Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape, CAD, maker project and design.

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.

Sheet Metal Fold

mbartlett21mbartlett21 Member Posts: 1,032 EDU
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?
«1

Comments

  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 739 ✭✭✭✭

    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?

  • mbartlett21mbartlett21 Member Posts: 1,032 EDU
    @konstantin_shiriazdanov
    Could you make it in FS code?
  • john_mcclaryjohn_mcclary Member, Developers Posts: 1,217 PRO
    @konstantin_shiriazdanov
    Could you make it in FS code?
    Now you're starting to sound like me XD
  • mbartlett21mbartlett21 Member Posts: 1,032 EDU
    edited November 6
    I'm assuming the angle is in radians.
    Is that right?

    Also, what are c and g?
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 739 ✭✭✭✭
    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.
  • mbartlett21mbartlett21 Member Posts: 1,032 EDU
    @konstantin_shiriazdanov
    What do c and g mean?
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 739 ✭✭✭✭
    If you mean c and g in ctg(a/2) it is cotangens, you might know it as cot() function
  • mbartlett21mbartlett21 Member Posts: 1,032 EDU
    edited November 6
    Oh ok.
    In Onshape it is atan().
    :confused:

    And i suppose tg() is tan()
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 739 ✭✭✭✭
    Yes, its a miracle that when even triginometric functions have different names, we still can understand each other :)
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 739 ✭✭✭✭
    Atan() should be arctangens, if it doesnt exist you can express it as ctg(x) =1/tan(x)
  • mbartlett21mbartlett21 Member Posts: 1,032 EDU
    @konstantin_shiriazdanov

    I have got it working in my part studio and here is the FS:
    https://cad.onshape.com/documents/9f116620b0f6d04445f57293
  • john_mcclaryjohn_mcclary Member, Developers Posts: 1,217 PRO
    Nice guys!
  • mbartlett21mbartlett21 Member Posts: 1,032 EDU
    PS: look in the flat before and after.
    Nothing changes :)
  • john_mcclaryjohn_mcclary Member, Developers Posts: 1,217 PRO
    Perfect
  • john_mcclaryjohn_mcclary Member, Developers Posts: 1,217 PRO
    Are you going to add in bend side? or will it always be based on center of bend?
  • mbartlett21mbartlett21 Member Posts: 1,032 EDU
    @john_mcclary
    You should be able to use it for angles in the opposite direction now.
  • mbartlett21mbartlett21 Member Posts: 1,032 EDU
    @john_mcclary

    You just can't fold it directly from a flat face (I don't know why, so maybe @lana could help)
  • lanalana Onshape Employees Posts: 387
    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.
  • mbartlett21mbartlett21 Member Posts: 1,032 EDU
    @lana what i am meaning is from a sheet metal model without any bends
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 739 ✭✭✭✭

    I have got it working in my part studio and here is the FS:
    https://cad.onshape.com/documents/9f116620b0f6d04445f57293
    looks like you are going to compete with OS devs in the sheet metal features implementation rate  ;)
    now you just left to add unbend capability for existing bends
  • mbartlett21mbartlett21 Member Posts: 1,032 EDU
    edited November 7
    @konstantin_shiriazdanov
    Well they are making a hem feature :) (click here)
  • mbartlett21mbartlett21 Member Posts: 1,032 EDU
    @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)
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,055
    @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 Team
  • mbartlett21mbartlett21 Member Posts: 1,032 EDU
    @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. :)
  • brucebartlettbrucebartlett Member, OS Professional, Mentor Posts: 1,684 PRO
    @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. 
    Engineer ı Product Designer ı Onshape Consulting Partner
    Twitter: @onshapetricks  & @babart1977   
  • mbartlett21mbartlett21 Member Posts: 1,032 EDU
    @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)
  • mbartlett21mbartlett21 Member Posts: 1,032 EDU
    edited November 8
    @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)
  • lanalana Onshape Employees Posts: 387
    @mbartlett21
    Sorry it took me some time to get back to you on fixed reference stabilization.
    I did:
         
     const bodyForTransform = evaluateQuery(context, qSubtraction(robustSMBodiesQ, qOwnerBody(fixed)))[0]; const bodyForTransformTrackingQ = qUnion([startTracking(context, bodyForTransform), bodyForTransform]);
    And then used bodyForTransformTrackingQ in 
    var 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

  • mbartlett21mbartlett21 Member Posts: 1,032 EDU
    @lana Thanks!
    I also had to make my own function remapCornerBreaksForSplitFaces to deal with the walls that were split (It is based on remapCornerBreaks)
  • lanalana Onshape Employees Posts: 387
    @mbartlett21
    I 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
Sign In or Register to comment.