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.
Featurescript computed part property for Number of Bends
curtis_keiderling
Member Posts: 4 PRO
I'm attempting to add a computed part property for Number of Bends (that's available in SW) to Sheetmetal parts in Onshape, but as i'm new to the Featurescript language, I dont know the best way to approach this. I've queried the SmObjectTypeAttributes, expecting some indication there, but no luck. Clearly this data is readily available as there is a bend table for each part, but i cant find how that may be accessed..
0
Comments
The tab "Count Bends" has a feature that will count the number of bends in the sheet metal model.
https://cad.onshape.com/documents/90c254d38958666d2f26de12/w/471128694634b8d0cd6861a7/e/f515b95316b41a0c905cb98c
Just needs to be adapted into a computed part property.
Custom FeatureScript and Onshape Integrated Applications
I just added a bit of additional logic to exclude all jointTypes that arent SMJointType.BEND, and its working..
I do note that the "Bends Table" in the modelling UI is unaffected by an "End Sheetmetal" feature, but this solution is. Is there a way to query bends on the SM body after the END Sheetmetal feature?
You could look at all of the faces of the part and count the number of faces with a geometry filter for cylindrical faces.
Divide by two, and that is likely the number of bends.
edit: thinking about it, you'd have count the number of cylindrical faces on one side of the part, as edge faces could be cylindrical.
If you start with the largest face and then do all tangent connected faces, and then look for cylindrical faces in that query.
Custom FeatureScript and Onshape Integrated Applications