Dimension origin issue and setting a new location

According to the these nodes the Origin of the Dimension is the middle of the (Segment) Line.
When i want to set a new location the Dimension ends up in a different location than I expected.

Hi @bvs1982, use a line instead of points for the element set location node. The dimension is line-based, not point-based.

I am pretty sure that is not the problem / solution. See also this :point_down:.

From that topic

Here you see a point is used to set the location.

@Alban_de_Chasteigner any idea why this is?

1 Like

After some encouragement of @jacob.small :stuck_out_tongue_winking_eye: i looked into it a bit more.

It only goes wrong when the dimension is a mutliple segment dimension.
It works fine if it is a single segment dimension :thinking:.

1 Like

Looks like an issue with the GeniusLoci node. Guessing it’s using the Origin property which isn’t valid on multi segment dimensions as per the API documentation.

This Python code may work out. I’ve tested with both multi segment and single segment dimensions. Input 0 is the dimension, and Input 1 is the target point as a Dynamo point (not a Revit XYZ). Takes matching list structures or single items; if you feed it a nested list it’ll fail though as it’s not a custom node.

########################################
############## Properties ##############
########################################
__author__ = 'Jacob Small'
__version__ = '0.1.0'
__description__ = ""
__RevitBuilds__ = "2025.3"
__DynamoBuilds__ = "3.2.2"
__ReleaseNotes__ = "Not completely tested. Test before implementing in production."
__Dependancies__ = "None"
__Copyright__ = "2025, Autodesk Inc."
__License__ = "Apache 2.0"



########################################
### Configure the Python environment ###
########################################
### standard imports ###
import sys #add the sys class to the Python environment so we can work with the sys objects
import clr #add the CLR (common language runtime) class to the Python environment so we can work with .net libraries

### basic Dynamo imports ###
clr.AddReference('ProtoGeometry') #add the Dynamo geometry library to the CLR
from Autodesk.DesignScript import Geometry as DG #add the Dynamo geometry class using the alias DG, to ensure no overlap between class calls in Revit or Dynamo

### Dynamo Revit imports ###
clr.AddReference("RevitNodes") #add Dynamo's Revit nodes library to the clr
import Revit #import Dynamo's Revit node class
clr.ImportExtensions(Revit.Elements) #add the element conversion methods to the CLR
clr.ImportExtensions(Revit.GeometryConversion) #add the geometry conversion methods to the CLR
clr.AddReference("RevitServices") #add the Revit services library to the CLR
import RevitServices #import the Revit services class to the Python environment
from RevitServices.Persistence import DocumentManager #import the document manager class to the Python environment 
from RevitServices.Transactions import TransactionManager #import the transaction manager class to the Python environment 

### Revit API imports ###
clr.AddReference("RevitAPI") #add the Revit API to the CLR
import Autodesk #add the Autodesk class to the Python environment 
from Autodesk.Revit.DB import * #import every class of the Revit API to the Python environment



#########################################
###### Global variables and inputs ######
#########################################
### documents and standard variables ###
doc = DocumentManager.Instance.CurrentDBDocument #the current Revit document

### imports and unwrapping ###
dims = UnwrapElement(IN[0]) #import the dimensions from IN[0] of the Dynamo environment and convert to native Revit elements
if not dims.__class__ == [].__class__ : dims = [dims] #ensure that dims is a list, not an individual object, so that we can always prepare for a loop
targets = IN[1] #import the target points from IN[1] of the Dynamo environment
if not targets.__class__ == [].__class__: targets = [targets] #ensure that targets is a list so that we an always prepare for a loop

dimClasses = [LinearDimension] #a list containing all valid dimension classes for relocating. Using this to allow for expansion beyond linar dimension types someday in the future
OUT = [] #set OUT to a list which will contain the results

TransactionManager.Instance.EnsureInTransaction(doc) #start transaction
if len(dims) != len(targets): sys.exit("\r\rTheLength of the dimensions list and targets list does not match. Review inputs and try again.\r\r") #stop execution if the number of dimensions doesn't match the number of targets
for dim, target in zip(dims, targets): #for each dimension and target pair
    if not dim.__class__ in dimClasses : #check if the dimension object is a Revit Dimension
        msg = "Object is not a dimension. Revise selection and try again." #build a informative message if not
        results.append(msg) #add the message to the results
    elif not target.__class__ == DG.Point : #check if the target is a Dynamo Point
        msg = "Target is not a Dynamo point. Revise input and try again." #build a informative message if not
        results.append(msg) #add the message to the results
    else: #if both object checks pass
        crv = dim.Curve #get the curve
        loc = crv.Evaluate(0,False) #get the start point
        pnt = target.ToRevitType() #get the target point as a Revit XYZ
        vec = pnt.Subtract(loc) #build a new XYZ for the offset vector between the target point and the current location
        dim.get_Location().Move(vec) #move the dimension's location by the vector
        msg = "Dimension moved to align with target" #build an informative message
        OUT.append(msg) #add the message to the results

TransactionManager.Instance.TransactionTaskDone() #end transaction

Thanks for looking into this, I’ll try your code later when i have some time again.

Hi @bvs1982 not sure if something here could work…maybe

Revit_XGjdbFktrJ

Where is this node from?

image

yeah just my bad homebrew and isnt public yet and probably never come;) :wink: just dyf…but something her should work as well…