Coordinate issue with CreateNewDimension using Revit API with C#

Coordinate issue with CreateNewDimension using Revit API with C#

Deepanshu_Vashishtha4SDTX
Explorer Explorer
280 Views
2 Replies
Message 1 of 3

Coordinate issue with CreateNewDimension using Revit API with C#

Deepanshu_Vashishtha4SDTX
Explorer
Explorer

I am developing an add-in that creates dimensions for a viewsheet. I need to ensure that the dimension text position does not intersect with the dimension segments (which may consist of one or multiple segments). However, when I checked this using the code below, I encountered exceptions for certain properties of the dimension objects (such as leader end position, origin, and text position), though the dimensions were successfully created.

Dimension dimTB = doc.Create.NewDimension(dim.view, dim.Line, dim.References, dim.DimensionType);

 

I also attempted to retrieve the above properties after committing the transaction, but I am still encountering the same exception issue.

My goal is to create dimensions for different views in a way that ensures they are neat and easily readable for the user, meaning there should be no intersections.

Deepanshu_Vashishtha4SDTX_0-1742233115145.png

The above after creating the dimension using the above line of code.

Deepanshu_Vashishtha4SDTX_1-1742233169949.png
and this is the goal to do after or while creating the dimension for the viewsheet.

Please provide me what could be the best solution for this. Thanks in advance.

0 Likes
281 Views
2 Replies
Replies (2)
Message 2 of 3

jeremy_tammik
Alumni
Alumni

That sounds like a non-trivial task to me. Please refer to this previous solution and let us know whether it helps address your issue:

  

  

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

Deepanshu_Vashishtha4SDTX
Explorer
Explorer

Thanks for your response! I will check the thread and get back to you shortly to let you know whether it helps me resolve the issue or not.

0 Likes