Lock/Constrain Dimensions

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.


it seems there is a Revit API property for setting the lock state:

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.


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
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

# Import RevitAPI
import Autodesk
from Autodesk.Revit.DB import *

dim = UnwrapElement(IN[0])

#start transaction

if dim.NumberOfSegments > 0:
    for dS in dim.Segments:
        dS.IsLocked = True
    dim.IsLocked = True

#finish transaction    

OUT = dim![Lock Dims|690x387](upload://tzIhHrU5fAMmUMniW0ta5R65cns.gif)
1 Like