Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. 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_malagodicarl_malagodi Member Posts: 18 EDU
edited July 2022 in FeatureScript
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

Comments

  • carl_malagodicarl_malagodi Member Posts: 18 EDU
    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.

  • steve_shubinsteve_shubin Member Posts: 1,066 ✭✭✭✭
    edited July 2022
    @carl_malagodi

    You said —
    Getting the geometry of a cross-section

    Another way is by INTERSECTION

    No copy

    No split

    No affecting the part

    Take a look at the GIF below

    https://cad.onshape.com/documents/dcf6c8e5ee2ad6d1a39d83f7/w/09c23d4aadeddd7894928bb5/e/206a62e3ccdf372b8209c193



  • Evan_ReeseEvan_Reese Member Posts: 2,060 PRO
    edited July 2022
    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.

    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/ae8cec45f479469a79d6a88e
    Evan Reese / Principal and Industrial Designer with Ovyl
    Website: ovyl.io
  • Jacob_CorderJacob_Corder Member Posts: 126 PRO
    opBoolean(context, id  , {
            "operationType" : BooleanOperationType.INTERSECTION,
            "tools" :  bodies, 
            "allowSheets" : true,
            "keepTools":true,
            "eraseImprintedEdges" : false
            }); 

    this returns wire bodies of the intersections of the bodies. 
Sign In or Register to comment.