Move text notes by cordinates

Can someone explain to me where I am i going wrong…?

How to move or translate the text notes…? Any nodes/codes…??

Also verified that the point has a location,hence should idealy change without having to code on python…!
its also fails with spring node(attempts to change but coordinates remain the same)

At first glance it looks like there’s no “easy” way to do this. I don’t think text notes will move like other elements because they require a referencing view since they’re annotation elements. Your best bet would probably be to place new elements at the new locations and delete the old ones.

Hi @saju_autodesk @Nick_Boyts

How about this?

@Kulkul to the rescue!

As always :smile:
import clr
from System.Collections.Generic import *
clr.AddReference(‘RevitAPI’)
from Autodesk.Revit.DB import *
import Autodesk

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
items = {UnwrapElement(IN[0])}
xyz = UnwrapElement(IN[1]).ToXyz()

ids = list()
for item in items:
	ids.append(item.Id)	
itemlist = List[ElementId](ids)

TransactionManager.Instance.EnsureInTransaction(doc)

moveditems = ElementTransformUtils.MoveElements(doc,itemlist,xyz)

TransactionManager.Instance.TransactionTaskDone()
5 Likes

Thanks a lot Kulkul for your assistance…! I have created my First python script…!

import clr

clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *
clr.AddReference(“RevitAPI”)
clr.AddReference(“RevitNodes”)
clr.AddReference(“RevitServices”)
clr.AddReference(‘RevitAPIUI’)
import Autodesk
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
from Autodesk.Revit.DB import *
from Autodesk.DesignScript.Geometry import *
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc= DocumentManager.Instance.CurrentDBDocument
TransactionManager.Instance.EnsureInTransaction(doc)

TextNoteId= UnwrapElement(IN[0]).Id
NewLocation=UnwrapElement(IN[1]).ToXyz()

#The inputs to this node will be stored as a list in the IN variables.
Move=ElementTransformUtils.MoveElement(doc,TextNoteId,NewLocation)

TransactionManager.Instance.TransactionTaskDone()

#Assign your output to the OUT variable.
OUT = IN[0]

Also I would start a new post to know the possible drawbacks of importing so many modules into library
I do this because often I get confused on what to import for what…!

@saju_autodesk please mark the post as solved. You’re welcome!

When passing a list instead of an element this struck can u help me how to choose the levels(l1,l2) in the node through python I am trying it but gives an Attribute error saying

AttributeError: ‘List[object]’ object has no attribute ‘Id’

finally here…! successfully aligned the text notes as required thanks @Kulkul and @Nick_Boyts…!

text.dyn (45.0 KB)

Alright…! now its time to move to next step starting a new topic" Extracting leader curves from text note " see you there…!

@Kulkul Could you show me how to use the similar method to rotate the text instead of moving it?

Hate to dig this one up. Could someone please show me a snapshot of what @Kulkul 's python node should look like in the editor? I’m having issues recreating it.

Hi @manderson557

Copy paste below script in python editor:

import clr
from System.Collections.Generic import *
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
import Autodesk

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
items = {UnwrapElement(IN[0])}
xyz = UnwrapElement(IN[1]).ToXyz()

ids = list()
for item in items:
	ids.append(item.Id)	
itemlist = List[ElementId](ids)

TransactionManager.Instance.EnsureInTransaction(doc)

moveditems = ElementTransformUtils.MoveElements(doc,itemlist,xyz)

TransactionManager.Instance.TransactionTaskDone()
3 Likes

Thank You!!

Hello @Kulkul ,

I was hoping to use your script for “Material Tags”, but I get an error on the python note that the elements don’t have an Element ID (line 24: "itemlist = ListElementId).

I was looking for a fix to the annoying issue of Material Tags loosing their reference briefly. There are ideas floating around to move them slightly back and forth, though I couldn’t find a definite answer on the forum. Is this a hopeless quest?

Thanks,
Philipp


the python code can deal with on annotation
but do not work when select one more annotations
shall i modify the code?
need your help
thanks a lot!

Hi,

For tags, you should use another method and the Tag SetLocation node.
For other elements, ust the universal Element SetLocation node.

3 Likes

Hello, can you explain please were you get that “text location” node? is from a package or is that the python script?