def addFacebase(self, obj, ss, sub=""): baselist = obj.Base if baselist is None: baselist = [] if len(baselist ) == 0: # When adding the first base object, guess at heights subshape = [ss.Shape.getElement(sub)] d = PathUtils.guessDepths(ss.Shape, subshape) obj.ClearanceHeight = d.clearance_height obj.SafeHeight = d.safe_height + 1 obj.StartDepth = d.safe_height obj.FinalDepth = d.final_depth obj.StepDown = obj.StartDepth.Value - obj.FinalDepth.Value item = (ss, sub) if item in baselist: FreeCAD.Console.PrintWarning( translate("Path", "this object already in the list" + "\n")) elif PathUtils.findParentJob(obj).Base.Name != ss.Name: PathLog.debug("parentbase: {}, selectionobj: {}".format( PathUtils.findParentJob(obj).Base.Name, ss.Name)) FreeCAD.Console.PrintWarning( translate( "Path", "Please select features from the Job model object" + "\n")) else: baselist.append(item) PathLog.debug('baselist: {}'.format(baselist)) obj.Base = baselist
def opSetDefaultValues(self, obj, job): '''opSetDefaultValues(obj, job) ... initialize defauts''' # obj.ZigZagAngle = 45.0 obj.StepOver = 50 # need to overwrite the default depth calculations for facing if job and job.Base: d = PathUtils.guessDepths(job.Base.Shape, None) obj.OpStartDepth = d.start_depth obj.OpFinalDepth = d.final_depth
def areaOpSetDefaultValues(self, obj): '''areaOpSetDefaultValues(obj) ... initialize mill facing properties''' # obj.StepOver = 50 # obj.ZigZagAngle = 45.0 # need to overwrite the default depth calculations for facing job = PathUtils.findParentJob(obj) if job and job.Base: d = PathUtils.guessDepths(job.Base.Shape, None) obj.OpStartDepth = d.safe_height obj.OpFinalDepth = d.start_depth
def opSetDefaultValues(self, obj, job): '''opSetDefaultValues(obj, job) ... initialize defaults''' # obj.ZigZagAngle = 45.0 obj.StepOver = 50 obj.Optimize = True # need to overwrite the default depth calculations for facing job = PathUtils.findParentJob(obj) if job and job.Stock: d = PathUtils.guessDepths(job.Stock.Shape, None) obj.OpStartDepth = d.start_depth obj.OpFinalDepth = d.final_depth
def areaOpOnChanged(self, obj, prop): '''areaOpOnChanged(obj, prop) ... facing specific depths calculation.''' PathLog.track(prop) if prop == "StepOver" and obj.StepOver == 0: obj.StepOver = 1 # default depths calculation not correct for facing if prop == "Base" and len(obj.Base) == 1: base, sub = obj.Base[0] shape = base.Shape.getElement(sub[0]) d = PathUtils.guessDepths(shape, None) obj.OpStartDepth = d.safe_height obj.OpFinalDepth = d.start_depth
def setDepths(self, obj): PathLog.track() parentJob = PathUtils.findParentJob(obj) if parentJob is None: return baseobject = parentJob.Base if baseobject is None: return d = PathUtils.guessDepths(baseobject.Shape, None) obj.ClearanceHeight = d.clearance_height obj.SafeHeight = d.safe_height + 1 obj.StartDepth = d.safe_height obj.FinalDepth = d.start_depth obj.StepDown = obj.StartDepth.Value - obj.FinalDepth.Value