Moved PathLog to Path.Log and import it by default
This commit is contained in:
@@ -27,6 +27,7 @@ INSTALL(
|
||||
|
||||
SET(PathPython_SRCS
|
||||
Path/__init__.py
|
||||
Path/Log.py
|
||||
)
|
||||
|
||||
SET(PathScripts_SRCS
|
||||
@@ -78,7 +79,6 @@ SET(PathScripts_SRCS
|
||||
PathScripts/PathJobCmd.py
|
||||
PathScripts/PathJobDlg.py
|
||||
PathScripts/PathJobGui.py
|
||||
PathScripts/PathLog.py
|
||||
PathScripts/PathMillFace.py
|
||||
PathScripts/PathMillFaceGui.py
|
||||
PathScripts/PathOp.py
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
# ***************************************************************************
|
||||
|
||||
|
||||
import PathScripts.PathLog as PathLog
|
||||
import Path
|
||||
import numpy
|
||||
|
||||
@@ -32,10 +31,10 @@ __doc__ = "Generates the drilling toolpath for a single spotshape"
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
def generate(edge, dwelltime=0.0, peckdepth=0.0, repeat=1, retractheight=None, chipBreak=False):
|
||||
@@ -62,12 +61,12 @@ def generate(edge, dwelltime=0.0, peckdepth=0.0, repeat=1, retractheight=None, c
|
||||
startPoint = edge.Vertexes[0].Point
|
||||
endPoint = edge.Vertexes[1].Point
|
||||
|
||||
PathLog.debug(startPoint)
|
||||
PathLog.debug(endPoint)
|
||||
Path.Log.debug(startPoint)
|
||||
Path.Log.debug(endPoint)
|
||||
|
||||
PathLog.debug(numpy.isclose(startPoint.sub(endPoint).x, 0, rtol=1e-05, atol=1e-06))
|
||||
PathLog.debug(numpy.isclose(startPoint.sub(endPoint).y, 0, rtol=1e-05, atol=1e-06))
|
||||
PathLog.debug(endPoint)
|
||||
Path.Log.debug(numpy.isclose(startPoint.sub(endPoint).x, 0, rtol=1e-05, atol=1e-06))
|
||||
Path.Log.debug(numpy.isclose(startPoint.sub(endPoint).y, 0, rtol=1e-05, atol=1e-06))
|
||||
Path.Log.debug(endPoint)
|
||||
|
||||
if dwelltime > 0.0 and peckdepth > 0.0:
|
||||
raise ValueError("Peck and Dwell cannot be used together")
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
from numpy import ceil, linspace, isclose
|
||||
import Path
|
||||
import PathScripts.PathLog as PathLog
|
||||
|
||||
__title__ = "Helix Path Generator"
|
||||
__author__ = "sliptonic (Brad Collette)"
|
||||
@@ -33,10 +32,10 @@ __contributors__ = "russ4262 (Russell Johnson), Lorenz Hüdepohl"
|
||||
|
||||
|
||||
if True:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
def generate(
|
||||
@@ -56,7 +55,7 @@ def generate(
|
||||
startPoint = edge.Vertexes[0].Point
|
||||
endPoint = edge.Vertexes[1].Point
|
||||
|
||||
PathLog.track(
|
||||
Path.Log.track(
|
||||
"(helix: <{}, {}>\n hole radius {}\n inner radius {}\n step over {}\n start point {}\n end point {}\n step_down {}\n tool diameter {}\n direction {}\n startAt {})".format(
|
||||
startPoint.x,
|
||||
startPoint.y,
|
||||
@@ -121,7 +120,7 @@ def generate(
|
||||
raise ValueError("start point is below end point")
|
||||
|
||||
if hole_radius <= tool_diameter:
|
||||
PathLog.debug("(single helix mode)\n")
|
||||
Path.Log.debug("(single helix mode)\n")
|
||||
radii = [hole_radius - tool_diameter / 2]
|
||||
if radii[0] <= 0:
|
||||
raise ValueError(
|
||||
@@ -132,7 +131,7 @@ def generate(
|
||||
outer_radius = hole_radius
|
||||
|
||||
else: # inner_radius > 0:
|
||||
PathLog.debug("(annulus mode / full hole)\n")
|
||||
Path.Log.debug("(annulus mode / full hole)\n")
|
||||
outer_radius = hole_radius - tool_diameter / 2
|
||||
step_radius = inner_radius + tool_diameter / 2
|
||||
if abs((outer_radius - step_radius) / step_over_distance) < 1e-5:
|
||||
@@ -141,7 +140,7 @@ def generate(
|
||||
nr = max(int(ceil((outer_radius - inner_radius) / step_over_distance)), 2)
|
||||
radii = linspace(outer_radius, step_radius, nr)
|
||||
|
||||
PathLog.debug("Radii: {}".format(radii))
|
||||
Path.Log.debug("Radii: {}".format(radii))
|
||||
# calculate the number of full and partial turns required
|
||||
# Each full turn is two 180 degree arcs. Zsteps is equally spaced step
|
||||
# down values
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
# The main generator function should be extended to include other flavors of 3+2
|
||||
|
||||
|
||||
import PathScripts.PathLog as PathLog
|
||||
import math
|
||||
import Path
|
||||
import FreeCAD
|
||||
@@ -38,10 +37,10 @@ __doc__ = "Generates the rotation toolpath"
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
class refAxis(Enum):
|
||||
@@ -56,7 +55,7 @@ def relAngle(vec, ref):
|
||||
relative angle. The result is returned in degrees (plus or minus)
|
||||
"""
|
||||
|
||||
PathLog.debug("vec: {} ref: {}".format(vec, ref))
|
||||
Path.Log.debug("vec: {} ref: {}".format(vec, ref))
|
||||
norm = vec * 1 # copy vec so we don't alter original
|
||||
|
||||
if ref == refAxis.x:
|
||||
@@ -72,7 +71,7 @@ def relAngle(vec, ref):
|
||||
rot = FreeCAD.Rotation(norm, ref)
|
||||
ang = math.degrees(rot.Angle)
|
||||
angle = ang * plane.dot(rot.Axis)
|
||||
PathLog.debug("relative ang: {}".format(angle))
|
||||
Path.Log.debug("relative ang: {}".format(angle))
|
||||
|
||||
return angle
|
||||
|
||||
@@ -83,7 +82,7 @@ def __getCRotation(normalVector, cMin=-360, cMax=360):
|
||||
with either the +y or -y axis.
|
||||
multiple poses may be possible. Returns a list of all valid poses
|
||||
"""
|
||||
PathLog.debug("normalVector: {} cMin: {} cMax: {}".format(normalVector, cMin, cMax))
|
||||
Path.Log.debug("normalVector: {} cMin: {} cMax: {}".format(normalVector, cMin, cMax))
|
||||
|
||||
angle = relAngle(normalVector, refAxis.y)
|
||||
|
||||
@@ -152,7 +151,7 @@ def generate(normalVector, aMin=-360, aMax=360, cMin=-360, cMax=360, compound=Fa
|
||||
normalVector = rot.multVec(n
|
||||
"""
|
||||
|
||||
PathLog.track(
|
||||
Path.Log.track(
|
||||
"\n=============\n normalVector: {}\n aMin: {}\n aMax: {}\n cMin: {}\n cMax: {}".format(
|
||||
normalVector, aMin, aMax, cMin, cMax
|
||||
)
|
||||
@@ -160,7 +159,7 @@ def generate(normalVector, aMin=-360, aMax=360, cMin=-360, cMax=360, compound=Fa
|
||||
|
||||
# Calculate C rotation
|
||||
cResults = __getCRotation(normalVector, cMin, cMax)
|
||||
PathLog.debug("C Rotation results {}".format(cResults))
|
||||
Path.Log.debug("C Rotation results {}".format(cResults))
|
||||
|
||||
solutions = []
|
||||
for result in cResults:
|
||||
@@ -172,7 +171,7 @@ def generate(normalVector, aMin=-360, aMax=360, cMin=-360, cMax=360, compound=Fa
|
||||
# Get the candidate A rotation for the new vector
|
||||
aResult = __getARotation(newvec, aMin, aMax)
|
||||
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"\n=====\nFor C Rotation: {}\n Calculated A {}\n".format(result, aResult)
|
||||
)
|
||||
|
||||
@@ -191,7 +190,7 @@ def generate(normalVector, aMin=-360, aMax=360, cMin=-360, cMax=360, compound=Fa
|
||||
best = solution
|
||||
curlen = testlen
|
||||
|
||||
PathLog.debug("best result: {}".format(best))
|
||||
Path.Log.debug("best result: {}".format(best))
|
||||
|
||||
# format and return rotation commands
|
||||
commands = []
|
||||
|
||||
@@ -25,7 +25,6 @@ from __future__ import print_function
|
||||
import FreeCAD
|
||||
import Path
|
||||
import PathScripts.PathGeom as PathGeom
|
||||
import PathScripts.PathLog as PathLog
|
||||
import math
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
|
||||
@@ -35,10 +34,10 @@ __url__ = "http://www.freecadweb.org"
|
||||
__doc__ = "Path thread milling operation."
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
@@ -184,12 +183,12 @@ def generate(center, cmd, zStart, zFinal, pitch, radius, leadInOut, elevator, st
|
||||
a = math.atan2(y - center.y, x - center.x)
|
||||
dx = math.cos(a) * (radius - elevator)
|
||||
dy = math.sin(a) * (radius - elevator)
|
||||
PathLog.debug("")
|
||||
PathLog.debug("a={}: dx={:.2f}, dy={:.2f}".format(a / math.pi * 180, dx, dy))
|
||||
Path.Log.debug("")
|
||||
Path.Log.debug("a={}: dx={:.2f}, dy={:.2f}".format(a / math.pi * 180, dx, dy))
|
||||
|
||||
elevatorX = x - dx
|
||||
elevatorY = y - dy
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"({:.2f}, {:.2f}) -> ({:.2f}, {:.2f})".format(x, y, elevatorX, elevatorY)
|
||||
)
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
# ***************************************************************************
|
||||
|
||||
|
||||
import PathScripts.PathLog as PathLog
|
||||
import Path
|
||||
from enum import Enum
|
||||
|
||||
@@ -32,10 +31,10 @@ __doc__ = "Generates the rotation toolpath"
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
class SpindleDirection(Enum):
|
||||
@@ -52,7 +51,7 @@ def generate(
|
||||
|
||||
"""
|
||||
|
||||
PathLog.track(
|
||||
Path.Log.track(
|
||||
f"toolnumber:{toolnumber} toollabel: {toollabel} spindlespeed:{spindlespeed} spindledirection: {spindledirection}"
|
||||
)
|
||||
|
||||
@@ -73,7 +72,7 @@ def generate(
|
||||
else:
|
||||
commands.append(Path.Command(spindledirection.value, {"S": spindlespeed}))
|
||||
|
||||
PathLog.track(commands)
|
||||
Path.Log.track(commands)
|
||||
return commands
|
||||
|
||||
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
from PathApp import *
|
||||
|
||||
import Path.Log
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
# ***************************************************************************
|
||||
|
||||
import FreeCAD
|
||||
import Path
|
||||
import PathScripts
|
||||
import PathScripts.PathLog as PathLog
|
||||
import traceback
|
||||
|
||||
from PathScripts.PathUtils import loopdetect
|
||||
@@ -80,7 +80,7 @@ class _CommandSelectLoop:
|
||||
self.active = False
|
||||
return self.active
|
||||
except Exception as exc:
|
||||
PathLog.error(exc)
|
||||
Path.Log.error(exc)
|
||||
traceback.print_exc(exc)
|
||||
return False
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
# ***************************************************************************
|
||||
|
||||
import FreeCAD
|
||||
import PathScripts.PathLog as PathLog
|
||||
import Path
|
||||
import PathMachineState
|
||||
import PathScripts.PathGeom as PathGeom
|
||||
import Part
|
||||
@@ -37,10 +37,10 @@ TODO: This needs to be able to handle feedrates for axes other than X,Y,Z
|
||||
"""
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
def setFeedRate(commandlist, ToolController):
|
||||
|
||||
@@ -26,15 +26,15 @@ __url__ = "https://www.freecadweb.org"
|
||||
__doc__ = "Dataclass to implement a machinestate tracker"
|
||||
__contributors__ = ""
|
||||
|
||||
import PathScripts.PathLog as PathLog
|
||||
import Path
|
||||
import FreeCAD
|
||||
from PathScripts.PathGeom import CmdMoveRapid, CmdMoveAll, CmdMoveDrill
|
||||
|
||||
if True:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
class MachineState:
|
||||
|
||||
@@ -22,11 +22,10 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
import Path
|
||||
import PathScripts.PathOp as PathOp
|
||||
import PathScripts.PathUtils as PathUtils
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathGeom as PathGeom
|
||||
import Path
|
||||
import FreeCAD
|
||||
import time
|
||||
import json
|
||||
@@ -52,10 +51,10 @@ DraftGeomUtils = LazyLoader("DraftGeomUtils", globals(), "DraftGeomUtils")
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
@@ -653,7 +652,7 @@ def Execute(op, obj):
|
||||
if FreeCAD.GuiUp:
|
||||
sceneGraph = FreeCADGui.ActiveDocument.ActiveView.getSceneGraph()
|
||||
|
||||
PathLog.info("*** Adaptive toolpath processing started...\n")
|
||||
Path.Log.info("*** Adaptive toolpath processing started...\n")
|
||||
|
||||
# hide old toolpaths during recalculation
|
||||
obj.Path = Path.Path("(Calculating...)")
|
||||
@@ -680,7 +679,7 @@ def Execute(op, obj):
|
||||
# Get list of working edges for adaptive algorithm
|
||||
pathArray = op.pathArray
|
||||
if not pathArray:
|
||||
PathLog.error("No wire data returned.")
|
||||
Path.Log.error("No wire data returned.")
|
||||
return
|
||||
|
||||
path2d = convertTo2d(pathArray)
|
||||
@@ -798,12 +797,12 @@ def Execute(op, obj):
|
||||
GenerateGCode(op, obj, adaptiveResults, helixDiameter)
|
||||
|
||||
if not obj.StopProcessing:
|
||||
PathLog.info("*** Done. Elapsed time: %f sec\n\n" % (time.time() - start))
|
||||
Path.Log.info("*** Done. Elapsed time: %f sec\n\n" % (time.time() - start))
|
||||
obj.AdaptiveOutputState = adaptiveResults
|
||||
obj.AdaptiveInputState = inputStateObject
|
||||
|
||||
else:
|
||||
PathLog.info(
|
||||
Path.Log.info(
|
||||
"*** Processing cancelled (after: %f sec).\n\n" % (time.time() - start)
|
||||
)
|
||||
|
||||
@@ -927,11 +926,11 @@ class PathAdaptive(PathOp.ObjectOp):
|
||||
data = list()
|
||||
idx = 0 if dataType == "translated" else 1
|
||||
|
||||
PathLog.debug(enums)
|
||||
Path.Log.debug(enums)
|
||||
|
||||
for k, v in enumerate(enums):
|
||||
data.append((v, [tup[idx] for tup in enums[v]]))
|
||||
PathLog.debug(data)
|
||||
Path.Log.debug(data)
|
||||
|
||||
return data
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
import FreeCAD
|
||||
import Path
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathOp as PathOp
|
||||
import PathScripts.PathUtils as PathUtils
|
||||
|
||||
@@ -44,10 +43,10 @@ __contributors__ = "russ4262 (Russell Johnson)"
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
@@ -82,7 +81,7 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
def initOperation(self, obj):
|
||||
"""initOperation(obj) ... sets up standard Path.Area properties and calls initAreaOp().
|
||||
Do not overwrite, overwrite initAreaOp(obj) instead."""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
|
||||
# Debugging
|
||||
obj.addProperty("App::PropertyString", "AreaParams", "Path")
|
||||
@@ -113,16 +112,16 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
The default implementation returns the job's Base.Shape"""
|
||||
if job:
|
||||
if job.Stock:
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"job=%s base=%s shape=%s" % (job, job.Stock, job.Stock.Shape)
|
||||
)
|
||||
return job.Stock.Shape
|
||||
else:
|
||||
PathLog.warning(
|
||||
Path.Log.warning(
|
||||
translate("PathAreaOp", "job %s has no Base.") % job.Label
|
||||
)
|
||||
else:
|
||||
PathLog.warning(
|
||||
Path.Log.warning(
|
||||
translate("PathAreaOp", "no job for op %s found.") % obj.Label
|
||||
)
|
||||
return None
|
||||
@@ -137,7 +136,7 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
The base implementation takes a stab at determining Heights and Depths if the operations's Base
|
||||
changes.
|
||||
Do not overwrite, overwrite areaOpOnChanged(obj, prop) instead."""
|
||||
# PathLog.track(obj.Label, prop)
|
||||
# Path.Log.track(obj.Label, prop)
|
||||
if prop in ["AreaParams", "PathParams", "removalshape"]:
|
||||
obj.setEditorMode(prop, 2)
|
||||
|
||||
@@ -156,7 +155,7 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
self.areaOpOnChanged(obj, prop)
|
||||
|
||||
def opOnDocumentRestored(self, obj):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
for prop in ["AreaParams", "PathParams", "removalshape"]:
|
||||
if hasattr(obj, prop):
|
||||
obj.setEditorMode(prop, 2)
|
||||
@@ -179,18 +178,18 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
The base implementation sets the depths and heights based on the
|
||||
areaOpShapeForDepths() return value.
|
||||
Do not overwrite, overwrite areaOpSetDefaultValues(obj, job) instead."""
|
||||
PathLog.debug("opSetDefaultValues(%s, %s)" % (obj.Label, job.Label))
|
||||
Path.Log.debug("opSetDefaultValues(%s, %s)" % (obj.Label, job.Label))
|
||||
|
||||
if PathOp.FeatureDepths & self.opFeatures(obj):
|
||||
try:
|
||||
shape = self.areaOpShapeForDepths(obj, job)
|
||||
except Exception as ee:
|
||||
PathLog.error(ee)
|
||||
Path.Log.error(ee)
|
||||
shape = None
|
||||
|
||||
# Set initial start and final depths
|
||||
if shape is None:
|
||||
PathLog.debug("shape is None")
|
||||
Path.Log.debug("shape is None")
|
||||
startDepth = 1.0
|
||||
finalDepth = 0.0
|
||||
else:
|
||||
@@ -203,12 +202,12 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
obj.OpStartDepth.Value = startDepth
|
||||
obj.OpFinalDepth.Value = finalDepth
|
||||
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"Default OpDepths are Start: {}, and Final: {}".format(
|
||||
obj.OpStartDepth.Value, obj.OpFinalDepth.Value
|
||||
)
|
||||
)
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"Default Depths are Start: {}, and Final: {}".format(
|
||||
startDepth, finalDepth
|
||||
)
|
||||
@@ -223,7 +222,7 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
|
||||
def _buildPathArea(self, obj, baseobject, isHole, start, getsim):
|
||||
"""_buildPathArea(obj, baseobject, isHole, start, getsim) ... internal function."""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
area = Path.Area()
|
||||
area.setPlane(PathUtils.makeWorkplane(baseobject))
|
||||
area.add(baseobject)
|
||||
@@ -232,18 +231,18 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
areaParams['SectionTolerance'] = 1e-07
|
||||
|
||||
heights = [i for i in self.depthparams]
|
||||
PathLog.debug("depths: {}".format(heights))
|
||||
Path.Log.debug("depths: {}".format(heights))
|
||||
area.setParams(**areaParams)
|
||||
obj.AreaParams = str(area.getParams())
|
||||
|
||||
PathLog.debug("Area with params: {}".format(area.getParams()))
|
||||
Path.Log.debug("Area with params: {}".format(area.getParams()))
|
||||
|
||||
sections = area.makeSections(
|
||||
mode=0, project=self.areaOpUseProjection(obj), heights=heights
|
||||
)
|
||||
PathLog.debug("sections = %s" % sections)
|
||||
Path.Log.debug("sections = %s" % sections)
|
||||
shapelist = [sec.getShape() for sec in sections]
|
||||
PathLog.debug("shapelist = %s" % shapelist)
|
||||
Path.Log.debug("shapelist = %s" % shapelist)
|
||||
|
||||
pathParams = self.areaOpPathParams(obj, isHole)
|
||||
pathParams["shapes"] = shapelist
|
||||
@@ -267,10 +266,10 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
obj.PathParams = str(
|
||||
{key: value for key, value in pathParams.items() if key != "shapes"}
|
||||
)
|
||||
PathLog.debug("Path with params: {}".format(obj.PathParams))
|
||||
Path.Log.debug("Path with params: {}".format(obj.PathParams))
|
||||
|
||||
(pp, end_vector) = Path.fromShapes(**pathParams)
|
||||
PathLog.debug("pp: {}, end vector: {}".format(pp, end_vector))
|
||||
Path.Log.debug("pp: {}, end vector: {}".format(pp, end_vector))
|
||||
self.endVector = end_vector
|
||||
|
||||
simobj = None
|
||||
@@ -287,11 +286,11 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
|
||||
def _buildProfileOpenEdges(self, obj, edgeList, isHole, start, getsim):
|
||||
"""_buildPathArea(obj, edgeList, isHole, start, getsim) ... internal function."""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
|
||||
paths = []
|
||||
heights = [i for i in self.depthparams]
|
||||
PathLog.debug("depths: {}".format(heights))
|
||||
Path.Log.debug("depths: {}".format(heights))
|
||||
for i in range(0, len(heights)):
|
||||
for baseShape in edgeList:
|
||||
hWire = Part.Wire(Part.__sortEdges__(baseShape.Edges))
|
||||
@@ -327,11 +326,11 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
obj.PathParams = str(
|
||||
{key: value for key, value in pathParams.items() if key != "shapes"}
|
||||
)
|
||||
PathLog.debug("Path with params: {}".format(obj.PathParams))
|
||||
Path.Log.debug("Path with params: {}".format(obj.PathParams))
|
||||
|
||||
(pp, end_vector) = Path.fromShapes(**pathParams)
|
||||
paths.extend(pp.Commands)
|
||||
PathLog.debug("pp: {}, end vector: {}".format(pp, end_vector))
|
||||
Path.Log.debug("pp: {}, end vector: {}".format(pp, end_vector))
|
||||
|
||||
self.endVector = end_vector
|
||||
simobj = None
|
||||
@@ -347,7 +346,7 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
areaOpShapes(obj) ... the shape for path area to process
|
||||
areaOpUseProjection(obj) ... return true if operation can use projection
|
||||
instead."""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
|
||||
# Instantiate class variables for operation reference
|
||||
self.endVector = None
|
||||
@@ -445,7 +444,7 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
)
|
||||
)
|
||||
|
||||
PathLog.debug("obj.Name: " + str(obj.Name) + "\n\n")
|
||||
Path.Log.debug("obj.Name: " + str(obj.Name) + "\n\n")
|
||||
return sims
|
||||
|
||||
def areaOpRetractTool(self, obj):
|
||||
|
||||
@@ -24,7 +24,6 @@ import FreeCAD
|
||||
import FreeCADGui
|
||||
import Path
|
||||
import PathScripts
|
||||
from PathScripts import PathLog
|
||||
from PathScripts.PathDressup import toolController
|
||||
from PySide import QtCore
|
||||
import math
|
||||
@@ -373,7 +372,7 @@ class PathArray:
|
||||
path data for the requested path array."""
|
||||
|
||||
if len(self.baseList) == 0:
|
||||
PathLog.error(translate("PathArray", "No base objects for PathArray."))
|
||||
Path.Log.error(translate("PathArray", "No base objects for PathArray."))
|
||||
return None
|
||||
|
||||
base = self.baseList
|
||||
@@ -389,7 +388,7 @@ class PathArray:
|
||||
|
||||
if b_tool_controller != toolController(base[0]):
|
||||
# this may be important if Job output is split by tool controller
|
||||
PathLog.warning(
|
||||
Path.Log.warning(
|
||||
translate(
|
||||
"PathArray",
|
||||
"Arrays of paths having different tool controllers are handled according to the tool controller of the first path.",
|
||||
|
||||
@@ -26,8 +26,8 @@ from threading import Thread, Lock
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import Mesh
|
||||
import Path
|
||||
import PathScripts
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathPost as PathPost
|
||||
import camotics
|
||||
import io
|
||||
@@ -43,10 +43,10 @@ __url__ = "https://www.freecadweb.org"
|
||||
__doc__ = "Task panel for Camotics Simulation"
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
@@ -76,7 +76,7 @@ class CAMoticsUI:
|
||||
subprocess.Popen(["camotics", filename])
|
||||
|
||||
def makeCamoticsFile(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
filename = QtGui.QFileDialog.getSaveFileName(
|
||||
self.form,
|
||||
translate("Path", "Save Project As"),
|
||||
@@ -139,7 +139,7 @@ class CamoticsSimulation(QtCore.QObject):
|
||||
def worker(self, lock):
|
||||
while True:
|
||||
item = self.q.get()
|
||||
PathLog.debug("worker processing: {}".format(item))
|
||||
Path.Log.debug("worker processing: {}".format(item))
|
||||
with lock:
|
||||
if item["TYPE"] == "STATUS":
|
||||
self.statusChange.emit(item["VALUE"])
|
||||
@@ -199,7 +199,7 @@ class CamoticsSimulation(QtCore.QObject):
|
||||
)
|
||||
|
||||
postlist = PathPost.buildPostList(self.job)
|
||||
PathLog.track(postlist)
|
||||
Path.Log.track(postlist)
|
||||
# self.filenames = [PathPost.resolveFileName(self.job)]
|
||||
|
||||
success = True
|
||||
@@ -217,7 +217,7 @@ class CamoticsSimulation(QtCore.QObject):
|
||||
extraargs="--no-show-editor",
|
||||
)
|
||||
self.filenames.append(name)
|
||||
PathLog.track(result, gcode, name)
|
||||
Path.Log.track(result, gcode, name)
|
||||
|
||||
if result is None:
|
||||
success = False
|
||||
@@ -231,11 +231,11 @@ class CamoticsSimulation(QtCore.QObject):
|
||||
self.SIM.wait()
|
||||
|
||||
tot = sum([step["time"] for step in self.SIM.get_path()])
|
||||
PathLog.debug("sim time: {}".format(tot))
|
||||
Path.Log.debug("sim time: {}".format(tot))
|
||||
self.taskForm.setRunTime(tot)
|
||||
|
||||
def execute(self, timeIndex):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.SIM.start(self.callback, time=timeIndex, done=self.isDone)
|
||||
|
||||
def accept(self):
|
||||
@@ -245,7 +245,7 @@ class CamoticsSimulation(QtCore.QObject):
|
||||
pass
|
||||
|
||||
def buildproject(self): # , files=[]):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
|
||||
job = self.job
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
import FreeCAD
|
||||
import PathScripts.PathLog as PathLog
|
||||
import Path
|
||||
import PathScripts.PathOp as PathOp
|
||||
import PathScripts.drillableLib as drillableLib
|
||||
|
||||
@@ -44,10 +44,10 @@ translate = FreeCAD.Qt.translate
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
class ObjectOp(PathOp.ObjectOp):
|
||||
@@ -109,7 +109,7 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
|
||||
# for all other shapes the diameter is just the dimension in X.
|
||||
# This may be inaccurate as the BoundBox is calculated on the tessellated geometry
|
||||
PathLog.warning(
|
||||
Path.Log.warning(
|
||||
translate(
|
||||
"Path",
|
||||
"Hole diameter may be inaccurate due to tessellation on face. Consider selecting hole edge.",
|
||||
@@ -117,7 +117,7 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
)
|
||||
return shape.BoundBox.XLength
|
||||
except Part.OCCError as e:
|
||||
PathLog.error(e)
|
||||
Path.Log.error(e)
|
||||
|
||||
return 0
|
||||
|
||||
@@ -141,9 +141,9 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
if len(shape.Edges) == 1 and type(shape.Edges[0].Curve) == Part.Circle:
|
||||
return shape.Edges[0].Curve.Center
|
||||
except Part.OCCError as e:
|
||||
PathLog.error(e)
|
||||
Path.Log.error(e)
|
||||
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
translate(
|
||||
"Path",
|
||||
"Feature %s.%s cannot be processed as a circular hole - please remove from Base geometry list.",
|
||||
@@ -164,7 +164,7 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
drillable features are added to Base. In this case appropriate values for depths are also
|
||||
calculated and assigned.
|
||||
Do not overwrite, implement circularHoleExecute(obj, holes) instead."""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
|
||||
def haveLocations(self, obj):
|
||||
if PathOp.FeatureLocations & self.opFeatures(obj):
|
||||
@@ -174,7 +174,7 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
holes = []
|
||||
for base, subs in obj.Base:
|
||||
for sub in subs:
|
||||
PathLog.debug("processing {} in {}".format(sub, base.Name))
|
||||
Path.Log.debug("processing {} in {}".format(sub, base.Name))
|
||||
if self.isHoleEnabled(obj, base, sub):
|
||||
pos = self.holePosition(obj, base, sub)
|
||||
if pos:
|
||||
@@ -202,7 +202,7 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
|
||||
def findAllHoles(self, obj):
|
||||
"""findAllHoles(obj) ... find all holes of all base models and assign as features."""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
job = self.getJob(obj)
|
||||
if not job:
|
||||
return
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import Path
|
||||
import PathGui as PGui # ensure Path/Gui/Resources are loaded
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathOpGui as PathOpGui
|
||||
|
||||
from PySide import QtCore, QtGui
|
||||
@@ -36,10 +36,10 @@ __doc__ = "Implementation of circular hole specific base geometry page controlle
|
||||
LOGLEVEL = False
|
||||
|
||||
if LOGLEVEL:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.NOTICE, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.NOTICE, Path.Log.thisModule())
|
||||
|
||||
|
||||
class TaskPanelHoleGeometryPage(PathOpGui.TaskPanelBaseGeometryPage):
|
||||
@@ -63,7 +63,7 @@ class TaskPanelHoleGeometryPage(PathOpGui.TaskPanelBaseGeometryPage):
|
||||
|
||||
def setFields(self, obj):
|
||||
"""setFields(obj) ... fill form with values from obj"""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.form.baseList.blockSignals(True)
|
||||
self.form.baseList.clearContents()
|
||||
self.form.baseList.setRowCount(0)
|
||||
@@ -98,7 +98,7 @@ class TaskPanelHoleGeometryPage(PathOpGui.TaskPanelBaseGeometryPage):
|
||||
|
||||
def itemActivated(self):
|
||||
"""itemActivated() ... callback when item in table is selected"""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
if self.form.baseList.selectedItems():
|
||||
self.form.deleteBase.setEnabled(True)
|
||||
FreeCADGui.Selection.clearSelection()
|
||||
@@ -109,7 +109,7 @@ class TaskPanelHoleGeometryPage(PathOpGui.TaskPanelBaseGeometryPage):
|
||||
activatedRows.append(row)
|
||||
obj = item.data(self.DataObject)
|
||||
sub = str(item.data(self.DataObjectSub))
|
||||
PathLog.debug("itemActivated() -> %s.%s" % (obj.Label, sub))
|
||||
Path.Log.debug("itemActivated() -> %s.%s" % (obj.Label, sub))
|
||||
if sub:
|
||||
FreeCADGui.Selection.addSelection(obj, sub)
|
||||
else:
|
||||
@@ -119,7 +119,7 @@ class TaskPanelHoleGeometryPage(PathOpGui.TaskPanelBaseGeometryPage):
|
||||
|
||||
def deleteBase(self):
|
||||
"""deleteBase() ... callback for push button"""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
selected = [
|
||||
self.form.baseList.row(item) for item in self.form.baseList.selectedItems()
|
||||
]
|
||||
@@ -135,23 +135,23 @@ class TaskPanelHoleGeometryPage(PathOpGui.TaskPanelBaseGeometryPage):
|
||||
|
||||
def updateBase(self):
|
||||
"""updateBase() ... helper function to transfer current table to obj"""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
newlist = []
|
||||
for i in range(self.form.baseList.rowCount()):
|
||||
item = self.form.baseList.item(i, 0)
|
||||
obj = item.data(self.DataObject)
|
||||
sub = str(item.data(self.DataObjectSub))
|
||||
base = (obj, sub)
|
||||
PathLog.debug("keeping (%s.%s)" % (obj.Label, sub))
|
||||
Path.Log.debug("keeping (%s.%s)" % (obj.Label, sub))
|
||||
newlist.append(base)
|
||||
PathLog.debug("obj.Base=%s newlist=%s" % (self.obj.Base, newlist))
|
||||
Path.Log.debug("obj.Base=%s newlist=%s" % (self.obj.Base, newlist))
|
||||
self.updating = True
|
||||
self.obj.Base = newlist
|
||||
self.updating = False
|
||||
|
||||
def checkedChanged(self):
|
||||
"""checkeChanged() ... callback when checked status of a base feature changed"""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
disabled = []
|
||||
for i in range(0, self.form.baseList.rowCount()):
|
||||
item = self.form.baseList.item(i, 0)
|
||||
|
||||
@@ -21,14 +21,14 @@
|
||||
# ***************************************************************************
|
||||
|
||||
import FreeCAD
|
||||
import PathScripts.PathLog as PathLog
|
||||
import Path
|
||||
from PySide import QtCore
|
||||
from PathScripts.PathUtils import waiting_effects
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
|
||||
LOG_MODULE = "PathCollision"
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, LOG_MODULE)
|
||||
PathLog.trackModule("PathCollision")
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, LOG_MODULE)
|
||||
Path.Log.trackModule("PathCollision")
|
||||
FreeCAD.setLogLevel("Path.Area", 0)
|
||||
|
||||
__title__ = "Path Collision Utility"
|
||||
|
||||
@@ -24,7 +24,6 @@ import FreeCAD
|
||||
import Path
|
||||
|
||||
import PathScripts.PathOp as PathOp
|
||||
import PathScripts.PathLog as PathLog
|
||||
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
|
||||
@@ -35,10 +34,10 @@ __doc__ = "Path Custom object and FreeCAD command"
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
# ***************************************************************************
|
||||
|
||||
import FreeCAD
|
||||
import Path
|
||||
import PathScripts.PathEngraveBase as PathEngraveBase
|
||||
import PathScripts.PathGeom as PathGeom
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathOp as PathOp
|
||||
import PathScripts.PathOpTools as PathOpTools
|
||||
import math
|
||||
@@ -43,10 +43,10 @@ __doc__ = "Deburr operation."
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
@@ -118,7 +118,7 @@ class ObjectDeburr(PathEngraveBase.ObjectOp):
|
||||
)
|
||||
|
||||
def initOperation(self, obj):
|
||||
PathLog.track(obj.Label)
|
||||
Path.Log.track(obj.Label)
|
||||
obj.addProperty(
|
||||
"App::PropertyDistance",
|
||||
"Width",
|
||||
@@ -197,12 +197,12 @@ class ObjectDeburr(PathEngraveBase.ObjectOp):
|
||||
data = list()
|
||||
idx = 0 if dataType == "translated" else 1
|
||||
|
||||
PathLog.debug(enums)
|
||||
Path.Log.debug(enums)
|
||||
|
||||
for k, v in enumerate(enums):
|
||||
# data[k] = [tup[idx] for tup in v]
|
||||
data.append((v, [tup[idx] for tup in enums[v]]))
|
||||
PathLog.debug(data)
|
||||
Path.Log.debug(data)
|
||||
|
||||
return data
|
||||
|
||||
@@ -210,7 +210,7 @@ class ObjectDeburr(PathEngraveBase.ObjectOp):
|
||||
obj.setEditorMode("Join", 2) # hide for now
|
||||
|
||||
def opExecute(self, obj):
|
||||
PathLog.track(obj.Label)
|
||||
Path.Log.track(obj.Label)
|
||||
if not hasattr(self, "printInfo"):
|
||||
self.printInfo = True
|
||||
try:
|
||||
@@ -224,7 +224,7 @@ class ObjectDeburr(PathEngraveBase.ObjectOp):
|
||||
# QtGui.QMessageBox.information(None, "Tool Error", msg)
|
||||
# return
|
||||
|
||||
PathLog.track(obj.Label, depth, offset)
|
||||
Path.Log.track(obj.Label, depth, offset)
|
||||
|
||||
self.basewires = []
|
||||
self.adjusted_basewires = []
|
||||
@@ -431,7 +431,7 @@ class ObjectDeburr(PathEngraveBase.ObjectOp):
|
||||
zValues.append(z)
|
||||
|
||||
zValues.append(depth)
|
||||
PathLog.track(obj.Label, depth, zValues)
|
||||
Path.Log.track(obj.Label, depth, zValues)
|
||||
|
||||
if obj.EntryPoint < 0:
|
||||
obj.EntryPoint = 0
|
||||
@@ -444,7 +444,7 @@ class ObjectDeburr(PathEngraveBase.ObjectOp):
|
||||
return base not in self.model
|
||||
|
||||
def opSetDefaultValues(self, obj, job):
|
||||
PathLog.track(obj.Label, job.Label)
|
||||
Path.Log.track(obj.Label, job.Label)
|
||||
obj.Width = "1 mm"
|
||||
obj.ExtraDepth = "0.5 mm"
|
||||
obj.Join = "Round"
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import Path
|
||||
import PathScripts.PathDeburr as PathDeburr
|
||||
import PathScripts.PathGui as PathGui
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathOpGui as PathOpGui
|
||||
from PySide import QtCore, QtGui
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
@@ -36,10 +36,10 @@ __doc__ = "Deburr operation page controller and command implementation."
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
@@ -26,15 +26,14 @@ import math
|
||||
import PathScripts.PathGeom as PathGeom
|
||||
import PathScripts.PathUtils as PathUtils
|
||||
import PathScripts.PathGui as PathGui
|
||||
import PathScripts.PathLog as PathLog
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
from PathScripts.PathGeom import CmdMoveArc
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
if FreeCAD.GuiUp:
|
||||
|
||||
@@ -28,7 +28,6 @@ import FreeCAD
|
||||
import Path
|
||||
import PathScripts.PathDressup as PathDressup
|
||||
import PathScripts.PathGeom as PathGeom
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathUtil as PathUtil
|
||||
import PathScripts.PathUtils as PathUtils
|
||||
import math
|
||||
@@ -42,10 +41,10 @@ Part = LazyLoader("Part", globals(), "Part")
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
@@ -55,7 +54,7 @@ movecommands = CmdMoveStraight + CmdMoveRapid + CmdMoveArc
|
||||
|
||||
|
||||
def debugMarker(vector, label, color=None, radius=0.5):
|
||||
if PathLog.getLevel(PathLog.thisModule()) == PathLog.Level.DEBUG:
|
||||
if Path.Log.getLevel(Path.Log.thisModule()) == Path.Log.Level.DEBUG:
|
||||
obj = FreeCAD.ActiveDocument.addObject("Part::Sphere", label)
|
||||
obj.Label = label
|
||||
obj.Radius = radius
|
||||
@@ -67,7 +66,7 @@ def debugMarker(vector, label, color=None, radius=0.5):
|
||||
|
||||
|
||||
def debugCircle(vector, r, label, color=None):
|
||||
if PathLog.getLevel(PathLog.thisModule()) == PathLog.Level.DEBUG:
|
||||
if Path.Log.getLevel(Path.Log.thisModule()) == Path.Log.Level.DEBUG:
|
||||
obj = FreeCAD.ActiveDocument.addObject("Part::Cylinder", label)
|
||||
obj.Label = label
|
||||
obj.Radius = r
|
||||
@@ -250,7 +249,7 @@ class Chord(object):
|
||||
def getDirectionOfVector(self, B):
|
||||
A = self.asDirection()
|
||||
# if the 2 vectors are identical, they head in the same direction
|
||||
PathLog.debug(" {}.getDirectionOfVector({})".format(A, B))
|
||||
Path.Log.debug(" {}.getDirectionOfVector({})".format(A, B))
|
||||
if PathGeom.pointsCoincide(A, B):
|
||||
return "Straight"
|
||||
d = -A.x * B.y + A.y * B.x
|
||||
@@ -310,7 +309,7 @@ class Chord(object):
|
||||
return not PathGeom.isRoughly(self.End.z, self.Start.z)
|
||||
|
||||
def isANoopMove(self):
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"{}.isANoopMove(): {}".format(
|
||||
self, PathGeom.pointsCoincide(self.Start, self.End)
|
||||
)
|
||||
@@ -319,7 +318,7 @@ class Chord(object):
|
||||
|
||||
def foldsBackOrTurns(self, chord, side):
|
||||
direction = chord.getDirectionOf(self)
|
||||
PathLog.info(" - direction = %s/%s" % (direction, side))
|
||||
Path.Log.info(" - direction = %s/%s" % (direction, side))
|
||||
return direction == "Back" or direction == side
|
||||
|
||||
def connectsTo(self, chord):
|
||||
@@ -378,9 +377,9 @@ class Bone(object):
|
||||
# for some reason pi/2 is not equal to pi/2
|
||||
if math.fabs(theta - boneAngle) < 0.00001:
|
||||
# moving directly towards the corner
|
||||
PathLog.debug("adaptive - on target: %.2f - %.2f" % (distance, toolRadius))
|
||||
Path.Log.debug("adaptive - on target: %.2f - %.2f" % (distance, toolRadius))
|
||||
return distance - toolRadius
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"adaptive - angles: corner=%.2f bone=%.2f diff=%.12f"
|
||||
% (theta / math.pi, boneAngle / math.pi, theta - boneAngle)
|
||||
)
|
||||
@@ -394,7 +393,7 @@ class Bone(object):
|
||||
beta = math.fabs(addAngle(boneAngle, -theta))
|
||||
D = (distance / toolRadius) * math.sin(beta)
|
||||
if D > 1: # no intersection
|
||||
PathLog.debug("adaptive - no intersection - no bone")
|
||||
Path.Log.debug("adaptive - no intersection - no bone")
|
||||
return 0
|
||||
gamma = math.asin(D)
|
||||
alpha = math.pi - beta - gamma
|
||||
@@ -410,7 +409,7 @@ class Bone(object):
|
||||
length2 = toolRadius * math.sin(alpha2) / math.sin(beta2)
|
||||
length = min(length, length2)
|
||||
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"adaptive corner=%.2f * %.2f˚ -> bone=%.2f * %.2f˚"
|
||||
% (distance, theta, length, boneAngle)
|
||||
)
|
||||
@@ -505,7 +504,7 @@ class ObjectDressup(object):
|
||||
return outChord.foldsBackOrTurns(inChord, self.theOtherSideOf(obj.Side))
|
||||
|
||||
def findPivotIntersection(self, pivot, pivotEdge, edge, refPt, d, color):
|
||||
PathLog.track(
|
||||
Path.Log.track(
|
||||
"(%.2f, %.2f)^%.2f - [(%.2f, %.2f), (%.2f, %.2f)]"
|
||||
% (
|
||||
pivotEdge.Curve.Center.x,
|
||||
@@ -522,22 +521,22 @@ class ObjectDressup(object):
|
||||
for pt in DraftGeomUtils.findIntersection(edge, pivotEdge, dts=False):
|
||||
# debugMarker(pt, "pti.%d-%s.in" % (self.boneId, d), color, 0.2)
|
||||
distance = (pt - refPt).Length
|
||||
PathLog.debug(" --> (%.2f, %.2f): %.2f" % (pt.x, pt.y, distance))
|
||||
Path.Log.debug(" --> (%.2f, %.2f): %.2f" % (pt.x, pt.y, distance))
|
||||
if not ppt or pptDistance < distance:
|
||||
ppt = pt
|
||||
pptDistance = distance
|
||||
if not ppt:
|
||||
tangent = DraftGeomUtils.findDistance(pivot, edge)
|
||||
if tangent:
|
||||
PathLog.debug("Taking tangent as intersect %s" % tangent)
|
||||
Path.Log.debug("Taking tangent as intersect %s" % tangent)
|
||||
ppt = pivot + tangent
|
||||
else:
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"Taking chord start as intersect %s" % edge.Vertexes[0].Point
|
||||
)
|
||||
ppt = edge.Vertexes[0].Point
|
||||
# debugMarker(ppt, "ptt.%d-%s.in" % (self.boneId, d), color, 0.2)
|
||||
PathLog.debug(" --> (%.2f, %.2f)" % (ppt.x, ppt.y))
|
||||
Path.Log.debug(" --> (%.2f, %.2f)" % (ppt.x, ppt.y))
|
||||
return ppt
|
||||
|
||||
def pointIsOnEdge(self, point, edge):
|
||||
@@ -548,7 +547,7 @@ class ObjectDressup(object):
|
||||
self, bone, inChord, outChord, edge, wire, corner, smooth, color=None
|
||||
):
|
||||
if smooth == 0:
|
||||
PathLog.info(" No smoothing requested")
|
||||
Path.Log.info(" No smoothing requested")
|
||||
return [bone.lastCommand, outChord.g1Command(bone.F)]
|
||||
|
||||
d = "in"
|
||||
@@ -558,13 +557,13 @@ class ObjectDressup(object):
|
||||
refPoint = outChord.End
|
||||
|
||||
if DraftGeomUtils.areColinear(inChord.asEdge(), outChord.asEdge()):
|
||||
PathLog.info(" straight edge %s" % d)
|
||||
Path.Log.info(" straight edge %s" % d)
|
||||
return [outChord.g1Command(bone.F)]
|
||||
|
||||
pivot = None
|
||||
pivotDistance = 0
|
||||
|
||||
PathLog.info(
|
||||
Path.Log.info(
|
||||
"smooth: (%.2f, %.2f)-(%.2f, %.2f)"
|
||||
% (
|
||||
edge.Vertexes[0].Point.x,
|
||||
@@ -576,7 +575,7 @@ class ObjectDressup(object):
|
||||
for e in wire.Edges:
|
||||
self.dbg.append(e)
|
||||
if type(e.Curve) == Part.LineSegment or type(e.Curve) == Part.Line:
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
" (%.2f, %.2f)-(%.2f, %.2f)"
|
||||
% (
|
||||
e.Vertexes[0].Point.x,
|
||||
@@ -586,7 +585,7 @@ class ObjectDressup(object):
|
||||
)
|
||||
)
|
||||
else:
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
" (%.2f, %.2f)^%.2f"
|
||||
% (e.Curve.Center.x, e.Curve.Center.y, e.Curve.Radius)
|
||||
)
|
||||
@@ -595,13 +594,13 @@ class ObjectDressup(object):
|
||||
pt, e
|
||||
):
|
||||
# debugMarker(pt, "candidate-%d-%s" % (self.boneId, d), color, 0.05)
|
||||
PathLog.debug(" -> candidate")
|
||||
Path.Log.debug(" -> candidate")
|
||||
distance = (pt - refPoint).Length
|
||||
if not pivot or pivotDistance > distance:
|
||||
pivot = pt
|
||||
pivotDistance = distance
|
||||
else:
|
||||
PathLog.debug(" -> corner intersect")
|
||||
Path.Log.debug(" -> corner intersect")
|
||||
|
||||
if pivot:
|
||||
# debugCircle(pivot, self.toolRadius, "pivot.%d-%s" % (self.boneId, d), color)
|
||||
@@ -618,19 +617,19 @@ class ObjectDressup(object):
|
||||
|
||||
commands = []
|
||||
if not PathGeom.pointsCoincide(t1, inChord.Start):
|
||||
PathLog.debug(" add lead in")
|
||||
Path.Log.debug(" add lead in")
|
||||
commands.append(Chord(inChord.Start, t1).g1Command(bone.F))
|
||||
if bone.obj.Side == Side.Left:
|
||||
PathLog.debug(" add g3 command")
|
||||
Path.Log.debug(" add g3 command")
|
||||
commands.append(Chord(t1, t2).g3Command(pivot, bone.F))
|
||||
else:
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
" add g2 command center=(%.2f, %.2f) -> from (%2f, %.2f) to (%.2f, %.2f"
|
||||
% (pivot.x, pivot.y, t1.x, t1.y, t2.x, t2.y)
|
||||
)
|
||||
commands.append(Chord(t1, t2).g2Command(pivot, bone.F))
|
||||
if not PathGeom.pointsCoincide(t2, outChord.End):
|
||||
PathLog.debug(" add lead out")
|
||||
Path.Log.debug(" add lead out")
|
||||
commands.append(Chord(t2, outChord.End).g1Command(bone.F))
|
||||
|
||||
# debugMarker(pivot, "pivot.%d-%s" % (self.boneId, d), color, 0.2)
|
||||
@@ -639,7 +638,7 @@ class ObjectDressup(object):
|
||||
|
||||
return commands
|
||||
|
||||
PathLog.info(" no pivot found - straight command")
|
||||
Path.Log.info(" no pivot found - straight command")
|
||||
return [inChord.g1Command(bone.F), outChord.g1Command(bone.F)]
|
||||
|
||||
def inOutBoneCommands(self, bone, boneAngle, fixedLength):
|
||||
@@ -647,7 +646,7 @@ class ObjectDressup(object):
|
||||
|
||||
bone.tip = bone.inChord.End # in case there is no bone
|
||||
|
||||
PathLog.debug("corner = (%.2f, %.2f)" % (corner.x, corner.y))
|
||||
Path.Log.debug("corner = (%.2f, %.2f)" % (corner.x, corner.y))
|
||||
# debugMarker(corner, 'corner', (1., 0., 1.), self.toolRadius)
|
||||
|
||||
length = fixedLength
|
||||
@@ -657,7 +656,7 @@ class ObjectDressup(object):
|
||||
length = bone.adaptiveLength(boneAngle, self.toolRadius)
|
||||
|
||||
if length == 0:
|
||||
PathLog.info("no bone after all ..")
|
||||
Path.Log.info("no bone after all ..")
|
||||
return [bone.lastCommand, bone.outChord.g1Command(bone.F)]
|
||||
|
||||
# track length for marker visuals
|
||||
@@ -764,7 +763,7 @@ class ObjectDressup(object):
|
||||
onInString = "out"
|
||||
if onIn:
|
||||
onInString = "in"
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"tboneEdge boneAngle[%s]=%.2f (in=%.2f, out=%.2f)"
|
||||
% (
|
||||
onInString,
|
||||
@@ -815,7 +814,7 @@ class ObjectDressup(object):
|
||||
return [bone.lastCommand, bone.outChord.g1Command(bone.F)]
|
||||
|
||||
def insertBone(self, bone):
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
">----------------------------------- %d --------------------------------------"
|
||||
% bone.boneId
|
||||
)
|
||||
@@ -826,7 +825,7 @@ class ObjectDressup(object):
|
||||
|
||||
self.boneId = bone.boneId
|
||||
# Specific debugging `if` statement
|
||||
# if PathLog.getLevel(LOG_MODULE) == PathLog.Level.DEBUG and bone.boneId > 2:
|
||||
# if Path.Log.getLevel(LOG_MODULE) == Path.Log.Level.DEBUG and bone.boneId > 2:
|
||||
# commands = self.boneCommands(bone, False)
|
||||
# else:
|
||||
# commands = self.boneCommands(bone, enabled)
|
||||
@@ -834,7 +833,7 @@ class ObjectDressup(object):
|
||||
bone.commands = commands
|
||||
|
||||
self.shapes[bone.boneId] = self.boneShapes
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"<----------------------------------- %d --------------------------------------"
|
||||
% bone.boneId
|
||||
)
|
||||
@@ -919,7 +918,7 @@ class ObjectDressup(object):
|
||||
# lastCommand = None
|
||||
# commands.append(thisCommand)
|
||||
# continue
|
||||
PathLog.info("%3d: %s" % (i, thisCommand))
|
||||
Path.Log.info("%3d: %s" % (i, thisCommand))
|
||||
if thisCommand.Name in movecommands:
|
||||
thisChord = lastChord.moveToParameters(thisCommand.Parameters)
|
||||
thisIsACandidate = self.canAttachDogbone(thisCommand, thisChord)
|
||||
@@ -929,7 +928,7 @@ class ObjectDressup(object):
|
||||
and lastCommand
|
||||
and self.shouldInsertDogbone(obj, lastChord, thisChord)
|
||||
):
|
||||
PathLog.info(" Found bone corner: {}".format(lastChord.End))
|
||||
Path.Log.info(" Found bone corner: {}".format(lastChord.End))
|
||||
bone = Bone(
|
||||
boneId,
|
||||
obj,
|
||||
@@ -942,7 +941,7 @@ class ObjectDressup(object):
|
||||
bones = self.insertBone(bone)
|
||||
boneId += 1
|
||||
if lastBone:
|
||||
PathLog.info(" removing potential path crossing")
|
||||
Path.Log.info(" removing potential path crossing")
|
||||
# debugMarker(thisChord.Start, "it", (1.0, 0.0, 1.0))
|
||||
commands, bones = self.removePathCrossing(
|
||||
commands, lastBone, bone
|
||||
@@ -951,14 +950,14 @@ class ObjectDressup(object):
|
||||
lastCommand = bones[-1]
|
||||
lastBone = bone
|
||||
elif lastCommand and thisChord.isAPlungeMove():
|
||||
PathLog.info(" Looking for connection in odds and ends")
|
||||
Path.Log.info(" Looking for connection in odds and ends")
|
||||
haveNewLastCommand = False
|
||||
for chord in (
|
||||
chord for chord in oddsAndEnds if lastChord.connectsTo(chord)
|
||||
):
|
||||
if self.shouldInsertDogbone(obj, lastChord, chord):
|
||||
PathLog.info(" and there is one")
|
||||
PathLog.debug(
|
||||
Path.Log.info(" and there is one")
|
||||
Path.Log.debug(
|
||||
" odd/end={} last={}".format(chord, lastChord)
|
||||
)
|
||||
bone = Bone(
|
||||
@@ -973,7 +972,7 @@ class ObjectDressup(object):
|
||||
bones = self.insertBone(bone)
|
||||
boneId += 1
|
||||
if lastBone:
|
||||
PathLog.info(" removing potential path crossing")
|
||||
Path.Log.info(" removing potential path crossing")
|
||||
# debugMarker(chord.Start, "it", (0.0, 1.0, 1.0))
|
||||
commands, bones = self.removePathCrossing(
|
||||
commands, lastBone, bone
|
||||
@@ -987,16 +986,16 @@ class ObjectDressup(object):
|
||||
commands.append(thisCommand)
|
||||
lastBone = None
|
||||
elif thisIsACandidate:
|
||||
PathLog.info(" is a candidate, keeping for later")
|
||||
Path.Log.info(" is a candidate, keeping for later")
|
||||
if lastCommand:
|
||||
commands.append(lastCommand)
|
||||
lastCommand = thisCommand
|
||||
lastBone = None
|
||||
elif thisChord.isANoopMove():
|
||||
PathLog.info(" ignoring and dropping noop move")
|
||||
Path.Log.info(" ignoring and dropping noop move")
|
||||
continue
|
||||
else:
|
||||
PathLog.info(" nope")
|
||||
Path.Log.info(" nope")
|
||||
if lastCommand:
|
||||
commands.append(lastCommand)
|
||||
lastCommand = None
|
||||
@@ -1004,43 +1003,43 @@ class ObjectDressup(object):
|
||||
lastBone = None
|
||||
|
||||
if lastChord.isAPlungeMove() and thisIsACandidate:
|
||||
PathLog.info(" adding to odds and ends")
|
||||
Path.Log.info(" adding to odds and ends")
|
||||
oddsAndEnds.append(thisChord)
|
||||
|
||||
lastChord = thisChord
|
||||
else:
|
||||
if thisCommand.Name[0] != "(":
|
||||
PathLog.info(" Clean slate")
|
||||
Path.Log.info(" Clean slate")
|
||||
if lastCommand:
|
||||
commands.append(lastCommand)
|
||||
lastCommand = None
|
||||
lastBone = None
|
||||
commands.append(thisCommand)
|
||||
# for cmd in commands:
|
||||
# PathLog.debug("cmd = '%s'" % cmd)
|
||||
# Path.Log.debug("cmd = '%s'" % cmd)
|
||||
path = Path.Path(commands)
|
||||
obj.Path = path
|
||||
|
||||
def setup(self, obj, initial):
|
||||
PathLog.info("Here we go ... ")
|
||||
Path.Log.info("Here we go ... ")
|
||||
if initial:
|
||||
if hasattr(obj.Base, "BoneBlacklist"):
|
||||
# dressing up a bone dressup
|
||||
obj.Side = obj.Base.Side
|
||||
else:
|
||||
PathLog.info("Default side = right")
|
||||
Path.Log.info("Default side = right")
|
||||
# otherwise dogbones are opposite of the base path's side
|
||||
side = Side.Right
|
||||
if hasattr(obj.Base, "Side") and obj.Base.Side == "Inside":
|
||||
PathLog.info("inside -> side = left")
|
||||
Path.Log.info("inside -> side = left")
|
||||
side = Side.Left
|
||||
else:
|
||||
PathLog.info("not inside -> side stays right")
|
||||
Path.Log.info("not inside -> side stays right")
|
||||
if hasattr(obj.Base, "Direction") and obj.Base.Direction == "CCW":
|
||||
PathLog.info("CCW -> switch sides")
|
||||
Path.Log.info("CCW -> switch sides")
|
||||
side = Side.oppositeOf(side)
|
||||
else:
|
||||
PathLog.info("CW -> stay on side")
|
||||
Path.Log.info("CW -> stay on side")
|
||||
obj.Side = side
|
||||
|
||||
self.toolRadius = 5
|
||||
@@ -1214,18 +1213,18 @@ class TaskPanel(object):
|
||||
self.form.customLabel.setEnabled(customSelected)
|
||||
self.updateBoneList()
|
||||
|
||||
if PathLog.getLevel(PathLog.thisModule()) == PathLog.Level.DEBUG:
|
||||
if Path.Log.getLevel(Path.Log.thisModule()) == Path.Log.Level.DEBUG:
|
||||
for obj in FreeCAD.ActiveDocument.Objects:
|
||||
if obj.Name.startswith("Shape"):
|
||||
FreeCAD.ActiveDocument.removeObject(obj.Name)
|
||||
PathLog.info("object name %s" % self.obj.Name)
|
||||
Path.Log.info("object name %s" % self.obj.Name)
|
||||
if hasattr(self.obj.Proxy, "shapes"):
|
||||
PathLog.info("showing shapes attribute")
|
||||
Path.Log.info("showing shapes attribute")
|
||||
for shapes in self.obj.Proxy.shapes.values():
|
||||
for shape in shapes:
|
||||
Part.show(shape)
|
||||
else:
|
||||
PathLog.info("no shapes attribute found")
|
||||
Path.Log.info("no shapes attribute found")
|
||||
|
||||
def updateModel(self):
|
||||
self.getFields()
|
||||
|
||||
@@ -27,7 +27,6 @@ import FreeCAD
|
||||
import Path
|
||||
import PathScripts.PathDressup as PathDressup
|
||||
import PathScripts.PathGeom as PathGeom
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathUtil as PathUtil
|
||||
import PathScripts.PathUtils as PathUtils
|
||||
import copy
|
||||
@@ -40,16 +39,16 @@ from lazy_loader.lazy_loader import LazyLoader
|
||||
Part = LazyLoader("Part", globals(), "Part")
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
|
||||
def debugEdge(edge, prefix, force=False):
|
||||
if force or PathLog.getLevel(PathLog.thisModule()) == PathLog.Level.DEBUG:
|
||||
if force or Path.Log.getLevel(Path.Log.thisModule()) == Path.Log.Level.DEBUG:
|
||||
pf = edge.valueAt(edge.FirstParameter)
|
||||
pl = edge.valueAt(edge.LastParameter)
|
||||
if type(edge.Curve) == Part.Line or type(edge.Curve) == Part.LineSegment:
|
||||
@@ -78,7 +77,7 @@ def debugEdge(edge, prefix, force=False):
|
||||
|
||||
|
||||
def debugMarker(vector, label, color=None, radius=0.5):
|
||||
if PathLog.getLevel(PathLog.thisModule()) == PathLog.Level.DEBUG:
|
||||
if Path.Log.getLevel(Path.Log.thisModule()) == Path.Log.Level.DEBUG:
|
||||
obj = FreeCAD.ActiveDocument.addObject("Part::Sphere", label)
|
||||
obj.Label = label
|
||||
obj.Radius = radius
|
||||
@@ -90,7 +89,7 @@ def debugMarker(vector, label, color=None, radius=0.5):
|
||||
|
||||
|
||||
def debugCylinder(vector, r, height, label, color=None):
|
||||
if PathLog.getLevel(PathLog.thisModule()) == PathLog.Level.DEBUG:
|
||||
if Path.Log.getLevel(Path.Log.thisModule()) == Path.Log.Level.DEBUG:
|
||||
obj = FreeCAD.ActiveDocument.addObject("Part::Cylinder", label)
|
||||
obj.Label = label
|
||||
obj.Radius = r
|
||||
@@ -104,7 +103,7 @@ def debugCylinder(vector, r, height, label, color=None):
|
||||
|
||||
|
||||
def debugCone(vector, r1, r2, height, label, color=None):
|
||||
if PathLog.getLevel(PathLog.thisModule()) == PathLog.Level.DEBUG:
|
||||
if Path.Log.getLevel(Path.Log.thisModule()) == Path.Log.Level.DEBUG:
|
||||
obj = FreeCAD.ActiveDocument.addObject("Part::Cone", label)
|
||||
obj.Label = label
|
||||
obj.Radius1 = r1
|
||||
@@ -120,7 +119,7 @@ def debugCone(vector, r1, r2, height, label, color=None):
|
||||
|
||||
class Tag:
|
||||
def __init__(self, nr, x, y, width, height, angle, radius, enabled=True):
|
||||
PathLog.track(
|
||||
Path.Log.track(
|
||||
"%.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %d"
|
||||
% (x, y, width, height, angle, radius, enabled)
|
||||
)
|
||||
@@ -170,7 +169,7 @@ class Tag:
|
||||
self.isSquare = True
|
||||
self.solid = Part.makeCylinder(r1, height)
|
||||
radius = min(min(self.radius, r1), self.height)
|
||||
PathLog.debug("Part.makeCylinder(%f, %f)" % (r1, height))
|
||||
Path.Log.debug("Part.makeCylinder(%f, %f)" % (r1, height))
|
||||
elif self.angle > 0.0 and height > 0.0:
|
||||
# cone
|
||||
rad = math.radians(self.angle)
|
||||
@@ -187,25 +186,25 @@ class Tag:
|
||||
height = r1 * tangens * 1.01
|
||||
self.actualHeight = height
|
||||
self.r2 = r2
|
||||
PathLog.debug("Part.makeCone(%f, %f, %f)" % (r1, r2, height))
|
||||
Path.Log.debug("Part.makeCone(%f, %f, %f)" % (r1, r2, height))
|
||||
self.solid = Part.makeCone(r1, r2, height)
|
||||
else:
|
||||
# degenerated case - no tag
|
||||
PathLog.debug("Part.makeSphere(%f / 10000)" % (r1))
|
||||
Path.Log.debug("Part.makeSphere(%f / 10000)" % (r1))
|
||||
self.solid = Part.makeSphere(r1 / 10000)
|
||||
if not PathGeom.isRoughly(
|
||||
0, R
|
||||
): # testing is easier if the solid is not rotated
|
||||
angle = -PathGeom.getAngle(self.originAt(0)) * 180 / math.pi
|
||||
PathLog.debug("solid.rotate(%f)" % angle)
|
||||
Path.Log.debug("solid.rotate(%f)" % angle)
|
||||
self.solid.rotate(FreeCAD.Vector(0, 0, 0), FreeCAD.Vector(0, 0, 1), angle)
|
||||
orig = self.originAt(z - 0.01 * self.actualHeight)
|
||||
PathLog.debug("solid.translate(%s)" % orig)
|
||||
Path.Log.debug("solid.translate(%s)" % orig)
|
||||
self.solid.translate(orig)
|
||||
radius = min(self.radius, radius)
|
||||
self.realRadius = radius
|
||||
if not PathGeom.isRoughly(0, radius):
|
||||
PathLog.debug("makeFillet(%.4f)" % radius)
|
||||
Path.Log.debug("makeFillet(%.4f)" % radius)
|
||||
self.solid = self.solid.makeFillet(radius, [self.solid.Edges[0]])
|
||||
|
||||
def filterIntersections(self, pts, face):
|
||||
@@ -214,12 +213,12 @@ class Tag:
|
||||
or type(face.Surface) == Part.Cylinder
|
||||
or type(face.Surface) == Part.Toroid
|
||||
):
|
||||
PathLog.track("it's a cone/cylinder, checking z")
|
||||
Path.Log.track("it's a cone/cylinder, checking z")
|
||||
return list(
|
||||
[pt for pt in pts if pt.z >= self.bottom() and pt.z <= self.top()]
|
||||
)
|
||||
if type(face.Surface) == Part.Plane:
|
||||
PathLog.track("it's a plane, checking R")
|
||||
Path.Log.track("it's a plane, checking R")
|
||||
c = face.Edges[0].Curve
|
||||
if type(c) == Part.Circle:
|
||||
return list(
|
||||
@@ -230,7 +229,7 @@ class Tag:
|
||||
or PathGeom.isRoughly((pt - c.Center).Length, c.Radius)
|
||||
]
|
||||
)
|
||||
PathLog.error("==== we got a %s" % face.Surface)
|
||||
Path.Log.error("==== we got a %s" % face.Surface)
|
||||
|
||||
def isPointOnEdge(self, pt, edge):
|
||||
param = edge.Curve.parameter(pt)
|
||||
@@ -320,11 +319,11 @@ class MapWireToTag:
|
||||
self.edges = []
|
||||
self.entry = i
|
||||
if tail:
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"MapWireToTag(%s - %s)" % (i, tail.valueAt(tail.FirstParameter))
|
||||
)
|
||||
else:
|
||||
PathLog.debug("MapWireToTag(%s - )" % i)
|
||||
Path.Log.debug("MapWireToTag(%s - )" % i)
|
||||
self.complete = False
|
||||
self.haveProblem = False
|
||||
|
||||
@@ -364,13 +363,13 @@ class MapWireToTag:
|
||||
|
||||
def cleanupEdges(self, edges):
|
||||
# want to remove all edges from the wire itself, and all internal struts
|
||||
PathLog.track("+cleanupEdges")
|
||||
PathLog.debug(" edges:")
|
||||
Path.Log.track("+cleanupEdges")
|
||||
Path.Log.debug(" edges:")
|
||||
if not edges:
|
||||
return edges
|
||||
for e in edges:
|
||||
debugEdge(e, " ")
|
||||
PathLog.debug(":")
|
||||
Path.Log.debug(":")
|
||||
self.edgesCleanup = [copy.copy(edges)]
|
||||
|
||||
# remove any edge that has a point inside the tag solid
|
||||
@@ -402,7 +401,7 @@ class MapWireToTag:
|
||||
# if there are no edges connected to entry/exit, it means the plunge in/out is vertical
|
||||
# we need to add in the missing segment and collect the new entry/exit edges.
|
||||
if not self.entryEdges:
|
||||
PathLog.debug("fill entryEdges ...")
|
||||
Path.Log.debug("fill entryEdges ...")
|
||||
self.realEntry = sorted(
|
||||
self.edgePoints, key=lambda p: (p - self.entry).Length
|
||||
)[0]
|
||||
@@ -413,7 +412,7 @@ class MapWireToTag:
|
||||
else:
|
||||
self.realEntry = None
|
||||
if not self.exitEdges:
|
||||
PathLog.debug("fill exitEdges ...")
|
||||
Path.Log.debug("fill exitEdges ...")
|
||||
self.realExit = sorted(
|
||||
self.edgePoints, key=lambda p: (p - self.exit).Length
|
||||
)[0]
|
||||
@@ -451,7 +450,7 @@ class MapWireToTag:
|
||||
return edges
|
||||
|
||||
def orderAndFlipEdges(self, inputEdges):
|
||||
PathLog.track(
|
||||
Path.Log.track(
|
||||
"entry(%.2f, %.2f, %.2f), exit(%.2f, %.2f, %.2f)"
|
||||
% (
|
||||
self.entry.x,
|
||||
@@ -493,7 +492,7 @@ class MapWireToTag:
|
||||
)
|
||||
cnt = cnt + 1
|
||||
p0 = p
|
||||
PathLog.info("replaced edge with %d straight segments" % cnt)
|
||||
Path.Log.info("replaced edge with %d straight segments" % cnt)
|
||||
edges.remove(e)
|
||||
lastP = None
|
||||
p0 = p1
|
||||
@@ -505,25 +504,25 @@ class MapWireToTag:
|
||||
if lastP == p0:
|
||||
self.edgesOrder.append(outputEdges)
|
||||
self.edgesOrder.append(edges)
|
||||
PathLog.debug("input edges:")
|
||||
Path.Log.debug("input edges:")
|
||||
for e in inputEdges:
|
||||
debugEdge(e, " ", False)
|
||||
PathLog.debug("ordered edges:")
|
||||
Path.Log.debug("ordered edges:")
|
||||
for e, flip in outputEdges:
|
||||
debugEdge(e, " %c " % ("<" if flip else ">"), False)
|
||||
PathLog.debug("remaining edges:")
|
||||
Path.Log.debug("remaining edges:")
|
||||
for e in edges:
|
||||
debugEdge(e, " ", False)
|
||||
raise ValueError("No connection to %s" % (p0))
|
||||
elif lastP:
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"xxxxxx (%.2f, %.2f, %.2f) (%.2f, %.2f, %.2f)"
|
||||
% (p0.x, p0.y, p0.z, lastP.x, lastP.y, lastP.z)
|
||||
)
|
||||
else:
|
||||
PathLog.debug("xxxxxx (%.2f, %.2f, %.2f) -" % (p0.x, p0.y, p0.z))
|
||||
Path.Log.debug("xxxxxx (%.2f, %.2f, %.2f) -" % (p0.x, p0.y, p0.z))
|
||||
lastP = p0
|
||||
PathLog.track("-")
|
||||
Path.Log.track("-")
|
||||
return outputEdges
|
||||
|
||||
def isStrut(self, edge):
|
||||
@@ -605,7 +604,7 @@ class MapWireToTag:
|
||||
# rapid = None # commented out per LGTM suggestion
|
||||
return commands
|
||||
except Exception as e:
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
"Exception during processing tag @(%.2f, %.2f) (%s) - disabling the tag"
|
||||
% (self.tag.x, self.tag.y, e.args[0])
|
||||
)
|
||||
@@ -624,7 +623,7 @@ class MapWireToTag:
|
||||
if self.tag.solid.isInside(
|
||||
edge.valueAt(edge.LastParameter), PathGeom.Tolerance, True
|
||||
):
|
||||
PathLog.track("solid.isInside")
|
||||
Path.Log.track("solid.isInside")
|
||||
self.addEdge(edge)
|
||||
else:
|
||||
i = self.tag.intersects(edge, edge.LastParameter)
|
||||
@@ -632,13 +631,13 @@ class MapWireToTag:
|
||||
self.offendingEdge = edge
|
||||
debugEdge(edge, "offending Edge:", False)
|
||||
o = self.tag.originAt(self.tag.z)
|
||||
PathLog.debug("originAt: (%.2f, %.2f, %.2f)" % (o.x, o.y, o.z))
|
||||
Path.Log.debug("originAt: (%.2f, %.2f, %.2f)" % (o.x, o.y, o.z))
|
||||
i = edge.valueAt(edge.FirstParameter)
|
||||
if PathGeom.pointsCoincide(i, edge.valueAt(edge.FirstParameter)):
|
||||
PathLog.track("tail")
|
||||
Path.Log.track("tail")
|
||||
self.tail = edge
|
||||
else:
|
||||
PathLog.track("split")
|
||||
Path.Log.track("split")
|
||||
e, tail = PathGeom.splitEdgeAt(edge, i)
|
||||
self.addEdge(e)
|
||||
self.tail = tail
|
||||
@@ -675,7 +674,7 @@ class _RapidEdges:
|
||||
|
||||
class PathData:
|
||||
def __init__(self, obj):
|
||||
PathLog.track(obj.Base.Name)
|
||||
Path.Log.track(obj.Base.Name)
|
||||
self.obj = obj
|
||||
self.wire, rapid = PathGeom.wireForPath(obj.Base.Path)
|
||||
self.rapid = _RapidEdges(rapid)
|
||||
@@ -727,7 +726,7 @@ class PathData:
|
||||
def generateTags(
|
||||
self, obj, count, width=None, height=None, angle=None, radius=None, spacing=None
|
||||
):
|
||||
PathLog.track(count, width, height, angle, spacing)
|
||||
Path.Log.track(count, width, height, angle, spacing)
|
||||
# for e in self.baseWire.Edges:
|
||||
# debugMarker(e.Vertexes[0].Point, 'base', (0.0, 1.0, 1.0), 0.2)
|
||||
|
||||
@@ -746,7 +745,7 @@ class PathData:
|
||||
startIndex = 0
|
||||
for i in range(0, len(self.baseWire.Edges)):
|
||||
edge = self.baseWire.Edges[i]
|
||||
PathLog.debug(" %d: %.2f" % (i, edge.Length))
|
||||
Path.Log.debug(" %d: %.2f" % (i, edge.Length))
|
||||
if PathGeom.isRoughly(edge.Length, longestEdge.Length):
|
||||
startIndex = i
|
||||
break
|
||||
@@ -761,7 +760,7 @@ class PathData:
|
||||
|
||||
minLength = min(2.0 * W, longestEdge.Length)
|
||||
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"length=%.2f shortestEdge=%.2f(%.2f) longestEdge=%.2f(%.2f) minLength=%.2f"
|
||||
% (
|
||||
self.baseWire.Length,
|
||||
@@ -772,12 +771,12 @@ class PathData:
|
||||
minLength,
|
||||
)
|
||||
)
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
" start: index=%-2d count=%d (length=%.2f, distance=%.2f)"
|
||||
% (startIndex, startCount, startEdge.Length, tagDistance)
|
||||
)
|
||||
PathLog.debug(" -> lastTagLength=%.2f)" % lastTagLength)
|
||||
PathLog.debug(" -> currentLength=%.2f)" % currentLength)
|
||||
Path.Log.debug(" -> lastTagLength=%.2f)" % lastTagLength)
|
||||
Path.Log.debug(" -> currentLength=%.2f)" % currentLength)
|
||||
|
||||
edgeDict = {startIndex: startCount}
|
||||
|
||||
@@ -796,7 +795,7 @@ class PathData:
|
||||
|
||||
for (i, count) in PathUtil.keyValueIter(edgeDict):
|
||||
edge = self.baseWire.Edges[i]
|
||||
PathLog.debug(" %d: %d" % (i, count))
|
||||
Path.Log.debug(" %d: %d" % (i, count))
|
||||
# debugMarker(edge.Vertexes[0].Point, 'base', (1.0, 0.0, 0.0), 0.2)
|
||||
# debugMarker(edge.Vertexes[1].Point, 'base', (0.0, 1.0, 0.0), 0.2)
|
||||
if 0 != count:
|
||||
@@ -836,12 +835,12 @@ class PathData:
|
||||
tags.append(Tag(j, at.x, at.y, W, H, A, R, True))
|
||||
j += 1
|
||||
else:
|
||||
PathLog.warning(
|
||||
Path.Log.warning(
|
||||
"Tag[%d] (%.2f, %.2f, %.2f) is too far away to copy: %.2f (%.2f)"
|
||||
% (i, pos.x, pos.y, self.minZ, dist[0], W)
|
||||
)
|
||||
else:
|
||||
PathLog.info("tag[%d]: not enabled, skipping" % i)
|
||||
Path.Log.info("tag[%d]: not enabled, skipping" % i)
|
||||
print("copied %d tags" % len(tags))
|
||||
return tags
|
||||
|
||||
@@ -862,10 +861,10 @@ class PathData:
|
||||
tagCount += 1
|
||||
lastTagLength += tagDistance
|
||||
if tagCount > 0:
|
||||
PathLog.debug(" index=%d -> count=%d" % (index, tagCount))
|
||||
Path.Log.debug(" index=%d -> count=%d" % (index, tagCount))
|
||||
edgeDict[index] = tagCount
|
||||
else:
|
||||
PathLog.debug(" skipping=%-2d (%.2f)" % (index, edge.Length))
|
||||
Path.Log.debug(" skipping=%-2d (%.2f)" % (index, edge.Length))
|
||||
|
||||
return (currentLength, lastTagLength)
|
||||
|
||||
@@ -913,7 +912,7 @@ class PathData:
|
||||
ordered.append(t)
|
||||
# disable all tags that are not on the base wire.
|
||||
for tag in tags:
|
||||
PathLog.info(
|
||||
Path.Log.info(
|
||||
"Tag #%d (%.2f, %.2f, %.2f) not on base wire - disabling\n"
|
||||
% (len(ordered), tag.x, tag.y, self.minZ)
|
||||
)
|
||||
@@ -923,7 +922,7 @@ class PathData:
|
||||
|
||||
def pointIsOnPath(self, p):
|
||||
v = Part.Vertex(self.pointAtBottom(p))
|
||||
PathLog.debug("pt = (%f, %f, %f)" % (v.X, v.Y, v.Z))
|
||||
Path.Log.debug("pt = (%f, %f, %f)" % (v.X, v.Y, v.Z))
|
||||
for e in self.bottomEdges:
|
||||
indent = "{} ".format(e.distToShape(v)[0])
|
||||
debugEdge(e, indent, True)
|
||||
@@ -1071,7 +1070,7 @@ class ObjectTagDressup:
|
||||
return True
|
||||
|
||||
def createPath(self, obj, pathData, tags):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
commands = []
|
||||
lastEdge = 0
|
||||
lastTag = 0
|
||||
@@ -1097,7 +1096,7 @@ class ObjectTagDressup:
|
||||
vertRapid = tc.VertRapid.Value
|
||||
|
||||
while edge or lastEdge < len(pathData.edges):
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"------- lastEdge = %d/%d.%d/%d" % (lastEdge, lastTag, t, len(tags))
|
||||
)
|
||||
if not edge:
|
||||
@@ -1194,10 +1193,10 @@ class ObjectTagDressup:
|
||||
if tag.enabled:
|
||||
if prev:
|
||||
if prev.solid.common(tag.solid).Faces:
|
||||
PathLog.info(
|
||||
Path.Log.info(
|
||||
"Tag #%d intersects with previous tag - disabling\n" % i
|
||||
)
|
||||
PathLog.debug("this tag = %d [%s]" % (i, tag.solid.BoundBox))
|
||||
Path.Log.debug("this tag = %d [%s]" % (i, tag.solid.BoundBox))
|
||||
tag.enabled = False
|
||||
elif self.pathData.edges:
|
||||
e = self.pathData.edges[0]
|
||||
@@ -1206,14 +1205,14 @@ class ObjectTagDressup:
|
||||
if tag.solid.isInside(
|
||||
p0, PathGeom.Tolerance, True
|
||||
) or tag.solid.isInside(p1, PathGeom.Tolerance, True):
|
||||
PathLog.info(
|
||||
Path.Log.info(
|
||||
"Tag #%d intersects with starting point - disabling\n" % i
|
||||
)
|
||||
tag.enabled = False
|
||||
|
||||
if tag.enabled:
|
||||
prev = tag
|
||||
PathLog.debug("previousTag = %d [%s]" % (i, prev))
|
||||
Path.Log.debug("previousTag = %d [%s]" % (i, prev))
|
||||
else:
|
||||
disabled.append(i)
|
||||
tag.nr = i # assign final nr
|
||||
@@ -1241,7 +1240,7 @@ class ObjectTagDressup:
|
||||
|
||||
pathData = self.setup(obj)
|
||||
if not pathData:
|
||||
PathLog.debug("execute - no pathData")
|
||||
Path.Log.debug("execute - no pathData")
|
||||
return
|
||||
|
||||
self.tags = []
|
||||
@@ -1250,21 +1249,21 @@ class ObjectTagDressup:
|
||||
obj, obj.Positions, obj.Disabled
|
||||
)
|
||||
if obj.Disabled != disabled:
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"Updating properties.... %s vs. %s" % (obj.Disabled, disabled)
|
||||
)
|
||||
obj.Positions = positions
|
||||
obj.Disabled = disabled
|
||||
|
||||
if not self.tags:
|
||||
PathLog.debug("execute - no tags")
|
||||
Path.Log.debug("execute - no tags")
|
||||
obj.Path = obj.Base.Path
|
||||
return
|
||||
|
||||
try:
|
||||
self.processTags(obj)
|
||||
except Exception as e:
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
"processing tags failed clearing all tags ... '%s'" % (e.args[0])
|
||||
)
|
||||
obj.Path = obj.Base.Path
|
||||
@@ -1283,11 +1282,11 @@ class ObjectTagDressup:
|
||||
@waiting_effects
|
||||
def processTags(self, obj):
|
||||
tagID = 0
|
||||
if PathLog.getLevel(PathLog.thisModule()) == PathLog.Level.DEBUG:
|
||||
if Path.Log.getLevel(Path.Log.thisModule()) == Path.Log.Level.DEBUG:
|
||||
for tag in self.tags:
|
||||
tagID += 1
|
||||
if tag.enabled:
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"x=%s, y=%s, z=%s" % (tag.x, tag.y, self.pathData.minZ)
|
||||
)
|
||||
# debugMarker(FreeCAD.Vector(tag.x, tag.y, self.pathData.minZ), "tag-%02d" % tagID , (1.0, 0.0, 1.0), 0.5)
|
||||
@@ -1299,12 +1298,12 @@ class ObjectTagDressup:
|
||||
obj.Path = self.createPath(obj, self.pathData, self.tags)
|
||||
|
||||
def setup(self, obj, generate=False):
|
||||
PathLog.debug("setup")
|
||||
Path.Log.debug("setup")
|
||||
self.obj = obj
|
||||
try:
|
||||
pathData = PathData(obj)
|
||||
except ValueError:
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
translate(
|
||||
"Path_DressupTag",
|
||||
"Cannot insert holding tags for this path - please select a Profile path",
|
||||
@@ -1325,7 +1324,7 @@ class ObjectTagDressup:
|
||||
return self.pathData
|
||||
|
||||
def setXyEnabled(self, triples):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
if not self.pathData:
|
||||
self.setup(self.obj)
|
||||
positions = []
|
||||
@@ -1358,13 +1357,13 @@ def Create(baseObject, name="DressupTag"):
|
||||
Create(basePath, name='DressupTag') ... create tag dressup object for the given base path.
|
||||
"""
|
||||
if not baseObject.isDerivedFrom("Path::Feature"):
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
translate("Path_DressupTag", "The selected object is not a path") + "\n"
|
||||
)
|
||||
return None
|
||||
|
||||
if baseObject.isDerivedFrom("Path::FeatureCompoundPython"):
|
||||
PathLog.error(translate("Path_DressupTag", "Please select a Profile object"))
|
||||
Path.Log.error(translate("Path_DressupTag", "Please select a Profile object"))
|
||||
return None
|
||||
|
||||
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
|
||||
@@ -1375,4 +1374,4 @@ def Create(baseObject, name="DressupTag"):
|
||||
return obj
|
||||
|
||||
|
||||
PathLog.notice("Loading Path_DressupTag... done\n")
|
||||
Path.Log.notice("Loading Path_DressupTag... done\n")
|
||||
|
||||
@@ -28,7 +28,6 @@ import FreeCADGui
|
||||
import Path
|
||||
import PathScripts.PathDressup as PathDressup
|
||||
import PathScripts.PathGeom as PathGeom
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathUtils as PathUtils
|
||||
import math
|
||||
import copy
|
||||
@@ -42,10 +41,10 @@ from PathPythonGui.simple_edit_panel import SimpleEditPanel
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
movecommands = ["G1", "G01", "G2", "G02", "G3", "G03"]
|
||||
@@ -186,7 +185,7 @@ class ObjectDressup:
|
||||
if not obj.Base.Path:
|
||||
return
|
||||
if obj.Length < 0:
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
translate("Path_DressupLeadInOut", "Length/Radius positive not Null")
|
||||
+ "\n"
|
||||
)
|
||||
@@ -268,12 +267,12 @@ class ObjectDressup:
|
||||
p0 = queue[0].Placement.Base
|
||||
p1 = queue[1].Placement.Base
|
||||
v = self.normalize(p1.sub(p0))
|
||||
PathLog.debug(" CURRENT_IN Line : P0 Z:{} p1 Z:{}".format(p0.z, p1.z))
|
||||
Path.Log.debug(" CURRENT_IN Line : P0 Z:{} p1 Z:{}".format(p0.z, p1.z))
|
||||
else:
|
||||
p0 = queue[0].Placement.Base
|
||||
p1 = queue[1].Placement.Base
|
||||
v = self.normalize(p1.sub(p0))
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
" CURRENT_IN ARC : P0 X:{} Y:{} P1 X:{} Y:{} ".format(
|
||||
p0.x, p0.y, p1.x, p1.y
|
||||
)
|
||||
@@ -292,7 +291,7 @@ class ObjectDressup:
|
||||
vec_n = self.normalize(vec)
|
||||
vec_inv = self.invert(vec_n)
|
||||
vec_off = self.multiply(vec_inv, obj.ExtendLeadIn)
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"LineCMD: {}, Vxinv: {}, Vyinv: {}, Vxoff: {}, Vyoff: {}".format(
|
||||
queue[0].Name, vec_inv.x, vec_inv.y, vec_off.x, vec_off.y
|
||||
)
|
||||
@@ -423,7 +422,7 @@ class ObjectDressup:
|
||||
extendcommand = Path.Command("G1", {"X": p0.x, "Y": p0.y, "F": horizFeed})
|
||||
results.append(extendcommand)
|
||||
else:
|
||||
PathLog.debug(" CURRENT_IN Perp")
|
||||
Path.Log.debug(" CURRENT_IN Perp")
|
||||
|
||||
currLocation.update(results[-1].Parameters)
|
||||
currLocation["Z"] = p1.z
|
||||
@@ -464,7 +463,7 @@ class ObjectDressup:
|
||||
vec_n = self.normalize(vec)
|
||||
vec_inv = self.invert(vec_n)
|
||||
vec_off = self.multiply(vec_inv, obj.ExtendLeadOut)
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"LineCMD: {}, Vxinv: {}, Vyinv: {}, Vxoff: {}, Vyoff: {}".format(
|
||||
queue[0].Name, vec_inv.x, vec_inv.y, vec_off.x, vec_off.y
|
||||
)
|
||||
@@ -540,7 +539,7 @@ class ObjectDressup:
|
||||
)
|
||||
results.append(extendcommand)
|
||||
else:
|
||||
PathLog.debug(" CURRENT_IN Perp")
|
||||
Path.Log.debug(" CURRENT_IN Perp")
|
||||
|
||||
if obj.UseMachineCRC: # crc off
|
||||
results.append(Path.Command("G40", {}))
|
||||
@@ -560,7 +559,7 @@ class ObjectDressup:
|
||||
|
||||
# Read in all commands
|
||||
for curCommand in obj.Base.Path.Commands:
|
||||
PathLog.debug("CurCMD: {}".format(curCommand))
|
||||
Path.Log.debug("CurCMD: {}".format(curCommand))
|
||||
if curCommand.Name not in movecommands + rapidcommands:
|
||||
# Don't worry about non-move commands, just add to output
|
||||
newpath.append(curCommand)
|
||||
@@ -587,7 +586,7 @@ class ObjectDressup:
|
||||
and prevCmd.Name in movecommands
|
||||
):
|
||||
# Layer change within move cmds
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"Layer change in move: {}->{}".format(
|
||||
currLocation["Z"], curCommand.z
|
||||
)
|
||||
@@ -608,14 +607,14 @@ class ObjectDressup:
|
||||
# Go through each layer and add leadIn/Out
|
||||
idx = 0
|
||||
for layer in layers:
|
||||
PathLog.debug("Layer {}".format(idx))
|
||||
Path.Log.debug("Layer {}".format(idx))
|
||||
|
||||
if obj.LeadIn:
|
||||
temp = self.getLeadStart(obj, layer, action)
|
||||
newpath.extend(temp)
|
||||
|
||||
for cmd in layer:
|
||||
PathLog.debug("CurLoc: {}, NewCmd: {}!!".format(currLocation, cmd))
|
||||
Path.Log.debug("CurLoc: {}, NewCmd: {}!!".format(currLocation, cmd))
|
||||
newpath.append(cmd)
|
||||
|
||||
if obj.LeadOut:
|
||||
@@ -690,7 +689,7 @@ class ViewProviderDressup:
|
||||
|
||||
def onDelete(self, arg1=None, arg2=None):
|
||||
"""this makes sure that the base operation is added back to the project and visible"""
|
||||
PathLog.debug("Deleting Dressup")
|
||||
Path.Log.debug("Deleting Dressup")
|
||||
if arg1.Object and arg1.Object.Base:
|
||||
FreeCADGui.ActiveDocument.getObject(arg1.Object.Base.Name).Visibility = True
|
||||
job = PathUtils.findParentJob(self.obj)
|
||||
@@ -730,20 +729,20 @@ class CommandPathDressupLeadInOut:
|
||||
# check that the selection contains exactly what we want
|
||||
selection = FreeCADGui.Selection.getSelection()
|
||||
if len(selection) != 1:
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
translate("Path_DressupLeadInOut", "Please select one path object")
|
||||
+ "\n"
|
||||
)
|
||||
return
|
||||
baseObject = selection[0]
|
||||
if not baseObject.isDerivedFrom("Path::Feature"):
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
translate("Path_DressupLeadInOut", "The selected object is not a path")
|
||||
+ "\n"
|
||||
)
|
||||
return
|
||||
if baseObject.isDerivedFrom("Path::FeatureCompoundPython"):
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
translate("Path_DressupLeadInOut", "Please select a Profile object")
|
||||
)
|
||||
return
|
||||
@@ -777,4 +776,4 @@ if FreeCAD.GuiUp:
|
||||
# register the FreeCAD command
|
||||
FreeCADGui.addCommand("Path_DressupLeadInOut", CommandPathDressupLeadInOut())
|
||||
|
||||
PathLog.notice("Loading Path_DressupLeadInOut... done\n")
|
||||
Path.Log.notice("Loading Path_DressupLeadInOut... done\n")
|
||||
|
||||
@@ -25,16 +25,15 @@ import FreeCAD
|
||||
import Path
|
||||
import PathScripts.PathDressup as PathDressup
|
||||
import PathScripts.PathGeom as PathGeom
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathStock as PathStock
|
||||
import PathScripts.PathUtil as PathUtil
|
||||
import PathScripts.PathUtils as PathUtils
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
@@ -127,7 +126,7 @@ class PathBoundary:
|
||||
self.strG0ZclearanceHeight = None
|
||||
|
||||
def boundaryCommands(self, begin, end, verticalFeed):
|
||||
PathLog.track(_vstr(begin), _vstr(end))
|
||||
Path.Log.track(_vstr(begin), _vstr(end))
|
||||
if end and PathGeom.pointsCoincide(begin, end):
|
||||
return []
|
||||
cmds = []
|
||||
@@ -152,7 +151,7 @@ class PathBoundary:
|
||||
return None
|
||||
|
||||
if len(self.baseOp.Path.Commands) == 0:
|
||||
PathLog.warning("No Path Commands for %s" % self.baseOp.Label)
|
||||
Path.Log.warning("No Path Commands for %s" % self.baseOp.Label)
|
||||
return []
|
||||
|
||||
tc = PathDressup.toolController(self.baseOp)
|
||||
@@ -189,7 +188,7 @@ class PathBoundary:
|
||||
# it's really a shame that one cannot trust the sequence and/or
|
||||
# orientation of edges
|
||||
if 1 == len(inside) and 0 == len(outside):
|
||||
PathLog.track(_vstr(pos), _vstr(lastExit), " + ", cmd)
|
||||
Path.Log.track(_vstr(pos), _vstr(lastExit), " + ", cmd)
|
||||
# cmd fully included by boundary
|
||||
if lastExit:
|
||||
if not (
|
||||
@@ -204,19 +203,19 @@ class PathBoundary:
|
||||
commands.append(cmd)
|
||||
pos = PathGeom.commandEndPoint(cmd, pos)
|
||||
elif 0 == len(inside) and 1 == len(outside):
|
||||
PathLog.track(_vstr(pos), _vstr(lastExit), " - ", cmd)
|
||||
Path.Log.track(_vstr(pos), _vstr(lastExit), " - ", cmd)
|
||||
# cmd fully excluded by boundary
|
||||
if not lastExit:
|
||||
lastExit = pos
|
||||
pos = PathGeom.commandEndPoint(cmd, pos)
|
||||
else:
|
||||
PathLog.track(
|
||||
Path.Log.track(
|
||||
_vstr(pos), _vstr(lastExit), len(inside), len(outside), cmd
|
||||
)
|
||||
# cmd pierces boundary
|
||||
while inside or outside:
|
||||
ie = [e for e in inside if PathGeom.edgeConnectsTo(e, pos)]
|
||||
PathLog.track(ie)
|
||||
Path.Log.track(ie)
|
||||
if ie:
|
||||
e = ie[0]
|
||||
LastPt = e.valueAt(e.LastParameter)
|
||||
@@ -232,7 +231,7 @@ class PathBoundary:
|
||||
)
|
||||
)
|
||||
lastExit = None
|
||||
PathLog.track(e, flip)
|
||||
Path.Log.track(e, flip)
|
||||
if not (
|
||||
bogusX or bogusY
|
||||
): # don't insert false paths based on bogus m/c position
|
||||
@@ -255,7 +254,7 @@ class PathBoundary:
|
||||
for e in outside
|
||||
if PathGeom.edgeConnectsTo(e, pos)
|
||||
]
|
||||
PathLog.track(oe)
|
||||
Path.Log.track(oe)
|
||||
if oe:
|
||||
e = oe[0]
|
||||
ptL = e.valueAt(e.LastParameter)
|
||||
@@ -268,7 +267,7 @@ class PathBoundary:
|
||||
outside.remove(e)
|
||||
pos = newPos
|
||||
else:
|
||||
PathLog.error("huh?")
|
||||
Path.Log.error("huh?")
|
||||
import Part
|
||||
|
||||
Part.show(Part.Vertex(pos), "pos")
|
||||
@@ -284,13 +283,13 @@ class PathBoundary:
|
||||
# pos = PathGeom.commandEndPoint(cmd, pos)
|
||||
# Eif
|
||||
else:
|
||||
PathLog.track("no-move", cmd)
|
||||
Path.Log.track("no-move", cmd)
|
||||
commands.append(cmd)
|
||||
if lastExit:
|
||||
commands.extend(self.boundaryCommands(lastExit, None, tc.VertFeed.Value))
|
||||
lastExit = None
|
||||
|
||||
PathLog.track(commands)
|
||||
Path.Log.track(commands)
|
||||
return Path.Path(commands)
|
||||
|
||||
|
||||
@@ -301,7 +300,7 @@ def Create(base, name="DressupPathBoundary"):
|
||||
"""Create(base, name='DressupPathBoundary') ... creates a dressup limiting base's Path to a boundary."""
|
||||
|
||||
if not base.isDerivedFrom("Path::Feature"):
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
translate("Path_DressupPathBoundary", "The selected object is not a path")
|
||||
+ "\n"
|
||||
)
|
||||
|
||||
@@ -24,15 +24,15 @@ from PySide import QtGui
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import Path
|
||||
import PathGui as PGui # ensure Path/Gui/Resources are loaded
|
||||
import PathScripts.PathDressupPathBoundary as PathDressupPathBoundary
|
||||
import PathScripts.PathLog as PathLog
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
@@ -116,7 +116,7 @@ class TaskPanel(object):
|
||||
import PathScripts.PathStock as PathStock
|
||||
|
||||
def setupFromBaseEdit():
|
||||
PathLog.track(index, force)
|
||||
Path.Log.track(index, force)
|
||||
if force or not self.stockFromBase:
|
||||
self.stockFromBase = PathJobGui.StockFromBaseBoundBoxEdit(
|
||||
self.obj, self.form, force
|
||||
@@ -124,7 +124,7 @@ class TaskPanel(object):
|
||||
self.stockEdit = self.stockFromBase
|
||||
|
||||
def setupCreateBoxEdit():
|
||||
PathLog.track(index, force)
|
||||
Path.Log.track(index, force)
|
||||
if force or not self.stockCreateBox:
|
||||
self.stockCreateBox = PathJobGui.StockCreateBoxEdit(
|
||||
self.obj, self.form, force
|
||||
@@ -132,7 +132,7 @@ class TaskPanel(object):
|
||||
self.stockEdit = self.stockCreateBox
|
||||
|
||||
def setupCreateCylinderEdit():
|
||||
PathLog.track(index, force)
|
||||
Path.Log.track(index, force)
|
||||
if force or not self.stockCreateCylinder:
|
||||
self.stockCreateCylinder = PathJobGui.StockCreateCylinderEdit(
|
||||
self.obj, self.form, force
|
||||
@@ -140,7 +140,7 @@ class TaskPanel(object):
|
||||
self.stockEdit = self.stockCreateCylinder
|
||||
|
||||
def setupFromExisting():
|
||||
PathLog.track(index, force)
|
||||
Path.Log.track(index, force)
|
||||
if force or not self.stockFromExisting:
|
||||
self.stockFromExisting = PathJobGui.StockFromExistingEdit(
|
||||
self.obj, self.form, force
|
||||
@@ -162,7 +162,7 @@ class TaskPanel(object):
|
||||
elif PathJobGui.StockFromExistingEdit.IsStock(self.obj):
|
||||
setupFromExisting()
|
||||
else:
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
translate("PathJob", "Unsupported stock object %s")
|
||||
% self.obj.Stock.Label
|
||||
)
|
||||
@@ -178,7 +178,7 @@ class TaskPanel(object):
|
||||
setupFromBaseEdit()
|
||||
index = -1
|
||||
else:
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
translate("PathJob", "Unsupported stock type %s (%d)")
|
||||
% (self.form.stock.currentText(), index)
|
||||
)
|
||||
@@ -280,7 +280,7 @@ class CommandPathDressupPathBoundary:
|
||||
# check that the selection contains exactly what we want
|
||||
selection = FreeCADGui.Selection.getSelection()
|
||||
if len(selection) != 1:
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
translate("Path_DressupPathBoundary", "Please select one path object")
|
||||
+ "\n"
|
||||
)
|
||||
@@ -302,4 +302,4 @@ if FreeCAD.GuiUp:
|
||||
# register the FreeCAD command
|
||||
FreeCADGui.addCommand("Path_DressupPathBoundary", CommandPathDressupPathBoundary())
|
||||
|
||||
PathLog.notice("Loading PathDressupPathBoundaryGui... done\n")
|
||||
Path.Log.notice("Loading PathDressupPathBoundaryGui... done\n")
|
||||
|
||||
@@ -26,7 +26,6 @@ import FreeCAD
|
||||
import Path
|
||||
import PathScripts.PathDressup as PathDressup
|
||||
import PathScripts.PathGeom as PathGeom
|
||||
import PathScripts.PathLog as PathLog
|
||||
import math
|
||||
|
||||
|
||||
@@ -43,10 +42,10 @@ translate = FreeCAD.Qt.translate
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
class ObjectDressup:
|
||||
@@ -158,11 +157,11 @@ class ObjectDressup:
|
||||
data = list()
|
||||
idx = 0 if dataType == "translated" else 1
|
||||
|
||||
PathLog.debug(enums)
|
||||
Path.Log.debug(enums)
|
||||
|
||||
for k, v in enumerate(enums):
|
||||
data.append((v, [tup[idx] for tup in enums[v]]))
|
||||
PathLog.debug(data)
|
||||
Path.Log.debug(data)
|
||||
|
||||
return data
|
||||
|
||||
@@ -263,7 +262,7 @@ class ObjectDressup:
|
||||
projectionlen = plungelen * math.tan(
|
||||
math.radians(rampangle)
|
||||
) # length of the forthcoming ramp projected to XY plane
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"Found plunge move at X:{} Y:{} From Z:{} to Z{}, length of ramp: {}".format(
|
||||
p0.x, p0.y, p0.z, p1.z, projectionlen
|
||||
)
|
||||
@@ -284,7 +283,7 @@ class ObjectDressup:
|
||||
if abs(cp0.z - cp1.z) > 1e-6:
|
||||
# this edge is not parallel to XY plane, not qualified for ramping.
|
||||
break
|
||||
# PathLog.debug("Next edge length {}".format(candidate.Length))
|
||||
# Path.Log.debug("Next edge length {}".format(candidate.Length))
|
||||
rampedges.append(candidate)
|
||||
coveredlen = coveredlen + candidate.Length
|
||||
|
||||
@@ -294,7 +293,7 @@ class ObjectDressup:
|
||||
if i >= len(edges):
|
||||
break
|
||||
if len(rampedges) == 0:
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"No suitable edges for ramping, plunge will remain as such"
|
||||
)
|
||||
outedges.append(edge)
|
||||
@@ -310,13 +309,13 @@ class ObjectDressup:
|
||||
)
|
||||
else:
|
||||
rampangle = math.degrees(math.atan(l / plungelen))
|
||||
PathLog.warning(
|
||||
Path.Log.warning(
|
||||
"Cannot cover with desired angle, tightening angle to: {}".format(
|
||||
rampangle
|
||||
)
|
||||
)
|
||||
|
||||
# PathLog.debug("Doing ramp to edges: {}".format(rampedges))
|
||||
# Path.Log.debug("Doing ramp to edges: {}".format(rampedges))
|
||||
if self.method == "RampMethod1":
|
||||
outedges.extend(
|
||||
self.createRampMethod1(
|
||||
@@ -355,7 +354,7 @@ class ObjectDressup:
|
||||
def generateHelix(self):
|
||||
edges = self.wire.Edges
|
||||
minZ = self.findMinZ(edges)
|
||||
PathLog.debug("Minimum Z in this path is {}".format(minZ))
|
||||
Path.Log.debug("Minimum Z in this path is {}".format(minZ))
|
||||
outedges = []
|
||||
i = 0
|
||||
while i < len(edges):
|
||||
@@ -375,7 +374,7 @@ class ObjectDressup:
|
||||
and p0.z > p1.z
|
||||
):
|
||||
# plungelen = abs(p0.z-p1.z)
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"Found plunge move at X:{} Y:{} From Z:{} to Z{}, Searching for closed loop".format(
|
||||
p0.x, p0.y, p0.z, p1.z
|
||||
)
|
||||
@@ -404,13 +403,13 @@ class ObjectDressup:
|
||||
if abs(cp0.z - cp1.z) > 1e-6:
|
||||
# this edge is not parallel to XY plane, not qualified for ramping.
|
||||
break
|
||||
# PathLog.debug("Next edge length {}".format(candidate.Length))
|
||||
# Path.Log.debug("Next edge length {}".format(candidate.Length))
|
||||
rampedges.append(candidate)
|
||||
j = j + 1
|
||||
if j >= len(edges):
|
||||
break
|
||||
if len(rampedges) == 0 or not loopFound:
|
||||
PathLog.debug("No suitable helix found")
|
||||
Path.Log.debug("No suitable helix found")
|
||||
outedges.append(edge)
|
||||
else:
|
||||
outedges.extend(self.createHelix(rampedges, p0, p1))
|
||||
@@ -434,12 +433,12 @@ class ObjectDressup:
|
||||
p1.z > self.ignoreAbove
|
||||
or PathGeom.isRoughly(p1.z, self.ignoreAbove.Value)
|
||||
):
|
||||
PathLog.debug("Whole plunge move above 'ignoreAbove', ignoring")
|
||||
Path.Log.debug("Whole plunge move above 'ignoreAbove', ignoring")
|
||||
return (edge, True)
|
||||
elif p0.z > self.ignoreAbove and not PathGeom.isRoughly(
|
||||
p0.z, self.ignoreAbove.Value
|
||||
):
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"Plunge move partially above 'ignoreAbove', splitting into two"
|
||||
)
|
||||
newPoint = FreeCAD.Base.Vector(p0.x, p0.y, self.ignoreAbove)
|
||||
@@ -474,7 +473,7 @@ class ObjectDressup:
|
||||
return outedges
|
||||
|
||||
def createRampEdge(self, originalEdge, startPoint, endPoint):
|
||||
# PathLog.debug("Create edge from [{},{},{}] to [{},{},{}]".format(startPoint.x,startPoint.y, startPoint.z, endPoint.x, endPoint.y, endPoint.z))
|
||||
# Path.Log.debug("Create edge from [{},{},{}] to [{},{},{}]".format(startPoint.x,startPoint.y, startPoint.z, endPoint.x, endPoint.y, endPoint.z))
|
||||
if (
|
||||
type(originalEdge.Curve) == Part.Line
|
||||
or type(originalEdge.Curve) == Part.LineSegment
|
||||
@@ -487,7 +486,7 @@ class ObjectDressup:
|
||||
arcMid.z = (startPoint.z + endPoint.z) / 2
|
||||
return Part.Arc(startPoint, arcMid, endPoint).toShape()
|
||||
else:
|
||||
PathLog.error("Edge should not be helix")
|
||||
Path.Log.error("Edge should not be helix")
|
||||
|
||||
def getreversed(self, edges):
|
||||
"""
|
||||
@@ -504,7 +503,7 @@ class ObjectDressup:
|
||||
arcMid = edge.valueAt((edge.FirstParameter + edge.LastParameter) / 2)
|
||||
outedges.append(Part.Arc(startPoint, arcMid, endPoint).toShape())
|
||||
else:
|
||||
PathLog.error("Edge should not be helix")
|
||||
Path.Log.error("Edge should not be helix")
|
||||
return outedges
|
||||
|
||||
def findMinZ(self, edges):
|
||||
@@ -545,8 +544,8 @@ class ObjectDressup:
|
||||
# will reach end of ramp within this edge, needs to be split
|
||||
p1 = self.getSplitPoint(redge, rampremaining)
|
||||
splitEdge = PathGeom.splitEdgeAt(redge, p1)
|
||||
PathLog.debug("Ramp remaining: {}".format(rampremaining))
|
||||
PathLog.debug(
|
||||
Path.Log.debug("Ramp remaining: {}".format(rampremaining))
|
||||
Path.Log.debug(
|
||||
"Got split edge (index: {}) (total len: {}) with lengths: {}, {}".format(
|
||||
i, redge.Length, splitEdge[0].Length, splitEdge[1].Length
|
||||
)
|
||||
@@ -585,7 +584,7 @@ class ObjectDressup:
|
||||
if not done:
|
||||
# we did not reach the end of the ramp going this direction, lets reverse.
|
||||
rampedges = self.getreversed(rampedges)
|
||||
PathLog.debug("Reversing")
|
||||
Path.Log.debug("Reversing")
|
||||
if goingForward:
|
||||
goingForward = False
|
||||
else:
|
||||
@@ -628,7 +627,7 @@ class ObjectDressup:
|
||||
# will reach end of ramp within this edge, needs to be split
|
||||
p1 = self.getSplitPoint(redge, rampremaining)
|
||||
splitEdge = PathGeom.splitEdgeAt(redge, p1)
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"Got split edge (index: {}) with lengths: {}, {}".format(
|
||||
i, splitEdge[0].Length, splitEdge[1].Length
|
||||
)
|
||||
@@ -707,7 +706,7 @@ class ObjectDressup:
|
||||
PathGeom.xy(p0),
|
||||
PathGeom.xy(rampedges[-1].valueAt(rampedges[-1].LastParameter)),
|
||||
):
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"The ramp forms a closed wire, needless to move on original Z height"
|
||||
)
|
||||
else:
|
||||
@@ -716,7 +715,7 @@ class ObjectDressup:
|
||||
# this edge needs to be split
|
||||
p1 = self.getSplitPoint(redge, rampremaining)
|
||||
splitEdge = PathGeom.splitEdgeAt(redge, p1)
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"Got split edges with lengths: {}, {}".format(
|
||||
splitEdge[0].Length, splitEdge[1].Length
|
||||
)
|
||||
@@ -877,7 +876,7 @@ class ViewProviderDressup:
|
||||
|
||||
def onDelete(self, arg1=None, arg2=None):
|
||||
"""this makes sure that the base operation is added back to the project and visible"""
|
||||
PathLog.debug("Deleting Dressup")
|
||||
Path.Log.debug("Deleting Dressup")
|
||||
if arg1.Object and arg1.Object.Base:
|
||||
FreeCADGui.ActiveDocument.getObject(arg1.Object.Base.Name).Visibility = True
|
||||
job = PathUtils.findParentJob(self.obj)
|
||||
@@ -917,20 +916,20 @@ class CommandPathDressupRampEntry:
|
||||
# check that the selection contains exactly what we want
|
||||
selection = FreeCADGui.Selection.getSelection()
|
||||
if len(selection) != 1:
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
translate("Path_DressupRampEntry", "Please select one path object")
|
||||
+ "\n"
|
||||
)
|
||||
return
|
||||
baseObject = selection[0]
|
||||
if not baseObject.isDerivedFrom("Path::Feature"):
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
translate("Path_DressupRampEntry", "The selected object is not a path")
|
||||
+ "\n"
|
||||
)
|
||||
return
|
||||
if baseObject.isDerivedFrom("Path::FeatureCompoundPython"):
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
translate("Path_DressupRampEntry", "Please select a Profile object")
|
||||
)
|
||||
return
|
||||
@@ -964,4 +963,4 @@ if FreeCAD.GuiUp:
|
||||
# register the FreeCAD command
|
||||
FreeCADGui.addCommand("Path_DressupRampEntry", CommandPathDressupRampEntry())
|
||||
|
||||
PathLog.notice("Loading Path_DressupRampEntry... done\n")
|
||||
Path.Log.notice("Loading Path_DressupRampEntry... done\n")
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
from PathScripts.PathDressupTagPreferences import HoldingTagPreferences
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
import FreeCAD
|
||||
import Path
|
||||
import PathScripts.PathDressup as PathDressup
|
||||
import PathScripts.PathGeom as PathGeom
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathUtils as PathUtils
|
||||
import math
|
||||
|
||||
@@ -37,10 +37,10 @@ Part = LazyLoader("Part", globals(), "Part")
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
@@ -69,7 +69,7 @@ class TagSolid:
|
||||
# cylinder
|
||||
self.solid = Part.makeCylinder(r1, height)
|
||||
radius = min(min(self.radius, r1), self.height)
|
||||
PathLog.debug("Part.makeCylinder(%f, %f)" % (r1, height))
|
||||
Path.Log.debug("Part.makeCylinder(%f, %f)" % (r1, height))
|
||||
elif self.angle > 0.0 and height > 0.0:
|
||||
# cone
|
||||
rad = math.radians(self.angle)
|
||||
@@ -86,17 +86,17 @@ class TagSolid:
|
||||
height = r1 * tangens * 1.01
|
||||
self.actualHeight = height
|
||||
self.r2 = r2
|
||||
PathLog.debug("Part.makeCone(r1=%.2f, r2=%.2f, h=%.2f)" % (r1, r2, height))
|
||||
Path.Log.debug("Part.makeCone(r1=%.2f, r2=%.2f, h=%.2f)" % (r1, r2, height))
|
||||
self.solid = Part.makeCone(r1, r2, height)
|
||||
else:
|
||||
# degenerated case - no tag
|
||||
PathLog.debug("Part.makeSphere(%.2f)" % (r1 / 10000))
|
||||
Path.Log.debug("Part.makeSphere(%.2f)" % (r1 / 10000))
|
||||
self.solid = Part.makeSphere(r1 / 10000)
|
||||
|
||||
radius = min(self.radius, radius)
|
||||
self.realRadius = radius
|
||||
if radius != 0:
|
||||
PathLog.debug("makeFillet(%.4f)" % radius)
|
||||
Path.Log.debug("makeFillet(%.4f)" % radius)
|
||||
self.solid = self.solid.makeFillet(radius, [self.solid.Edges[0]])
|
||||
|
||||
# lastly determine the center of the model, we want to make sure the seam of
|
||||
@@ -197,22 +197,22 @@ class ObjectDressup:
|
||||
self.obj.Radius = HoldingTagPreferences.defaultRadius()
|
||||
|
||||
def execute(self, obj):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
if not obj.Base:
|
||||
PathLog.error(translate("Path_DressupTag", "No Base object found."))
|
||||
Path.Log.error(translate("Path_DressupTag", "No Base object found."))
|
||||
return
|
||||
if not obj.Base.isDerivedFrom("Path::Feature"):
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
translate("Path_DressupTag", "Base is not a Path::Feature object.")
|
||||
)
|
||||
return
|
||||
if not obj.Base.Path:
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
translate("Path_DressupTag", "Base doesn't have a Path to dress-up.")
|
||||
)
|
||||
return
|
||||
if not obj.Base.Path.Commands:
|
||||
PathLog.error(translate("Path_DressupTag", "Base Path is empty."))
|
||||
Path.Log.error(translate("Path_DressupTag", "Base Path is empty."))
|
||||
return
|
||||
|
||||
self.obj = obj
|
||||
@@ -241,7 +241,7 @@ class ObjectDressup:
|
||||
maxZ = max(pt.z, maxZ)
|
||||
minZ = min(pt.z, minZ)
|
||||
lastPt = pt
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"bb = (%.2f, %.2f, %.2f) ... (%.2f, %.2f, %.2f)"
|
||||
% (minX, minY, minZ, maxX, maxY, maxZ)
|
||||
)
|
||||
@@ -273,7 +273,7 @@ class ObjectDressup:
|
||||
|
||||
obj.Path = obj.Base.Path
|
||||
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
|
||||
def toolRadius(self):
|
||||
return float(PathDressup.toolController(self.obj.Base).Tool.Diameter) / 2.0
|
||||
@@ -298,13 +298,13 @@ def Create(baseObject, name="DressupTag"):
|
||||
Create(basePath, name = 'DressupTag') ... create tag dressup object for the given base path.
|
||||
"""
|
||||
if not baseObject.isDerivedFrom("Path::Feature"):
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
translate("Path_DressupTag", "The selected object is not a path") + "\n"
|
||||
)
|
||||
return None
|
||||
|
||||
if baseObject.isDerivedFrom("Path::FeatureCompoundPython"):
|
||||
PathLog.error(translate("Path_DressupTag", "Please select a Profile object"))
|
||||
Path.Log.error(translate("Path_DressupTag", "Please select a Profile object"))
|
||||
return None
|
||||
|
||||
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
|
||||
@@ -315,4 +315,4 @@ def Create(baseObject, name="DressupTag"):
|
||||
return obj
|
||||
|
||||
|
||||
PathLog.notice("Loading Path_DressupTag... done\n")
|
||||
Path.Log.notice("Loading Path_DressupTag... done\n")
|
||||
|
||||
@@ -25,26 +25,26 @@ from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
from pivy import coin
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import Path
|
||||
import PathGui as PGui # ensure Path/Gui/Resources are loaded
|
||||
import PathScripts.PathDressupHoldingTags as PathDressupTag
|
||||
import PathScripts.PathGeom as PathGeom
|
||||
import PathScripts.PathGetPoint as PathGetPoint
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathPreferences as PathPreferences
|
||||
import PathScripts.PathUtils as PathUtils
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
|
||||
def addDebugDisplay():
|
||||
return PathLog.getLevel(PathLog.thisModule()) == PathLog.Level.DEBUG
|
||||
return Path.Log.getLevel(Path.Log.thisModule()) == Path.Log.Level.DEBUG
|
||||
|
||||
|
||||
class PathDressupTagTaskPanel:
|
||||
@@ -164,7 +164,7 @@ class PathDressupTagTaskPanel:
|
||||
self.isDirty = True
|
||||
|
||||
def updateTagsView(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.form.lwTags.blockSignals(True)
|
||||
self.form.lwTags.clear()
|
||||
for i, pos in enumerate(self.Positions):
|
||||
@@ -189,7 +189,7 @@ class PathDressupTagTaskPanel:
|
||||
|
||||
def generateNewTags(self):
|
||||
count = self.form.sbCount.value()
|
||||
PathLog.track(count)
|
||||
Path.Log.track(count)
|
||||
if not self.obj.Proxy.generateTags(self.obj, count):
|
||||
self.obj.Proxy.execute(self.obj)
|
||||
self.Positions = self.obj.Positions
|
||||
@@ -206,7 +206,7 @@ class PathDressupTagTaskPanel:
|
||||
self.Disabled = self.obj.Disabled
|
||||
self.updateTagsView()
|
||||
else:
|
||||
PathLog.error("Cannot copy tags - internal error")
|
||||
Path.Log.error("Cannot copy tags - internal error")
|
||||
|
||||
def updateModel(self):
|
||||
self.getFields()
|
||||
@@ -218,7 +218,7 @@ class PathDressupTagTaskPanel:
|
||||
self.form.pbGenerate.setEnabled(count)
|
||||
|
||||
def selectTagWithId(self, index):
|
||||
PathLog.track(index)
|
||||
Path.Log.track(index)
|
||||
self.form.lwTags.setCurrentRow(index)
|
||||
|
||||
def whenTagSelectionChanged(self):
|
||||
@@ -242,18 +242,18 @@ class PathDressupTagTaskPanel:
|
||||
|
||||
def addNewTagAt(self, point, obj):
|
||||
if point and obj and self.obj.Proxy.pointIsOnPath(self.obj, point):
|
||||
PathLog.info("addNewTagAt(%.2f, %.2f)" % (point.x, point.y))
|
||||
Path.Log.info("addNewTagAt(%.2f, %.2f)" % (point.x, point.y))
|
||||
self.Positions.append(FreeCAD.Vector(point.x, point.y, 0))
|
||||
self.updateTagsView()
|
||||
else:
|
||||
PathLog.notice("ignore new tag at %s (obj=%s, on-path=%d" % (point, obj, 0))
|
||||
Path.Log.notice("ignore new tag at %s (obj=%s, on-path=%d" % (point, obj, 0))
|
||||
|
||||
def addNewTag(self):
|
||||
self.tags = self.getTags(True)
|
||||
self.getPoint.getPoint(self.addNewTagAt)
|
||||
|
||||
def editTagAt(self, point, obj):
|
||||
PathLog.track(point, obj)
|
||||
Path.Log.track(point, obj)
|
||||
if point and self.obj.Proxy.pointIsOnPath(self.obj, point):
|
||||
tags = []
|
||||
for i, (x, y, enabled) in enumerate(self.tags):
|
||||
@@ -363,7 +363,7 @@ class HoldingTagMarker:
|
||||
|
||||
class PathDressupTagViewProvider:
|
||||
def __init__(self, vobj):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.vobj = vobj
|
||||
self.panel = None
|
||||
|
||||
@@ -413,7 +413,7 @@ class PathDressupTagViewProvider:
|
||||
]
|
||||
|
||||
def attach(self, vobj):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.setupColors()
|
||||
self.vobj = vobj
|
||||
self.obj = vobj.Object
|
||||
@@ -438,14 +438,14 @@ class PathDressupTagViewProvider:
|
||||
self.switch.whichChild = sw
|
||||
|
||||
def claimChildren(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
# if self.debugDisplay():
|
||||
# return [self.obj.Base, self.vobj.Debug]
|
||||
return [self.obj.Base]
|
||||
|
||||
def onDelete(self, arg1=None, arg2=None):
|
||||
"""this makes sure that the base operation is added back to the job and visible"""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
if self.obj.Base and self.obj.Base.ViewObject:
|
||||
self.obj.Base.ViewObject.Visibility = True
|
||||
job = PathUtils.findParentJob(self.obj)
|
||||
@@ -472,12 +472,12 @@ class PathDressupTagViewProvider:
|
||||
self.tags = tags
|
||||
|
||||
def updateData(self, obj, propName):
|
||||
PathLog.track(propName)
|
||||
Path.Log.track(propName)
|
||||
if "Disabled" == propName:
|
||||
self.updatePositions(obj.Positions, obj.Disabled)
|
||||
|
||||
def onModelChanged(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
# if self.debugDisplay():
|
||||
# self.vobj.Debug.removeObjectsFromDocument()
|
||||
# for solid in self.obj.Proxy.solids:
|
||||
@@ -515,7 +515,7 @@ class PathDressupTagViewProvider:
|
||||
# SelectionObserver interface
|
||||
|
||||
def selectTag(self, index):
|
||||
PathLog.track(index)
|
||||
Path.Log.track(index)
|
||||
for i, tag in enumerate(self.tags):
|
||||
tag.setSelected(i == index)
|
||||
|
||||
@@ -539,7 +539,7 @@ class PathDressupTagViewProvider:
|
||||
return False
|
||||
|
||||
def addSelection(self, doc, obj, sub, point):
|
||||
PathLog.track(doc, obj, sub, point)
|
||||
Path.Log.track(doc, obj, sub, point)
|
||||
if self.panel:
|
||||
i = self.tagAtPoint(point, sub is None)
|
||||
self.panel.selectTagWithId(i)
|
||||
@@ -580,7 +580,7 @@ class CommandPathDressupTag:
|
||||
# check that the selection contains exactly what we want
|
||||
selection = FreeCADGui.Selection.getSelection()
|
||||
if len(selection) != 1:
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
translate("Path_DressupTag", "Please select one path object") + "\n"
|
||||
)
|
||||
return
|
||||
@@ -601,4 +601,4 @@ if FreeCAD.GuiUp:
|
||||
# register the FreeCAD command
|
||||
FreeCADGui.addCommand("Path_DressupTag", CommandPathDressupTag())
|
||||
|
||||
PathLog.notice("Loading PathDressupTagGui... done\n")
|
||||
Path.Log.notice("Loading PathDressupTagGui... done\n")
|
||||
|
||||
@@ -21,15 +21,15 @@
|
||||
# ***************************************************************************
|
||||
|
||||
import FreeCAD
|
||||
import PathScripts.PathLog as PathLog
|
||||
import Path
|
||||
import PathScripts.PathPreferences as PathPreferences
|
||||
import PathScripts.PathPreferencesPathDressup as PathPreferencesPathDressup
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ import FreeCAD
|
||||
import FreeCADGui
|
||||
import Path
|
||||
import PathScripts.PathGeom as PathGeom
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathUtils as PathUtils
|
||||
|
||||
from PySide import QtGui
|
||||
@@ -44,13 +43,13 @@ Part = LazyLoader("Part", globals(), "Part")
|
||||
|
||||
LOGLEVEL = False
|
||||
|
||||
LOG_MODULE = PathLog.thisModule()
|
||||
LOG_MODULE = Path.Log.thisModule()
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
@@ -130,12 +129,12 @@ class ObjectDressup:
|
||||
zval = round(float(w[2]), 2)
|
||||
|
||||
pointlist.append([xval, yval, zval])
|
||||
PathLog.debug(pointlist)
|
||||
Path.Log.debug(pointlist)
|
||||
|
||||
cols = list(zip(*pointlist))
|
||||
PathLog.debug("cols: {}".format(cols))
|
||||
Path.Log.debug("cols: {}".format(cols))
|
||||
yindex = list(sorted(set(cols[1])))
|
||||
PathLog.debug("yindex: {}".format(yindex))
|
||||
Path.Log.debug("yindex: {}".format(yindex))
|
||||
|
||||
array = []
|
||||
for y in yindex:
|
||||
@@ -173,8 +172,8 @@ class ObjectDressup:
|
||||
currLocation = {"X": 0, "Y": 0, "Z": 0, "F": 0}
|
||||
|
||||
for c in pathlist:
|
||||
PathLog.debug(c)
|
||||
PathLog.debug(" curLoc:{}".format(currLocation))
|
||||
Path.Log.debug(c)
|
||||
Path.Log.debug(" curLoc:{}".format(currLocation))
|
||||
newparams = dict(c.Parameters)
|
||||
zval = newparams.get("Z", currLocation["Z"])
|
||||
if c.Name in CmdMoveStraight + CmdMoveArc:
|
||||
@@ -254,18 +253,18 @@ class TaskPanel:
|
||||
|
||||
def updateUI(self):
|
||||
|
||||
if PathLog.getLevel(LOG_MODULE) == PathLog.Level.DEBUG:
|
||||
if Path.Log.getLevel(LOG_MODULE) == Path.Log.Level.DEBUG:
|
||||
for obj in FreeCAD.ActiveDocument.Objects:
|
||||
if obj.Name.startswith("Shape"):
|
||||
FreeCAD.ActiveDocument.removeObject(obj.Name)
|
||||
print("object name %s" % self.obj.Name)
|
||||
if hasattr(self.obj.Proxy, "shapes"):
|
||||
PathLog.info("showing shapes attribute")
|
||||
Path.Log.info("showing shapes attribute")
|
||||
for shapes in self.obj.Proxy.shapes.itervalues():
|
||||
for shape in shapes:
|
||||
Part.show(shape)
|
||||
else:
|
||||
PathLog.info("no shapes attribute found")
|
||||
Path.Log.info("no shapes attribute found")
|
||||
|
||||
def updateModel(self):
|
||||
self.getFields()
|
||||
|
||||
@@ -31,7 +31,6 @@ import Path
|
||||
import PathFeedRate
|
||||
import PathMachineState
|
||||
import PathScripts.PathCircularHoleBase as PathCircularHoleBase
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathOp as PathOp
|
||||
import PathScripts.PathUtils as PathUtils
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
@@ -43,10 +42,10 @@ __doc__ = "Path Drilling operation."
|
||||
__contributors__ = "IMBack!"
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
@@ -84,11 +83,11 @@ class ObjectDrilling(PathCircularHoleBase.ObjectOp):
|
||||
data = list()
|
||||
idx = 0 if dataType == "translated" else 1
|
||||
|
||||
PathLog.debug(enums)
|
||||
Path.Log.debug(enums)
|
||||
|
||||
for k, v in enumerate(enums):
|
||||
data.append((v, [tup[idx] for tup in enums[v]]))
|
||||
PathLog.debug(data)
|
||||
Path.Log.debug(data)
|
||||
|
||||
return data
|
||||
|
||||
@@ -180,7 +179,7 @@ class ObjectDrilling(PathCircularHoleBase.ObjectOp):
|
||||
|
||||
def circularHoleExecute(self, obj, holes):
|
||||
"""circularHoleExecute(obj, holes) ... generate drill operation for each hole in holes."""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
machine = PathMachineState.MachineState()
|
||||
|
||||
self.commandlist.append(Path.Command("(Begin Drilling)"))
|
||||
@@ -220,7 +219,7 @@ class ObjectDrilling(PathCircularHoleBase.ObjectOp):
|
||||
# iterate the edgelist and generate gcode
|
||||
for edge in edgelist:
|
||||
|
||||
PathLog.debug(edge)
|
||||
Path.Log.debug(edge)
|
||||
|
||||
# move to hole location
|
||||
|
||||
@@ -259,7 +258,7 @@ class ObjectDrilling(PathCircularHoleBase.ObjectOp):
|
||||
)
|
||||
|
||||
except ValueError as e: # any targets that fail the generator are ignored
|
||||
PathLog.info(e)
|
||||
Path.Log.info(e)
|
||||
continue
|
||||
|
||||
for command in drillcommands:
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import Path
|
||||
import PathGui as PGui # ensure Path/Gui/Resources are loaded
|
||||
import PathScripts.PathCircularHoleBaseGui as PathCircularHoleBaseGui
|
||||
import PathScripts.PathDrilling as PathDrilling
|
||||
import PathScripts.PathGui as PathGui
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathOpGui as PathOpGui
|
||||
|
||||
from PySide import QtCore
|
||||
@@ -38,10 +38,10 @@ __doc__ = "UI and Command for Path Drilling Operation."
|
||||
__contributors__ = "IMBack!"
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
class TaskPanelOpPage(PathCircularHoleBaseGui.TaskPanelOpPage):
|
||||
@@ -105,7 +105,7 @@ class TaskPanelOpPage(PathCircularHoleBaseGui.TaskPanelOpPage):
|
||||
|
||||
def getFields(self, obj):
|
||||
"""setFields(obj) ... update obj's properties with values from the UI"""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.peckDepthSpinBox.updateProperty()
|
||||
self.peckRetractSpinBox.updateProperty()
|
||||
self.dwellTimeSpinBox.updateProperty()
|
||||
@@ -124,7 +124,7 @@ class TaskPanelOpPage(PathCircularHoleBaseGui.TaskPanelOpPage):
|
||||
|
||||
def setFields(self, obj):
|
||||
"""setFields(obj) ... update UI with obj properties' values"""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.updateQuantitySpinBoxes()
|
||||
|
||||
if obj.DwellEnabled:
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
import FreeCAD
|
||||
import Path
|
||||
import PathScripts.PathEngraveBase as PathEngraveBase
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathOp as PathOp
|
||||
import PathScripts.PathUtils as PathUtils
|
||||
|
||||
@@ -32,10 +31,10 @@ from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
__doc__ = "Class and implementation of Path Engrave operation"
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
# lazily loaded modules
|
||||
from lazy_loader.lazy_loader import LazyLoader
|
||||
@@ -101,12 +100,12 @@ class ObjectEngrave(PathEngraveBase.ObjectOp):
|
||||
|
||||
def opExecute(self, obj):
|
||||
"""opExecute(obj) ... process engraving operation"""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
|
||||
jobshapes = []
|
||||
|
||||
if len(obj.Base) >= 1: # user has selected specific subelements
|
||||
PathLog.track(len(obj.Base))
|
||||
Path.Log.track(len(obj.Base))
|
||||
wires = []
|
||||
for base, subs in obj.Base:
|
||||
edges = []
|
||||
@@ -129,9 +128,9 @@ class ObjectEngrave(PathEngraveBase.ObjectOp):
|
||||
elif len(obj.BaseShapes) > 0: # user added specific shapes
|
||||
jobshapes.extend([base.Shape for base in obj.BaseShapes])
|
||||
else:
|
||||
PathLog.track(self.model)
|
||||
Path.Log.track(self.model)
|
||||
for base in self.model:
|
||||
PathLog.track(base.Label)
|
||||
Path.Log.track(base.Label)
|
||||
if base.isDerivedFrom("Part::Part2DObject"):
|
||||
jobshapes.append(base.Shape)
|
||||
elif base.isDerivedFrom("Sketcher::SketchObject"):
|
||||
@@ -140,11 +139,11 @@ class ObjectEngrave(PathEngraveBase.ObjectOp):
|
||||
jobshapes.append(base.Shape)
|
||||
|
||||
if len(jobshapes) > 0:
|
||||
PathLog.debug("processing {} jobshapes".format(len(jobshapes)))
|
||||
Path.Log.debug("processing {} jobshapes".format(len(jobshapes)))
|
||||
wires = []
|
||||
for shape in jobshapes:
|
||||
shapeWires = shape.Wires
|
||||
PathLog.debug("jobshape has {} edges".format(len(shape.Edges)))
|
||||
Path.Log.debug("jobshape has {} edges".format(len(shape.Edges)))
|
||||
self.commandlist.append(
|
||||
Path.Command(
|
||||
"G0", {"Z": obj.ClearanceHeight.Value, "F": self.vertRapid}
|
||||
@@ -153,7 +152,7 @@ class ObjectEngrave(PathEngraveBase.ObjectOp):
|
||||
self.buildpathocc(obj, shapeWires, self.getZValues(obj))
|
||||
wires.extend(shapeWires)
|
||||
self.wires = wires
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"processing {} jobshapes -> {} wires".format(len(jobshapes), len(wires))
|
||||
)
|
||||
# the last command is a move to clearance, which is automatically added by PathOp
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
from lazy_loader.lazy_loader import LazyLoader
|
||||
import Path
|
||||
import PathScripts.PathGeom as PathGeom
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathOp as PathOp
|
||||
import PathScripts.PathOpTools as PathOpTools
|
||||
import copy
|
||||
@@ -35,10 +34,10 @@ DraftGeomUtils = LazyLoader("DraftGeomUtils", globals(), "DraftGeomUtils")
|
||||
Part = LazyLoader("Part", globals(), "Part")
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
class ObjectOp(PathOp.ObjectOp):
|
||||
@@ -61,7 +60,7 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
|
||||
def buildpathocc(self, obj, wires, zValues, relZ=False, forward=True, start_idx=0):
|
||||
"""buildpathocc(obj, wires, zValues, relZ=False) ... internal helper function to generate engraving commands."""
|
||||
PathLog.track(obj.Label, len(wires), zValues)
|
||||
Path.Log.track(obj.Label, len(wires), zValues)
|
||||
|
||||
decomposewires = []
|
||||
for wire in wires:
|
||||
@@ -77,14 +76,14 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
edges = wire.Edges
|
||||
|
||||
# edges = copy.copy(PathOpTools.orientWire(offset, forward).Edges)
|
||||
# PathLog.track("wire: {} offset: {}".format(len(wire.Edges), len(edges)))
|
||||
# Path.Log.track("wire: {} offset: {}".format(len(wire.Edges), len(edges)))
|
||||
# edges = Part.sortEdges(edges)[0]
|
||||
# PathLog.track("edges: {}".format(len(edges)))
|
||||
# Path.Log.track("edges: {}".format(len(edges)))
|
||||
|
||||
last = None
|
||||
|
||||
for z in zValues:
|
||||
PathLog.debug(z)
|
||||
Path.Log.debug(z)
|
||||
if last:
|
||||
self.appendCommand(
|
||||
Path.Command("G1", {"X": last.x, "Y": last.y, "Z": last.z}),
|
||||
@@ -99,19 +98,19 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
|
||||
edges = edges[start_idx:] + edges[:start_idx]
|
||||
for edge in edges:
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"points: {} -> {}".format(
|
||||
edge.Vertexes[0].Point, edge.Vertexes[-1].Point
|
||||
)
|
||||
)
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"valueat {} -> {}".format(
|
||||
edge.valueAt(edge.FirstParameter),
|
||||
edge.valueAt(edge.LastParameter),
|
||||
)
|
||||
)
|
||||
if first and (not last or not wire.isClosed()):
|
||||
PathLog.debug("processing first edge entry")
|
||||
Path.Log.debug("processing first edge entry")
|
||||
# we set the first move to our first point
|
||||
last = edge.Vertexes[0].Point
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import Path
|
||||
import PathGui as PGui # ensure Path/Gui/Resources are loaded
|
||||
import PathScripts.PathEngrave as PathEngrave
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathOpGui as PathOpGui
|
||||
import PathScripts.PathUtils as PathUtils
|
||||
|
||||
@@ -37,10 +37,10 @@ __url__ = "https://www.freecadweb.org"
|
||||
__doc__ = "Engrave operation page controller and command implementation."
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
@@ -70,7 +70,7 @@ class TaskPanelBaseGeometryPage(PathOpGui.TaskPanelBaseGeometryPage):
|
||||
job = PathUtils.findParentJob(self.obj)
|
||||
base = job.Proxy.resourceClone(job, sel.Object)
|
||||
if not base:
|
||||
PathLog.notice(
|
||||
Path.Log.notice(
|
||||
(
|
||||
translate("Path", "%s is not a Base Model object of the job %s")
|
||||
+ "\n"
|
||||
@@ -79,7 +79,7 @@ class TaskPanelBaseGeometryPage(PathOpGui.TaskPanelBaseGeometryPage):
|
||||
)
|
||||
continue
|
||||
if base in shapes:
|
||||
PathLog.notice(
|
||||
Path.Log.notice(
|
||||
(translate("Path", "Base shape %s already in the list") + "\n")
|
||||
% (sel.Object.Label)
|
||||
)
|
||||
@@ -89,7 +89,7 @@ class TaskPanelBaseGeometryPage(PathOpGui.TaskPanelBaseGeometryPage):
|
||||
# selectively add some elements of the drawing to the Base
|
||||
for sub in sel.SubElementNames:
|
||||
if "Vertex" in sub:
|
||||
PathLog.info("Ignoring vertex")
|
||||
Path.Log.info("Ignoring vertex")
|
||||
else:
|
||||
self.obj.Proxy.addBase(self.obj, base, sub)
|
||||
else:
|
||||
@@ -116,7 +116,7 @@ class TaskPanelBaseGeometryPage(PathOpGui.TaskPanelBaseGeometryPage):
|
||||
self.form.baseList.blockSignals(False)
|
||||
|
||||
def updateBase(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
shapes = []
|
||||
for i in range(self.form.baseList.count()):
|
||||
item = self.form.baseList.item(i)
|
||||
@@ -124,7 +124,7 @@ class TaskPanelBaseGeometryPage(PathOpGui.TaskPanelBaseGeometryPage):
|
||||
sub = item.data(self.super().DataObjectSub)
|
||||
if not sub:
|
||||
shapes.append(obj)
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"Setting new base shapes: %s -> %s" % (self.obj.BaseShapes, shapes)
|
||||
)
|
||||
self.obj.BaseShapes = shapes
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
import FreeCAD
|
||||
import Part
|
||||
import Path
|
||||
import PathScripts.PathGeom as PathGeom
|
||||
import PathScripts.PathLog as PathLog
|
||||
import math
|
||||
|
||||
# lazily loaded modules
|
||||
@@ -40,10 +40,10 @@ __doc__ = "Class and implementation of face extensions features."
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
@@ -95,7 +95,7 @@ def selectOffsetWire(feature, wires):
|
||||
|
||||
def extendWire(feature, wire, length):
|
||||
"""extendWire(wire, length) ... return a closed Wire which extends wire by length"""
|
||||
PathLog.track(length)
|
||||
Path.Log.track(length)
|
||||
|
||||
if not length or length == 0:
|
||||
return None
|
||||
@@ -103,7 +103,7 @@ def extendWire(feature, wire, length):
|
||||
try:
|
||||
off2D = wire.makeOffset2D(length)
|
||||
except FreeCAD.Base.FreeCADError as ee:
|
||||
PathLog.debug(ee)
|
||||
Path.Log.debug(ee)
|
||||
return None
|
||||
endPts = endPoints(wire) # Assumes wire is NOT closed
|
||||
if endPts:
|
||||
@@ -157,7 +157,7 @@ def readObjExtensionFeature(obj):
|
||||
|
||||
|
||||
def getExtensions(obj):
|
||||
PathLog.debug("getExtenstions()")
|
||||
Path.Log.debug("getExtenstions()")
|
||||
extensions = []
|
||||
i = 0
|
||||
|
||||
@@ -170,7 +170,7 @@ def getExtensions(obj):
|
||||
|
||||
|
||||
def setExtensions(obj, extensions):
|
||||
PathLog.track(obj.Label, len(extensions))
|
||||
Path.Log.track(obj.Label, len(extensions))
|
||||
obj.ExtensionFeature = [(ext.obj, ext.getSubLink()) for ext in extensions]
|
||||
|
||||
|
||||
@@ -218,7 +218,7 @@ class Extension(object):
|
||||
DirectionY = 2
|
||||
|
||||
def __init__(self, op, obj, feature, sub, length, direction):
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"Extension(%s, %s, %s, %.2f, %s"
|
||||
% (obj.Label, feature, sub, length, direction)
|
||||
)
|
||||
@@ -229,7 +229,7 @@ class Extension(object):
|
||||
self.length = length
|
||||
self.direction = direction
|
||||
self.extFaces = None
|
||||
self.isDebug = True if PathLog.getLevel(PathLog.thisModule()) == 4 else False
|
||||
self.isDebug = True if Path.Log.getLevel(Path.Log.thisModule()) == 4 else False
|
||||
|
||||
self.avoid = False
|
||||
if sub.startswith("Avoid_"):
|
||||
@@ -241,7 +241,7 @@ class Extension(object):
|
||||
return "%s:%s" % (self.feature, self.sub)
|
||||
|
||||
def _extendEdge(self, feature, e0, direction):
|
||||
PathLog.track(feature, e0, direction)
|
||||
Path.Log.track(feature, e0, direction)
|
||||
if isinstance(e0.Curve, Part.Line) or isinstance(e0.Curve, Part.LineSegment):
|
||||
e2 = e0.copy()
|
||||
off = self.length.Value * direction
|
||||
@@ -269,7 +269,7 @@ class Extension(object):
|
||||
else:
|
||||
numbers = [self.sub[4:]]
|
||||
|
||||
PathLog.debug("_getEdgeNumbers() -> %s" % numbers)
|
||||
Path.Log.debug("_getEdgeNumbers() -> %s" % numbers)
|
||||
return numbers
|
||||
|
||||
def _getEdgeNames(self):
|
||||
@@ -293,7 +293,7 @@ class Extension(object):
|
||||
e0 = wire.Edges[0]
|
||||
midparam = e0.FirstParameter + 0.5 * (e0.LastParameter - e0.FirstParameter)
|
||||
tangent = e0.tangentAt(midparam)
|
||||
PathLog.track("tangent", tangent, self.feature, self.sub)
|
||||
Path.Log.track("tangent", tangent, self.feature, self.sub)
|
||||
normal = tangent.cross(FreeCAD.Vector(0, 0, 1))
|
||||
if PathGeom.pointsCoincide(normal, FreeCAD.Vector(0, 0, 0)):
|
||||
return None
|
||||
@@ -323,11 +323,11 @@ class Extension(object):
|
||||
"""_getRegularWire()... Private method to retrieve the extension area, pertaining to the feature
|
||||
and sub element provided at class instantiation, as a closed wire. If no closed wire
|
||||
is possible, a `None` value is returned."""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
|
||||
length = self.length.Value
|
||||
if PathGeom.isRoughly(0, length) or not self.sub:
|
||||
PathLog.debug("no extension, length=%.2f, sub=%s" % (length, self.sub))
|
||||
Path.Log.debug("no extension, length=%.2f, sub=%s" % (length, self.sub))
|
||||
return None
|
||||
|
||||
feature = self.obj.Shape.getElement(self.feature)
|
||||
@@ -335,10 +335,10 @@ class Extension(object):
|
||||
sub = Part.Wire(Part.sortEdges(edges)[0])
|
||||
|
||||
if 1 == len(edges):
|
||||
PathLog.debug("Extending single edge wire")
|
||||
Path.Log.debug("Extending single edge wire")
|
||||
edge = edges[0]
|
||||
if Part.Circle == type(edge.Curve):
|
||||
PathLog.debug("is Part.Circle")
|
||||
Path.Log.debug("is Part.Circle")
|
||||
circle = edge.Curve
|
||||
# for a circle we have to figure out if it's a hole or a cylinder
|
||||
p0 = edge.valueAt(edge.FirstParameter)
|
||||
@@ -354,7 +354,7 @@ class Extension(object):
|
||||
|
||||
# assuming the offset produces a valid circle - go for it
|
||||
if r > 0:
|
||||
PathLog.debug("radius > 0 - extend outward")
|
||||
Path.Log.debug("radius > 0 - extend outward")
|
||||
e3 = Part.makeCircle(
|
||||
r,
|
||||
circle.Center,
|
||||
@@ -373,7 +373,7 @@ class Extension(object):
|
||||
)
|
||||
|
||||
if endPoints(edge):
|
||||
PathLog.debug("Make section of donut")
|
||||
Path.Log.debug("Make section of donut")
|
||||
# need to construct the arc slice
|
||||
e0 = Part.makeLine(
|
||||
edge.valueAt(edge.FirstParameter),
|
||||
@@ -397,22 +397,22 @@ class Extension(object):
|
||||
self.extFaces = [self._makeCircularExtFace(edge, extWire)]
|
||||
return extWire
|
||||
|
||||
PathLog.debug("radius < 0 - extend inward")
|
||||
Path.Log.debug("radius < 0 - extend inward")
|
||||
# the extension is bigger than the hole - so let's just cover the whole hole
|
||||
if endPoints(edge):
|
||||
# if the resulting arc is smaller than the radius, create a pie slice
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
center = circle.Center
|
||||
e0 = Part.makeLine(center, edge.valueAt(edge.FirstParameter))
|
||||
e2 = Part.makeLine(edge.valueAt(edge.LastParameter), center)
|
||||
return Part.Wire([e0, edge, e2])
|
||||
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
return Part.Wire([edge])
|
||||
|
||||
else:
|
||||
PathLog.debug("else is NOT Part.Circle")
|
||||
PathLog.track(self.feature, self.sub, type(edge.Curve), endPoints(edge))
|
||||
Path.Log.debug("else is NOT Part.Circle")
|
||||
Path.Log.track(self.feature, self.sub, type(edge.Curve), endPoints(edge))
|
||||
direction = self._getDirection(sub)
|
||||
if direction is None:
|
||||
return None
|
||||
@@ -420,7 +420,7 @@ class Extension(object):
|
||||
return self._extendEdge(feature, edges[0], direction)
|
||||
|
||||
elif sub.isClosed():
|
||||
PathLog.debug("Extending multi-edge closed wire")
|
||||
Path.Log.debug("Extending multi-edge closed wire")
|
||||
subFace = Part.Face(sub)
|
||||
featFace = Part.Face(feature.Wires[0])
|
||||
isOutside = True
|
||||
@@ -431,7 +431,7 @@ class Extension(object):
|
||||
try:
|
||||
off2D = sub.makeOffset2D(length)
|
||||
except FreeCAD.Base.FreeCADError as ee:
|
||||
PathLog.debug(ee)
|
||||
Path.Log.debug(ee)
|
||||
return None
|
||||
|
||||
if isOutside:
|
||||
@@ -440,7 +440,7 @@ class Extension(object):
|
||||
self.extFaces = [subFace.cut(Part.Face(off2D))]
|
||||
return off2D
|
||||
|
||||
PathLog.debug("Extending multi-edge open wire")
|
||||
Path.Log.debug("Extending multi-edge open wire")
|
||||
extendedWire = extendWire(feature, sub, length)
|
||||
if extendedWire is None:
|
||||
return extendedWire
|
||||
@@ -538,7 +538,7 @@ def getExtendOutlineFace(
|
||||
face, extension, removeHoles=remHoles, plane=face, tolerance=offset_tolerance
|
||||
)
|
||||
if not offset_face:
|
||||
PathLog.error("Failed to offset a selected face.")
|
||||
Path.Log.error("Failed to offset a selected face.")
|
||||
return None
|
||||
|
||||
# Apply collision detection by limiting extended face using base shape
|
||||
@@ -579,7 +579,7 @@ def getExtendOutlineFace(
|
||||
|
||||
return extended
|
||||
|
||||
PathLog.error("No bottom face for extend outline.")
|
||||
Path.Log.error("No bottom face for extend outline.")
|
||||
return None
|
||||
|
||||
|
||||
|
||||
@@ -24,10 +24,10 @@ from PySide import QtCore, QtGui
|
||||
from pivy import coin
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import Path
|
||||
import PathScripts.PathFeatureExtensions as FeatureExtensions
|
||||
import PathScripts.PathGeom as PathGeom
|
||||
import PathScripts.PathGui as PathGui
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathOpGui as PathOpGui
|
||||
|
||||
# lazily loaded modules
|
||||
@@ -44,10 +44,10 @@ __doc__ = "Extensions feature page controller."
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
class _Extension(object):
|
||||
@@ -229,7 +229,7 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage):
|
||||
try:
|
||||
self.obj.ViewObject.RootNode.removeChild(self.switch)
|
||||
except ReferenceError:
|
||||
PathLog.debug("obj already destroyed - no cleanup required")
|
||||
Path.Log.debug("obj already destroyed - no cleanup required")
|
||||
|
||||
def getForm(self):
|
||||
form = FreeCADGui.PySideUic.loadUi(":/panels/PageOpPocketExtEdit.ui")
|
||||
@@ -246,7 +246,7 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage):
|
||||
cb(item, ext)
|
||||
|
||||
def currentExtensions(self):
|
||||
PathLog.debug("currentExtensions()")
|
||||
Path.Log.debug("currentExtensions()")
|
||||
extensions = []
|
||||
|
||||
def extractExtension(item, ext):
|
||||
@@ -255,16 +255,16 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage):
|
||||
|
||||
if self.form.enableExtensions.isChecked():
|
||||
self.forAllItemsCall(extractExtension)
|
||||
PathLog.track("extensions", extensions)
|
||||
Path.Log.track("extensions", extensions)
|
||||
return extensions
|
||||
|
||||
def updateProxyExtensions(self, obj):
|
||||
PathLog.debug("updateProxyExtensions()")
|
||||
Path.Log.debug("updateProxyExtensions()")
|
||||
self.extensions = self.currentExtensions()
|
||||
FeatureExtensions.setExtensions(obj, self.extensions)
|
||||
|
||||
def getFields(self, obj):
|
||||
PathLog.track(obj.Label, self.model.rowCount(), self.model.columnCount())
|
||||
Path.Log.track(obj.Label, self.model.rowCount(), self.model.columnCount())
|
||||
self.blockUpdateData = True
|
||||
|
||||
if obj.ExtensionCorners != self.form.extendCorners.isChecked():
|
||||
@@ -275,8 +275,8 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage):
|
||||
self.blockUpdateData = False
|
||||
|
||||
def setFields(self, obj):
|
||||
PathLog.track(obj.Label)
|
||||
# PathLog.debug("setFields()")
|
||||
Path.Log.track(obj.Label)
|
||||
# Path.Log.debug("setFields()")
|
||||
|
||||
if obj.ExtensionCorners != self.form.extendCorners.isChecked():
|
||||
self.form.extendCorners.toggle()
|
||||
@@ -312,10 +312,10 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage):
|
||||
self._enableExtensions() # Recalculate extensions
|
||||
|
||||
def createItemForBaseModel(self, base, sub, edges, extensions):
|
||||
PathLog.track(
|
||||
Path.Log.track(
|
||||
base.Label, sub, "+", len(edges), len(base.Shape.getElement(sub).Edges)
|
||||
)
|
||||
# PathLog.debug("createItemForBaseModel() label: {}, sub: {}, {}, edgeCnt: {}, subEdges: {}".format(base.Label, sub, '+', len(edges), len(base.Shape.getElement(sub).Edges)))
|
||||
# Path.Log.debug("createItemForBaseModel() label: {}, sub: {}, {}, edgeCnt: {}, subEdges: {}".format(base.Label, sub, '+', len(edges), len(base.Shape.getElement(sub).Edges)))
|
||||
|
||||
extendCorners = self.form.extendCorners.isChecked()
|
||||
subShape = base.Shape.getElement(sub)
|
||||
@@ -370,7 +370,7 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage):
|
||||
return PathGeom.edgesMatch(e0, e1)
|
||||
|
||||
self.extensionEdges = extensionEdges
|
||||
PathLog.debug("extensionEdges.values(): {}".format(extensionEdges.values()))
|
||||
Path.Log.debug("extensionEdges.values(): {}".format(extensionEdges.values()))
|
||||
for edgeList in Part.sortEdges(
|
||||
list(extensionEdges.keys())
|
||||
): # Identify connected edges that form wires
|
||||
@@ -402,11 +402,11 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage):
|
||||
return item
|
||||
|
||||
def setExtensions(self, extensions):
|
||||
PathLog.track(len(extensions))
|
||||
PathLog.debug("setExtensions()")
|
||||
Path.Log.track(len(extensions))
|
||||
Path.Log.debug("setExtensions()")
|
||||
|
||||
if self.extensionsReady:
|
||||
PathLog.debug("setExtensions() returning per `extensionsReady` flag")
|
||||
Path.Log.debug("setExtensions() returning per `extensionsReady` flag")
|
||||
return
|
||||
|
||||
self.form.extensionTree.blockSignals(True)
|
||||
@@ -482,11 +482,11 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage):
|
||||
|
||||
self.form.extensionTree.blockSignals(False)
|
||||
self.extensionsReady = True
|
||||
PathLog.debug(" setExtensions() finished and setting `extensionsReady=True`")
|
||||
Path.Log.debug(" setExtensions() finished and setting `extensionsReady=True`")
|
||||
|
||||
def updateData(self, obj, prop):
|
||||
PathLog.track(obj.Label, prop, self.blockUpdateData)
|
||||
# PathLog.debug("updateData({})".format(prop))
|
||||
Path.Log.track(obj.Label, prop, self.blockUpdateData)
|
||||
# Path.Log.debug("updateData({})".format(prop))
|
||||
|
||||
if not self.blockUpdateData:
|
||||
if self.fieldsSet:
|
||||
@@ -503,10 +503,10 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage):
|
||||
self.extensionsReady = False
|
||||
|
||||
def restoreSelection(self, selection):
|
||||
PathLog.debug("restoreSelection()")
|
||||
PathLog.track()
|
||||
Path.Log.debug("restoreSelection()")
|
||||
Path.Log.track()
|
||||
if 0 == self.model.rowCount():
|
||||
PathLog.track("-")
|
||||
Path.Log.track("-")
|
||||
self.form.buttonClear.setEnabled(False)
|
||||
self.form.buttonDisable.setEnabled(False)
|
||||
self.form.buttonEnable.setEnabled(False)
|
||||
@@ -549,11 +549,11 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage):
|
||||
self.forAllItemsCall(setSelectionVisuals)
|
||||
|
||||
def selectionChanged(self):
|
||||
PathLog.debug("selectionChanged()")
|
||||
Path.Log.debug("selectionChanged()")
|
||||
self.restoreSelection([])
|
||||
|
||||
def extensionsClear(self):
|
||||
PathLog.debug("extensionsClear()")
|
||||
Path.Log.debug("extensionsClear()")
|
||||
|
||||
def disableItem(item, ext):
|
||||
item.setCheckState(QtCore.Qt.Unchecked)
|
||||
@@ -563,8 +563,8 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage):
|
||||
self.setDirty()
|
||||
|
||||
def _extensionsSetState(self, state):
|
||||
PathLog.debug("_extensionsSetState()")
|
||||
PathLog.track(state)
|
||||
Path.Log.debug("_extensionsSetState()")
|
||||
Path.Log.track(state)
|
||||
for index in self.selectionModel.selectedIndexes():
|
||||
item = self.model.itemFromIndex(index)
|
||||
ext = item.data(self.DataObject)
|
||||
@@ -580,7 +580,7 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage):
|
||||
self._extensionsSetState(QtCore.Qt.Checked)
|
||||
|
||||
def updateItemEnabled(self, item):
|
||||
PathLog.track(item)
|
||||
Path.Log.track(item)
|
||||
ext = item.data(self.DataObject)
|
||||
if item.checkState() == QtCore.Qt.Checked:
|
||||
ext.enable()
|
||||
@@ -606,8 +606,8 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage):
|
||||
# self.setDirty()
|
||||
|
||||
def toggleExtensionCorners(self):
|
||||
PathLog.debug("toggleExtensionCorners()")
|
||||
PathLog.track()
|
||||
Path.Log.debug("toggleExtensionCorners()")
|
||||
Path.Log.track()
|
||||
self.extensionsReady = False
|
||||
extensions = FeatureExtensions.getExtensions(self.obj)
|
||||
self.setExtensions(extensions)
|
||||
@@ -615,7 +615,7 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage):
|
||||
self.setDirty()
|
||||
|
||||
def getSignalsForUpdate(self, obj):
|
||||
PathLog.track(obj.Label)
|
||||
Path.Log.track(obj.Label)
|
||||
signals = []
|
||||
signals.append(self.form.defaultLength.editingFinished)
|
||||
signals.append(self.form.enableExtensions.toggled)
|
||||
@@ -654,7 +654,7 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage):
|
||||
if page.panelTitle == "Operation" and hasattr(
|
||||
page.form, "useOutline"
|
||||
):
|
||||
PathLog.debug("Found useOutline checkbox")
|
||||
Path.Log.debug("Found useOutline checkbox")
|
||||
self.useOutlineCheckbox = page.form.useOutline
|
||||
if page.form.useOutline.isChecked():
|
||||
self.useOutline = 1
|
||||
@@ -682,7 +682,7 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage):
|
||||
if self.form.enableExtensions.isChecked():
|
||||
enabled = True
|
||||
|
||||
PathLog.debug("_autoEnableExtensions() is {}".format(enabled))
|
||||
Path.Log.debug("_autoEnableExtensions() is {}".format(enabled))
|
||||
self.enabled = enabled
|
||||
|
||||
def _enableExtensions(self):
|
||||
@@ -691,7 +691,7 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage):
|
||||
This method manages the enabled or disabled state of the extensionsEdit
|
||||
Task Panel input group.
|
||||
"""
|
||||
PathLog.debug("_enableExtensions()")
|
||||
Path.Log.debug("_enableExtensions()")
|
||||
|
||||
if self.form.enableExtensions.isChecked():
|
||||
self.enabled = True
|
||||
@@ -709,7 +709,7 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage):
|
||||
This method manages the state of the button and the message thereof.
|
||||
"""
|
||||
self._getUseOutlineState() # Find `useOutline` checkbox and get its boolean value
|
||||
PathLog.debug("_includeEdgesAndWires()")
|
||||
Path.Log.debug("_includeEdgesAndWires()")
|
||||
self.extensionsReady = False
|
||||
self._enableExtensions()
|
||||
|
||||
@@ -725,16 +725,16 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage):
|
||||
cacheLabel = base.Name + "_" + sub + "_None"
|
||||
|
||||
if cacheLabel in self.extensionsCache.keys():
|
||||
# PathLog.debug("return _cachedExtension({})".format(cacheLabel))
|
||||
# Path.Log.debug("return _cachedExtension({})".format(cacheLabel))
|
||||
return self.extensionsCache[cacheLabel]
|
||||
else:
|
||||
# PathLog.debug("_cachedExtension({}) created".format(cacheLabel))
|
||||
# Path.Log.debug("_cachedExtension({}) created".format(cacheLabel))
|
||||
_ext = _Extension(obj, base, sub, label)
|
||||
self.extensionsCache[cacheLabel] = _ext # cache the extension
|
||||
return _ext
|
||||
|
||||
def _resetCachedExtensions(self):
|
||||
PathLog.debug("_resetCachedExtensions()")
|
||||
Path.Log.debug("_resetCachedExtensions()")
|
||||
reset = dict()
|
||||
self.extensionsCache = reset
|
||||
self.extensionsReady = False
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
import FreeCAD
|
||||
import Path
|
||||
import PathScripts.PathLog as PathLog
|
||||
import math
|
||||
|
||||
from FreeCAD import Vector
|
||||
@@ -44,10 +43,10 @@ Tolerance = 0.000001
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
class Side:
|
||||
@@ -170,7 +169,7 @@ def isVertical(obj):
|
||||
if type(obj.Surface) == Part.SurfaceOfRevolution:
|
||||
return isHorizontal(obj.Surface.Direction)
|
||||
if type(obj.Surface) != Part.BSplineSurface:
|
||||
PathLog.info(
|
||||
Path.Log.info(
|
||||
translate("PathGeom", "face %s not handled, assuming not vertical")
|
||||
% type(obj.Surface)
|
||||
)
|
||||
@@ -187,13 +186,13 @@ def isVertical(obj):
|
||||
# the current assumption is that a bezier curve is vertical if its end points are vertical
|
||||
return isVertical(obj.Curve.EndPoint - obj.Curve.StartPoint)
|
||||
if type(obj.Curve) != Part.BSplineCurve:
|
||||
PathLog.info(
|
||||
Path.Log.info(
|
||||
translate("PathGeom", "edge %s not handled, assuming not vertical")
|
||||
% type(obj.Curve)
|
||||
)
|
||||
return None
|
||||
|
||||
PathLog.error(translate("PathGeom", "isVertical(%s) not supported") % obj)
|
||||
Path.Log.error(translate("PathGeom", "isVertical(%s) not supported") % obj)
|
||||
return None
|
||||
|
||||
|
||||
@@ -224,7 +223,7 @@ def isHorizontal(obj):
|
||||
return isVertical(obj.Curve.Axis)
|
||||
return isRoughly(obj.BoundBox.ZLength, 0.0)
|
||||
|
||||
PathLog.error(translate("PathGeom", "isHorizontal(%s) not supported") % obj)
|
||||
Path.Log.error(translate("PathGeom", "isHorizontal(%s) not supported") % obj)
|
||||
return None
|
||||
|
||||
|
||||
@@ -258,7 +257,7 @@ def speedBetweenPoints(p0, p1, hSpeed, vSpeed):
|
||||
pitch = pitch + 1
|
||||
while pitch > 1:
|
||||
pitch = pitch - 1
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
" pitch = %g %g (%.2f, %.2f, %.2f) -> %.2f"
|
||||
% (pitch, math.atan2(xy(d).Length, d.z), d.x, d.y, d.z, xy(d).Length)
|
||||
)
|
||||
@@ -322,7 +321,7 @@ def cmdsForEdge(edge, flip=False, useHelixForBSpline=True, segm=50, hSpeed=0, vS
|
||||
offset = edge.Curve.Center - pt
|
||||
else:
|
||||
pd = Part.Circle(xy(p1), xy(p2), xy(p3)).Center
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"**** %s.%d: (%.2f, %.2f, %.2f) - (%.2f, %.2f, %.2f) - (%.2f, %.2f, %.2f) -> center=(%.2f, %.2f)"
|
||||
% (
|
||||
cmd,
|
||||
@@ -347,15 +346,15 @@ def cmdsForEdge(edge, flip=False, useHelixForBSpline=True, segm=50, hSpeed=0, vS
|
||||
pc = xy(p3)
|
||||
offset = Part.Circle(pa, pb, pc).Center - pa
|
||||
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"**** (%.2f, %.2f, %.2f) - (%.2f, %.2f, %.2f)"
|
||||
% (pa.x, pa.y, pa.z, pc.x, pc.y, pc.z)
|
||||
)
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"**** (%.2f, %.2f, %.2f) - (%.2f, %.2f, %.2f)"
|
||||
% (pb.x, pb.y, pb.z, pd.x, pd.y, pd.z)
|
||||
)
|
||||
PathLog.debug("**** (%.2f, %.2f, %.2f)" % (offset.x, offset.y, offset.z))
|
||||
Path.Log.debug("**** (%.2f, %.2f, %.2f)" % (offset.x, offset.y, offset.z))
|
||||
|
||||
params.update({"I": offset.x, "J": offset.y, "K": (p3.z - p1.z) / 2})
|
||||
# G2/G3 commands are always performed at hSpeed
|
||||
@@ -389,8 +388,8 @@ def edgeForCmd(cmd, startPoint):
|
||||
"""edgeForCmd(cmd, startPoint).
|
||||
Returns an Edge representing the given command, assuming a given startPoint."""
|
||||
|
||||
PathLog.debug("cmd: {}".format(cmd))
|
||||
PathLog.debug("startpoint {}".format(startPoint))
|
||||
Path.Log.debug("cmd: {}".format(cmd))
|
||||
Path.Log.debug("startpoint {}".format(startPoint))
|
||||
|
||||
endPoint = commandEndPoint(cmd, startPoint)
|
||||
if (cmd.Name in CmdMoveStraight) or (cmd.Name in CmdMoveRapid):
|
||||
@@ -405,7 +404,7 @@ def edgeForCmd(cmd, startPoint):
|
||||
d = -B.x * A.y + B.y * A.x
|
||||
|
||||
if isRoughly(d, 0, 0.005):
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"Half circle arc at: (%.2f, %.2f, %.2f)"
|
||||
% (center.x, center.y, center.z)
|
||||
)
|
||||
@@ -416,23 +415,23 @@ def edgeForCmd(cmd, startPoint):
|
||||
else:
|
||||
C = A + B
|
||||
angle = getAngle(C)
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"Arc (%8f) at: (%.2f, %.2f, %.2f) -> angle=%f"
|
||||
% (d, center.x, center.y, center.z, angle / math.pi)
|
||||
)
|
||||
|
||||
R = A.Length
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"arc: p1=(%.2f, %.2f) p2=(%.2f, %.2f) -> center=(%.2f, %.2f)"
|
||||
% (startPoint.x, startPoint.y, endPoint.x, endPoint.y, center.x, center.y)
|
||||
)
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"arc: A=(%.2f, %.2f) B=(%.2f, %.2f) -> d=%.2f" % (A.x, A.y, B.x, B.y, d)
|
||||
)
|
||||
PathLog.debug("arc: R=%.2f angle=%.2f" % (R, angle / math.pi))
|
||||
Path.Log.debug("arc: R=%.2f angle=%.2f" % (R, angle / math.pi))
|
||||
if isRoughly(startPoint.z, endPoint.z):
|
||||
midPoint = center + Vector(math.cos(angle), math.sin(angle), 0) * R
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"arc: (%.2f, %.2f) -> (%.2f, %.2f) -> (%.2f, %.2f)"
|
||||
% (
|
||||
startPoint.x,
|
||||
@@ -443,9 +442,9 @@ def edgeForCmd(cmd, startPoint):
|
||||
endPoint.y,
|
||||
)
|
||||
)
|
||||
PathLog.debug("StartPoint:{}".format(startPoint))
|
||||
PathLog.debug("MidPoint:{}".format(midPoint))
|
||||
PathLog.debug("EndPoint:{}".format(endPoint))
|
||||
Path.Log.debug("StartPoint:{}".format(startPoint))
|
||||
Path.Log.debug("MidPoint:{}".format(midPoint))
|
||||
Path.Log.debug("EndPoint:{}".format(endPoint))
|
||||
|
||||
if pointsCoincide(startPoint, endPoint, 0.001):
|
||||
return Part.makeCircle(R, center, FreeCAD.Vector(0, 0, 1))
|
||||
@@ -582,10 +581,10 @@ def combineConnectedShapes(shapes):
|
||||
while not done:
|
||||
done = True
|
||||
combined = []
|
||||
PathLog.debug("shapes: {}".format(shapes))
|
||||
Path.Log.debug("shapes: {}".format(shapes))
|
||||
for shape in shapes:
|
||||
connected = [f for f in combined if isRoughly(shape.distToShape(f)[0], 0.0)]
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
" {}: connected: {} dist: {}".format(
|
||||
len(combined),
|
||||
connected,
|
||||
@@ -672,7 +671,7 @@ def flipEdge(edge):
|
||||
elif type(edge.Curve) == Part.OffsetCurve:
|
||||
return edge.reversed()
|
||||
|
||||
PathLog.warning(
|
||||
Path.Log.warning(
|
||||
translate("PathGeom", "%s not supported for flipping") % type(edge.Curve)
|
||||
)
|
||||
|
||||
@@ -681,7 +680,7 @@ def flipWire(wire):
|
||||
"""Flip the entire wire and all its edges so it is being processed the other way around."""
|
||||
edges = [flipEdge(e) for e in wire.Edges]
|
||||
edges.reverse()
|
||||
PathLog.debug(edges)
|
||||
Path.Log.debug(edges)
|
||||
return Part.Wire(edges)
|
||||
|
||||
|
||||
@@ -729,7 +728,7 @@ def combineHorizontalFaces(faces):
|
||||
"PathGeom",
|
||||
"Zero working area to process. Check your selection and settings.",
|
||||
)
|
||||
PathLog.info(msg)
|
||||
Path.Log.info(msg)
|
||||
return horizontal
|
||||
|
||||
afbb = allFaces.BoundBox
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import PathScripts.PathLog as PathLog
|
||||
import Path
|
||||
|
||||
# lazily loaded modules
|
||||
from lazy_loader.lazy_loader import LazyLoader
|
||||
@@ -37,8 +37,8 @@ __author__ = "sliptonic (Brad Collette)"
|
||||
__url__ = "https://www.freecadweb.org"
|
||||
__doc__ = "Helper class to use FreeCADGUi.Snapper to let the user enter arbitrary points while the task panel is active."
|
||||
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
# PathLog.track(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
# Path.Log.track(Path.Log.thisModule())
|
||||
|
||||
|
||||
class TaskPanel:
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import Path
|
||||
import PathScripts.PathGeom as PathGeom
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathUtil as PathUtil
|
||||
from PySide import QtGui, QtCore
|
||||
|
||||
@@ -36,10 +36,10 @@ __doc__ = "A collection of helper and utility functions for the Path GUI."
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
def populateCombobox(form, enumTups, comboBoxesPropertyMap):
|
||||
@@ -50,7 +50,7 @@ def populateCombobox(form, enumTups, comboBoxesPropertyMap):
|
||||
enumTups = list of (translated_text, data_string) tuples
|
||||
comboBoxesPropertyMap = list of (translated_text, data_string) tuples
|
||||
"""
|
||||
PathLog.track(enumTups)
|
||||
Path.Log.track(enumTups)
|
||||
|
||||
# Load appropriate enumerations in each combobox
|
||||
for cb, prop in comboBoxesPropertyMap:
|
||||
@@ -70,7 +70,7 @@ def updateInputField(obj, prop, widget, onBeforeChange=None):
|
||||
Returns True if a new value was assigned, False otherwise (new value is the same as the current).
|
||||
"""
|
||||
value = widget.property("rawValue")
|
||||
PathLog.track("value: {}".format(value))
|
||||
Path.Log.track("value: {}".format(value))
|
||||
attr = PathUtil.getProperty(obj, prop)
|
||||
attrValue = attr.Value if hasattr(attr, "Value") else attr
|
||||
|
||||
@@ -83,7 +83,7 @@ def updateInputField(obj, prop, widget, onBeforeChange=None):
|
||||
for (prp, expr) in obj.ExpressionEngine:
|
||||
if prp == prop:
|
||||
exprSet = True
|
||||
PathLog.debug('prop = "expression": {} = "{}"'.format(prp, expr))
|
||||
Path.Log.debug('prop = "expression": {} = "{}"'.format(prp, expr))
|
||||
value = FreeCAD.Units.Quantity(obj.evalExpression(expr)).Value
|
||||
if not PathGeom.isRoughly(attrValue, value):
|
||||
isDiff = True
|
||||
@@ -97,7 +97,7 @@ def updateInputField(obj, prop, widget, onBeforeChange=None):
|
||||
widget.update()
|
||||
|
||||
if isDiff:
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"updateInputField(%s, %s): %.2f -> %.2f" % (obj.Label, prop, attr, value)
|
||||
)
|
||||
if onBeforeChange:
|
||||
@@ -120,7 +120,7 @@ class QuantitySpinBox(QtCore.QObject):
|
||||
|
||||
def __init__(self, widget, obj, prop, onBeforeChange=None):
|
||||
super().__init__()
|
||||
PathLog.track(widget)
|
||||
Path.Log.track(widget)
|
||||
self.widget = widget
|
||||
self.onBeforeChange = onBeforeChange
|
||||
self.prop = None
|
||||
@@ -150,7 +150,7 @@ class QuantitySpinBox(QtCore.QObject):
|
||||
|
||||
def attachTo(self, obj, prop=None):
|
||||
"""attachTo(obj, prop=None) ... use an existing editor for the given object and property"""
|
||||
PathLog.track(self.prop, prop)
|
||||
Path.Log.track(self.prop, prop)
|
||||
self.obj = obj
|
||||
self.prop = prop
|
||||
if obj and prop:
|
||||
@@ -161,21 +161,21 @@ class QuantitySpinBox(QtCore.QObject):
|
||||
self.widget.setProperty("binding", "%s.%s" % (obj.Name, prop))
|
||||
self.valid = True
|
||||
else:
|
||||
PathLog.warning("Cannot find property {} of {}".format(prop, obj.Label))
|
||||
Path.Log.warning("Cannot find property {} of {}".format(prop, obj.Label))
|
||||
self.valid = False
|
||||
else:
|
||||
self.valid = False
|
||||
|
||||
def expression(self):
|
||||
"""expression() ... returns the expression if one is bound to the property"""
|
||||
PathLog.track(self.prop, self.valid)
|
||||
Path.Log.track(self.prop, self.valid)
|
||||
if self.valid:
|
||||
return self.widget.property("expression")
|
||||
return ""
|
||||
|
||||
def setMinimum(self, quantity):
|
||||
"""setMinimum(quantity) ... set the minimum"""
|
||||
PathLog.track(self.prop, self.valid)
|
||||
Path.Log.track(self.prop, self.valid)
|
||||
if self.valid:
|
||||
value = quantity.Value if hasattr(quantity, "Value") else quantity
|
||||
self.widget.setProperty("setMinimum", value)
|
||||
@@ -184,7 +184,7 @@ class QuantitySpinBox(QtCore.QObject):
|
||||
"""updateSpinBox(quantity=None) ... update the display value of the spin box.
|
||||
If no value is provided the value of the bound property is used.
|
||||
quantity can be of type Quantity or Float."""
|
||||
PathLog.track(self.prop, self.valid, quantity)
|
||||
Path.Log.track(self.prop, self.valid, quantity)
|
||||
|
||||
if self.valid:
|
||||
expr = self._hasExpression()
|
||||
@@ -205,7 +205,7 @@ class QuantitySpinBox(QtCore.QObject):
|
||||
|
||||
def updateProperty(self):
|
||||
"""updateProperty() ... update the bound property with the value from the spin box"""
|
||||
PathLog.track(self.prop, self.valid)
|
||||
Path.Log.track(self.prop, self.valid)
|
||||
if self.valid:
|
||||
return updateInputField(
|
||||
self.obj, self.prop, self.widget, self.onBeforeChange
|
||||
|
||||
@@ -20,16 +20,16 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
import PathScripts.PathLog as PathLog
|
||||
import Path
|
||||
import subprocess
|
||||
|
||||
LOGLEVEL = False
|
||||
|
||||
if LOGLEVEL:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
Processed = False
|
||||
|
||||
@@ -37,7 +37,7 @@ Processed = False
|
||||
def Startup():
|
||||
global Processed
|
||||
if not Processed:
|
||||
PathLog.debug("Initializing PathGui")
|
||||
Path.Log.debug("Initializing PathGui")
|
||||
from PathScripts import PathAdaptiveGui
|
||||
from PathScripts import PathArray
|
||||
from PathScripts import PathComment
|
||||
@@ -98,4 +98,4 @@ def Startup():
|
||||
|
||||
Processed = True
|
||||
else:
|
||||
PathLog.debug("Skipping PathGui initialisation")
|
||||
Path.Log.debug("Skipping PathGui initialisation")
|
||||
|
||||
@@ -28,7 +28,6 @@ import FreeCAD
|
||||
import Part
|
||||
import Path
|
||||
import PathScripts.PathCircularHoleBase as PathCircularHoleBase
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathOp as PathOp
|
||||
import PathFeedRate
|
||||
|
||||
@@ -44,10 +43,10 @@ __lastModified__ = "2019-07-12 09:50 CST"
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
@@ -84,11 +83,11 @@ class ObjectHelix(PathCircularHoleBase.ObjectOp):
|
||||
data = list()
|
||||
idx = 0 if dataType == "translated" else 1
|
||||
|
||||
PathLog.debug(enums)
|
||||
Path.Log.debug(enums)
|
||||
|
||||
for k, v in enumerate(enums):
|
||||
data.append((v, [tup[idx] for tup in enums[v]]))
|
||||
PathLog.debug(data)
|
||||
Path.Log.debug(data)
|
||||
|
||||
return data
|
||||
|
||||
@@ -170,7 +169,7 @@ class ObjectHelix(PathCircularHoleBase.ObjectOp):
|
||||
|
||||
def circularHoleExecute(self, obj, holes):
|
||||
"""circularHoleExecute(obj, holes) ... generate helix commands for each hole in holes"""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.commandlist.append(Path.Command("(helix cut operation)"))
|
||||
|
||||
self.commandlist.append(Path.Command("G0", {"Z": obj.ClearanceHeight.Value}))
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import Path
|
||||
import PathGui as PGui # ensure Path/Gui/Resources are loaded
|
||||
import PathScripts.PathCircularHoleBaseGui as PathCircularHoleBaseGui
|
||||
import PathScripts.PathHelix as PathHelix
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathOpGui as PathOpGui
|
||||
import PathScripts.PathGui as PathGui
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
@@ -39,10 +39,10 @@ __doc__ = "Helix operation page controller and command implementation."
|
||||
LOGLEVEL = False
|
||||
|
||||
if LOGLEVEL:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.NOTICE, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.NOTICE, Path.Log.thisModule())
|
||||
|
||||
|
||||
class TaskPanelOpPage(PathCircularHoleBaseGui.TaskPanelOpPage):
|
||||
@@ -61,7 +61,7 @@ class TaskPanelOpPage(PathCircularHoleBaseGui.TaskPanelOpPage):
|
||||
|
||||
def getFields(self, obj):
|
||||
"""getFields(obj) ... transfers values from UI to obj's proprties"""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
if obj.Direction != str(self.form.direction.currentData()):
|
||||
obj.Direction = str(self.form.direction.currentData())
|
||||
if obj.StartSide != str(self.form.startSide.currentData()):
|
||||
@@ -75,7 +75,7 @@ class TaskPanelOpPage(PathCircularHoleBaseGui.TaskPanelOpPage):
|
||||
|
||||
def setFields(self, obj):
|
||||
"""setFields(obj) ... transfers obj's property values to UI"""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
|
||||
self.form.stepOverPercent.setValue(obj.StepOver)
|
||||
self.selectInComboBox(obj.Direction, self.form.direction)
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
# ***************************************************************************
|
||||
|
||||
import FreeCAD
|
||||
import Path
|
||||
import PathGui
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathUtil as PathUtil
|
||||
import importlib
|
||||
|
||||
@@ -34,10 +34,10 @@ __doc__ = "ViewProvider who's main and only task is to assign an icon."
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
class ViewProvider(object):
|
||||
@@ -91,7 +91,7 @@ class ViewProvider(object):
|
||||
self._onEditCallback(False)
|
||||
|
||||
def setupContextMenu(self, vobj, menu):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
from PySide import QtGui
|
||||
|
||||
edit = translate("Path", "Edit")
|
||||
@@ -107,12 +107,12 @@ def Attach(vobj, name):
|
||||
"""Attach(vobj, name) ... attach the appropriate view provider to the view object.
|
||||
If no view provider was registered for the given name a default IconViewProvider is created."""
|
||||
|
||||
PathLog.track(vobj.Object.Label, name)
|
||||
Path.Log.track(vobj.Object.Label, name)
|
||||
global _factory
|
||||
for key, value in PathUtil.keyValueIter(_factory):
|
||||
if key == name:
|
||||
return value(vobj, name)
|
||||
PathLog.track(vobj.Object.Label, name, "PathIconViewProvider")
|
||||
Path.Log.track(vobj.Object.Label, name, "PathIconViewProvider")
|
||||
return ViewProvider(vobj, name)
|
||||
|
||||
|
||||
@@ -120,6 +120,6 @@ def RegisterViewProvider(name, provider):
|
||||
"""RegisterViewProvider(name, provider) ... if an IconViewProvider is created for an object with the given name
|
||||
an instance of provider is used instead."""
|
||||
|
||||
PathLog.track(name)
|
||||
Path.Log.track(name)
|
||||
global _factory
|
||||
_factory[name] = provider
|
||||
|
||||
@@ -24,7 +24,7 @@ from PathScripts.PathPostProcessor import PostProcessor
|
||||
from PySide import QtCore
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
import FreeCAD
|
||||
import PathScripts.PathLog as PathLog
|
||||
import Path
|
||||
import PathScripts.PathPreferences as PathPreferences
|
||||
import PathScripts.PathSetupSheet as PathSetupSheet
|
||||
import PathScripts.PathStock as PathStock
|
||||
@@ -42,10 +42,10 @@ Draft = LazyLoader("Draft", globals(), "Draft")
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
@@ -272,11 +272,11 @@ class ObjectJob:
|
||||
data = list()
|
||||
idx = 0 if dataType == "translated" else 1
|
||||
|
||||
PathLog.debug(enums)
|
||||
Path.Log.debug(enums)
|
||||
|
||||
for k, v in enumerate(enums):
|
||||
data.append((v, [tup[idx] for tup in enums[v]]))
|
||||
PathLog.debug(data)
|
||||
Path.Log.debug(data)
|
||||
|
||||
return data
|
||||
|
||||
@@ -316,7 +316,7 @@ class ObjectJob:
|
||||
self.setupSheet = obj.SetupSheet.Proxy
|
||||
|
||||
def setupBaseModel(self, obj, models=None):
|
||||
PathLog.track(obj.Label, models)
|
||||
Path.Log.track(obj.Label, models)
|
||||
addModels = False
|
||||
|
||||
if not hasattr(obj, "Model"):
|
||||
@@ -346,7 +346,7 @@ class ObjectJob:
|
||||
obj.Model.Label = "Model"
|
||||
|
||||
if hasattr(obj, "Base"):
|
||||
PathLog.info(
|
||||
Path.Log.info(
|
||||
"Converting Job.Base to new Job.Model for {}".format(obj.Label)
|
||||
)
|
||||
obj.Model.addObject(obj.Base)
|
||||
@@ -403,12 +403,12 @@ class ObjectJob:
|
||||
|
||||
def onDelete(self, obj, arg2=None):
|
||||
"""Called by the view provider, there doesn't seem to be a callback on the obj itself."""
|
||||
PathLog.track(obj.Label, arg2)
|
||||
Path.Log.track(obj.Label, arg2)
|
||||
doc = obj.Document
|
||||
|
||||
if getattr(obj, "Operations", None):
|
||||
# the first to tear down are the ops, they depend on other resources
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"taking down ops: %s" % [o.Name for o in self.allOperations()]
|
||||
)
|
||||
while obj.Operations.Group:
|
||||
@@ -426,7 +426,7 @@ class ObjectJob:
|
||||
|
||||
# stock could depend on Model, so delete it first
|
||||
if getattr(obj, "Stock", None):
|
||||
PathLog.debug("taking down stock")
|
||||
Path.Log.debug("taking down stock")
|
||||
PathUtil.clearExpressionEngine(obj.Stock)
|
||||
doc.removeObject(obj.Stock.Name)
|
||||
obj.Stock = None
|
||||
@@ -434,7 +434,7 @@ class ObjectJob:
|
||||
# base doesn't depend on anything inside job
|
||||
if getattr(obj, "Model", None):
|
||||
for base in obj.Model.Group:
|
||||
PathLog.debug("taking down base %s" % base.Label)
|
||||
Path.Log.debug("taking down base %s" % base.Label)
|
||||
self.removeBase(obj, base, False)
|
||||
obj.Model.Group = []
|
||||
doc.removeObject(obj.Model.Name)
|
||||
@@ -442,7 +442,7 @@ class ObjectJob:
|
||||
|
||||
# Tool controllers might refer to either legacy tool or toolbit
|
||||
if getattr(obj, "Tools", None):
|
||||
PathLog.debug("taking down tool controller")
|
||||
Path.Log.debug("taking down tool controller")
|
||||
for tc in obj.Tools.Group:
|
||||
if hasattr(tc.Tool, "Proxy"):
|
||||
PathUtil.clearExpressionEngine(tc.Tool)
|
||||
@@ -631,10 +631,10 @@ class ObjectJob:
|
||||
if attrs.get(JobTemplate.SplitOutput):
|
||||
obj.SplitOutput = attrs.get(JobTemplate.SplitOutput)
|
||||
|
||||
PathLog.debug("setting tool controllers (%d)" % len(tcs))
|
||||
Path.Log.debug("setting tool controllers (%d)" % len(tcs))
|
||||
obj.Tools.Group = tcs
|
||||
else:
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
"Unsupported PathJob template version {}".format(
|
||||
attrs.get(JobTemplate.Version)
|
||||
)
|
||||
@@ -719,7 +719,7 @@ class ObjectJob:
|
||||
if removeBefore:
|
||||
group.remove(before)
|
||||
except Exception as e:
|
||||
PathLog.error(e)
|
||||
Path.Log.error(e)
|
||||
group.append(op)
|
||||
else:
|
||||
group.append(op)
|
||||
@@ -736,7 +736,7 @@ class ObjectJob:
|
||||
|
||||
def addToolController(self, tc):
|
||||
group = self.obj.Tools.Group
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"addToolController(%s): %s" % (tc.Label, [t.Label for t in group])
|
||||
)
|
||||
if tc.Name not in [str(t.Name) for t in group]:
|
||||
@@ -795,7 +795,7 @@ class ObjectJob:
|
||||
suffix = job.Name[3:]
|
||||
|
||||
def errorMessage(grp, job):
|
||||
PathLog.error("{} corrupt in {} job.".format(grp, job.Name))
|
||||
Path.Log.error("{} corrupt in {} job.".format(grp, job.Name))
|
||||
|
||||
if not job.Operations:
|
||||
self.setupOperations(job)
|
||||
|
||||
@@ -24,9 +24,9 @@ from PySide import QtCore, QtGui
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import Path
|
||||
import PathScripts.PathJob as PathJob
|
||||
import PathScripts.PathJobDlg as PathJobDlg
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathPreferences as PathPreferences
|
||||
import PathScripts.PathStock as PathStock
|
||||
import PathScripts.PathUtil as PathUtil
|
||||
@@ -37,10 +37,10 @@ import os
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
class CommandJobCreate:
|
||||
|
||||
@@ -24,8 +24,8 @@ from PySide import QtCore, QtGui
|
||||
from collections import Counter
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import Path
|
||||
import PathScripts.PathJob as PathJob
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathPreferences as PathPreferences
|
||||
import PathScripts.PathStock as PathStock
|
||||
import PathScripts.PathUtil as PathUtil
|
||||
@@ -36,10 +36,10 @@ translate = FreeCAD.Qt.translate
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
class _ItemDelegate(QtGui.QStyledItemDelegate):
|
||||
@@ -238,7 +238,7 @@ class JobCreate:
|
||||
while name in template:
|
||||
i = i + 1
|
||||
name = basename + " (%s)" % i
|
||||
PathLog.track(name, tFile)
|
||||
Path.Log.track(name, tFile)
|
||||
template[name] = tFile
|
||||
selectTemplate = PathPreferences.defaultJobTemplate()
|
||||
index = 0
|
||||
@@ -253,7 +253,7 @@ class JobCreate:
|
||||
def templateFilesIn(self, path):
|
||||
"""templateFilesIn(path) ... answer all file in the given directory which fit the job template naming convention.
|
||||
PathJob template files are name job_*.json"""
|
||||
PathLog.track(path)
|
||||
Path.Log.track(path)
|
||||
return glob.glob(path + "/job_*.json")
|
||||
|
||||
def getModels(self):
|
||||
@@ -353,7 +353,7 @@ class JobTemplateExport:
|
||||
|
||||
else: # Existing Solid
|
||||
seHint = "-"
|
||||
PathLog.error(translate("Path_Job", "Unsupported stock type"))
|
||||
Path.Log.error(translate("Path_Job", "Unsupported stock type"))
|
||||
self.dialog.stockExtentHint.setText(seHint)
|
||||
spHint = "%s" % job.Stock.Placement
|
||||
self.dialog.stockPlacementHint.setText(spHint)
|
||||
|
||||
@@ -27,12 +27,12 @@ from contextlib import contextmanager
|
||||
from pivy import coin
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import Path
|
||||
import PathScripts.PathGeom as PathGeom
|
||||
import PathScripts.PathGuiInit as PathGuiInit
|
||||
import PathScripts.PathJob as PathJob
|
||||
import PathScripts.PathJobCmd as PathJobCmd
|
||||
import PathScripts.PathJobDlg as PathJobDlg
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathPreferences as PathPreferences
|
||||
import PathScripts.PathSetupSheetGui as PathSetupSheetGui
|
||||
import PathScripts.PathStock as PathStock
|
||||
@@ -55,10 +55,10 @@ DraftVecUtils = LazyLoader("DraftVecUtils", globals(), "DraftVecUtils")
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
def _OpenCloseResourceEditor(obj, vobj, edit):
|
||||
@@ -74,7 +74,7 @@ def _OpenCloseResourceEditor(obj, vobj, edit):
|
||||
missing = "ViewObject"
|
||||
if job.ViewObject:
|
||||
missing = "Proxy"
|
||||
PathLog.warning("Cannot edit %s - no %s" % (obj.Label, missing))
|
||||
Path.Log.warning("Cannot edit %s - no %s" % (obj.Label, missing))
|
||||
|
||||
|
||||
@contextmanager
|
||||
@@ -162,7 +162,7 @@ class ViewProvider:
|
||||
return hasattr(self, "deleteOnReject") and self.deleteOnReject
|
||||
|
||||
def setEdit(self, vobj=None, mode=0):
|
||||
PathLog.track(mode)
|
||||
Path.Log.track(mode)
|
||||
if 0 == mode:
|
||||
job = self.vobj.Object
|
||||
if not job.Proxy.integrityCheck(job):
|
||||
@@ -192,7 +192,7 @@ class ViewProvider:
|
||||
return self.openTaskPanel("Model")
|
||||
if obj == self.obj.Stock:
|
||||
return self.openTaskPanel("Stock")
|
||||
PathLog.info(
|
||||
Path.Log.info(
|
||||
"Expected a specific object to edit - %s not recognized" % obj.Label
|
||||
)
|
||||
return self.openTaskPanel()
|
||||
@@ -221,12 +221,12 @@ class ViewProvider:
|
||||
return children
|
||||
|
||||
def onDelete(self, vobj, arg2=None):
|
||||
PathLog.track(vobj.Object.Label, arg2)
|
||||
Path.Log.track(vobj.Object.Label, arg2)
|
||||
self.obj.Proxy.onDelete(self.obj, arg2)
|
||||
return True
|
||||
|
||||
def updateData(self, obj, prop):
|
||||
PathLog.track(obj.Label, prop)
|
||||
Path.Log.track(obj.Label, prop)
|
||||
# make sure the resource view providers are setup properly
|
||||
if prop == "Model" and self.obj.Model:
|
||||
for base in self.obj.Model.Group:
|
||||
@@ -241,7 +241,7 @@ class ViewProvider:
|
||||
self.obj.Stock.ViewObject.Proxy.onEdit(_OpenCloseResourceEditor)
|
||||
|
||||
def rememberBaseVisibility(self, obj, base):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
if base.ViewObject:
|
||||
orig = PathUtil.getPublicObject(obj.Proxy.baseObject(obj, base))
|
||||
self.baseVisibility[base.Name] = (
|
||||
@@ -254,7 +254,7 @@ class ViewProvider:
|
||||
base.ViewObject.Visibility = True
|
||||
|
||||
def forgetBaseVisibility(self, obj, base):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
if self.baseVisibility.get(base.Name):
|
||||
visibility = self.baseVisibility[base.Name]
|
||||
visibility[0].ViewObject.Visibility = visibility[1]
|
||||
@@ -262,7 +262,7 @@ class ViewProvider:
|
||||
del self.baseVisibility[base.Name]
|
||||
|
||||
def setupEditVisibility(self, obj):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.baseVisibility = {}
|
||||
for base in obj.Model.Group:
|
||||
self.rememberBaseVisibility(obj, base)
|
||||
@@ -273,14 +273,14 @@ class ViewProvider:
|
||||
self.obj.Stock.ViewObject.Visibility = True
|
||||
|
||||
def resetEditVisibility(self, obj):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
for base in obj.Model.Group:
|
||||
self.forgetBaseVisibility(obj, base)
|
||||
if obj.Stock and obj.Stock.ViewObject:
|
||||
obj.Stock.ViewObject.Visibility = self.stockVisibility
|
||||
|
||||
def setupContextMenu(self, vobj, menu):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
for action in menu.actions():
|
||||
menu.removeAction(action)
|
||||
action = QtGui.QAction(translate("Path_Job", "Edit"), menu)
|
||||
@@ -293,7 +293,7 @@ class StockEdit(object):
|
||||
StockType = PathStock.StockType.Unknown
|
||||
|
||||
def __init__(self, obj, form, force):
|
||||
PathLog.track(obj.Label, force)
|
||||
Path.Log.track(obj.Label, force)
|
||||
self.obj = obj
|
||||
self.form = form
|
||||
self.force = force
|
||||
@@ -304,7 +304,7 @@ class StockEdit(object):
|
||||
return PathStock.StockType.FromStock(obj.Stock) == cls.StockType
|
||||
|
||||
def activate(self, obj, select=False):
|
||||
PathLog.track(obj.Label, select)
|
||||
Path.Log.track(obj.Label, select)
|
||||
|
||||
def showHide(widget, activeWidget):
|
||||
if widget == activeWidget:
|
||||
@@ -322,11 +322,11 @@ class StockEdit(object):
|
||||
self.setFields(obj)
|
||||
|
||||
def setStock(self, obj, stock):
|
||||
PathLog.track(obj.Label, stock)
|
||||
Path.Log.track(obj.Label, stock)
|
||||
if obj.Stock:
|
||||
PathLog.track(obj.Stock.Name)
|
||||
Path.Log.track(obj.Stock.Name)
|
||||
obj.Document.removeObject(obj.Stock.Name)
|
||||
PathLog.track(stock.Name)
|
||||
Path.Log.track(stock.Name)
|
||||
obj.Stock = stock
|
||||
if stock.ViewObject and stock.ViewObject.Proxy:
|
||||
stock.ViewObject.Proxy.onEdit(_OpenCloseResourceEditor)
|
||||
@@ -359,7 +359,7 @@ class StockFromBaseBoundBoxEdit(StockEdit):
|
||||
self.trackZpos = None
|
||||
|
||||
def editorFrame(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
return self.form.stockFromBase
|
||||
|
||||
def getFieldsStock(self, stock, fields=None):
|
||||
@@ -384,16 +384,16 @@ class StockFromBaseBoundBoxEdit(StockEdit):
|
||||
def getFields(self, obj, fields=None):
|
||||
if fields is None:
|
||||
fields = ["xneg", "xpos", "yneg", "ypos", "zneg", "zpos"]
|
||||
PathLog.track(obj.Label, fields)
|
||||
Path.Log.track(obj.Label, fields)
|
||||
if self.IsStock(obj):
|
||||
self.getFieldsStock(obj.Stock, fields)
|
||||
else:
|
||||
PathLog.error("Stock not from Base bound box!")
|
||||
Path.Log.error("Stock not from Base bound box!")
|
||||
|
||||
def setFields(self, obj):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
if self.force or not self.IsStock(obj):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
stock = PathStock.CreateFromBase(obj)
|
||||
if self.force and self.editorFrame().isVisible():
|
||||
self.getFieldsStock(stock)
|
||||
@@ -407,7 +407,7 @@ class StockFromBaseBoundBoxEdit(StockEdit):
|
||||
self.setLengthField(self.form.stockExtZpos, obj.Stock.ExtZpos)
|
||||
|
||||
def setupUi(self, obj):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.setFields(obj)
|
||||
self.checkXpos()
|
||||
self.checkYpos()
|
||||
@@ -480,7 +480,7 @@ class StockCreateBoxEdit(StockEdit):
|
||||
self.form.stockBoxHeight.text()
|
||||
)
|
||||
else:
|
||||
PathLog.error("Stock not a box!")
|
||||
Path.Log.error("Stock not a box!")
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
@@ -526,7 +526,7 @@ class StockCreateCylinderEdit(StockEdit):
|
||||
self.form.stockCylinderHeight.text()
|
||||
)
|
||||
else:
|
||||
PathLog.error(translate("Path_Job", "Stock not a cylinder!"))
|
||||
Path.Log.error(translate("Path_Job", "Stock not a cylinder!"))
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
@@ -687,13 +687,13 @@ class TaskPanel:
|
||||
box.addItem(text, data)
|
||||
|
||||
def preCleanup(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
FreeCADGui.Selection.removeObserver(self)
|
||||
self.vproxy.resetEditVisibility(self.obj)
|
||||
self.vproxy.resetTaskPanel()
|
||||
|
||||
def accept(self, resetEdit=True):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self._jobIntegrityCheck() # Check existence of Model and Tools
|
||||
self.preCleanup()
|
||||
self.getFields()
|
||||
@@ -703,19 +703,19 @@ class TaskPanel:
|
||||
self.cleanup(resetEdit)
|
||||
|
||||
def reject(self, resetEdit=True):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.preCleanup()
|
||||
self.setupGlobal.reject()
|
||||
self.setupOps.reject()
|
||||
FreeCAD.ActiveDocument.abortTransaction()
|
||||
if self.deleteOnReject and FreeCAD.ActiveDocument.getObject(self.name):
|
||||
PathLog.info("Uncreate Job")
|
||||
Path.Log.info("Uncreate Job")
|
||||
FreeCAD.ActiveDocument.openTransaction("Uncreate Job")
|
||||
if self.obj.ViewObject.Proxy.onDelete(self.obj.ViewObject, None):
|
||||
FreeCAD.ActiveDocument.removeObject(self.obj.Name)
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
else:
|
||||
PathLog.track(
|
||||
Path.Log.track(
|
||||
self.name,
|
||||
self.deleteOnReject,
|
||||
FreeCAD.ActiveDocument.getObject(self.name),
|
||||
@@ -724,7 +724,7 @@ class TaskPanel:
|
||||
return True
|
||||
|
||||
def cleanup(self, resetEdit):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
FreeCADGui.Control.closeDialog()
|
||||
if resetEdit:
|
||||
FreeCADGui.ActiveDocument.resetEdit()
|
||||
@@ -779,7 +779,7 @@ class TaskPanel:
|
||||
flist.append(self.form.wcslist.item(i).text())
|
||||
self.obj.Fixtures = flist
|
||||
except Exception as e:
|
||||
PathLog.debug(e)
|
||||
Path.Log.debug(e)
|
||||
FreeCAD.Console.PrintWarning(
|
||||
"The Job was created without fixture support. Please delete and recreate the job\r\n"
|
||||
)
|
||||
@@ -1083,10 +1083,10 @@ class TaskPanel:
|
||||
self.template.updateUI()
|
||||
|
||||
def modelSetAxis(self, axis):
|
||||
PathLog.track(axis)
|
||||
Path.Log.track(axis)
|
||||
|
||||
def alignSel(sel, normal, flip=False):
|
||||
PathLog.track(
|
||||
Path.Log.track(
|
||||
"Vector(%.2f, %.2f, %.2f)" % (normal.x, normal.y, normal.z), flip
|
||||
)
|
||||
v = axis
|
||||
@@ -1104,7 +1104,7 @@ class TaskPanel:
|
||||
else:
|
||||
r = v.cross(normal) # rotation axis
|
||||
a = DraftVecUtils.angle(normal, v, r) * 180 / math.pi
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"oh boy: (%.2f, %.2f, %.2f) x (%.2f, %.2f, %.2f) -> (%.2f, %.2f, %.2f) -> %.2f"
|
||||
% (v.x, v.y, v.z, normal.x, normal.y, normal.z, r.x, r.y, r.z, a)
|
||||
)
|
||||
@@ -1117,19 +1117,19 @@ class TaskPanel:
|
||||
selObject = sel.Object
|
||||
for feature in sel.SubElementNames:
|
||||
selFeature = feature
|
||||
PathLog.track(selObject.Label, feature)
|
||||
Path.Log.track(selObject.Label, feature)
|
||||
sub = sel.Object.Shape.getElement(feature)
|
||||
|
||||
if "Face" == sub.ShapeType:
|
||||
normal = sub.normalAt(0, 0)
|
||||
if sub.Orientation == "Reversed":
|
||||
normal = FreeCAD.Vector() - normal
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"(%.2f, %.2f, %.2f) -> reversed (%s)"
|
||||
% (normal.x, normal.y, normal.z, sub.Orientation)
|
||||
)
|
||||
else:
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"(%.2f, %.2f, %.2f) -> forward (%s)"
|
||||
% (normal.x, normal.y, normal.z, sub.Orientation)
|
||||
)
|
||||
@@ -1155,7 +1155,7 @@ class TaskPanel:
|
||||
alignSel(sel, normal)
|
||||
|
||||
else:
|
||||
PathLog.track(sub.ShapeType)
|
||||
Path.Log.track(sub.ShapeType)
|
||||
|
||||
if selObject and selFeature:
|
||||
FreeCADGui.Selection.clearSelection()
|
||||
@@ -1167,19 +1167,19 @@ class TaskPanel:
|
||||
FreeCADGui.Selection.addSelection(sel.Object, sel.SubElementNames)
|
||||
|
||||
def modelSet0(self, axis):
|
||||
PathLog.track(axis)
|
||||
Path.Log.track(axis)
|
||||
with selectionEx() as selection:
|
||||
for sel in selection:
|
||||
selObject = sel.Object
|
||||
PathLog.track(selObject.Label)
|
||||
Path.Log.track(selObject.Label)
|
||||
for name in sel.SubElementNames:
|
||||
PathLog.track(selObject.Label, name)
|
||||
Path.Log.track(selObject.Label, name)
|
||||
feature = selObject.Shape.getElement(name)
|
||||
bb = feature.BoundBox
|
||||
offset = FreeCAD.Vector(
|
||||
axis.x * bb.XMax, axis.y * bb.YMax, axis.z * bb.ZMax
|
||||
)
|
||||
PathLog.track(feature.BoundBox.ZMax, offset)
|
||||
Path.Log.track(feature.BoundBox.ZMax, offset)
|
||||
p = selObject.Placement
|
||||
p.move(offset)
|
||||
selObject.Placement = p
|
||||
@@ -1254,7 +1254,7 @@ class TaskPanel:
|
||||
|
||||
def updateStockEditor(self, index, force=False):
|
||||
def setupFromBaseEdit():
|
||||
PathLog.track(index, force)
|
||||
Path.Log.track(index, force)
|
||||
if force or not self.stockFromBase:
|
||||
self.stockFromBase = StockFromBaseBoundBoxEdit(
|
||||
self.obj, self.form, force
|
||||
@@ -1262,13 +1262,13 @@ class TaskPanel:
|
||||
self.stockEdit = self.stockFromBase
|
||||
|
||||
def setupCreateBoxEdit():
|
||||
PathLog.track(index, force)
|
||||
Path.Log.track(index, force)
|
||||
if force or not self.stockCreateBox:
|
||||
self.stockCreateBox = StockCreateBoxEdit(self.obj, self.form, force)
|
||||
self.stockEdit = self.stockCreateBox
|
||||
|
||||
def setupCreateCylinderEdit():
|
||||
PathLog.track(index, force)
|
||||
Path.Log.track(index, force)
|
||||
if force or not self.stockCreateCylinder:
|
||||
self.stockCreateCylinder = StockCreateCylinderEdit(
|
||||
self.obj, self.form, force
|
||||
@@ -1276,7 +1276,7 @@ class TaskPanel:
|
||||
self.stockEdit = self.stockCreateCylinder
|
||||
|
||||
def setupFromExisting():
|
||||
PathLog.track(index, force)
|
||||
Path.Log.track(index, force)
|
||||
if force or not self.stockFromExisting:
|
||||
self.stockFromExisting = StockFromExistingEdit(
|
||||
self.obj, self.form, force
|
||||
@@ -1296,7 +1296,7 @@ class TaskPanel:
|
||||
elif StockFromExistingEdit.IsStock(self.obj):
|
||||
setupFromExisting()
|
||||
else:
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
translate("Path_Job", "Unsupported stock object %s")
|
||||
% self.obj.Stock.Label
|
||||
)
|
||||
@@ -1312,7 +1312,7 @@ class TaskPanel:
|
||||
setupFromBaseEdit()
|
||||
index = -1
|
||||
else:
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
translate("Path_Job", "Unsupported stock type %s (%d)")
|
||||
% (self.form.stock.currentText(), index)
|
||||
)
|
||||
@@ -1443,7 +1443,7 @@ class TaskPanel:
|
||||
if obsolete or additions:
|
||||
self.setFields()
|
||||
else:
|
||||
PathLog.track("no changes to model")
|
||||
Path.Log.track("no changes to model")
|
||||
|
||||
def tabPageChanged(self, index):
|
||||
if index == 0:
|
||||
@@ -1459,7 +1459,7 @@ class TaskPanel:
|
||||
try:
|
||||
self.setupOps.setupUi()
|
||||
except Exception as ee:
|
||||
PathLog.error(str(ee))
|
||||
Path.Log.error(str(ee))
|
||||
self.updateStockEditor(-1, False)
|
||||
self.setFields()
|
||||
|
||||
@@ -1649,7 +1649,7 @@ def Create(base, template=None, openTaskPanel=True):
|
||||
obj.ViewObject.Proxy.deleteOnReject = False
|
||||
return obj
|
||||
except Exception as exc:
|
||||
PathLog.error(exc)
|
||||
Path.Log.error(exc)
|
||||
traceback.print_exc()
|
||||
FreeCAD.ActiveDocument.abortTransaction()
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import FreeCAD
|
||||
import PathScripts.PathLog as PathLog
|
||||
import Path
|
||||
import PathScripts.PathPocketBase as PathPocketBase
|
||||
import PathScripts.PathUtils as PathUtils
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
@@ -42,10 +42,10 @@ __contributors__ = "russ4262 (Russell Johnson)"
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
@@ -79,16 +79,16 @@ class ObjectFace(PathPocketBase.ObjectPocket):
|
||||
data = list()
|
||||
idx = 0 if dataType == "translated" else 1
|
||||
|
||||
PathLog.debug(enums)
|
||||
Path.Log.debug(enums)
|
||||
|
||||
for k, v in enumerate(enums):
|
||||
data.append((v, [tup[idx] for tup in enums[v]]))
|
||||
PathLog.debug(data)
|
||||
Path.Log.debug(data)
|
||||
|
||||
return data
|
||||
|
||||
def initPocketOp(self, obj):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
"""initPocketOp(obj) ... create facing specific properties"""
|
||||
obj.addProperty(
|
||||
"App::PropertyEnumeration",
|
||||
@@ -122,7 +122,7 @@ class ObjectFace(PathPocketBase.ObjectPocket):
|
||||
|
||||
def areaOpOnChanged(self, obj, prop):
|
||||
"""areaOpOnChanged(obj, prop) ... facing specific depths calculation."""
|
||||
PathLog.track(prop)
|
||||
Path.Log.track(prop)
|
||||
if prop == "StepOver" and obj.StepOver == 0:
|
||||
obj.StepOver = 1
|
||||
|
||||
@@ -133,7 +133,7 @@ class ObjectFace(PathPocketBase.ObjectPocket):
|
||||
obj.OpStartDepth = job.Stock.Shape.BoundBox.ZMax
|
||||
|
||||
if len(obj.Base) >= 1:
|
||||
PathLog.debug("processing")
|
||||
Path.Log.debug("processing")
|
||||
sublist = []
|
||||
for i in obj.Base:
|
||||
o = i[0]
|
||||
@@ -154,10 +154,10 @@ class ObjectFace(PathPocketBase.ObjectPocket):
|
||||
self.removalshapes = []
|
||||
holeShape = None
|
||||
|
||||
PathLog.debug("depthparams: {}".format([i for i in self.depthparams]))
|
||||
Path.Log.debug("depthparams: {}".format([i for i in self.depthparams]))
|
||||
|
||||
if obj.Base:
|
||||
PathLog.debug("obj.Base: {}".format(obj.Base))
|
||||
Path.Log.debug("obj.Base: {}".format(obj.Base))
|
||||
faces = []
|
||||
holes = []
|
||||
holeEnvs = []
|
||||
@@ -187,7 +187,7 @@ class ObjectFace(PathPocketBase.ObjectPocket):
|
||||
else:
|
||||
holes.append((b[0].Shape, wire))
|
||||
else:
|
||||
PathLog.warning(
|
||||
Path.Log.warning(
|
||||
'The base subobject, "{0}," is not a face. Ignoring "{0}."'.format(
|
||||
sub
|
||||
)
|
||||
@@ -202,16 +202,16 @@ class ObjectFace(PathPocketBase.ObjectPocket):
|
||||
holeEnvs.append(env)
|
||||
holeShape = Part.makeCompound(holeEnvs)
|
||||
|
||||
PathLog.debug("Working on a collection of faces {}".format(faces))
|
||||
Path.Log.debug("Working on a collection of faces {}".format(faces))
|
||||
planeshape = Part.makeCompound(faces)
|
||||
|
||||
# If no base object, do planing of top surface of entire model
|
||||
else:
|
||||
planeshape = Part.makeCompound([base.Shape for base in self.model])
|
||||
PathLog.debug("Working on a shape {}".format(obj.Label))
|
||||
Path.Log.debug("Working on a shape {}".format(obj.Label))
|
||||
|
||||
# Find the correct shape depending on Boundary shape.
|
||||
PathLog.debug("Boundary Shape: {}".format(obj.BoundaryShape))
|
||||
Path.Log.debug("Boundary Shape: {}".format(obj.BoundaryShape))
|
||||
bb = planeshape.BoundBox
|
||||
|
||||
# Apply offset for clearing edges
|
||||
@@ -307,14 +307,14 @@ class ObjectFace(PathPocketBase.ObjectPocket):
|
||||
env = ofstShapeEnv
|
||||
|
||||
if holeShape:
|
||||
PathLog.debug("Processing holes and face ...")
|
||||
Path.Log.debug("Processing holes and face ...")
|
||||
holeEnv = PathUtils.getEnvelope(
|
||||
partshape=holeShape, depthparams=self.depthparams
|
||||
)
|
||||
newEnv = env.cut(holeEnv)
|
||||
tup = newEnv, False, "pathMillFace"
|
||||
else:
|
||||
PathLog.debug("Processing solid face ...")
|
||||
Path.Log.debug("Processing solid face ...")
|
||||
tup = env, False, "pathMillFace"
|
||||
|
||||
self.removalshapes.append(tup)
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
import FreeCAD
|
||||
import PathScripts.PathLog as PathLog
|
||||
import Path
|
||||
import PathScripts.PathMillFace as PathMillFace
|
||||
import PathScripts.PathOpGui as PathOpGui
|
||||
import PathScripts.PathPocketBaseGui as PathPocketBaseGui
|
||||
@@ -35,17 +35,17 @@ __url__ = "https://www.freecadweb.org"
|
||||
__doc__ = "Face Mill operation page controller and command implementation."
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
class TaskPanelOpPage(PathPocketBaseGui.TaskPanelOpPage):
|
||||
"""Page controller class for the face milling operation."""
|
||||
|
||||
def getForm(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
"""getForm() ... return UI"""
|
||||
|
||||
form = FreeCADGui.PySideUic.loadUi(":/panels/PageOpPocketFullEdit.ui")
|
||||
|
||||
@@ -25,7 +25,6 @@ from PathScripts.PathUtils import waiting_effects
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
import Path
|
||||
import PathScripts.PathGeom as PathGeom
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathPreferences as PathPreferences
|
||||
import PathScripts.PathUtil as PathUtil
|
||||
import PathScripts.PathUtils as PathUtils
|
||||
@@ -44,10 +43,10 @@ __url__ = "https://www.freecadweb.org"
|
||||
__doc__ = "Base class and properties implementation for all Path operations."
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
@@ -164,7 +163,7 @@ class ObjectOp(object):
|
||||
obj.setEditorMode("OpStockZMin", 1) # read-only
|
||||
|
||||
def __init__(self, obj, name, parentJob=None):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
|
||||
obj.addProperty(
|
||||
"App::PropertyBool",
|
||||
@@ -336,8 +335,8 @@ class ObjectOp(object):
|
||||
)
|
||||
|
||||
for n in self.opPropertyEnumerations():
|
||||
PathLog.debug("n: {}".format(n))
|
||||
PathLog.debug("n[0]: {} n[1]: {}".format(n[0], n[1]))
|
||||
Path.Log.debug("n: {}".format(n))
|
||||
Path.Log.debug("n[0]: {} n[1]: {}".format(n[0], n[1]))
|
||||
if hasattr(obj, n[0]):
|
||||
setattr(obj, n[0], n[1])
|
||||
|
||||
@@ -390,11 +389,11 @@ class ObjectOp(object):
|
||||
data = list()
|
||||
idx = 0 if dataType == "translated" else 1
|
||||
|
||||
PathLog.debug(enums)
|
||||
Path.Log.debug(enums)
|
||||
|
||||
for k, v in enumerate(enums):
|
||||
data.append((v, [tup[idx] for tup in enums[v]]))
|
||||
PathLog.debug(data)
|
||||
Path.Log.debug(data)
|
||||
|
||||
return data
|
||||
|
||||
@@ -410,13 +409,13 @@ class ObjectOp(object):
|
||||
obj.setEditorMode("OpFinalDepth", 2)
|
||||
|
||||
def onDocumentRestored(self, obj):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
features = self.opFeatures(obj)
|
||||
if (
|
||||
FeatureBaseGeometry & features
|
||||
and "App::PropertyLinkSubList" == obj.getTypeIdOfProperty("Base")
|
||||
):
|
||||
PathLog.info("Replacing link property with global link (%s)." % obj.State)
|
||||
Path.Log.info("Replacing link property with global link (%s)." % obj.State)
|
||||
base = obj.Base
|
||||
obj.removeProperty("Base")
|
||||
self.addBaseProperty(obj)
|
||||
@@ -580,8 +579,8 @@ class ObjectOp(object):
|
||||
obj.OpToolDiameter = obj.ToolController.Tool.Diameter
|
||||
|
||||
if FeatureCoolant & features:
|
||||
PathLog.track()
|
||||
PathLog.debug(obj.getEnumerationsOfProperty("CoolantMode"))
|
||||
Path.Log.track()
|
||||
Path.Log.debug(obj.getEnumerationsOfProperty("CoolantMode"))
|
||||
obj.CoolantMode = job.SetupSheet.CoolantMode
|
||||
|
||||
if FeatureDepths & features:
|
||||
@@ -635,11 +634,11 @@ class ObjectOp(object):
|
||||
|
||||
if not job:
|
||||
if not ignoreErrors:
|
||||
PathLog.error(translate("Path", "No parent job found for operation."))
|
||||
Path.Log.error(translate("Path", "No parent job found for operation."))
|
||||
return False
|
||||
if not job.Model.Group:
|
||||
if not ignoreErrors:
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
translate("Path", "Parent job %s doesn't have a base object")
|
||||
% job.Label
|
||||
)
|
||||
@@ -694,7 +693,7 @@ class ObjectOp(object):
|
||||
zmin = max(zmin, faceZmin(bb, fbb))
|
||||
zmax = max(zmax, fbb.ZMax)
|
||||
except Part.OCCError as e:
|
||||
PathLog.error(e)
|
||||
Path.Log.error(e)
|
||||
|
||||
else:
|
||||
# clearing with stock boundaries
|
||||
@@ -738,7 +737,7 @@ class ObjectOp(object):
|
||||
for sub in sublist:
|
||||
o.Shape.getElement(sub)
|
||||
except Part.OCCError:
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
"{} - stale base geometry detected - clearing.".format(obj.Label)
|
||||
)
|
||||
obj.Base = []
|
||||
@@ -766,7 +765,7 @@ class ObjectOp(object):
|
||||
Finally the base implementation adds a rapid move to clearance height and assigns
|
||||
the receiver's Path property from the command list.
|
||||
"""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
|
||||
if not obj.Active:
|
||||
path = Path.Path("(inactive operation)")
|
||||
@@ -782,7 +781,7 @@ class ObjectOp(object):
|
||||
if FeatureTool & self.opFeatures(obj):
|
||||
tc = obj.ToolController
|
||||
if tc is None or tc.ToolNumber == 0:
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
translate(
|
||||
"Path",
|
||||
"No Tool Controller is selected. We need a tool to build a Path.",
|
||||
@@ -796,7 +795,7 @@ class ObjectOp(object):
|
||||
self.horizRapid = tc.HorizRapid.Value
|
||||
tool = tc.Proxy.getTool(tc)
|
||||
if not tool or float(tool.Diameter) == 0:
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
translate(
|
||||
"Path",
|
||||
"No Tool found or diameter is zero. We need a tool to build a Path.",
|
||||
@@ -836,7 +835,7 @@ class ObjectOp(object):
|
||||
tc = obj.ToolController
|
||||
|
||||
if tc is None or tc.ToolNumber == 0:
|
||||
PathLog.error(translate("Path", "No Tool Controller selected."))
|
||||
Path.Log.error(translate("Path", "No Tool Controller selected."))
|
||||
return translate("Path", "Tool Error")
|
||||
|
||||
hFeedrate = tc.HorizFeed.Value
|
||||
@@ -847,7 +846,7 @@ class ObjectOp(object):
|
||||
if (
|
||||
hFeedrate == 0 or vFeedrate == 0
|
||||
) and not PathPreferences.suppressAllSpeedsWarning():
|
||||
PathLog.warning(
|
||||
Path.Log.warning(
|
||||
translate(
|
||||
"Path",
|
||||
"Tool Controller feedrates required to calculate the cycle time.",
|
||||
@@ -858,7 +857,7 @@ class ObjectOp(object):
|
||||
if (
|
||||
hRapidrate == 0 or vRapidrate == 0
|
||||
) and not PathPreferences.suppressRapidSpeedsWarning():
|
||||
PathLog.warning(
|
||||
Path.Log.warning(
|
||||
translate(
|
||||
"Path",
|
||||
"Add Tool Controller Rapid Speeds on the SetupSheet for more accurate cycle times.",
|
||||
@@ -877,7 +876,7 @@ class ObjectOp(object):
|
||||
return cycleTime
|
||||
|
||||
def addBase(self, obj, base, sub):
|
||||
PathLog.track(obj, base, sub)
|
||||
Path.Log.track(obj, base, sub)
|
||||
base = PathUtil.getPublicObject(base)
|
||||
|
||||
if self._setBaseAndStock(obj):
|
||||
@@ -892,7 +891,7 @@ class ObjectOp(object):
|
||||
|
||||
for p, el in baselist:
|
||||
if p == base and sub in el:
|
||||
PathLog.notice(
|
||||
Path.Log.notice(
|
||||
(
|
||||
translate("Path", "Base object %s.%s already in the list")
|
||||
+ "\n"
|
||||
@@ -905,7 +904,7 @@ class ObjectOp(object):
|
||||
baselist.append((base, sub))
|
||||
obj.Base = baselist
|
||||
else:
|
||||
PathLog.notice(
|
||||
Path.Log.notice(
|
||||
(
|
||||
translate("Path", "Base object %s.%s rejected by operation")
|
||||
+ "\n"
|
||||
|
||||
@@ -22,12 +22,12 @@
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import Path
|
||||
import PathGui as PGui # ensure Path/Gui/Resources are loaded
|
||||
import PathScripts.PathGeom as PathGeom
|
||||
import PathScripts.PathGetPoint as PathGetPoint
|
||||
import PathScripts.PathGui as PathGui
|
||||
import PathScripts.PathJob as PathJob
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathOp as PathOp
|
||||
import PathScripts.PathPreferences as PathPreferences
|
||||
import PathScripts.PathSelection as PathSelection
|
||||
@@ -47,10 +47,10 @@ __doc__ = "Base classes and framework for Path operation's UI"
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
class ViewProvider(object):
|
||||
@@ -62,7 +62,7 @@ class ViewProvider(object):
|
||||
"""
|
||||
|
||||
def __init__(self, vobj, resources):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.deleteOnReject = True
|
||||
self.OpIcon = ":/icons/%s.svg" % resources.pixmap
|
||||
self.OpName = resources.name
|
||||
@@ -75,7 +75,7 @@ class ViewProvider(object):
|
||||
self.panel = None
|
||||
|
||||
def attach(self, vobj):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.vobj = vobj
|
||||
self.Object = vobj.Object
|
||||
self.panel = None
|
||||
@@ -88,17 +88,17 @@ class ViewProvider(object):
|
||||
edit session, if the user does not press OK, it is assumed they've
|
||||
changed their mind about creating the operation.
|
||||
"""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
return hasattr(self, "deleteOnReject") and self.deleteOnReject
|
||||
|
||||
def setDeleteObjectsOnReject(self, state=False):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.deleteOnReject = state
|
||||
return self.deleteOnReject
|
||||
|
||||
def setEdit(self, vobj=None, mode=0):
|
||||
"""setEdit(vobj, mode=0) ... initiate editing of receivers model."""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
if 0 == mode:
|
||||
if vobj is None:
|
||||
vobj = self.vobj
|
||||
@@ -124,7 +124,7 @@ class ViewProvider(object):
|
||||
if job:
|
||||
job.ViewObject.Proxy.setupEditVisibility(job)
|
||||
else:
|
||||
PathLog.info("did not find no job")
|
||||
Path.Log.info("did not find no job")
|
||||
|
||||
def clearTaskPanel(self):
|
||||
"""clearTaskPanel() ... internal callback function when editing has finished."""
|
||||
@@ -140,7 +140,7 @@ class ViewProvider(object):
|
||||
def __getstate__(self):
|
||||
"""__getstate__() ... callback before receiver is saved to a file.
|
||||
Returns a dictionary with the receiver's resources as strings."""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
state = {}
|
||||
state["OpName"] = self.OpName
|
||||
state["OpIcon"] = self.OpIcon
|
||||
@@ -176,7 +176,7 @@ class ViewProvider(object):
|
||||
def updateData(self, obj, prop):
|
||||
"""updateData(obj, prop) ... callback whenever a property of the receiver's model is assigned.
|
||||
The callback is forwarded to the task panel - in case an editing session is ongoing."""
|
||||
# PathLog.track(obj.Label, prop) # Creates a lot of noise
|
||||
# Path.Log.track(obj.Label, prop) # Creates a lot of noise
|
||||
if self.panel:
|
||||
self.panel.updateData(obj, prop)
|
||||
|
||||
@@ -185,7 +185,7 @@ class ViewProvider(object):
|
||||
return True
|
||||
|
||||
def setupContextMenu(self, vobj, menu):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
for action in menu.actions():
|
||||
menu.removeAction(action)
|
||||
action = QtGui.QAction(translate("PathOp", "Edit"), menu)
|
||||
@@ -548,7 +548,7 @@ class TaskPanelBaseGeometryPage(TaskPanelPage):
|
||||
"Please select %s from a single solid" % self.featureName(),
|
||||
)
|
||||
FreeCAD.Console.PrintError(msg + "\n")
|
||||
PathLog.debug(msg)
|
||||
Path.Log.debug(msg)
|
||||
return False
|
||||
sel = selection[0]
|
||||
if sel.HasSubObjects:
|
||||
@@ -557,26 +557,26 @@ class TaskPanelBaseGeometryPage(TaskPanelPage):
|
||||
and selection[0].SubObjects[0].ShapeType == "Vertex"
|
||||
):
|
||||
if not ignoreErrors:
|
||||
PathLog.error(translate("PathOp", "Vertexes are not supported"))
|
||||
Path.Log.error(translate("PathOp", "Vertexes are not supported"))
|
||||
return False
|
||||
if (
|
||||
not self.supportsEdges()
|
||||
and selection[0].SubObjects[0].ShapeType == "Edge"
|
||||
):
|
||||
if not ignoreErrors:
|
||||
PathLog.error(translate("PathOp", "Edges are not supported"))
|
||||
Path.Log.error(translate("PathOp", "Edges are not supported"))
|
||||
return False
|
||||
if (
|
||||
not self.supportsFaces()
|
||||
and selection[0].SubObjects[0].ShapeType == "Face"
|
||||
):
|
||||
if not ignoreErrors:
|
||||
PathLog.error(translate("PathOp", "Faces are not supported"))
|
||||
Path.Log.error(translate("PathOp", "Faces are not supported"))
|
||||
return False
|
||||
else:
|
||||
if not self.supportsPanels() or "Panel" not in sel.Object.Name:
|
||||
if not ignoreErrors:
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
translate(
|
||||
"PathOp",
|
||||
"Please select %s of a solid" % self.featureName(),
|
||||
@@ -586,7 +586,7 @@ class TaskPanelBaseGeometryPage(TaskPanelPage):
|
||||
return True
|
||||
|
||||
def addBaseGeometry(self, selection):
|
||||
PathLog.track(selection)
|
||||
Path.Log.track(selection)
|
||||
if self.selectionSupportedAsBaseGeometry(selection, False):
|
||||
sel = selection[0]
|
||||
for sub in sel.SubElementNames:
|
||||
@@ -595,7 +595,7 @@ class TaskPanelBaseGeometryPage(TaskPanelPage):
|
||||
return False
|
||||
|
||||
def addBase(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
if self.addBaseGeometry(FreeCADGui.Selection.getSelectionEx()):
|
||||
# self.obj.Proxy.execute(self.obj)
|
||||
self.setFields(self.obj)
|
||||
@@ -603,7 +603,7 @@ class TaskPanelBaseGeometryPage(TaskPanelPage):
|
||||
self.updatePanelVisibility("Operation", self.obj)
|
||||
|
||||
def deleteBase(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
selected = self.form.baseList.selectedItems()
|
||||
for item in selected:
|
||||
self.form.baseList.takeItem(self.form.baseList.row(item))
|
||||
@@ -621,7 +621,7 @@ class TaskPanelBaseGeometryPage(TaskPanelPage):
|
||||
if sub:
|
||||
base = (obj, str(sub))
|
||||
newlist.append(base)
|
||||
PathLog.debug("Setting new base: %s -> %s" % (self.obj.Base, newlist))
|
||||
Path.Log.debug("Setting new base: %s -> %s" % (self.obj.Base, newlist))
|
||||
self.obj.Base = newlist
|
||||
|
||||
# self.obj.Proxy.execute(self.obj)
|
||||
@@ -677,7 +677,7 @@ class TaskPanelBaseGeometryPage(TaskPanelPage):
|
||||
qList = self.form.baseList
|
||||
row = (qList.count() + qList.frameWidth()) * 15
|
||||
# qList.setMinimumHeight(row)
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"baseList({}, {}) {} * {}".format(
|
||||
qList.size(), row, qList.count(), qList.sizeHintForRow(0)
|
||||
)
|
||||
@@ -748,7 +748,7 @@ class TaskPanelBaseLocationPage(TaskPanelPage):
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
def updateLocations(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
locations = []
|
||||
for i in range(self.formLoc.baseList.rowCount()):
|
||||
x = self.formLoc.baseList.item(i, 0).data(self.DataLocation)
|
||||
@@ -985,7 +985,7 @@ class TaskPanelDepthsPage(TaskPanelPage):
|
||||
def depthSet(self, obj, spinbox, prop):
|
||||
z = self.selectionZLevel(FreeCADGui.Selection.getSelectionEx())
|
||||
if z is not None:
|
||||
PathLog.debug("depthSet(%s, %s, %.2f)" % (obj.Label, prop, z))
|
||||
Path.Log.debug("depthSet(%s, %s, %.2f)" % (obj.Label, prop, z))
|
||||
if spinbox.expression():
|
||||
obj.setExpression(prop, None)
|
||||
self.setDirty()
|
||||
@@ -993,7 +993,7 @@ class TaskPanelDepthsPage(TaskPanelPage):
|
||||
if spinbox.updateProperty():
|
||||
self.setDirty()
|
||||
else:
|
||||
PathLog.info("depthSet(-)")
|
||||
Path.Log.info("depthSet(-)")
|
||||
|
||||
def selectionZLevel(self, sel):
|
||||
if len(sel) == 1 and len(sel[0].SubObjects) == 1:
|
||||
@@ -1071,7 +1071,7 @@ class TaskPanel(object):
|
||||
"""
|
||||
|
||||
def __init__(self, obj, deleteOnReject, opPage, selectionFactory):
|
||||
PathLog.track(obj.Label, deleteOnReject, opPage, selectionFactory)
|
||||
Path.Log.track(obj.Label, deleteOnReject, opPage, selectionFactory)
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("PathOp", "AreaOp Operation"))
|
||||
self.obj = obj
|
||||
self.deleteOnReject = deleteOnReject
|
||||
@@ -1209,7 +1209,7 @@ class TaskPanel(object):
|
||||
PathUtil.clearExpressionEngine(self.obj)
|
||||
FreeCAD.ActiveDocument.removeObject(self.obj.Name)
|
||||
except Exception as ee:
|
||||
PathLog.debug("{}\n".format(ee))
|
||||
Path.Log.debug("{}\n".format(ee))
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
self.cleanup(resetEdit)
|
||||
return True
|
||||
@@ -1250,20 +1250,20 @@ class TaskPanel(object):
|
||||
|
||||
def panelGetFields(self):
|
||||
"""panelGetFields() ... invoked to trigger a complete transfer of UI data to the model."""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
for page in self.featurePages:
|
||||
page.pageGetFields()
|
||||
|
||||
def panelSetFields(self):
|
||||
"""panelSetFields() ... invoked to trigger a complete transfer of the model's properties to the UI."""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.obj.Proxy.sanitizeBase(self.obj)
|
||||
for page in self.featurePages:
|
||||
page.pageSetFields()
|
||||
|
||||
def panelCleanup(self):
|
||||
"""panelCleanup() ... invoked before the receiver is destroyed."""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
for page in self.featurePages:
|
||||
page.pageCleanup()
|
||||
|
||||
@@ -1282,7 +1282,7 @@ class TaskPanel(object):
|
||||
|
||||
def setupUi(self):
|
||||
"""setupUi() ... internal function to initialise all pages."""
|
||||
PathLog.track(self.deleteOnReject)
|
||||
Path.Log.track(self.deleteOnReject)
|
||||
|
||||
if (
|
||||
self.deleteOnReject
|
||||
@@ -1311,7 +1311,7 @@ class TaskPanel(object):
|
||||
|
||||
def updateData(self, obj, prop):
|
||||
"""updateDate(obj, prop) ... callback invoked whenever a model's property is assigned a value."""
|
||||
# PathLog.track(obj.Label, prop) # creates a lot of noise
|
||||
# Path.Log.track(obj.Label, prop) # creates a lot of noise
|
||||
for page in self.featurePages:
|
||||
page.pageUpdateData(obj, prop)
|
||||
|
||||
@@ -1391,7 +1391,7 @@ def Create(res):
|
||||
diag.setWindowModality(QtCore.Qt.ApplicationModal)
|
||||
diag.exec_()
|
||||
except PathOp.PathNoTCException:
|
||||
PathLog.warning(translate("PathOp", "No tool controller, aborting op creation"))
|
||||
Path.Log.warning(translate("PathOp", "No tool controller, aborting op creation"))
|
||||
|
||||
FreeCAD.ActiveDocument.abortTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
import FreeCAD
|
||||
import Path
|
||||
import PathScripts.PathGeom as PathGeom
|
||||
import PathScripts.PathLog as PathLog
|
||||
import math
|
||||
|
||||
# lazily loaded modules
|
||||
@@ -41,10 +41,10 @@ __doc__ = "Collection of functions used by various Path operations. The function
|
||||
PrintWireDebug = False
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
@@ -109,7 +109,7 @@ def debugWire(label, w):
|
||||
def _orientEdges(inEdges):
|
||||
"""_orientEdges(inEdges) ... internal worker function to orient edges so the last vertex of one edge connects to the first vertex of the next edge.
|
||||
Assumes the edges are in an order so they can be connected."""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
# orient all edges of the wire so each edge's last value connects to the next edge's first value
|
||||
e0 = inEdges[0]
|
||||
# well, even the very first edge could be misoriented, so let's try and connect it to the second
|
||||
@@ -153,7 +153,7 @@ def _isWireClockwise(w):
|
||||
v0 = e.valueAt(e.FirstParameter)
|
||||
v1 = e.valueAt(e.LastParameter)
|
||||
area = area + (v0.x * v1.y - v1.x * v0.y)
|
||||
PathLog.track(area)
|
||||
Path.Log.track(area)
|
||||
return area < 0
|
||||
|
||||
|
||||
@@ -167,13 +167,13 @@ def orientWire(w, forward=True):
|
||||
If forward = True (the default) the wire is oriented clockwise, looking down the negative Z axis.
|
||||
If forward = False the wire is oriented counter clockwise.
|
||||
If forward = None the orientation is determined by the order in which the edges appear in the wire."""
|
||||
PathLog.debug("orienting forward: {}: {} edges".format(forward, len(w.Edges)))
|
||||
Path.Log.debug("orienting forward: {}: {} edges".format(forward, len(w.Edges)))
|
||||
wire = Part.Wire(_orientEdges(w.Edges))
|
||||
if forward is not None:
|
||||
if forward != _isWireClockwise(wire):
|
||||
PathLog.track("orientWire - needs flipping")
|
||||
Path.Log.track("orientWire - needs flipping")
|
||||
return PathGeom.flipWire(wire)
|
||||
PathLog.track("orientWire - ok")
|
||||
Path.Log.track("orientWire - ok")
|
||||
return wire
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ def offsetWire(wire, base, offset, forward, Side=None):
|
||||
The function tries to avoid most of the pitfalls of Part.makeOffset2D which is possible because all offsetting
|
||||
happens in the XY plane.
|
||||
"""
|
||||
PathLog.track("offsetWire")
|
||||
Path.Log.track("offsetWire")
|
||||
|
||||
if 1 == len(wire.Edges):
|
||||
edge = wire.Edges[0]
|
||||
@@ -297,11 +297,11 @@ def offsetWire(wire, base, offset, forward, Side=None):
|
||||
|
||||
if wire.isClosed():
|
||||
if not base.isInside(owire.Edges[0].Vertexes[0].Point, offset / 2, True):
|
||||
PathLog.track("closed - outside")
|
||||
Path.Log.track("closed - outside")
|
||||
if Side:
|
||||
Side[0] = "Outside"
|
||||
return orientWire(owire, forward)
|
||||
PathLog.track("closed - inside")
|
||||
Path.Log.track("closed - inside")
|
||||
if Side:
|
||||
Side[0] = "Inside"
|
||||
try:
|
||||
@@ -412,18 +412,18 @@ def offsetWire(wire, base, offset, forward, Side=None):
|
||||
for e0 in rightSideEdges:
|
||||
if PathGeom.edgesMatch(e, e0):
|
||||
edges = rightSideEdges
|
||||
PathLog.debug("#use right side edges")
|
||||
Path.Log.debug("#use right side edges")
|
||||
if not forward:
|
||||
PathLog.debug("#reverse")
|
||||
Path.Log.debug("#reverse")
|
||||
edges.reverse()
|
||||
return orientWire(Part.Wire(edges), None)
|
||||
|
||||
# at this point we have the correct edges and they are in the order for forward
|
||||
# traversal (climb milling). If that's not what we want just reverse the order,
|
||||
# orientWire takes care of orienting the edges appropriately.
|
||||
PathLog.debug("#use left side edges")
|
||||
Path.Log.debug("#use left side edges")
|
||||
if not forward:
|
||||
PathLog.debug("#reverse")
|
||||
Path.Log.debug("#reverse")
|
||||
edges.reverse()
|
||||
|
||||
return orientWire(Part.Wire(edges), None)
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
import FreeCAD
|
||||
import Part
|
||||
import PathScripts.PathLog as PathLog
|
||||
import Path
|
||||
import PathScripts.PathOp as PathOp
|
||||
import PathScripts.PathPocketBase as PathPocketBase
|
||||
import PathScripts.PathUtils as PathUtils
|
||||
@@ -40,10 +40,10 @@ __doc__ = "Class and implementation of the 3D Pocket operation."
|
||||
__created__ = "2014"
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
@@ -127,11 +127,11 @@ class ObjectPocket(PathPocketBase.ObjectPocket):
|
||||
data = list()
|
||||
idx = 0 if dataType == "translated" else 1
|
||||
|
||||
PathLog.debug(enums)
|
||||
Path.Log.debug(enums)
|
||||
|
||||
for k, v in enumerate(enums):
|
||||
data.append((v, [tup[idx] for tup in enums[v]]))
|
||||
PathLog.debug(data)
|
||||
Path.Log.debug(data)
|
||||
|
||||
return data
|
||||
|
||||
@@ -154,15 +154,15 @@ class ObjectPocket(PathPocketBase.ObjectPocket):
|
||||
|
||||
def areaOpShapes(self, obj):
|
||||
"""areaOpShapes(obj) ... return shapes representing the solids to be removed."""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
|
||||
subObjTups = []
|
||||
removalshapes = []
|
||||
|
||||
if obj.Base:
|
||||
PathLog.debug("base items exist. Processing... ")
|
||||
Path.Log.debug("base items exist. Processing... ")
|
||||
for base in obj.Base:
|
||||
PathLog.debug("obj.Base item: {}".format(base))
|
||||
Path.Log.debug("obj.Base item: {}".format(base))
|
||||
|
||||
# Check if all subs are faces
|
||||
allSubsFaceType = True
|
||||
@@ -185,7 +185,7 @@ class ObjectPocket(PathPocketBase.ObjectPocket):
|
||||
):
|
||||
(fzmin, fzmax) = self.getMinMaxOfFaces(Faces)
|
||||
if obj.FinalDepth.Value < fzmin:
|
||||
PathLog.warning(
|
||||
Path.Log.warning(
|
||||
translate(
|
||||
"PathPocket",
|
||||
"Final depth set below ZMin of face(s) selected.",
|
||||
@@ -234,7 +234,7 @@ class ObjectPocket(PathPocketBase.ObjectPocket):
|
||||
removalshapes.append((obj.removalshape, False, "3DPocket"))
|
||||
|
||||
else: # process the job base object as a whole
|
||||
PathLog.debug("processing the whole job base object")
|
||||
Path.Log.debug("processing the whole job base object")
|
||||
for base in self.model:
|
||||
if obj.ProcessStockArea is True:
|
||||
job = PathUtils.findParentJob(obj)
|
||||
@@ -326,8 +326,8 @@ class ObjectPocket(PathPocketBase.ObjectPocket):
|
||||
try:
|
||||
highFaceShape = Part.Face(Part.Wire(Part.__sortEdges__(allEdges)))
|
||||
except Exception as ee:
|
||||
PathLog.warning(ee)
|
||||
PathLog.error(
|
||||
Path.Log.warning(ee)
|
||||
Path.Log.error(
|
||||
translate(
|
||||
"Path",
|
||||
"A planar adaptive start is unavailable. The non-planar will be attempted.",
|
||||
@@ -343,8 +343,8 @@ class ObjectPocket(PathPocketBase.ObjectPocket):
|
||||
Part.__sortEdges__(allEdges)
|
||||
) # NON-planar face method
|
||||
except Exception as eee:
|
||||
PathLog.warning(eee)
|
||||
PathLog.error(
|
||||
Path.Log.warning(eee)
|
||||
Path.Log.error(
|
||||
translate(
|
||||
"Path", "The non-planar adaptive start is also unavailable."
|
||||
)
|
||||
@@ -368,13 +368,13 @@ class ObjectPocket(PathPocketBase.ObjectPocket):
|
||||
highFace.Shape.BoundBox.ZMax > mx
|
||||
or highFace.Shape.BoundBox.ZMin < mn
|
||||
):
|
||||
PathLog.warning(
|
||||
Path.Log.warning(
|
||||
"ZMaxDiff: {}; ZMinDiff: {}".format(
|
||||
highFace.Shape.BoundBox.ZMax - mx,
|
||||
highFace.Shape.BoundBox.ZMin - mn,
|
||||
)
|
||||
)
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
translate(
|
||||
"Path", "The non-planar adaptive start is also unavailable."
|
||||
)
|
||||
@@ -397,8 +397,8 @@ class ObjectPocket(PathPocketBase.ObjectPocket):
|
||||
lowFaceShape = Part.Face(Part.Wire(Part.__sortEdges__(allEdges)))
|
||||
# lowFaceShape = Part.makeFilledFace(Part.__sortEdges__(allEdges)) # NON-planar face method
|
||||
except Exception as ee:
|
||||
PathLog.error(ee)
|
||||
PathLog.error("An adaptive finish is unavailable.")
|
||||
Path.Log.error(ee)
|
||||
Path.Log.error("An adaptive finish is unavailable.")
|
||||
isLowFacePlanar = False
|
||||
else:
|
||||
FreeCAD.ActiveDocument.addObject("Part::Feature", "bottomEdgeFace")
|
||||
@@ -633,7 +633,7 @@ class ObjectPocket(PathPocketBase.ObjectPocket):
|
||||
for ei2 in range(0, len(face2.Edges)):
|
||||
edg2 = face2.Edges[ei2]
|
||||
if edg1.isSame(edg2) is True:
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"{}.Edges[{}] connects at {}.Edges[{}]".format(
|
||||
sub1, ei1, sub2, ei2
|
||||
)
|
||||
@@ -704,7 +704,7 @@ class ObjectPocket(PathPocketBase.ObjectPocket):
|
||||
Compare vertexes of two edges to identify a common vertex.
|
||||
Returns the vertex index of edge1 to which edge2 is connected"""
|
||||
if show is True:
|
||||
PathLog.info("New findCommonVertex()... ")
|
||||
Path.Log.info("New findCommonVertex()... ")
|
||||
|
||||
oIdx = 0
|
||||
listOne = edge1.Vertexes
|
||||
@@ -713,15 +713,15 @@ class ObjectPocket(PathPocketBase.ObjectPocket):
|
||||
# Find common vertexes
|
||||
for o in listOne:
|
||||
if show is True:
|
||||
PathLog.info(" one ({}, {}, {})".format(o.X, o.Y, o.Z))
|
||||
Path.Log.info(" one ({}, {}, {})".format(o.X, o.Y, o.Z))
|
||||
for t in listTwo:
|
||||
if show is True:
|
||||
PathLog.error("two ({}, {}, {})".format(t.X, t.Y, t.Z))
|
||||
Path.Log.error("two ({}, {}, {})".format(t.X, t.Y, t.Z))
|
||||
if o.X == t.X:
|
||||
if o.Y == t.Y:
|
||||
if o.Z == t.Z:
|
||||
if show is True:
|
||||
PathLog.info("found")
|
||||
Path.Log.info("found")
|
||||
return oIdx
|
||||
oIdx += 1
|
||||
return -1
|
||||
@@ -773,7 +773,7 @@ class ObjectPocket(PathPocketBase.ObjectPocket):
|
||||
|
||||
while len(holds) > 0:
|
||||
if loops > 500:
|
||||
PathLog.error("BREAK --- LOOPS LIMIT of 500 ---")
|
||||
Path.Log.error("BREAK --- LOOPS LIMIT of 500 ---")
|
||||
break
|
||||
save = False
|
||||
|
||||
|
||||
@@ -21,11 +21,12 @@
|
||||
# ***************************************************************************
|
||||
|
||||
import FreeCAD
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
import Path
|
||||
import PathScripts.PathAreaOp as PathAreaOp
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathOp as PathOp
|
||||
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
|
||||
|
||||
__title__ = "Base Path Pocket Operation"
|
||||
__author__ = "sliptonic (Brad Collette)"
|
||||
@@ -33,10 +34,10 @@ __url__ = "https://www.freecadweb.org"
|
||||
__doc__ = "Base class and implementation for Path pocket operations."
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
@@ -79,11 +80,11 @@ class ObjectPocket(PathAreaOp.ObjectOp):
|
||||
data = list()
|
||||
idx = 0 if dataType == "translated" else 1
|
||||
|
||||
PathLog.debug(enums)
|
||||
Path.Log.debug(enums)
|
||||
|
||||
for k, v in enumerate(enums):
|
||||
data.append((v, [tup[idx] for tup in enums[v]]))
|
||||
PathLog.debug(data)
|
||||
Path.Log.debug(data)
|
||||
|
||||
return data
|
||||
|
||||
@@ -114,7 +115,7 @@ class ObjectPocket(PathAreaOp.ObjectOp):
|
||||
def initAreaOp(self, obj):
|
||||
"""initAreaOp(obj) ... create pocket specific properties.
|
||||
Do not overwrite, implement initPocketOp(obj) instead."""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
|
||||
# Pocket Properties
|
||||
obj.addProperty(
|
||||
@@ -191,7 +192,7 @@ class ObjectPocket(PathAreaOp.ObjectOp):
|
||||
self.initPocketOp(obj)
|
||||
|
||||
def areaOpRetractTool(self, obj):
|
||||
PathLog.debug("retracting tool: %d" % (not obj.KeepToolDown))
|
||||
Path.Log.debug("retracting tool: %d" % (not obj.KeepToolDown))
|
||||
return not obj.KeepToolDown
|
||||
|
||||
def areaOpUseProjection(self, obj):
|
||||
@@ -200,7 +201,7 @@ class ObjectPocket(PathAreaOp.ObjectOp):
|
||||
|
||||
def areaOpAreaParams(self, obj, isHole):
|
||||
"""areaOpAreaParams(obj, isHole) ... return dictionary with pocket's area parameters"""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
params = {}
|
||||
params["Fill"] = 0
|
||||
params["Coplanar"] = 0
|
||||
@@ -245,7 +246,7 @@ class ObjectPocket(PathAreaOp.ObjectOp):
|
||||
),
|
||||
)
|
||||
obj.PocketLastStepOver = 0
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
|
||||
def areaOpPathParams(self, obj, isHole):
|
||||
"""areaOpAreaParams(obj, isHole) ... return dictionary with pocket's path parameters"""
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import Path
|
||||
import PathGui as PGui # ensure Path/Gui/Resources are loaded
|
||||
import PathScripts.PathGui as PathGui
|
||||
import PathScripts.PathOpGui as PathOpGui
|
||||
import PathScripts.PathPocket as PathPocket
|
||||
import PathScripts.PathLog as PathLog
|
||||
|
||||
__title__ = "Path Pocket Base Operation UI"
|
||||
__author__ = "sliptonic (Brad Collette)"
|
||||
@@ -34,10 +34,10 @@ __url__ = "https://www.freecadweb.org"
|
||||
__doc__ = "Base page controller and command implementation for path pocket operations."
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
|
||||
@@ -21,18 +21,18 @@
|
||||
# ***************************************************************************
|
||||
|
||||
import FreeCAD
|
||||
import Path
|
||||
import PathScripts.PathOpGui as PathOpGui
|
||||
import PathScripts.PathPocket as PathPocket
|
||||
import PathScripts.PathPocketBaseGui as PathPocketBaseGui
|
||||
import PathScripts.PathLog as PathLog
|
||||
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
__title__ = "Path Pocket Operation UI"
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
import FreeCAD
|
||||
import Path
|
||||
import PathScripts.PathGeom as PathGeom
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathOp as PathOp
|
||||
import PathScripts.PathPocketBase as PathPocketBase
|
||||
|
||||
@@ -47,10 +47,10 @@ __doc__ = "Class and implementation of shape based Pocket operation."
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
class ObjectPocket(PathPocketBase.ObjectPocket):
|
||||
@@ -89,10 +89,10 @@ class ObjectPocket(PathPocketBase.ObjectPocket):
|
||||
|
||||
def areaOpShapes(self, obj):
|
||||
"""areaOpShapes(obj) ... return shapes representing the solids to be removed."""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.removalshapes = []
|
||||
|
||||
# self.isDebug = True if PathLog.getLevel(PathLog.thisModule()) == 4 else False
|
||||
# self.isDebug = True if Path.Log.getLevel(Path.Log.thisModule()) == 4 else False
|
||||
self.removalshapes = []
|
||||
avoidFeatures = list()
|
||||
|
||||
@@ -103,14 +103,14 @@ class ObjectPocket(PathPocketBase.ObjectPocket):
|
||||
avoidFeatures.append(e.feature)
|
||||
|
||||
if obj.Base:
|
||||
PathLog.debug("base items exist. Processing...")
|
||||
Path.Log.debug("base items exist. Processing...")
|
||||
self.horiz = []
|
||||
self.vert = []
|
||||
for (base, subList) in obj.Base:
|
||||
for sub in subList:
|
||||
if "Face" in sub:
|
||||
if sub not in avoidFeatures and not self.clasifySub(base, sub):
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
"Pocket does not support shape {}.{}".format(
|
||||
base.Label, sub
|
||||
)
|
||||
@@ -133,7 +133,7 @@ class ObjectPocket(PathPocketBase.ObjectPocket):
|
||||
face = Part.Face(w)
|
||||
# face.tessellate(0.1)
|
||||
if PathGeom.isRoughly(face.Area, 0):
|
||||
PathLog.error("Vertical faces do not form a loop - ignoring")
|
||||
Path.Log.error("Vertical faces do not form a loop - ignoring")
|
||||
else:
|
||||
self.horiz.append(face)
|
||||
|
||||
@@ -174,7 +174,7 @@ class ObjectPocket(PathPocketBase.ObjectPocket):
|
||||
]
|
||||
|
||||
else: # process the job base object as a whole
|
||||
PathLog.debug("processing the whole job base object")
|
||||
Path.Log.debug("processing the whole job base object")
|
||||
self.outlines = [
|
||||
Part.Face(
|
||||
TechDraw.findShapeOutline(base.Shape, 1, FreeCAD.Vector(0, 0, 1))
|
||||
@@ -218,15 +218,15 @@ class ObjectPocket(PathPocketBase.ObjectPocket):
|
||||
face = bs.Shape.getElement(sub)
|
||||
|
||||
if type(face.Surface) == Part.Plane:
|
||||
PathLog.debug("type() == Part.Plane")
|
||||
Path.Log.debug("type() == Part.Plane")
|
||||
if PathGeom.isVertical(face.Surface.Axis):
|
||||
PathLog.debug(" -isVertical()")
|
||||
Path.Log.debug(" -isVertical()")
|
||||
# it's a flat horizontal face
|
||||
self.horiz.append(face)
|
||||
return True
|
||||
|
||||
elif PathGeom.isHorizontal(face.Surface.Axis):
|
||||
PathLog.debug(" -isHorizontal()")
|
||||
Path.Log.debug(" -isHorizontal()")
|
||||
self.vert.append(face)
|
||||
return True
|
||||
|
||||
@@ -236,10 +236,10 @@ class ObjectPocket(PathPocketBase.ObjectPocket):
|
||||
elif type(face.Surface) == Part.Cylinder and PathGeom.isVertical(
|
||||
face.Surface.Axis
|
||||
):
|
||||
PathLog.debug("type() == Part.Cylinder")
|
||||
Path.Log.debug("type() == Part.Cylinder")
|
||||
# vertical cylinder wall
|
||||
if any(e.isClosed() for e in face.Edges):
|
||||
PathLog.debug(" -e.isClosed()")
|
||||
Path.Log.debug(" -e.isClosed()")
|
||||
# complete cylinder
|
||||
circle = Part.makeCircle(face.Surface.Radius, face.Surface.Center)
|
||||
disk = Part.Face(Part.Wire(circle))
|
||||
@@ -250,23 +250,23 @@ class ObjectPocket(PathPocketBase.ObjectPocket):
|
||||
return True
|
||||
|
||||
else:
|
||||
PathLog.debug(" -none isClosed()")
|
||||
Path.Log.debug(" -none isClosed()")
|
||||
# partial cylinder wall
|
||||
self.vert.append(face)
|
||||
return True
|
||||
|
||||
elif type(face.Surface) == Part.SurfaceOfExtrusion:
|
||||
# extrusion wall
|
||||
PathLog.debug("type() == Part.SurfaceOfExtrusion")
|
||||
Path.Log.debug("type() == Part.SurfaceOfExtrusion")
|
||||
# Save face to self.horiz for processing or display error
|
||||
if self.isVerticalExtrusionFace(face):
|
||||
self.vert.append(face)
|
||||
return True
|
||||
else:
|
||||
PathLog.error("Failed to identify vertical face from {}".format(sub))
|
||||
Path.Log.error("Failed to identify vertical face from {}".format(sub))
|
||||
|
||||
else:
|
||||
PathLog.debug(" -type(face.Surface): {}".format(type(face.Surface)))
|
||||
Path.Log.debug(" -type(face.Surface): {}".format(type(face.Surface)))
|
||||
return False
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
# ***************************************************************************
|
||||
|
||||
import FreeCAD
|
||||
import PathScripts.PathLog as PathLog
|
||||
import Path
|
||||
import PathScripts.PathOpGui as PathOpGui
|
||||
import PathScripts.PathPocketShape as PathPocketShape
|
||||
import PathScripts.PathPocketBaseGui as PathPocketBaseGui
|
||||
@@ -39,10 +39,10 @@ __url__ = "https://www.freecadweb.org"
|
||||
__doc__ = "Pocket Shape operation page controller and command implementation."
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ import FreeCAD
|
||||
import FreeCADGui
|
||||
import Path
|
||||
import PathScripts.PathJob as PathJob
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathPreferences as PathPreferences
|
||||
import PathScripts.PathUtil as PathUtil
|
||||
import PathScripts.PathUtils as PathUtils
|
||||
@@ -43,10 +42,10 @@ from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
LOG_MODULE = PathLog.thisModule()
|
||||
|
||||
if True:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
@@ -70,7 +69,7 @@ def processFileNameSubstitutions(
|
||||
"""Process any substitutions in the outputpath or filename."""
|
||||
|
||||
# The following section allows substitution within the path part
|
||||
PathLog.track(f"path before substitution: {outputpath}")
|
||||
Path.Log.track(f"path before substitution: {outputpath}")
|
||||
|
||||
if "%D" in outputpath: # Directory of active document
|
||||
D = FreeCAD.ActiveDocument.FileName
|
||||
@@ -100,10 +99,10 @@ def processFileNameSubstitutions(
|
||||
j = job.Label
|
||||
outputpath = outputpath.replace("%j", j)
|
||||
|
||||
PathLog.track(f"path after substitution: {outputpath}")
|
||||
Path.Log.track(f"path after substitution: {outputpath}")
|
||||
|
||||
# The following section allows substitution within the filename part
|
||||
PathLog.track(f"filename before substitution: {filename}")
|
||||
Path.Log.track(f"filename before substitution: {filename}")
|
||||
|
||||
# Use the file label
|
||||
if "%d" in filename:
|
||||
@@ -122,7 +121,7 @@ def processFileNameSubstitutions(
|
||||
|
||||
# This section handles unique names for splitting output
|
||||
if job.SplitOutput:
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
if "%T" in filename and job.OrderOutputBy == "Tool":
|
||||
filename = filename.replace("%T", subpartname)
|
||||
|
||||
@@ -142,20 +141,20 @@ def processFileNameSubstitutions(
|
||||
else:
|
||||
filename = f"{filename}-{sequencenumber}"
|
||||
|
||||
PathLog.track(f"filename after substitution: {filename}")
|
||||
Path.Log.track(f"filename after substitution: {filename}")
|
||||
|
||||
if not ext:
|
||||
ext = ".nc"
|
||||
PathLog.track(f"file extension: {ext}")
|
||||
Path.Log.track(f"file extension: {ext}")
|
||||
|
||||
fullPath = f"{outputpath}{os.path.sep}{filename}{ext}"
|
||||
|
||||
PathLog.track(f"full filepath: {fullPath}")
|
||||
Path.Log.track(f"full filepath: {fullPath}")
|
||||
return fullPath
|
||||
|
||||
|
||||
def resolveFileName(job, subpartname, sequencenumber):
|
||||
PathLog.track(subpartname, sequencenumber)
|
||||
Path.Log.track(subpartname, sequencenumber)
|
||||
|
||||
validPathSubstitutions = ["D", "d", "M", "j"]
|
||||
validFilenameSubstitutions = ["j", "d", "T", "t", "W", "O", "S"]
|
||||
@@ -198,7 +197,7 @@ def resolveFileName(job, subpartname, sequencenumber):
|
||||
ext = ".nc"
|
||||
|
||||
# By now we should have a sanitized path, filename and extension to work with
|
||||
PathLog.track(f"path: {outputpath} name: {filename} ext: {ext}")
|
||||
Path.Log.track(f"path: {outputpath} name: {filename} ext: {ext}")
|
||||
|
||||
fullPath = processFileNameSubstitutions(
|
||||
job,
|
||||
@@ -238,7 +237,7 @@ def resolveFileName(job, subpartname, sequencenumber):
|
||||
|
||||
if openDialog:
|
||||
foo = QtGui.QFileDialog.getSaveFileName(
|
||||
QtGui.QApplication.activeWindow(), "Output File", fullPath
|
||||
QtGui.QApplication.activeWindow(), "Output File", filename
|
||||
)
|
||||
if foo[0]:
|
||||
fullPath = foo[0]
|
||||
@@ -250,9 +249,8 @@ def resolveFileName(job, subpartname, sequencenumber):
|
||||
for s in validPathSubstitutions + validFilenameSubstitutions:
|
||||
fullPath = fullPath.replace(f"%{s}", "")
|
||||
|
||||
fullPath = os.path.normpath(fullPath)
|
||||
PathLog.track(fullPath)
|
||||
|
||||
fullPath = os.path.normpath(fullPath)
|
||||
Path.Log.track(fullPath)
|
||||
return fullPath
|
||||
|
||||
|
||||
@@ -266,7 +264,7 @@ def buildPostList(job):
|
||||
postlist = []
|
||||
|
||||
if orderby == "Fixture":
|
||||
PathLog.debug("Ordering by Fixture")
|
||||
Path.Log.debug("Ordering by Fixture")
|
||||
# Order by fixture means all operations and tool changes will be
|
||||
# completed in one fixture before moving to the next.
|
||||
|
||||
@@ -294,13 +292,13 @@ def buildPostList(job):
|
||||
if tc is not None and PathUtil.opProperty(obj, "Active"):
|
||||
if tc.ToolNumber != currTool:
|
||||
sublist.append(tc)
|
||||
PathLog.debug("Appending TC: {}".format(tc.Name))
|
||||
Path.Log.debug("Appending TC: {}".format(tc.Name))
|
||||
currTool = tc.ToolNumber
|
||||
sublist.append(obj)
|
||||
postlist.append((f, sublist))
|
||||
|
||||
elif orderby == "Tool":
|
||||
PathLog.debug("Ordering by Tool")
|
||||
Path.Log.debug("Ordering by Tool")
|
||||
# Order by tool means tool changes are minimized.
|
||||
# all operations with the current tool are processed in the current
|
||||
# fixture before moving to the next fixture.
|
||||
@@ -329,13 +327,13 @@ def buildPostList(job):
|
||||
curlist = [] # list of ops for tool, will repeat for each fixture
|
||||
sublist = [] # list of ops for output splitting
|
||||
|
||||
PathLog.track(job.PostProcessorOutputFile)
|
||||
Path.Log.track(job.PostProcessorOutputFile)
|
||||
for idx, obj in enumerate(job.Operations.Group):
|
||||
PathLog.track(obj.Label)
|
||||
Path.Log.track(obj.Label)
|
||||
|
||||
# check if the operation is active
|
||||
if not getattr(obj, "Active", True):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
continue
|
||||
|
||||
# Determine the proper string for the Op's TC
|
||||
@@ -346,7 +344,7 @@ def buildPostList(job):
|
||||
tcstring = f"{tc.ToolNumber}"
|
||||
else:
|
||||
tcstring = re.sub(r"[^\w\d-]", "_", tc.Label)
|
||||
PathLog.track(toolstring)
|
||||
Path.Log.track(toolstring)
|
||||
|
||||
if tc is None or tc.ToolNumber == currTool:
|
||||
curlist.append(obj)
|
||||
@@ -374,7 +372,7 @@ def buildPostList(job):
|
||||
postlist.append((toolstring, sublist))
|
||||
|
||||
elif orderby == "Operation":
|
||||
PathLog.debug("Ordering by Operation")
|
||||
Path.Log.debug("Ordering by Operation")
|
||||
# Order by operation means ops are done in each fixture in
|
||||
# sequence.
|
||||
currTool = None
|
||||
@@ -388,7 +386,7 @@ def buildPostList(job):
|
||||
continue
|
||||
|
||||
sublist = []
|
||||
PathLog.debug("obj: {}".format(obj.Name))
|
||||
Path.Log.debug("obj: {}".format(obj.Name))
|
||||
|
||||
for f in wcslist:
|
||||
fobj = _TempObject()
|
||||
@@ -415,10 +413,10 @@ def buildPostList(job):
|
||||
postlist.append((obj.Label, sublist))
|
||||
|
||||
if job.SplitOutput:
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
return postlist
|
||||
else:
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
finalpostlist = [
|
||||
("allitems", [item for slist in postlist for item in slist[1]])
|
||||
]
|
||||
@@ -493,16 +491,16 @@ class CommandPathPost:
|
||||
return False
|
||||
|
||||
def exportObjectsWith(self, objs, partname, job, sequence, extraargs=None):
|
||||
PathLog.track(extraargs)
|
||||
Path.Log.track(extraargs)
|
||||
# check if the user has a project and has set the default post and
|
||||
# output filename
|
||||
# extraargs can be passed in at this time
|
||||
PathLog.track(partname, sequence)
|
||||
PathLog.track(objs)
|
||||
Path.Log.track(partname, sequence)
|
||||
Path.Log.track(objs)
|
||||
|
||||
# partname = objs[0]
|
||||
# slist = objs[1]
|
||||
PathLog.track(objs, partname)
|
||||
Path.Log.track(objs, partname)
|
||||
|
||||
postArgs = PathPreferences.defaultPostProcessorArgs()
|
||||
if hasattr(job, "PostProcessorArgs") and job.PostProcessorArgs:
|
||||
@@ -513,7 +511,7 @@ class CommandPathPost:
|
||||
if extraargs is not None:
|
||||
postArgs += " {}".format(extraargs)
|
||||
|
||||
PathLog.track(postArgs)
|
||||
Path.Log.track(postArgs)
|
||||
|
||||
postname = self.resolvePostProcessor(job)
|
||||
# filename = "-"
|
||||
@@ -530,7 +528,7 @@ class CommandPathPost:
|
||||
return (True, "", filename)
|
||||
|
||||
def Activated(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
FreeCAD.ActiveDocument.openTransaction("Post Process the Selected path(s)")
|
||||
FreeCADGui.addModule("PathScripts.PathPost")
|
||||
|
||||
@@ -564,7 +562,7 @@ class CommandPathPost:
|
||||
if hasattr(o, "Proxy"):
|
||||
if isinstance(o.Proxy, PathJob.ObjectJob):
|
||||
targetlist.append(o.Label)
|
||||
PathLog.debug("Possible post objects: {}".format(targetlist))
|
||||
Path.Log.debug("Possible post objects: {}".format(targetlist))
|
||||
if len(targetlist) > 1:
|
||||
jobname, result = QtGui.QInputDialog.getItem(
|
||||
None, translate("Path", "Choose a Path Job"), None, targetlist
|
||||
@@ -576,7 +574,7 @@ class CommandPathPost:
|
||||
jobname = targetlist[0]
|
||||
job = FreeCAD.ActiveDocument.getObject(jobname)
|
||||
|
||||
PathLog.debug("about to postprocess job: {}".format(job.Name))
|
||||
Path.Log.debug("about to postprocess job: {}".format(job.Name))
|
||||
|
||||
postlist = buildPostList(job)
|
||||
# filename = resolveFileName(job, "allitems", 0)
|
||||
@@ -591,7 +589,7 @@ class CommandPathPost:
|
||||
|
||||
result, gcode, name = self.exportObjectsWith(sublist, partname, job, idx)
|
||||
filenames.append(name)
|
||||
PathLog.track(result, gcode, name)
|
||||
Path.Log.track(result, gcode, name)
|
||||
|
||||
if name is None:
|
||||
success = False
|
||||
@@ -612,13 +610,13 @@ class CommandPathPost:
|
||||
# gcode = self.exportObjectsWith(finalpostlist, "allitems", job, 1)
|
||||
# success = gcode is not None
|
||||
|
||||
PathLog.track(success)
|
||||
Path.Log.track(success)
|
||||
if success:
|
||||
if hasattr(job, "LastPostProcessDate"):
|
||||
job.LastPostProcessDate = str(datetime.now())
|
||||
if hasattr(job, "LastPostProcessOutput"):
|
||||
job.LastPostProcessOutput = " \n".join(filenames)
|
||||
PathLog.track(job.LastPostProcessOutput)
|
||||
Path.Log.track(job.LastPostProcessOutput)
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
else:
|
||||
FreeCAD.ActiveDocument.abortTransaction()
|
||||
|
||||
@@ -20,11 +20,11 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
import PathScripts.PathLog as PathLog
|
||||
import Path
|
||||
import PathScripts.PathPreferences as PathPreferences
|
||||
import sys
|
||||
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
class PostProcessor:
|
||||
@@ -34,7 +34,7 @@ class PostProcessor:
|
||||
|
||||
@classmethod
|
||||
def load(cls, processor):
|
||||
PathLog.track(processor)
|
||||
Path.Log.track(processor)
|
||||
syspath = sys.path
|
||||
paths = PathPreferences.searchPathsPost()
|
||||
paths.extend(sys.path)
|
||||
|
||||
@@ -21,16 +21,16 @@
|
||||
# ***************************************************************************
|
||||
|
||||
import FreeCAD
|
||||
import Path
|
||||
import glob
|
||||
import os
|
||||
import PathScripts.PathLog as PathLog
|
||||
from PySide.QtGui import QMessageBox
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
@@ -208,7 +208,7 @@ def defaultJobTemplate():
|
||||
|
||||
|
||||
def setJobDefaults(fileName, jobTemplate, geometryTolerance, curveAccuracy):
|
||||
PathLog.track(
|
||||
Path.Log.track(
|
||||
"(%s='%s', %s, %s, %s)"
|
||||
% (DefaultFilePath, fileName, jobTemplate, geometryTolerance, curveAccuracy)
|
||||
)
|
||||
@@ -320,14 +320,14 @@ def lastFileToolLibrary():
|
||||
if len(libFiles) >= 1:
|
||||
filename = libFiles[0]
|
||||
setLastFileToolLibrary(filename)
|
||||
PathLog.track(filename)
|
||||
Path.Log.track(filename)
|
||||
return filename
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def setLastFileToolLibrary(path):
|
||||
PathLog.track(path)
|
||||
Path.Log.track(path)
|
||||
if os.path.isfile(path): # keep the path and file in sync
|
||||
preferences().SetString(LastPathToolLibrary, os.path.split(path)[0])
|
||||
return preferences().SetString(LastFileToolLibrary, path)
|
||||
@@ -342,14 +342,14 @@ def setLastPathToolBit(path):
|
||||
|
||||
|
||||
def lastPathToolLibrary():
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
return preferences().GetString(LastPathToolLibrary, pathDefaultToolsPath("Library"))
|
||||
|
||||
|
||||
def setLastPathToolLibrary(path):
|
||||
PathLog.track(path)
|
||||
Path.Log.track(path)
|
||||
curLib = lastFileToolLibrary()
|
||||
PathLog.debug("curLib: {}".format(curLib))
|
||||
Path.Log.debug("curLib: {}".format(curLib))
|
||||
if curLib and os.path.split(curLib)[0] != path:
|
||||
setLastFileToolLibrary("") # a path is known but not specific file
|
||||
return preferences().SetString(LastPathToolLibrary, path)
|
||||
|
||||
@@ -21,14 +21,14 @@
|
||||
# ***************************************************************************
|
||||
|
||||
import FreeCADGui
|
||||
import Path
|
||||
import PathScripts.PathPreferences as PathPreferences
|
||||
import PathScripts.PathLog as PathLog
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
class AdvancedPreferencesPage:
|
||||
@@ -48,7 +48,7 @@ class AdvancedPreferencesPage:
|
||||
)
|
||||
|
||||
def loadSettings(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.form.WarningSuppressAllSpeeds.setChecked(
|
||||
PathPreferences.suppressAllSpeedsWarning()
|
||||
)
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
import FreeCAD
|
||||
import Path
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathPreferences as PathPreferences
|
||||
import PathScripts.PathStock as PathStock
|
||||
import json
|
||||
@@ -32,7 +31,7 @@ from PySide import QtCore, QtGui
|
||||
from PathScripts.PathPostProcessor import PostProcessor
|
||||
|
||||
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
class JobPreferencesPage:
|
||||
|
||||
@@ -24,7 +24,6 @@ from __future__ import print_function
|
||||
|
||||
import FreeCAD
|
||||
import Path
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathOp as PathOp
|
||||
import PathScripts.PathUtils as PathUtils
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
@@ -36,10 +35,10 @@ __url__ = "http://www.freecadweb.org"
|
||||
__doc__ = "Path Probing operation."
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
class ObjectProbing(PathOp.ObjectOp):
|
||||
@@ -96,7 +95,7 @@ class ObjectProbing(PathOp.ObjectOp):
|
||||
|
||||
def opExecute(self, obj):
|
||||
"""opExecute(obj) ... generate probe locations."""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.commandlist.append(Path.Command("(Begin Probing)"))
|
||||
|
||||
stock = PathUtils.findParentJob(obj).Stock
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import Path
|
||||
import PathGui as PGui # ensure Path/Gui/Resources are loaded
|
||||
import PathScripts.PathProbe as PathProbe
|
||||
import PathScripts.PathOpGui as PathOpGui
|
||||
import PathScripts.PathGui as PathGui
|
||||
import PathScripts.PathLog as PathLog
|
||||
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
from PySide import QtCore, QtGui
|
||||
@@ -38,10 +38,10 @@ __doc__ = "Probing operation page controller and command implementation."
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
import FreeCAD
|
||||
import Path
|
||||
import PathScripts.PathAreaOp as PathAreaOp
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathOp as PathOp
|
||||
import PathScripts.PathUtils as PathUtils
|
||||
import PathScripts.drillableLib as drillableLib
|
||||
@@ -50,10 +49,10 @@ __doc__ = (
|
||||
__contributors__ = "Schildkroet"
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
@@ -218,12 +217,12 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
data = list()
|
||||
idx = 0 if dataType == "translated" else 1
|
||||
|
||||
PathLog.debug(enums)
|
||||
Path.Log.debug(enums)
|
||||
|
||||
for k, v in enumerate(enums):
|
||||
# data[k] = [tup[idx] for tup in v]
|
||||
data.append((v, [tup[idx] for tup in enums[v]]))
|
||||
PathLog.debug(data)
|
||||
Path.Log.debug(data)
|
||||
|
||||
return data
|
||||
|
||||
@@ -375,7 +374,7 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
|
||||
shapes = []
|
||||
remainingObjBaseFeatures = []
|
||||
self.isDebug = True if PathLog.getLevel(PathLog.thisModule()) == 4 else False
|
||||
self.isDebug = True if Path.Log.getLevel(Path.Log.thisModule()) == 4 else False
|
||||
self.inaccessibleMsg = translate(
|
||||
"PathProfile",
|
||||
"The selected edge(s) are inaccessible. If multiple, re-ordering selection might work.",
|
||||
@@ -412,12 +411,12 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
obj.Base and len(obj.Base) > 0
|
||||
): # The user has selected subobjects from the base. Process each.
|
||||
shapes.extend(self._processEdges(obj, remainingObjBaseFeatures))
|
||||
PathLog.track("returned {} shapes".format(len(shapes)))
|
||||
Path.Log.track("returned {} shapes".format(len(shapes)))
|
||||
|
||||
PathLog.track(remainingObjBaseFeatures)
|
||||
Path.Log.track(remainingObjBaseFeatures)
|
||||
if obj.Base and len(obj.Base) > 0 and not remainingObjBaseFeatures:
|
||||
# Edges were already processed, or whole model targeted.
|
||||
PathLog.track("remainingObjBaseFeatures is False")
|
||||
Path.Log.track("remainingObjBaseFeatures is False")
|
||||
elif (
|
||||
remainingObjBaseFeatures and len(remainingObjBaseFeatures) > 0
|
||||
): # Process remaining features after edges processed above.
|
||||
@@ -434,7 +433,7 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
if numpy.isclose(
|
||||
abs(shape.normalAt(0, 0).z), 1
|
||||
): # horizontal face
|
||||
PathLog.debug(abs(shape.normalAt(0, 0).z))
|
||||
Path.Log.debug(abs(shape.normalAt(0, 0).z))
|
||||
for wire in shape.Wires:
|
||||
if wire.hashCode() == shape.OuterWire.hashCode():
|
||||
continue
|
||||
@@ -443,16 +442,16 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
# Add face depth to list
|
||||
faceDepths.append(shape.BoundBox.ZMin)
|
||||
else:
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
ignoreSub = base.Name + "." + sub
|
||||
msg = "Found a selected object which is not a face. Ignoring:"
|
||||
PathLog.warning(msg + " {}".format(ignoreSub))
|
||||
Path.Log.warning(msg + " {}".format(ignoreSub))
|
||||
|
||||
for baseShape, wire in holes:
|
||||
cont = False
|
||||
f = Part.makeFace(wire, "Part::FaceMakerSimple")
|
||||
drillable = drillableLib.isDrillable(baseShape, f, vector=None)
|
||||
PathLog.debug(drillable)
|
||||
Path.Log.debug(drillable)
|
||||
|
||||
if obj.processCircles:
|
||||
if drillable:
|
||||
@@ -486,7 +485,7 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
msg = translate(
|
||||
"PathProfile", "Unable to create path for face(s)."
|
||||
)
|
||||
PathLog.error(msg + "\n{}".format(ee))
|
||||
Path.Log.error(msg + "\n{}".format(ee))
|
||||
cont = False
|
||||
|
||||
if cont:
|
||||
@@ -508,17 +507,17 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
|
||||
else: # Try to build targets from the job models
|
||||
# No base geometry selected, so treating operation like a exterior contour operation
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.opUpdateDepths(obj)
|
||||
|
||||
if 1 == len(self.model) and hasattr(self.model[0], "Proxy"):
|
||||
PathLog.debug("Single model processed.")
|
||||
Path.Log.debug("Single model processed.")
|
||||
shapes.extend(self._processEachModel(obj))
|
||||
else:
|
||||
shapes.extend(self._processEachModel(obj))
|
||||
|
||||
self.removalshapes = shapes
|
||||
PathLog.debug("%d shapes" % len(shapes))
|
||||
Path.Log.debug("%d shapes" % len(shapes))
|
||||
|
||||
# Delete the temporary objects
|
||||
if self.isDebug:
|
||||
@@ -547,7 +546,7 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
|
||||
# Edges pre-processing
|
||||
def _processEdges(self, obj, remainingObjBaseFeatures):
|
||||
PathLog.track("remainingObjBaseFeatures: {}".format(remainingObjBaseFeatures))
|
||||
Path.Log.track("remainingObjBaseFeatures: {}".format(remainingObjBaseFeatures))
|
||||
shapes = []
|
||||
basewires = []
|
||||
ezMin = None
|
||||
@@ -572,7 +571,7 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
if len(keepFaces) > 0: # save faces for returning and processing
|
||||
remainingObjBaseFeatures.append((base, keepFaces))
|
||||
|
||||
PathLog.track(basewires)
|
||||
Path.Log.track(basewires)
|
||||
for base, wires in basewires:
|
||||
for wire in wires:
|
||||
if wire.isClosed():
|
||||
@@ -592,13 +591,13 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
tup = shapeEnv, False, "pathProfile"
|
||||
shapes.append(tup)
|
||||
else:
|
||||
PathLog.error(self.inaccessibleMsg)
|
||||
Path.Log.error(self.inaccessibleMsg)
|
||||
else:
|
||||
# Attempt open-edges profile
|
||||
if self.JOB.GeometryTolerance.Value == 0.0:
|
||||
msg = self.JOB.Label + ".GeometryTolerance = 0.0. "
|
||||
msg += "Please set to an acceptable value greater than zero."
|
||||
PathLog.error(msg)
|
||||
Path.Log.error(msg)
|
||||
else:
|
||||
flattened = self._flattenWire(obj, wire, obj.FinalDepth.Value)
|
||||
zDiff = math.fabs(wire.BoundBox.ZMin - obj.FinalDepth.Value)
|
||||
@@ -624,7 +623,7 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
for cW in cutWireObjs:
|
||||
openEdges.append(cW)
|
||||
else:
|
||||
PathLog.error(self.inaccessibleMsg)
|
||||
Path.Log.error(self.inaccessibleMsg)
|
||||
|
||||
if openEdges:
|
||||
tup = openEdges, False, "OpenEdge"
|
||||
@@ -635,9 +634,9 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
"PathProfile",
|
||||
"Check edge selection and Final Depth requirements for profiling open edge(s).",
|
||||
)
|
||||
PathLog.error(msg)
|
||||
Path.Log.error(msg)
|
||||
else:
|
||||
PathLog.error(self.inaccessibleMsg)
|
||||
Path.Log.error(self.inaccessibleMsg)
|
||||
# Eif
|
||||
# Eif
|
||||
# Efor
|
||||
@@ -647,11 +646,11 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
|
||||
def _flattenWire(self, obj, wire, trgtDep):
|
||||
"""_flattenWire(obj, wire)... Return a flattened version of the wire"""
|
||||
PathLog.debug("_flattenWire()")
|
||||
Path.Log.debug("_flattenWire()")
|
||||
wBB = wire.BoundBox
|
||||
|
||||
if wBB.ZLength > 0.0:
|
||||
PathLog.debug("Wire is not horizontally co-planar. Flattening it.")
|
||||
Path.Log.debug("Wire is not horizontally co-planar. Flattening it.")
|
||||
|
||||
# Extrude non-horizontal wire
|
||||
extFwdLen = (wBB.ZLength + 2.0) * 2.0
|
||||
@@ -672,7 +671,7 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
|
||||
# Open-edges methods
|
||||
def _getCutAreaCrossSection(self, obj, base, origWire, flatWire):
|
||||
PathLog.debug("_getCutAreaCrossSection()")
|
||||
Path.Log.debug("_getCutAreaCrossSection()")
|
||||
# FCAD = FreeCAD.ActiveDocument
|
||||
tolerance = self.JOB.GeometryTolerance.Value
|
||||
toolDiam = (
|
||||
@@ -758,14 +757,14 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
):
|
||||
botFc.append(f)
|
||||
if len(topFc) == 0:
|
||||
PathLog.error("Failed to identify top faces of cut area.")
|
||||
Path.Log.error("Failed to identify top faces of cut area.")
|
||||
return False
|
||||
topComp = Part.makeCompound([cutArea.Faces[f] for f in topFc])
|
||||
topComp.translate(
|
||||
FreeCAD.Vector(0, 0, fdv - topComp.BoundBox.ZMin)
|
||||
) # Translate face to final depth
|
||||
if len(botFc) > 1:
|
||||
# PathLog.debug('len(botFc) > 1')
|
||||
# Path.Log.debug('len(botFc) > 1')
|
||||
bndboxFace = Part.Face(extBndbox.Wires[0])
|
||||
tmpFace = Part.Face(extBndbox.Wires[0])
|
||||
for f in botFc:
|
||||
@@ -786,12 +785,12 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
# Determine with which set of intersection tags the model intersects
|
||||
(cmnIntArea, cmnExtArea) = self._checkTagIntersection(iTAG, eTAG, "QRY", comFC)
|
||||
if cmnExtArea > cmnIntArea:
|
||||
PathLog.debug("Cutting on Ext side.")
|
||||
Path.Log.debug("Cutting on Ext side.")
|
||||
self.cutSide = "E"
|
||||
self.cutSideTags = eTAG
|
||||
tagCOM = begExt.CenterOfMass
|
||||
else:
|
||||
PathLog.debug("Cutting on Int side.")
|
||||
Path.Log.debug("Cutting on Int side.")
|
||||
self.cutSide = "I"
|
||||
self.cutSideTags = iTAG
|
||||
tagCOM = begInt.CenterOfMass
|
||||
@@ -836,12 +835,12 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
# Efor
|
||||
|
||||
if wi is None:
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
"The cut area cross-section wire does not coincide with selected edge. Wires[] index is None."
|
||||
)
|
||||
return False
|
||||
else:
|
||||
PathLog.debug("Cross-section Wires[] index is {}.".format(wi))
|
||||
Path.Log.debug("Cross-section Wires[] index is {}.".format(wi))
|
||||
|
||||
nWire = Part.Wire(Part.__sortEdges__(workShp.Wires[wi].Edges))
|
||||
fcShp = Part.Face(nWire)
|
||||
@@ -850,22 +849,22 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
|
||||
# verify that wire chosen is not inside the physical model
|
||||
if wi > 0: # and isInterior is False:
|
||||
PathLog.debug("Multiple wires in cut area. First choice is not 0. Testing.")
|
||||
Path.Log.debug("Multiple wires in cut area. First choice is not 0. Testing.")
|
||||
testArea = fcShp.cut(base.Shape)
|
||||
|
||||
isReady = self._checkTagIntersection(iTAG, eTAG, self.cutSide, testArea)
|
||||
PathLog.debug("isReady {}.".format(isReady))
|
||||
Path.Log.debug("isReady {}.".format(isReady))
|
||||
|
||||
if isReady is False:
|
||||
PathLog.debug("Using wire index {}.".format(wi - 1))
|
||||
Path.Log.debug("Using wire index {}.".format(wi - 1))
|
||||
pWire = Part.Wire(Part.__sortEdges__(workShp.Wires[wi - 1].Edges))
|
||||
pfcShp = Part.Face(pWire)
|
||||
pfcShp.translate(FreeCAD.Vector(0, 0, fdv - workShp.BoundBox.ZMin))
|
||||
workShp = pfcShp.cut(fcShp)
|
||||
|
||||
if testArea.Area < minArea:
|
||||
PathLog.debug("offset area is less than minArea of {}.".format(minArea))
|
||||
PathLog.debug("Using wire index {}.".format(wi - 1))
|
||||
Path.Log.debug("offset area is less than minArea of {}.".format(minArea))
|
||||
Path.Log.debug("Using wire index {}.".format(wi - 1))
|
||||
pWire = Part.Wire(Part.__sortEdges__(workShp.Wires[wi - 1].Edges))
|
||||
pfcShp = Part.Face(pWire)
|
||||
pfcShp.translate(FreeCAD.Vector(0, 0, fdv - workShp.BoundBox.ZMin))
|
||||
@@ -879,7 +878,7 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
return cutShp
|
||||
|
||||
def _checkTagIntersection(self, iTAG, eTAG, cutSide, tstObj):
|
||||
PathLog.debug("_checkTagIntersection()")
|
||||
Path.Log.debug("_checkTagIntersection()")
|
||||
# Identify intersection of Common area and Interior Tags
|
||||
intCmn = tstObj.common(iTAG)
|
||||
|
||||
@@ -893,17 +892,17 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
return (cmnIntArea, cmnExtArea)
|
||||
|
||||
if cmnExtArea > cmnIntArea:
|
||||
PathLog.debug("Cutting on Ext side.")
|
||||
Path.Log.debug("Cutting on Ext side.")
|
||||
if cutSide == "E":
|
||||
return True
|
||||
else:
|
||||
PathLog.debug("Cutting on Int side.")
|
||||
Path.Log.debug("Cutting on Int side.")
|
||||
if cutSide == "I":
|
||||
return True
|
||||
return False
|
||||
|
||||
def _extractPathWire(self, obj, base, flatWire, cutShp):
|
||||
PathLog.debug("_extractPathWire()")
|
||||
Path.Log.debug("_extractPathWire()")
|
||||
|
||||
subLoops = []
|
||||
rtnWIRES = []
|
||||
@@ -929,10 +928,10 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
if osArea: # Make LGTM parser happy
|
||||
pass
|
||||
else:
|
||||
PathLog.error("No area to offset shape returned.")
|
||||
Path.Log.error("No area to offset shape returned.")
|
||||
return []
|
||||
except Exception as ee:
|
||||
PathLog.error("No area to offset shape returned.\n{}".format(ee))
|
||||
Path.Log.error("No area to offset shape returned.\n{}".format(ee))
|
||||
return []
|
||||
|
||||
self._addDebugObject("OffsetShape", ofstShp)
|
||||
@@ -967,7 +966,7 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
self._addDebugObject("Near1", near1Shp)
|
||||
|
||||
if w0 != w1:
|
||||
PathLog.warning(
|
||||
Path.Log.warning(
|
||||
"Offset wire endpoint indexes are not equal - w0, w1: {}, {}".format(
|
||||
w0, w1
|
||||
)
|
||||
@@ -976,12 +975,12 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
# Debugging
|
||||
"""
|
||||
if self.isDebug:
|
||||
PathLog.debug('min0i is {}.'.format(min0i))
|
||||
PathLog.debug('min1i is {}.'.format(min1i))
|
||||
PathLog.debug('NEAR0[{}] is {}.'.format(w0, NEAR0[w0]))
|
||||
PathLog.debug('NEAR1[{}] is {}.'.format(w1, NEAR1[w1]))
|
||||
PathLog.debug('NEAR0 is {}.'.format(NEAR0))
|
||||
PathLog.debug('NEAR1 is {}.'.format(NEAR1))
|
||||
Path.Log.debug('min0i is {}.'.format(min0i))
|
||||
Path.Log.debug('min1i is {}.'.format(min1i))
|
||||
Path.Log.debug('NEAR0[{}] is {}.'.format(w0, NEAR0[w0]))
|
||||
Path.Log.debug('NEAR1[{}] is {}.'.format(w1, NEAR1[w1]))
|
||||
Path.Log.debug('NEAR0 is {}.'.format(NEAR0))
|
||||
Path.Log.debug('NEAR1 is {}.'.format(NEAR1))
|
||||
"""
|
||||
|
||||
mainWire = ofstShp.Wires[w0]
|
||||
@@ -1018,7 +1017,7 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
mainWire, mainWire.Vertexes[vi0], mainWire.Vertexes[vi1]
|
||||
)
|
||||
except Exception as ee:
|
||||
PathLog.error("Failed to identify offset edge.\n{}".format(ee))
|
||||
Path.Log.error("Failed to identify offset edge.\n{}".format(ee))
|
||||
return False
|
||||
edgs0 = []
|
||||
edgs1 = []
|
||||
@@ -1043,7 +1042,7 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
def _getOffsetArea(self, obj, fcShape, isHole):
|
||||
"""Get an offset area for a shape. Wrapper around
|
||||
PathUtils.getOffsetArea."""
|
||||
PathLog.debug("_getOffsetArea()")
|
||||
Path.Log.debug("_getOffsetArea()")
|
||||
|
||||
JOB = PathUtils.findParentJob(obj)
|
||||
tolerance = JOB.GeometryTolerance.Value
|
||||
@@ -1057,7 +1056,7 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
)
|
||||
|
||||
def _findNearestVertex(self, shape, point):
|
||||
PathLog.debug("_findNearestVertex()")
|
||||
Path.Log.debug("_findNearestVertex()")
|
||||
PT = FreeCAD.Vector(point.x, point.y, 0.0)
|
||||
|
||||
def sortDist(tup):
|
||||
@@ -1086,7 +1085,7 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
return PNTS
|
||||
|
||||
def _separateWireAtVertexes(self, wire, VV1, VV2):
|
||||
PathLog.debug("_separateWireAtVertexes()")
|
||||
Path.Log.debug("_separateWireAtVertexes()")
|
||||
tolerance = self.JOB.GeometryTolerance.Value
|
||||
grps = [[], []]
|
||||
wireIdxs = [[], []]
|
||||
@@ -1129,7 +1128,7 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
FLGS[e] += v
|
||||
# Efor
|
||||
|
||||
# PathLog.debug('_separateWireAtVertexes() FLGS: {}'.format(FLGS))
|
||||
# Path.Log.debug('_separateWireAtVertexes() FLGS: {}'.format(FLGS))
|
||||
|
||||
PRE = []
|
||||
POST = []
|
||||
@@ -1209,12 +1208,12 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
# Debugging
|
||||
"""
|
||||
if self.isDebug:
|
||||
PathLog.debug('grps[0]: {}'.format(grps[0]))
|
||||
PathLog.debug('grps[1]: {}'.format(grps[1]))
|
||||
PathLog.debug('wireIdxs[0]: {}'.format(wireIdxs[0]))
|
||||
PathLog.debug('wireIdxs[1]: {}'.format(wireIdxs[1]))
|
||||
PathLog.debug('PRE: {}'.format(PRE))
|
||||
PathLog.debug('IDXS: {}'.format(IDXS))
|
||||
Path.Log.debug('grps[0]: {}'.format(grps[0]))
|
||||
Path.Log.debug('grps[1]: {}'.format(grps[1]))
|
||||
Path.Log.debug('wireIdxs[0]: {}'.format(wireIdxs[0]))
|
||||
Path.Log.debug('wireIdxs[1]: {}'.format(wireIdxs[1]))
|
||||
Path.Log.debug('PRE: {}'.format(PRE))
|
||||
Path.Log.debug('IDXS: {}'.format(IDXS))
|
||||
"""
|
||||
return (wireIdxs[0], wireIdxs[1])
|
||||
|
||||
@@ -1222,7 +1221,7 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
"""_makeCrossSection(shape, sliceZ, zHghtTrgt=None)...
|
||||
Creates cross-section objectc from shape. Translates cross-section to zHghtTrgt if available.
|
||||
Makes face shape from cross-section object. Returns face shape at zHghtTrgt."""
|
||||
PathLog.debug("_makeCrossSection()")
|
||||
Path.Log.debug("_makeCrossSection()")
|
||||
# Create cross-section of shape and translate
|
||||
wires = []
|
||||
slcs = shape.slice(FreeCAD.Vector(0, 0, 1), sliceZ)
|
||||
@@ -1237,7 +1236,7 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
return False
|
||||
|
||||
def _makeExtendedBoundBox(self, wBB, bbBfr, zDep):
|
||||
PathLog.debug("_makeExtendedBoundBox()")
|
||||
Path.Log.debug("_makeExtendedBoundBox()")
|
||||
p1 = FreeCAD.Vector(wBB.XMin - bbBfr, wBB.YMin - bbBfr, zDep)
|
||||
p2 = FreeCAD.Vector(wBB.XMax + bbBfr, wBB.YMin - bbBfr, zDep)
|
||||
p3 = FreeCAD.Vector(wBB.XMax + bbBfr, wBB.YMax + bbBfr, zDep)
|
||||
@@ -1251,7 +1250,7 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
return Part.Face(Part.Wire([L1, L2, L3, L4]))
|
||||
|
||||
def _makeIntersectionTags(self, useWire, numOrigEdges, fdv):
|
||||
PathLog.debug("_makeIntersectionTags()")
|
||||
Path.Log.debug("_makeIntersectionTags()")
|
||||
# Create circular probe tags around perimiter of wire
|
||||
extTags = []
|
||||
intTags = []
|
||||
@@ -1309,7 +1308,7 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
return (begInt, begExt, iTAG, eTAG)
|
||||
|
||||
def _makeOffsetCircleTag(self, p1, p2, cutterRad, depth, lbl, reverse=False):
|
||||
# PathLog.debug('_makeOffsetCircleTag()')
|
||||
# Path.Log.debug('_makeOffsetCircleTag()')
|
||||
pb = FreeCAD.Vector(p1.x, p1.y, 0.0)
|
||||
pe = FreeCAD.Vector(p2.x, p2.y, 0.0)
|
||||
|
||||
@@ -1344,7 +1343,7 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
return (intTag, extTag)
|
||||
|
||||
def _makeStop(self, sType, pA, pB, lbl):
|
||||
# PathLog.debug('_makeStop()')
|
||||
# Path.Log.debug('_makeStop()')
|
||||
ofstRad = self.ofstRadius
|
||||
extra = self.radius / 5.0
|
||||
lng = 0.05
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
import PathScripts.PathLog as PathLog
|
||||
import Path
|
||||
|
||||
__title__ = "Property type abstraction for editing purposes"
|
||||
__author__ = "sliptonic (Brad Collette)"
|
||||
@@ -28,8 +28,8 @@ __url__ = "https://www.freecadweb.org"
|
||||
__doc__ = "Prototype objects to allow extraction of setup sheet values and editing."
|
||||
|
||||
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
# PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
# Path.Log.trackModule(Path.Log.thisModule())
|
||||
|
||||
|
||||
class Property(object):
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
import FreeCAD
|
||||
import Path
|
||||
import re
|
||||
import PathScripts.PathLog as PathLog
|
||||
|
||||
__title__ = "Generic property container to store some values."
|
||||
__author__ = "sliptonic (Brad Collette)"
|
||||
@@ -31,10 +31,10 @@ __url__ = "https://www.freecadweb.org"
|
||||
__doc__ = "A generic container for typed properties in arbitrary categories."
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
from PySide import QtCore, QtGui
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import Path
|
||||
import PathScripts.PathIconViewProvider as PathIconViewProvider
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathPropertyBag as PathPropertyBag
|
||||
import PathScripts.PathPropertyEditor as PathPropertyEditor
|
||||
import PathScripts.PathUtil as PathUtil
|
||||
@@ -37,10 +37,10 @@ __url__ = "https://www.freecadweb.org"
|
||||
__doc__ = "Task panel editor for a PropertyBag"
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
@@ -50,7 +50,7 @@ class ViewProvider(object):
|
||||
It's sole job is to provide an icon and invoke the TaskPanel on edit."""
|
||||
|
||||
def __init__(self, vobj, name):
|
||||
PathLog.track(name)
|
||||
Path.Log.track(name)
|
||||
vobj.Proxy = self
|
||||
self.icon = name
|
||||
# mode = 2
|
||||
@@ -58,7 +58,7 @@ class ViewProvider(object):
|
||||
self.vobj = None
|
||||
|
||||
def attach(self, vobj):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.vobj = vobj
|
||||
self.obj = vobj.Object
|
||||
|
||||
@@ -75,7 +75,7 @@ class ViewProvider(object):
|
||||
return "Default"
|
||||
|
||||
def setEdit(self, vobj, mode=0):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
taskPanel = TaskPanel(vobj)
|
||||
FreeCADGui.Control.closeDialog()
|
||||
FreeCADGui.Control.showDialog(taskPanel)
|
||||
@@ -99,7 +99,7 @@ class Delegate(QtGui.QStyledItemDelegate):
|
||||
RoleEditor = QtCore.Qt.UserRole + 3
|
||||
|
||||
# def paint(self, painter, option, index):
|
||||
# #PathLog.track(index.column(), type(option))
|
||||
# #Path.Log.track(index.column(), type(option))
|
||||
|
||||
def createEditor(self, parent, option, index):
|
||||
editor = PathPropertyEditor.Editor(
|
||||
@@ -109,11 +109,11 @@ class Delegate(QtGui.QStyledItemDelegate):
|
||||
return editor.widget(parent)
|
||||
|
||||
def setEditorData(self, widget, index):
|
||||
PathLog.track(index.row(), index.column())
|
||||
Path.Log.track(index.row(), index.column())
|
||||
index.data(self.RoleEditor).setEditorData(widget)
|
||||
|
||||
def setModelData(self, widget, model, index):
|
||||
PathLog.track(index.row(), index.column())
|
||||
Path.Log.track(index.row(), index.column())
|
||||
editor = index.data(self.RoleEditor)
|
||||
editor.setModelData(widget)
|
||||
index.model().setData(index, editor.displayString(), QtCore.Qt.DisplayRole)
|
||||
@@ -273,7 +273,7 @@ class TaskPanel(object):
|
||||
# self.model.item(i, self.ColumnType).setEditable(False)
|
||||
|
||||
def setupUi(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
|
||||
self.delegate = Delegate(self.form)
|
||||
self.model = QtGui.QStandardItemModel(
|
||||
@@ -308,7 +308,7 @@ class TaskPanel(object):
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
def propertySelected(self, selection):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
if selection:
|
||||
self.form.modify.setEnabled(True)
|
||||
self.form.remove.setEnabled(True)
|
||||
@@ -327,7 +327,7 @@ class TaskPanel(object):
|
||||
return (propname, info)
|
||||
|
||||
def propertyAdd(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
more = False
|
||||
grp = None
|
||||
typ = None
|
||||
@@ -358,7 +358,7 @@ class TaskPanel(object):
|
||||
break
|
||||
|
||||
def propertyModifyIndex(self, index):
|
||||
PathLog.track(index.row(), index.column())
|
||||
Path.Log.track(index.row(), index.column())
|
||||
row = index.row()
|
||||
|
||||
obj = self.model.item(row, self.ColumnVal).data(Delegate.RoleObject)
|
||||
@@ -387,7 +387,7 @@ class TaskPanel(object):
|
||||
)
|
||||
|
||||
def propertyModify(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
rows = []
|
||||
for index in self.form.table.selectionModel().selectedIndexes():
|
||||
row = index.row()
|
||||
@@ -398,7 +398,7 @@ class TaskPanel(object):
|
||||
self.propertyModifyIndex(index)
|
||||
|
||||
def propertyRemove(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
# first find all rows which need to be removed
|
||||
rows = []
|
||||
for index in self.form.table.selectionModel().selectedIndexes():
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
# ***************************************************************************
|
||||
|
||||
import FreeCAD
|
||||
import PathScripts.PathLog as PathLog
|
||||
import Path
|
||||
import PathScripts.PathSetupSheetOpPrototype as PathSetupSheetOpPrototype
|
||||
|
||||
from PySide import QtCore, QtGui
|
||||
@@ -33,10 +33,10 @@ __doc__ = "Task panel editor for Properties"
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
class _PropertyEditor(object):
|
||||
|
||||
@@ -32,8 +32,8 @@ from __future__ import print_function
|
||||
from PySide import QtCore, QtGui
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import Path
|
||||
import PathScripts
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathUtil as PathUtil
|
||||
import PathScripts.PathPreferences as PathPreferences
|
||||
from collections import Counter
|
||||
@@ -47,8 +47,8 @@ translate = FreeCAD.Qt.translate
|
||||
|
||||
|
||||
LOG_MODULE = "PathSanity"
|
||||
# PathLog.setLevel(PathLog.Level.INFO, LOG_MODULE)
|
||||
# PathLog.trackModule('PathSanity')
|
||||
# Path.Log.setLevel(Path.Log.Level.INFO, LOG_MODULE)
|
||||
# Path.Log.trackModule('PathSanity')
|
||||
|
||||
|
||||
class CommandPathSanity:
|
||||
@@ -87,14 +87,14 @@ class CommandPathSanity:
|
||||
M = pref.GetString("MacroPath", FreeCAD.getUserAppDataDir())
|
||||
filepath = filepath.replace("%M", M)
|
||||
|
||||
PathLog.debug("filepath: {}".format(filepath))
|
||||
Path.Log.debug("filepath: {}".format(filepath))
|
||||
|
||||
# starting at the derived filename, iterate up until we have a valid
|
||||
# directory to write to
|
||||
while not os.path.isdir(filepath):
|
||||
filepath = os.path.dirname(filepath)
|
||||
|
||||
PathLog.debug("filepath: {}".format(filepath))
|
||||
Path.Log.debug("filepath: {}".format(filepath))
|
||||
return filepath + os.sep
|
||||
|
||||
def GetResources(self):
|
||||
|
||||
@@ -25,13 +25,13 @@
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import PathScripts.PathLog as PathLog
|
||||
import Path
|
||||
import PathScripts.PathPreferences as PathPreferences
|
||||
import PathScripts.drillableLib as drillableLib
|
||||
import math
|
||||
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
# PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
# Path.Log.trackModule(Path.Log.thisModule())
|
||||
|
||||
|
||||
class PathBaseGate(object):
|
||||
@@ -123,7 +123,7 @@ class CHAMFERGate(PathBaseGate):
|
||||
|
||||
class DRILLGate(PathBaseGate):
|
||||
def allow(self, doc, obj, sub):
|
||||
PathLog.debug("obj: {} sub: {}".format(obj, sub))
|
||||
Path.Log.debug("obj: {} sub: {}".format(obj, sub))
|
||||
if not hasattr(obj, "Shape"):
|
||||
return False
|
||||
shape = obj.Shape
|
||||
@@ -233,7 +233,7 @@ class PROBEGate:
|
||||
|
||||
class TURNGate(PathBaseGate):
|
||||
def allow(self, doc, obj, sub):
|
||||
PathLog.debug("obj: {} sub: {}".format(obj, sub))
|
||||
Path.Log.debug("obj: {} sub: {}".format(obj, sub))
|
||||
if hasattr(obj, "Shape") and sub:
|
||||
shape = obj.Shape
|
||||
subobj = shape.getElement(sub)
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
# ***************************************************************************
|
||||
|
||||
import FreeCAD
|
||||
import Path
|
||||
import PathScripts.PathGeom as PathGeom
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathSetupSheetOpPrototype as PathSetupSheetOpPrototype
|
||||
import PathScripts.PathUtil as PathUtil
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
@@ -36,10 +36,10 @@ _RegisteredOps: dict = {}
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
class Template:
|
||||
@@ -73,20 +73,20 @@ class Template:
|
||||
|
||||
|
||||
def _traverseTemplateAttributes(attrs, codec):
|
||||
PathLog.debug(attrs)
|
||||
Path.Log.debug(attrs)
|
||||
coded = {}
|
||||
for key, value in PathUtil.keyValueIter(attrs):
|
||||
if type(value) == dict:
|
||||
PathLog.debug("%s is a dict" % key)
|
||||
Path.Log.debug("%s is a dict" % key)
|
||||
coded[key] = _traverseTemplateAttributes(value, codec)
|
||||
elif type(value) == list:
|
||||
PathLog.debug("%s is a list" % key)
|
||||
Path.Log.debug("%s is a list" % key)
|
||||
coded[key] = [_traverseTemplateAttributes(attr, codec) for attr in value]
|
||||
elif PathUtil.isString(value):
|
||||
PathLog.debug("%s is a string" % key)
|
||||
Path.Log.debug("%s is a string" % key)
|
||||
coded[key] = codec(value)
|
||||
else:
|
||||
PathLog.debug("%s is %s" % (key, type(value)))
|
||||
Path.Log.debug("%s is %s" % (key, type(value)))
|
||||
coded[key] = value
|
||||
return coded
|
||||
|
||||
@@ -394,7 +394,7 @@ class SetupSheet:
|
||||
return list(sorted(ops))
|
||||
|
||||
def setOperationProperties(self, obj, opName):
|
||||
PathLog.track(obj.Label, opName)
|
||||
Path.Log.track(obj.Label, opName)
|
||||
try:
|
||||
op = _RegisteredOps[opName]
|
||||
for prop in op.properties():
|
||||
@@ -402,7 +402,7 @@ class SetupSheet:
|
||||
if hasattr(self.obj, propName):
|
||||
setattr(obj, prop, getattr(self.obj, propName))
|
||||
except Exception:
|
||||
PathLog.info("SetupSheet has no support for {}".format(opName))
|
||||
Path.Log.info("SetupSheet has no support for {}".format(opName))
|
||||
|
||||
def onDocumentRestored(self, obj):
|
||||
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import Path
|
||||
import PathGui as PGui # ensure Path/Gui/Resources are loaded
|
||||
import PathScripts.PathGui as PathGui
|
||||
import PathScripts.PathIconViewProvider as PathIconViewProvider
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathSetupSheet as PathSetupSheet
|
||||
import PathScripts.PathSetupSheetOpPrototypeGui as PathSetupSheetOpPrototypeGui
|
||||
import PathScripts.PathUtil as PathUtil
|
||||
@@ -41,10 +41,10 @@ __doc__ = "Task panel editor for a SetupSheet"
|
||||
LOGLEVEL = False
|
||||
|
||||
if LOGLEVEL:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
class ViewProvider:
|
||||
@@ -52,7 +52,7 @@ class ViewProvider:
|
||||
It's sole job is to provide an icon and invoke the TaskPanel on edit."""
|
||||
|
||||
def __init__(self, vobj, name):
|
||||
PathLog.track(name)
|
||||
Path.Log.track(name)
|
||||
vobj.Proxy = self
|
||||
self.icon = name
|
||||
# mode = 2
|
||||
@@ -60,7 +60,7 @@ class ViewProvider:
|
||||
self.vobj = None
|
||||
|
||||
def attach(self, vobj):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.vobj = vobj
|
||||
self.obj = vobj.Object
|
||||
|
||||
@@ -77,7 +77,7 @@ class ViewProvider:
|
||||
return "Default"
|
||||
|
||||
def setEdit(self, vobj, mode=0):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
taskPanel = TaskPanel(vobj)
|
||||
FreeCADGui.Control.closeDialog()
|
||||
FreeCADGui.Control.showDialog(taskPanel)
|
||||
@@ -106,11 +106,11 @@ class Delegate(QtGui.QStyledItemDelegate):
|
||||
return index.data(self.EditorRole).widget(parent)
|
||||
|
||||
def setEditorData(self, widget, index):
|
||||
PathLog.track(index.row(), index.column())
|
||||
Path.Log.track(index.row(), index.column())
|
||||
index.data(self.EditorRole).setEditorData(widget)
|
||||
|
||||
def setModelData(self, widget, model, index):
|
||||
PathLog.track(index.row(), index.column())
|
||||
Path.Log.track(index.row(), index.column())
|
||||
editor = index.data(self.EditorRole)
|
||||
editor.setModelData(widget)
|
||||
index.model().setData(index, editor.prop.displayString(), QtCore.Qt.DisplayRole)
|
||||
@@ -150,7 +150,7 @@ class OpTaskPanel:
|
||||
self.model.item(topLeft.row(), 2).setEnabled(isset)
|
||||
|
||||
def setupUi(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
|
||||
self.delegate = Delegate(self.form)
|
||||
self.model = QtGui.QStandardItemModel(len(self.props), 3, self.form)
|
||||
@@ -242,7 +242,7 @@ class OpsDefaultEditor:
|
||||
|
||||
def accept(self):
|
||||
if any([op.accept() for op in self.ops]):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
|
||||
def getFields(self):
|
||||
pass
|
||||
@@ -259,7 +259,7 @@ class OpsDefaultEditor:
|
||||
self.currentOp.form.show()
|
||||
|
||||
def updateModel(self, recomp=True):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.getFields()
|
||||
self.updateUI()
|
||||
if recomp:
|
||||
@@ -324,7 +324,7 @@ class GlobalEditor(object):
|
||||
combo.blockSignals(False)
|
||||
|
||||
def updateUI(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.form.setupStartDepthExpr.setText(self.obj.StartDepthExpression)
|
||||
self.form.setupFinalDepthExpr.setText(self.obj.FinalDepthExpression)
|
||||
self.form.setupStepDownExpr.setText(self.obj.StepDownExpression)
|
||||
@@ -337,7 +337,7 @@ class GlobalEditor(object):
|
||||
self.selectInComboBox(self.obj.CoolantMode, self.form.setupCoolantMode)
|
||||
|
||||
def updateModel(self, recomp=True):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.getFields()
|
||||
self.updateUI()
|
||||
if recomp:
|
||||
@@ -369,7 +369,7 @@ class TaskPanel:
|
||||
def __init__(self, vobj):
|
||||
self.vobj = vobj
|
||||
self.obj = vobj.Object
|
||||
PathLog.track(self.obj.Label)
|
||||
Path.Log.track(self.obj.Label)
|
||||
self.globalForm = FreeCADGui.PySideUic.loadUi(":/panels/SetupGlobal.ui")
|
||||
self.globalEditor = GlobalEditor(self.obj, self.globalForm)
|
||||
self.opsEditor = OpsDefaultEditor(self.obj, None)
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
import PathScripts.PathLog as PathLog
|
||||
import Path
|
||||
|
||||
__title__ = "Setup Sheet for a Job."
|
||||
__author__ = "sliptonic (Brad Collette)"
|
||||
@@ -28,8 +28,8 @@ __url__ = "https://www.freecadweb.org"
|
||||
__doc__ = "Prototype objects to allow extraction of setup sheet values and editing."
|
||||
|
||||
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
# PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
# Path.Log.trackModule(Path.Log.thisModule())
|
||||
|
||||
|
||||
class Property(object):
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
# ***************************************************************************
|
||||
|
||||
import FreeCAD
|
||||
import PathScripts.PathLog as PathLog
|
||||
import Path
|
||||
import PathScripts.PathSetupSheetOpPrototype as PathSetupSheetOpPrototype
|
||||
|
||||
from PySide import QtCore, QtGui
|
||||
@@ -35,10 +35,10 @@ __doc__ = "Task panel editor for a SetupSheet"
|
||||
LOGLEVEL = False
|
||||
|
||||
if LOGLEVEL:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
class _PropertyEditor(object):
|
||||
@@ -68,7 +68,7 @@ class _PropertyEnumEditor(_PropertyEditor):
|
||||
"""Editor for enumeration values - uses a combo box."""
|
||||
|
||||
def widget(self, parent):
|
||||
PathLog.track(self.prop.name, self.prop.getEnumValues())
|
||||
Path.Log.track(self.prop.name, self.prop.getEnumValues())
|
||||
return QtGui.QComboBox(parent)
|
||||
|
||||
def setEditorData(self, widget):
|
||||
|
||||
@@ -25,7 +25,6 @@ import Path
|
||||
import PathGui as PGui # ensure Path/Gui/Resources are loaded
|
||||
import PathScripts.PathDressup as PathDressup
|
||||
import PathScripts.PathGeom as PathGeom
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathUtil as PathUtil
|
||||
import PathScripts.PathJob as PathJob
|
||||
import PathSimulator
|
||||
@@ -475,7 +474,7 @@ class PathSimulation:
|
||||
h = tool.CuttingEdgeHeight
|
||||
if h <= 0.0: # set default if user fails to avoid freeze
|
||||
h = 1.0
|
||||
PathLog.error("SET Tool Length")
|
||||
Path.Log.error("SET Tool Length")
|
||||
# common to all tools
|
||||
vTR = Vector(xp + yf, yp - xf, zp + h)
|
||||
vTC = Vector(xp, yp, zp + h)
|
||||
|
||||
@@ -32,7 +32,6 @@ __contributors__ = ""
|
||||
import FreeCAD
|
||||
from PySide import QtCore
|
||||
import Path
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathUtils as PathUtils
|
||||
import PathScripts.PathOp as PathOp
|
||||
import math
|
||||
@@ -51,10 +50,10 @@ translate = FreeCAD.Qt.translate
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
class ObjectSlot(PathOp.ObjectOp):
|
||||
@@ -81,7 +80,7 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
self.initOpProperties(obj) # Initialize operation-specific properties
|
||||
|
||||
# For debugging
|
||||
if PathLog.getLevel(PathLog.thisModule()) != 4:
|
||||
if Path.Log.getLevel(Path.Log.thisModule()) != 4:
|
||||
obj.setEditorMode("ShowTempObjects", 2) # hide
|
||||
|
||||
if not hasattr(obj, "DoNotSetDefaultValues"):
|
||||
@@ -89,7 +88,7 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
|
||||
def initOpProperties(self, obj, warn=False):
|
||||
"""initOpProperties(obj) ... create operation specific properties"""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.addNewProps = list()
|
||||
|
||||
for (prtyp, nm, grp, tt) in self.opPropertyDefinitions():
|
||||
@@ -251,7 +250,7 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
'raw' is list of (translated_text, data_string) tuples
|
||||
'translated' is list of translated string literals
|
||||
"""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
|
||||
enums = {
|
||||
"CutPattern": [
|
||||
@@ -296,11 +295,11 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
data = list()
|
||||
idx = 0 if dataType == "translated" else 1
|
||||
|
||||
PathLog.debug(enums)
|
||||
Path.Log.debug(enums)
|
||||
|
||||
for k, v in enumerate(enums):
|
||||
data.append((v, [tup[idx] for tup in enums[v]]))
|
||||
PathLog.debug(data)
|
||||
Path.Log.debug(data)
|
||||
|
||||
return data
|
||||
|
||||
@@ -354,7 +353,7 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
in the operation. Returns the updated enumerations dictionary.
|
||||
Existing property values must be stored, and then restored after
|
||||
the assignment of updated enumerations."""
|
||||
PathLog.debug("updateEnumerations()")
|
||||
Path.Log.debug("updateEnumerations()")
|
||||
# Save existing values
|
||||
pre_Ref1 = obj.Reference1
|
||||
pre_Ref2 = obj.Reference2
|
||||
@@ -410,7 +409,7 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
self.initOpProperties(obj, warn=True)
|
||||
self.opApplyPropertyDefaults(obj, job, self.addNewProps)
|
||||
|
||||
mode = 2 if PathLog.getLevel(PathLog.thisModule()) != 4 else 0
|
||||
mode = 2 if Path.Log.getLevel(Path.Log.thisModule()) != 4 else 0
|
||||
obj.setEditorMode("ShowTempObjects", mode)
|
||||
|
||||
# Repopulate enumerations in case of changes
|
||||
@@ -454,11 +453,11 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
if job:
|
||||
if job.Stock:
|
||||
d = PathUtils.guessDepths(job.Stock.Shape, None)
|
||||
PathLog.debug("job.Stock exists")
|
||||
Path.Log.debug("job.Stock exists")
|
||||
else:
|
||||
PathLog.debug("job.Stock NOT exist")
|
||||
Path.Log.debug("job.Stock NOT exist")
|
||||
else:
|
||||
PathLog.debug("job NOT exist")
|
||||
Path.Log.debug("job NOT exist")
|
||||
|
||||
if d is not None:
|
||||
obj.OpFinalDepth.Value = d.final_depth
|
||||
@@ -467,8 +466,8 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
obj.OpFinalDepth.Value = -10
|
||||
obj.OpStartDepth.Value = 10
|
||||
|
||||
PathLog.debug("Default OpFinalDepth: {}".format(obj.OpFinalDepth.Value))
|
||||
PathLog.debug("Default OpStartDepth: {}".format(obj.OpStartDepth.Value))
|
||||
Path.Log.debug("Default OpFinalDepth: {}".format(obj.OpFinalDepth.Value))
|
||||
Path.Log.debug("Default OpStartDepth: {}".format(obj.OpStartDepth.Value))
|
||||
|
||||
def opApplyPropertyLimits(self, obj):
|
||||
"""opApplyPropertyLimits(obj) ... Apply necessary limits to user input property values before performing main operation."""
|
||||
@@ -485,12 +484,12 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
fbb = base.Shape.getElement(sub).BoundBox
|
||||
zmin = min(zmin, fbb.ZMin)
|
||||
except Part.OCCError as e:
|
||||
PathLog.error(e)
|
||||
Path.Log.error(e)
|
||||
obj.OpFinalDepth = zmin
|
||||
|
||||
def opExecute(self, obj):
|
||||
"""opExecute(obj) ... process surface operation"""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
|
||||
self.base = None
|
||||
self.shape1 = None
|
||||
@@ -509,7 +508,7 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
self.arcRadius = 0.0
|
||||
self.newRadius = 0.0
|
||||
self.featureDetails = ["", ""]
|
||||
self.isDebug = False if PathLog.getLevel(PathLog.thisModule()) != 4 else True
|
||||
self.isDebug = False if Path.Log.getLevel(Path.Log.thisModule()) != 4 else True
|
||||
self.showDebugObjects = False
|
||||
self.stockZMin = self.job.Stock.Shape.BoundBox.ZMin
|
||||
CMDS = list()
|
||||
@@ -630,14 +629,14 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
|
||||
featureCount = len(subsList)
|
||||
if featureCount == 1:
|
||||
PathLog.debug("Reference 1: {}".format(obj.Reference1))
|
||||
Path.Log.debug("Reference 1: {}".format(obj.Reference1))
|
||||
sub1 = subsList[0]
|
||||
shape_1 = getattr(base.Shape, sub1)
|
||||
self.shape1 = shape_1
|
||||
pnts = self._processSingle(obj, shape_1, sub1)
|
||||
else:
|
||||
PathLog.debug("Reference 1: {}".format(obj.Reference1))
|
||||
PathLog.debug("Reference 2: {}".format(obj.Reference2))
|
||||
Path.Log.debug("Reference 1: {}".format(obj.Reference1))
|
||||
Path.Log.debug("Reference 2: {}".format(obj.Reference2))
|
||||
sub1 = subsList[0]
|
||||
sub2 = subsList[1]
|
||||
shape_1 = getattr(base.Shape, sub1)
|
||||
@@ -662,16 +661,16 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
def _finishArc(self, obj, pnts, featureCnt):
|
||||
"""This method finishes an Arc Slot operation.
|
||||
It returns the gcode for the slot operation."""
|
||||
PathLog.debug("arc center: {}".format(self.arcCenter))
|
||||
Path.Log.debug("arc center: {}".format(self.arcCenter))
|
||||
self._addDebugObject(
|
||||
Part.makeLine(self.arcCenter, self.arcMidPnt), "CentToMidPnt"
|
||||
)
|
||||
|
||||
# PathLog.debug('Pre-offset points are:\np1 = {}\np2 = {}'.format(p1, p2))
|
||||
# Path.Log.debug('Pre-offset points are:\np1 = {}\np2 = {}'.format(p1, p2))
|
||||
if obj.ExtendRadius.Value != 0:
|
||||
# verify offset does not force radius < 0
|
||||
newRadius = self.arcRadius + obj.ExtendRadius.Value
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"arc radius: {}; offset radius: {}".format(self.arcRadius, newRadius)
|
||||
)
|
||||
if newRadius <= 0:
|
||||
@@ -686,11 +685,11 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
pnts = self._makeOffsetArc(p1, p2, self.arcCenter, newRadius)
|
||||
self.newRadius = newRadius
|
||||
else:
|
||||
PathLog.debug("arc radius: {}".format(self.arcRadius))
|
||||
Path.Log.debug("arc radius: {}".format(self.arcRadius))
|
||||
self.newRadius = self.arcRadius
|
||||
|
||||
# Apply path extension for arcs
|
||||
# PathLog.debug('Pre-extension points are:\np1 = {}\np2 = {}'.format(p1, p2))
|
||||
# Path.Log.debug('Pre-extension points are:\np1 = {}\np2 = {}'.format(p1, p2))
|
||||
if self.isArc == 1:
|
||||
# Complete circle
|
||||
if obj.ExtendPathStart.Value != 0 or obj.ExtendPathEnd.Value != 0:
|
||||
@@ -712,9 +711,9 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
return False
|
||||
|
||||
(p1, p2) = pnts
|
||||
# PathLog.error('Post-offset points are:\np1 = {}\np2 = {}'.format(p1, p2))
|
||||
# Path.Log.error('Post-offset points are:\np1 = {}\np2 = {}'.format(p1, p2))
|
||||
if self.isDebug:
|
||||
PathLog.debug("Path Points are:\np1 = {}\np2 = {}".format(p1, p2))
|
||||
Path.Log.debug("Path Points are:\np1 = {}\np2 = {}".format(p1, p2))
|
||||
if p1.sub(p2).Length != 0:
|
||||
self._addDebugObject(Part.makeLine(p1, p2), "Path")
|
||||
|
||||
@@ -727,7 +726,7 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
msg += translate("Path_Slot", "operation collides with model.")
|
||||
FreeCAD.Console.PrintError(msg + "\n")
|
||||
|
||||
# PathLog.warning('Unable to create G-code. _makeArcGCode() is incomplete.')
|
||||
# Path.Log.warning('Unable to create G-code. _makeArcGCode() is incomplete.')
|
||||
cmds = self._makeArcGCode(obj, p1, p2)
|
||||
return cmds
|
||||
|
||||
@@ -790,7 +789,7 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
)
|
||||
|
||||
if self.isDebug:
|
||||
PathLog.debug("G-code arc command is: {}".format(PATHS[path_index][2]))
|
||||
Path.Log.debug("G-code arc command is: {}".format(PATHS[path_index][2]))
|
||||
|
||||
return CMDS
|
||||
|
||||
@@ -808,7 +807,7 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
pnts = self._processSingleVertFace(obj, BE)
|
||||
perpZero = False
|
||||
elif self.shapeType1 == "Edge" and self.shapeType2 == "Edge":
|
||||
PathLog.debug("_finishLine() Perp, featureCnt == 2")
|
||||
Path.Log.debug("_finishLine() Perp, featureCnt == 2")
|
||||
if perpZero:
|
||||
(p1, p2) = pnts
|
||||
initPerpDist = p1.sub(p2).Length
|
||||
@@ -825,7 +824,7 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
if self.featureDetails[0] == "arc" and self.featureDetails[1] == "arc":
|
||||
perpZero = False
|
||||
elif self._isParallel(self.dYdX1, self.dYdX2):
|
||||
PathLog.debug("_finishLine() StE, featureCnt == 2 // edges")
|
||||
Path.Log.debug("_finishLine() StE, featureCnt == 2 // edges")
|
||||
(p1, p2) = pnts
|
||||
edg1_len = self.shape1.Length
|
||||
edg2_len = self.shape2.Length
|
||||
@@ -862,7 +861,7 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
|
||||
(p1, p2) = pnts
|
||||
if self.isDebug:
|
||||
PathLog.debug("Path Points are:\np1 = {}\np2 = {}".format(p1, p2))
|
||||
Path.Log.debug("Path Points are:\np1 = {}\np2 = {}".format(p1, p2))
|
||||
if p1.sub(p2).Length != 0:
|
||||
self._addDebugObject(Part.makeLine(p1, p2), "Path")
|
||||
|
||||
@@ -946,7 +945,7 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
if cat1 == "Face":
|
||||
pnts = False
|
||||
norm = shape_1.normalAt(0.0, 0.0)
|
||||
PathLog.debug("{}.normalAt(): {}".format(sub1, norm))
|
||||
Path.Log.debug("{}.normalAt(): {}".format(sub1, norm))
|
||||
|
||||
if PathGeom.isRoughly(shape_1.BoundBox.ZMax, shape_1.BoundBox.ZMin):
|
||||
# Horizontal face
|
||||
@@ -978,7 +977,7 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
done = True
|
||||
|
||||
elif cat1 == "Edge":
|
||||
PathLog.debug("Single edge")
|
||||
Path.Log.debug("Single edge")
|
||||
pnts = self._processSingleEdge(obj, shape_1)
|
||||
if pnts:
|
||||
(p1, p2) = pnts
|
||||
@@ -998,7 +997,7 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
|
||||
def _processSingleHorizFace(self, obj, shape):
|
||||
"""Determine slot path endpoints from a single horizontally oriented face."""
|
||||
PathLog.debug("_processSingleHorizFace()")
|
||||
Path.Log.debug("_processSingleHorizFace()")
|
||||
lineTypes = ["Part::GeomLine"]
|
||||
|
||||
def getRadians(self, E):
|
||||
@@ -1056,19 +1055,19 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
flag += 1
|
||||
if debug:
|
||||
msg = "Erroneous Curve.TypeId: {}".format(debug)
|
||||
PathLog.debug(msg)
|
||||
Path.Log.debug(msg)
|
||||
|
||||
pairCnt = len(parallel_edge_pairs)
|
||||
if pairCnt > 1:
|
||||
parallel_edge_pairs.sort(key=lambda tup: tup[0].Length, reverse=True)
|
||||
|
||||
if self.isDebug:
|
||||
PathLog.debug(" -pairCnt: {}".format(pairCnt))
|
||||
Path.Log.debug(" -pairCnt: {}".format(pairCnt))
|
||||
for (a, b) in parallel_edge_pairs:
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
" -pair: {}, {}".format(round(a.Length, 4), round(b.Length, 4))
|
||||
)
|
||||
PathLog.debug(" -parallel_edge_flags: {}".format(parallel_edge_flags))
|
||||
Path.Log.debug(" -parallel_edge_flags: {}".format(parallel_edge_flags))
|
||||
|
||||
if pairCnt == 0:
|
||||
msg = translate("Path_Slot", "No parallel edges identified.")
|
||||
@@ -1104,7 +1103,7 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
|
||||
def _processSingleComplexFace(self, obj, shape):
|
||||
"""Determine slot path endpoints from a single complex face."""
|
||||
PathLog.debug("_processSingleComplexFace()")
|
||||
Path.Log.debug("_processSingleComplexFace()")
|
||||
pnts = list()
|
||||
|
||||
def zVal(p):
|
||||
@@ -1119,7 +1118,7 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
def _processSingleVertFace(self, obj, shape):
|
||||
"""Determine slot path endpoints from a single vertically oriented face
|
||||
with no single bottom edge."""
|
||||
PathLog.debug("_processSingleVertFace()")
|
||||
Path.Log.debug("_processSingleVertFace()")
|
||||
eCnt = len(shape.Edges)
|
||||
V0 = shape.Edges[0].Vertexes[0]
|
||||
V1 = shape.Edges[eCnt - 1].Vertexes[1]
|
||||
@@ -1149,7 +1148,7 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
|
||||
def _processSingleEdge(self, obj, edge):
|
||||
"""Determine slot path endpoints from a single horizontally oriented edge."""
|
||||
PathLog.debug("_processSingleEdge()")
|
||||
Path.Log.debug("_processSingleEdge()")
|
||||
tolrnc = 0.0000001
|
||||
lineTypes = ["Part::GeomLine"]
|
||||
curveTypes = ["Part::GeomCircle"]
|
||||
@@ -1180,7 +1179,7 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
# Circle radius (not used)
|
||||
# r = vP1P2.Length * vP2P3.Length * vP3P1.Length / 2 / l
|
||||
if round(L, 8) == 0.0:
|
||||
PathLog.error("The three points are colinear, arc is a straight.")
|
||||
Path.Log.error("The three points are colinear, arc is a straight.")
|
||||
return False
|
||||
|
||||
# Sphere center.
|
||||
@@ -1205,7 +1204,7 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
elif edge.Curve.TypeId in curveTypes:
|
||||
if len(edge.Vertexes) == 1:
|
||||
# Circle edge
|
||||
PathLog.debug("Arc with single vertex.")
|
||||
Path.Log.debug("Arc with single vertex.")
|
||||
if oversizedTool(edge.BoundBox.XLength):
|
||||
return False
|
||||
|
||||
@@ -1222,7 +1221,7 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
self.arcRadius = edge.BoundBox.XLength / 2.0
|
||||
else:
|
||||
# Arc edge
|
||||
PathLog.debug("Arc with multiple vertices.")
|
||||
Path.Log.debug("Arc with multiple vertices.")
|
||||
self.isArc = 2
|
||||
midPnt = edge.valueAt(edge.getParameterByLength(edge.Length / 2.0))
|
||||
if not isHorizontal(V1.Z, V2.Z, midPnt.z):
|
||||
@@ -1253,7 +1252,7 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
def _processDouble(self, obj, shape_1, sub1, shape_2, sub2):
|
||||
"""This is the control method for slots based on a
|
||||
two Base Geometry features."""
|
||||
PathLog.debug("_processDouble()")
|
||||
Path.Log.debug("_processDouble()")
|
||||
|
||||
p1 = None
|
||||
p2 = None
|
||||
@@ -1283,7 +1282,7 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
|
||||
# Parallel check for twin face, and face-edge cases
|
||||
if dYdX1 and dYdX2:
|
||||
PathLog.debug("dYdX1, dYdX2: {}, {}".format(dYdX1, dYdX2))
|
||||
Path.Log.debug("dYdX1, dYdX2: {}, {}".format(dYdX1, dYdX2))
|
||||
if not self._isParallel(dYdX1, dYdX2):
|
||||
if self.shapeType1 != "Edge" or self.shapeType2 != "Edge":
|
||||
msg = translate("Path_Slot", "Selected geometry not parallel.")
|
||||
@@ -1389,7 +1388,7 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
p = None
|
||||
dYdX = None
|
||||
cat = sub[:4]
|
||||
PathLog.debug("sub-feature is {}".format(cat))
|
||||
Path.Log.debug("sub-feature is {}".format(cat))
|
||||
Ref = getattr(obj, "Reference" + str(pNum))
|
||||
if cat == "Face":
|
||||
BE = self._getBottomEdge(shape)
|
||||
@@ -1488,7 +1487,7 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
2 * ExtRadians
|
||||
) # positive Ext lengthens slot so decrease start point angle
|
||||
|
||||
# PathLog.debug('begExt angles are: {}, {}'.format(beginRadians, math.degrees(beginRadians)))
|
||||
# Path.Log.debug('begExt angles are: {}, {}'.format(beginRadians, math.degrees(beginRadians)))
|
||||
|
||||
chord.rotate(origin, FreeCAD.Vector(0, 0, 1), math.degrees(beginRadians))
|
||||
chord.translate(self.arcCenter)
|
||||
@@ -1509,7 +1508,7 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
2 * ExtRadians
|
||||
) # negative Ext shortens slot so decrease end point angle
|
||||
|
||||
# PathLog.debug('endExt angles are: {}, {}'.format(endRadians, math.degrees(endRadians)))
|
||||
# Path.Log.debug('endExt angles are: {}, {}'.format(endRadians, math.degrees(endRadians)))
|
||||
|
||||
chord.rotate(origin, FreeCAD.Vector(0, 0, 1), math.degrees(endRadians))
|
||||
chord.translate(self.arcCenter)
|
||||
@@ -1773,7 +1772,7 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
|
||||
def _makeReference1Enumerations(self, sub, single=False):
|
||||
"""Customize Reference1 enumerations based on feature type."""
|
||||
PathLog.debug("_makeReference1Enumerations()")
|
||||
Path.Log.debug("_makeReference1Enumerations()")
|
||||
cat = sub[:4]
|
||||
if single:
|
||||
if cat == "Face":
|
||||
@@ -1789,7 +1788,7 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
|
||||
def _makeReference2Enumerations(self, sub):
|
||||
"""Customize Reference2 enumerations based on feature type."""
|
||||
PathLog.debug("_makeReference2Enumerations()")
|
||||
Path.Log.debug("_makeReference2Enumerations()")
|
||||
cat = sub[:4]
|
||||
if cat == "Vert":
|
||||
return ["Vertex"]
|
||||
@@ -1859,7 +1858,7 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
if cmn.Volume > 0.000001:
|
||||
return True
|
||||
except Exception:
|
||||
PathLog.debug("Failed to complete path collision check.")
|
||||
Path.Log.debug("Failed to complete path collision check.")
|
||||
|
||||
return False
|
||||
|
||||
@@ -1917,7 +1916,7 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
|
||||
# verify offset does not force radius < 0
|
||||
newRadius = arcRadius - rad
|
||||
# PathLog.debug('arcRadius, newRadius: {}, {}'.format(arcRadius, newRadius))
|
||||
# Path.Log.debug('arcRadius, newRadius: {}, {}'.format(arcRadius, newRadius))
|
||||
if newRadius <= 0:
|
||||
msg = translate(
|
||||
"Path_Slot", "Current offset value produces negative radius."
|
||||
@@ -1931,7 +1930,7 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
# Arc 2 - outside
|
||||
# verify offset does not force radius < 0
|
||||
newRadius = arcRadius + rad
|
||||
# PathLog.debug('arcRadius, newRadius: {}, {}'.format(arcRadius, newRadius))
|
||||
# Path.Log.debug('arcRadius, newRadius: {}, {}'.format(arcRadius, newRadius))
|
||||
if newRadius <= 0:
|
||||
msg = translate(
|
||||
"Path_Slot", "Current offset value produces negative radius."
|
||||
@@ -1975,7 +1974,7 @@ class ObjectSlot(PathOp.ObjectOp):
|
||||
# print("volume=", cmn.Volume)
|
||||
return True
|
||||
except Exception:
|
||||
PathLog.debug("Failed to complete path collision check.")
|
||||
Path.Log.debug("Failed to complete path collision check.")
|
||||
|
||||
return False
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
"""Used to create material stock around a machined part - for visualization"""
|
||||
|
||||
import FreeCAD
|
||||
import PathScripts.PathLog as PathLog
|
||||
import Path
|
||||
import math
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
from PySide import QtCore
|
||||
@@ -36,10 +36,10 @@ Part = LazyLoader("Part", globals(), "Part")
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
class StockType:
|
||||
@@ -69,7 +69,7 @@ class StockType:
|
||||
|
||||
|
||||
def shapeBoundBox(obj):
|
||||
PathLog.track(type(obj))
|
||||
Path.Log.track(type(obj))
|
||||
if list == type(obj) and obj:
|
||||
bb = FreeCAD.BoundBox()
|
||||
for o in obj:
|
||||
@@ -86,7 +86,7 @@ def shapeBoundBox(obj):
|
||||
bb = bb.united(b)
|
||||
return bb
|
||||
if obj:
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
translate("PathStock", "Invalid base object %s - no shape found") % obj.Name
|
||||
)
|
||||
return None
|
||||
@@ -185,7 +185,7 @@ class StockFromBase(Stock):
|
||||
FreeCAD.Vector(bb.XMin, bb.YMin, bb.ZMin), FreeCAD.Rotation()
|
||||
)
|
||||
else:
|
||||
PathLog.track(obj.Label, base.Label)
|
||||
Path.Log.track(obj.Label, base.Label)
|
||||
obj.Proxy = self
|
||||
|
||||
# debugging aids
|
||||
@@ -206,7 +206,7 @@ class StockFromBase(Stock):
|
||||
if obj.Base and hasattr(obj.Base, "Group")
|
||||
else None
|
||||
)
|
||||
PathLog.track(obj.Label, bb)
|
||||
Path.Log.track(obj.Label, bb)
|
||||
|
||||
# Sometimes, when the Base changes it's temporarily not assigned when
|
||||
# Stock.execute is triggered - it'll be set correctly the next time around.
|
||||
@@ -327,7 +327,7 @@ class StockCreateCylinder(Stock):
|
||||
|
||||
|
||||
def SetupStockObject(obj, stockType):
|
||||
PathLog.track(obj.Label, stockType)
|
||||
Path.Log.track(obj.Label, stockType)
|
||||
if FreeCAD.GuiUp and obj.ViewObject:
|
||||
obj.addProperty(
|
||||
"App::PropertyString",
|
||||
@@ -362,7 +362,7 @@ def _getBase(job):
|
||||
|
||||
|
||||
def CreateFromBase(job, neg=None, pos=None, placement=None):
|
||||
PathLog.track(job.Label, neg, pos, placement)
|
||||
Path.Log.track(job.Label, neg, pos, placement)
|
||||
base = _getBase(job)
|
||||
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython", "Stock")
|
||||
obj.Proxy = StockFromBase(obj, base)
|
||||
@@ -512,7 +512,7 @@ def CreateFromTemplate(job, template):
|
||||
or rotZ is not None
|
||||
or rotW is not None
|
||||
):
|
||||
PathLog.warning(
|
||||
Path.Log.warning(
|
||||
"Corrupted or incomplete placement information in template - ignoring"
|
||||
)
|
||||
|
||||
@@ -551,30 +551,30 @@ def CreateFromTemplate(job, template):
|
||||
or zneg is not None
|
||||
or zpos is not None
|
||||
):
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
"Corrupted or incomplete specification for creating stock from base - ignoring extent"
|
||||
)
|
||||
return CreateFromBase(job, neg, pos, placement)
|
||||
|
||||
if stockType == StockType.CreateBox:
|
||||
PathLog.track(" create box")
|
||||
Path.Log.track(" create box")
|
||||
length = template.get("length")
|
||||
width = template.get("width")
|
||||
height = template.get("height")
|
||||
extent = None
|
||||
if length is not None and width is not None and height is not None:
|
||||
PathLog.track(" have extent")
|
||||
Path.Log.track(" have extent")
|
||||
extent = FreeCAD.Vector(
|
||||
FreeCAD.Units.Quantity(length).Value,
|
||||
FreeCAD.Units.Quantity(width).Value,
|
||||
FreeCAD.Units.Quantity(height).Value,
|
||||
)
|
||||
elif length is not None or width is not None or height is not None:
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
"Corrupted or incomplete size for creating a stock box - ignoring size"
|
||||
)
|
||||
else:
|
||||
PathLog.track(
|
||||
Path.Log.track(
|
||||
" take placement (%s) and extent (%s) from model"
|
||||
% (placement, extent)
|
||||
)
|
||||
@@ -588,18 +588,18 @@ def CreateFromTemplate(job, template):
|
||||
elif radius is not None or height is not None:
|
||||
radius = None
|
||||
height = None
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
"Corrupted or incomplete size for creating a stock cylinder - ignoring size"
|
||||
)
|
||||
return CreateCylinder(job, radius, height, placement)
|
||||
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
translate("PathStock", "Unsupported stock type named {}").format(
|
||||
stockType
|
||||
)
|
||||
)
|
||||
else:
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
translate(
|
||||
"PathStock", "Unsupported PathStock template version {}"
|
||||
).format(template.get("version"))
|
||||
|
||||
@@ -47,7 +47,6 @@ except ImportError:
|
||||
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
import Path
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathOp as PathOp
|
||||
import PathScripts.PathSurfaceSupport as PathSurfaceSupport
|
||||
import PathScripts.PathUtils as PathUtils
|
||||
@@ -64,10 +63,10 @@ if FreeCAD.GuiUp:
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
class ObjectSurface(PathOp.ObjectOp):
|
||||
@@ -92,7 +91,7 @@ class ObjectSurface(PathOp.ObjectOp):
|
||||
self.initOpProperties(obj) # Initialize operation-specific properties
|
||||
|
||||
# For debugging
|
||||
if PathLog.getLevel(PathLog.thisModule()) != 4:
|
||||
if Path.Log.getLevel(Path.Log.thisModule()) != 4:
|
||||
obj.setEditorMode("ShowTempObjects", 2) # hide
|
||||
|
||||
if not hasattr(obj, "DoNotSetDefaultValues"):
|
||||
@@ -603,7 +602,7 @@ class ObjectSurface(PathOp.ObjectOp):
|
||||
self.initOpProperties(obj, warn=True)
|
||||
self.opApplyPropertyDefaults(obj, job, self.addNewProps)
|
||||
|
||||
mode = 2 if PathLog.getLevel(PathLog.thisModule()) != 4 else 0
|
||||
mode = 2 if Path.Log.getLevel(Path.Log.thisModule()) != 4 else 0
|
||||
obj.setEditorMode("ShowTempObjects", mode)
|
||||
|
||||
# Repopulate enumerations in case of changes
|
||||
@@ -645,11 +644,11 @@ class ObjectSurface(PathOp.ObjectOp):
|
||||
if job:
|
||||
if job.Stock:
|
||||
d = PathUtils.guessDepths(job.Stock.Shape, None)
|
||||
PathLog.debug("job.Stock exists")
|
||||
Path.Log.debug("job.Stock exists")
|
||||
else:
|
||||
PathLog.debug("job.Stock NOT exist")
|
||||
Path.Log.debug("job.Stock NOT exist")
|
||||
else:
|
||||
PathLog.debug("job NOT exist")
|
||||
Path.Log.debug("job NOT exist")
|
||||
|
||||
if d is not None:
|
||||
obj.OpFinalDepth.Value = d.final_depth
|
||||
@@ -658,8 +657,8 @@ class ObjectSurface(PathOp.ObjectOp):
|
||||
obj.OpFinalDepth.Value = -10
|
||||
obj.OpStartDepth.Value = 10
|
||||
|
||||
PathLog.debug("Default OpFinalDepth: {}".format(obj.OpFinalDepth.Value))
|
||||
PathLog.debug("Default OpStartDepth: {}".format(obj.OpStartDepth.Value))
|
||||
Path.Log.debug("Default OpFinalDepth: {}".format(obj.OpFinalDepth.Value))
|
||||
Path.Log.debug("Default OpStartDepth: {}".format(obj.OpStartDepth.Value))
|
||||
|
||||
def opApplyPropertyLimits(self, obj):
|
||||
"""opApplyPropertyLimits(obj) ... Apply necessary limits to user input property values before performing main operation."""
|
||||
@@ -684,20 +683,20 @@ class ObjectSurface(PathOp.ObjectOp):
|
||||
# Limit sample interval
|
||||
if obj.SampleInterval.Value < 0.0001:
|
||||
obj.SampleInterval.Value = 0.0001
|
||||
PathLog.error("Sample interval limits are 0.001 to 25.4 millimeters.")
|
||||
Path.Log.error("Sample interval limits are 0.001 to 25.4 millimeters.")
|
||||
|
||||
if obj.SampleInterval.Value > 25.4:
|
||||
obj.SampleInterval.Value = 25.4
|
||||
PathLog.error("Sample interval limits are 0.001 to 25.4 millimeters.")
|
||||
Path.Log.error("Sample interval limits are 0.001 to 25.4 millimeters.")
|
||||
|
||||
# Limit cut pattern angle
|
||||
if obj.CutPatternAngle < -360.0:
|
||||
obj.CutPatternAngle = 0.0
|
||||
PathLog.error("Cut pattern angle limits are +-360 degrees.")
|
||||
Path.Log.error("Cut pattern angle limits are +-360 degrees.")
|
||||
|
||||
if obj.CutPatternAngle >= 360.0:
|
||||
obj.CutPatternAngle = 0.0
|
||||
PathLog.error("Cut pattern angle limits are +- 360 degrees.")
|
||||
Path.Log.error("Cut pattern angle limits are +- 360 degrees.")
|
||||
|
||||
# Limit StepOver to natural number percentage
|
||||
if obj.StepOver > 100.0:
|
||||
@@ -708,11 +707,11 @@ class ObjectSurface(PathOp.ObjectOp):
|
||||
# Limit AvoidLastX_Faces to zero and positive values
|
||||
if obj.AvoidLastX_Faces < 0:
|
||||
obj.AvoidLastX_Faces = 0
|
||||
PathLog.error("AvoidLastX_Faces: Only zero or positive values permitted.")
|
||||
Path.Log.error("AvoidLastX_Faces: Only zero or positive values permitted.")
|
||||
|
||||
if obj.AvoidLastX_Faces > 100:
|
||||
obj.AvoidLastX_Faces = 100
|
||||
PathLog.error("AvoidLastX_Faces: Avoid last X faces count limited to 100.")
|
||||
Path.Log.error("AvoidLastX_Faces: Avoid last X faces count limited to 100.")
|
||||
|
||||
def opUpdateDepths(self, obj):
|
||||
if hasattr(obj, "Base") and obj.Base:
|
||||
@@ -725,7 +724,7 @@ class ObjectSurface(PathOp.ObjectOp):
|
||||
fbb = base.Shape.getElement(sub).BoundBox
|
||||
zmin = min(zmin, fbb.ZMin)
|
||||
except Part.OCCError as e:
|
||||
PathLog.error(e)
|
||||
Path.Log.error(e)
|
||||
obj.OpFinalDepth = zmin
|
||||
elif self.job:
|
||||
if hasattr(obj, "BoundBox"):
|
||||
@@ -741,7 +740,7 @@ class ObjectSurface(PathOp.ObjectOp):
|
||||
|
||||
def opExecute(self, obj):
|
||||
"""opExecute(obj) ... process surface operation"""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
|
||||
self.modelSTLs = []
|
||||
self.safeSTLs = []
|
||||
@@ -771,7 +770,7 @@ class ObjectSurface(PathOp.ObjectOp):
|
||||
self.showDebugObjects = False # Set to true if you want a visual DocObjects created for some path construction objects
|
||||
self.showDebugObjects = obj.ShowTempObjects
|
||||
deleteTempsFlag = True # Set to False for debugging
|
||||
if PathLog.getLevel(PathLog.thisModule()) == 4:
|
||||
if Path.Log.getLevel(Path.Log.thisModule()) == 4:
|
||||
deleteTempsFlag = False
|
||||
else:
|
||||
self.showDebugObjects = False
|
||||
@@ -783,7 +782,7 @@ class ObjectSurface(PathOp.ObjectOp):
|
||||
JOB = PathUtils.findParentJob(obj)
|
||||
self.JOB = JOB
|
||||
if JOB is None:
|
||||
PathLog.error(translate("PathSurface", "No JOB"))
|
||||
Path.Log.error(translate("PathSurface", "No JOB"))
|
||||
return
|
||||
self.stockZMin = JOB.Stock.Shape.BoundBox.ZMin
|
||||
|
||||
@@ -803,7 +802,7 @@ class ObjectSurface(PathOp.ObjectOp):
|
||||
oclTool = PathSurfaceSupport.OCL_Tool(ocl, obj)
|
||||
self.cutter = oclTool.getOclTool()
|
||||
if not self.cutter:
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
translate(
|
||||
"PathSurface",
|
||||
"Canceling 3D Surface operation. Error creating OCL cutter.",
|
||||
@@ -933,12 +932,12 @@ class ObjectSurface(PathOp.ObjectOp):
|
||||
self.profileShapes = PSF.profileShapes
|
||||
|
||||
for idx, model in enumerate(JOB.Model.Group):
|
||||
PathLog.debug(idx)
|
||||
Path.Log.debug(idx)
|
||||
# Create OCL.stl model objects
|
||||
PathSurfaceSupport._prepareModelSTLs(self, JOB, obj, idx, ocl)
|
||||
|
||||
if FACES[idx]:
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"Working on Model.Group[{}]: {}".format(idx, model.Label)
|
||||
)
|
||||
if idx > 0:
|
||||
@@ -963,12 +962,12 @@ class ObjectSurface(PathOp.ObjectOp):
|
||||
self._processCutAreas(JOB, obj, idx, FACES[idx], VOIDS[idx])
|
||||
)
|
||||
else:
|
||||
PathLog.debug("No data for model base: {}".format(model.Label))
|
||||
Path.Log.debug("No data for model base: {}".format(model.Label))
|
||||
|
||||
# Save gcode produced
|
||||
self.commandlist.extend(CMDS)
|
||||
else:
|
||||
PathLog.error("Failed to pre-process model and/or selected face(s).")
|
||||
Path.Log.error("Failed to pre-process model and/or selected face(s).")
|
||||
|
||||
# ###### CLOSING COMMANDS FOR OPERATION ######
|
||||
|
||||
@@ -1055,7 +1054,7 @@ class ObjectSurface(PathOp.ObjectOp):
|
||||
"""_processCutAreas(JOB, obj, mdlIdx, FCS, VDS)...
|
||||
This method applies any avoided faces or regions to the selected faces.
|
||||
It then calls the correct scan method depending on the ScanType property."""
|
||||
PathLog.debug("_processCutAreas()")
|
||||
Path.Log.debug("_processCutAreas()")
|
||||
|
||||
final = []
|
||||
|
||||
@@ -1108,7 +1107,7 @@ class ObjectSurface(PathOp.ObjectOp):
|
||||
It makes the necessary facial geometries for the actual cut area.
|
||||
It calls the correct Single or Multi-pass method as needed.
|
||||
It returns the gcode for the operation."""
|
||||
PathLog.debug("_processPlanarOp()")
|
||||
Path.Log.debug("_processPlanarOp()")
|
||||
final = []
|
||||
SCANDATA = []
|
||||
|
||||
@@ -1144,14 +1143,14 @@ class ObjectSurface(PathOp.ObjectOp):
|
||||
prflShp = self.profileShapes[mdlIdx][fsi]
|
||||
if prflShp is False:
|
||||
msg = translate("PathSurface", "No profile geometry shape returned.")
|
||||
PathLog.error(msg)
|
||||
Path.Log.error(msg)
|
||||
return []
|
||||
self.showDebugObject(prflShp, "NewProfileShape")
|
||||
# get offset path geometry and perform OCL scan with that geometry
|
||||
pathOffsetGeom = self._offsetFacesToPointData(obj, prflShp)
|
||||
if pathOffsetGeom is False:
|
||||
msg = translate("PathSurface", "No profile path geometry returned.")
|
||||
PathLog.error(msg)
|
||||
Path.Log.error(msg)
|
||||
return []
|
||||
profScan = [self._planarPerformOclScan(obj, pdc, pathOffsetGeom, True)]
|
||||
|
||||
@@ -1166,7 +1165,7 @@ class ObjectSurface(PathOp.ObjectOp):
|
||||
pathGeom = PGG.generatePathGeometry()
|
||||
if pathGeom is False:
|
||||
msg = translate("PathSurface", "No clearing shape returned.")
|
||||
PathLog.error(msg)
|
||||
Path.Log.error(msg)
|
||||
return []
|
||||
if obj.CutPattern == "Offset":
|
||||
useGeom = self._offsetFacesToPointData(obj, pathGeom, profile=False)
|
||||
@@ -1174,7 +1173,7 @@ class ObjectSurface(PathOp.ObjectOp):
|
||||
msg = translate(
|
||||
"PathSurface", "No clearing path geometry returned."
|
||||
)
|
||||
PathLog.error(msg)
|
||||
Path.Log.error(msg)
|
||||
return []
|
||||
geoScan = [self._planarPerformOclScan(obj, pdc, useGeom, True)]
|
||||
else:
|
||||
@@ -1194,7 +1193,7 @@ class ObjectSurface(PathOp.ObjectOp):
|
||||
|
||||
if len(SCANDATA) == 0:
|
||||
msg = translate("PathSurface", "No scan data to convert to Gcode.")
|
||||
PathLog.error(msg)
|
||||
Path.Log.error(msg)
|
||||
return []
|
||||
|
||||
# Apply depth offset
|
||||
@@ -1230,7 +1229,7 @@ class ObjectSurface(PathOp.ObjectOp):
|
||||
return final
|
||||
|
||||
def _offsetFacesToPointData(self, obj, subShp, profile=True):
|
||||
PathLog.debug("_offsetFacesToPointData()")
|
||||
Path.Log.debug("_offsetFacesToPointData()")
|
||||
|
||||
offsetLists = []
|
||||
dist = obj.SampleInterval.Value / 5.0
|
||||
@@ -1263,7 +1262,7 @@ class ObjectSurface(PathOp.ObjectOp):
|
||||
"""_planarPerformOclScan(obj, pdc, pathGeom, offsetPoints=False)...
|
||||
Switching function for calling the appropriate path-geometry to OCL points conversion function
|
||||
for the various cut patterns."""
|
||||
PathLog.debug("_planarPerformOclScan()")
|
||||
Path.Log.debug("_planarPerformOclScan()")
|
||||
SCANS = []
|
||||
|
||||
if offsetPoints or obj.CutPattern == "Offset":
|
||||
@@ -1375,7 +1374,7 @@ class ObjectSurface(PathOp.ObjectOp):
|
||||
|
||||
# Main planar scan functions
|
||||
def _planarDropCutSingle(self, JOB, obj, pdc, safePDC, depthparams, SCANDATA):
|
||||
PathLog.debug("_planarDropCutSingle()")
|
||||
Path.Log.debug("_planarDropCutSingle()")
|
||||
|
||||
GCODE = [Path.Command("N (Beginning of Single-pass layer.)", {})]
|
||||
tolrnc = JOB.GeometryTolerance.Value
|
||||
@@ -1513,7 +1512,7 @@ class ObjectSurface(PathOp.ObjectOp):
|
||||
# lastPrvStpLast = prvStpLast
|
||||
prvStpLast = None
|
||||
lyrDep = depthparams[lyr]
|
||||
PathLog.debug("Multi-pass lyrDep: {}".format(round(lyrDep, 4)))
|
||||
Path.Log.debug("Multi-pass lyrDep: {}".format(round(lyrDep, 4)))
|
||||
|
||||
# Cycle through step-over sections (line segments or arcs)
|
||||
for so in range(0, len(SCANDATA)):
|
||||
@@ -1676,7 +1675,7 @@ class ObjectSurface(PathOp.ObjectOp):
|
||||
prevDepth = lyrDep
|
||||
# Efor
|
||||
|
||||
PathLog.debug("Multi-pass op has {} layers (step downs).".format(lyr + 1))
|
||||
Path.Log.debug("Multi-pass op has {} layers (step downs).".format(lyr + 1))
|
||||
|
||||
return GCODE
|
||||
|
||||
@@ -1877,9 +1876,9 @@ class ObjectSurface(PathOp.ObjectOp):
|
||||
stepDown = obj.StepDown.Value if hasattr(obj, "StepDown") else 0
|
||||
rtpd = min(height, p2.z + stepDown + 2)
|
||||
elif not p1:
|
||||
PathLog.debug("_stepTransitionCmds() p1 is None")
|
||||
Path.Log.debug("_stepTransitionCmds() p1 is None")
|
||||
elif not p2:
|
||||
PathLog.debug("_stepTransitionCmds() p2 is None")
|
||||
Path.Log.debug("_stepTransitionCmds() p2 is None")
|
||||
|
||||
# Create raise, shift, and optional lower commands
|
||||
if height is not False:
|
||||
@@ -2025,7 +2024,7 @@ class ObjectSurface(PathOp.ObjectOp):
|
||||
return (coPlanar, cmds)
|
||||
|
||||
def _planarApplyDepthOffset(self, SCANDATA, DepthOffset):
|
||||
PathLog.debug("Applying DepthOffset value: {}".format(DepthOffset))
|
||||
Path.Log.debug("Applying DepthOffset value: {}".format(DepthOffset))
|
||||
lenScans = len(SCANDATA)
|
||||
for s in range(0, lenScans):
|
||||
SO = SCANDATA[s] # StepOver
|
||||
@@ -2047,7 +2046,7 @@ class ObjectSurface(PathOp.ObjectOp):
|
||||
|
||||
# Main rotational scan functions
|
||||
def _processRotationalOp(self, JOB, obj, mdlIdx, compoundFaces=None):
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"_processRotationalOp(self, JOB, obj, mdlIdx, compoundFaces=None)"
|
||||
)
|
||||
|
||||
@@ -2138,7 +2137,7 @@ class ObjectSurface(PathOp.ObjectOp):
|
||||
line
|
||||
) in scanLines: # extract circular set(ring) of points from scan lines
|
||||
if len(line) != numPnts:
|
||||
PathLog.debug("Error: line lengths not equal")
|
||||
Path.Log.debug("Error: line lengths not equal")
|
||||
return rngs
|
||||
|
||||
for num in range(0, numPnts):
|
||||
@@ -2301,7 +2300,7 @@ class ObjectSurface(PathOp.ObjectOp):
|
||||
|
||||
prevDepth = layDep
|
||||
lCnt += 1 # increment layer count
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"--Layer "
|
||||
+ str(lCnt)
|
||||
+ ": "
|
||||
@@ -2330,7 +2329,7 @@ class ObjectSurface(PathOp.ObjectOp):
|
||||
# if self.useTiltCutter == True:
|
||||
if obj.CutterTilt != 0.0:
|
||||
cutterOfst = layDep * math.sin(math.radians(obj.CutterTilt))
|
||||
PathLog.debug("CutterTilt: cutterOfst is " + str(cutterOfst))
|
||||
Path.Log.debug("CutterTilt: cutterOfst is " + str(cutterOfst))
|
||||
|
||||
sumAdv = 0.0
|
||||
for adv in advances:
|
||||
@@ -2686,7 +2685,7 @@ class ObjectSurface(PathOp.ObjectOp):
|
||||
if FR != 0.0:
|
||||
FR += 2.0
|
||||
|
||||
PathLog.debug("ToolType: {}".format(obj.ToolController.Tool.ToolType))
|
||||
Path.Log.debug("ToolType: {}".format(obj.ToolController.Tool.ToolType))
|
||||
if obj.ToolController.Tool.ToolType == "EndMill":
|
||||
# Standard End Mill
|
||||
return ocl.CylCutter(diam_1, (CEH + lenOfst))
|
||||
@@ -2716,7 +2715,7 @@ class ObjectSurface(PathOp.ObjectOp):
|
||||
return ocl.ConeCutter(diam_1, (CEA / 2), lenOfst)
|
||||
else:
|
||||
# Default to standard end mill
|
||||
PathLog.warning("Defaulting cutter to standard end mill.")
|
||||
Path.Log.warning("Defaulting cutter to standard end mill.")
|
||||
return ocl.CylCutter(diam_1, (CEH + lenOfst))
|
||||
|
||||
def _getTransitionLine(self, pdc, p1, p2, obj):
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
from PySide import QtCore
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import PathScripts.PathLog as PathLog
|
||||
import Path
|
||||
import PathGui as PGui # ensure Path/Gui/Resources are loaded
|
||||
import PathScripts.PathGui as PathGui
|
||||
import PathScripts.PathOpGui as PathOpGui
|
||||
@@ -38,10 +38,10 @@ __doc__ = "Surface operation page controller and command implementation."
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
class TaskPanelOpPage(PathOpGui.TaskPanelPage):
|
||||
|
||||
@@ -29,7 +29,7 @@ __doc__ = "Support functions and classes for 3D Surface and Waterline operations
|
||||
__contributors__ = ""
|
||||
|
||||
import FreeCAD
|
||||
import PathScripts.PathLog as PathLog
|
||||
import Path
|
||||
import PathScripts.PathUtils as PathUtils
|
||||
import PathScripts.PathOpTools as PathOpTools
|
||||
import math
|
||||
@@ -42,10 +42,10 @@ Part = LazyLoader("Part", globals(), "Part")
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
@@ -225,7 +225,7 @@ class PathGeometryGenerator:
|
||||
if minRad < minRadSI:
|
||||
minRad = minRadSI
|
||||
|
||||
PathLog.debug(" -centerOfPattern: {}".format(self.centerOfPattern))
|
||||
Path.Log.debug(" -centerOfPattern: {}".format(self.centerOfPattern))
|
||||
# Make small center circle to start pattern
|
||||
if self.obj.StepOver > 50:
|
||||
circle = Part.makeCircle(minRad, self.centerOfPattern)
|
||||
@@ -418,7 +418,7 @@ class PathGeometryGenerator:
|
||||
return FreeCAD.Vector(-1 * x, y, 0.0).add(move)
|
||||
|
||||
def _extractOffsetFaces(self):
|
||||
PathLog.debug("_extractOffsetFaces()")
|
||||
Path.Log.debug("_extractOffsetFaces()")
|
||||
wires = []
|
||||
shape = self.shape
|
||||
offset = 0.0 # Start right at the edge of cut area
|
||||
@@ -548,7 +548,7 @@ class ProcessSelectedFaces:
|
||||
self.showDebugObjects = val
|
||||
|
||||
def preProcessModel(self, module):
|
||||
PathLog.debug("preProcessModel()")
|
||||
Path.Log.debug("preProcessModel()")
|
||||
|
||||
if not self._isReady(module):
|
||||
return False
|
||||
@@ -570,7 +570,7 @@ class ProcessSelectedFaces:
|
||||
|
||||
# The user has selected subobjects from the base. Pre-Process each.
|
||||
if self.checkBase:
|
||||
PathLog.debug(" -obj.Base exists. Pre-processing for selected faces.")
|
||||
Path.Log.debug(" -obj.Base exists. Pre-processing for selected faces.")
|
||||
|
||||
(hasFace, hasVoid) = self._identifyFacesAndVoids(
|
||||
FACES, VOIDS
|
||||
@@ -591,14 +591,14 @@ class ProcessSelectedFaces:
|
||||
if hasGeometry and not proceed:
|
||||
return False
|
||||
else:
|
||||
PathLog.debug(" -No obj.Base data.")
|
||||
Path.Log.debug(" -No obj.Base data.")
|
||||
for m in range(0, lenGRP):
|
||||
self.modelSTLs[m] = True
|
||||
|
||||
# Process each model base, as a whole, as needed
|
||||
for m in range(0, lenGRP):
|
||||
if self.modelSTLs[m] and not fShapes[m]:
|
||||
PathLog.debug(" -Pre-processing {} as a whole.".format(GRP[m].Label))
|
||||
Path.Log.debug(" -Pre-processing {} as a whole.".format(GRP[m].Label))
|
||||
if self.obj.BoundBox == "BaseBoundBox":
|
||||
base = GRP[m]
|
||||
elif self.obj.BoundBox == "Stock":
|
||||
@@ -618,24 +618,24 @@ class ProcessSelectedFaces:
|
||||
(fcShp, prflShp) = pPEB
|
||||
if fcShp:
|
||||
if fcShp is True:
|
||||
PathLog.debug(" -fcShp is True.")
|
||||
Path.Log.debug(" -fcShp is True.")
|
||||
fShapes[m] = True
|
||||
else:
|
||||
fShapes[m] = [fcShp]
|
||||
if prflShp:
|
||||
if fcShp:
|
||||
PathLog.debug("vShapes[{}]: {}".format(m, vShapes[m]))
|
||||
Path.Log.debug("vShapes[{}]: {}".format(m, vShapes[m]))
|
||||
if vShapes[m]:
|
||||
PathLog.debug(" -Cutting void from base profile shape.")
|
||||
Path.Log.debug(" -Cutting void from base profile shape.")
|
||||
adjPS = prflShp.cut(vShapes[m][0])
|
||||
self.profileShapes[m] = [adjPS]
|
||||
else:
|
||||
PathLog.debug(" -vShapes[m] is False.")
|
||||
Path.Log.debug(" -vShapes[m] is False.")
|
||||
self.profileShapes[m] = [prflShp]
|
||||
else:
|
||||
PathLog.debug(" -Saving base profile shape.")
|
||||
Path.Log.debug(" -Saving base profile shape.")
|
||||
self.profileShapes[m] = [prflShp]
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"self.profileShapes[{}]: {}".format(
|
||||
m, self.profileShapes[m]
|
||||
)
|
||||
@@ -648,21 +648,21 @@ class ProcessSelectedFaces:
|
||||
def _isReady(self, module):
|
||||
"""_isReady(module)... Internal method.
|
||||
Checks if required attributes are available for processing obj.Base (the Base Geometry)."""
|
||||
PathLog.debug("ProcessSelectedFaces _isReady({})".format(module))
|
||||
Path.Log.debug("ProcessSelectedFaces _isReady({})".format(module))
|
||||
if hasattr(self, module):
|
||||
self.module = module
|
||||
modMethod = getattr(self, module) # gets the attribute only
|
||||
modMethod() # executes as method
|
||||
else:
|
||||
PathLog.error('PSF._isReady() no "{}" method.'.format(module))
|
||||
Path.Log.error('PSF._isReady() no "{}" method.'.format(module))
|
||||
return False
|
||||
|
||||
if not self.radius:
|
||||
PathLog.error("PSF._isReady() no cutter radius available.")
|
||||
Path.Log.error("PSF._isReady() no cutter radius available.")
|
||||
return False
|
||||
|
||||
if not self.depthParams:
|
||||
PathLog.error("PSF._isReady() no depth params available.")
|
||||
Path.Log.error("PSF._isReady() no depth params available.")
|
||||
return False
|
||||
|
||||
return True
|
||||
@@ -698,13 +698,13 @@ class ProcessSelectedFaces:
|
||||
if F[m] is False:
|
||||
F[m] = []
|
||||
F[m].append((shape, faceIdx))
|
||||
PathLog.debug(".. Cutting {}".format(sub))
|
||||
Path.Log.debug(".. Cutting {}".format(sub))
|
||||
hasFace = True
|
||||
else:
|
||||
if V[m] is False:
|
||||
V[m] = []
|
||||
V[m].append((shape, faceIdx))
|
||||
PathLog.debug(".. Avoiding {}".format(sub))
|
||||
Path.Log.debug(".. Avoiding {}".format(sub))
|
||||
hasVoid = True
|
||||
return (hasFace, hasVoid)
|
||||
|
||||
@@ -718,7 +718,7 @@ class ProcessSelectedFaces:
|
||||
isHole = False
|
||||
if self.obj.HandleMultipleFeatures == "Collectively":
|
||||
cont = True
|
||||
PathLog.debug("Attempting to get cross-section of collective faces.")
|
||||
Path.Log.debug("Attempting to get cross-section of collective faces.")
|
||||
outFCS, ifL = self.findUnifiedRegions(FCS)
|
||||
if self.obj.InternalFeaturesCut and ifL:
|
||||
ifL = [] # clear avoid shape list
|
||||
@@ -732,7 +732,7 @@ class ProcessSelectedFaces:
|
||||
|
||||
# Handle profile edges request
|
||||
if cont and self.profileEdges != "None":
|
||||
PathLog.debug(".. include Profile Edge")
|
||||
Path.Log.debug(".. include Profile Edge")
|
||||
ofstVal = self._calculateOffsetValue(isHole)
|
||||
psOfst = PathUtils.getOffsetArea(cfsL, ofstVal, plane=self.wpc)
|
||||
if psOfst:
|
||||
@@ -763,7 +763,7 @@ class ProcessSelectedFaces:
|
||||
lenIfL = len(ifL)
|
||||
if not self.obj.InternalFeaturesCut:
|
||||
if lenIfL == 0:
|
||||
PathLog.debug(" -No internal features saved.")
|
||||
Path.Log.debug(" -No internal features saved.")
|
||||
else:
|
||||
if lenIfL == 1:
|
||||
casL = ifL[0]
|
||||
@@ -798,7 +798,7 @@ class ProcessSelectedFaces:
|
||||
ifL = [] # avoid shape list
|
||||
|
||||
if outerFace:
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"Attempting to create offset face of Face{}".format(fNum)
|
||||
)
|
||||
|
||||
@@ -854,7 +854,7 @@ class ProcessSelectedFaces:
|
||||
mVS.append(ifs)
|
||||
|
||||
if VDS:
|
||||
PathLog.debug("Processing avoid faces.")
|
||||
Path.Log.debug("Processing avoid faces.")
|
||||
cont = True
|
||||
isHole = False
|
||||
|
||||
@@ -928,7 +928,7 @@ class ProcessSelectedFaces:
|
||||
partshape=base.Shape, subshape=None, depthparams=self.depthParams
|
||||
) # Produces .Shape
|
||||
except Exception as ee:
|
||||
PathLog.error(str(ee))
|
||||
Path.Log.error(str(ee))
|
||||
shell = base.Shape.Shells[0]
|
||||
solid = Part.makeSolid(shell)
|
||||
try:
|
||||
@@ -936,7 +936,7 @@ class ProcessSelectedFaces:
|
||||
partshape=solid, subshape=None, depthparams=self.depthParams
|
||||
) # Produces .Shape
|
||||
except Exception as eee:
|
||||
PathLog.error(str(eee))
|
||||
Path.Log.error(str(eee))
|
||||
cont = False
|
||||
|
||||
if cont:
|
||||
@@ -946,11 +946,11 @@ class ProcessSelectedFaces:
|
||||
if csFaceShape is False:
|
||||
csFaceShape = getSliceFromEnvelope(baseEnv)
|
||||
if csFaceShape is False:
|
||||
PathLog.debug("Failed to slice baseEnv shape.")
|
||||
Path.Log.debug("Failed to slice baseEnv shape.")
|
||||
cont = False
|
||||
|
||||
if cont and self.profileEdges != "None":
|
||||
PathLog.debug(" -Attempting profile geometry for model base.")
|
||||
Path.Log.debug(" -Attempting profile geometry for model base.")
|
||||
ofstVal = self._calculateOffsetValue(isHole)
|
||||
psOfst = PathUtils.getOffsetArea(csFaceShape, ofstVal, plane=self.wpc)
|
||||
if psOfst:
|
||||
@@ -966,7 +966,7 @@ class ProcessSelectedFaces:
|
||||
csFaceShape, ofstVal, plane=self.wpc
|
||||
)
|
||||
if faceOffsetShape is False:
|
||||
PathLog.debug("getOffsetArea() failed for entire base.")
|
||||
Path.Log.debug("getOffsetArea() failed for entire base.")
|
||||
else:
|
||||
faceOffsetShape.translate(
|
||||
FreeCAD.Vector(0.0, 0.0, 0.0 - faceOffsetShape.BoundBox.ZMin)
|
||||
@@ -1005,7 +1005,7 @@ class ProcessSelectedFaces:
|
||||
def findUnifiedRegions(self, shapeAndIndexTuples, useAreaImplementation=True):
|
||||
"""Wrapper around area and wire based region unification
|
||||
implementations."""
|
||||
PathLog.debug("findUnifiedRegions()")
|
||||
Path.Log.debug("findUnifiedRegions()")
|
||||
# Allow merging of faces within the LinearDeflection tolerance.
|
||||
tolerance = self.obj.LinearDeflection.Value
|
||||
# Default: normal to Z=1 (XY plane), at Z=0
|
||||
@@ -1038,7 +1038,7 @@ class ProcessSelectedFaces:
|
||||
internalFaces = Part.makeCompound(internalFaces)
|
||||
return ([outlineShape], [internalFaces])
|
||||
except Exception as e:
|
||||
PathLog.warning(
|
||||
Path.Log.warning(
|
||||
"getOffsetArea failed: {}; Using FindUnifiedRegions.".format(e)
|
||||
)
|
||||
# Use face-unifying class
|
||||
@@ -1053,14 +1053,14 @@ class ProcessSelectedFaces:
|
||||
|
||||
# Functions for getting a shape envelope and cross-section
|
||||
def getExtrudedShape(wire):
|
||||
PathLog.debug("getExtrudedShape()")
|
||||
Path.Log.debug("getExtrudedShape()")
|
||||
wBB = wire.BoundBox
|
||||
extFwd = math.floor(2.0 * wBB.ZLength) + 10.0
|
||||
|
||||
try:
|
||||
shell = wire.extrude(FreeCAD.Vector(0.0, 0.0, extFwd))
|
||||
except Exception as ee:
|
||||
PathLog.error(" -extrude wire failed: \n{}".format(ee))
|
||||
Path.Log.error(" -extrude wire failed: \n{}".format(ee))
|
||||
return False
|
||||
|
||||
SHP = Part.makeSolid(shell)
|
||||
@@ -1068,7 +1068,7 @@ def getExtrudedShape(wire):
|
||||
|
||||
|
||||
def getShapeSlice(shape):
|
||||
PathLog.debug("getShapeSlice()")
|
||||
Path.Log.debug("getShapeSlice()")
|
||||
|
||||
bb = shape.BoundBox
|
||||
mid = (bb.ZMin + bb.ZMax) / 2.0
|
||||
@@ -1096,7 +1096,7 @@ def getShapeSlice(shape):
|
||||
if slcArea < midArea:
|
||||
for W in slcShp.Wires:
|
||||
if W.isClosed() is False:
|
||||
PathLog.debug(" -wire.isClosed() is False")
|
||||
Path.Log.debug(" -wire.isClosed() is False")
|
||||
return False
|
||||
if len(slcShp.Wires) == 1:
|
||||
wire = slcShp.Wires[0]
|
||||
@@ -1118,7 +1118,7 @@ def getShapeSlice(shape):
|
||||
def getProjectedFace(tempGroup, wire):
|
||||
import Draft
|
||||
|
||||
PathLog.debug("getProjectedFace()")
|
||||
Path.Log.debug("getProjectedFace()")
|
||||
F = FreeCAD.ActiveDocument.addObject("Part::Feature", "tmpProjectionWire")
|
||||
F.Shape = wire
|
||||
F.purgeTouched()
|
||||
@@ -1129,7 +1129,7 @@ def getProjectedFace(tempGroup, wire):
|
||||
prj.purgeTouched()
|
||||
tempGroup.addObject(prj)
|
||||
except Exception as ee:
|
||||
PathLog.error(str(ee))
|
||||
Path.Log.error(str(ee))
|
||||
return False
|
||||
else:
|
||||
pWire = Part.Wire(prj.Shape.Edges)
|
||||
@@ -1141,7 +1141,7 @@ def getProjectedFace(tempGroup, wire):
|
||||
|
||||
|
||||
def getCrossSection(shape):
|
||||
PathLog.debug("getCrossSection()")
|
||||
Path.Log.debug("getCrossSection()")
|
||||
wires = []
|
||||
bb = shape.BoundBox
|
||||
mid = (bb.ZMin + bb.ZMax) / 2.0
|
||||
@@ -1154,19 +1154,19 @@ def getCrossSection(shape):
|
||||
comp.translate(FreeCAD.Vector(0.0, 0.0, 0.0 - comp.BoundBox.ZMin))
|
||||
csWire = comp.Wires[0]
|
||||
if csWire.isClosed() is False:
|
||||
PathLog.debug(" -comp.Wires[0] is not closed")
|
||||
Path.Log.debug(" -comp.Wires[0] is not closed")
|
||||
return False
|
||||
CS = Part.Face(csWire)
|
||||
CS.translate(FreeCAD.Vector(0.0, 0.0, 0.0 - CS.BoundBox.ZMin))
|
||||
return CS
|
||||
else:
|
||||
PathLog.debug(" -No wires from .slice() method")
|
||||
Path.Log.debug(" -No wires from .slice() method")
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def getShapeEnvelope(shape):
|
||||
PathLog.debug("getShapeEnvelope()")
|
||||
Path.Log.debug("getShapeEnvelope()")
|
||||
|
||||
wBB = shape.BoundBox
|
||||
extFwd = wBB.ZLength + 10.0
|
||||
@@ -1187,7 +1187,7 @@ def getShapeEnvelope(shape):
|
||||
|
||||
|
||||
def getSliceFromEnvelope(env):
|
||||
PathLog.debug("getSliceFromEnvelope()")
|
||||
Path.Log.debug("getSliceFromEnvelope()")
|
||||
eBB = env.BoundBox
|
||||
extFwd = eBB.ZLength + 10.0
|
||||
maxz = eBB.ZMin + extFwd
|
||||
@@ -1217,7 +1217,7 @@ def _makeSafeSTL(self, JOB, obj, mdlIdx, faceShapes, voidShapes, ocl):
|
||||
Creates and OCL.stl object with combined data with waste stock,
|
||||
model, and avoided faces. Travel lines can be checked against this
|
||||
STL object to determine minimum travel height to clear stock and model."""
|
||||
PathLog.debug("_makeSafeSTL()")
|
||||
Path.Log.debug("_makeSafeSTL()")
|
||||
|
||||
fuseShapes = []
|
||||
Mdl = JOB.Model.Group[mdlIdx]
|
||||
@@ -1243,7 +1243,7 @@ def _makeSafeSTL(self, JOB, obj, mdlIdx, faceShapes, voidShapes, ocl):
|
||||
) # Produces .Shape
|
||||
cont = True
|
||||
except Exception as ee:
|
||||
PathLog.error(str(ee))
|
||||
Path.Log.error(str(ee))
|
||||
shell = Mdl.Shape.Shells[0]
|
||||
solid = Part.makeSolid(shell)
|
||||
try:
|
||||
@@ -1252,7 +1252,7 @@ def _makeSafeSTL(self, JOB, obj, mdlIdx, faceShapes, voidShapes, ocl):
|
||||
) # Produces .Shape
|
||||
cont = True
|
||||
except Exception as eee:
|
||||
PathLog.error(str(eee))
|
||||
Path.Log.error(str(eee))
|
||||
|
||||
if cont:
|
||||
stckWst = JOB.Stock.Shape.cut(envBB)
|
||||
@@ -1330,7 +1330,7 @@ def _makeSTL(model, obj, ocl, model_type=None):
|
||||
def pathGeomToLinesPointSet(self, obj, compGeoShp):
|
||||
"""pathGeomToLinesPointSet(self, obj, compGeoShp)...
|
||||
Convert a compound set of sequential line segments to directionally-oriented collinear groupings."""
|
||||
PathLog.debug("pathGeomToLinesPointSet()")
|
||||
Path.Log.debug("pathGeomToLinesPointSet()")
|
||||
# Extract intersection line segments for return value as []
|
||||
LINES = []
|
||||
inLine = []
|
||||
@@ -1426,9 +1426,9 @@ def pathGeomToLinesPointSet(self, obj, compGeoShp):
|
||||
|
||||
isEven = lnCnt % 2
|
||||
if isEven == 0:
|
||||
PathLog.debug("Line count is ODD: {}.".format(lnCnt))
|
||||
Path.Log.debug("Line count is ODD: {}.".format(lnCnt))
|
||||
else:
|
||||
PathLog.debug("Line count is even: {}.".format(lnCnt))
|
||||
Path.Log.debug("Line count is even: {}.".format(lnCnt))
|
||||
|
||||
return LINES
|
||||
|
||||
@@ -1437,7 +1437,7 @@ def pathGeomToZigzagPointSet(self, obj, compGeoShp):
|
||||
"""_pathGeomToZigzagPointSet(self, obj, compGeoShp)...
|
||||
Convert a compound set of sequential line segments to directionally-oriented collinear groupings
|
||||
with a ZigZag directional indicator included for each collinear group."""
|
||||
PathLog.debug("_pathGeomToZigzagPointSet()")
|
||||
Path.Log.debug("_pathGeomToZigzagPointSet()")
|
||||
# Extract intersection line segments for return value as []
|
||||
LINES = []
|
||||
inLine = []
|
||||
@@ -1516,9 +1516,9 @@ def pathGeomToZigzagPointSet(self, obj, compGeoShp):
|
||||
# Fix directional issue with LAST line when line count is even
|
||||
isEven = lnCnt % 2
|
||||
if isEven == 0: # Changed to != with 90 degree CutPatternAngle
|
||||
PathLog.debug("Line count is even: {}.".format(lnCnt))
|
||||
Path.Log.debug("Line count is even: {}.".format(lnCnt))
|
||||
else:
|
||||
PathLog.debug("Line count is ODD: {}.".format(lnCnt))
|
||||
Path.Log.debug("Line count is ODD: {}.".format(lnCnt))
|
||||
dirFlg = -1 * dirFlg
|
||||
if not obj.CutPatternReversed:
|
||||
if self.CutClimb:
|
||||
@@ -1561,7 +1561,7 @@ def pathGeomToCircularPointSet(self, obj, compGeoShp):
|
||||
Convert a compound set of arcs/circles to a set of directionally-oriented arc end points
|
||||
and the corresponding center point."""
|
||||
# Extract intersection line segments for return value as []
|
||||
PathLog.debug("pathGeomToCircularPointSet()")
|
||||
Path.Log.debug("pathGeomToCircularPointSet()")
|
||||
ARCS = []
|
||||
stpOvrEI = []
|
||||
segEI = []
|
||||
@@ -1668,7 +1668,7 @@ def pathGeomToCircularPointSet(self, obj, compGeoShp):
|
||||
for so in range(0, len(stpOvrEI)):
|
||||
SO = stpOvrEI[so]
|
||||
if SO[0] == "L": # L = Loop/Ring/Circle
|
||||
# PathLog.debug("SO[0] == 'Loop'")
|
||||
# Path.Log.debug("SO[0] == 'Loop'")
|
||||
lei = SO[1] # loop Edges index
|
||||
v1 = compGeoShp.Edges[lei].Vertexes[0]
|
||||
|
||||
@@ -1703,7 +1703,7 @@ def pathGeomToCircularPointSet(self, obj, compGeoShp):
|
||||
) # OCL.Arc(firstPnt, lastPnt, centerPnt, dir=True(CCW direction))
|
||||
ARCS.append(("L", dirFlg, [arc]))
|
||||
elif SO[0] == "A": # A = Arc
|
||||
# PathLog.debug("SO[0] == 'Arc'")
|
||||
# Path.Log.debug("SO[0] == 'Arc'")
|
||||
PRTS = []
|
||||
EI = SO[1] # list of corresponding Edges indexes
|
||||
CONN = SO[2] # list of corresponding connected edges tuples (iE, iS)
|
||||
@@ -1803,7 +1803,7 @@ def pathGeomToCircularPointSet(self, obj, compGeoShp):
|
||||
def pathGeomToSpiralPointSet(obj, compGeoShp):
|
||||
"""_pathGeomToSpiralPointSet(obj, compGeoShp)...
|
||||
Convert a compound set of sequential line segments to directional, connected groupings."""
|
||||
PathLog.debug("_pathGeomToSpiralPointSet()")
|
||||
Path.Log.debug("_pathGeomToSpiralPointSet()")
|
||||
# Extract intersection line segments for return value as []
|
||||
LINES = []
|
||||
inLine = []
|
||||
@@ -1856,7 +1856,7 @@ def pathGeomToSpiralPointSet(obj, compGeoShp):
|
||||
def pathGeomToOffsetPointSet(obj, compGeoShp):
|
||||
"""pathGeomToOffsetPointSet(obj, compGeoShp)...
|
||||
Convert a compound set of 3D profile segmented wires to 2D segments, applying linear optimization."""
|
||||
PathLog.debug("pathGeomToOffsetPointSet()")
|
||||
Path.Log.debug("pathGeomToOffsetPointSet()")
|
||||
|
||||
LINES = []
|
||||
optimize = obj.OptimizeLinearPaths
|
||||
@@ -1952,7 +1952,7 @@ class FindUnifiedRegions:
|
||||
base = ef.cut(cutBox)
|
||||
|
||||
if base.Volume == 0:
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"Ignoring Face{}. It is likely vertical with no horizontal exposure.".format(
|
||||
fcIdx
|
||||
)
|
||||
@@ -2026,7 +2026,7 @@ class FindUnifiedRegions:
|
||||
count[1] += 1
|
||||
|
||||
def _groupEdgesByLength(self):
|
||||
PathLog.debug("_groupEdgesByLength()")
|
||||
Path.Log.debug("_groupEdgesByLength()")
|
||||
threshold = self.geomToler
|
||||
grp = []
|
||||
processLast = False
|
||||
@@ -2074,7 +2074,7 @@ class FindUnifiedRegions:
|
||||
self.idGroups.append(grp)
|
||||
|
||||
def _identifySharedEdgesByLength(self, grp):
|
||||
PathLog.debug("_identifySharedEdgesByLength()")
|
||||
Path.Log.debug("_identifySharedEdgesByLength()")
|
||||
holds = []
|
||||
specialIndexes = []
|
||||
threshold = self.geomToler
|
||||
@@ -2132,7 +2132,7 @@ class FindUnifiedRegions:
|
||||
self.noSharedEdges = False
|
||||
|
||||
def _extractWiresFromEdges(self):
|
||||
PathLog.debug("_extractWiresFromEdges()")
|
||||
Path.Log.debug("_extractWiresFromEdges()")
|
||||
DATA = self.edgeData
|
||||
holds = []
|
||||
firstEdge = None
|
||||
@@ -2229,7 +2229,7 @@ class FindUnifiedRegions:
|
||||
# Ewhile
|
||||
|
||||
numLoops = len(LOOPS)
|
||||
PathLog.debug(" -numLoops: {}.".format(numLoops))
|
||||
Path.Log.debug(" -numLoops: {}.".format(numLoops))
|
||||
if numLoops > 0:
|
||||
for li in range(0, numLoops):
|
||||
Edges = LOOPS[li]
|
||||
@@ -2258,7 +2258,7 @@ class FindUnifiedRegions:
|
||||
self.REGIONS.sort(key=faceArea, reverse=True)
|
||||
|
||||
def _identifyInternalFeatures(self):
|
||||
PathLog.debug("_identifyInternalFeatures()")
|
||||
Path.Log.debug("_identifyInternalFeatures()")
|
||||
remList = []
|
||||
|
||||
for (top, fcIdx) in self.topFaces:
|
||||
@@ -2273,14 +2273,14 @@ class FindUnifiedRegions:
|
||||
remList.append(s)
|
||||
break
|
||||
else:
|
||||
PathLog.debug(" - No common area.\n")
|
||||
Path.Log.debug(" - No common area.\n")
|
||||
|
||||
remList.sort(reverse=True)
|
||||
for ri in remList:
|
||||
self.REGIONS.pop(ri)
|
||||
|
||||
def _processNestedRegions(self):
|
||||
PathLog.debug("_processNestedRegions()")
|
||||
Path.Log.debug("_processNestedRegions()")
|
||||
cont = True
|
||||
hold = []
|
||||
Ids = []
|
||||
@@ -2325,7 +2325,7 @@ class FindUnifiedRegions:
|
||||
|
||||
# Accessory methods
|
||||
def _getCompleteCrossSection(self, shape):
|
||||
PathLog.debug("_getCompleteCrossSection()")
|
||||
Path.Log.debug("_getCompleteCrossSection()")
|
||||
wires = []
|
||||
bb = shape.BoundBox
|
||||
mid = (bb.ZMin + bb.ZMax) / 2.0
|
||||
@@ -2339,7 +2339,7 @@ class FindUnifiedRegions:
|
||||
CS.translate(FreeCAD.Vector(0.0, 0.0, 0.0 - CS.BoundBox.ZMin))
|
||||
return CS
|
||||
|
||||
PathLog.debug(" -No wires from .slice() method")
|
||||
Path.Log.debug(" -No wires from .slice() method")
|
||||
return False
|
||||
|
||||
def _edgesAreConnected(self, e1, e2):
|
||||
@@ -2382,7 +2382,7 @@ class FindUnifiedRegions:
|
||||
def getUnifiedRegions(self):
|
||||
"""getUnifiedRegions()... Returns a list of unified regions from list
|
||||
of tuples (faceShape, faceIndex) received at instantiation of the class object."""
|
||||
PathLog.debug("getUnifiedRegions()")
|
||||
Path.Log.debug("getUnifiedRegions()")
|
||||
if len(self.FACES) == 0:
|
||||
msg = "No FACE data tuples received at instantiation of class.\n"
|
||||
FreeCAD.Console.PrintError(msg)
|
||||
@@ -2431,7 +2431,7 @@ class FindUnifiedRegions:
|
||||
self._identifySharedEdgesByLength(grp)
|
||||
|
||||
if self.noSharedEdges:
|
||||
PathLog.debug("No shared edges by length detected.")
|
||||
Path.Log.debug("No shared edges by length detected.")
|
||||
allTopFaces = []
|
||||
for (topFace, fcIdx) in self.topFaces:
|
||||
allTopFaces.append(topFace)
|
||||
@@ -2505,7 +2505,7 @@ class OCL_Tool:
|
||||
self.toolType = self.tool.ToolType # Indicates Legacy tool
|
||||
self.toolMode = "Legacy"
|
||||
if self.toolType:
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"OCL_Tool tool mode, type: {}, {}".format(self.toolMode, self.toolType)
|
||||
)
|
||||
|
||||
@@ -2780,7 +2780,7 @@ class OCL_Tool:
|
||||
FreeCAD.Console.PrintError(err + "\n")
|
||||
return False
|
||||
else:
|
||||
PathLog.debug("OCL_Tool tool method: {}".format(self.toolMethod))
|
||||
Path.Log.debug("OCL_Tool tool method: {}".format(self.toolMethod))
|
||||
oclToolMethod = getattr(self, "_ocl" + self.toolMethod)
|
||||
oclToolMethod()
|
||||
|
||||
@@ -2812,7 +2812,7 @@ class OCL_Tool:
|
||||
|
||||
# Support functions
|
||||
def makeExtendedBoundBox(wBB, bbBfr, zDep):
|
||||
PathLog.debug("makeExtendedBoundBox()")
|
||||
Path.Log.debug("makeExtendedBoundBox()")
|
||||
p1 = FreeCAD.Vector(wBB.XMin - bbBfr, wBB.YMin - bbBfr, zDep)
|
||||
p2 = FreeCAD.Vector(wBB.XMax + bbBfr, wBB.YMin - bbBfr, zDep)
|
||||
p3 = FreeCAD.Vector(wBB.XMax + bbBfr, wBB.YMax + bbBfr, zDep)
|
||||
|
||||
@@ -26,7 +26,6 @@ import FreeCAD
|
||||
import Path
|
||||
import PathScripts.PathCircularHoleBase as PathCircularHoleBase
|
||||
import PathScripts.PathGeom as PathGeom
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathOp as PathOp
|
||||
import Generators.threadmilling_generator as threadmilling
|
||||
import math
|
||||
@@ -41,10 +40,10 @@ __doc__ = "Path thread milling operation."
|
||||
SQRT_3_DIVIDED_BY_2 = 0.8660254037844386
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
@@ -106,7 +105,7 @@ def _isThreadInternal(obj):
|
||||
return obj.ThreadType in ThreadTypesInternal
|
||||
|
||||
def threadSetupInternal(obj, zTop, zBottom):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
if obj.ThreadOrientation == RightHand:
|
||||
# Right hand thread, G2, top down -> conventional milling
|
||||
if obj.Direction == DirectionConventional:
|
||||
@@ -121,7 +120,7 @@ def threadSetupInternal(obj, zTop, zBottom):
|
||||
return ("G2", zBottom, zTop)
|
||||
|
||||
def threadSetupExternal(obj, zTop, zBottom):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
if obj.ThreadOrientation == RightHand:
|
||||
# right hand thread, G2, top down -> climb milling
|
||||
if obj.Direction == DirectionClimb:
|
||||
@@ -136,7 +135,7 @@ def threadSetupExternal(obj, zTop, zBottom):
|
||||
|
||||
def threadSetup(obj):
|
||||
"""Return (cmd, zbegin, zend) of thread milling operation"""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
|
||||
zTop = obj.StartDepth.Value
|
||||
zBottom = obj.FinalDepth.Value
|
||||
@@ -149,7 +148,7 @@ def threadSetup(obj):
|
||||
|
||||
def threadRadii(internal, majorDia, minorDia, toolDia, toolCrest):
|
||||
"""threadRadii(majorDia, minorDia, toolDia, toolCrest) ... returns the minimum and maximum radius for thread."""
|
||||
PathLog.track(internal, majorDia, minorDia, toolDia, toolCrest)
|
||||
Path.Log.track(internal, majorDia, minorDia, toolDia, toolCrest)
|
||||
if toolCrest is None:
|
||||
toolCrest = 0.0
|
||||
# As it turns out metric and imperial standard threads follow the same rules.
|
||||
@@ -171,12 +170,12 @@ def threadRadii(internal, majorDia, minorDia, toolDia, toolCrest):
|
||||
# Compensate for the crest of the tool
|
||||
toolTip = innerTip - toolCrest * SQRT_3_DIVIDED_BY_2
|
||||
radii = ((majorDia + toolDia) / 2.0, toolTip + toolDia / 2.0)
|
||||
PathLog.track(radii)
|
||||
Path.Log.track(radii)
|
||||
return radii
|
||||
|
||||
|
||||
def threadPasses(count, radii, internal, majorDia, minorDia, toolDia, toolCrest):
|
||||
PathLog.track(count, radii, internal, majorDia, minorDia, toolDia, toolCrest)
|
||||
Path.Log.track(count, radii, internal, majorDia, minorDia, toolDia, toolCrest)
|
||||
# the logic goes as follows, total area to be removed:
|
||||
# A = H * W ... where H is the depth and W is half the width of a thread
|
||||
# H = k * sin(30) = k * 1/2 -> k = 2 * H
|
||||
@@ -198,7 +197,7 @@ def threadPasses(count, radii, internal, majorDia, minorDia, toolDia, toolCrest)
|
||||
# the order in which they have to get milled. As a result H ends up being negative
|
||||
# and the math for internal and external threads is identical.
|
||||
passes = [minor + h for h in Hi]
|
||||
PathLog.debug(f"threadPasses({minor}, {major}) -> H={H} : {Hi} --> {passes}")
|
||||
Path.Log.debug(f"threadPasses({minor}, {major}) -> H={H} : {Hi} --> {passes}")
|
||||
|
||||
return passes
|
||||
|
||||
@@ -210,7 +209,7 @@ def elevatorRadius(obj, center, internal, tool):
|
||||
dy = float(obj.MinorDiameter - tool.Diameter) / 2 - 1
|
||||
if dy < 0:
|
||||
if obj.MinorDiameter < tool.Diameter:
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
"The selected tool is too big (d={}) for milling a thread with minor diameter D={}".format(
|
||||
tool.Diameter, obj.MinorDiameter
|
||||
)
|
||||
@@ -235,7 +234,7 @@ class ObjectThreadMilling(PathCircularHoleBase.ObjectOp):
|
||||
'raw' is list of (translated_text, data_string) tuples
|
||||
'translated' is list of translated string literals
|
||||
"""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
|
||||
# Enumeration lists for App::PropertyEnumeration properties
|
||||
enums = {
|
||||
@@ -305,20 +304,20 @@ class ObjectThreadMilling(PathCircularHoleBase.ObjectOp):
|
||||
data = list()
|
||||
idx = 0 if dataType == "translated" else 1
|
||||
|
||||
PathLog.debug(enums)
|
||||
Path.Log.debug(enums)
|
||||
|
||||
for k, v in enumerate(enums):
|
||||
data.append((v, [tup[idx] for tup in enums[v]]))
|
||||
PathLog.debug(data)
|
||||
Path.Log.debug(data)
|
||||
|
||||
return data
|
||||
|
||||
def circularHoleFeatures(self, obj):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
return PathOp.FeatureBaseGeometry
|
||||
|
||||
def initCircularHoleOperation(self, obj):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
obj.addProperty(
|
||||
"App::PropertyEnumeration",
|
||||
"ThreadOrientation",
|
||||
@@ -414,7 +413,7 @@ class ObjectThreadMilling(PathCircularHoleBase.ObjectOp):
|
||||
setattr(obj, n[0], n[1])
|
||||
|
||||
def threadPassRadii(self, obj):
|
||||
PathLog.track(obj.Label)
|
||||
Path.Log.track(obj.Label)
|
||||
rMajor = (obj.MajorDiameter.Value - self.tool.Diameter) / 2.0
|
||||
rMinor = (obj.MinorDiameter.Value - self.tool.Diameter) / 2.0
|
||||
if obj.Passes < 1:
|
||||
@@ -426,7 +425,7 @@ class ObjectThreadMilling(PathCircularHoleBase.ObjectOp):
|
||||
return list(reversed(passes))
|
||||
|
||||
def executeThreadMill(self, obj, loc, gcode, zStart, zFinal, pitch):
|
||||
PathLog.track(obj.Label, loc, gcode, zStart, zFinal, pitch)
|
||||
Path.Log.track(obj.Label, loc, gcode, zStart, zFinal, pitch)
|
||||
elevator = elevatorRadius(obj, loc, _isThreadInternal(obj), self.tool)
|
||||
|
||||
move2clearance = Path.Command(
|
||||
@@ -480,7 +479,7 @@ class ObjectThreadMilling(PathCircularHoleBase.ObjectOp):
|
||||
)
|
||||
|
||||
def circularHoleExecute(self, obj, holes):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
if self.isToolSupported(obj, self.tool):
|
||||
self.commandlist.append(Path.Command("(Begin Thread Milling)"))
|
||||
|
||||
@@ -489,7 +488,7 @@ class ObjectThreadMilling(PathCircularHoleBase.ObjectOp):
|
||||
if obj.TPI > 0:
|
||||
pitch = 25.4 / obj.TPI
|
||||
if pitch <= 0:
|
||||
PathLog.error("Cannot create thread with pitch {}".format(pitch))
|
||||
Path.Log.error("Cannot create thread with pitch {}".format(pitch))
|
||||
return
|
||||
|
||||
# rapid to clearance height
|
||||
@@ -503,10 +502,10 @@ class ObjectThreadMilling(PathCircularHoleBase.ObjectOp):
|
||||
pitch,
|
||||
)
|
||||
else:
|
||||
PathLog.error("No suitable Tool found for thread milling operation")
|
||||
Path.Log.error("No suitable Tool found for thread milling operation")
|
||||
|
||||
def opSetDefaultValues(self, obj, job):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
obj.ThreadOrientation = RightHand
|
||||
obj.ThreadType = ThreadTypeMetricInternal6H
|
||||
obj.ThreadFit = 50
|
||||
@@ -519,7 +518,7 @@ class ObjectThreadMilling(PathCircularHoleBase.ObjectOp):
|
||||
def isToolSupported(self, obj, tool):
|
||||
"""Thread milling only supports thread milling cutters."""
|
||||
support = hasattr(tool, "Diameter") and hasattr(tool, "Crest")
|
||||
PathLog.track(tool.Label, support)
|
||||
Path.Log.track(tool.Label, support)
|
||||
return support
|
||||
|
||||
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import Path
|
||||
import PathGui as PGui # ensure Path/Gui/Resources are loaded
|
||||
import PathScripts.PathCircularHoleBaseGui as PathCircularHoleBaseGui
|
||||
import PathScripts.PathThreadMilling as PathThreadMilling
|
||||
import PathScripts.PathGui as PathGui
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathOpGui as PathOpGui
|
||||
import csv
|
||||
|
||||
@@ -41,10 +41,10 @@ __url__ = "http://www.freecadweb.org"
|
||||
__doc__ = "UI and Command for Path Thread Milling Operation."
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
@@ -52,7 +52,7 @@ translate = FreeCAD.Qt.translate
|
||||
def fillThreads(form, dataFile, defaultSelect):
|
||||
form.threadName.blockSignals(True)
|
||||
select = form.threadName.currentText()
|
||||
PathLog.debug("select = '{}'".format(select))
|
||||
Path.Log.debug("select = '{}'".format(select))
|
||||
form.threadName.clear()
|
||||
with open(
|
||||
"{}Mod/Path/Data/Threads/{}".format(FreeCAD.getHomePath(), dataFile)
|
||||
@@ -97,7 +97,7 @@ class TaskPanelOpPage(PathCircularHoleBaseGui.TaskPanelOpPage):
|
||||
|
||||
def getFields(self, obj):
|
||||
"""getFields(obj) ... update obj's properties with values from the UI"""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
|
||||
self.majorDia.updateProperty()
|
||||
self.minorDia.updateProperty()
|
||||
@@ -115,7 +115,7 @@ class TaskPanelOpPage(PathCircularHoleBaseGui.TaskPanelOpPage):
|
||||
|
||||
def setFields(self, obj):
|
||||
"""setFields(obj) ... update UI with obj properties' values"""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
|
||||
self.selectInComboBox(obj.ThreadOrientation, self.form.threadOrientation)
|
||||
self.selectInComboBox(obj.ThreadType, self.form.threadType)
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
# ***************************************************************************
|
||||
|
||||
import FreeCAD
|
||||
import PathScripts.PathLog as PathLog
|
||||
import Path
|
||||
import PathScripts.PathPreferences as PathPreferences
|
||||
import PathScripts.PathPropertyBag as PathPropertyBag
|
||||
import PathScripts.PathUtil as PathUtil
|
||||
@@ -46,14 +46,14 @@ _DebugFindTool = False
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
def _findToolFile(name, containerFile, typ):
|
||||
PathLog.track(name)
|
||||
Path.Log.track(name)
|
||||
if os.path.exists(name): # absolute reference
|
||||
return name
|
||||
|
||||
@@ -65,7 +65,7 @@ def _findToolFile(name, containerFile, typ):
|
||||
paths.extend(PathPreferences.searchPathsTool(typ))
|
||||
|
||||
def _findFile(path, name):
|
||||
PathLog.track(path, name)
|
||||
Path.Log.track(path, name)
|
||||
fullPath = os.path.join(path, name)
|
||||
if os.path.exists(fullPath):
|
||||
return (True, fullPath)
|
||||
@@ -85,13 +85,13 @@ def _findToolFile(name, containerFile, typ):
|
||||
|
||||
def findToolShape(name, path=None):
|
||||
"""findToolShape(name, path) ... search for name, if relative path look in path"""
|
||||
PathLog.track(name, path)
|
||||
Path.Log.track(name, path)
|
||||
return _findToolFile(name, path, "Shape")
|
||||
|
||||
|
||||
def findToolBit(name, path=None):
|
||||
"""findToolBit(name, path) ... search for name, if relative path look in path"""
|
||||
PathLog.track(name, path)
|
||||
Path.Log.track(name, path)
|
||||
if name.endswith(".fctb"):
|
||||
return _findToolFile(name, path, "Bit")
|
||||
return _findToolFile("{}.fctb".format(name), path, "Bit")
|
||||
@@ -100,14 +100,14 @@ def findToolBit(name, path=None):
|
||||
# Only used in ToolBit unit test module: TestPathToolBit.py
|
||||
def findToolLibrary(name, path=None):
|
||||
"""findToolLibrary(name, path) ... search for name, if relative path look in path"""
|
||||
PathLog.track(name, path)
|
||||
Path.Log.track(name, path)
|
||||
if name.endswith(".fctl"):
|
||||
return _findToolFile(name, path, "Library")
|
||||
return _findToolFile("{}.fctl".format(name), path, "Library")
|
||||
|
||||
|
||||
def _findRelativePath(path, typ):
|
||||
PathLog.track(path, typ)
|
||||
Path.Log.track(path, typ)
|
||||
relative = path
|
||||
for p in PathPreferences.searchPathsTool(typ):
|
||||
if path.startswith(p):
|
||||
@@ -136,7 +136,7 @@ def findRelativePathLibrary(path):
|
||||
|
||||
class ToolBit(object):
|
||||
def __init__(self, obj, shapeFile, path=None):
|
||||
PathLog.track(obj.Label, shapeFile, path)
|
||||
Path.Log.track(obj.Label, shapeFile, path)
|
||||
self.obj = obj
|
||||
obj.addProperty(
|
||||
"App::PropertyFile",
|
||||
@@ -238,12 +238,12 @@ class ToolBit(object):
|
||||
obj.setEditorMode(prop, 0)
|
||||
|
||||
def onChanged(self, obj, prop):
|
||||
PathLog.track(obj.Label, prop)
|
||||
Path.Log.track(obj.Label, prop)
|
||||
if prop == "BitShape" and "Restore" not in obj.State:
|
||||
self._setupBitShape(obj)
|
||||
|
||||
def onDelete(self, obj, arg2=None):
|
||||
PathLog.track(obj.Label)
|
||||
Path.Log.track(obj.Label)
|
||||
self.unloadBitBody(obj)
|
||||
obj.Document.removeObject(obj.Name)
|
||||
|
||||
@@ -276,7 +276,7 @@ class ToolBit(object):
|
||||
obj.Shape = Part.Shape()
|
||||
|
||||
def _loadBitBody(self, obj, path=None):
|
||||
PathLog.track(obj.Label, path)
|
||||
Path.Log.track(obj.Label, path)
|
||||
p = path if path else obj.BitShape
|
||||
docOpened = False
|
||||
doc = None
|
||||
@@ -291,12 +291,12 @@ class ToolBit(object):
|
||||
|
||||
if not path and p != obj.BitShape:
|
||||
obj.BitShape = p
|
||||
PathLog.debug("ToolBit {} using shape file: {}".format(obj.Label, p))
|
||||
Path.Log.debug("ToolBit {} using shape file: {}".format(obj.Label, p))
|
||||
doc = FreeCAD.openDocument(p, True)
|
||||
obj.ShapeName = doc.Name
|
||||
docOpened = True
|
||||
else:
|
||||
PathLog.debug("ToolBit {} already open: {}".format(obj.Label, doc))
|
||||
Path.Log.debug("ToolBit {} already open: {}".format(obj.Label, doc))
|
||||
return (doc, docOpened)
|
||||
|
||||
def _removeBitBody(self, obj):
|
||||
@@ -306,7 +306,7 @@ class ToolBit(object):
|
||||
obj.BitBody = None
|
||||
|
||||
def _deleteBitSetup(self, obj):
|
||||
PathLog.track(obj.Label)
|
||||
Path.Log.track(obj.Label)
|
||||
self._removeBitBody(obj)
|
||||
self._copyBitShape(obj)
|
||||
for prop in obj.BitPropertyNames:
|
||||
@@ -342,7 +342,7 @@ class ToolBit(object):
|
||||
PathUtil.setProperty(obj, prop, val)
|
||||
|
||||
def _setupBitShape(self, obj, path=None):
|
||||
PathLog.track(obj.Label)
|
||||
Path.Log.track(obj.Label)
|
||||
|
||||
activeDoc = FreeCAD.ActiveDocument
|
||||
(doc, docOpened) = self._loadBitBody(obj, path)
|
||||
@@ -359,7 +359,7 @@ class ToolBit(object):
|
||||
if bitBody.ViewObject:
|
||||
bitBody.ViewObject.Visibility = False
|
||||
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"bitBody.{} ({}): {}".format(bitBody.Label, bitBody.Name, type(bitBody))
|
||||
)
|
||||
|
||||
@@ -367,12 +367,12 @@ class ToolBit(object):
|
||||
for attributes in [
|
||||
o for o in bitBody.Group if PathPropertyBag.IsPropertyBag(o)
|
||||
]:
|
||||
PathLog.debug("Process properties from {}".format(attributes.Label))
|
||||
Path.Log.debug("Process properties from {}".format(attributes.Label))
|
||||
for prop in attributes.Proxy.getCustomProperties():
|
||||
self._setupProperty(obj, prop, attributes)
|
||||
propNames.append(prop)
|
||||
if not propNames:
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
"Did not find a PropertyBag in {} - not a ToolBit shape?".format(
|
||||
docName
|
||||
)
|
||||
@@ -430,7 +430,7 @@ class ToolBit(object):
|
||||
return None
|
||||
|
||||
def saveToFile(self, obj, path, setFile=True):
|
||||
PathLog.track(path)
|
||||
Path.Log.track(path)
|
||||
try:
|
||||
with open(path, "w") as fp:
|
||||
json.dump(self.templateAttrs(obj), fp, indent=" ")
|
||||
@@ -438,7 +438,7 @@ class ToolBit(object):
|
||||
obj.File = path
|
||||
return True
|
||||
except (OSError, IOError) as e:
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
"Could not save tool {} to {} ({})".format(obj.Label, path, e)
|
||||
)
|
||||
raise
|
||||
@@ -466,14 +466,14 @@ class ToolBit(object):
|
||||
|
||||
|
||||
def Declaration(path):
|
||||
PathLog.track(path)
|
||||
Path.Log.track(path)
|
||||
with open(path, "r") as fp:
|
||||
return json.load(fp)
|
||||
|
||||
|
||||
class ToolBitFactory(object):
|
||||
def CreateFromAttrs(self, attrs, name="ToolBit", path=None):
|
||||
PathLog.track(attrs, path)
|
||||
Path.Log.track(attrs, path)
|
||||
obj = Factory.Create(name, attrs["shape"], path)
|
||||
obj.Label = attrs["name"]
|
||||
params = attrs["parameter"]
|
||||
@@ -484,7 +484,7 @@ class ToolBitFactory(object):
|
||||
return obj
|
||||
|
||||
def CreateFrom(self, path, name="ToolBit"):
|
||||
PathLog.track(name, path)
|
||||
Path.Log.track(name, path)
|
||||
|
||||
if not os.path.isfile(path):
|
||||
raise FileNotFoundError(f"{path} not found")
|
||||
@@ -493,11 +493,11 @@ class ToolBitFactory(object):
|
||||
bit = Factory.CreateFromAttrs(data, name, path)
|
||||
return bit
|
||||
except (OSError, IOError) as e:
|
||||
PathLog.error("%s not a valid tool file (%s)" % (path, e))
|
||||
Path.Log.error("%s not a valid tool file (%s)" % (path, e))
|
||||
raise
|
||||
|
||||
def Create(self, name="ToolBit", shapeFile=None, path=None):
|
||||
PathLog.track(name, shapeFile, path)
|
||||
Path.Log.track(name, shapeFile, path)
|
||||
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython", name)
|
||||
obj.Proxy = ToolBit(obj, shapeFile, path)
|
||||
return obj
|
||||
|
||||
@@ -20,19 +20,19 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
from PySide import QtCore
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import Path
|
||||
import PathScripts
|
||||
import PathScripts.PathLog as PathLog
|
||||
import os
|
||||
from PySide import QtCore
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
class CommandToolBitCreate:
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
|
||||
from PySide import QtCore, QtGui
|
||||
import FreeCADGui
|
||||
import Path
|
||||
import PathScripts.PathGui as PathGui
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathPreferences as PathPreferences
|
||||
import PathScripts.PathPropertyEditor as PathPropertyEditor
|
||||
import PathScripts.PathUtil as PathUtil
|
||||
@@ -32,10 +32,10 @@ import re
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
class _Delegate(QtGui.QStyledItemDelegate):
|
||||
@@ -76,7 +76,7 @@ class ToolBitEditor(object):
|
||||
"""
|
||||
|
||||
def __init__(self, tool, parentWidget=None, loadBitBody=True):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.form = FreeCADGui.PySideUic.loadUi(":/panels/ToolBitEditor.ui")
|
||||
|
||||
if parentWidget:
|
||||
@@ -102,7 +102,7 @@ class ToolBitEditor(object):
|
||||
self.setupAttributes(self.tool)
|
||||
|
||||
def setupTool(self, tool):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
# Can't delete and add fields to the form because of dangling references in case of
|
||||
# a focus change. see https://forum.freecadweb.org/viewtopic.php?f=10&t=52246#p458583
|
||||
# Instead we keep widgets once created and use them for new properties, and hide all
|
||||
@@ -120,7 +120,7 @@ class ToolBitEditor(object):
|
||||
usedRows = 0
|
||||
for nr, name in enumerate(tool.Proxy.toolShapeProperties(tool)):
|
||||
if nr < len(self.widgets):
|
||||
PathLog.debug("re-use row: {} [{}]".format(nr, name))
|
||||
Path.Log.debug("re-use row: {} [{}]".format(nr, name))
|
||||
label, qsb, editor = self.widgets[nr]
|
||||
label.setText(labelText(name))
|
||||
editor.attachTo(tool, name)
|
||||
@@ -131,7 +131,7 @@ class ToolBitEditor(object):
|
||||
editor = PathGui.QuantitySpinBox(qsb, tool, name)
|
||||
label = QtGui.QLabel(labelText(name))
|
||||
self.widgets.append((label, qsb, editor))
|
||||
PathLog.debug("create row: {} [{}] {}".format(nr, name, type(qsb)))
|
||||
Path.Log.debug("create row: {} [{}] {}".format(nr, name, type(qsb)))
|
||||
if hasattr(qsb, "editingFinished"):
|
||||
qsb.editingFinished.connect(self.updateTool)
|
||||
|
||||
@@ -140,13 +140,13 @@ class ToolBitEditor(object):
|
||||
usedRows = usedRows + 1
|
||||
|
||||
# hide all rows which aren't being used
|
||||
PathLog.track(usedRows, len(self.widgets))
|
||||
Path.Log.track(usedRows, len(self.widgets))
|
||||
for i in range(usedRows, len(self.widgets)):
|
||||
label, qsb, editor = self.widgets[i]
|
||||
label.hide()
|
||||
qsb.hide()
|
||||
editor.attachTo(None)
|
||||
PathLog.debug(" hide row: {}".format(i))
|
||||
Path.Log.debug(" hide row: {}".format(i))
|
||||
|
||||
img = tool.Proxy.getBitThumbnail(tool)
|
||||
if img:
|
||||
@@ -155,7 +155,7 @@ class ToolBitEditor(object):
|
||||
self.form.image.setPixmap(QtGui.QPixmap())
|
||||
|
||||
def setupAttributes(self, tool):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
|
||||
setup = True
|
||||
if not hasattr(self, "delegate"):
|
||||
@@ -195,16 +195,16 @@ class ToolBitEditor(object):
|
||||
# self.form.attrTree.collapseAll()
|
||||
|
||||
def accept(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.refresh()
|
||||
self.tool.Proxy.unloadBitBody(self.tool)
|
||||
|
||||
def reject(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.tool.Proxy.unloadBitBody(self.tool)
|
||||
|
||||
def updateUI(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.form.toolName.setText(self.tool.Label)
|
||||
self.form.shapePath.setText(self.tool.BitShape)
|
||||
|
||||
@@ -230,7 +230,7 @@ class ToolBitEditor(object):
|
||||
return False
|
||||
|
||||
def updateShape(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
shapePath = str(self.form.shapePath.text())
|
||||
# Only need to go through this exercise if the shape actually changed.
|
||||
if self._updateBitShape(shapePath):
|
||||
@@ -238,7 +238,7 @@ class ToolBitEditor(object):
|
||||
editor.updateSpinBox()
|
||||
|
||||
def updateTool(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
|
||||
label = str(self.form.toolName.text())
|
||||
shape = str(self.form.shapePath.text())
|
||||
@@ -252,14 +252,14 @@ class ToolBitEditor(object):
|
||||
self.tool.Proxy._updateBitShape(self.tool)
|
||||
|
||||
def refresh(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.form.blockSignals(True)
|
||||
self.updateTool()
|
||||
self.updateUI()
|
||||
self.form.blockSignals(False)
|
||||
|
||||
def selectShape(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
path = self.tool.BitShape
|
||||
if not path:
|
||||
path = PathPreferences.lastPathToolShape()
|
||||
@@ -272,7 +272,7 @@ class ToolBitEditor(object):
|
||||
self.updateShape()
|
||||
|
||||
def setupUI(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.updateUI()
|
||||
|
||||
self.form.toolName.editingFinished.connect(self.refresh)
|
||||
|
||||
@@ -24,8 +24,8 @@ from PySide import QtCore, QtGui
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import Path
|
||||
import PathScripts.PathIconViewProvider as PathIconViewProvider
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathPreferences as PathPreferences
|
||||
import PathScripts.PathToolBit as PathToolBit
|
||||
import PathScripts.PathToolBitEdit as PathToolBitEdit
|
||||
@@ -38,10 +38,10 @@ __doc__ = "Task panel editor for a ToolBit"
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
@@ -51,7 +51,7 @@ class ViewProvider(object):
|
||||
It's sole job is to provide an icon and invoke the TaskPanel on edit."""
|
||||
|
||||
def __init__(self, vobj, name):
|
||||
PathLog.track(name, vobj.Object)
|
||||
Path.Log.track(name, vobj.Object)
|
||||
self.panel = None
|
||||
self.icon = name
|
||||
self.obj = vobj.Object
|
||||
@@ -59,7 +59,7 @@ class ViewProvider(object):
|
||||
vobj.Proxy = self
|
||||
|
||||
def attach(self, vobj):
|
||||
PathLog.track(vobj.Object)
|
||||
Path.Log.track(vobj.Object)
|
||||
self.vobj = vobj
|
||||
self.obj = vobj.Object
|
||||
|
||||
@@ -78,21 +78,21 @@ class ViewProvider(object):
|
||||
return None
|
||||
|
||||
def onDelete(self, vobj, arg2=None):
|
||||
PathLog.track(vobj.Object.Label)
|
||||
Path.Log.track(vobj.Object.Label)
|
||||
vobj.Object.Proxy.onDelete(vobj.Object)
|
||||
|
||||
def getDisplayMode(self, mode):
|
||||
return "Default"
|
||||
|
||||
def _openTaskPanel(self, vobj, deleteOnReject):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.panel = TaskPanel(vobj, deleteOnReject)
|
||||
FreeCADGui.Control.closeDialog()
|
||||
FreeCADGui.Control.showDialog(self.panel)
|
||||
self.panel.setupUi()
|
||||
|
||||
def setCreate(self, vobj):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self._openTaskPanel(vobj, True)
|
||||
|
||||
def setEdit(self, vobj, mode=0):
|
||||
@@ -125,7 +125,7 @@ class TaskPanel:
|
||||
"""TaskPanel for the SetupSheet - if it is being edited directly."""
|
||||
|
||||
def __init__(self, vobj, deleteOnReject):
|
||||
PathLog.track(vobj.Object.Label)
|
||||
Path.Log.track(vobj.Object.Label)
|
||||
self.vobj = vobj
|
||||
self.obj = vobj.Object
|
||||
self.editor = PathToolBitEdit.ToolBitEditor(self.obj)
|
||||
@@ -153,7 +153,7 @@ class TaskPanel:
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
def updateUI(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.editor.updateUI()
|
||||
|
||||
def updateModel(self):
|
||||
@@ -169,7 +169,7 @@ class ToolBitGuiFactory(PathToolBit.ToolBitFactory):
|
||||
"""Create(name = 'ToolBit') ... creates a new tool bit.
|
||||
It is assumed the tool will be edited immediately so the internal bit body is still attached."""
|
||||
|
||||
PathLog.track(name, shapeFile, path)
|
||||
Path.Log.track(name, shapeFile, path)
|
||||
FreeCAD.ActiveDocument.openTransaction("Create ToolBit")
|
||||
tool = PathToolBit.ToolBitFactory.Create(self, name, shapeFile, path)
|
||||
PathIconViewProvider.Attach(tool.ViewObject, name)
|
||||
|
||||
@@ -23,13 +23,13 @@
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import PathScripts.PathLog as PathLog
|
||||
import Path
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import Path
|
||||
import PathGui as PGui # ensure Path/Gui/Resources are loaded
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathPreferences as PathPreferences
|
||||
import PathScripts.PathToolBit as PathToolBit
|
||||
import PathScripts.PathToolBitEdit as PathToolBitEdit
|
||||
@@ -43,10 +43,10 @@ from functools import partial
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
_UuidRole = PySide.QtCore.Qt.UserRole + 1
|
||||
@@ -59,12 +59,12 @@ translate = FreeCAD.Qt.translate
|
||||
def checkWorkingDir():
|
||||
# users shouldn't use the example toolbits and libraries.
|
||||
# working directory should be writable
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
|
||||
workingdir = os.path.dirname(PathPreferences.lastPathToolLibrary())
|
||||
defaultdir = os.path.dirname(PathPreferences.pathDefaultToolsPath())
|
||||
|
||||
PathLog.debug("workingdir: {} defaultdir: {}".format(workingdir, defaultdir))
|
||||
Path.Log.debug("workingdir: {} defaultdir: {}".format(workingdir, defaultdir))
|
||||
|
||||
dirOK = lambda: workingdir != defaultdir and (os.access(workingdir, os.W_OK))
|
||||
|
||||
@@ -95,7 +95,7 @@ def checkWorkingDir():
|
||||
"{}{}Library".format(workingdir, os.path.sep)
|
||||
)
|
||||
PathPreferences.setLastPathToolBit("{}{}Bit".format(workingdir, os.path.sep))
|
||||
PathLog.debug("setting workingdir to: {}".format(workingdir))
|
||||
Path.Log.debug("setting workingdir to: {}".format(workingdir))
|
||||
|
||||
# Copy only files of default Path\Tools folder to working directory (targeting the README.md help file)
|
||||
src_toolfiles = os.listdir(defaultdir)
|
||||
@@ -221,7 +221,7 @@ class _TableView(PySide.QtGui.QTableView):
|
||||
self._copyTool(uuid, dst + i)
|
||||
|
||||
def dropEvent(self, event):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
mime = event.mimeData()
|
||||
data = mime.data("application/x-qstandarditemmodeldatalist")
|
||||
stream = PySide.QtCore.QDataStream(data)
|
||||
@@ -245,12 +245,12 @@ class ModelFactory(object):
|
||||
"""Helper class to generate qtdata models for toolbit libraries"""
|
||||
|
||||
def __init__(self, path=None):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.path = ""
|
||||
# self.currentLib = ""
|
||||
|
||||
def __libraryLoad(self, path, datamodel):
|
||||
PathLog.track(path)
|
||||
Path.Log.track(path)
|
||||
PathPreferences.setLastFileToolLibrary(path)
|
||||
# self.currenLib = path
|
||||
|
||||
@@ -262,11 +262,11 @@ class ModelFactory(object):
|
||||
nr = toolBit["nr"]
|
||||
bit = PathToolBit.findToolBit(toolBit["path"], path)
|
||||
if bit:
|
||||
PathLog.track(bit)
|
||||
Path.Log.track(bit)
|
||||
tool = PathToolBit.Declaration(bit)
|
||||
datamodel.appendRow(self._toolAdd(nr, tool, bit))
|
||||
else:
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
"Could not find tool #{}: {}".format(nr, toolBit["path"])
|
||||
)
|
||||
except Exception as e:
|
||||
@@ -301,7 +301,7 @@ class ModelFactory(object):
|
||||
"""
|
||||
Adds a toolbit item to a model
|
||||
"""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
|
||||
try:
|
||||
nr = 0
|
||||
@@ -311,7 +311,7 @@ class ModelFactory(object):
|
||||
nr += 1
|
||||
tool = PathToolBit.Declaration(path)
|
||||
except Exception as e:
|
||||
PathLog.error(e)
|
||||
Path.Log.error(e)
|
||||
|
||||
datamodel.appendRow(self._toolAdd(nr, tool, path))
|
||||
|
||||
@@ -320,7 +320,7 @@ class ModelFactory(object):
|
||||
Finds all the fctl files in a location
|
||||
Returns a QStandardItemModel
|
||||
"""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
path = PathPreferences.lastPathToolLibrary()
|
||||
|
||||
if os.path.isdir(path): # opening all tables in a directory
|
||||
@@ -335,7 +335,7 @@ class ModelFactory(object):
|
||||
libItem.setIcon(PySide.QtGui.QPixmap(":/icons/Path_ToolTable.svg"))
|
||||
model.appendRow(libItem)
|
||||
|
||||
PathLog.debug("model rows: {}".format(model.rowCount()))
|
||||
Path.Log.debug("model rows: {}".format(model.rowCount()))
|
||||
return model
|
||||
|
||||
def libraryOpen(self, model, lib=""):
|
||||
@@ -343,7 +343,7 @@ class ModelFactory(object):
|
||||
opens the tools in library
|
||||
Returns a QStandardItemModel
|
||||
"""
|
||||
PathLog.track(lib)
|
||||
Path.Log.track(lib)
|
||||
|
||||
if lib == "":
|
||||
lib = PathPreferences.lastFileToolLibrary()
|
||||
@@ -354,7 +354,7 @@ class ModelFactory(object):
|
||||
if os.path.isfile(lib): # An individual library is wanted
|
||||
self.__libraryLoad(lib, model)
|
||||
|
||||
PathLog.debug("model rows: {}".format(model.rowCount()))
|
||||
Path.Log.debug("model rows: {}".format(model.rowCount()))
|
||||
return model
|
||||
|
||||
|
||||
@@ -381,7 +381,7 @@ class ToolBitSelector(object):
|
||||
return libfile
|
||||
|
||||
def loadData(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.toolModel.clear()
|
||||
self.toolModel.setHorizontalHeaderLabels(self.columnNames())
|
||||
self.form.lblLibrary.setText(self.currentLibrary(True))
|
||||
@@ -391,7 +391,7 @@ class ToolBitSelector(object):
|
||||
self.toolModel.takeColumn(2)
|
||||
|
||||
def setupUI(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.loadData()
|
||||
self.form.tools.setModel(self.toolModel)
|
||||
self.form.tools.selectionModel().selectionChanged.connect(self.enableButtons)
|
||||
@@ -491,7 +491,7 @@ class ToolBitLibrary(object):
|
||||
displaying/selecting/creating/editing a collection of ToolBits."""
|
||||
|
||||
def __init__(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
checkWorkingDir()
|
||||
self.factory = ModelFactory()
|
||||
self.temptool = None
|
||||
@@ -507,7 +507,7 @@ class ToolBitLibrary(object):
|
||||
self.title = self.form.windowTitle()
|
||||
|
||||
def toolBitNew(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
|
||||
# select the shape file
|
||||
shapefile = PathToolBitGui.GetToolShapeFile()
|
||||
@@ -523,7 +523,7 @@ class ToolBitLibrary(object):
|
||||
loc, fil = os.path.split(filename)
|
||||
fname = os.path.splitext(fil)[0]
|
||||
fullpath = "{}{}{}.fctb".format(loc, os.path.sep, fname)
|
||||
PathLog.debug("fullpath: {}".format(fullpath))
|
||||
Path.Log.debug("fullpath: {}".format(fullpath))
|
||||
|
||||
self.temptool = PathToolBit.ToolBitFactory().Create(name=fname)
|
||||
self.temptool.BitShape = shapefile
|
||||
@@ -552,7 +552,7 @@ class ToolBitLibrary(object):
|
||||
self.factory.newTool(self.toolModel, fullpath)
|
||||
|
||||
def toolDelete(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
selectedRows = set(
|
||||
[index.row() for index in self.toolTableView.selectedIndexes()]
|
||||
)
|
||||
@@ -565,18 +565,18 @@ class ToolBitLibrary(object):
|
||||
|
||||
def tableSelected(self, index):
|
||||
"""loads the tools for the selected tool table"""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
item = index.model().itemFromIndex(index)
|
||||
libpath = item.data(_PathRole)
|
||||
self.loadData(libpath)
|
||||
self.path = libpath
|
||||
|
||||
def open(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
return self.form.exec_()
|
||||
|
||||
def libraryPath(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
path = PySide.QtGui.QFileDialog.getExistingDirectory(
|
||||
self.form, "Tool Library Path", PathPreferences.lastPathToolLibrary()
|
||||
)
|
||||
@@ -632,7 +632,7 @@ class ToolBitLibrary(object):
|
||||
self.form.librarySave.setEnabled(True)
|
||||
|
||||
def toolEdit(self, selected):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
item = self.toolModel.item(selected.row(), 0)
|
||||
|
||||
if self.temptool is not None:
|
||||
@@ -723,14 +723,14 @@ class ToolBitLibrary(object):
|
||||
lib = PathPreferences.lastFileToolLibrary()
|
||||
loc = PathPreferences.lastPathToolLibrary()
|
||||
|
||||
PathLog.track("lib: {} loc: {}".format(lib, loc))
|
||||
Path.Log.track("lib: {} loc: {}".format(lib, loc))
|
||||
return lib, loc
|
||||
|
||||
def columnNames(self):
|
||||
return ["Nr", "Tool", "Shape"]
|
||||
|
||||
def loadData(self, path=None):
|
||||
PathLog.track(path)
|
||||
Path.Log.track(path)
|
||||
self.toolTableView.setUpdatesEnabled(False)
|
||||
self.form.TableList.setUpdatesEnabled(False)
|
||||
|
||||
@@ -766,7 +766,7 @@ class ToolBitLibrary(object):
|
||||
self.form.TableList.setUpdatesEnabled(True)
|
||||
|
||||
def setupUI(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.form.TableList.setModel(self.listModel)
|
||||
self.toolTableView.setModel(self.toolModel)
|
||||
|
||||
@@ -843,7 +843,7 @@ class ToolBitLibrary(object):
|
||||
|
||||
bit = PathToolBit.Factory.CreateFrom(toolPath)
|
||||
if bit:
|
||||
PathLog.track(bit)
|
||||
Path.Log.track(bit)
|
||||
|
||||
pocket = bit.Pocket if hasattr(bit, "Pocket") else "0"
|
||||
xoffset = bit.Xoffset if hasattr(bit, "Xoffset") else "0"
|
||||
@@ -893,7 +893,7 @@ class ToolBitLibrary(object):
|
||||
FreeCAD.ActiveDocument.removeObject(bit.Name)
|
||||
|
||||
else:
|
||||
PathLog.error("Could not find tool #{} ".format(toolNr))
|
||||
Path.Log.error("Could not find tool #{} ".format(toolNr))
|
||||
|
||||
def libararySaveCamotics(self, path):
|
||||
|
||||
@@ -923,7 +923,7 @@ class ToolBitLibrary(object):
|
||||
)
|
||||
|
||||
toolPath = self.toolModel.data(self.toolModel.index(row, 0), _PathRole)
|
||||
PathLog.debug(toolPath)
|
||||
Path.Log.debug(toolPath)
|
||||
try:
|
||||
bit = PathToolBit.Factory.CreateFrom(toolPath)
|
||||
except FileNotFoundError as e:
|
||||
@@ -935,7 +935,7 @@ class ToolBitLibrary(object):
|
||||
if not bit:
|
||||
continue
|
||||
|
||||
PathLog.track(bit)
|
||||
Path.Log.track(bit)
|
||||
|
||||
toolitem = tooltemplate.copy()
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
import FreeCAD
|
||||
import Path
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathPreferences as PathPreferences
|
||||
import PathScripts.PathToolBit as PathToolBit
|
||||
from Generators import toolchange_generator as toolchange_generator
|
||||
@@ -33,10 +32,10 @@ from Generators.toolchange_generator import SpindleDirection
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
@@ -62,7 +61,7 @@ class ToolControllerTemplate:
|
||||
|
||||
class ToolController:
|
||||
def __init__(self, obj, legacyTool=False, createTool=True):
|
||||
PathLog.track("tool: {}".format(legacyTool))
|
||||
Path.Log.track("tool: {}".format(legacyTool))
|
||||
|
||||
obj.addProperty(
|
||||
"App::PropertyIntegerConstraint",
|
||||
@@ -143,11 +142,11 @@ class ToolController:
|
||||
data = list()
|
||||
idx = 0 if dataType == "translated" else 1
|
||||
|
||||
PathLog.debug(enums)
|
||||
Path.Log.debug(enums)
|
||||
|
||||
for k, v in enumerate(enums):
|
||||
data.append((v, [tup[idx] for tup in enums[v]]))
|
||||
PathLog.debug(data)
|
||||
Path.Log.debug(data)
|
||||
|
||||
return data
|
||||
|
||||
@@ -165,7 +164,7 @@ class ToolController:
|
||||
setFromTemplate(obj, xmlItem) ... extract properties from xmlItem
|
||||
and assign to receiver.
|
||||
"""
|
||||
PathLog.track(obj.Name, template)
|
||||
Path.Log.track(obj.Name, template)
|
||||
version = 0
|
||||
if template.get(ToolControllerTemplate.Version):
|
||||
version = int(template.get(ToolControllerTemplate.Version))
|
||||
@@ -218,13 +217,13 @@ class ToolController:
|
||||
exprDef[ToolControllerTemplate.ExprExpr],
|
||||
)
|
||||
else:
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
"Unsupported PathToolController template version {}".format(
|
||||
template.get(ToolControllerTemplate.Version)
|
||||
)
|
||||
)
|
||||
else:
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
"PathToolController template has no version - corrupted template file?"
|
||||
)
|
||||
|
||||
@@ -247,7 +246,7 @@ class ToolController:
|
||||
attrs[ToolControllerTemplate.Tool] = obj.Tool.Proxy.templateAttrs(obj.Tool)
|
||||
expressions = []
|
||||
for expr in obj.ExpressionEngine:
|
||||
PathLog.debug("%s: %s" % (expr[0], expr[1]))
|
||||
Path.Log.debug("%s: %s" % (expr[0], expr[1]))
|
||||
expressions.append(
|
||||
{
|
||||
ToolControllerTemplate.ExprProp: expr[0],
|
||||
@@ -259,7 +258,7 @@ class ToolController:
|
||||
return attrs
|
||||
|
||||
def execute(self, obj):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
|
||||
args = {
|
||||
"toolnumber": obj.ToolNumber,
|
||||
@@ -294,7 +293,7 @@ class ToolController:
|
||||
|
||||
def getTool(self, obj):
|
||||
"""returns the tool associated with this tool controller"""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
return obj.Tool
|
||||
|
||||
def usesLegacyTool(self, obj):
|
||||
@@ -344,7 +343,7 @@ def Create(
|
||||
else isinstance(tool, Path.Tool)
|
||||
)
|
||||
|
||||
PathLog.track(tool, toolNumber, legacyTool)
|
||||
Path.Log.track(tool, toolNumber, legacyTool)
|
||||
|
||||
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
|
||||
obj.Label = name
|
||||
@@ -376,7 +375,7 @@ def Create(
|
||||
|
||||
|
||||
def FromTemplate(template, assignViewProvider=True):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
|
||||
name = template.get(ToolControllerTemplate.Name, ToolControllerTemplate.Label)
|
||||
obj = Create(name, assignViewProvider=True, assignTool=False)
|
||||
|
||||
@@ -24,10 +24,10 @@ from PySide import QtCore, QtGui
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import Path
|
||||
import PathGui as PGui # ensure Path/Gui/Resources are loaded
|
||||
import PathScripts
|
||||
import PathScripts.PathGui as PathGui
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathToolBitGui as PathToolBitGui
|
||||
import PathScripts.PathToolEdit as PathToolEdit
|
||||
import PathScripts.PathUtil as PathUtil
|
||||
@@ -39,10 +39,10 @@ Part = LazyLoader("Part", globals(), "Part")
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
@@ -111,7 +111,7 @@ class ViewProvider:
|
||||
return False
|
||||
|
||||
def setupContextMenu(self, vobj, menu):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
for action in menu.actions():
|
||||
menu.removeAction(action)
|
||||
action = QtGui.QAction(translate("Path", "Edit"), menu)
|
||||
@@ -126,7 +126,7 @@ class ViewProvider:
|
||||
|
||||
|
||||
def Create(name="Default Tool", tool=None, toolNumber=1):
|
||||
PathLog.track(tool, toolNumber)
|
||||
Path.Log.track(tool, toolNumber)
|
||||
|
||||
obj = PathScripts.PathToolController.Create(name, tool, toolNumber)
|
||||
ViewProvider(obj.ViewObject)
|
||||
@@ -161,7 +161,7 @@ class CommandPathToolController(object):
|
||||
return self.selectedJob() is not None
|
||||
|
||||
def Activated(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
job = self.selectedJob()
|
||||
if job:
|
||||
tool = PathToolBitGui.ToolBitSelector().getTool()
|
||||
@@ -265,7 +265,7 @@ class ToolControllerEditor(object):
|
||||
tc.Tool = self.editor.tool
|
||||
|
||||
except Exception as e:
|
||||
PathLog.error("Error updating TC: {}".format(e))
|
||||
Path.Log.error("Error updating TC: {}".format(e))
|
||||
|
||||
def refresh(self):
|
||||
self.form.blockSignals(True)
|
||||
@@ -353,7 +353,7 @@ class DlgToolControllerEdit:
|
||||
|
||||
rc = False
|
||||
if not self.editor.form.exec_():
|
||||
PathLog.info("revert")
|
||||
Path.Log.info("revert")
|
||||
self.obj.Proxy.setFromTemplate(self.obj, restoreTC)
|
||||
rc = True
|
||||
return rc
|
||||
|
||||
@@ -23,13 +23,12 @@
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import Path
|
||||
import PathScripts.PathLog as PathLog
|
||||
import math
|
||||
|
||||
from PySide import QtGui
|
||||
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
# PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
# Path.Log.trackModule(Path.Log.thisModule())
|
||||
|
||||
|
||||
class ToolEditorDefault:
|
||||
@@ -113,7 +112,7 @@ class ToolEditorImage(object):
|
||||
}
|
||||
|
||||
def setupUI(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.form.paramGeneric.hide()
|
||||
self.form.paramImage.show()
|
||||
|
||||
@@ -129,14 +128,14 @@ class ToolEditorImage(object):
|
||||
self.form.image.setPixmap(self.image)
|
||||
|
||||
def updateUI(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.form.value_D.setText(self.quantityDiameter(True).UserString)
|
||||
self.form.value_d.setText(self.quantityFlatRadius(True).UserString)
|
||||
self.form.value_a.setText(self.quantityCuttingEdgeAngle(True).UserString)
|
||||
self.form.value_H.setText(self.quantityCuttingEdgeHeight(True).UserString)
|
||||
|
||||
def updateTool(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
toolDefault = Path.Tool()
|
||||
if "D" in self.hide:
|
||||
self.editor.tool.Diameter = toolDefault.Diameter
|
||||
@@ -227,7 +226,7 @@ class ToolEditorEngrave(ToolEditorImage):
|
||||
super(ToolEditorEngrave, self).__init__(editor, "v-bit.svg", "", "dS")
|
||||
|
||||
def quantityCuttingEdgeHeight(self, propertyToDisplay):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
dr = (self.quantityDiameter(False) - self.quantityFlatRadius(False)) / 2
|
||||
da = self.quantityCuttingEdgeAngle(False).Value
|
||||
return dr / math.tan(math.radians(da) / 2)
|
||||
@@ -297,7 +296,7 @@ class ToolEditor:
|
||||
return matslist[material]
|
||||
|
||||
def updateUI(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.form.toolName.setText(self.tool.Name)
|
||||
self.form.toolType.setCurrentIndex(self.getType(self.tool.ToolType))
|
||||
self.form.toolMaterial.setCurrentIndex(self.getMaterial(self.tool.Material))
|
||||
@@ -310,7 +309,7 @@ class ToolEditor:
|
||||
self.editor.updateUI()
|
||||
|
||||
def updateToolType(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.form.blockSignals(True)
|
||||
self.tool.ToolType = self.getType(self.form.toolType.currentIndex())
|
||||
self.setupToolType(self.tool.ToolType)
|
||||
@@ -318,19 +317,19 @@ class ToolEditor:
|
||||
self.form.blockSignals(False)
|
||||
|
||||
def setupToolType(self, tt):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
print("Tool type: %s" % (tt))
|
||||
if "Undefined" == tt:
|
||||
tt = Path.Tool.getToolTypes(Path.Tool())[0]
|
||||
if tt in self.ToolTypeImage:
|
||||
self.editor = self.ToolTypeImage[tt](self)
|
||||
else:
|
||||
PathLog.debug("weak supported ToolType = %s" % (tt))
|
||||
Path.Log.debug("weak supported ToolType = %s" % (tt))
|
||||
self.editor = ToolEditorDefault(self)
|
||||
self.editor.setupUI()
|
||||
|
||||
def updateTool(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.tool.Name = str(self.form.toolName.text())
|
||||
self.tool.Material = self.getMaterial(self.form.toolMaterial.currentIndex())
|
||||
self.tool.LengthOffset = FreeCAD.Units.parseQuantity(
|
||||
@@ -339,14 +338,14 @@ class ToolEditor:
|
||||
self.editor.updateTool()
|
||||
|
||||
def refresh(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.form.blockSignals(True)
|
||||
self.updateTool()
|
||||
self.updateUI()
|
||||
self.form.blockSignals(False)
|
||||
|
||||
def setupUI(self):
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
self.updateUI()
|
||||
|
||||
self.form.toolName.editingFinished.connect(self.refresh)
|
||||
|
||||
@@ -27,7 +27,6 @@ import FreeCAD
|
||||
import FreeCADGui
|
||||
import Path
|
||||
import PathScripts
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathPreferences as PathPreferences
|
||||
import PathScripts.PathToolBitLibraryCmd as PathToolBitLibraryCmd
|
||||
import PathScripts.PathToolEdit as PathToolEdit
|
||||
@@ -36,10 +35,10 @@ import PathScripts.PathUtils as PathUtils
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
@@ -287,7 +286,7 @@ class EditorPanel:
|
||||
|
||||
for toolnum in tools:
|
||||
tool = self.TLM.getTool(currList, int(toolnum))
|
||||
PathLog.debug("tool: {}, toolnum: {}".format(tool, toolnum))
|
||||
Path.Log.debug("tool: {}, toolnum: {}".format(tool, toolnum))
|
||||
if self.job:
|
||||
label = "T{}: {}".format(toolnum, tool.Name)
|
||||
tc = PathScripts.PathToolController.Create(
|
||||
|
||||
@@ -25,7 +25,6 @@ from __future__ import print_function
|
||||
import FreeCAD
|
||||
import Path
|
||||
import PathScripts
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathUtil as PathUtil
|
||||
import json
|
||||
import os
|
||||
@@ -33,10 +32,10 @@ import xml.sax
|
||||
from PySide import QtGui
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
@@ -217,10 +216,10 @@ class ToolLibraryManager:
|
||||
"""renames a tool table with the new name"""
|
||||
currentTableName = self.toolTables[index].Name
|
||||
if newName == currentTableName:
|
||||
PathLog.error(translate("PathToolLibraryManager", "Tool Table Same Name"))
|
||||
Path.Log.error(translate("PathToolLibraryManager", "Tool Table Same Name"))
|
||||
return False
|
||||
if newName in self.toolTables:
|
||||
PathLog.error(translate("PathToolLibraryManager", "Tool Table Name Exists"))
|
||||
Path.Log.error(translate("PathToolLibraryManager", "Tool Table Name Exists"))
|
||||
return False
|
||||
tt = self.getTableFromName(currentTableName)
|
||||
if tt:
|
||||
@@ -275,7 +274,7 @@ class ToolLibraryManager:
|
||||
|
||||
return tt
|
||||
else:
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
translate(
|
||||
"PathToolLibraryManager",
|
||||
"Unsupported Path tooltable template version %s",
|
||||
@@ -293,7 +292,7 @@ class ToolLibraryManager:
|
||||
if tt:
|
||||
self.toolTables.append(tt)
|
||||
else:
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
translate("PathToolLibraryManager", "Unsupported Path tooltable")
|
||||
)
|
||||
|
||||
|
||||
@@ -27,20 +27,20 @@ PathUtils depends on PathJob. Which makes it impossible to use the functions
|
||||
and classes defined there in PathJob.
|
||||
|
||||
So if you add to this file and think about importing anything from PathScripts
|
||||
other than PathLog, then it probably doesn't belong here.
|
||||
other than Path.Log, then it probably doesn't belong here.
|
||||
"""
|
||||
|
||||
import FreeCAD
|
||||
import six
|
||||
import PathScripts.PathLog as PathLog
|
||||
import Path
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
def _getProperty(obj, prop):
|
||||
@@ -54,13 +54,13 @@ def _getProperty(obj, prop):
|
||||
attr = getattr(o, name)
|
||||
|
||||
if o == attr:
|
||||
PathLog.warning(
|
||||
Path.Log.warning(
|
||||
translate("PathGui", "%s has no property %s (%s))")
|
||||
% (obj.Label, prop, name)
|
||||
)
|
||||
return (None, None, None)
|
||||
|
||||
# PathLog.debug("found property %s of %s (%s: %s)" % (prop, obj.Label, name, attr))
|
||||
# Path.Log.debug("found property %s of %s (%s: %s)" % (prop, obj.Label, name, attr))
|
||||
return (o, attr, name)
|
||||
|
||||
|
||||
@@ -98,18 +98,18 @@ def isValidBaseObject(obj):
|
||||
"""isValidBaseObject(obj) ... returns true if the object can be used as a base for a job."""
|
||||
if hasattr(obj, "getParentGeoFeatureGroup") and obj.getParentGeoFeatureGroup():
|
||||
# Can't link to anything inside a geo feature group anymore
|
||||
PathLog.debug("%s is inside a geo feature group" % obj.Label)
|
||||
Path.Log.debug("%s is inside a geo feature group" % obj.Label)
|
||||
return False
|
||||
if hasattr(obj, "BitBody") and hasattr(obj, "BitShape"):
|
||||
# ToolBit's are not valid base objects
|
||||
return False
|
||||
if obj.TypeId in NotValidBaseTypeIds:
|
||||
PathLog.debug("%s is blacklisted (%s)" % (obj.Label, obj.TypeId))
|
||||
Path.Log.debug("%s is blacklisted (%s)" % (obj.Label, obj.TypeId))
|
||||
return False
|
||||
if hasattr(obj, "Sheets") or hasattr(
|
||||
obj, "TagText"
|
||||
): # Arch.Panels and Arch.PanelCut
|
||||
PathLog.debug("%s is not an Arch.Panel" % (obj.Label))
|
||||
Path.Log.debug("%s is not an Arch.Panel" % (obj.Label))
|
||||
return False
|
||||
import Part
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
import FreeCAD
|
||||
from FreeCAD import Vector
|
||||
from PathScripts import PathLog
|
||||
from PySide import QtCore
|
||||
from PySide import QtGui
|
||||
import Path
|
||||
@@ -43,10 +42,10 @@ translate = FreeCAD.Qt.translate
|
||||
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
|
||||
|
||||
|
||||
UserInput = None
|
||||
@@ -99,7 +98,7 @@ def loopdetect(obj, edge1, edge2):
|
||||
edge2 = edge
|
||||
"""
|
||||
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
candidates = []
|
||||
for wire in obj.Shape.Wires:
|
||||
for e in wire.Edges:
|
||||
@@ -184,7 +183,7 @@ def horizontalFaceLoop(obj, face, faceList=None):
|
||||
|
||||
def filterArcs(arcEdge):
|
||||
"""filterArcs(Edge) -used to split an arc that is over 180 degrees. Returns list"""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
splitlist = []
|
||||
if isinstance(arcEdge.Curve, Part.Circle):
|
||||
angle = abs(arcEdge.LastParameter - arcEdge.FirstParameter) # Angle in radians
|
||||
@@ -225,7 +224,7 @@ def makeWorkplane(shape):
|
||||
"""
|
||||
Creates a workplane circle at the ZMin level.
|
||||
"""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
loc = Vector(shape.BoundBox.Center.x, shape.BoundBox.Center.y, shape.BoundBox.ZMin)
|
||||
c = Part.makeCircle(10, loc)
|
||||
return c
|
||||
@@ -240,20 +239,20 @@ def getEnvelope(partshape, subshape=None, depthparams=None):
|
||||
partshape = solid object
|
||||
stockheight = float - Absolute Z height of the top of material before cutting.
|
||||
"""
|
||||
PathLog.track(partshape, subshape, depthparams)
|
||||
Path.Log.track(partshape, subshape, depthparams)
|
||||
|
||||
zShift = 0
|
||||
if subshape is not None:
|
||||
if isinstance(subshape, Part.Face):
|
||||
PathLog.debug("processing a face")
|
||||
Path.Log.debug("processing a face")
|
||||
sec = Part.makeCompound([subshape])
|
||||
else:
|
||||
area = Path.Area(Fill=2, Coplanar=0).add(subshape)
|
||||
area.setPlane(makeWorkplane(partshape))
|
||||
PathLog.debug("About to section with params: {}".format(area.getParams()))
|
||||
Path.Log.debug("About to section with params: {}".format(area.getParams()))
|
||||
sec = area.makeSections(heights=[0.0], project=True)[0].getShape()
|
||||
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"partshapeZmin: {}, subshapeZMin: {}, zShift: {}".format(
|
||||
partshape.BoundBox.ZMin, subshape.BoundBox.ZMin, zShift
|
||||
)
|
||||
@@ -269,7 +268,7 @@ def getEnvelope(partshape, subshape=None, depthparams=None):
|
||||
if depthparams is not None:
|
||||
eLength = depthparams.safe_height - depthparams.final_depth
|
||||
zShift = depthparams.final_depth - sec.BoundBox.ZMin
|
||||
PathLog.debug(
|
||||
Path.Log.debug(
|
||||
"boundbox zMIN: {} elength: {} zShift {}".format(
|
||||
partshape.BoundBox.ZMin, eLength, zShift
|
||||
)
|
||||
@@ -283,7 +282,7 @@ def getEnvelope(partshape, subshape=None, depthparams=None):
|
||||
|
||||
# Extrude the section to top of Boundbox or desired height
|
||||
envelopeshape = sec.extrude(Vector(0, 0, eLength))
|
||||
if PathLog.getLevel(PathLog.thisModule()) == PathLog.Level.DEBUG:
|
||||
if Path.Log.getLevel(Path.Log.thisModule()) == Path.Log.Level.DEBUG:
|
||||
removalshape = FreeCAD.ActiveDocument.addObject("Part::Feature", "Envelope")
|
||||
removalshape.Shape = envelopeshape
|
||||
return envelopeshape
|
||||
@@ -303,7 +302,7 @@ def getOffsetArea(
|
||||
Inspired by _buildPathArea() from PathAreaOp.py module. Adjustments made
|
||||
based on notes by @sliptonic at this webpage:
|
||||
https://github.com/sliptonic/FreeCAD/wiki/PathArea-notes."""
|
||||
PathLog.debug("getOffsetArea()")
|
||||
Path.Log.debug("getOffsetArea()")
|
||||
|
||||
areaParams = {}
|
||||
areaParams["Offset"] = offset
|
||||
@@ -363,7 +362,7 @@ def getToolControllers(obj, proxy=None):
|
||||
except Exception:
|
||||
job = None
|
||||
|
||||
PathLog.debug("op={} ({})".format(obj.Label, type(obj)))
|
||||
Path.Log.debug("op={} ({})".format(obj.Label, type(obj)))
|
||||
if job:
|
||||
return [tc for tc in job.Tools.Group if proxy.isToolSupported(obj, tc.Tool)]
|
||||
return []
|
||||
@@ -374,7 +373,7 @@ def findToolController(obj, proxy, name=None):
|
||||
If no name is specified, returns the first controller.
|
||||
if no controller is found, returns None"""
|
||||
|
||||
PathLog.track("name: {}".format(name))
|
||||
Path.Log.track("name: {}".format(name))
|
||||
c = None
|
||||
if UserInput:
|
||||
c = UserInput.selectedToolController()
|
||||
@@ -401,7 +400,7 @@ def findToolController(obj, proxy, name=None):
|
||||
|
||||
def findParentJob(obj):
|
||||
"""retrieves a parent job object for an operation or other Path object"""
|
||||
PathLog.track()
|
||||
Path.Log.track()
|
||||
for i in obj.InList:
|
||||
if hasattr(i, "Proxy") and isinstance(i.Proxy, PathJob.ObjectJob):
|
||||
return i
|
||||
@@ -427,7 +426,7 @@ def addToJob(obj, jobname=None):
|
||||
"""adds a path object to a job
|
||||
obj = obj
|
||||
jobname = None"""
|
||||
PathLog.track(jobname)
|
||||
Path.Log.track(jobname)
|
||||
|
||||
job = None
|
||||
if jobname is not None:
|
||||
@@ -435,7 +434,7 @@ def addToJob(obj, jobname=None):
|
||||
if len(jobs) == 1:
|
||||
job = jobs[0]
|
||||
else:
|
||||
PathLog.error(translate("Path", "Didn't find job {}".format(jobname)))
|
||||
Path.Log.error(translate("Path", "Didn't find job {}".format(jobname)))
|
||||
return None
|
||||
else:
|
||||
jobs = GetJobs()
|
||||
@@ -543,17 +542,17 @@ def drillTipLength(tool):
|
||||
"""returns the length of the drillbit tip."""
|
||||
|
||||
if isinstance(tool, Path.Tool):
|
||||
PathLog.error(translate("Path", "Legacy Tools not supported"))
|
||||
Path.Log.error(translate("Path", "Legacy Tools not supported"))
|
||||
return 0.0
|
||||
|
||||
if not hasattr(tool, "TipAngle"):
|
||||
PathLog.error(translate("Path", "Selected tool is not a drill"))
|
||||
Path.Log.error(translate("Path", "Selected tool is not a drill"))
|
||||
return 0.0
|
||||
|
||||
angle = tool.TipAngle
|
||||
|
||||
if angle <= 0 or angle >= 180:
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
translate("Path", "Invalid Cutting Edge Angle %.2f, must be >0° and <=180°")
|
||||
% angle
|
||||
)
|
||||
@@ -563,7 +562,7 @@ def drillTipLength(tool):
|
||||
length = (float(tool.Diameter) / 2) / math.tan(theta / 2)
|
||||
|
||||
if length < 0:
|
||||
PathLog.error(
|
||||
Path.Log.error(
|
||||
translate(
|
||||
"Path", "Cutting Edge Angle (%.2f) results in negative tool tip length"
|
||||
)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user