Merge pull request #5005 from sliptonic/archcleanupfix
[PATH] Fix bug on profile creation
This commit is contained in:
@@ -173,7 +173,7 @@ def SetupProperties():
|
||||
|
||||
|
||||
def Create(name, obj=None, parentJob=None):
|
||||
'''Create(name) ... Creates and returns an Engrave operation.'''
|
||||
"""Create(name) ... Creates and returns an Engrave operation."""
|
||||
if obj is None:
|
||||
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
|
||||
obj.Proxy = ObjectEngrave(obj, name, parentJob)
|
||||
|
||||
@@ -102,6 +102,7 @@ Notification = NotificationClass()
|
||||
|
||||
|
||||
class ObjectJob:
|
||||
|
||||
def __init__(self, obj, models, templateFile=None):
|
||||
self.obj = obj
|
||||
obj.addProperty(
|
||||
|
||||
@@ -32,20 +32,20 @@ import traceback
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
|
||||
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.PathGeom as PathGeom
|
||||
import PathScripts.PathGuiInit as PathGuiInit
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathPreferences as PathPreferences
|
||||
import PathScripts.PathSetupSheetGui as PathSetupSheetGui
|
||||
import PathScripts.PathStock as PathStock
|
||||
import PathScripts.PathToolBitGui as PathToolBitGui
|
||||
import PathScripts.PathToolControllerGui as PathToolControllerGui
|
||||
import PathScripts.PathToolLibraryEditor as PathToolLibraryEditor
|
||||
import PathScripts.PathUtil as PathUtil
|
||||
import PathScripts.PathUtils as PathUtils
|
||||
import PathScripts.PathToolBitGui as PathToolBitGui
|
||||
|
||||
# lazily loaded modules
|
||||
from lazy_loader.lazy_loader import LazyLoader
|
||||
@@ -230,10 +230,7 @@ class ViewProvider:
|
||||
# make sure the resource view providers are setup properly
|
||||
if prop == "Model" and self.obj.Model:
|
||||
for base in self.obj.Model.Group:
|
||||
if (
|
||||
base.ViewObject
|
||||
and base.ViewObject.Proxy
|
||||
):
|
||||
if base.ViewObject and base.ViewObject.Proxy:
|
||||
base.ViewObject.Proxy.onEdit(_OpenCloseResourceEditor)
|
||||
if (
|
||||
prop == "Stock"
|
||||
|
||||
@@ -51,20 +51,20 @@ def translate(context, text, disambig=None):
|
||||
return QtCore.QCoreApplication.translate(context, text, disambig)
|
||||
|
||||
|
||||
FeatureTool = 0x0001 # ToolController
|
||||
FeatureDepths = 0x0002 # FinalDepth, StartDepth
|
||||
FeatureHeights = 0x0004 # ClearanceHeight, SafeHeight
|
||||
FeatureStartPoint = 0x0008 # StartPoint
|
||||
FeatureFinishDepth = 0x0010 # FinishDepth
|
||||
FeatureStepDown = 0x0020 # StepDown
|
||||
FeatureNoFinalDepth = 0x0040 # edit or not edit FinalDepth
|
||||
FeatureBaseVertexes = 0x0100 # Base
|
||||
FeatureBaseEdges = 0x0200 # Base
|
||||
FeatureBaseFaces = 0x0400 # Base
|
||||
FeatureBasePanels = 0x0800 # Base
|
||||
FeatureLocations = 0x1000 # Locations
|
||||
FeatureCoolant = 0x2000 # Coolant
|
||||
FeatureDiameters = 0x4000 # Turning Diameters
|
||||
FeatureTool = 0x0001 # ToolController
|
||||
FeatureDepths = 0x0002 # FinalDepth, StartDepth
|
||||
FeatureHeights = 0x0004 # ClearanceHeight, SafeHeight
|
||||
FeatureStartPoint = 0x0008 # StartPoint
|
||||
FeatureFinishDepth = 0x0010 # FinishDepth
|
||||
FeatureStepDown = 0x0020 # StepDown
|
||||
FeatureNoFinalDepth = 0x0040 # edit or not edit FinalDepth
|
||||
FeatureBaseVertexes = 0x0100 # Base
|
||||
FeatureBaseEdges = 0x0200 # Base
|
||||
FeatureBaseFaces = 0x0400 # Base
|
||||
FeatureBasePanels = 0x0800 # Base
|
||||
FeatureLocations = 0x1000 # Locations
|
||||
FeatureCoolant = 0x2000 # Coolant
|
||||
FeatureDiameters = 0x4000 # Turning Diameters
|
||||
|
||||
FeatureBaseGeometry = FeatureBaseVertexes | FeatureBaseFaces | FeatureBaseEdges
|
||||
|
||||
@@ -338,7 +338,7 @@ class ObjectOp(object):
|
||||
|
||||
self.initOperation(obj)
|
||||
|
||||
if not hasattr(obj, 'DoNotSetDefaultValues') or not obj.DoNotSetDefaultValues:
|
||||
if not hasattr(obj, "DoNotSetDefaultValues") or not obj.DoNotSetDefaultValues:
|
||||
if parentJob:
|
||||
self.job = PathUtils.addToJob(obj, jobname=parentJob.Name)
|
||||
job = self.setDefaultValues(obj)
|
||||
@@ -494,7 +494,10 @@ class ObjectOp(object):
|
||||
def setDefaultValues(self, obj):
|
||||
"""setDefaultValues(obj) ... base implementation.
|
||||
Do not overwrite, overwrite opSetDefaultValues() instead."""
|
||||
job = PathUtils.addToJob(obj)
|
||||
if self.job:
|
||||
job = self.job
|
||||
else:
|
||||
job = PathUtils.addToJob(obj)
|
||||
|
||||
obj.Active = True
|
||||
|
||||
|
||||
@@ -1432,7 +1432,9 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
# Method to add temporary debug object
|
||||
def _addDebugObject(self, objName, objShape):
|
||||
if self.isDebug:
|
||||
newDocObj = FreeCAD.ActiveDocument.addObject("Part::Feature", "tmp_" + objName)
|
||||
newDocObj = FreeCAD.ActiveDocument.addObject(
|
||||
"Part::Feature", "tmp_" + objName
|
||||
)
|
||||
newDocObj.Shape = objShape
|
||||
newDocObj.purgeTouched()
|
||||
self.tmpGrp.addObject(newDocObj)
|
||||
@@ -1444,9 +1446,9 @@ def SetupProperties():
|
||||
return setup
|
||||
|
||||
|
||||
def Create(name, obj=None):
|
||||
def Create(name, obj=None, parentJob=None):
|
||||
"""Create(name) ... Creates and returns a Profile based on faces operation."""
|
||||
if obj is None:
|
||||
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
|
||||
obj.Proxy = ObjectProfile(obj, name)
|
||||
obj.Proxy = ObjectProfile(obj, name, parentJob)
|
||||
return obj
|
||||
|
||||
Reference in New Issue
Block a user