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 (const 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=nullptr) 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... | |
BaseClass (const BaseClass &)=default | |
virtual PyObject * | getPyObject () |
This method returns the Python wrapper for a C++ object. More... | |
virtual Type | getTypeId () const |
bool | isDerivedFrom (const Type type) const |
BaseClass & | operator= (const BaseClass &)=default |
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 () |
static Type | getClassTypeId () |
static void | init () |
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) |
The AttachEngine class is the placement calculation routine, modes, hints and so on.
It can be used separately, without deriving from AttachableObject.
AttachEngine::AttachEngine | ( | ) |
|
virtual |
|
pure virtual |
Implemented in Attacher::AttachEngine3D, Attacher::AttachEnginePlane, Attacher::AttachEngineLine, and Attacher::AttachEnginePoint.
|
protected |
|
protected |
|
protected |
|
protected |
|
pure virtual |
Implemented in Attacher::AttachEngine3D, Attacher::AttachEnginePlane, Attacher::AttachEngineLine, and Attacher::AttachEnginePoint.
downgradeType converts a more-specific type into a less-specific type (e.g.
rtCircle->rtCurve, rtCurve->rtEdge, rtEdge->rtAnything)
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 getTypeRank(), and isShapeOfType().
void AttachEngine::EnableAllSupportedModes | ( | void | ) |
EnableAllModes enables all modes that have shape type lists filled.
The function acts on modeEnabled array.
References Attacher::mmDummy_NumberOfModes, modeEnabled, and modeRefTypes.
|
static |
|
static |
References eMapModeStrings, and Attacher::mmDummy_NumberOfModes.
|
static |
getModeName
mmode |
References eMapModeStrings, and Attacher::mmDummy_NumberOfModes.
Referenced by PartDesignGui::fixSketchSupport().
|
static |
References eRefTypeStrings, Attacher::rtDummy_numberOfShapeTypes, and Attacher::rtFlagHasPlacement.
|
static |
References eRefTypeStrings, Attacher::rtDummy_numberOfShapeTypes, and Attacher::rtFlagHasPlacement.
|
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) |
References readLinks(), and App::PropertyLinkSubList::setValue().
|
static |
getShapeType by shape.
Will never set rtFlagHasPlacement.
sh |
References getShapeType(), 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 getShapeType(), and readLinks().
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 |
References downgradeType(), Attacher::rtAnything, and Attacher::rtFlagHasPlacement.
Referenced by isShapeOfType().
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 |
References downgradeType(), getTypeRank(), Attacher::rtAnything, and Attacher::rtFlagHasPlacement.
Referenced by Attacher::AttachEngine3D::calculateAttachedPlacement(), and suggestMapModes().
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 = nullptr |
||
) | 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. |
References Base::Placement::getRotation(), mapReverse, Base::Rotation::multVec(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
Referenced by Attacher::AttachEngine3D::calculateAttachedPlacement(), Attacher::AttachEngineLine::calculateAttachedPlacement(), and Attacher::AttachEnginePoint::calculateAttachedPlacement().
|
staticprotected |
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(), getShapeType(), App::PropertyLinkSubList::getSubValues(), Base::BaseClass::getTypeId(), App::PropertyPlacement::getValue(), App::PropertyLinkSubList::getValues(), Base::BaseClass::isDerivedFrom(), Base::Placement::multVec(), Base::Rotation::multVec(), App::GeoFeature::Placement, references, Attacher::rtFlagHasPlacement, verifyReferencesAreSafe(), Base::ConsoleSingleton::Warning(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
Referenced by Attacher::AttachEngine3D::calculateAttachedPlacement(), Attacher::AttachEngineLine::calculateAttachedPlacement(), Attacher::AttachEnginePoint::calculateAttachedPlacement(), getShapeType(), and suggestMapModes().
|
virtual |
References attachmentOffset, attachParameter, mapMode, mapReverse, App::PropertyLinkSubList::Paste(), references, surfU, and surfV.
Referenced by Attacher::AttachEnginePlane::calculateAttachedPlacement(), Attacher::AttachEngineLine::calculateAttachedPlacement(), Attacher::AttachEnginePoint::calculateAttachedPlacement(), setUp(), and SketcherGui::SuggestAutoMapMode().
|
virtual |
References attachmentOffset, attachParameter, mapMode, mapReverse, references, setUp(), surfU, and surfV.
|
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. |
References isShapeOfType(), Attacher::mmDeactivated, Attacher::mmDummy_NumberOfModes, modeEnabled, modeRefTypes, readLinks(), references, Attacher::SuggestResult::srIncompatibleGeometry, Attacher::SuggestResult::srLinkBroken, Attacher::SuggestResult::srNoModesFit, and Attacher::SuggestResult::srOK.
Referenced by SketcherGui::SuggestAutoMapMode().
|
staticprotected |
|
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(), App::PropertyLinkSubList::getValues(), and references.
Referenced by readLinks().
Base::Placement Attacher::AttachEngine::attachmentOffset |
double Attacher::AttachEngine::attachParameter |
Referenced by Attacher::AttachEngine3D::calculateAttachedPlacement(), and setUp().
|
static |
Referenced by getModeByName(), getModeName(), and throwWrongMode().
|
static |
Referenced by getRefTypeByName(), and getRefTypeName().
eMapMode Attacher::AttachEngine::mapMode |
bool Attacher::AttachEngine::mapReverse |
Referenced by Attacher::AttachEngine3D::calculateAttachedPlacement(), placementFactory(), and setUp().
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;
Referenced by EnableAllSupportedModes(), and suggestMapModes().
std::vector<refTypeStringList> Attacher::AttachEngine::modeRefTypes |
App::PropertyLinkSubList Attacher::AttachEngine::references |
Referenced by Attacher::AttachEngine3D::calculateAttachedPlacement(), Attacher::AttachEngineLine::calculateAttachedPlacement(), Attacher::AttachEnginePoint::calculateAttachedPlacement(), femguiutils.selection_widgets.GeometryElementsSelection::get_allitems_text(), femguiutils.selection_widgets.GeometryElementsSelection::get_references(), femguiutils.selection_widgets.GeometryElementsSelection::has_equal_references_shape_types(), readLinks(), femguiutils.selection_widgets.GeometryElementsSelection::remove_all_references(), femguiutils.selection_widgets.GeometryElementsSelection::remove_selected_reference(), femguiutils.selection_widgets.GeometryElementsSelection::select_clicked_reference_shape(), femguiutils.selection_widgets.GeometryElementsSelection::selectionParser(), setUp(), suggestMapModes(), and verifyReferencesAreSafe().
double Attacher::AttachEngine::surfU |
Referenced by setUp().
double Attacher::AttachEngine::surfV |
Referenced by setUp().