Sketches Created in Featurescript No Longer Appearing Under Feature
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
-
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.
1
Answers
-
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()?
1 -
Working for me. Share a document?
0 -
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); } );0 -
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); } );0 -
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.
0 -
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.
0 -
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.
1 -
Oh interesting that makes sense. Thanks for reporting back on your fix. It really helps people with similar issues searching the forum.
2



