FreeCAD Python
|
Base class for proxy objects of all Path operations. Use this class as a base class for new operations. It provides properties and some functionality for the standard properties each operation supports. By OR'ing features from the feature list an operation can select which ones of the standard features it requires and/or supports. The currently supported features are: FeatureTool ... Use of a ToolController FeatureDepths ... Depths, for start, final FeatureHeights ... Heights, safe and clearance FeatureStartPoint ... Supports setting a start point FeatureFinishDepth ... Operation supports a finish depth FeatureStepDown ... Support for step down FeatureNoFinalDepth ... Disable support for final depth modifications FeatureBaseVertexes ... Base geometry support for vertexes FeatureBaseEdges ... Base geometry support for edges FeatureBaseFaces ... Base geometry support for faces FeatureBasePanels ... Base geometry support for Arch.Panels FeatureLocations ... Base location support The base class handles all base API and forwards calls to subclasses with an op prefix. For instance, an op is not expected to overwrite onChanged(), but implement the function opOnChanged(). If a base class overwrites a base API function it should call the super's implementation - otherwise the base functionality might be broken.
Public Member Functions | |
def | setEditorModes (self, obj, features) |
def | __getstate__ (self) |
def | __setstate__ (self, state) |
def | opFeatures (self, obj) |
def | initOperation (self, obj) |
def | opOnDocumentRestored (self, obj) |
def | opOnChanged (self, obj, prop) |
def | opSetDefaultValues (self, obj, job) |
def | opUpdateDepths (self, obj) |
def | opExecute (self, obj) |
def | opRejectAddBase (self, obj, base, sub) |
def | onChanged (self, obj, prop) |
def | applyExpression (self, obj, prop, expr) |
def | setDefaultValues (self, obj) |
def | getJob (self, obj) |
def | updateDepths (self, obj, ignoreErrors=False) |
def | execute (self, obj) |
def PathScripts.PathOp.ObjectOp.__getstate__ | ( | self | ) |
__getstat__(self) ... called when receiver is saved. Can safely be overwritten by subclasses.
def PathScripts.PathOp.ObjectOp.__setstate__ | ( | self, | |
state | |||
) |
__getstat__(self) ... called when receiver is restored. Can safely be overwritten by subclasses.
def PathScripts.PathOp.ObjectOp.applyExpression | ( | self, | |
obj, | |||
prop, | |||
expr | |||
) |
applyExpression(obj, prop, expr) ... set expression expr on obj.prop if expr is set
def PathScripts.PathOp.ObjectOp.execute | ( | self, | |
obj | |||
) |
execute(obj) ... base implementation - do not overwrite! Verifies that the operation is assigned to a job and that the job also has a valid Base. It also sets the following instance variables that can and should be safely be used by implementation of opExecute(): self.model ... List of base objects of the Job itself self.stock ... Stock object for the Job itself self.vertFeed ... vertical feed rate of assigned tool self.vertRapid ... vertical rapid rate of assigned tool self.horizFeed ... horizontal feed rate of assigned tool self.horizRapid ... norizontal rapid rate of assigned tool self.tool ... the actual tool being used self.radius ... the main radius of the tool being used self.commandlist ... a list for collecting all commands produced by the operation Once everything is validated and above variables are set the implementation calls opExecute(obj) - which is expected to add the generated commands to self.commandlist Finally the base implementation adds a rapid move to clearance height and assigns the receiver's Path property from the command list.
def PathScripts.PathOp.ObjectOp.getJob | ( | self, | |
obj | |||
) |
getJob(obj) ... return the job this operation is part of.
def PathScripts.PathOp.ObjectOp.initOperation | ( | self, | |
obj | |||
) |
initOperation(obj) ... implement to create additional properties. Should be overwritten by subclasses.
Reimplemented in PathScripts.PathSurface.ObjectSurface, PathScripts.PathAreaOp.ObjectOp, PathScripts.PathCircularHoleBase.ObjectOp, and PathScripts.PathEngrave.ObjectEngrave.
def PathScripts.PathOp.ObjectOp.onChanged | ( | self, | |
obj, | |||
prop | |||
) |
onChanged(obj, prop) ... base implementation of the FC notification framework. Do not overwrite, overwrite opOnChanged() instead.
def PathScripts.PathOp.ObjectOp.opExecute | ( | self, | |
obj | |||
) |
opExecute(obj) ... called whenever the receiver needs to be recalculated. See documentation of execute() for a list of base functionality provided. Should be overwritten by subclasses.
Reimplemented in PathScripts.PathSurface.ObjectSurface, PathScripts.PathCircularHoleBase.ObjectOp, and PathScripts.PathEngrave.ObjectEngrave.
def PathScripts.PathOp.ObjectOp.opFeatures | ( | self, | |
obj | |||
) |
opFeatures(obj) ... returns the OR'ed list of features used and supported by the operation. The default implementation returns "FeatureTool | FeatureDeptsh | FeatureHeights | FeatureStartPoint" Should be overwritten by subclasses.
Reimplemented in PathScripts.PathSurface.ObjectSurface, PathScripts.PathAreaOp.ObjectOp, PathScripts.PathCircularHoleBase.ObjectOp, and PathScripts.PathEngrave.ObjectEngrave.
def PathScripts.PathOp.ObjectOp.opOnChanged | ( | self, | |
obj, | |||
prop | |||
) |
opOnChanged(obj, prop) ... overwrite to process property changes. This is a callback function that is invoked each time a property of the receiver is assigned a value. Note that the FC framework does not distinguish between assigning a different value and assigning the same value again. Can safely be overwritten by subclasses.
Reimplemented in PathScripts.PathAreaOp.ObjectOp.
def PathScripts.PathOp.ObjectOp.opOnDocumentRestored | ( | self, | |
obj | |||
) |
opOnDocumentRestored(obj) ... implement if an op needs special handling like migrating the data model. Should be overwritten by subclasses.
Reimplemented in PathScripts.PathPocketShape.ObjectPocket.
def PathScripts.PathOp.ObjectOp.opRejectAddBase | ( | self, | |
obj, | |||
base, | |||
sub | |||
) |
opRejectAddBase(base, sub) ... if op returns True the addition of the feature is prevented. Should be overwritten by subclasses.
Reimplemented in PathScripts.PathDeburr.ObjectDeburr.
def PathScripts.PathOp.ObjectOp.opSetDefaultValues | ( | self, | |
obj, | |||
job | |||
) |
opSetDefaultValues(obj, job) ... overwrite to set initial default values. Called after the receiver has been fully created with all properties. Can safely be overwritten by subclasses.
Reimplemented in PathScripts.PathSurface.ObjectSurface, PathScripts.PathAreaOp.ObjectOp, PathScripts.PathEngraveBase.ObjectOp, and PathScripts.PathDrilling.ObjectDrilling.
def PathScripts.PathOp.ObjectOp.opUpdateDepths | ( | self, | |
obj | |||
) |
opUpdateDepths(obj) ... overwrite to implement special depths calculation. Can safely be overwritten by subclass.
def PathScripts.PathOp.ObjectOp.setDefaultValues | ( | self, | |
obj | |||
) |
setDefaultValues(obj) ... base implementation. Do not overwrite, overwrite opSetDefaultValues() instead.
def PathScripts.PathOp.ObjectOp.setEditorModes | ( | self, | |
obj, | |||
features | |||
) |
Editor modes are not preserved during document store/restore, set editor modes for all properties
def PathScripts.PathOp.ObjectOp.updateDepths | ( | self, | |
obj, | |||
ignoreErrors = False |
|||
) |
updateDepths(obj) ... base implementation calculating depths depending on base geometry. Should not be overwritten.