Attacher: Py: extend AttachEngine's interface
* add constructor attributes: * Mode * CompleteModeList * ImplementedModes * GetModeInfo * References * SuperPlacement * Reverse * Parameter * CompleteRefTypeList methods: * getShapeType * isShapeOfType * downgradeType * getTypeRank * copy * calculateAttachedPlacement * suggestMapModes * readParametersFromFeature * writeParametersToFeature
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
Include="Mod/Part/App/Attacher.h"
|
||||
FatherInclude="Base/BaseClassPy.h"
|
||||
Namespace="Attacher"
|
||||
Constructor="true"
|
||||
Delete="true"
|
||||
FatherNamespace="Base">
|
||||
<Documentation>
|
||||
@@ -21,5 +22,147 @@
|
||||
</Documentation>
|
||||
<Parameter Name="AttacherType" Type="String" />
|
||||
</Attribute>
|
||||
<Attribute Name="Mode" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>Current attachment mode.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Mode" Type="String" />
|
||||
</Attribute>
|
||||
<Attribute Name="References" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>Current attachment mode.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="References" Type="Object" />
|
||||
</Attribute>
|
||||
<Attribute Name="SuperPlacement" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>Current attachment mode.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="SuperPlacement" Type="Object" />
|
||||
</Attribute>
|
||||
<Attribute Name="Reverse" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>If True, Z axis of attached placement is flipped. X axis is flipped in addition (CS has to remain right-handed).</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Reverse" Type="Boolean" />
|
||||
</Attribute>
|
||||
<Attribute Name="Parameter" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>Value of parameter for some curve attachment modes. Range of 0..1 spans the length of the edge (parameter value can be outside of the range for curves that allow extrapolation.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Parameter" Type="Float" />
|
||||
</Attribute>
|
||||
|
||||
<Attribute Name="CompleteModeList" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>List of all attachment modes of all AttachEngines. This is the list of modes in MapMode enum properties of AttachableObjects.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="CompleteModeList" Type="List" />
|
||||
</Attribute>
|
||||
<Attribute Name="ImplementedModes" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>List of all attachment modes of all AttachEngines. This is the list of modes in MapMode enum properties of AttachableObjects.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="ImplementedModes" Type="List" />
|
||||
</Attribute>
|
||||
<Attribute Name="CompleteRefTypeList" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>List of all attachment modes of all AttachEngines. This is the list of modes in MapMode enum properties of AttachableObjects.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="CompleteModeList" Type="List" />
|
||||
</Attribute>
|
||||
|
||||
<Methode Name="getModeInfo">
|
||||
<Documentation>
|
||||
<UserDocu>getModeInfo(mode): returns supported reference combinations, user-friendly name, and so on.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getShapeType">
|
||||
<Documentation>
|
||||
<UserDocu>getShapeType(shape): returns shape type as interpreted by AttachEngine. Returns a string.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="isShapeOfType">
|
||||
<Documentation>
|
||||
<UserDocu>isShapeOfType(type_shape, type_needed): tests if shape type, specified by type_shape (string), fits a type required by attachment mode type_needed (string). e.g. 'Circle' fits a requirement of 'Edge', and 'Curve' doesn't fit if a 'Circle' is required.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="downgradeType">
|
||||
<Documentation>
|
||||
<UserDocu>downgradeType(type): returns next more general type. E.g. downgradeType('Circle') yeilds 'Curve'.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getTypeRank">
|
||||
<Documentation>
|
||||
<UserDocu>getTypeRank(type): returns rank of shape type. Rank is how many times the type can be downgraded, before it becomes 'Any'.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="copy" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>copy(): returns a new instance of AttachEngine.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="calculateAttachedPlacement" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>calculateAttachedPlacement(orig_placement): returns result of attachment, based
|
||||
on current Mode, References, etc. SuperPlacment is included.
|
||||
|
||||
original_placement is the previous placement of the object being attached. It
|
||||
is used to preserve orientation for Translate attachment mode. For other modes,
|
||||
it is ignored.
|
||||
|
||||
Returns the new placement. If not attached, returns None. If attachment fails,
|
||||
an exception is raised.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="suggestMapModes">
|
||||
<Documentation>
|
||||
|
||||
<UserDocu>suggestMapModes(): runs mode suggestion routine and returns a dictionary with
|
||||
results and supplementary information.
|
||||
|
||||
Keys:
|
||||
'allApplicableModes': list of modes that can accept current references. Note
|
||||
that it is only a check by types, and does not guarantee the modes will
|
||||
actually work.
|
||||
|
||||
'bestFitMode': mode that fits current references best. Note that the mode may
|
||||
not be valid for the set of references; check for if 'message' is 'OK'.
|
||||
|
||||
'error': error message for when 'message' is 'UnexpectedError' or
|
||||
'LinkBroken'.
|
||||
|
||||
'message': general result of suggestion. 'IncompatibleGeometry', 'NoModesFit':
|
||||
no modes accept current set of references; 'OK': some modes do accept current
|
||||
set of references (though it's not guarantted the modes will work - surrestor
|
||||
only checks for correct types); 'UnexpectedError': should never happen.
|
||||
|
||||
'nextRefTypeHint': what more can be added to references to reach other modes
|
||||
('reachableModes' provide more extended information on this)
|
||||
|
||||
'reachableModes': a dict, where key is mode, and value is a list of sequences
|
||||
of references that can be added to fit that mode.
|
||||
|
||||
'references_Types': a list of types of geometry linked by references (that's
|
||||
the input information for suggestor, actually).</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="readParametersFromFeature">
|
||||
<Documentation>
|
||||
<UserDocu>readParametersFromFeature(document_object): sets AttachEngine parameters (References, Mode, etc.) by reading out properties of AttachableObject-derived feature.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="writeParametersToFeature">
|
||||
<Documentation>
|
||||
|
||||
<UserDocu>writeParametersToFeature(document_object): updates properties of
|
||||
AttachableObject-derived feature with current AttachEngine parameters
|
||||
(References, Mode, etc.).
|
||||
|
||||
Warning: if a feature linked by AttachEngine.References was deleted, this method
|
||||
will crash FreeCAD.</UserDocu>
|
||||
|
||||
</Documentation>
|
||||
</Methode>
|
||||
</PythonExport>
|
||||
</GenerateModel>
|
||||
|
||||
Reference in New Issue
Block a user