What does NO_ERROR mean?

kendall_frey
kendall_frey Member Posts: 2 ✭
I'm trying to use skEllipticalArc in a feature, but every time I give it a center that is not the origin (0,0) it produces NO_ERROR and doesn't create the arc.



Here is the simplest code that reproduces it:
<div>FeatureScript 581;</div><div>import(path : "onshape/std/geometry.fs", version : "581.0");</div><div><br></div><div>annotation { "Feature Type Name" : "Test" }</div><div>export const myFeature = defineFeature(function(context is Context, id is Id, definition is map)</div><div>&nbsp; &nbsp; precondition</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; // Define the parameters of the feature type</div><div>&nbsp; &nbsp; }</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; var sketch1 = newSketch(context, id + "sketch1", {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "sketchPlane" : qCreatedBy(makeId("Top"), EntityType.FACE)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; });</div><div>&nbsp; &nbsp; &nbsp; &nbsp; skEllipticalArc(sketch1, "ellipticalArc1", {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "center" : vector(2, 0) * inch,</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "majorAxis" : vector(1, 0) * inch,</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "minorRadius" : 1 * inch,</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "majorRadius" : 2 * inch,</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "startParameter" : 0,</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "endParameter" : 0.25</div><div>&nbsp; &nbsp; &nbsp; &nbsp; });</div><div>&nbsp; &nbsp; &nbsp; &nbsp; skSolve(sketch1);</div><div>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; });</div><div></div>
Is this a bug? How can I create an arc where the center is somewhere other than the origin?

Answers

  • emmett_weeks
    emmett_weeks Onshape Employees Posts: 29 image
    edited May 2017
    It turns out that this is a bug. When sketching interactively, none of the arguments to skEllipticalArc are used, so I never noticed that one of them doesn't work properly. As a temporary workaround, it's possible to use skSetInitialGuess. skSetInitialGuess takes in a sketch and a map of sketch entity ids to arrays. This is used to place those entities in the sketch. Using it would look something like this.
            var sketch = newSketch(context, id + "sketch1", {
                    "sketchPlane" : qCreatedBy(makeId("Top"), EntityType.FACE)
                });
                
            const initialGuess = { "ellipticalArc" : [2, 0, sqrt(2) / 2, sqrt(2) / 2, 1, 0.5, 0, 3] };
                
            skEllipticalArc(sketch, "ellipticalArc", { });
            
            skSetInitialGuess(sketch, initialGuess);
            skSolve(sketch);
    The initial guess data for an elliptical arc is in this format: [center x, center y, major axis x, major axis y, major radius, minor radius, start parameter, end parameter] All distances are in meters, the parameter's domain is [0, 2 pi], and the major axis will not be normalized for you unlike with the skEllipticalArc function.
  • john_f_carr
    john_f_carr Onshape Employees Posts: 74 image
    The fix for this went out in our last update.  Like many fixes, it only affects new and upgraded Part Studios.