Moved all Path operations with model and gui into Path.Op module

This commit is contained in:
Markus Lampert
2022-08-11 23:53:33 -07:00
parent 4b205943bc
commit 6da2c338df
65 changed files with 261 additions and 259 deletions

View File

@@ -51,16 +51,6 @@ SET(PathPythonDressupGui_SRCS
Path/Dressup/Gui/ZCorrect.py
)
SET(PathPythonOp_SRCS
Path/Op/__init__.py
Path/Op/Adaptive.py
)
SET(PathPythonOpGui_SRCS
Path/Op/Gui/__init__.py
Path/Op/Gui/Adaptive.py
)
SET(PathPythonTools_SRCS
Path/Tools/__init__.py
Path/Tools/Bit.py
@@ -120,24 +110,62 @@ SET(PathPythonPostScripts_SRCS
Path/Post/scripts/uccnc_post.py
)
SET(PathPythonOp_SRCS
Path/Op/__init__.py
Path/Op/Adaptive.py
Path/Op/Area.py
Path/Op/Base.py
Path/Op/CircularHoleBase.py
Path/Op/Custom.py
Path/Op/Deburr.py
Path/Op/Engrave.py
Path/Op/EngraveBase.py
Path/Op/Drilling.py
Path/Op/Helix.py
Path/Op/MillFace.py
Path/Op/Pocket.py
Path/Op/PocketBase.py
Path/Op/PocketShape.py
Path/Op/Probe.py
Path/Op/Profile.py
Path/Op/Slot.py
Path/Op/Surface.py
Path/Op/SurfaceSupport.py
Path/Op/ThreadMilling.py
Path/Op/Util.py
Path/Op/Vcarve.py
Path/Op/Waterline.py
)
SET(PathPythonOpGui_SRCS
Path/Op/Gui/__init__.py
Path/Op/Gui/Adaptive.py
Path/Op/Gui/Base.py
Path/Op/Gui/CircularHoleBase.py
Path/Op/Gui/Custom.py
Path/Op/Gui/Deburr.py
Path/Op/Gui/Drilling.py
Path/Op/Gui/Engrave.py
Path/Op/Gui/Helix.py
Path/Op/Gui/MillFace.py
Path/Op/Gui/PocketBase.py
Path/Op/Gui/Pocket.py
Path/Op/Gui/PocketShape.py
Path/Op/Gui/Probe.py
Path/Op/Gui/Profile.py
Path/Op/Gui/Slot.py
Path/Op/Gui/Surface.py
Path/Op/Gui/ThreadMilling.py
Path/Op/Gui/Vcarve.py
Path/Op/Gui/Waterline.py
)
SET(PathScripts_SRCS
PathScripts/drillableLib.py
PathScripts/PathAreaOp.py
PathScripts/PathArray.py
PathScripts/PathCircularHoleBase.py
PathScripts/PathCircularHoleBaseGui.py
PathScripts/PathCamoticsGui.py
PathScripts/PathComment.py
PathScripts/PathCopy.py
PathScripts/PathCustom.py
PathScripts/PathCustomGui.py
PathScripts/PathDeburr.py
PathScripts/PathDeburrGui.py
PathScripts/PathDrilling.py
PathScripts/PathDrillingGui.py
PathScripts/PathEngrave.py
PathScripts/PathEngraveBase.py
PathScripts/PathEngraveGui.py
PathScripts/PathFeatureExtensions.py
PathScripts/PathFeatureExtensionsGui.py
PathScripts/PathFixture.py
@@ -145,8 +173,6 @@ SET(PathScripts_SRCS
PathScripts/PathGetPoint.py
PathScripts/PathGui.py
PathScripts/PathGuiInit.py
PathScripts/PathHelix.py
PathScripts/PathHelixGui.py
PathScripts/PathHop.py
PathScripts/PathIconViewProvider.py
PathScripts/PathInspect.py
@@ -154,30 +180,15 @@ SET(PathScripts_SRCS
PathScripts/PathJobCmd.py
PathScripts/PathJobDlg.py
PathScripts/PathJobGui.py
PathScripts/PathMillFace.py
PathScripts/PathMillFaceGui.py
PathScripts/PathOp.py
PathScripts/PathOpGui.py
PathScripts/PathOpTools.py
PathScripts/PathPocket.py
PathScripts/PathPocketBase.py
PathScripts/PathPocketBaseGui.py
PathScripts/PathPocketGui.py
PathScripts/PathPocketShape.py
PathScripts/PathPocketShapeGui.py
PathScripts/PathPreferences.py
PathScripts/PathPreferencesAdvanced.py
PathScripts/PathPreferencesPathJob.py
PathScripts/PathProbe.py
PathScripts/PathProbeGui.py
PathScripts/PathProfile.py
PathScripts/PathProfileContour.py
PathScripts/PathProfileContourGui.py
PathScripts/PathProfileEdges.py
PathScripts/PathProfileEdgesGui.py
PathScripts/PathProfileFaces.py
PathScripts/PathProfileFacesGui.py
PathScripts/PathProfileGui.py
PathScripts/PathProperty.py
PathScripts/PathPropertyBag.py
PathScripts/PathPropertyBagGui.py
@@ -190,25 +201,14 @@ SET(PathScripts_SRCS
PathScripts/PathSetupSheetOpPrototypeGui.py
PathScripts/PathSimpleCopy.py
PathScripts/PathSimulatorGui.py
PathScripts/PathSlot.py
PathScripts/PathSlotGui.py
PathScripts/PathStock.py
PathScripts/PathStop.py
PathScripts/PathSurface.py
PathScripts/PathSurfaceGui.py
PathScripts/PathSurfaceSupport.py
PathScripts/PathThreadMilling.py
PathScripts/PathThreadMillingGui.py
PathScripts/PathToolEdit.py
PathScripts/PathToolLibraryEditor.py
PathScripts/PathToolLibraryManager.py
PathScripts/PathUtil.py
PathScripts/PathUtils.py
PathScripts/PathUtilsGui.py
PathScripts/PathVcarve.py
PathScripts/PathVcarveGui.py
PathScripts/PathWaterline.py
PathScripts/PathWaterlineGui.py
PathScripts/__init__.py
)
@@ -287,7 +287,7 @@ SET(PathTests_SRCS
PathTests/TestPathHelpers.py
PathTests/TestPathHelixGenerator.py
PathTests/TestPathLog.py
PathTests/TestPathOpTools.py
PathTests/TestPathOpUtil.py
PathTests/TestPathPost.py
PathTests/TestPathPreferences.py
PathTests/TestPathPropertyBag.py

View File

@@ -173,8 +173,8 @@ class PathWorkbench(Workbench):
try:
import ocl # pylint: disable=unused-variable
from PathScripts import PathSurfaceGui
from PathScripts import PathWaterlineGui
from Path.Op.Gui import Surface
from Path.Op.Gui import Waterline
threedopcmdlist.extend(["Path_Surface", "Path_Waterline"])
threedcmdgroup = ["Path_3dTools"]
@@ -325,7 +325,7 @@ class PathWorkbench(Workbench):
"", ["Path_ExportTemplate"] + self.toolbitctxmenu
)
menuAppended = True
if isinstance(obj.Proxy, PathScripts.PathOp.ObjectOp):
if isinstance(obj.Proxy, Path.Op.Base.ObjectOp):
self.appendContextMenu(
"", ["Path_OperationCopy", "Path_OpActiveToggle"]
)

View File

@@ -1342,7 +1342,7 @@ class ViewProviderDressup(object):
def Create(base, name="DogboneDressup"):
"""
Create(obj, name='DogboneDressup') ... dresses the given PathProfile/PathContour object with dogbones.
Create(obj, name='DogboneDressup') ... dresses the given Path.Op.Profile/PathContour object with dogbones.
"""
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
dbo = ObjectDressup(obj, base)

View File

@@ -23,7 +23,7 @@
# ***************************************************************************
import Path
import PathScripts.PathOp as PathOp
import Path.Op.Base as PathOp
import PathScripts.PathUtils as PathUtils
import PathScripts.PathGeom as PathGeom
import FreeCAD

View File

@@ -23,7 +23,7 @@
from PySide.QtCore import QT_TRANSLATE_NOOP
import FreeCAD
import Path
import PathScripts.PathOp as PathOp
import Path.Op.Base as PathOp
import PathScripts.PathUtils as PathUtils

View File

@@ -23,7 +23,7 @@
from PySide.QtCore import QT_TRANSLATE_NOOP
import FreeCAD
import Path
import PathScripts.PathOp as PathOp
import Path.Op.Base as PathOp
import PathScripts.drillableLib as drillableLib
# lazily loaded modules

View File

@@ -22,8 +22,7 @@
import FreeCAD
import Path
import PathScripts.PathOp as PathOp
import Path.Op.Base as PathOp
from PySide.QtCore import QT_TRANSLATE_NOOP

View File

@@ -23,10 +23,10 @@
import FreeCAD
import Path
import PathScripts.PathEngraveBase as PathEngraveBase
import Path.Op.Base as PathOp
import Path.Op.EngraveBase as PathEngraveBase
import Path.Op.Util as PathOpUtil
import PathScripts.PathGeom as PathGeom
import PathScripts.PathOp as PathOp
import PathScripts.PathOpTools as PathOpTools
import math
from PySide.QtCore import QT_TRANSLATE_NOOP
@@ -410,7 +410,7 @@ class ObjectDeburr(PathEngraveBase.ObjectOp):
for w in basewires:
self.adjusted_basewires.append(w)
wire = PathOpTools.offsetWire(w, base.Shape, offset, True, side)
wire = PathOpUtil.offsetWire(w, base.Shape, offset, True, side)
if wire:
wires.append(wire)

View File

@@ -28,10 +28,10 @@ from Generators import drill_generator as generator
import FreeCAD
import Part
import Path
import Path.Op.Base as PathOp
import Path.Op.CircularHoleBase as PathCircularHoleBase
import PathFeedRate
import PathMachineState
import PathScripts.PathCircularHoleBase as PathCircularHoleBase
import PathScripts.PathOp as PathOp
import PathScripts.PathUtils as PathUtils
from PySide.QtCore import QT_TRANSLATE_NOOP

View File

@@ -22,8 +22,8 @@
import FreeCAD
import Path
import PathScripts.PathEngraveBase as PathEngraveBase
import PathScripts.PathOp as PathOp
import Path.Op.Base as PathOp
import Path.Op.EngraveBase as PathEngraveBase
import PathScripts.PathUtils as PathUtils
from PySide.QtCore import QT_TRANSLATE_NOOP

View File

@@ -22,9 +22,9 @@
from lazy_loader.lazy_loader import LazyLoader
import Path
import Path.Op.Base as PathOp
import PathScripts.PathGeom as PathGeom
import PathScripts.PathOp as PathOp
import PathScripts.PathOpTools as PathOpTools
import Path.Op.Util as PathOpUtil
import copy
__doc__ = "Base class for all ops in the engrave family."
@@ -64,7 +64,7 @@ class ObjectOp(PathOp.ObjectOp):
decomposewires = []
for wire in wires:
decomposewires.extend(PathOpTools.makeWires(wire.Edges))
decomposewires.extend(PathOpUtil.makeWires(wire.Edges))
wires = decomposewires
for wire in wires:
@@ -75,7 +75,7 @@ class ObjectOp(PathOp.ObjectOp):
start_idx = obj.StartVertex
edges = wire.Edges
# edges = copy.copy(PathOpTools.orientWire(offset, forward).Edges)
# edges = copy.copy(PathOpUtil.orientWire(offset, forward).Edges)
# Path.Log.track("wire: {} offset: {}".format(len(wire.Edges), len(edges)))
# edges = Part.sortEdges(edges)[0]
# Path.Log.track("edges: {}".format(len(edges)))

View File

@@ -22,7 +22,7 @@
# ***************************************************************************
import Path.Op.Adaptive as PathAdaptive
import PathScripts.PathOpGui as PathOpGui
import Path.Op.Gui.Base as PathOpGui
from PySide import QtCore
import PathScripts.PathFeatureExtensionsGui as PathFeatureExtensionsGui
import FreeCADGui

View File

@@ -23,12 +23,12 @@
import FreeCAD
import FreeCADGui
import Path
import Path.Op.Base as PathOp
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.PathOp as PathOp
import PathScripts.PathPreferences as PathPreferences
import PathScripts.PathSelection as PathSelection
import PathScripts.PathSetupSheet as PathSetupSheet

View File

@@ -23,8 +23,8 @@
import FreeCAD
import FreeCADGui
import Path
import Path.Op.Gui.Base as PathOpGui
import PathGui as PGui # ensure Path/Gui/Resources are loaded
import PathScripts.PathOpGui as PathOpGui
from PySide import QtCore, QtGui

View File

@@ -22,8 +22,8 @@
import FreeCAD
import FreeCADGui
import PathScripts.PathCustom as PathCustom
import PathScripts.PathOpGui as PathOpGui
import Path.Op.Custom as PathCustom
import Path.Op.Gui.Base as PathOpGui
from PySide.QtCore import QT_TRANSLATE_NOOP

View File

@@ -23,9 +23,9 @@
import FreeCAD
import FreeCADGui
import Path
import PathScripts.PathDeburr as PathDeburr
import Path.Op.Deburr as PathDeburr
import Path.Op.Gui.Base as PathOpGui
import PathScripts.PathGui as PathGui
import PathScripts.PathOpGui as PathOpGui
from PySide import QtCore, QtGui
from PySide.QtCore import QT_TRANSLATE_NOOP

View File

@@ -23,11 +23,11 @@
import FreeCAD
import FreeCADGui
import Path
import Path.Op.Drilling as PathDrilling
import Path.Op.Gui.Base as PathOpGui
import Path.Op.Gui.CircularHoleBase as PathCircularHoleBaseGui
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.PathOpGui as PathOpGui
from PySide import QtCore

View File

@@ -23,9 +23,9 @@
import FreeCAD
import FreeCADGui
import Path
import Path.Op.Engrave as PathEngrave
import Path.Op.Gui.Base as PathOpGui
import PathGui as PGui # ensure Path/Gui/Resources are loaded
import PathScripts.PathEngrave as PathEngrave
import PathScripts.PathOpGui as PathOpGui
import PathScripts.PathUtils as PathUtils
from PySide import QtCore, QtGui

View File

@@ -23,10 +23,10 @@
import FreeCAD
import FreeCADGui
import Path
import Path.Op.Gui.Base as PathOpGui
import Path.Op.Gui.CircularHoleBase as PathCircularHoleBaseGui
import Path.Op.Helix as PathHelix
import PathGui as PGui # ensure Path/Gui/Resources are loaded
import PathScripts.PathCircularHoleBaseGui as PathCircularHoleBaseGui
import PathScripts.PathHelix as PathHelix
import PathScripts.PathOpGui as PathOpGui
import PathScripts.PathGui as PathGui
from PySide.QtCore import QT_TRANSLATE_NOOP

View File

@@ -23,10 +23,10 @@
from PySide.QtCore import QT_TRANSLATE_NOOP
import FreeCAD
import Path
import PathScripts.PathMillFace as PathMillFace
import PathScripts.PathOpGui as PathOpGui
import PathScripts.PathPocketBaseGui as PathPocketBaseGui
import PathScripts.PathPocketShape as PathPocketShape
import Path.Op.Gui.Base as PathOpGui
import Path.Op.Gui.PocketBase as PathPocketBaseGui
import Path.Op.MillFace as PathMillFace
import Path.Op.PocketShape as PathPocketShape
import FreeCADGui
__title__ = "Path Face Mill Operation UI"

View File

@@ -22,9 +22,9 @@
import FreeCAD
import Path
import PathScripts.PathOpGui as PathOpGui
import PathScripts.PathPocket as PathPocket
import PathScripts.PathPocketBaseGui as PathPocketBaseGui
import Path.Op.Gui.Base as PathOpGui
import Path.Op.Gui.PocketBase as PathPocketBaseGui
import Path.Op.Pocket as PathPocket
from PySide.QtCore import QT_TRANSLATE_NOOP

View File

@@ -23,10 +23,10 @@
import FreeCAD
import FreeCADGui
import Path
import Path.Op.Gui.Base as PathOpGui
import Path.Op.Pocket as PathPocket
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
__title__ = "Path Pocket Base Operation UI"
__author__ = "sliptonic (Brad Collette)"

View File

@@ -22,9 +22,9 @@
import FreeCAD
import Path
import PathScripts.PathOpGui as PathOpGui
import PathScripts.PathPocketShape as PathPocketShape
import PathScripts.PathPocketBaseGui as PathPocketBaseGui
import Path.Op.Gui.Base as PathOpGui
import Path.Op.Gui.PocketBase as PathPocketBaseGui
import Path.Op.PocketShape as PathPocketShape
import PathScripts.PathFeatureExtensionsGui as PathFeatureExtensionsGui
from PySide.QtCore import QT_TRANSLATE_NOOP

View File

@@ -23,9 +23,9 @@
import FreeCAD
import FreeCADGui
import Path
import Path.Op.Gui.Base as PathOpGui
import Path.Op.Probe as PathProbe
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
from PySide.QtCore import QT_TRANSLATE_NOOP

View File

@@ -22,10 +22,10 @@
import FreeCAD
import FreeCADGui
import Path.Op.Gui.Base as PathOpGui
import Path.Op.Profile as PathProfile
import PathGui as PGui # ensure Path/Gui/Resources are loaded
import PathScripts.PathGui as PathGui
import PathScripts.PathOpGui as PathOpGui
import PathScripts.PathProfile as PathProfile
from PySide.QtCore import QT_TRANSLATE_NOOP

View File

@@ -22,10 +22,10 @@
import FreeCAD
import FreeCADGui
import Path.Op.Gui.Base as PathOpGui
import Path.Op.Slot as PathSlot
import PathGui as PGui # ensure Path/Gui/Resources are loaded
import PathScripts.PathSlot as PathSlot
import PathScripts.PathGui as PathGui
import PathScripts.PathOpGui as PathOpGui
from PySide import QtCore

View File

@@ -24,10 +24,10 @@ from PySide import QtCore
import FreeCAD
import FreeCADGui
import Path
import Path.Op.Gui.Base as PathOpGui
import Path.Op.Surface as PathSurface
import PathGui as PGui # ensure Path/Gui/Resources are loaded
import PathScripts.PathGui as PathGui
import PathScripts.PathOpGui as PathOpGui
import PathScripts.PathSurface as PathSurface
__title__ = "Path Surface Operation UI"

View File

@@ -23,11 +23,11 @@
import FreeCAD
import FreeCADGui
import Path
import Path.Op.Gui.Base as PathOpGui
import Path.Op.Gui.CircularHoleBase as PathCircularHoleBaseGui
import Path.Op.ThreadMilling as PathThreadMilling
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.PathOpGui as PathOpGui
import csv
from PySide.QtCore import QT_TRANSLATE_NOOP

View File

@@ -23,9 +23,9 @@
import FreeCAD
import FreeCADGui
import Path
import Path.Op.Gui.Base as PathOpGui
import Path.Op.Vcarve as PathVcarve
import PathGui as PGui # ensure Path/Gui/Resources are loaded
import PathScripts.PathVcarve as PathVcarve
import PathScripts.PathOpGui as PathOpGui
import PathScripts.PathUtils as PathUtils
from PySide import QtCore, QtGui

View File

@@ -26,9 +26,9 @@ from PySide.QtCore import QT_TRANSLATE_NOOP
import FreeCAD
import FreeCADGui
import Path
import Path.Op.Gui.Base as PathOpGui
import Path.Op.Waterline as PathWaterline
import PathScripts.PathGui as PathGui
import PathScripts.PathOpGui as PathOpGui
import PathScripts.PathWaterline as PathWaterline
__title__ = "Path Waterline Operation UI"
__author__ = "sliptonic (Brad Collette), russ4262 (Russell Johnson)"

View File

@@ -27,8 +27,8 @@ from PySide.QtCore import QT_TRANSLATE_NOOP
import FreeCAD
import Part
import Path
import PathScripts.PathCircularHoleBase as PathCircularHoleBase
import PathScripts.PathOp as PathOp
import Path.Op.Base as PathOp
import Path.Op.CircularHoleBase as PathCircularHoleBase
import PathFeedRate

View File

@@ -24,7 +24,7 @@ from __future__ import print_function
import FreeCAD
import Path
import PathScripts.PathPocketBase as PathPocketBase
import Path.Op.PocketBase as PathPocketBase
import PathScripts.PathUtils as PathUtils
from PySide.QtCore import QT_TRANSLATE_NOOP
import numpy

View File

@@ -24,8 +24,8 @@ from PySide.QtCore import QT_TRANSLATE_NOOP
import FreeCAD
import Part
import Path
import PathScripts.PathOp as PathOp
import PathScripts.PathPocketBase as PathPocketBase
import Path.Op.Base as PathOp
import Path.Op.PocketBase as PathPocketBase
import PathScripts.PathUtils as PathUtils
# lazily loaded modules

View File

@@ -22,8 +22,8 @@
import FreeCAD
import Path
import PathScripts.PathAreaOp as PathAreaOp
import PathScripts.PathOp as PathOp
import Path.Op.Area as PathAreaOp
import Path.Op.Base as PathOp
from PySide.QtCore import QT_TRANSLATE_NOOP

View File

@@ -23,9 +23,9 @@
from PySide.QtCore import QT_TRANSLATE_NOOP
import FreeCAD
import Path
import Path.Op.Base as PathOp
import Path.Op.PocketBase as PathPocketBase
import PathScripts.PathGeom as PathGeom
import PathScripts.PathOp as PathOp
import PathScripts.PathPocketBase as PathPocketBase
# lazily loaded modules

View File

@@ -24,7 +24,7 @@ from __future__ import print_function
import FreeCAD
import Path
import PathScripts.PathOp as PathOp
import Path.Op.Base as PathOp
import PathScripts.PathUtils as PathUtils
from PySide.QtCore import QT_TRANSLATE_NOOP

View File

@@ -24,8 +24,8 @@
import FreeCAD
import Path
import PathScripts.PathAreaOp as PathAreaOp
import PathScripts.PathOp as PathOp
import Path.Op.Area as PathAreaOp
import Path.Op.Base as PathOp
import PathScripts.PathUtils as PathUtils
import PathScripts.drillableLib as drillableLib
import math

View File

@@ -32,8 +32,8 @@ __contributors__ = ""
import FreeCAD
from PySide import QtCore
import Path
import Path.Op.Base as PathOp
import PathScripts.PathUtils as PathUtils
import PathScripts.PathOp as PathOp
import math
# lazily loaded modules

View File

@@ -47,8 +47,8 @@ except ImportError:
from PySide.QtCore import QT_TRANSLATE_NOOP
import Path
import PathScripts.PathOp as PathOp
import PathScripts.PathSurfaceSupport as PathSurfaceSupport
import Path.Op.Base as PathOp
import Path.Op.SurfaceSupport as PathSurfaceSupport
import PathScripts.PathUtils as PathUtils
import math
import time

View File

@@ -30,8 +30,8 @@ __contributors__ = ""
import FreeCAD
import Path
import Path.Op.Util as PathOpUtil
import PathScripts.PathUtils as PathUtils
import PathScripts.PathOpTools as PathOpTools
import math
# lazily loaded modules
@@ -426,7 +426,7 @@ class PathGeometryGenerator:
loop_cnt = 0
def _get_direction(w):
if PathOpTools._isWireClockwise(w):
if PathOpUtil._isWireClockwise(w):
return 1
return -1

View File

@@ -24,9 +24,9 @@ from __future__ import print_function
import FreeCAD
import Path
import PathScripts.PathCircularHoleBase as PathCircularHoleBase
import Path.Op.Base as PathOp
import Path.Op.CircularHoleBase as PathCircularHoleBase
import PathScripts.PathGeom as PathGeom
import PathScripts.PathOp as PathOp
import Generators.threadmilling_generator as threadmilling
import math
from PySide.QtCore import QT_TRANSLATE_NOOP

View File

@@ -32,7 +32,7 @@ from lazy_loader.lazy_loader import LazyLoader
Part = LazyLoader("Part", globals(), "Part")
__title__ = "PathOpTools - Tools for Path operations."
__title__ = "Util - Utility functions for Path operations."
__author__ = "sliptonic (Brad Collette)"
__url__ = "https://www.freecadweb.org"
__doc__ = "Collection of functions used by various Path operations. The functions are specific to Path and the algorithms employed by Path's operations."

View File

@@ -23,8 +23,8 @@
import FreeCAD
import Part
import Path
import PathScripts.PathEngraveBase as PathEngraveBase
import PathScripts.PathOp as PathOp
import Path.Op.Base as PathOp
import Path.Op.EngraveBase as PathEngraveBase
import PathScripts.PathUtils as PathUtils
import PathScripts.PathGeom as PathGeom
import PathScripts.PathPreferences as PathPreferences

View File

@@ -43,8 +43,8 @@ except ImportError:
raise ImportError
import Path
import PathScripts.PathOp as PathOp
import PathScripts.PathSurfaceSupport as PathSurfaceSupport
import Path.Op.Base as PathOp
import Path.Op.SurfaceSupport as PathSurfaceSupport
import PathScripts.PathUtils as PathUtils
import math
import time

View File

@@ -50,11 +50,11 @@ import re
from PySide.QtCore import QT_TRANSLATE_NOOP
if FreeCAD.GuiUp:
import PathScripts.PathCustomGui as PathCustomGui
import Path.Op.Gui.Custom as PathCustomGui
PathCustom = PathCustomGui.PathCustom
else:
import PathScripts.PathCustom as PathCustom
import Path.Op.Custom as PathCustom
translate = FreeCAD.Qt.translate

View File

@@ -350,15 +350,15 @@ def export(objectslist, filename, argstring):
MACHINE_LAST_POSITION["X"] = 99999
MACHINE_LAST_POSITION["Y"] = 99999
MACHINE_LAST_POSITION["Z"] = 99999
elif isinstance(obj.Proxy, PathScripts.PathProfileEdges.ObjectProfile):
elif isinstance(obj.Proxy, Path.Op.ProfileEdges.ObjectProfile):
Object_Kind = "PROFILE"
if LBLIZE_ACTIVE:
LBLIZE_STAUS = True
elif isinstance(obj.Proxy, PathScripts.PathMillFace.ObjectFace):
elif isinstance(obj.Proxy, Path.Op.MillFace.ObjectFace):
Object_Kind = "FACE"
if LBLIZE_ACTIVE:
LBLIZE_STAUS = True
elif isinstance(obj.Proxy, PathScripts.PathHelix.ObjectHelix):
elif isinstance(obj.Proxy, Path.Op.Helix.ObjectHelix):
Object_Kind = "HELIX"
# If used compensated path, store, recompute and diff when asked

View File

@@ -163,7 +163,7 @@ class _ToggleOperation:
for sel in FreeCADGui.Selection.getSelectionEx():
selProxy = Path.Dressup.Utils.baseOp(sel.Object).Proxy
if not isinstance(
selProxy, PathScripts.PathOp.ObjectOp
selProxy, Path.Op.Base.ObjectOp
) and not isinstance(selProxy, PathScripts.PathArray.ObjectArray):
return False
return True
@@ -203,7 +203,7 @@ class _CopyOperation:
return False
try:
for sel in FreeCADGui.Selection.getSelectionEx():
if not isinstance(sel.Object.Proxy, PathScripts.PathOp.ObjectOp):
if not isinstance(sel.Object.Proxy, Path.Op.Base.ObjectOp):
return False
return True
except (IndexError, AttributeError):

View File

@@ -25,10 +25,10 @@ from pivy import coin
import FreeCAD
import FreeCADGui
import Path
import Path.Op.Gui.Base as PathOpGui
import PathScripts.PathFeatureExtensions as FeatureExtensions
import PathScripts.PathGeom as PathGeom
import PathScripts.PathGui as PathGui
import PathScripts.PathOpGui as PathOpGui
# lazily loaded modules
from lazy_loader.lazy_loader import LazyLoader

View File

@@ -47,36 +47,36 @@ def Startup():
from Path.Dressup.Gui import RampEntry
from Path.Dressup.Gui import Tags
from Path.Dressup.Gui import ZCorrect
from Path.Op.Gui import Custom
from Path.Op.Gui import Deburr
from Path.Op.Gui import Drilling
from Path.Op.Gui import Engrave
from Path.Op.Gui import Helix
from Path.Op.Gui import MillFace
from Path.Op.Gui import Pocket
from Path.Op.Gui import PocketShape
from Path.Op.Gui import Probe
from Path.Op.Gui import Profile
from Path.Op.Gui import Slot
from Path.Op.Gui import ThreadMilling
from Path.Op.Gui import Vcarve
from Path.Post import Command
from Path.Tools import Controller
from Path.Tools.Gui import Controller
from PathScripts import PathArray
from PathScripts import PathComment
from PathScripts import PathCustomGui
from PathScripts import PathDeburrGui
from PathScripts import PathDrillingGui
from PathScripts import PathEngraveGui
from PathScripts import PathFixture
from PathScripts import PathHelixGui
from PathScripts import PathHop
from PathScripts import PathInspect
from PathScripts import PathMillFaceGui
from PathScripts import PathPocketGui
from PathScripts import PathPocketShapeGui
from PathScripts import PathProbeGui
from PathScripts import PathProfileGui
from PathScripts import PathPropertyBagGui
from PathScripts import PathSanity
from PathScripts import PathSetupSheetGui
from PathScripts import PathSimpleCopy
from PathScripts import PathSimulatorGui
from PathScripts import PathSlotGui
from PathScripts import PathStop
from PathScripts import PathThreadMillingGui
from PathScripts import PathToolLibraryEditor
from PathScripts import PathToolLibraryManager
from PathScripts import PathUtilsGui
from PathScripts import PathVcarveGui
from packaging.version import Version, parse

View File

@@ -22,7 +22,7 @@
# * Major modifications: 2020 Russell Johnson <russ4262@gmail.com> *
import FreeCAD
import PathScripts.PathProfile as PathProfile
import Path.Op.Profile as PathProfile
__title__ = "Path Contour Operation (depreciated)"

View File

@@ -22,9 +22,10 @@
# * Major modifications: 2020 Russell Johnson <russ4262@gmail.com> *
import FreeCAD
import PathScripts.PathOpGui as PathOpGui
import PathScripts.PathProfile as PathProfile
import PathScripts.PathProfileGui as PathProfileGui
import Path
import Path.Op.Gui.Base as PathOpGui
import Path.Op.Gui.Profile as PathProfileGui
import Path.Op.Profile as PathProfile
from PySide.QtCore import QT_TRANSLATE_NOOP
__title__ = "Path Contour Operation UI (depreciated)"

View File

@@ -22,7 +22,8 @@
# * Major modifications: 2020 Russell Johnson <russ4262@gmail.com> *
import FreeCAD
import PathScripts.PathProfile as PathProfile
import Path
import Path.Op.Profile as PathProfile
__title__ = "Path Profile Edges Operation (depreciated)"

View File

@@ -22,9 +22,9 @@
# * Major modifications: 2020 Russell Johnson <russ4262@gmail.com> *
import FreeCAD
import PathScripts.PathOpGui as PathOpGui
import PathScripts.PathProfile as PathProfile
import PathScripts.PathProfileGui as PathProfileGui
import Path.Op.Gui.Base as PathOpGui
import Path.Op.Gui.Profile as PathProfileGui
import Path.Op.Profile as PathProfile
from PySide.QtCore import QT_TRANSLATE_NOOP
__title__ = "Path Profile Edges Operation UI (depreciated)"

View File

@@ -23,7 +23,7 @@
# * Major modifications: 2020 Russell Johnson <russ4262@gmail.com> *
import FreeCAD
import PathScripts.PathProfile as PathProfile
import Path.Op.Profile as PathProfile
__title__ = "Path Profile Faces Operation (depreciated)"

View File

@@ -22,9 +22,9 @@
# * Major modifications: 2020 Russell Johnson <russ4262@gmail.com> *
import FreeCAD
import PathScripts.PathOpGui as PathOpGui
import PathScripts.PathProfile as PathProfile
import PathScripts.PathProfileGui as PathProfileGui
import Path.Op.Gui.Base as PathOpGui
import Path.Op.Gui.Profile as PathProfileGui
import Path.Op.Profile as PathProfile
from PySide.QtCore import QT_TRANSLATE_NOOP
__title__ = "Path Profile Faces Operation UI (depreciated)"

View File

@@ -22,6 +22,7 @@
import FreeCAD
import FreeCADGui
import Path
import PathScripts
from PySide.QtCore import QT_TRANSLATE_NOOP
@@ -45,7 +46,7 @@ class CommandPathSimpleCopy:
return False
try:
obj = FreeCADGui.Selection.getSelectionEx()[0].Object
return isinstance(obj.Proxy, PathScripts.PathOp.ObjectOp)
return isinstance(obj.Proxy, Path.Op.Base.ObjectOp)
except Exception:
return False
@@ -71,9 +72,9 @@ class CommandPathSimpleCopy:
)
FreeCADGui.addModule("PathScripts.PathUtils")
FreeCADGui.addModule("PathScripts.PathCustom")
FreeCADGui.addModule("Path.Op.Custom")
FreeCADGui.doCommand(
'obj = PathScripts.PathCustom.Create("'
'obj = Path.Op.Custom.Create("'
+ selection[0].Name
+ '_SimpleCopy")'
)

View File

@@ -24,7 +24,6 @@
import FreeCAD
from FreeCAD import Vector
from PySide import QtCore
from PySide import QtGui
import Path
import PathScripts.PathGeom as PathGeom
import PathScripts.PathJob as PathJob
@@ -64,6 +63,7 @@ def waiting_effects(function):
def new_function(*args, **kwargs):
if not FreeCAD.GuiUp:
return function(*args, **kwargs)
from PySide import QtGui
QtGui.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)
res = None
try:
@@ -299,7 +299,7 @@ def getOffsetArea(
):
"""Make an offset area of a shape, projected onto a plane.
Positive offsets expand the area, negative offsets shrink it.
Inspired by _buildPathArea() from PathAreaOp.py module. Adjustments made
Inspired by _buildPathArea() from Path.Op.Area.py module. Adjustments made
based on notes by @sliptonic at this webpage:
https://github.com/sliptonic/FreeCAD/wiki/PathArea-notes."""
Path.Log.debug("getOffsetArea()")

View File

@@ -23,7 +23,7 @@
import FreeCADGui
import FreeCAD
import Path
import Path.Tools.Controller as PathToolsController
import Path.Tools.Controller as PathToolController
import PathGui as PGui # ensure Path/Gui/Resources are loaded
import PathScripts.PathJobCmd as PathJobCmd
import PathScripts.PathUtils as PathUtils

View File

@@ -21,7 +21,7 @@
# ***************************************************************************
import Path
import PathScripts.PathDeburr as PathDeburr
import Path.Op.Deburr as PathDeburr
import PathTests.PathTestUtils as PathTestUtils
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())

View File

@@ -23,7 +23,7 @@
import Draft
import FreeCAD
import Path
import PathScripts.PathHelix as PathHelix
import Path.Op.Helix as PathHelix
import PathScripts.PathJob as PathJob
import PathTests.PathTestUtils as PathTestUtils

View File

@@ -23,8 +23,8 @@
import FreeCAD
import Part
import Path
import Path.Op.Util as PathOpUtil
import PathScripts.PathGeom as PathGeom
import PathScripts.PathOpTools as PathOpTools
import PathTests.PathTestUtils as PathTestUtils
import math
@@ -85,7 +85,7 @@ def wireMarkers(wire):
return pts
class TestPathOpTools(PathTestUtils.PathTestBase):
class TestPathOpUtil(PathTestUtils.PathTestBase):
@classmethod
def setUpClass(cls):
global doc
@@ -104,18 +104,18 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
pc = Vector(5, 5, 0)
pd = Vector(5, 1, 0)
self.assertTrue(PathOpTools.isWireClockwise(makeWire([pa, pb, pc, pd])))
self.assertFalse(PathOpTools.isWireClockwise(makeWire([pa, pd, pc, pb])))
self.assertTrue(PathOpUtil.isWireClockwise(makeWire([pa, pb, pc, pd])))
self.assertFalse(PathOpUtil.isWireClockwise(makeWire([pa, pd, pc, pb])))
def test01(self):
"""Verify isWireClockwise for single edge circle wires."""
self.assertTrue(
PathOpTools.isWireClockwise(
PathOpUtil.isWireClockwise(
Part.makeCircle(5, Vector(1, 2, 3), Vector(0, 0, -1))
)
)
self.assertFalse(
PathOpTools.isWireClockwise(
PathOpUtil.isWireClockwise(
Part.makeCircle(5, Vector(1, 2, 3), Vector(0, 0, +1))
)
)
@@ -124,31 +124,31 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
"""Verify isWireClockwise for two half circle wires."""
e0 = Part.makeCircle(5, Vector(1, 2, 3), Vector(0, 0, -1), 0, 180)
e1 = Part.makeCircle(5, Vector(1, 2, 3), Vector(0, 0, -1), 180, 360)
self.assertTrue(PathOpTools.isWireClockwise(Part.Wire([e0, e1])))
self.assertTrue(PathOpUtil.isWireClockwise(Part.Wire([e0, e1])))
e0 = Part.makeCircle(5, Vector(1, 2, 3), Vector(0, 0, +1), 0, 180)
e1 = Part.makeCircle(5, Vector(1, 2, 3), Vector(0, 0, +1), 180, 360)
self.assertFalse(PathOpTools.isWireClockwise(Part.Wire([e0, e1])))
self.assertFalse(PathOpUtil.isWireClockwise(Part.Wire([e0, e1])))
def test03(self):
"""Verify isWireClockwise for two edge wires with an arc."""
e0 = Part.makeCircle(5, Vector(1, 2, 3), Vector(0, 0, -1), 0, 180)
e2 = Part.makeLine(e0.valueAt(e0.LastParameter), e0.valueAt(e0.FirstParameter))
self.assertTrue(PathOpTools.isWireClockwise(Part.Wire([e0, e2])))
self.assertTrue(PathOpUtil.isWireClockwise(Part.Wire([e0, e2])))
e0 = Part.makeCircle(5, Vector(1, 2, 3), Vector(0, 0, +1), 0, 180)
e2 = Part.makeLine(e0.valueAt(e0.LastParameter), e0.valueAt(e0.FirstParameter))
self.assertFalse(PathOpTools.isWireClockwise(Part.Wire([e0, e2])))
self.assertFalse(PathOpUtil.isWireClockwise(Part.Wire([e0, e2])))
def test04(self):
"""Verify isWireClockwise for unoriented wires."""
e0 = Part.makeCircle(5, Vector(1, 2, 3), Vector(0, 0, -1), 0, 180)
e3 = Part.makeLine(e0.valueAt(e0.FirstParameter), e0.valueAt(e0.LastParameter))
self.assertTrue(PathOpTools.isWireClockwise(Part.Wire([e0, e3])))
self.assertTrue(PathOpUtil.isWireClockwise(Part.Wire([e0, e3])))
e0 = Part.makeCircle(5, Vector(1, 2, 3), Vector(0, 0, +1), 0, 180)
e3 = Part.makeLine(e0.valueAt(e0.FirstParameter), e0.valueAt(e0.LastParameter))
self.assertFalse(PathOpTools.isWireClockwise(Part.Wire([e0, e3])))
self.assertFalse(PathOpUtil.isWireClockwise(Part.Wire([e0, e3])))
def test11(self):
"""Check offsetting a circular hole."""
@@ -157,13 +157,13 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
small = getWireInside(obj)
self.assertRoughly(10, small.Edges[0].Curve.Radius)
wire = PathOpTools.offsetWire(small, obj.Shape, 3, True)
wire = PathOpUtil.offsetWire(small, obj.Shape, 3, True)
self.assertIsNotNone(wire)
self.assertEqual(1, len(wire.Edges))
self.assertRoughly(7, wire.Edges[0].Curve.Radius)
self.assertCoincide(Vector(0, 0, 1), wire.Edges[0].Curve.Axis)
wire = PathOpTools.offsetWire(small, obj.Shape, 9.9, True)
wire = PathOpUtil.offsetWire(small, obj.Shape, 9.9, True)
self.assertIsNotNone(wire)
self.assertEqual(1, len(wire.Edges))
self.assertRoughly(0.1, wire.Edges[0].Curve.Radius)
@@ -175,10 +175,10 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
small = getWireInside(obj)
self.assertRoughly(10, small.Edges[0].Curve.Radius)
wire = PathOpTools.offsetWire(small, obj.Shape, 10, True)
wire = PathOpUtil.offsetWire(small, obj.Shape, 10, True)
self.assertIsNone(wire)
wire = PathOpTools.offsetWire(small, obj.Shape, 15, True)
wire = PathOpUtil.offsetWire(small, obj.Shape, 15, True)
self.assertIsNone(wire)
def test13(self):
@@ -188,13 +188,13 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
big = getWireOutside(obj)
self.assertRoughly(20, big.Edges[0].Curve.Radius)
wire = PathOpTools.offsetWire(big, obj.Shape, 10, True)
wire = PathOpUtil.offsetWire(big, obj.Shape, 10, True)
self.assertIsNotNone(wire)
self.assertEqual(1, len(wire.Edges))
self.assertRoughly(30, wire.Edges[0].Curve.Radius)
self.assertCoincide(Vector(0, 0, -1), wire.Edges[0].Curve.Axis)
wire = PathOpTools.offsetWire(big, obj.Shape, 20, True)
wire = PathOpUtil.offsetWire(big, obj.Shape, 20, True)
self.assertIsNotNone(wire)
self.assertEqual(1, len(wire.Edges))
self.assertRoughly(40, wire.Edges[0].Curve.Radius)
@@ -217,7 +217,7 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
# make sure there is a placement and I didn't mess up the model
self.assertFalse(PathGeom.pointsCoincide(Vector(), w.Edges[0].Placement.Base))
wire = PathOpTools.offsetWire(w, obj.Shape, 2, True)
wire = PathOpUtil.offsetWire(w, obj.Shape, 2, True)
self.assertIsNotNone(wire)
self.assertEqual(1, len(wire.Edges))
self.assertRoughly(8, wire.Edges[0].Curve.Radius)
@@ -241,7 +241,7 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
# make sure there is a placement and I didn't mess up the model
self.assertFalse(PathGeom.pointsCoincide(Vector(), w.Edges[0].Placement.Base))
wire = PathOpTools.offsetWire(w, obj.Shape, 2, True)
wire = PathOpUtil.offsetWire(w, obj.Shape, 2, True)
self.assertIsNotNone(wire)
self.assertEqual(1, len(wire.Edges))
self.assertRoughly(22, wire.Edges[0].Curve.Radius)
@@ -267,12 +267,12 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
],
)
wire = PathOpTools.offsetWire(small, obj.Shape, 3, True)
wire = PathOpUtil.offsetWire(small, obj.Shape, 3, True)
self.assertIsNotNone(wire)
self.assertEqual(3, len(wire.Edges))
self.assertTrue(wire.isClosed())
# for holes processing "forward" means CCW
self.assertFalse(PathOpTools.isWireClockwise(wire))
self.assertFalse(PathOpUtil.isWireClockwise(wire))
y = 4 # offset works in both directions
x = 4 * math.cos(math.pi / 6)
self.assertLines(
@@ -299,7 +299,7 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
Vector(0, y, 0),
],
)
wire = PathOpTools.offsetWire(small, obj.Shape, 5, True)
wire = PathOpUtil.offsetWire(small, obj.Shape, 5, True)
self.assertIsNone(wire)
def test22(self):
@@ -321,7 +321,7 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
],
)
wire = PathOpTools.offsetWire(big, obj.Shape, 5, True)
wire = PathOpUtil.offsetWire(big, obj.Shape, 5, True)
self.assertIsNotNone(wire)
self.assertEqual(6, len(wire.Edges))
lastAngle = None
@@ -350,13 +350,13 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
else:
self.assertIsNone("%s: angle=%s" % (type(e.Curve), angle))
lastAngle = angle
self.assertTrue(PathOpTools.isWireClockwise(wire))
self.assertTrue(PathOpUtil.isWireClockwise(wire))
def test31(self):
"""Check offsetting a cylinder."""
obj = doc.getObjectsByLabel("circle-cut")[0]
wire = PathOpTools.offsetWire(getWire(obj.Tool), getPositiveShape(obj), 3, True)
wire = PathOpUtil.offsetWire(getWire(obj.Tool), getPositiveShape(obj), 3, True)
self.assertEqual(1, len(wire.Edges))
edge = wire.Edges[0]
self.assertCoincide(Vector(), edge.Curve.Center)
@@ -364,7 +364,7 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
self.assertRoughly(33, edge.Curve.Radius)
# the other way around everything's the same except the axis is negative
wire = PathOpTools.offsetWire(
wire = PathOpUtil.offsetWire(
getWire(obj.Tool), getPositiveShape(obj), 3, False
)
self.assertEqual(1, len(wire.Edges))
@@ -377,7 +377,7 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
"""Check offsetting a box."""
obj = doc.getObjectsByLabel("square-cut")[0]
wire = PathOpTools.offsetWire(getWire(obj.Tool), getPositiveShape(obj), 3, True)
wire = PathOpUtil.offsetWire(getWire(obj.Tool), getPositiveShape(obj), 3, True)
self.assertEqual(8, len(wire.Edges))
self.assertEqual(4, len([e for e in wire.Edges if Part.Line == type(e.Curve)]))
self.assertEqual(
@@ -392,10 +392,10 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
if Part.Circle == type(e.Curve):
self.assertRoughly(3, e.Curve.Radius)
self.assertCoincide(Vector(0, 0, -1), e.Curve.Axis)
self.assertTrue(PathOpTools.isWireClockwise(wire))
self.assertTrue(PathOpUtil.isWireClockwise(wire))
# change offset orientation
wire = PathOpTools.offsetWire(
wire = PathOpUtil.offsetWire(
getWire(obj.Tool), getPositiveShape(obj), 3, False
)
self.assertEqual(8, len(wire.Edges))
@@ -412,13 +412,13 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
if Part.Circle == type(e.Curve):
self.assertRoughly(3, e.Curve.Radius)
self.assertCoincide(Vector(0, 0, +1), e.Curve.Axis)
self.assertFalse(PathOpTools.isWireClockwise(wire))
self.assertFalse(PathOpUtil.isWireClockwise(wire))
def test33(self):
"""Check offsetting a triangle."""
obj = doc.getObjectsByLabel("triangle-cut")[0]
wire = PathOpTools.offsetWire(getWire(obj.Tool), getPositiveShape(obj), 3, True)
wire = PathOpUtil.offsetWire(getWire(obj.Tool), getPositiveShape(obj), 3, True)
self.assertEqual(6, len(wire.Edges))
self.assertEqual(3, len([e for e in wire.Edges if Part.Line == type(e.Curve)]))
self.assertEqual(
@@ -433,7 +433,7 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
self.assertCoincide(Vector(0, 0, -1), e.Curve.Axis)
# change offset orientation
wire = PathOpTools.offsetWire(
wire = PathOpUtil.offsetWire(
getWire(obj.Tool), getPositiveShape(obj), 3, False
)
self.assertEqual(6, len(wire.Edges))
@@ -452,7 +452,7 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
"""Check offsetting a shape."""
obj = doc.getObjectsByLabel("shape-cut")[0]
wire = PathOpTools.offsetWire(getWire(obj.Tool), getPositiveShape(obj), 3, True)
wire = PathOpUtil.offsetWire(getWire(obj.Tool), getPositiveShape(obj), 3, True)
self.assertEqual(6, len(wire.Edges))
self.assertEqual(3, len([e for e in wire.Edges if Part.Line == type(e.Curve)]))
self.assertEqual(
@@ -468,7 +468,7 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
self.assertCoincide(Vector(0, 0, -1), e.Curve.Axis)
# change offset orientation
wire = PathOpTools.offsetWire(
wire = PathOpUtil.offsetWire(
getWire(obj.Tool), getPositiveShape(obj), 3, False
)
self.assertEqual(6, len(wire.Edges))
@@ -487,7 +487,7 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
"""Check offsetting a cylindrical hole."""
obj = doc.getObjectsByLabel("circle-cut")[0]
wire = PathOpTools.offsetWire(getWire(obj.Tool), getNegativeShape(obj), 3, True)
wire = PathOpUtil.offsetWire(getWire(obj.Tool), getNegativeShape(obj), 3, True)
self.assertEqual(1, len(wire.Edges))
edge = wire.Edges[0]
self.assertCoincide(Vector(), edge.Curve.Center)
@@ -495,7 +495,7 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
self.assertRoughly(27, edge.Curve.Radius)
# the other way around everything's the same except the axis is negative
wire = PathOpTools.offsetWire(
wire = PathOpUtil.offsetWire(
getWire(obj.Tool), getNegativeShape(obj), 3, False
)
self.assertEqual(1, len(wire.Edges))
@@ -508,7 +508,7 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
"""Check offsetting a square hole."""
obj = doc.getObjectsByLabel("square-cut")[0]
wire = PathOpTools.offsetWire(getWire(obj.Tool), getNegativeShape(obj), 3, True)
wire = PathOpUtil.offsetWire(getWire(obj.Tool), getNegativeShape(obj), 3, True)
self.assertEqual(4, len(wire.Edges))
self.assertEqual(4, len([e for e in wire.Edges if Part.Line == type(e.Curve)]))
for e in wire.Edges:
@@ -516,10 +516,10 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
self.assertRoughly(34, e.Length)
if PathGeom.isRoughly(e.Vertexes[0].Point.y, e.Vertexes[1].Point.y):
self.assertRoughly(54, e.Length)
self.assertFalse(PathOpTools.isWireClockwise(wire))
self.assertFalse(PathOpUtil.isWireClockwise(wire))
# change offset orientation
wire = PathOpTools.offsetWire(
wire = PathOpUtil.offsetWire(
getWire(obj.Tool), getNegativeShape(obj), 3, False
)
self.assertEqual(4, len(wire.Edges))
@@ -529,35 +529,35 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
self.assertRoughly(34, e.Length)
if PathGeom.isRoughly(e.Vertexes[0].Point.y, e.Vertexes[1].Point.y):
self.assertRoughly(54, e.Length)
self.assertTrue(PathOpTools.isWireClockwise(wire))
self.assertTrue(PathOpUtil.isWireClockwise(wire))
def test37(self):
"""Check offsetting a triangular holee."""
obj = doc.getObjectsByLabel("triangle-cut")[0]
wire = PathOpTools.offsetWire(getWire(obj.Tool), getNegativeShape(obj), 3, True)
wire = PathOpUtil.offsetWire(getWire(obj.Tool), getNegativeShape(obj), 3, True)
self.assertEqual(3, len(wire.Edges))
self.assertEqual(3, len([e for e in wire.Edges if Part.Line == type(e.Curve)]))
length = 48 * math.sin(math.radians(60))
for e in wire.Edges:
self.assertRoughly(length, e.Length)
self.assertFalse(PathOpTools.isWireClockwise(wire))
self.assertFalse(PathOpUtil.isWireClockwise(wire))
# change offset orientation
wire = PathOpTools.offsetWire(
wire = PathOpUtil.offsetWire(
getWire(obj.Tool), getNegativeShape(obj), 3, False
)
self.assertEqual(3, len(wire.Edges))
self.assertEqual(3, len([e for e in wire.Edges if Part.Line == type(e.Curve)]))
for e in wire.Edges:
self.assertRoughly(length, e.Length)
self.assertTrue(PathOpTools.isWireClockwise(wire))
self.assertTrue(PathOpUtil.isWireClockwise(wire))
def test38(self):
"""Check offsetting a shape hole."""
obj = doc.getObjectsByLabel("shape-cut")[0]
wire = PathOpTools.offsetWire(getWire(obj.Tool), getNegativeShape(obj), 3, True)
wire = PathOpUtil.offsetWire(getWire(obj.Tool), getNegativeShape(obj), 3, True)
self.assertEqual(6, len(wire.Edges))
self.assertEqual(3, len([e for e in wire.Edges if Part.Line == type(e.Curve)]))
self.assertEqual(
@@ -573,7 +573,7 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
self.assertCoincide(Vector(0, 0, +1), e.Curve.Axis)
# change offset orientation
wire = PathOpTools.offsetWire(
wire = PathOpUtil.offsetWire(
getWire(obj.Tool), getNegativeShape(obj), 3, False
)
self.assertEqual(6, len(wire.Edges))
@@ -612,7 +612,7 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
self.assertCoincide(Vector(-x, y, 0), edge.Vertexes[0].Point)
self.assertCoincide(Vector(+x, y, 0), edge.Vertexes[1].Point)
wire = PathOpTools.offsetWire(Part.Wire([edge]), obj.Shape, 5, True)
wire = PathOpUtil.offsetWire(Part.Wire([edge]), obj.Shape, 5, True)
self.assertEqual(1, len(wire.Edges))
y = y - 5
@@ -621,7 +621,7 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
# make sure we get the same result even if the edge is oriented the other way
edge = PathGeom.flipEdge(edge)
wire = PathOpTools.offsetWire(Part.Wire([edge]), obj.Shape, 5, True)
wire = PathOpUtil.offsetWire(Part.Wire([edge]), obj.Shape, 5, True)
self.assertEqual(1, len(wire.Edges))
self.assertCoincide(Vector(+x, y, 0), wire.Edges[0].Vertexes[0].Point)
@@ -650,7 +650,7 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
self.assertCoincide(Vector(-x, y, 0), edge.Vertexes[0].Point)
self.assertCoincide(Vector(+x, y, 0), edge.Vertexes[1].Point)
wire = PathOpTools.offsetWire(Part.Wire([edge]), obj.Shape, 5, False)
wire = PathOpUtil.offsetWire(Part.Wire([edge]), obj.Shape, 5, False)
self.assertEqual(1, len(wire.Edges))
y = y - 5
@@ -659,7 +659,7 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
# make sure we get the same result on a reversed edge
edge = PathGeom.flipEdge(edge)
wire = PathOpTools.offsetWire(Part.Wire([edge]), obj.Shape, 5, False)
wire = PathOpUtil.offsetWire(Part.Wire([edge]), obj.Shape, 5, False)
self.assertEqual(1, len(wire.Edges))
self.assertCoincide(Vector(-x, y, 0), wire.Edges[0].Vertexes[0].Point)
@@ -682,7 +682,7 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
]
self.assertEqual(2, len(lEdges))
wire = PathOpTools.offsetWire(Part.Wire(lEdges), obj.Shape, 2, True)
wire = PathOpUtil.offsetWire(Part.Wire(lEdges), obj.Shape, 2, True)
x = length / 2 + 2 * math.cos(math.pi / 6)
y = -10 + 2 * math.sin(math.pi / 6)
@@ -697,7 +697,7 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
self.assertCoincide(Vector(0, 0, -1), rEdges[0].Curve.Axis)
# offset the other way
wire = PathOpTools.offsetWire(Part.Wire(lEdges), obj.Shape, 2, False)
wire = PathOpUtil.offsetWire(Part.Wire(lEdges), obj.Shape, 2, False)
self.assertCoincide(Vector(+x, y, 0), wire.Edges[0].Vertexes[0].Point)
self.assertCoincide(Vector(-x, y, 0), wire.Edges[-1].Vertexes[1].Point)
@@ -726,7 +726,7 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
self.assertEqual(2, len(lEdges))
w = PathGeom.flipWire(Part.Wire(lEdges))
wire = PathOpTools.offsetWire(w, obj.Shape, 2, True)
wire = PathOpUtil.offsetWire(w, obj.Shape, 2, True)
x = length / 2 + 2 * math.cos(math.pi / 6)
y = -10 + 2 * math.sin(math.pi / 6)
@@ -741,7 +741,7 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
self.assertCoincide(Vector(0, 0, -1), rEdges[0].Curve.Axis)
# offset the other way
wire = PathOpTools.offsetWire(Part.Wire(lEdges), obj.Shape, 2, False)
wire = PathOpUtil.offsetWire(Part.Wire(lEdges), obj.Shape, 2, False)
self.assertCoincide(Vector(+x, y, 0), wire.Edges[0].Vertexes[0].Point)
self.assertCoincide(Vector(-x, y, 0), wire.Edges[-1].Vertexes[1].Point)
@@ -776,7 +776,7 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
self.assertCoincide(Vector(-x, y, 0), edge.Vertexes[0].Point)
self.assertCoincide(Vector(+x, y, 0), edge.Vertexes[1].Point)
wire = PathOpTools.offsetWire(Part.Wire([edge]), obj.Shape, 2, True)
wire = PathOpUtil.offsetWire(Part.Wire([edge]), obj.Shape, 2, True)
self.assertEqual(1, len(wire.Edges))
y = y + 2
@@ -785,7 +785,7 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
# make sure we get the same result even if the edge is oriented the other way
edge = PathGeom.flipEdge(edge)
wire = PathOpTools.offsetWire(Part.Wire([edge]), obj.Shape, 2, True)
wire = PathOpUtil.offsetWire(Part.Wire([edge]), obj.Shape, 2, True)
self.assertEqual(1, len(wire.Edges))
self.assertCoincide(Vector(-x, y, 0), wire.Edges[0].Vertexes[0].Point)
@@ -815,7 +815,7 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
self.assertCoincide(Vector(-x, y, 0), edge.Vertexes[0].Point)
self.assertCoincide(Vector(+x, y, 0), edge.Vertexes[1].Point)
wire = PathOpTools.offsetWire(Part.Wire([edge]), obj.Shape, 2, False)
wire = PathOpUtil.offsetWire(Part.Wire([edge]), obj.Shape, 2, False)
self.assertEqual(1, len(wire.Edges))
y = y + 2
@@ -824,7 +824,7 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
# make sure we get the same result even if the edge is oriented the other way
edge = PathGeom.flipEdge(edge)
wire = PathOpTools.offsetWire(Part.Wire([edge]), obj.Shape, 2, False)
wire = PathOpUtil.offsetWire(Part.Wire([edge]), obj.Shape, 2, False)
self.assertEqual(1, len(wire.Edges))
self.assertCoincide(Vector(+x, y, 0), wire.Edges[0].Vertexes[0].Point)
@@ -845,7 +845,7 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
]
self.assertEqual(2, len(lEdges))
wire = PathOpTools.offsetWire(Part.Wire(lEdges), obj.Shape, 2, True)
wire = PathOpUtil.offsetWire(Part.Wire(lEdges), obj.Shape, 2, True)
x = length / 2 - 2 * math.cos(math.pi / 6)
y = -5 - 2 * math.sin(math.pi / 6)
@@ -857,7 +857,7 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
self.assertEqual(0, len(rEdges))
# offset the other way
wire = PathOpTools.offsetWire(Part.Wire(lEdges), obj.Shape, 2, False)
wire = PathOpUtil.offsetWire(Part.Wire(lEdges), obj.Shape, 2, False)
self.assertCoincide(Vector(-x, y, 0), wire.Edges[0].Vertexes[0].Point)
self.assertCoincide(Vector(+x, y, 0), wire.Edges[-1].Vertexes[1].Point)
@@ -883,7 +883,7 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
self.assertEqual(2, len(lEdges))
w = PathGeom.flipWire(Part.Wire(lEdges))
wire = PathOpTools.offsetWire(w, obj.Shape, 2, True)
wire = PathOpUtil.offsetWire(w, obj.Shape, 2, True)
x = length / 2 - 2 * math.cos(math.pi / 6)
y = -5 - 2 * math.sin(math.pi / 6)
@@ -895,7 +895,7 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
self.assertEqual(0, len(rEdges))
# offset the other way
wire = PathOpTools.offsetWire(Part.Wire(lEdges), obj.Shape, 2, False)
wire = PathOpUtil.offsetWire(Part.Wire(lEdges), obj.Shape, 2, False)
self.assertCoincide(Vector(-x, y, 0), wire.Edges[0].Vertexes[0].Point)
self.assertCoincide(Vector(+x, y, 0), wire.Edges[-1].Vertexes[1].Point)
@@ -913,7 +913,7 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
e0 = Part.Edge(Part.LineSegment(p0, p1))
e1 = Part.Edge(Part.LineSegment(p1, p2))
wire = PathOpTools.orientWire(Part.Wire([e0, e1]))
wire = PathOpUtil.orientWire(Part.Wire([e0, e1]))
wirePts = wireMarkers(wire)
self.assertPointsMatch(wirePts, pts)
@@ -930,16 +930,16 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
e1p = Part.Edge(Part.LineSegment(p1, p2))
e1m = Part.Edge(Part.LineSegment(p2, p1))
wire = PathOpTools.orientWire(Part.Wire([e0p, e1p]))
wire = PathOpUtil.orientWire(Part.Wire([e0p, e1p]))
self.assertPointsMatch(wireMarkers(wire), pts)
wire = PathOpTools.orientWire(Part.Wire([e0p, e1m]))
wire = PathOpUtil.orientWire(Part.Wire([e0p, e1m]))
self.assertPointsMatch(wireMarkers(wire), pts)
wire = PathOpTools.orientWire(Part.Wire([e0m, e1p]))
wire = PathOpUtil.orientWire(Part.Wire([e0m, e1p]))
self.assertPointsMatch(wireMarkers(wire), pts)
wire = PathOpTools.orientWire(Part.Wire([e0m, e1m]))
wire = PathOpUtil.orientWire(Part.Wire([e0m, e1m]))
self.assertPointsMatch(wireMarkers(wire), pts)
def test52(self):
@@ -957,26 +957,26 @@ class TestPathOpTools(PathTestUtils.PathTestBase):
e2p = Part.Edge(Part.LineSegment(p2, p3))
e2m = Part.Edge(Part.LineSegment(p3, p2))
wire = PathOpTools.orientWire(Part.Wire([e0p, e1p, e2p]))
wire = PathOpUtil.orientWire(Part.Wire([e0p, e1p, e2p]))
self.assertPointsMatch(wireMarkers(wire), pts)
wire = PathOpTools.orientWire(Part.Wire([e0p, e1m, e2p]))
wire = PathOpUtil.orientWire(Part.Wire([e0p, e1m, e2p]))
self.assertPointsMatch(wireMarkers(wire), pts)
wire = PathOpTools.orientWire(Part.Wire([e0m, e1p, e2p]))
wire = PathOpUtil.orientWire(Part.Wire([e0m, e1p, e2p]))
self.assertPointsMatch(wireMarkers(wire), pts)
wire = PathOpTools.orientWire(Part.Wire([e0m, e1m, e2p]))
wire = PathOpUtil.orientWire(Part.Wire([e0m, e1m, e2p]))
self.assertPointsMatch(wireMarkers(wire), pts)
wire = PathOpTools.orientWire(Part.Wire([e0p, e1p, e2m]))
wire = PathOpUtil.orientWire(Part.Wire([e0p, e1p, e2m]))
self.assertPointsMatch(wireMarkers(wire), pts)
wire = PathOpTools.orientWire(Part.Wire([e0p, e1m, e2m]))
wire = PathOpUtil.orientWire(Part.Wire([e0p, e1m, e2m]))
self.assertPointsMatch(wireMarkers(wire), pts)
wire = PathOpTools.orientWire(Part.Wire([e0m, e1p, e2m]))
wire = PathOpUtil.orientWire(Part.Wire([e0m, e1p, e2m]))
self.assertPointsMatch(wireMarkers(wire), pts)
wire = PathOpTools.orientWire(Part.Wire([e0m, e1m, e2m]))
wire = PathOpUtil.orientWire(Part.Wire([e0m, e1m, e2m]))
self.assertPointsMatch(wireMarkers(wire), pts)

View File

@@ -22,7 +22,7 @@
import FreeCAD
import PathScripts.PathGeom as PathGeom
import PathScripts.PathThreadMilling as PathThreadMilling
import Path.Op.ThreadMilling as PathThreadMilling
import math
from PathTests.PathTestUtils import PathTestBase

View File

@@ -21,9 +21,9 @@
# ***************************************************************************
import FreeCAD
import Path.Op.Vcarve as PathVcarve
import Path.Tools.Bit as PathToolBit
import PathScripts.PathGeom as PathGeom
import PathScripts.PathVcarve as PathVcarve
import math
from PathTests.PathTestUtils import PathTestBase

View File

@@ -36,7 +36,7 @@ from PathTests.TestPathGeom import TestPathGeom
from PathTests.TestPathHelpers import TestPathHelpers
from PathTests.TestPathHelixGenerator import TestPathHelixGenerator
from PathTests.TestPathLog import TestPathLog
from PathTests.TestPathOpTools import TestPathOpTools
from PathTests.TestPathOpUtil import TestPathOpUtil
# from PathTests.TestPathPost import TestPathPost
from PathTests.TestPathPost import TestPathPostUtils
@@ -84,7 +84,7 @@ False if TestPathGeom.__name__ else True
False if TestPathHelpers.__name__ else True
# False if TestPathHelix.__name__ else True
False if TestPathLog.__name__ else True
False if TestPathOpTools.__name__ else True
False if TestPathOpUtil.__name__ else True
# False if TestPathPost.__name__ else True
False if TestPathPostUtils.__name__ else True
False if TestPathPreferences.__name__ else True