help on sheet metal script

Need help, or want to share a macro? Post here!
jaisejames
Posts: 283
Joined: Sat Sep 24, 2016 6:51 am

help on sheet metal script

Postby jaisejames » Fri Nov 10, 2017 6:42 am

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 113 times
looo
Posts: 2966
Joined: Mon Nov 11, 2013 5:29 pm

Re: help on sheet metal script

Postby looo » Fri Nov 10, 2017 7:04 am

I think you have to be a bit more specific. Give some information, what you want to achieve, what error message appears,...
please help with my conda-packaging efforts: https://liberapay.com/looooo/
jaisejames
Posts: 283
Joined: Sat Sep 24, 2016 6:51 am

Re: help on sheet metal script

Postby jaisejames » 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

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: 283
Joined: Sat Sep 24, 2016 6:51 am

Re: help on sheet metal script

Postby jaisejames » Fri Nov 10, 2017 7:21 am

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

Re: help on sheet metal script

Postby easyw-fc » Fri Nov 10, 2017 9:02 am

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: 350
Joined: Thu Jun 11, 2015 8:11 am

Re: help on sheet metal script

Postby shaise » Fri Nov 10, 2017 5:23 pm

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

Re: help on sheet metal script

Postby easyw-fc » Fri Nov 10, 2017 5:40 pm

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_
Posts: 1021
Joined: Tue Jan 03, 2017 8:42 pm

Re: help on sheet metal script

Postby UR_ » Fri Nov 10, 2017 9:06 pm

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 43 times
jaisejames
Posts: 283
Joined: Sat Sep 24, 2016 6:51 am

Re: help on sheet metal script

Postby jaisejames » Sat Nov 11, 2017 10:35 am

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

Re: help on sheet metal script

Postby shaise » Sat Nov 11, 2017 2:01 pm

Very nice! now Unfold work as well.

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

shai