Moved generators into Path.Base.Generator module

This commit is contained in:
Markus Lampert
2022-08-14 11:56:28 -07:00
parent d6293308b4
commit a1b3319bdf
16 changed files with 60 additions and 47 deletions

View File

@@ -145,7 +145,7 @@ SET(PathPythonOp_SRCS
Path/Op/Deburr.py
Path/Op/Engrave.py
Path/Op/EngraveBase.py
Path/Op/FeatureExtensions.py
Path/Op/FeatureExtension.py
Path/Op/Drilling.py
Path/Op/Helix.py
Path/Op/MillFace.py
@@ -175,7 +175,7 @@ SET(PathPythonOpGui_SRCS
Path/Op/Gui/Deburr.py
Path/Op/Gui/Drilling.py
Path/Op/Gui/Engrave.py
Path/Op/Gui/FeatureExtensions.py
Path/Op/Gui/FeatureExtension.py
Path/Op/Gui/Helix.py
Path/Op/Gui/Hop.py
Path/Op/Gui/MillFace.py
@@ -211,12 +211,12 @@ SET(PathScripts_SRCS
PathScripts/__init__.py
)
SET(Generator_SRCS
Generators/drill_generator.py
Generators/helix_generator.py
Generators/rotation_generator.py
Generators/threadmilling_generator.py
Generators/toolchange_generator.py
SET(PathPythonBaseGenerator_SRCS
Path/Base/Generator/drill.py
Path/Base/Generator/helix.py
Path/Base/Generator/rotation.py
Path/Base/Generator/threadmilling.py
Path/Base/Generator/toolchange.py
)
SET(PathPythonGui_SRCS
@@ -342,6 +342,9 @@ SET(Path_Data
SET(all_files
${PathScripts_SRCS}
${PathPython_SRCS}
${PathPythonBase_SRCS}
${PathPythonBaseGui_SRCS}
${PathPythonBaseGenerator_SRCS}
${PathPythonDressup_SRCS}
${PathPythonDressupGui_SRCS}
${PathPythonOp_SRCS}
@@ -350,7 +353,6 @@ SET(all_files
${PathPythonPostScripts_SRCS}
${PathPythonTools_SRCS}
${PathPythonToolsGui_SRCS}
${Generator_SRCS}
${PathPythonGui_SRCS}
${Tools_SRCS}
${Tools_Bit_SRCS}
@@ -390,6 +392,27 @@ INSTALL(
Mod/Path/Path
)
INSTALL(
FILES
${PathPythonBase_SRCS}
DESTINATION
Mod/Path/Path/Base
)
INSTALL(
FILES
${PathPythonBaseGenerator_SRCS}
DESTINATION
Mod/Path/Path/Base/Generator
)
INSTALL(
FILES
${PathPythonBaseGui_SRCS}
DESTINATION
Mod/Path/Path/Base/Gui
)
INSTALL(
FILES
${PathPythonDressup_SRCS}
@@ -424,6 +447,13 @@ INSTALL(
Mod/Path/Path/Post
)
INSTALL(
FILES
${PathPythonPostScripts_SRCS}
DESTINATION
Mod/Path/Path/Post/scripts
)
INSTALL(
FILES
${PathPythonTools_SRCS}
@@ -438,20 +468,6 @@ INSTALL(
Mod/Path/Path/Tool/Gui
)
INSTALL(
FILES
${PathPythonPostScripts_SRCS}
DESTINATION
Mod/Path/Path/Post/scripts
)
INSTALL(
FILES
${Generator_SRCS}
DESTINATION
Mod/Path/Generators
)
INSTALL(
FILES
${PathTests_SRCS}

View File

@@ -24,11 +24,11 @@
from __future__ import print_function
from Generators import drill_generator as generator
import FreeCAD
import Part
import Path
import Path.Base.FeedRate as PathFeedRate
import Path.Base.Generator.drill as drill
import Path.Base.MachineState as PathMachineState
import Path.Op.Base as PathOp
import Path.Op.CircularHoleBase as PathCircularHoleBase
@@ -248,7 +248,7 @@ class ObjectDrilling(PathCircularHoleBase.ObjectOp):
chipBreak = (obj.chipBreakEnabled and obj.PeckEnabled)
try:
drillcommands = generator.generate(
drillcommands = drill.generate(
edge,
dwelltime,
peckdepth,

View File

@@ -20,7 +20,7 @@
# * *
# ***************************************************************************
from Generators import helix_generator
import Path.Base.Generator.helix as helix
from PathScripts.PathUtils import fmt
from PathScripts.PathUtils import sort_locations
from PySide.QtCore import QT_TRANSLATE_NOOP
@@ -218,7 +218,7 @@ class ObjectHelix(PathCircularHoleBase.ObjectOp):
)
)
results = helix_generator.generate(**args)
results = helix.generate(**args)
for command in results:
self.commandlist.append(command)

View File

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

View File

@@ -26,8 +26,7 @@ from PySide.QtCore import QT_TRANSLATE_NOOP
import FreeCAD
import Path
import Path.Tool.Bit as PathToolBit
from Generators import toolchange_generator as toolchange_generator
from Generators.toolchange_generator import SpindleDirection
import Path.Base.Generator.toolchange as toolchange
if False:
@@ -253,27 +252,27 @@ class ToolController:
"toolnumber": obj.ToolNumber,
"toollabel": obj.Label,
"spindlespeed": obj.SpindleSpeed,
"spindledirection": SpindleDirection.OFF,
"spindledirection": toolchange.SpindleDirection.OFF,
}
if hasattr(obj.Tool, "SpindlePower"):
if not obj.Tool.SpindlePower:
args["spindledirection"] = SpindleDirection.OFF
args["spindledirection"] = toolchange.SpindleDirection.OFF
else:
if obj.SpindleDir == "Forward":
args["spindledirection"] = SpindleDirection.CW
args["spindledirection"] = toolchange.SpindleDirection.CW
else:
args["spindledirection"] = SpindleDirection.CCW
args["spindledirection"] = toolchange.SpindleDirection.CCW
elif obj.SpindleDir == "None":
args["spindledirection"] = SpindleDirection.OFF
args["spindledirection"] = toolchange.SpindleDirection.OFF
else:
if obj.SpindleDir == "Forward":
args["spindledirection"] = SpindleDirection.CW
args["spindledirection"] = toolchange.SpindleDirection.CW
else:
args["spindledirection"] = SpindleDirection.CCW
args["spindledirection"] = toolchange.SpindleDirection.CCW
commands = toolchange_generator.generate(**args)
commands = toolchange.generate(**args)
path = Path.Path(commands)
obj.Path = path

View File

@@ -21,9 +21,9 @@
# ***************************************************************************
import FreeCAD
import Generators.drill_generator as generator
import Part
import Path
import Path.Base.Generator.drill as generator
import PathTests.PathTestUtils as PathTestUtils
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())

View File

@@ -23,7 +23,7 @@
import FreeCAD
import Part
import Path
import Generators.helix_generator as generator
import Path.Base.Generator.helix as generator
import PathTests.PathTestUtils as PathTestUtils

View File

@@ -21,8 +21,8 @@
# ***************************************************************************
import FreeCAD
import Generators.rotation_generator as generator
import Path
import Path.Base.Generator.rotation as generator
import PathTests.PathTestUtils as PathTestUtils
import numpy as np

View File

@@ -21,7 +21,7 @@
# ***************************************************************************
import FreeCAD
import Generators.threadmilling_generator as threadmilling
import Path.Base.Generator.threadmilling as threadmilling
import math
from PathTests.PathTestUtils import PathTestBase

View File

@@ -21,9 +21,7 @@
# ***************************************************************************
import Path
import Generators.toolchange_generator as generator
from Generators.toolchange_generator import SpindleDirection
import Path.Base.Generator.toolchange as generator
import PathTests.PathTestUtils as PathTestUtils
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
@@ -38,7 +36,7 @@ class TestPathToolChangeGenerator(PathTestUtils.PathTestBase):
"toolnumber": 1,
"toollabel": "My Label",
"spindlespeed": 500,
"spindledirection": SpindleDirection.OFF,
"spindledirection": generator.SpindleDirection.OFF,
}
results = generator.generate(**args)
@@ -54,7 +52,7 @@ class TestPathToolChangeGenerator(PathTestUtils.PathTestBase):
self.assertTrue(toolcommand.Name == "M6")
# Turn on the spindle
args["spindledirection"] = SpindleDirection.CW
args["spindledirection"] = generator.SpindleDirection.CW
results = generator.generate(**args)
self.assertTrue(len(results) == 3)