Textnote vertical and horizontal alignment

Is anyone aware of a node that will create a textnote where both vertical and horizontal alignment can be set at the same time…or a workaround to do so?

Thanks in advance!

# Phython-Standard- und DesignScript-Bibliotheken laden
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

clr.AddReference("RevitAPI","RevitServices")
from Autodesk.Revit.DB import *
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
elements = UnwrapElement(IN[0])

if not hasattr(elements,"__iter__"):
	elements = [elements]
	
TransactionManager.Instance.EnsureInTransaction(doc)
for el in elements:
	el.HorizontalAlignment = HorizontalTextAlignment.Left
	el.VerticalAlignment = VerticalTextAlignment.Middle
	
TransactionManager.Instance.TransactionTaskDone()
OUT = elements

Do List.Flatten before you connect elements to it.

1 Like

@Deniz_Maral, this is great, thank you very much! Any guidance on what needs done to the python script so I can enter these two lists into the python block to assign the appropriate alignment per text note, based on what I pulled from a .dwg import instance?

Let’s see if it works :slight_smile:
Use List.Flatten after all nodes.


# Phython-Standard- und DesignScript-Bibliotheken laden
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

clr.AddReference("RevitAPI","RevitServices")
from Autodesk.Revit.DB import *
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
elements = UnwrapElement(IN[0])

vertical = IN[1]
horizontal = IN[2]

if not hasattr(elements,"__iter__"):
	elements = [elements]
	
TransactionManager.Instance.EnsureInTransaction(doc)
for el,ver,hor in zip(elements,vertical,horizontal):
	el.HorizontalAlignment = HorizontalTextAlignment[hor]
	el.VerticalAlignment = VerticalTextAlignment[ver]
	
TransactionManager.Instance.TransactionTaskDone()
OUT = elements

Yes, I think this did what I was looking for. I really need to teach myself some python! Thank you so much for the help!

1 Like