Switch out base in case user selects features of the original - fixes op placement.
This commit is contained in:
@@ -458,9 +458,7 @@ class TaskPanel:
|
||||
self.stockEdit = None
|
||||
|
||||
def baseObjectViewObject(self, obj):
|
||||
base = obj.Proxy.baseObject(obj)
|
||||
body = base.getParentGeoFeatureGroup()
|
||||
return body.ViewObject if body else base.ViewObject
|
||||
return PathUtil.getPublicObject(obj.Proxy.baseObject(obj)).ViewObject
|
||||
|
||||
def baseObjectSaveVisibility(self, obj):
|
||||
baseVO = self.baseObjectViewObject(self.obj)
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
import FreeCAD
|
||||
import Path
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathUtil as PathUtil
|
||||
import PathScripts.PathUtils as PathUtils
|
||||
|
||||
from PathScripts.PathGeom import PathGeom
|
||||
@@ -252,6 +253,7 @@ class ObjectOp(object):
|
||||
if not ignoreErrors:
|
||||
PathLog.error(translate("Path", "Parent job %s doesn't have a base object") % job.Label)
|
||||
return False
|
||||
self.job = job
|
||||
self.baseobject = job.Base
|
||||
self.stock = job.Stock
|
||||
return True
|
||||
@@ -400,13 +402,21 @@ class ObjectOp(object):
|
||||
|
||||
def addBase(self, obj, base, sub):
|
||||
PathLog.track()
|
||||
baselist = obj.Base
|
||||
if baselist is None:
|
||||
baselist = []
|
||||
item = (base, sub)
|
||||
if item in baselist:
|
||||
PathLog.notice(translate("Path", "this object already in the list" + "\n"))
|
||||
else:
|
||||
baselist.append(item)
|
||||
obj.Base = baselist
|
||||
base = PathUtil.getPublicObject(base)
|
||||
|
||||
if self._setBaseAndStock(obj):
|
||||
if base == self.job.Proxy.baseObject(self.job):
|
||||
PathLog.info("this is it")
|
||||
base = self.baseobject
|
||||
else:
|
||||
PathLog.info("no, base=%s job.base=%s" % (base, self.job.Proxy.baseObject(self.job)))
|
||||
baselist = obj.Base
|
||||
if baselist is None:
|
||||
baselist = []
|
||||
item = (base, sub)
|
||||
if item in baselist:
|
||||
PathLog.notice(translate("Path", "this object already in the list" + "\n"))
|
||||
else:
|
||||
baselist.append(item)
|
||||
obj.Base = baselist
|
||||
|
||||
|
||||
@@ -70,10 +70,20 @@ def isSolid(obj):
|
||||
return False
|
||||
|
||||
def toolControllerForOp(op):
|
||||
'''toolControllerForOp(op) ... return the tool controller used by the op.
|
||||
If the op doesn't have its own tool controller but has a Base object, return its tool controller.
|
||||
Otherwise return None.'''
|
||||
if hasattr(op, 'ToolController'):
|
||||
return op.ToolController
|
||||
if hasattr(op, 'Base'):
|
||||
return toolControllerForOp(op.Base)
|
||||
return None
|
||||
|
||||
def getPublicObject(obj):
|
||||
'''getPublicObject(obj) ... returns the object which should be used to reference a feature of the given object.'''
|
||||
if hasattr(obj, 'getParentGeoFeatureGroup'):
|
||||
body = obj.getParentGeoFeatureGroup()
|
||||
if body:
|
||||
return getPublicObject(body)
|
||||
return obj
|
||||
|
||||
|
||||
Reference in New Issue
Block a user