Control the laid out area of rebar set

Control the laid out area of rebar set

longt61
Advocate Advocate
1,830 Views
3 Replies
Message 1 of 4

Control the laid out area of rebar set

longt61
Advocate
Advocate

I am using Revit API to create a set of rebar for a beam. By default, when I change the layout rule (using Revit API as well as end user UI), no matter where I place my rebars, they will automatically adjust to spread out the entire face of the host (in this case, the top face of the beam).

However, I want to control the area that my rebars will be laid out so that they only cover a small part but not the entire face of the host when I change rebar layout rule (using Revit API). If I using the end user UI, I can manually grab the handle at the edge of rebar set then adjust the laid out-area after changing layout rule.
Please take a look at the images for better understanding.

I intend to switch from "single" rule (default) to "fixed number" rule. How can I do this? In the worst scenario, I can use "single" rule and place each of the rebar at the desire place, though. 

0 Likes
Accepted solutions (1)
1,831 Views
3 Replies
Replies (3)
Message 2 of 4

jeremytammik
Autodesk
Autodesk

I am checking with the development team for you...

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 4

jeremytammik
Autodesk
Autodesk
Accepted solution

The development team replied to your query and question whether you have read the documentation at all.

 

They say:

 

There is a difference between how the layout rule is changed from API or from UI. I’ll explain how it works from API for a Shape Driven Rebar.

 

We have a Rebar element. We obtain the RebarShapeDrivenAccessor and we will work with this class. There is a property called Normal. It represent the normal of the plane on which the rebar is bent. Also, based on this vector it will decide in which direction will expand the set.

 

The function 

 

  public void SetLayoutAsFixedNumber(
    int numberOfBarPositions, double arrayLength, 
    bool barsOnNormalSide, bool includeFirstBar, 
    bool includeLastBar);

 

has the following parameters:

 

  • numberOfBarPositions  - How many bars are in the set.
  • arrayLength – How long is the set - the distance between the first bar and the last bar in the set
  • barsOnNormalSide - In which part will go the set, in the direction of the normal or opposite.
  • includeFirstBar  - True if the first bar in set should be visible, false otherwise
  • includeLastBar - True if the last bar in set should be visible, false otherwise

 

So, when will change layout from single to any other layout the bar that you see on screen it will keep its position and will be the first bar in the set. It will calculate where is the last bar in the set according to the arrayLength and barsOnNormalSide and will distribute the bars between these two.

 

In order to obtain the result you can set layout with the array length equal with your zone length (the set will start from the existing bar on the screen)  and then you can move the Rebar element where you want.

 

Or, you can move the single bar where zone starts and then set layout with array length equal with your zone length.

 

I hope this helps.

 

Cheers,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 4 of 4

longt61
Advocate
Advocate

Thank you for your quick response, this solution surely make my day. I guess when some one is desperately scratching his head, something may not be as clear as it should be, even though I doubt that I would stumble on the method by myself any time soon. 

 

Thanks again.

0 Likes