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.

Cannot resolve plane in Feature Script extrude

tom_savu433tom_savu433 Member Posts: 5 EDU

Hi,

I am new to Feature Script and I am trying to create one for placing, on a cylindrical part, a groove for a Seeger ring.

I need to remove from the cylinder using an area between two circles.

Before placing the opExtrude function, the script works and the sketch with the two circles is created.

After inserting the opExtrude, I receive the "Cannot resolve plane" error.

Can anyone tell me where I am wrong, please?

Here is the code

FeatureScript 2641;
import(path : "onshape/std/common.fs", version : "2641.0");

annotation { "Feature Type Name" : "Canal_arbore", "Feature Type Description" : "" }
export const Canal_arbore = defineFeature(function(context is Context, id is Id, definition is map)

precondition
{
annotation { "Name" : "Muchie arbore", "Filter" : EntityType.EDGE, "MaxNumberOfPicks" : 1 }
definition.Muchie_arbore is Query;
}

{
    // Get the plane of the selected face
    
    var Plan_muchie = evPlanarEdge(context, {
            "edge" : definition.Muchie_arbore
    });
    
    var Muchie = evCurveDefinition(context, {
            "edge" : definition.Muchie_arbore
    });
            
    var Raza_muchie = Muchie.radius;
    println(Raza_muchie);
    
    var Raza_int = Raza_muchie - 1 * millimeter;
    
    // Create a sketch on the selected face
    var sketchId = id + "toolSketch";
    var toolSketch = newSketchOnPlane(context, sketchId, {
        "sketchPlane" : Plan_muchie
    });
    
    skCircle(toolSketch, "circle1", {
            "center" : vector(0,0) * millimeter,
            "radius" : Raza_muchie
    });
    
    skCircle(toolSketch, "circle2", {
            "center" : vector(0, 0) * millimeter,
            "radius" : Raza_int
    });
    skSolve(toolSketch);
    
    opExtrude(context, id + "extrude1", {
            "entities" : qCreatedBy(id + "toolSketch", EntityType.FACE),
            "direction" : evOwnerSketchPlane(context, {"entity" : definition.Muchie_arbore}).normal,
            "endBound" : BoundingType.BLIND,
            "endDepth" : 2 * millimeter,
            "startTranslationalOffset" : 2 * millimeter
    });
    
    opThicken(context, id + "thicken1", {
            "entities" : qCreatedBy(id + "extrude1", EntityType.BODY),
            "thickness1" : 0.1 * inch,
            "thickness2" : 0.1 * inch
    });
    
    opDeleteBodies(context, id + "delete1", {
           "entities" : qCreatedBy(id + "extrude1", EntityType.BODY)
    });
    
    opBoolean(context, id + "boolean1", {
           "tools" : qCreatedBy(id + "thicken1", EntityType.BODY),
           "targets" : qOwnerBody(definition.Muchie_arbore),
           "operationType" : BooleanOperationType.SUBTRACTION
    });
    
    
});

Best Answer

Answers

  • Caden_ArmstrongCaden_Armstrong Member Posts: 271 PRO

    Start with reading the error message:
    "evOwnerSketchPlane: CANNOT_RESOLVE_PLANE"

    If you read the documentation for this function, you'll find that it is expecting a sketch entity.
    Your feature is selecting an edge, which is not a sketch entity.

    You don't even need to find the plane again here, since "Plan_muchie" already exists. Just use Plan_muchie.normal

    Its good practice to read the documentation and see if the function inputs match what you are putting into it.

    www.smartbenchsoftware.com --- fs.place --- Renaissance
    Custom FeatureScript and Onshape Integrated Applications
  • tom_savu433tom_savu433 Member Posts: 5 EDU

    Sorry Caden, but I don't understand, I'm an absolute beginner in Feature Script.

    I've tried different solutions for the "direction" argument of opExtrude and for the "entity" in evOwnerSketchPlane, but none worked.

    I tried also evPlane instead of evOwnerSketchPlane, no result.

    I've read the documentation, it seems pretty clear, but I really don't know what I'm missing.

  • tom_savu433tom_savu433 Member Posts: 5 EDU
    Answer ✓

    Solved it, thank you!

Sign In or Register to comment.