I have place a set of rebars in a viewPlan that only have 1 segment:
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
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.
Appreciate the reply Jeremy, I'll be more than glad to hear from the team
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:
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.
Thanks for your prompt reply!, I will explore what you've suggested this weekend