That's great. Just one word: Thanks
help on sheet metal script
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: help on sheet metal script
jaisejames,
can you please look into issue #89 on sheetmetal. It looks like there is a problem: When you set a gap of X mm, you get a gap of 2X mm. It looks like the miter function returns the gap doubled
https://github.com/shaise/FreeCAD_SheetMetal/issues/89
shai
-
- Posts: 384
- Joined: Sat Sep 24, 2016 6:51 am
Re: help on sheet metal script
By Wednesday, I can check.
We can change x+ y to max(x,y) line 356 & 357. While adding x + y gap 5 + 5 become 10. So that May be the problem.
We can change x+ y to max(x,y) line 356 & 357. While adding x + y gap 5 + 5 become 10. So that May be the problem.
Re: help on sheet metal script
Hi Maurice!
I'm back again about your fix PR 83
This was a great fix, but it involved a minor drawback though: with full 3D sheet metal parts like this 3D-shell-sloped-sheet-metal-v2.FCStd peripheral filets are transformed to Bsplines in unfold outline sketch.
However arcs would be better for Gcode export purpose IMHO.
As you know it's possible to get arcs from Bspline in sketches, like with this macro for eg.
Would you mind to include such behavior in the sheet metal unfold tool? As an integrated post-process maybe? As an option maybe as well?
What's your opinion about that?
Thanks for your kind attention.
Re: help on sheet metal script
Hi @-alex-
I have adapted the macro code to cover most the user case of SM wb. It could be just integrated as an extra button to simplify the sketches.
Code: Select all
# -*- coding: utf-8 -*-
''' Approximation of wires containing bezier curves by arcs '''
import FreeCAD
from DraftGeomUtils import geomType
import Draft
def cleanedges(splines, precision):
'''cleanedges([splines],precision). Convert BSpline curves, Beziers, to arcs that can be used for cnc paths.
Returns Lines as is. Filters Circle and Arcs for over 180 degrees. Discretizes Ellipses. Ignores other geometry. '''
edges = []
for spline in splines:
if geomType(spline) == "BSplineCurve":
arcs = spline.Curve.toBiArcs(precision)
for i in arcs:
edges.append(Part.Edge(i))
elif geomType(spline) == "BezierCurve":
newspline = spline.Curve.toBSpline()
arcs = newspline.toBiArcs(precision)
for i in arcs:
edges.append(Part.Edge(i))
elif geomType(spline) == "Ellipse":
edges.append(Part.makePolygon(spline.discretize(QuasiDeflection=precision/2))) # fixme hardcoded value
# edges = curvetowire(spline, 1.0) # fixme hardcoded value
elif geomType(spline) == "Circle":
# arcs = PathUtils.filterArcs(spline)
# for i in arcs:
# edges.append(Part.Edge(i))
edges.append(spline)
elif geomType(spline) == "Line":
edges.append(spline)
elif geomType(spline) == "LineSegment":
edges.append(spline)
else:
pass
return edges
def shape2Sketch(shape, label):
# replace shape.edges with arcs
global test
newEdges = cleanedges(shape.Edges,0.2)
# for i in newEdges:
# s=Part.Edge(i)
# Part.show(s)
# wire = Part.Wire([Part.Edge(i) for i in newEdges])
# sketch = Draft.makeSketch(wire,autoconstraints=True,delete=True)
sketch = Draft.makeSketch(newEdges,autoconstraints=True,delete=True)
sketch.Label = label + '_simplified'
selection = FreeCADGui.Selection.getSelectionEx()
for s in selection:
need2symplify = False
for e in s.Object.Shape.Edges:
if geomType(e) == "BSplineCurve" or geomType(e) == "BezierCurve" or geomType(e) == "Ellipse":
need2symplify = True
if need2symplify:
shape2Sketch(s.Object.Shape,s.Object.Label)
print (s.Object.Label, "simplified")
s.Object.Visibility=False
else:
print (s.Object.Label, "not needed to be simplified")
FreeCAD.ActiveDocument.recompute()