Quantcast
Channel: RevitNetAddinWizard & NavisworksNetAddinWizard
Viewing all articles
Browse latest Browse all 872

Revit .NET API: No Full Circle Only Two Half Circles

$
0
0

In fact, we have addressed the issue recently in a few early posts, but it was not the focus there. If readers read those posts, they would have noticed the odd behavior already that a full circle Arc/Curve would fail for either profile construction or curve input for methods like Wall.Create.  

In this article, let’s summarize it a bit.

The following Arc/Curve which has a full circle range does not work for profiles, geometries, or Revit elements like walls, floors, slabs, and roofs.

...
    Arc arc = CachedDoc.Application.Create.NewArc(new Plane(new XYZ(0, 0, 1), XYZ.Zero), 10, 0, Math.PI * 2);
...

As discussed and demonstrated before, the following two half circles work fine for all these situations.

...
    CurveArray profile = new CurveArray();
    Arc arc1 = doc.Application.Create.NewArc(new Plane(normal, location), radius, 0, Math.PI);
    Arc arc2 = doc.Application.Create.NewArc(new Plane(normal, location), radius, Math.PI, 2 * Math.PI);
    profile.Append(arc1);
    profile.Append(arc2);
...

Why the oddity is there and why Revit API does not like full circle arc/curve at all is mysterious, but we believe the small finding which is not documented elsewhere will save people lots of trials and errors.

Revit Addin Wizard (RevitAddinWizard) provides various wizards, coders and widgets to help program Revit addins. It can be downloaded from the Download link at the bottom of the blog index page.


Viewing all articles
Browse latest Browse all 872

Trending Articles