PATH: conversion of PathContour to PathArea nearly complete

Path: improve contour to use makeSections
This commit is contained in:
sliptonic
2017-05-01 23:56:36 -05:00
committed by wmayer
parent 018ba981f8
commit 775b91d1a2
4 changed files with 87 additions and 182 deletions

View File

@@ -33,6 +33,7 @@ import numpy
import PathLog
#from math import pi
from FreeCAD import Vector
import Path
LOG_MODULE = 'PathUtils'
PathLog.setLevel(PathLog.Level.INFO, LOG_MODULE)
@@ -193,6 +194,22 @@ def filterArcs(arcEdge):
pass
return splitlist
def getEnvelope(partshape, stockheight=None):
'''
getEnvelop(partshape, stockheight=None)
returns a shape corresponding to the partshape silhouette extruded to height.
if stockheight is given, the returned shape is extruded to that height otherwise the returned shape
is the height of the original shape boundbox
partshape = solid object
stockheight = float
'''
area = Path.Area(Fill=1, Coplanar=0).add(partshape)
area.setPlane(Part.makeCircle(10))
sec = area.makeSections(heights=[1.0], project=True)[0].getShape(rebuild=True)
if stockheight is not None:
return sec.extrude(FreeCAD.Vector(0, 0, stockheight))
else:
return sec.extrude(FreeCAD.Vector(0, 0, partshape.BoundBox.ZMax))
def reverseEdge(e):
if geomType(e) == "Circle":