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.
Getting the geometry of a cross-section
carl_malagodi
Member Posts: 18 EDU
Hello,
I am attempting to add a configurable part through the instantiator functionality to a part studio in a featurescript. However I am lost in how to access and evaluate the cross section of a part. In this use case I have the user select a part and an intersecting plane, I would like to be able to find the geometry of this parts cross-section(square, rectangular, circular) and some measurements about the cross-section, I've experimented with some intersection and owner style queries but I don't have a good grasp on how to start solving this problem. Is there a good way to go about accessing this information?
Thanks
0
Comments
-
So I ended up getting a decent solution for this, there's another forum post here https://forum.onshape.com/discussion/11020/create-sketch-at-intersection-of-face-with-sketch-plane, that kind of details what should be done here, basically Create a copy, split the copy part using the selected plane, then query for the edges created by the split operation, qSplitBy is also helpful here to avoid getting the duplicates that are unavoidable from querying for edges resulting from the split op. Then I used a isQueryEmpty wrapper for geometry types to get the type of cross section type. As a note once you query for the face that results from the split operation you can get the area directly from that using the build in evaluate functions, that can be then used to back calculate things like radius and side length for very basic cross sections.
1 -
@carl_malagodiYou said —
Getting the geometry of a cross-sectionAnother way is by INTERSECTION
No copy
No split
No affecting the part
Take a look at the GIF below
1 -
Sounds like about what I'd have tried, this got me curious though, and it turns out you can also generate this surface using opBoolean with BooleanOperationType.SUBTRACT_COMPLEMENT. Not sure if that's better than what you're doing. Maybe it's faster to regen. Check it out. https://cad.onshape.com/documents/4ab43b0c4446570dbf8df0ad/w/66bac2ceafc2a892bb5fc234/e/ae8cec45f479469a79d6a88ecarl_malagodi said:So I ended up getting a decent solution for this, there's another forum post here https://forum.onshape.com/discussion/11020/create-sketch-at-intersection-of-face-with-sketch-plane, that kind of details what should be done here, basically Create a copy, split the copy part using the selected plane, then query for the edges created by the split operation, qSplitBy is also helpful here to avoid getting the duplicates that are unavoidable from querying for edges resulting from the split op. Then I used a isQueryEmpty wrapper for geometry types to get the type of cross section type. As a note once you query for the face that results from the split operation you can get the area directly from that using the build in evaluate functions, that can be then used to back calculate things like radius and side length for very basic cross sections.1 -
opBoolean(context, id , {"operationType" : BooleanOperationType.INTERSECTION,"tools" : bodies,"allowSheets" : true,"keepTools":true,"eraseImprintedEdges" : false});
this returns wire bodies of the intersections of the bodies.1


