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.

Featurescript computed part property for Number of Bends

curtis_keiderlingcurtis_keiderling Member Posts: 4 PRO
edited May 29 in FeatureScript
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..

Comments

  • Caden_ArmstrongCaden_Armstrong Member Posts: 195 PRO
    I have a sample document that gets the bend information.
    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.
    www.smartbenchsoftware.com --- fs.place --- Renaissance
    Custom FeatureScript and Onshape Integrated Applications
  • curtis_keiderlingcurtis_keiderling Member Posts: 4 PRO
    Thanks @caden_armstrong, thats it.. The part that had me stalled was the query.
    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?

  • Caden_ArmstrongCaden_Armstrong Member Posts: 195 PRO
    edited May 31
    After SM ends your only option is to look at the geometry and make some assumptions.
    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.
    www.smartbenchsoftware.com --- fs.place --- Renaissance
    Custom FeatureScript and Onshape Integrated Applications
  • curtis_keiderlingcurtis_keiderling Member Posts: 4 PRO
    Ok, thanks. I'll explore this...
Sign In or Register to comment.