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:
Hello all, I’m trying to relocate a few text elements. In the Revit API I can find this coord property which mentions a get and set. Does anyone know if it possible to use this set functionality? This is what I’ve got thus far: elements = UnwrapElement(IN[0]) newloc = UnwrapElement(IN[1]) newlocs = [] listout = [] for x in newloc: newlocs.append(x.ToXyz()) TransactionManager.Instance.EnsureInTransaction(doc) for i,e in enumerate(elements): loc = e.Coord #this doesn't work: new = ...Chris 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]
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, 07:16 PM -
-
Note: Thread split from another topic since it drifted a bit. Original topic here:
...-
Channel: Dynamo BIM
February 21, 2018, 02: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, 06: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, 04: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, 04:15 AM -
Comment