draftobjects.base.DraftObject Class Reference

Public Member Functions

def execute (self, obj)
 
def onChanged (self, obj, prop)
 

Public Attributes

 Type
 

Detailed Description

The base class for Draft objects.

Parameters
----------
obj : a base C++ object
    The base object instantiated during creation,
    which commonly may be of types `Part::Part2DObjectPython`,
    `Part::FeaturePython`, or `App::FeaturePython`.

        >>> obj = App.ActiveDocument.addObject('Part::Part2DObjectPython')
        >>> DraftObject(obj)

    This class instance is stored in the `Proxy` attribute
    of the base object.
    ::
        obj.Proxy = self

tp : str, optional
    It defaults to `'Unknown'`.
    It indicates the type of this scripted object,
    which will be assigned to the Proxy's `Type` attribute.

    This is useful to distinguish different types of scripted objects
    that may be derived from the same C++ class.

Attributes
----------
Type : str
    It indicates the type of scripted object.
    Normally `Type = tp`.

    All objects have a `TypeId` attribute, but this attribute
    refers to the C++ class only. Using the `Type` attribute
    allows distinguishing among various types of objects
    derived from the same C++ class.

        >>> print(A.TypeId, "->", A.Proxy.Type)
        Part::Part2DObjectPython -> Wire
        >>> print(B.TypeId, "->", B.Proxy.Type)
        Part::Part2DObjectPython -> Circle

This class attribute is accessible through the `Proxy` object:
`obj.Proxy.Type`.

Member Function Documentation

◆ execute()

def draftobjects.base.DraftObject.execute (   self,
  obj 
)
Run this method when the object is created or recomputed.

Override this method to produce effects when the object
is newly created, and whenever the document is recomputed.

By default it does nothing.

Parameters
----------
obj : the scripted object.
    This commonly may be of types `Part::Part2DObjectPython`,
    `Part::FeaturePython`, or `App::FeaturePython`.

Reimplemented in draftobjects.bezcurve.BezCurve, draftobjects.array.Array, draftobjects.block.Block, draftobjects.bspline.BSpline, draftobjects.circle.Circle, draftobjects.clone.Clone, draftobjects.drawingview.DrawingView, draftobjects.ellipse.Ellipse, draftobjects.facebinder.Facebinder, draftobjects.fillet.Fillet, draftobjects.patharray.PathArray, draftobjects.pathtwistedarray.PathTwistedArray, draftobjects.point.Point, draftobjects.pointarray.PointArray, draftobjects.polygon.Polygon, draftobjects.rectangle.Rectangle, draftobjects.shape2dview.Shape2DView, draftobjects.shapestring.ShapeString, and draftobjects.wire.Wire.

Referenced by draftobjects.facebinder.Facebinder.addSubobjects(), PathScripts.PathDressupDogbone.ObjectDressup.boneStateList(), ArchSite.Compass.buildCoordinates(), PathScripts.PathDressupHoldingTags.ObjectTagDressup.generateTags(), ArchPanel.PanelCut.getWires(), ArchSchedule.CommandArchSchedule.IsActive(), Mod.PartDesign.Scripts.DistanceBolt.DistanceBolt.onChanged(), Mod.PartDesign.Scripts.Epitrochoid.Epitrochoid.onChanged(), Mod.PartDesign.Scripts.Parallelepiped.Parallelepiped.onChanged(), Mod.PartDesign.Scripts.Parallelepiped.BoxCylinder.onChanged(), Mod.PartDesign.Scripts.Spring.MySpring.onChanged(), FeaturePython.DistanceBolt.onChanged(), PathScripts.PathStock.StockFromBase.onChanged(), PathScripts.PathStock.StockCreateBox.onChanged(), PathScripts.PathStock.StockCreateCylinder.onChanged(), draftobjects.draftlink.DraftLink.onDocumentRestored(), draftobjects.patharray.PathArray.onDocumentRestored(), and draftobjects.pathtwistedarray.PathTwistedArray.onDocumentRestored().

◆ onChanged()

def draftobjects.base.DraftObject.onChanged (   self,
  obj,
  prop 
)

Member Data Documentation

◆ Type


The documentation for this class was generated from the following file: