Create sketch at intersection of face with sketch plane

I have a solid and need to trace the cross section at various heights, matching the functionality of the Intersection feature in sketch mode.
I have a script to generate parallel planes intersecting the solid at various heights, but I can't find a way to replicate the Intersection functionality on each of these planes.
Here's a test Part https://cad.onshape.com/documents/465690599b6739cfa9025632/w/1324cb723889014e32d90d2b/e/8dd53f1e62b25f885f88f974
Does anyone have any ideas how I may solve this?

Comments

  • ilya_baran
    ilya_baran Onshape Employees, Developers, HDM Posts: 1,279 image
    You can use opSplitFace like this: https://cad.onshape.com/documents/3d93a9511178b81ff24933ee/w/e7ea12d246b978bdab5f2490/e/5e8642ea5268e07764c89705

    That may be different from what you want in that it actually splits the faces.  If you want to leave the body untouched, make a copy of it first (using opPattern), do the splits, use opExtractWires to make a copy of the new edges you want, and then use opDeleteBodies to remove the part copy.  Hope this helps.
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • graham_lock
    graham_lock Member Posts: 277 PRO

    I know this is an old post but could you show how to use opExtractWires in the example script please?

  • Caden_Armstrong
    Caden_Armstrong Member Posts: 472 PRO

    Its very straight forward. It only takes in a query containing edge entities. It generates wirebodies with those edges. If the edges are not connected, it creates separate bodies, and joined edges create a single body.

        
    opExtractWires(context, id + "opExtractWires1", {
                "edges" : definition.edges
    });
    

    example
    https://cad.onshape.com/documents/74602c6e3b7235e71375f012/w/9a574195a44b60e84a90c1ca/e/205e50e64ae378e1733e5d46

    www.smartbenchsoftware.com --- Renaissance --- Kestrel -- SmartLink
    Experts in Onshape Automation - Custom Features and Integrated Applications