help on sheet metal script

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
jaisejames
Posts: 384
Joined: Sat Sep 24, 2016 6:51 am

help on sheet metal script

Post by jaisejames »

I have modified sheet metal.py to add miter angle. but it is not unfolding. Help on this.
Attachments
SheetMetalCmd.py
(14.84 KiB) Downloaded 186 times
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: help on sheet metal script

Post by looo »

I think you have to be a bit more specific. Give some information, what you want to achieve, what error message appears,...
jaisejames
Posts: 384
Joined: Sat Sep 24, 2016 6:51 am

Re: help on sheet metal script

Post by jaisejames »

I made some changes to wall creation. In case miter angle, it will create two faces at the bend length & part loft between both instead of extrude.

Code is given as below

Code: Select all

    if extLen > 0 :
      # calculate miter length
      seamlen = extLen * math.tan(math.radians(miterA))
      seamgap1 = gap1 + seamlen
      seamgap2 = len - gap2 - seamlen
      if seamlen :
        seamEdge = thkEdge.copy()
        # make second face for lofting
        seamFace = smMakeFace(seamEdge, revDir, seamgap1, seamgap2)
        seamFace.rotate(revAxisP, revAxisV, bendA)
        seamFace.translate(wallFace.normalAt(0,0) * extLen)
        wallSolid = Part.makeLoft([wallFace.Wires[0],seamFace.Wires[0]],True)
      else:  
        wallSolid = wallFace.extrude(wallFace.normalAt(0,0) * extLen)
      resultSolid = resultSolid.fuse(wallSolid)
jaisejames
Posts: 384
Joined: Sat Sep 24, 2016 6:51 am

Re: help on sheet metal script

Post by jaisejames »

pic of miter angle
sheetmetal.png
sheetmetal.png (42.26 KiB) Viewed 4073 times
User avatar
easyw-fc
Veteran
Posts: 3629
Joined: Thu Jul 09, 2015 9:34 am

Re: help on sheet metal script

Post by easyw-fc »

jaisejames wrote: Fri Nov 10, 2017 7:17 am I made some changes to wall creation. In case miter angle, it will create two faces at the bend length & part loft between both instead of extrude.

Code is given as below
...
miter angle could be a very nice addition... :)

the unfolder code is in
https://github.com/shaise/FreeCAD_Sheet ... nfolder.py

may be @shaise or @ulrich1a may have a hint
User avatar
shaise
Posts: 470
Joined: Thu Jun 11, 2015 8:11 am

Re: help on sheet metal script

Post by shaise »

I agree. I will add a miter option to the to-do list...
User avatar
easyw-fc
Veteran
Posts: 3629
Joined: Thu Jul 09, 2015 9:34 am

Re: help on sheet metal script

Post by easyw-fc »

shaise wrote: Fri Nov 10, 2017 5:23 pm I agree. I will add a miter option to the to-do list...
the posted code is already working...
ATM is the unfold that is not working when a sheet metal is mitered
UR_
Veteran
Posts: 1354
Joined: Tue Jan 03, 2017 8:42 pm

Re: help on sheet metal script

Post by UR_ »

SheetMetallcmd.py produces mitering parts by makeloft

Code: Select all

wallSolid = Part.makeLoft([wallFace.Wires[0],seamFace.Wires[0]],True)
Faces of resulting part are BSplineSurfaces, which are not necessary planes.

Unfold tool will sort them out, while doing his plausibility checks.
Is this is a bad idea for a sheetmetal part? :roll:

So try to make mitering part by sweeping, this will produce plane faces, same as extrude used by sheetmetalWB

bend loft vs extrude vs sweep.FCStd
(23.89 KiB) Downloaded 99 times
jaisejames
Posts: 384
Joined: Sat Sep 24, 2016 6:51 am

Re: help on sheet metal script

Post by jaisejames »

Thanks for the hint. updated script is attached. we need to add some gap to work unfold.
Attachments
SheetMetalCmd.py
(15.22 KiB) Downloaded 147 times
User avatar
shaise
Posts: 470
Joined: Thu Jun 11, 2015 8:11 am

Re: help on sheet metal script

Post by shaise »

Very nice! now Unfold work as well.

@jaisejames, with your permission, I will add this fix to the release.

shai
Post Reply