Flip Baseline Dimension Direction

Flip Baseline Dimension Direction

asa_xiao
Participant Participant
930 Views
8 Replies
Message 1 of 9

Flip Baseline Dimension Direction

asa_xiao
Participant
Participant

Hi,

 

I'm trying to create baseline dimensions via Revit API. While I've successfully created the dimension, its direction is not ideal, and this is quite important for baseline dimensions. Usually when creating dimensions via the Revit GUI, the order in which elements are selected significantly impacts the resulting dimension direction. However, using the API, I found that the order of the ReferenceArray doesn't influence the dimension direction at all.

 

(Below is what I get if I use the API to create the baseline dimension, but I want all dimensions to reference the gridline)

asa_xiao_0-1726259320922.png


So my question is, is there a way to flip dimension direction using the API, similar to selecting the dimension object and press the Spacebar, or right-clicking and choosing 'Flip Dimension Direction'?

asa_xiao_1-1726259399637.png

 

0 Likes
Accepted solutions (2)
931 Views
8 Replies
Replies (8)
Message 2 of 9

jeremy_tammik
Alumni
Alumni

As you say and as the Revit online help suggest, you can use the flip controls in the user interface to change the direction:

  

  

So, it would be nice to have programmatic access to these controls. Maybe we do. Can you check the dimension properties and parameters via RevitLookup and other database exploration tools to see whether any changes are apparent via API when using the UI flip controls?

  

Meanwhile, I also asked the development team for you.

   

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

asa_xiao
Participant
Participant

Hi Jeremy,

 

Thanks for your reply. 

From what I can see, when I do the flip, the orders of the References and Segments change. However I don't see a relationship between the order of the array and order of stacking, it seems pretty random to me (ex. the first one is the one in the middle).

0 Likes
Message 4 of 9

asa_xiao
Participant
Participant

Hi Jeremy,

 

have you heard back from the development team by any chance?

0 Likes
Message 5 of 9

jeremy_tammik
Alumni
Alumni

Nope, not yet. I re-prompted for you...

   

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

jeremy_tammik
Alumni
Alumni
Accepted solution

It is currently not possible to flip the baseline dimension through API, because the class BaselineLinearDimState is not yet exposed in the public API. The devteam is thinking of doing so in a future release. Maybe you would also like to raise a wish for this in the Revit Idea Station to increase its priority.

   

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

jeremy_tammik
Alumni
Alumni

The ticket number is REVIT-227496. Please make a note of that for future reference. Thank you.

    

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

asa_xiao
Participant
Participant
Thank you Jeremy
0 Likes
Message 9 of 9

iris_inokhosa3RCCN
Explorer
Explorer
Accepted solution

I had the same issue, the order of ReferenceArray does not affect the dimension direction, however the Line direction do. It looks like that behind the scene, ReferenceArray is sorted towards the Line. You can try it just by flipping the original Line, like this.

var flippedLine = line.CreateReversed() as Line;
var dimension = doc.Create.NewDimension(view, flippedLine, dimLine.ReferenceArray);

 Unfortenatelly you can't modify existing dimension, because dimension.Curve is read-only property, so you have to create a new one, with the right line direction.