Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- 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.
Looking for a snippet that will cycle through all points in a nominated sketch
philip_thomas
Member, Moderator, Onshape Employees, Developers Posts: 1,381
I just don't know what the code looks like - is there something similar someone can point me to or perhaps just paste a snippet?
Thank you.
Thank you.
Philip Thomas - Onshape
0
Best Answers
-
konstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭sometimes ago i found a handy overload of qCreatedBy() in the standart library:
<a rel="nofollow" href="https://cad.onshape.com/FsDoc/library.html#qCreatedBy-FeatureList">qCreatedBy </a><span>(features is <a rel="nofollow" href="https://cad.onshape.com/FsDoc/library.html#FeatureList">FeatureList</a>) </span><span> returns <a rel="nofollow" href="https://cad.onshape.com/FsDoc/library.html#Query">Query</a></span>
so if you get the sketch as FeatureList you just feed it to this qCreatedBy() and filter the point bodies with qBodyType()if you are asking seriously)5 -
kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565If you created the sketch in the current feature (and have its id) this should be just
for (var point in evaluateQuery(context, qCreatedBy(id + "sketch1", EntityType.VERTEX))) { ...
6 -
Jake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646^ Although you may hit each point twice by doing that. It is safer to also add a body type filter:
for (var point in evaluateQuery(context, qBodyType(qCreatedBy(<sketchId>, EntityType.VERTEX), BodyType.WIRE))) { ...
Jake Rosenfeld - Modeling Team6 -
philip_thomas Member, Moderator, Onshape Employees, Developers Posts: 1,381Thank you (and Jake) - here are the fruits
https://cad.onshape.com/documents/e02f8da5c872d4d55e30e218/w/41d8b64176967ea1955c14fa/e/63364cbd3b3f3c845a6a46ad
Philip Thomas - Onshape2
Answers
https://cad.onshape.com/documents/e02f8da5c872d4d55e30e218/w/41d8b64176967ea1955c14fa/e/63364cbd3b3f3c845a6a46ad
@philip_thomas - .Nice .Nice .Nice .Nice .Nice!