FeatureScript with sketches

jrs_spedley
jrs_spedley Member Posts: 71 ✭✭
Can I just confirm that you can't access geometry in a sketch with featurescript?

I have a vertex selected from a sketch as a parameter and I'd like to query all the edges in a sketch connected to that vertex.  I've spent about 2 hours trying and I've come to the conclusion it isn't possible.

Best Answer

Answers

  • jrs_spedley
    jrs_spedley Member Posts: 71 ✭✭
    Thanks for your help but I've now spent 45 minutes trying to figure out how find the sketch id of the sketch which contains the vertex I pass as a parameter.  Not sure what is wrong with "vertex.parent" or something like that :) 
  • ilya_baran
    ilya_baran Onshape Employees, Developers, HDM Posts: 1,274 image
    You can use https://cad.onshape.com/FsDoc/library.html#lastModifyingOperationId-Context-Query except you'll have to strip out the last part of the id -- so something like:
    var operationId = lastModifyingOperationId(context, myVertex);
    var featureId = resize(operationId, size(operationId) - 1) as Id;
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc