Sweep along split line

graham_lock
graham_lock Member Posts: 277 PRO

Best Answer

  • graham_lock
    graham_lock Member Posts: 277 PRO
    Answer ✓

    I edited the initial post and corrected a syntax error on the sweep.

    The code shown now works.

Answers

  • graham_lock
    graham_lock Member Posts: 277 PRO
    edited March 2025

    Hi,

    I'm trying to workout how to sweep along an edge created by a split in FS as can be done in the UI.

    The outline of my code is:

    // create plane at angle - THIS WORKS

    cPlane(context, id + "bodySplitter", {
    "entities" : qCreatedBy(id + config.longeronIndex + "skLine", EntityType.EDGE),
    "cplaneType" : CPlaneType.LINE_ANGLE,
    "offset" : 0 * millimeter,
    "angle" : planeAngle,
    "oppositeDirection" : false,
    "flipAlignment" : false,
    "flipNormal" : false
    });

    // split solid body with plane - THIS WORKS      
    
    opSplitPart(context, id + "splitPart1", {
            "targets" : config.solidBody,
            "tool" : qCreatedBy(id + "bodySplitter", EntityType.FACE)
    });
    
    // use sweep to create a body using previously sketched profiles -  - THIS NOW WORKS
    
     sweep(context, id + "sweep1",
            {
                    "bodyType" : ExtendedToolBodyType.SOLID,
                    "operationType" : NewBodyOperationType.NEW,
                    "profiles" : config.longeronProfiles[0].sketchRegion,
                    "path" : qNthElement(qCreatedBy(id + "splitPart1", EntityType.EDGE), 2),    
                    "profileControl" : ProfileControlMode.NONE    
                });
    

    The sweep throws an execution error.

    I have a test document here which shows what I'm trying to achieve using the UI:

    https://cad.onshape.com/documents/b47247537a19de65742c7ceb/w/a1f3a56d0c6bdd4de138c226/e/135b3120a9f5267d9588c24a

    Any help appreciated.

    Thank you.

  • graham_lock
    graham_lock Member Posts: 277 PRO
    Answer ✓

    I edited the initial post and corrected a syntax error on the sweep.

    The code shown now works.