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.

Sketches Created in Featurescript No Longer Appearing Under Feature

asher_haigasher_haig Member Posts: 16

I have a feature written in Featurescript that creates a number of sketches. Previously, they were all showing up under the feature's details (when expanding the feature via arrow), but something changed and now they aren't. I'm not sure what changed.

What determines whether they show up? I don't get any arrow at all now next to the feature.

Best Answer

  • asher_haigasher_haig Member Posts: 16
    Answer ✓

    The problem turns out to be due to how the Id was being formed, I believe because the Id hierarchy was being broken. Fixing the Id assignments resolved the issue.

Answers

  • EvanReeseEvanReese Member, Mentor Posts: 2,500 ✭✭✭✭✭

    I'd guess either you're deleting the sketches with opDelete() or they're not being created in the first place. Maybe you forgot to add a skSolve()?

    Evan Reese
    The Onsherpa | Reach peak Onshape productivity
    www.theonsherpa.com
  • _anton_anton Member, Onshape Employees Posts: 478

    Working for me. Share a document?

  • asher_haigasher_haig Member Posts: 16

    Definitely not deleting, definitely solving. The sketches show up as parts, just not in the list.

    FeatureScript 2737;
    import(path : "onshape/std/common.fs", version : "2737.0");
    
    annotation { "Feature Type Name" : "Create and Show Sketch", "Feature Type Description" : "" }
    export const sketchNotShown = defineFeature(function(context is Context, id is Id, definition is map)
        precondition {
            
            annotation {
                "Name" : "Parameter",
                "UIHint" : [UIHint.SHOW_LABEL, UIHint.REMEMBER_PREVIOUS_VALUE ],
                "Default": "value"
            }
            definition.parameter is string;
        }
        {
            const plane = plane( vector(0,0,0)*inch, vector( 0, 0, 1 ), vector( 1, 0, 0 ) );
            const sketch = newSketchOnPlane(context, id + "_sketch", {
                "Name" : "Sketch",
                "sketchPlane" : plane
            });
            skSolve(sketch);
        }
    );
    
    Screenshot 2025-08-08 at 4.22.51 PM.png
  • EvanReeseEvanReese Member, Mentor Posts: 2,500 ✭✭✭✭✭

    Ah, the sketch is empty. It should show once you add geometry to it.

    FeatureScript 2737;
    import(path : "onshape/std/common.fs", version : "2737.0");
    
    annotation { "Feature Type Name" : "Create and Show Sketch", "Feature Type Description" : "" }
    export const sketchNotShown = defineFeature(function(context is Context, id is Id, definition is map)
        precondition {
            
            annotation {
                "Name" : "Parameter",
                "UIHint" : [UIHint.SHOW_LABEL, UIHint.REMEMBER_PREVIOUS_VALUE ],
                "Default": "value"
            }
            definition.parameter is string;
        }
        {
            const plane = plane( vector(0,0,0)*inch, vector( 0, 0, 1 ), vector( 1, 0, 0 ) );
            const sketch = newSketchOnPlane(context, id + "_sketch", {
                "Name" : "Sketch",
                "sketchPlane" : plane
            });
            skCircle(sketch, "circle1", {
                    "center" : vector(0, 0) * inch,
                    "radius" : 1 * inch
            });
            
            skSolve(sketch);
        }
    );
    
    Evan Reese
    The Onsherpa | Reach peak Onshape productivity
    www.theonsherpa.com
  • asher_haigasher_haig Member Posts: 16

    Is it possibly something that I inadvertently toggled in the document settings-wise? It seems that the ability to hide the feature is also missing, which surprises me.

  • asher_haigasher_haig Member Posts: 16

    OK— that solved the example case.

    But my actual feature has contents in each sketch and still isn't showing up.

    I will have to try to create another example to show.

  • asher_haigasher_haig Member Posts: 16
    Answer ✓

    The problem turns out to be due to how the Id was being formed, I believe because the Id hierarchy was being broken. Fixing the Id assignments resolved the issue.

  • EvanReeseEvanReese Member, Mentor Posts: 2,500 ✭✭✭✭✭

    Oh interesting that makes sense. Thanks for reporting back on your fix. It really helps people with similar issues searching the forum.

    Evan Reese
    The Onsherpa | Reach peak Onshape productivity
    www.theonsherpa.com
Sign In or Register to comment.