How to create an Arc Length Dimension in a doc view?

How to create an Arc Length Dimension in a doc view?

ediloreto8W6MG
Participant Participant
508 Views
7 Replies
Message 1 of 8

How to create an Arc Length Dimension in a doc view?

ediloreto8W6MG
Participant
Participant

I've tried using AngularDimension but only shows the angle of the arc. It has a property called "DimensionShape" that is read only. I cannot set it to ArcLength.

 

Any solutions?

0 Likes
509 Views
7 Replies
Replies (7)
Message 2 of 8

jeremy_tammik
Alumni
Alumni

This issue was raised repeatedly recently:

  

https://forums.autodesk.com/t5/forums/searchpage/tab/message?advanced=false&allow_punctuation=false&...

  

Please always search for existing threads before raising a new one. Thank you!

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 3 of 8

architect.bim
Collaborator
Collaborator

Hi!

To do this, you need to select the correct DimensionType object in the project. You can do this via the FilteredElementCollector class or directly by the Id value (you can find it out with RevitLookup by creating a dimension manually in the project and looking up the Id of its dimension type).

 

Here is a small example of creating a dimension that shows the arc length of the detail line. Note that you need to set the ComputeReferences property in the Options object to be able to get references to the start and end of the arc.

In this code, the dimension will be created at the same location as the original arc. If you want to place the dimension somewhere else, you have to offset the original arc and pass it instead of the original arc.

options = DB.Options()
options.ComputeReferences = True
arc = detail_line \
    .Geometry[options] \
    .Where(lambda x: isinstance(x, DB.Arc)) \
    .First()
dimension_type = doc.GetElement(DB.ElementId(2530))
with DB.Transaction(doc, 'Create Arc Length Dimension') as t:
    t.Start()
    DB.AngularDimension.Create(
        doc,
        doc.ActiveView,
        arc,
        [
            arc.GetEndPointReference(0),
            arc.GetEndPointReference(1)
        ],
        dimension_type
    )
    t.Commit()

Maxim Stepannikov | Architect, BIM Manager, Instructor
0 Likes
Message 4 of 8

ediloreto8W6MG
Participant
Participant

Thanks for the response. Still I'm getting the dimension with the angle parameter. This is what I was doing.

 

The weird thing is that the dimension get created properly if i do it manually.

Message 5 of 8

ediloreto8W6MG
Participant
Participant
I did a quick search, but I couldn't found any solution. I've tried all the "solutions" I found.
Message 6 of 8

jeremy_tammik
Alumni
Alumni

Please add your comments, use case, business requirements and vote to the wish list request in the Revit Idea Station:

   

https://forums.autodesk.com/t5/revit-ideas/api-create-arc-length-and-radial-dimensions/idi-p/7003021

    

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 7 of 8

jeremy_tammik
Alumni
Alumni

Hi Maxim, are you saying that this can be done, and that the wish list item in the idea station is unnecessary? 

  

https://forums.autodesk.com/t5/revit-ideas/api-create-arc-length-and-radial-dimensions/idi-p/7003021

  

That would be great! Thank you!

    

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 8 of 8

architect.bim
Collaborator
Collaborator

@ediloreto8W6MG @jeremy_tammik

Sorry, guys. I seem to have misled you. I didn't notice that I was creating the angular dimnesion as well. My apologies!


Maxim Stepannikov | Architect, BIM Manager, Instructor
0 Likes