The AttachEngine class is the placement calculation routine, modes, hints and so on. More...
#include <Attacher.h>
Public Member Functions | |
AttachEngine () | |
virtual Base::Placement | calculateAttachedPlacement (Base::Placement origPlacement) const =0 |
virtual AttachEngine * | copy () const =0 |
void | EnableAllSupportedModes (void) |
EnableAllModes enables all modes that have shape type lists filled. More... | |
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 | setUp (const App::PropertyLinkSubList &references, eMapMode mapMode=mmDeactivated, bool mapReverse=false, double attachParameter=0.0, double surfU=0.0, double surfV=0.0, const Base::Placement &attachmentOffset=Base::Placement()) |
virtual void | setUp (const AttachEngine &another) |
virtual void | suggestMapModes (SuggestResult &result) const |
suggestMapModes is the procedure that knows everything about mapping modes. More... | |
virtual | ~AttachEngine () |
Public Member Functions inherited from Base::BaseClass | |
BaseClass () | |
Construction. More... | |
virtual PyObject * | getPyObject (void) |
This method returns the Python wrapper for a C++ object. More... | |
virtual Type | getTypeId (void) const |
bool | isDerivedFrom (const Type type) const |
virtual void | setPyObject (PyObject *) |
virtual | ~BaseClass () |
Destruction. More... | |
Static Public Member Functions | |
static eRefType | downgradeType (eRefType type) |
downgradeType converts a more-specific type into a less-specific type (e.g. More... | |
static GProp_GProps | getInertialPropsOfShape (const std::vector< const TopoDS_Shape * > &shapes) |
static eMapMode | getModeByName (const std::string &modeName) |
static std::string | getModeName (eMapMode mmode) |
getModeName More... | |
static eRefType | getRefTypeByName (const std::string &typeName) |
static std::string | getRefTypeName (eRefType shapeType) |
static eRefType | getShapeType (const App::DocumentObject *obj, const std::string &subshape) |
getShapeType by link content. More... | |
static eRefType | getShapeType (const TopoDS_Shape &sh) |
getShapeType by shape. More... | |
static int | getTypeRank (eRefType type) |
getTypeRank determines, how specific is the supplied shape type. 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 void | verifyReferencesAreSafe (const App::PropertyLinkSubList &references) |
verifyReferencesAreSafe: checks if pointers in references still point to objects contained in open documents. More... | |
Static Public Member Functions inherited from Base::BaseClass | |
static void * | create (void) |
static Type | getClassTypeId (void) |
static void | init (void) |
Public Attributes | |
Base::Placement | attachmentOffset |
double | attachParameter |
eMapMode | mapMode |
bool | mapReverse |
std::vector< bool > | modeEnabled |
modeEnabled is an indicator, whether some mode is ever suggested or not. More... | |
std::vector< refTypeStringList > | modeRefTypes |
App::PropertyLinkSubList | references |
double | surfU |
double | surfV |
Static Public Attributes | |
static const char * | eMapModeStrings [] |
static const char * | eRefTypeStrings [] |
Protected Member Functions | |
refTypeString | cat (eRefType rt1) |
refTypeString | cat (eRefType rt1, eRefType rt2) |
refTypeString | cat (eRefType rt1, eRefType rt2, eRefType rt3) |
refTypeString | cat (eRefType rt1, eRefType rt2, eRefType rt3, eRefType rt4) |
Static Protected Member Functions | |
static void | readLinks (const App::PropertyLinkSubList &references, std::vector< App::GeoFeature * > &geofs, std::vector< const TopoDS_Shape * > &shapes, std::vector< TopoDS_Shape > &storage, std::vector< eRefType > &types) |
AttachEngine3D::readLinks. More... | |
static void | throwWrongMode (eMapMode mmode) |
Static Protected Member Functions inherited from Base::BaseClass | |
static void | initSubclass (Base::Type &toInit, const char *ClassName, const char *ParentName, Type::instantiationMethod method=nullptr) |
Detailed Description
The AttachEngine class is the placement calculation routine, modes, hints and so on.
It can be used separately, without deriving from AttachableObject.
Constructor & Destructor Documentation
◆ AttachEngine()
AttachEngine::AttachEngine | ( | ) |
◆ ~AttachEngine()
|
virtual |
Member Function Documentation
◆ calculateAttachedPlacement()
|
pure virtual |
Implemented in Attacher::AttachEnginePoint, Attacher::AttachEngineLine, Attacher::AttachEnginePlane, and Attacher::AttachEngine3D.
Referenced by Attacher::AttachEnginePy::calculateAttachedPlacement().
◆ cat() [1/4]
|
protected |
◆ cat() [2/4]
|
protected |
◆ cat() [3/4]
|
protected |
◆ cat() [4/4]
|
protected |
◆ copy()
|
pure virtual |
Implemented in Attacher::AttachEnginePoint, Attacher::AttachEngineLine, Attacher::AttachEnginePlane, and Attacher::AttachEngine3D.
Referenced by Attacher::AttachEnginePy::PyInit().
◆ downgradeType()
downgradeType converts a more-specific type into a less-specific type (e.g.
rtCircle->rtCurve, rtCurve->rtEdge, rtEdge->rtAnything)
- Parameters
-
type
- Returns
- the downgraded type.
References Attacher::rtAnything, Attacher::rtCircle, Attacher::rtConic, Attacher::rtConicalFace, Attacher::rtCurve, Attacher::rtCylindricalFace, Attacher::rtEdge, Attacher::rtEllipse, Attacher::rtFace, Attacher::rtFlagHasPlacement, Attacher::rtFlatFace, Attacher::rtHyperbola, Attacher::rtLine, Attacher::rtParabola, Attacher::rtPart, Attacher::rtSolid, Attacher::rtSphericalFace, Attacher::rtSurfaceRev, Attacher::rtToroidalFace, Attacher::rtVertex, and Attacher::rtWire.
Referenced by Attacher::AttachEnginePy::downgradeRefType().
◆ EnableAllSupportedModes()
void AttachEngine::EnableAllSupportedModes | ( | void | ) |
EnableAllModes enables all modes that have shape type lists filled.
The function acts on modeEnabled array.
References Attacher::mmDummy_NumberOfModes.
◆ getInertialPropsOfShape()
|
static |
◆ getModeByName()
|
static |
References Attacher::mmDummy_NumberOfModes.
Referenced by Attacher::AttachEnginePy::getModeInfo(), and Attacher::AttachEnginePy::setMode().
◆ getModeName()
|
static |
getModeName
- Parameters
-
mmode
- Returns
- returns a string that identifies the attachment mode in enum property.
References Attacher::mmDummy_NumberOfModes.
Referenced by PartDesignGui::fixSketchSupport(), Attacher::AttachEnginePy::getCompleteModeList(), Attacher::AttachEnginePy::getImplementedModes(), Attacher::AttachEnginePy::getMode(), AttacherGui::getUIStrings(), and Attacher::AttachEnginePy::suggestModes().
◆ getRefTypeByName()
|
static |
◆ getRefTypeName()
|
static |
References Attacher::rtDummy_numberOfShapeTypes, and Attacher::rtFlagHasPlacement.
Referenced by Attacher::AttachEnginePy::downgradeRefType(), Attacher::AttachEnginePy::getCompleteRefTypeList(), Attacher::AttachEnginePy::getModeInfo(), Attacher::AttachEnginePy::getRefTypeOfShape(), and Attacher::AttachEnginePy::suggestModes().
◆ getShapeType() [1/2]
|
static |
getShapeType by link content.
Will include rtFlagHasPlacement, if applies.
- Parameters
-
obj subshape (input). Can be empty string (then, whole object will be used for shape type testing)
- Returns
References App::PropertyLinkSubList::setValue().
◆ getShapeType() [2/2]
|
static |
getShapeType by shape.
Will never set rtFlagHasPlacement.
- Parameters
-
sh
- Returns
References Attacher::rtAnything, Attacher::rtCircle, Attacher::rtConicalFace, Attacher::rtCurve, Attacher::rtCylindricalFace, Attacher::rtEllipse, Attacher::rtFace, Attacher::rtFlatFace, Attacher::rtHyperbola, Attacher::rtLine, Attacher::rtParabola, Attacher::rtSolid, Attacher::rtSphericalFace, Attacher::rtSurfaceRev, Attacher::rtToroidalFace, Attacher::rtVertex, and Attacher::rtWire.
Referenced by Attacher::AttachEnginePy::getRefTypeOfShape().
◆ getTypeRank()
|
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().
- Parameters
-
type
- Returns
- number of times the type can be downgradeType() before it becomes rtAnything
References Attacher::rtAnything, and Attacher::rtFlagHasPlacement.
Referenced by Attacher::AttachEnginePy::getRefTypeInfo().
◆ isShapeOfType()
isShapeOfType tests if a shape fulfills the requirement of a mode, and returns a score of how spot on was the requirement.
- Parameters
-
shapeType (use return value of AttachEngine::getShapeType) requirement
- Returns
- : -1 - doesn't fulfill, 0 - compatible topology, but incompatible specific (e.g. rtLine, rtCircle); 1 - valid by generic type (e.g. rtCircle is rtEdge), 2 and up - more and more specific match (according to rank of requirement)
References Attacher::rtAnything, and Attacher::rtFlagHasPlacement.
Referenced by Attacher::AttachEnginePy::isFittingRefType().
◆ placementFactory()
Base::Placement 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.
- Parameters
-
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.
- Returns
- the resulting placement. ReverseXY property of Attacher will be automatically applied.
References Part::TopoShape::convertToMatrix(), Base::Placement::getRotation(), Base::Rotation::multVec(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
◆ readLinks()
|
staticprotected |
- Parameters
-
parts shapes storage is a buffer storing what some of the pointers in shapes point to. It is needed, since subshapes are copied in the process (but copying a whole shape of an object can potentially be slow).
References Base::Console(), Base::Persistence::getClassTypeId(), App::DocumentObject::getNameInDocument(), Base::Placement::getRotation(), App::PropertyLinkSubList::getSubValues(), App::PropertyPlacement::getValue(), App::PropertyLinkSubList::getValues(), Base::BaseClass::isDerivedFrom(), Base::Placement::multVec(), Base::Rotation::multVec(), App::GeoFeature::Placement, Attacher::rtFlagHasPlacement, Base::ConsoleSingleton::Warning(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
◆ setUp() [1/2]
|
virtual |
References App::PropertyLinkSubList::Paste().
Referenced by Attacher::AttachEnginePlane::calculateAttachedPlacement(), Attacher::AttachEngineLine::calculateAttachedPlacement(), Attacher::AttachEnginePoint::calculateAttachedPlacement(), Attacher::AttachEngine3D::copy(), Attacher::AttachEnginePlane::copy(), Attacher::AttachEngineLine::copy(), Attacher::AttachEnginePoint::copy(), Attacher::AttachEnginePy::readParametersFromFeature(), and SketcherGui::SuggestAutoMapMode().
◆ setUp() [2/2]
|
virtual |
References attachmentOffset, attachParameter, mapMode, mapReverse, references, surfU, and surfV.
◆ suggestMapModes()
|
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.
- Parameters
-
result (output). Returns results of suggestion, such as best fit mode, list of all modes that apply, hints, etc.
References Attacher::mmDeactivated, and Attacher::mmDummy_NumberOfModes.
Referenced by SketcherGui::SuggestAutoMapMode(), and Attacher::AttachEnginePy::suggestModes().
◆ throwWrongMode()
|
staticprotected |
References Attacher::mmDummy_NumberOfModes.
◆ verifyReferencesAreSafe()
|
static |
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.
References App::GetApplication(), App::Application::getDocuments(), and App::PropertyLinkSubList::getValues().
Referenced by Attacher::AttachEnginePy::getReferences(), and Attacher::AttachEnginePy::writeParametersToFeature().
Member Data Documentation
◆ attachmentOffset
Base::Placement Attacher::AttachEngine::attachmentOffset |
◆ attachParameter
double Attacher::AttachEngine::attachParameter |
Referenced by Attacher::AttachEnginePy::getParameter(), Attacher::AttachEnginePy::setParameter(), and setUp().
◆ eMapModeStrings
|
static |
◆ eRefTypeStrings
|
static |
◆ mapMode
eMapMode Attacher::AttachEngine::mapMode |
◆ mapReverse
bool Attacher::AttachEngine::mapReverse |
Referenced by Attacher::AttachEnginePy::getReverse(), Attacher::AttachEnginePy::setReverse(), and setUp().
◆ modeEnabled
std::vector<bool> Attacher::AttachEngine::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;
◆ modeRefTypes
std::vector<refTypeStringList> Attacher::AttachEngine::modeRefTypes |
◆ references
App::PropertyLinkSubList Attacher::AttachEngine::references |
Referenced by Attacher::AttachEnginePy::getReferences(), Attacher::AttachEnginePy::setReferences(), and setUp().
◆ surfU
double Attacher::AttachEngine::surfU |
Referenced by setUp().
◆ surfV
double Attacher::AttachEngine::surfV |
Referenced by setUp().
The documentation for this class was generated from the following files:
- src/Mod/Part/App/Attacher.h
- src/Mod/Part/App/Attacher.cpp