Jump to content

Sketch circle is always stored as two half arcs, even when drawn with the Circle tool?


Recommended Posts

Posted

Small Revit API finding, and a question for anyone who knows the answer.
 

When I create a family extrusion through the API from one full closed circle (Arc.Create, 0 to 2π), Revit saves the sketch as two half arcs.
 

Then I checked Autodesk's own M_Table-Round family, where the circle was drawn by hand with the Circle tool. Same thing underneath: two half arcs, two sketch lines.
 

So it looks like Revit stores every sketch circle as two halves, whether you draw it or the API does. The family flexes fine and a diameter label drives the whole circle, so nothing is broken.


Has anyone found a way through the API to make the two halves pick as one circle in Edit Extrusion, like a hand-drawn one? Or is this just how Revit works?

// Inside an open Transaction in a family document
Level refLevel = new FilteredElementCollector(doc)
    .OfClass(typeof(Level)).Cast<Level>().First();          // "Ref. Level"

XYZ centre = XYZ.Zero;                                       // origin
double radius = 100 / 304.8;                                 // 100 mm

SketchPlane sp = SketchPlane.Create(doc, refLevel.Id);

// ONE closed circle
Arc circle = Arc.Create(
    Plane.CreateByNormalAndOrigin(XYZ.BasisZ, centre),
    radius, 0, 2 * Math.PI);

CurveArray loop = new CurveArray();
loop.Append(circle);
CurveArrArray profile = new CurveArrArray();
profile.Append(loop);

Extrusion ext = doc.FamilyCreate.NewExtrusion(true, profile, sp, 300 / 304.8);
doc.Regenerate();

// Read back: 1 loop with 2 arcs, each half the circle
foreach (CurveArray l in ext.Sketch.Profile)
    foreach (Curve c in l)
        TaskDialog.Show("Sketch curve",
            c.GetType().Name + "  length " + Math.Round(c.Length * 304.8, 1) + " mm");

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...