Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
trying to get length of cylinder face.
nathan_shaffer
Member Posts: 10 ✭✭
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
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).
The Onsherpa | Reach peak Onshape productivity
www.theonsherpa.com