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.

query a line sketch

papawopapawo Member, Developers Posts: 206 PRO
how can i query a line and get or save  its coordinates or info?

Comments

  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 980
    If you have a query for a line, for instance if you know the sketch has only one thing in it and you do lineQuery = qCreatedBy(id + "mySketch", EntityType.EDGE) then evLine(context, { "edge" : lineQuery }) will return a Line (which has origin and direction coordinates).
    See:
    https://cad.onshape.com/FsDoc/library.html#evLine-Context-map
    https://cad.onshape.com/FsDoc/library.html#Line
    Ilya Baran \ Director, Architecture and FeatureScript \ Onshape Inc
  • papawopapawo Member, Developers Posts: 206 PRO
    how to capture line & line 2 without user selecting it?

  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 980
    I don't quite understand what you mean here -- I assume you want to query for the two lines. So what are you starting with? A sketch (and you want to query for all lines in it)? A vertex? A query for some other entity/entities?
    Ilya Baran \ Director, Architecture and FeatureScript \ Onshape Inc
  • papawopapawo Member, Developers Posts: 206 PRO
    lets just say i just created a polygon sketch with 6 sides and i want to query & capture line[1],line[2] ..or vertex [1], vertex [2] ....without  the user help?
  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 980
    Sorry, I'm still not clear: when you say "I just created a polygon," do you mean in an interactive sketch (i.e., by clicking the sketch button in a part studio and dragging out the polygon with the polygon tool), do you mean in FeatureScript with like skPolygon earlier in the same feature, or do you mean in a prior custom feature?  If it's earlier in the same feature, you can use sketchEntityQuery (https://cad.onshape.com/FsDoc/library.html#sketchEntityQuery-Id--string) with the entity id of the relevant line or vertex.
    Ilya Baran \ Director, Architecture and FeatureScript \ Onshape Inc
  • papawopapawo Member, Developers Posts: 206 PRO
    this FS is based on the tutorial using skRectangle. user has to pick line 1,2 & 3 to create rectangle then extrude & subtract the part since those lines varies .  line 1 will create rectangle and subtract, then line 2 will do the same then line 3 too..
    what im trying to achieved is after it create 1 rectangle , i need to fillet one of its corner (say the upper corner of the rectangle "a" ). then extrude and subtract the part.
    So I was thinking , to id the 2 lines of the rectangle . I dont know if its correct approach though is there an easier way to do it?

Sign In or Register to comment.