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.
Best way to query threaded faces (tapped Hole and External Thread)
EvanReese
Member, Mentor Posts: 2,188 ✭✭✭✭✭
I'm working on a feature that needs to find faces with hole attributes or external thread attributes. Can this be done with qHasAttribute()? I'm not sure where to find the "name" to filter for.
Evan Reese
1
Best Answer
-
Caden_Armstrong Member Posts: 195 PRO
I think holes were made before named attributes were a thing, so they are found based on the value pattern.
You have to take a query of seed faces and check which faces have the attribute pattern:var seedFaces = qEverything(EntityType.FACE); for (var f in evaluateQuery(context, seedFaces)) { var attributes = getAttributes(context, { "entities" : f, "attributePattern" : {} as HoleAttribute } ); if(size(attributes) > 0) { println(attributes); } }
www.smartbenchsoftware.com --- fs.place --- Renaissance
Custom FeatureScript and Onshape Integrated Applications1
Answers
I think holes were made before named attributes were a thing, so they are found based on the value pattern.
You have to take a query of seed faces and check which faces have the attribute pattern:
Custom FeatureScript and Onshape Integrated Applications
Aw man, that's what I was starting to do, but it felt wrong somehow. Thanks, Caden!
You could start with a smaller seed query by taking all the faces and putting it through qHoleFaces
Custom FeatureScript and Onshape Integrated Applications