Can we reconstruct cylindrical face from facets


#1

A cylindrical face is faceted, although Sketchup seems to remember or recognize that these facets belong to one cylindrical face. Is there a way to extract a cylindrical face from the facet faces using the Sketchup SDK ?


#2

SketchUp does not know exactly whether facets belong to a cylindrical face, but it knows when facets form together a continuous “surface”. That is when the edges inbetween have the soft property set. If you also apply the “smooth” property, the shading of the facets will be interpolated to look like a curved surface.

The SDK equivalent is SUEdgeSetSoft(SUEdgeRef edge, bool soft_flag).


#3

If you create a circle and use the push/pull tool to extrude it into a cylinder, the edge of the face is stored as an ArcCurve:

http://www.sketchup.com/intl/en/developer/docs/ourdoc/arccurve

You can use the ‘center’, ‘normal’, and ‘radius’ methods to retrieve the information necessary to define a circle. You can also use the ‘start_angle’ and ‘end_angle’ if needed for a partial circle.

[edited] I wasn’t paying attention to the question … the OP asked about the SDK, not the Ruby API.

However, there is an enum type called SUCurveType_Arc that leads me to believe that it should have different attributes than the SUCurveType_Simple for other curves. However, I haven’t be able to determine how to access these attributes (i.e., center, radius).

[more edits] If you determine an SUCurveRef is of type SUCurveType_Arc, you can detemermine the centroid of the face by averaging the x/y/zs of the curve edges to get the center. The distance from this to any point is the radius. The circle normal can be retrieved by the SUFaceGetNormal function.