Hello all, I have a problem, I am successfully creating dimensions in views but the dimension elements appear in a position not expected not set by script, although I see if I select the dimensions and move pan around then they look like expected, but I need to move all of them manually. I tried to move them with python script using Location.Move method but I do not see any differences.
I tried something like that in python node of Dynamo:
# Start a new transaction
TransactionManager.Instance.EnsureInTransaction(doc)
# Define the translation vectors for moving the dimensions
translation_vectors = [XYZ(-10.1, 0, 0),XYZ(0.1, 0, 0),XYZ(0, 0.1, 0),XYZ(0, -0.1, 0)]
for dim_list in dimensions:
for dim in dim_list:
location = dim.Location
if isinstance(location, LocationCurve) or isinstance(location, LocationPoint):
for translation in translation_vectors:
try:
# Attempt to move the dimension
moved = location.Move(translation)
except Exception as e:
# Record any exceptions that occur during the move
debug_messages.append("Error moving dimension ID {}: {}".format(dim.Id, str(e)))
continue # Continue with the next dimension or translation vector
TransactionManager.Instance.TransactionTaskDone()