Hello,
I am trying to Align, and Constrain Revit Lines with Dynamo, like we are doing in Revit. But I dont find any nodes for “Align” or “Constrain”?
In Revit it looks like this:
Align:
Constrain:
Every help would be great
Thanks
Hello,
I am trying to Align, and Constrain Revit Lines with Dynamo, like we are doing in Revit. But I dont find any nodes for “Align” or “Constrain”?
In Revit it looks like this:
Align:
Every help would be great
Thanks
I have also the same kind of problem. Seems like no one encountered the problem of aligning 450 columns to grids for each floor.
Hey,
Welcome to the community, I don’t believe the Revit ‘Align’ tool is exposed in the API, so Dynamo can’t use it.
There is an Align method exposed, but it is the Lock part ie. the elements must be already aligned.
https://www.revitapidocs.com/2015/b3c10008-aba6-9eee-99c9-7e05ace75796.htm
Some discussion here:
However, it is possible to extract the geometry of the grids and columns, do some maths, then move the location (and/or change rotation) to coordinate the elements.
Have a go, if you get stuck post your graph
Good luck!
Mark
Hello Mark,
Thank you very much for your welcoming. I researched a lot about this topic and encountered the discussions you shared. I am good at Dynamo but not with Python so Revit API. I simply need to solve the “Lock” part after the alignment.
I tried something but it gives an error saying the NewAlignmentMethod needs 4 tokens (3 given). It would be great if you can help me to understand what I am doing wrong. I tried to add a “True” value as the 4th parameter then it says “TypeError: expected ItemFactoryBase, got FloorPlanView.” I just want to understand how I can make the method run properly. I am using the GeniusLoci package to get references of elements. Most of the examples are in C# and work fine with 3 parameters but in Dynamo Python with Revit API library, it is giving some kind of errors.
Here is my full script:
# The inputs to this node will be stored as a list in the IN variables.
import clr
clr.AddReference("ProtoGeometry")
from Autodesk.DesignScript.Geometry import *
# Import RevitAPI
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *
from Autodesk.Revit.Creation import *
clr.AddReference("RevitAPIUI")
from Autodesk.Revit.UI import TaskDialog
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
# Import ToProtoType, ToRevitType geometry conversion extension methods
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
from Autodesk.Revit.DB import Options
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
options = Options()
options.ComputeReferences = True
options.IncludeNonVisibleObjects = True
dataEnteringNode = IN
view = IN[0]
ref1 = IN[1]
ref2 = IN[2]
b = ItemFactoryBase.NewAlignment(view, ref1, ref2, True)
b.IsLocked = True
OUT = b
Hello Mark,
I solved it. Thank you very much. Here is the final pyhton script.
# The inputs to this node will be stored as a list in the IN variables.
import clr
clr.AddReference("ProtoGeometry")
from Autodesk.DesignScript.Geometry import *
# Import RevitAPI
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *
from Autodesk.Revit.Creation import *
clr.AddReference("RevitAPIUI")
from Autodesk.Revit.UI import TaskDialog
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
# Import ToProtoType, ToRevitType geometry conversion extension methods
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
from Autodesk.Revit.DB import Options
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
options = Options()
options.ComputeReferences = True
options.IncludeNonVisibleObjects = True
dataEnteringNode = IN
view = doc.ActiveView
ref1 = IN[1]
ref2 = IN[2]
TransactionManager.Instance.EnsureInTransaction(doc)
b = doc.Create.NewAlignment(view, ref1, ref2)
b.IsLocked = True
TransactionManager.Instance.TransactionTaskDone()
OUT = b
Great work
Hello, could you please place this dynamo file here?