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.
Sheet Metal Fold
MBartlett21
Member, OS Professional, Developers Posts: 2,064 ✭✭✭✭✭
I am in the middle of trying to make a FeatureScript that lets the user "fold" a sheet metal part.
However, I am having trouble determining the rotation axis once I have split the underlying sheet metal model.
I have modelled up a sample cross-section of a sheet metal part here
I have determined the rotation axis using a sketch, however, I would like to make a FeatureScript formula to get the location.
@konstantin_shiriazdanov , could you help?
However, I am having trouble determining the rotation axis once I have split the underlying sheet metal model.
I have modelled up a sample cross-section of a sheet metal part here
I have determined the rotation axis using a sketch, however, I would like to make a FeatureScript formula to get the location.
@konstantin_shiriazdanov , could you help?
0
Comments
-

Hi, I found raius "r" which is the horizontal distance from rotation axis to the line of length "l1", so you can transform this result in terms of coordinates of the rotation axis origin. Is that what was needed?
1 -
@konstantin_shiriazdanov
Could you make it in FS code?0 -
Now you're starting to sound like me XDmbartlett21 said:@konstantin_shiriazdanov
Could you make it in FS code?
0 -
I'm assuming the angle is in radians.
Is that right?
Also, what are c and g?
0 -
Yes, in radians. In Featurscript you just need to get axis of the sketched fold line and transform it at the s+r distance in the direction, opposite to sketch plane normal.
0 -
@konstantin_shiriazdanov
What do c and g mean?0 -
If you mean c and g in ctg(a/2) it is cotangens, you might know it as cot() function
0 -
Oh ok.
In Onshape it is atan().
And i suppose tg() is tan()0 -
Yes, its a miracle that when even triginometric functions have different names, we still can understand each other
0 -
Atan() should be arctangens, if it doesnt exist you can express it as ctg(x) =1/tan(x)
0 -
@konstantin_shiriazdanov
I have got it working in my part studio and here is the FS:
https://cad.onshape.com/documents/9f116620b0f6d04445f57293
2 -
Nice guys!0
-
PS: look in the flat before and after.
Nothing changes
0 -
Perfect0
-
Are you going to add in bend side? or will it always be based on center of bend?0
-
@john_mcclary
You should be able to use it for angles in the opposite direction now.1 -
@john_mcclary
You just can't fold it directly from a flat face (I don't know why, so maybe @lana could help)
0 -
You just can't fold it directly from a flat face.Operations in flat are not very FS friendly. We'll try to improve that in the future.0
-
@lana what i am meaning is from a sheet metal model without any bends0
-
looks like you are going to compete with OS devs in the sheet metal features implementation ratembartlett21 said:I have got it working in my part studio and here is the FS:
https://cad.onshape.com/documents/9f116620b0f6d04445f57293
now you just left to add unbend capability for existing bends1 -
0
-
@lana
It doesn't seem to work if the edge selected to be "fixed" is on the face that is bent. (The edge's id seems to change internally after the sheet metal internal body is split)0 -
@mbartlett21
Are you using split part or split face? Split part has to create new tags internally because it creates a new body. This should be somewhat stable due to our tracking, but once it goes through the sheet metal system it probable loses that associativity. My recommendation would be to split the face, and then use move face-rotate to rotate the faces in question. You may already be doing this, I haven't looked into the code.
re: hems, you found our big secret
Jake Rosenfeld - Modeling Team0 -
@Jake_Rosenfeld
I am using split part, then boolean.
The reason I found out about the hems was because, when I updated my feature to FS Version 937, it told me that that symbol already existed.
0 -
@mbartlett21 I love your Fold SM tool. I just tried it with an imported dxf, but found it was able to do the fold but failed on the flat pattern.0
-
@Jake_Rosenfeld
If i do this:var fixed = getSMDefinitionEntities(definition.fixedFlange)[0]; // Split the part ... debug(qOwnerBody(fixed));
It highlights the wrong side of the sheet metal part (the one that's going to be transformed)0 -
@brucebartlett
You will have to make a flange somewhere on the sheet metal and select that as the fixed part.
You can then use the bend feature.
Once you're done, you can do an extrude+remove on the flange (the sketch you use must include the bend)0 -
@mbartlett21
Sorry it took me some time to get back to you on fixed reference stabilization.
I did:<div> const bodyForTransform = evaluateQuery(context, qSubtraction(robustSMBodiesQ, qOwnerBody(fixed)))[0];</div><div> const bodyForTransformTrackingQ = qUnion([startTracking(context, bodyForTransform), bodyForTransform]);</div>
And then used bodyForTransformTrackingQ invar wallAttFace = qIntersection([qOwnedByBody(bodyForTransformTrackingQ, EntityType.FACE), qEdgeAdjacent(edgeForTransform, EntityType.FACE)]);Please see in this copy of your document
https://cad.onshape.com/documents/747286511d2736b6ec7f42a9/w/8187e95388ab7c0019b24fb8/e/a4e55c145d68860ba4080549
0 -
@lana Thanks!
I also had to make my own function remapCornerBreaksForSplitFaces to deal with the walls that were split (It is based on remapCornerBreaks)0 -
@mbartlett21I also had to make my own function remapCornerBreaksForSplitFaces to deal with the walls that were split (It is based on remapCornerBreaks)That makes sense.
Thank you for extending sheet metal functionality.1





