I want to turn on the “leader” for a generic annotation. Cannot find a parameter or node to do so. Is this one of those can’t happen or unique yet to be noded (yes new verb “node’d”)scenarios?
Leaders are obsolete for annotations? lol
an example with a list of points
import clr import sys import System clr.AddReference('ProtoGeometry') from Autodesk.DesignScript.Geometry import * import Autodesk.DesignScript.Geometry as DS #import Revit API clr.AddReference('RevitAPI') import Autodesk from Autodesk.Revit.DB import * import Autodesk.Revit.DB as DB clr.AddReference('RevitNodes') import Revit clr.ImportExtensions(Revit.GeometryConversion) clr.ImportExtensions(Revit.Elements) clr.AddReference('RevitServices') import RevitServices from RevitServices.Persistence import DocumentManager from RevitServices.Transactions import TransactionManager doc = DocumentManager.Instance.CurrentDBDocument annot = UnwrapElement(IN) lstPoint = IN for pt in lstPoint: annot.addLeader() leaders = annot.GetLeaders() for pt, l in zip(lstPoint, leaders): l.End = pt.ToXyz() OUT = annot.GetLeaders()
Thanks for the help but it is saying an error on line 30. SImilar to when I tried to hack the leader using set parameter “Leader Line” haha
I can add the leader to the family manually I am also feeding 186 families and 186 points.
Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 30, in
AttributeError: ‘List[object]’ object has no attribute 'addLeader
can you post a screenshot of your graph with showing the structure of the inputs lists?
I recreated my tag family with a revit 2020 family template but still same result.
the python script provided is meant for a list of points and a list of elements.
You provide it with a single element.
Take the element and set it to a list with a code block like
[your_element] and feed it to the python script. That should do the trick
Two equal length lists still same error on line 30
AddLeaderToGenericAnnotation.dyn (12.6 KB)
import clr import sys import System clr.AddReference('ProtoGeometry') from Autodesk.DesignScript.Geometry import * import Autodesk.DesignScript.Geometry as DS #import Revit API clr.AddReference('RevitAPI') import Autodesk from Autodesk.Revit.DB import * import Autodesk.Revit.DB as DB clr.AddReference('RevitNodes') import Revit clr.ImportExtensions(Revit.GeometryConversion) clr.ImportExtensions(Revit.Elements) clr.AddReference('RevitServices') import RevitServices from RevitServices.Persistence import DocumentManager from RevitServices.Transactions import TransactionManager doc = DocumentManager.Instance.CurrentDBDocument toList = lambda x : x if hasattr(x, '__iter__') else [x] annotSybs = toList(UnwrapElement(IN)) lstPoint = toList(IN) # TransactionManager.Instance.EnsureInTransaction(doc) for pt, annot in zip(lstPoint,annotSybs) : annot.addLeader() leaders = annot.GetLeaders() leaders.End = pt.ToXyz() TransactionManager.Instance.TransactionTaskDone() # OUT = annotSybs
Entry lists must have the same length
Awesome!!! Works now I will implement in big graph and post the results here in the coming weeks.
AddLeaderToGenericAnnotation.dyn (12.7 KB)
Sneak peak at the graph which this feeds into
MoveGenericAnnoInCurrentView.dyn (152.9 KB)
Script before these scripts
MoveTagsInCurrentView.dyn (92.6 KB)
Bonus Script so simple but helpful
AddSpaceBoundaryToLines.dyn (8.0 KB)
Not that you need any of them but the guys that come looking at this thread may
So far I am feeling confident I can get the method to work, brain is slightly on fire but process has been made. I ended up using the center point of the GA family, offset that value to create a “artificial” bounding box for the GA, take those points increase by 5% and create a no go zone box around each GA, use the point prior to the 5% increase and the polygon containment test to test my expanded rectangle vs the non scaled points to find out which tags overlap. Now I intent to use that boolean to isolate the tags which overlap and move them apart. Already worried about how moving them could move them into another tags no go zone haha and hence I am done for a friday haha. O well its all learning. Feel free to chime in and school me on my atrocious work arounds haha
MoveGenericAnnoInCurrentView.dyn (177.1 KB)
If I have four points and take those points and multiply each of their xy components by 10% to create a polygon, the original four points always have to be within the area of the scaled polygon. True or false…please tell me true lol, my brain can’t handle false haha
Take a rectangle with these points: (10,0),(20,0),(20,10),(10,10). Scale the numbers by multiplying by 1.10 and you get: (11,0), (22,0), (22,11), (11,11). The previous 10,0 and 10,10 are outside the bounds of the newly scaled numbers.
Try this: Build a plane from the points (Plane.ByBestFit), and pull that plane’s coordinate system. Scale the coordinate system by 0.1, and then you can apply that CS to the points.
But my rectangle is relative to its own center so it will never have a “0” point, unless I am highly unlucky and the corner ends right on the offset point. The zero is the only thing messing up the math?
Regardless I kept reading about surfaces/coordinate systems, tried to “patch” the rectangles to a surface but could not get anything of use that is when I started down this rectangle path. Honestly not even sure what patching is, I understand geometry planes, vectors, etc reading the introduction again now actually…and maybe something just clicked lol…Coordinate systems have bounds don’t they, so if I scale they system its a “unilateral” scale in that plane which is perfect. What do you mean by apply the CS to the points?
Its frustrating because I have everything I need just can’t get it to come together but this time I will not be giving up so easily as before haha. Feel close.
The four points of one rectangle are definitely inside the other but dynamo does not agree LOL
Going to try the coordinate system/surface method again. Thanks for the help
MoveGenericAnnoInCurrentView.dyn (218.6 KB)
What do you get if you ask for a bounding box from the object?
Note that the Y values could be changed to 10 and 12 and the result would still apply.
A coordinate system doesn’t have a bounds either - they are infinite in the local X, Y and Z vectors.
Patching will take a closed curve and build a surface that consists of all the points inside the closed curve. Dynamo Dictionary
I couldn’t get a bounding box from the Generic Annotation (GA) so I got the center point offset from that point the bounds of the GA tag to “create” (hack to death) a bounding box, then I create detail lines to visualize the box in revit, then I scale the box, then I query the scaled box for the original points, graphically shows as expected but dynamo says only two points in the rectangle but the visual check says otherwise.
I got to write some numbers on a page now to see about the math above again, I think I am right due to the nature of the script. I could be wrong for sure and thinking I must to wrong but my brain keeps saying no your right