Announcements
Autodesk Community will be read-only between April 26 and April 27 as we complete essential maintenance. We will remove this banner once completed. Thanks for your understanding

IsRebarInSection()

MiguelGT17
Advocate Advocate
309 Views
4 Replies
Message 1 of 5

IsRebarInSection()

MiguelGT17
Advocate
Advocate

I have place a set of rebars in a viewPlan that only have 1 segment:

MiguelGT17_0-1651726217067.png

 

I was expecting the IsRebarInSection() command to throw a true boolean as the rebars are shown as a cross section. If that is not the case, what this method stands for and which api method should I be looking up instead?

 

Test code:

foreach (Element element in rebars) {
				if (element is RebarContainer) {
					
				}
				else if (element is Rebar) {
					
					Rebar el = element as Rebar;
					if (el.IsRebarFreeForm() == true) {
						
					}
					else if(el.IsRebarShapeDriven() == true){
						RebarShapeDrivenAccessor acc=(element as Rebar).GetShapeDrivenAccessor();
						XYZ dir=acc.GetDistributionPath().Direction;
						
						double angle=dir.AngleTo(view.ViewDirection);
						angle=angle*(180/Math.PI); //90,0
						stb.AppendLine(angle.ToString());
						stb.AppendLine(el.IsRebarInSection(view).ToString());

				
				}
			}
			TaskDialog.Show("dd",stb.ToString());

Best Regards

0 Likes
310 Views
4 Replies
Replies (4)
Message 2 of 5

jeremy_tammik
Autodesk
Autodesk

And yet again: This sounds like a request for some in-depth rebar API expertise beyond my limited ken, so I asked the devteam for you. I hope we can find an efficient way to address your very valid questions. 

  

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

MiguelGT17
Advocate
Advocate

Appreciate the reply Jeremy, I'll be more than  glad to hear from the team

0 Likes
Message 4 of 5

StefanDobre
Autodesk
Autodesk

IsRebarInSection(View view) returns true only if the view is a section or elevation and the view plane is cutting at least one of the rebar curves, false otherwise.

This API function is the correspondent of this UI option:

IsRebarInSection.png

 

In your case,  to see that the straight bar is shown as a point you can verify this on your own. You can get the centerline curves like this rebar.GetTransformedCenterlineCurves(false, true, true, MultiplanarOption.IncludeOnlyPlanarCurves, 0);, You will get only one line. If the line’s direction is parallel with view’s direction it means that the bar is shown as a cross section, false otherwise.

Message 5 of 5

MiguelGT17
Advocate
Advocate

Thanks for your prompt reply!, I will explore what you've suggested this weekend

0 Likes