From d08aef58a9521a72e6ea86f5dee91c107c247e40 Mon Sep 17 00:00:00 2001 From: Russell Johnson <47639332+Russ4262@users.noreply.github.com> Date: Sat, 10 Apr 2021 14:05:52 -0500 Subject: [PATCH] Path: Correct GUI visualization of circular-face visualizations Path: Fix internal circular extension visualization --- .../Path/PathScripts/PathPocketShapeGui.py | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathPocketShapeGui.py b/src/Mod/Path/PathScripts/PathPocketShapeGui.py index 4e1b651148..c43000d0bd 100644 --- a/src/Mod/Path/PathScripts/PathPocketShapeGui.py +++ b/src/Mod/Path/PathScripts/PathPocketShapeGui.py @@ -75,6 +75,7 @@ class _Extension(object): hnt = coin.SoShapeHints() if not ext is None: + numVert = list() # track number of verticies in each polygon face try: wire = ext.getWire() except FreeCAD.Base.FreeCADError: @@ -86,8 +87,22 @@ class _Extension(object): p2 = list(reversed(p1)) polygon = [(p.x, p.y, p.z) for p in (p0 + p2)] else: - poly = [p for p in wire.discretize(Deflection=0.02)][:-1] - polygon = [(p.x, p.y, p.z) for p in poly] + if ext.extFaces: + # Create polygon for each extension face in compound extensions + allPolys = list() + extFaces = ext.getExtensionFaces(wire) + for f in extFaces: + pCnt = 0 + for w in f.Wires: + poly = [p for p in w.discretize(Deflection=0.01)] + pCnt += len(poly) + allPolys.extend(poly) + numVert.append(pCnt) + polygon = [(p.x, p.y, p.z) for p in allPolys] + else: + # poly = [p for p in wire.discretize(Deflection=0.02)][:-1] + poly = [p for p in wire.discretize(Deflection=0.02)] + polygon = [(p.x, p.y, p.z) for p in poly] crd.point.setValues(polygon) else: return None @@ -98,6 +113,10 @@ class _Extension(object): hnt.faceType = coin.SoShapeHints.UNKNOWN_FACE_TYPE hnt.vertexOrdering = coin.SoShapeHints.CLOCKWISE + if numVert: + # Transfer vertex counts for polygon faces + fce.numVertices.setValues(tuple(numVert)) + sep.addChild(pos) sep.addChild(mat) sep.addChild(hnt)