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.
Check the entity type of an Id using featurescript
mohammad_sadil_khan
Member Posts: 8 EDU
Hello Onshape Community,
I would like to know if there is any way, given Ids like ("JHD", "JKC"), I can know if these ids correspond to parts, edges, vertices, faces or mate connectors using Featurescript?
Thank you.
0
Best Answers
-
Caden_Armstrong Member Posts: 195 PROYou can turn an entity id into a query like so:
var specificEntity = { "queryType" : QueryType.TRANSIENT, "transientId" : "JHD"} as Query;
and then do a filter like qEntityType and a isQueryEmpty check to see if it matches.www.smartbenchsoftware.com --- fs.place --- Renaissance
Custom FeatureScript and Onshape Integrated Applications1 -
Caden_Armstrong Member Posts: 195 PROMate connectors are a type of body:
qBodyType(myquery, BodyType.MATE_CONNECTOR);
www.smartbenchsoftware.com --- fs.place --- Renaissance
Custom FeatureScript and Onshape Integrated Applications0
Answers
var specificEntity = { "queryType" : QueryType.TRANSIENT, "transientId" : "JHD"} as Query;
and then do a filter like qEntityType and a isQueryEmpty check to see if it matches.
Custom FeatureScript and Onshape Integrated Applications
As soon as I posted, I remembered there was a proper function for it. Old habits die hard.
Custom FeatureScript and Onshape Integrated Applications
This is working, Thanks.
I have another question. Since Mate Connector is not an Entitytype, mate connectors ids are being identified as body.
Is there way around it? Thanks
qBodyType(myquery, BodyType.MATE_CONNECTOR);
Custom FeatureScript and Onshape Integrated Applications
Will it solve it?
If not, can you please elaborate on the specific queries?
Thanks