Resolve UI issues
taskpanel threshold value add constants to PathVoronoi calls check for tool properties set correct z height coloring exterior lines
This commit is contained in:
@@ -81,28 +81,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="threshold">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Threshold is used by the medial axis filter to remove unwanted segments. If the resulting path contains unwanted segments, decrease this value. </p><p>Valid values are 0.0 - 1.0</p><p>Default = 0.8</p><p>1.0 will remove nothing.</p></body></html></string>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.800000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="toolTip">
|
||||
@@ -113,6 +91,19 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="threshold">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Threshold is used by the medial axis filter to remove unwanted segments. If the resulting path contains unwanted segments, decrease this value. </p><p>Valid values are 0.0 - 1.0</p><p>Default = 0.8</p><p>1.0 will remove nothing.</p></body></html></string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>180</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -40,6 +40,12 @@ from PySide import QtCore
|
||||
|
||||
__doc__ = "Class and implementation of Path Vcarve operation"
|
||||
|
||||
PRIMARY = 0
|
||||
EXTERIOR1 = 1
|
||||
EXTERIOR2 = 4
|
||||
TWIN = 2
|
||||
COLINEAR = 3
|
||||
OTHER = 5
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
@@ -113,14 +119,14 @@ class ObjectVcarve(PathEngraveBase.ObjectOp):
|
||||
d = round(MIC / math.tan(math.radians(toolangle / 2)), 4)
|
||||
return d if d <= maxdepth else maxdepth
|
||||
|
||||
def getEdges(vd, color=[0]):
|
||||
def getEdges(vd, color=[PRIMARY]):
|
||||
if type(color) == int:
|
||||
color = [color]
|
||||
geomList = []
|
||||
for e in vd.Edges:
|
||||
if e.Color not in color:
|
||||
continue
|
||||
if e.toGeom(8) is None:
|
||||
if e.toGeom() is None:
|
||||
continue
|
||||
p1 = e.Vertices[0].toGeom(calculate_depth(0-e.getDistances()[0]))
|
||||
p2 = e.Vertices[-1].toGeom(calculate_depth(0-e.getDistances()[-1]))
|
||||
@@ -129,8 +135,7 @@ class ObjectVcarve(PathEngraveBase.ObjectOp):
|
||||
newedge.fixTolerance(obj.Tolerance, Part.Vertex)
|
||||
geomList.append(newedge)
|
||||
|
||||
if geomList:
|
||||
return geomList
|
||||
return geomList
|
||||
|
||||
def sortEm(mywire, unmatched):
|
||||
remaining = []
|
||||
@@ -212,12 +217,13 @@ class ObjectVcarve(PathEngraveBase.ObjectOp):
|
||||
vd.construct()
|
||||
|
||||
for e in vd.Edges:
|
||||
e.Color = 0 if e.isPrimary() else 5
|
||||
vd.colorExterior(1)
|
||||
vd.colorExterior(4, lambda v: not f.isInside(v.toGeom(),
|
||||
e.Color = PRIMARY if e.isPrimary() else OTHER
|
||||
vd.colorExterior(EXTERIOR1)
|
||||
vd.colorExterior(EXTERIOR2,
|
||||
lambda v: not f.isInside(v.toGeom(f.BoundBox.ZMin),
|
||||
obj.Tolerance, True))
|
||||
vd.colorColinear(3, obj.Threshold)
|
||||
vd.colorTwins(2)
|
||||
vd.colorColinear(COLINEAR, obj.Threshold)
|
||||
vd.colorTwins(TWIN)
|
||||
|
||||
edgelist = getEdges(vd)
|
||||
|
||||
@@ -230,6 +236,12 @@ class ObjectVcarve(PathEngraveBase.ObjectOp):
|
||||
'''opExecute(obj) ... process engraving operation'''
|
||||
PathLog.track()
|
||||
|
||||
if not (hasattr(obj.ToolController.Tool, "CuttingEdgeAngle") and
|
||||
hasattr(obj.ToolController.Tool, "CuttingEdgeHeight")):
|
||||
FreeCAD.Console.PrintError(
|
||||
translate("Path_Vcarve", "VCarve requires an engraving \
|
||||
cutter with CuttingEdgeAngle and CuttingEdgeHeight") + "\n")
|
||||
|
||||
if obj.ToolController.Tool.CuttingEdgeAngle >= 180.0:
|
||||
FreeCAD.Console.PrintError(
|
||||
translate("Path_Vcarve",
|
||||
@@ -276,5 +288,5 @@ def Create(name, obj=None):
|
||||
'''Create(name) ... Creates and returns a Vcarve operation.'''
|
||||
if obj is None:
|
||||
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
|
||||
proxy = ObjectVcarve(obj, name)
|
||||
ObjectVcarve(obj, name)
|
||||
return obj
|
||||
|
||||
Reference in New Issue
Block a user