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.

Options

startTracking with sweep

MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,034 EDU
I am trying to do a tracking query on a sweep to get a face to put into opReplaceFace.
However, it resolves to nothing.

Here is my code:

    // Sketch
    var sketch = newSketchOnPlane(context, id + "sketch", {
            "sketchPlane" : skPlane
        });
    skLineSegment(sketch, "face1Line", {
                "start" : vector(0, 0) * inch,
                "end" : face1Point
            });
    skLineSegment(sketch, "face2Line", {
                "start" : vector(0, 0) * inch,
                "end" : face2Point
            });
    skArc(sketch, "arc", {
                "start" : face1Point,
                "mid" : normalize(face1SkDir + face2SkDir) * dist * (shape == FilletShape.CONVEX ? 1.15 : 0.75),
                "end" : face2Point
            });
    skSolve(sketch);
    toDelete[] = append(toDelete[], qCreatedBy(id + "sketch"));

    // Weld Faces
    var weldFace1 = qEntityFilter(startTracking(context, id + "sketch", "face1Line"), EntityType.FACE);
    var weldFace2 = qEntityFilter(startTracking(context, id + "sketch", "face2Line"), EntityType.FACE);

    // Sketch face
    var sketchFace = qCreatedBy(id + "sketch", EntityType.FACE);

    var sweepDef = {
        "profiles" : sketchFace,
        "path" : qClosestTo(qEdgeAdjacent(face1, EntityType.EDGE), distResult.sides[0].point),
        "lockFaces" : face1
    };
    opSweep(context, id + "sweep", sweepDef);

    debug(context, weldFace1); // Resolves to nothing :(

mb - draftsman - also FS author: View FeatureScripts
IR for AS/NZS 1100

Best Answers

Answers

  • Options
    MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,034 EDU
    @lana
    Is this part of the function the edge of the sketch face?
    makeQuery(sketchId, "IMPRINT", undefined, { "derivedFrom" : sketchQuery })

    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • Options
    MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,034 EDU
    @lana
    How would I get the sketch id from a user's selection?
    Or can't I do that?
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • Options
    MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,034 EDU
    edited November 2018
    @Jake_Rosenfeld
    What I was wanting was to allow sketch edge selection for my shaped flange feature
    https://cad.onshape.com/documents/602655eff016f183fc184978

    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • Options
    Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    @mbartlett21

    Are you sweeping the sketch region and trying to track one of the side faces, or sweeping sketch edge itself into a surface?  If you're sweeping the sketch edge, you should be able to just do:

    startTracking(context, { "subquery" : definition.edgeToSweep, "secondarySubquery" : pathEdge });

    If you are sweeping a region into a solid, and trying to track one of the edges by user selection, it'll require some creativity.  Sketch edges are actually independent wire bodies which sit on top of the sketch regions.  Sketch regions have their own bounding edges, which are not topologically associated with the sketch edges.  If your sketch is simple, though, it should not be too hard to find the correct sketch region edge to track, based off of a sketch edge selection.

    Here is a document with an example of how to do both of the above things:
    https://cad.onshape.com/documents/aeead03c19e203f80f7a8a42/w/7860ea9de8207834674fd2b8/e/7ef5715b5172858bcbc526fb 
    Jake Rosenfeld - Modeling Team
  • Options
    MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,034 EDU
    @Jake_Rosenfeld
    I am wanting to get the sketch face adjacent to the edge so I can do an opExtractSurface on it.
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
Sign In or Register to comment.