I can't get location of Text Notes elements by Element.GetLocation. Is there any way i can get the location?
Announcement
Collapse
No announcement yet.
TextNotes location
Collapse
X
-
In the API, TextElements have a .Coord property that stores the position. Looks do-able with some python work, see here:
https://forum.dynamobim.com/t/set-lo...t-element/5700Chris Ellersick
-
Hello HandyAndy,
You need to write it as the following:
And you should be able to copy and paste the following into your Python node
Code:[COLOR=#75715e]# Importing the 'Common Language Runtime' library[/COLOR] [COLOR=#f92672][B]import[/B][/COLOR] clr [COLOR=#75715e]# Adding specific references: The Revit API[/COLOR] clr.[COLOR=#ffffff][B]AddReference[/B][/COLOR]([COLOR=#e6db74]'RevitAPI'[/COLOR]) [COLOR=#f92672][B]from[/B][/COLOR] Autodesk.Revit.DB [COLOR=#f92672][B]import[/B][/COLOR] * clr.[COLOR=#ffffff][B]AddReference[/B][/COLOR]([COLOR=#e6db74]'RevitNodes'[/COLOR]) [COLOR=#f92672][B]import[/B][/COLOR] Revit [COLOR=#75715e]# Importing specific extension methods that allow us to gain[/COLOR] [COLOR=#75715e]# information such as 'Coord' data[/COLOR] clr.[COLOR=#ffffff][B]ImportExtensions[/B][/COLOR](Revit.GeometryConversion) clr.[COLOR=#ffffff][B]ImportExtensions[/B][/COLOR](Revit.Elements) [COLOR=#75715e]# Creating an empty list that we populate later[/COLOR] OUT = [] [COLOR=#75715e]# Running a 'for loop' over everything inside our input list[/COLOR] [COLOR=#75715e]# by Unwrapping them (Which is requried between Revit and Dynamo[/COLOR] [COLOR=#75715e]# objects[/COLOR] [COLOR=#f92672][B]for[/B][/COLOR] item [COLOR=#f92672][B]in[/B][/COLOR] [COLOR=#ffffff][B]UnwrapElement[/B][/COLOR](IN[[COLOR=#ae81ff]0[/COLOR]]): [COLOR=#75715e]# For our 'for loop' to work, we need to indent as Python is [/COLOR] [COLOR=#75715e]# very particular about indentation. We simply then 'nest' in[/COLOR] [COLOR=#75715e]# our line of code an appendation of each 'looped' item into[/COLOR] [COLOR=#75715e]# our previously created empty list. We then 'cast' the data[/COLOR] [COLOR=#75715e]# to a Point (Which dynamo can read)[/COLOR] OUT.[COLOR=#ffffff][B]append[/B][/COLOR](item.Coord.[COLOR=#ffffff][B]ToPoint[/B][/COLOR]()) [COLOR=#75715e]# Natively, Dynamo understands that the OUT is our output, so[/COLOR] [COLOR=#75715e]# pushes this data through the node out port [/COLOR]
Attached Files
Sol Amour
Architectural Explorer, Digital warrior, Affectual adventurer and Curious Human Being
Portfolio Website @ Cargo Collective
Comment
Related Topics
Collapse
-
I'm trying to use FamilyInstance.SetRotation within a Python script, but the objects are being rotated using arround, I believe, the project origin....
-
Channel: Dynamo BIM
April 24, 2016, 06:16 PM -
-
Note: Thread split from another topic since it drifted a bit. Original topic here:
https://www.revitforum.org/dynamo-bi...etail-level.ht...-
Channel: Dynamo BIM
February 21, 2018, 01:44 PM -
-
Hi.
I obtained the following script from Dynamo BIM
which I subsequently tweaked to selected the already generated part....-
Channel: Dynamo BIM
July 13, 2018, 05:58 AM -
-
for instance, i have Revit API Python code (by Gui Talarico) to create drafting view which can run @ RevitPythonShell
from Autodesk.Revit.DB import...-
Channel: Dynamo BIM
April 27, 2018, 03:28 PM -
-
The Revit API is actually something pretty special. People will go on and on about how Revit needs this feature or that feature, but the fact...-
Channel: Blog Feeds
October 16, 2017, 03:15 AM -
Comment