Skip to content

Commit

Permalink
Flatten Face: Output raw edges, when building face fails
Browse files Browse the repository at this point in the history
  • Loading branch information
tomate44 committed Aug 3, 2022
1 parent 6e55ab7 commit 894acc1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
14 changes: 11 additions & 3 deletions freecad/Curves/FlattenFP.py
Expand Up @@ -132,18 +132,26 @@ def flatten_face(face, inPlace=False, size=0.0):
raise TypeError(f"Flattening surface of type {face.Surface.TypeId} not implemented")
wl = []
ow = None
for w in face.Wires:
build_face = True
for i, w in enumerate(face.Wires):
el = []
for e in w.OrderedEdges:
c, fp, lp = face.curveOnSurface(e)
el.append(c.toShape(flatsurf, fp, lp))
nw = Part.Wire(el)
if w.Orientation == "Reversed":
nw.reverse()
if not nw.isClosed() or not nw.isValid():
FreeCAD.Console.PrintError(f"Wire{i + 1} is not valid. Switching to Compound output.\n")
build_face = False
nw = Part.Compound(el)
else:
if w.Orientation == "Reversed":
nw.reverse()
if w.isPartner(face.OuterWire):
ow = nw
else:
wl.append(nw)
if not build_face:
return Part.Compound([ow] + wl)
ff = Part.Face(flatsurf, ow)
ff.validate()
if wl:
Expand Down
4 changes: 2 additions & 2 deletions package.xml
Expand Up @@ -2,7 +2,7 @@
<package format="1">
<name>Curves workbench</name>
<description>A collection of tools mainly dedicated to NURBS curves and surfaces modeling.</description>
<version>0.5.2</version>
<version>0.5.3</version>
<maintainer email="cg@grellier.fr">Christophe Grellier</maintainer>
<license file="LICENSE">LGPL-2.1</license>
<url type="repository" branch="master">https://github.com/tomate44/CurvesWB</url>
Expand All @@ -13,7 +13,7 @@
<name>Curves workbench</name>
<classname>CurvesWorkbench</classname>
<description>A collection of tools mainly dedicated to NURBS curves and surfaces modeling.</description>
<version>0.5.2</version>
<version>0.5.3</version>
<subdirectory>./</subdirectory>
<icon>freecad/Curves/resources/icons/blendSurf.svg</icon>
<freecadmin>0.19.0</freecadmin>
Expand Down

0 comments on commit 894acc1

Please sign in to comment.