I am wondering if it is possible to lock/constrain all “segments” of a dimension string in dynamo. Looking to ensure a bunch of curtain walls don’t get their patterns changed on me.
Thanks!
I am wondering if it is possible to lock/constrain all “segments” of a dimension string in dynamo. Looking to ensure a bunch of curtain walls don’t get their patterns changed on me.
Thanks!
it seems there is a Revit API property for setting the lock state:
https://www.revitapidocs.com/2015/496d64c6-3642-577d-7631-96956baed820.htm
However, looking at the remarks, it may not work on a string of dimensions:
This property always returns false if the dimension is a radial or spot dimension. This property cannot be set if the dimension has been labeled, or if the dimension shape is arc-length, radial, diameter or spot, or if the dimension is linear with more than one segment.
Hey,
That is true, but there is a different property which works for a dimension ‘segment’ see if this works for you…
import clr
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
dim = UnwrapElement(IN[0])
#start transaction
TransactionManager.Instance.EnsureInTransaction(doc)
if dim.NumberOfSegments > 0:
for dS in dim.Segments:
dS.IsLocked = True
else:
dim.IsLocked = True
#finish transaction
TransactionManager.Instance.TransactionTaskDone()
OUT = dim