Having troubles with: skCircle(Sketch, Id (array), map) does not match skCircle(..., string, ...)

darren_13
darren_13 Member, Developers Posts: 120 PRO
the id: id+'circle1'+keys

debugs to: Id : [ "FIZxwPCJn00T9Nq_1" , "circle1" , "0" ]

I presume the issue is that it is an array of strings however this is valid for a sketch so I am puzzled. The link is: 
https://cad.onshape.com/documents/95877be3b17f49277e87a2c3/w/b503830fd20472014beb1221/e/4c4431103f44e823aca947dd

the feature script is 'Wing Structure Parametric' in folder 'Wing Structure Creator (prac)'

Thanks in advance,
Darren

Comments

  • kevin_o_toole_1
    kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565 image
    FeatureScript has two kinds of ids. Operation ids (including the id passed into newSketchOnPlane) are the Id type, which is a hierarchical array of strings. But inside of sketches, ids are just plain strings. skCircle is expecting a string, and you're giving it an array with the Id type.

    In FS, the ~ operator joins values as strings, so you'll probably want to use something like id ~ 'circle1' ~ keys
  • darren_13
    darren_13 Member, Developers Posts: 120 PRO
    Thanks again @kevin_o_toole_1 ! 
  • lana
    lana Onshape Employees Posts: 782 image
    Just to expand a little on Kevin's comment.  Operation ids have to be of the shape id + ... ( where id is the id argument of custom feature), they have to be unique within the context( == within part studio), while sketch entity id in skXXX functions are strings and need to be unique within the sketch.
    e.g. It is valid to do something like:
    var sketch = newSketchOnPlane(context, id + "sketch1,..)
    for (var i = 0; i < 5; i += 1)
    {
        skCircle(sketch, "circle_" ~ i, ..);
    }
    skSolve(sketch);

    sketch = 
    newSketchOnPlane(context, id + "sketch2,..);
    skCircle(sketch, "circle_1", '..)
    skSolve(sketch);
  • darren_13
    darren_13 Member, Developers Posts: 120 PRO
    Ah, cheer's @lana that makes my job easier. Cheers for the follow-up :)