ArcLengthDimension

Hello everyone,

I’m trying the apply the NewArcLengthDimension method from the Revit 2017 API to a dynamo python node

To create dimensions for Arcs, but I’m still new to Dynamo and Python can someone help with that

http://www.revitapidocs.com/2017/a33279db-ba00-7cb7-1cea-9f4eac33b747.htm

im not found the solution but
im think its must looks like this:

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
from Revit.Elements import *

clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
    
arc=UnwrapElement(IN[0]).GeometryCurve 
arc_ref=arc.Reference

refs = ReferenceArray()
refs.Append(UnwrapElement(arc).GetEndPointReference(0))
refs.Append(UnwrapElement(arc).GetEndPointReference(1))


TransactionManager.Instance.EnsureInTransaction(doc)

dimension =doc.FamilyCreate.NewArcLengthDimension(doc.ActiveView, arc, arc_ref, refs)

TransactionManager.Instance.TransactionTaskDone()

OUT =arc, arc_ref, refs, dimension

And may be anybody explain how correctly use FamilyItemFactory Class
because of for example we cant use :
dimension =doc.Create.NewArcLengthDimension(doc.ActiveView, arc, arc_ref, refs)
its - not a ItemFactoryBase Class

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
from Revit.Elements import *

clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
    
arc=UnwrapElement(IN[0]).GeometryCurve 
arc_ref=arc.Reference

ref1=UnwrapElement(arc).GetEndPointReference(0)
ref2=UnwrapElement(arc).GetEndPointReference(1)

TransactionManager.Instance.EnsureInTransaction(doc)

dimension = doc.FamilyCreate.NewArcLengthDimension(doc.ActiveView, arc, arc_ref, ref1, ref2)

TransactionManager.Instance.TransactionTaskDone()

OUT =arc, arc_ref, dimension

This seems to work for me in a family. But I think the method is not available in the project environment.
I get:
"Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 29, in
AttributeError: ‘Document’ object has no attribute ‘NewArcLengthDimension’ "

1 Like

You are right @viktor_kuzev its work only inside of family! …
I am think what is so strange… I think it’s useless if only works inside family

May be exist another way (Using Revit API) to do this in revit Document ?

and may be:


we can do it in revit manually:

this means that we can do it in Revit API! Right?

I went through the Revit API but the method is only available within a family unfortunately

had the same issue when I tried doc, i though maybe something wrong with my code that’s why I asked for help

It should be but unfortunately I don’t know how, Will keep looking in the Revit API maybe there is something else