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.

evOwnerSketchPlane can't figure out a sketch's plane

gregory_tugregory_tu Member Posts: 6 EDU
Doc Link: https://cad.onshape.com/documents/e746e5a1af6ab69016ffd94f/w/081cbbc49abd4344596a9144/e/a9ac389edf3d50f310bc8113
(At bottom of featurescript is where I've been trying to get it to work)

I made a ridged tab feature that could add a little tab connection for 3dp parts, but when I try to have evOwnerSketchPlane evaluate a sketch's plane that was placed on an inside edge, on the inside of a cylindrical face, instead of on the outside of a cylindrical pin head, it says it cannot resolve (@evOwnerSketchPlane: CANNOT_RESOLVE_PLANE). This situation should be the same except for the faces around the edge, but the edge itself should still be perfectly circular, and planar, so I don't know why it now can't figure it out as I am still directly referencing what created the sketch.

Best Answer

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,680
    edited April 19 Answer ✓
    You were querying the sketch outside the loop, so moved it inside and changed your id hierarchy:

    for (i = 0; i < size(pinHeadEdge.subqueries); i += 1)
                {
                    var sketchPlane = evPlanarEdge(context, { "edge" : qNthElement(pinHeadEdge, i) });
    
                    var slitSketch = newSketchOnPlane(context, id + i + "slitSketch12", {
                            "sketchPlane" : sketchPlane
                        });
                    // Create new sketch on each pin edge plane
    
                    var circA = measureDiameter(context, {
                                "entity" : qNthElement(pinHeadEdge, i)
                            }) / meter / 2;
                    // Measure pin head diameter
    
                    var tabWidth = (definition.slitDepth / meter / definition.tabFlexMult) / (definition.ridgeSize / meter / 0.000396875);
    
                    var slitWidth = max(definition.ridgeSize * 2 / meter, circA - tabWidth * 2);
    
                    skRectangle(slitSketch, "slitRectangle", {
                                "firstCorner" : vector(-circA - definition.ridgeSize / meter, slitWidth) * meter,
                                "secondCorner" : vector(0, -slitWidth) * meter
                            });
    
                    skSolve(slitSketch);
                    // Solve sketch
    
                    opExtrude(context, id + i + "extrude12", {
                                "entities" : qSketchRegion(id + i + "slitSketch12"),
                                "direction" : sketchPlane.normal * -1,
                                "endBound" : BoundingType.BLIND,
                                "endDepth" : definition.slitDepth,
                            });
                }


    Senior Director, Technical Services, EMEAI

Answers

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,680
    edited April 19 Answer ✓
    You were querying the sketch outside the loop, so moved it inside and changed your id hierarchy:

    for (i = 0; i < size(pinHeadEdge.subqueries); i += 1)
                {
                    var sketchPlane = evPlanarEdge(context, { "edge" : qNthElement(pinHeadEdge, i) });
    
                    var slitSketch = newSketchOnPlane(context, id + i + "slitSketch12", {
                            "sketchPlane" : sketchPlane
                        });
                    // Create new sketch on each pin edge plane
    
                    var circA = measureDiameter(context, {
                                "entity" : qNthElement(pinHeadEdge, i)
                            }) / meter / 2;
                    // Measure pin head diameter
    
                    var tabWidth = (definition.slitDepth / meter / definition.tabFlexMult) / (definition.ridgeSize / meter / 0.000396875);
    
                    var slitWidth = max(definition.ridgeSize * 2 / meter, circA - tabWidth * 2);
    
                    skRectangle(slitSketch, "slitRectangle", {
                                "firstCorner" : vector(-circA - definition.ridgeSize / meter, slitWidth) * meter,
                                "secondCorner" : vector(0, -slitWidth) * meter
                            });
    
                    skSolve(slitSketch);
                    // Solve sketch
    
                    opExtrude(context, id + i + "extrude12", {
                                "entities" : qSketchRegion(id + i + "slitSketch12"),
                                "direction" : sketchPlane.normal * -1,
                                "endBound" : BoundingType.BLIND,
                                "endDepth" : definition.slitDepth,
                            });
                }


    Senior Director, Technical Services, EMEAI
Sign In or Register to comment.