trying to get length of cylinder face.

nathan_shaffer
nathan_shaffer Member Posts: 11 ✭✭

I'm creating a tool in which I need to get the dimensions of a cylindrical face. So far, after about 6 hours, I got this working to get the radius:

var cyl is Query = qGeometry(definition.refChoice, GeometryType.CYLINDER);
var face = qEntityFilter(cyl, EntityType.FACE);
var cyl_props = evSurfaceDefinition(context, {"face": face});
println(cyl_props.radius);

But I can't seem to get anything further out of it.

var line is Query = qGeometry(definition.refChoice, GeometryType.LINE);
debug(context, line);
var edge = qEntityFilter(line, EntityType.EDGE);
var line_props = evLength (context, {"entities": edge});this outputs "debug: Query resolves to nothing"

yet when I print definition.refChoice, I can see "{ geometryType : LINE , queryType : GEOMETRY , subquery :"

I have also tried querying the edge in the cylinder→face still nothing.

I can get the origin and axis of the cylinder, but like, how long is it?

Comments

  • EvanReese
    EvanReese Member, Mentor Posts: 3,099 PRO

    Hey, I thought this would be a decent opportunity for a quick FeatureScript video tutorial so I made a 20-ish minute video about how I'd approach something like this. I actually imagine that your way to get the radius will be more reliable than my example since it would handle partial cylinders like you get with a fillet face. For your example specifically, I assume the second query resolves to nothing because a true cylinder doesn't have any "Line" geometry on it (it's two circles with a face in between).

    Evan Reese
    The Onsherpa | Reach peak Onshape productivity
    www.theonsherpa.com