FreeCAD C++
|
#include <Mod/Part/App/Attacher.h>
The AttachEngine class is the placement calculation routine, modes, hints and so on. It can be used separately, without deriving from AttachableObject.
Public Member Functions | |
Base::Placement | placementFactory (const gp_Dir &ZAxis, gp_Vec XAxis, gp_Pnt Origin, gp_Pnt refOrg=gp_Pnt(), bool useRefOrg_Line=false, bool useRefOrg_Plane=false, bool makeYVertical=false, bool makeLegacyFlatFaceOrientation=false, Base::Placement *placeOfRef=0) const |
placementFactory calculates placement from Z axis direction, optional X axis direction, and origin point. More... | |
virtual void | suggestMapModes (SuggestResult &result) const |
suggestMapModes is the procedure that knows everything about mapping modes. It returns the most appropriate mapping mode, as well as list of all modes that will accept the set of references. In case no modes apply, extra information regarding reasons is returned in msg. More... | |
void | EnableAllSupportedModes (void) |
EnableAllModes enables all modes that have shape type lists filled. The function acts on modeEnabled array. | |
![]() | |
BaseClass () | |
Construction. | |
virtual | ~BaseClass () |
Destruction. | |
Static Public Member Functions | |
static eRefType | getShapeType (const TopoDS_Shape &sh) |
getShapeType by shape. Will never set rtFlagHasPlacement. More... | |
static eRefType | getShapeType (const App::DocumentObject *obj, const std::string &subshape) |
getShapeType by link content. Will include rtFlagHasPlacement, if applies. More... | |
static eRefType | downgradeType (eRefType type) |
downgradeType converts a more-specific type into a less-specific type (e.g. rtCircle->rtCurve, rtCurve->rtEdge, rtEdge->rtAnything) More... | |
static int | getTypeRank (eRefType type) |
getTypeRank determines, how specific is the supplied shape type. The ranks are outlined in definition of eRefType. The ranks are defined by implementation of downgradeType(). More... | |
static int | isShapeOfType (eRefType shapeType, eRefType requirement) |
isShapeOfType tests if a shape fulfills the requirement of a mode, and returns a score of how spot on was the requirement. More... | |
static std::string | getModeName (eMapMode mmode) |
getModeName More... | |
static void | verifyReferencesAreSafe (const App::PropertyLinkSubList &references) |
verifyReferencesAreSafe: checks if pointers in references still point to objects contained in open documents. This guarantees the links are valid. Throws Base::Exception if invalid links are found. | |
Public Attributes | |
std::vector< bool > | modeEnabled |
modeEnabled is an indicator, whether some mode is ever suggested or not. Set to false to suppress suggesting some mode, like so: modeEnabled[mmModeIDontLike] = false; | |
downgradeType converts a more-specific type into a less-specific type (e.g. rtCircle->rtCurve, rtCurve->rtEdge, rtEdge->rtAnything)
type |
|
static |
getModeName
mmode |
|
static |
getShapeType by shape. Will never set rtFlagHasPlacement.
sh |
|
static |
getShapeType by link content. Will include rtFlagHasPlacement, if applies.
obj | |
subshape | (input). Can be empty string (then, whole object will be used for shape type testing) |
|
static |
getTypeRank determines, how specific is the supplied shape type. The ranks are outlined in definition of eRefType. The ranks are defined by implementation of downgradeType().
type |
|
static |
isShapeOfType tests if a shape fulfills the requirement of a mode, and returns a score of how spot on was the requirement.
shapeType | (use return value of AttachEngine::getShapeType) |
requirement |
Base::Placement Attacher::AttachEngine::placementFactory | ( | const gp_Dir & | ZAxis, |
gp_Vec | XAxis, | ||
gp_Pnt | Origin, | ||
gp_Pnt | refOrg = gp_Pnt() , |
||
bool | useRefOrg_Line = false , |
||
bool | useRefOrg_Plane = false , |
||
bool | makeYVertical = false , |
||
bool | makeLegacyFlatFaceOrientation = false , |
||
Base::Placement * | placeOfRef = 0 |
||
) | const |
placementFactory calculates placement from Z axis direction, optional X axis direction, and origin point.
ZAxis | (input) mandatory. Z axis of the returned placement will strictly coincide with ZAxis. |
XAxis | (input) optional (i.e., can be zero). Sets the preferred X axis orientation. If it is not perpendicular to ZAxis, it will be forced to be. If XAxis is zero, the effect is equivalent to setting makeYVertical to true. |
Origin | (input) mandatory. |
refOrg | (input). The point that will be used in case any of useRefOrg_XX parameters is true. |
useRefOrg_Line | (input). If true, Origin will be moved along ZAxis to be as close as possible to refOrg. |
useRefOrg_Plane | (input). If true, Origin will be moved in XAxis-YAxis plane to be as close as possible to refOrg. |
makeYVertical | (input). If true, XAxis is ignored, and X and Y axes are defined in order to make Y axis go as upwards as possible. If ZAxis is strictly upwards, XY will match global XY. If ZAxis is strictly downwards, XAxis will be the reversed global X axis. |
makeLegacyFlatFaceOrientation | (input). Modifies the behavior of makeYVertical to match the logic that was used in mapping of sketches to flat faces in FreeCAD prior to introduction of Attacher. Set makeYVertical to true if using this. |
|
virtual |
suggestMapModes is the procedure that knows everything about mapping modes. It returns the most appropriate mapping mode, as well as list of all modes that will accept the set of references. In case no modes apply, extra information regarding reasons is returned in msg.
result | (output). Returns results of suggestion, such as best fit mode, list of all modes that apply, hints, etc. |