Typedefs | |
typedef Gui::ViewProviderPythonFeatureT< ViewProvider > | ViewProviderPython |
Enumerations | |
enum | Workflow { Workflow::Undetermined = 0, Workflow::Legacy = 1<<0, Workflow::Modern = 1<<1 } |
Defines allowded tool set provided by the workbench Legacy mode provides a free PartDesign features but forbids bodies and parts. More... | |
Functions | |
App::Part * | assertActivePart () |
Returns active part, if there is no such, creates a new part, if it fails, shows a message. More... | |
bool | assureLegacyWorkflow (App::Document *doc) |
Assures that workflow of the given document is determined and returns true if it is Workflow::Legacy. More... | |
bool | assureModernWorkflow (App::Document *doc) |
Assures that workflow of the given document is determined and returns true if it is Workflow::Modern. More... | |
std::string | buildLinkListPythonStr (const std::vector< App::DocumentObject * > &objs) |
Return reference as string for python in the format [obj1, obj2, ...,]. More... | |
std::string | buildLinkSingleSubPythonStr (const App::DocumentObject *obj, const std::vector< std::string > &subs) |
Return reference as string for python in the format (<obj> ["sub"?]) More... | |
std::string | buildLinkSubListPythonStr (const std::vector< App::DocumentObject * > &objs, const std::vector< std::string > &subs) |
Returns sub reference list as a python string in the format [(obj1,"sub1"),(obj2,"sub2"),...]. More... | |
std::string | buildLinkSubPythonStr (const App::DocumentObject *obj, const std::vector< std::string > &subs) |
Return reference as string for python in the format (<obj> ["sub1", "sub2", ...]) More... | |
std::vector< App::DocumentObject * > | collectMovableDependencies (std::vector< App::DocumentObject * > &features) |
Collect dependencies of the features during the move. Dependencies should only be dependent on origin. More... | |
void | fixSketchSupport (Sketcher::SketchObject *sketch) |
Fix sketch support after moving a free sketch into a body. More... | |
App::Part * | getActivePart () |
PartDesign::Body * | getBody (bool messageIfNot, bool autoActivate, bool assertModern, App::DocumentObject **topParent, std::string *subname) |
Return active body or show a warning message. If autoActivate is true (the default) then if there is only single body in the document it will be activated. More... | |
PartDesign::Body * | getBodyFor (const App::DocumentObject *, bool messageIfNot, bool autoActivate=true, bool assertModern=true, App::DocumentObject **topParent=0, std::string *subname=0) |
Finds a body for the given feature. More... | |
App::Part * | getPartFor (const App::DocumentObject *obj, bool messageIfNot) |
void | getReferencedSelection (const App::DocumentObject *thisObj, const Gui::SelectionChanges &msg, App::DocumentObject *&selObj, std::vector< std::string > &selSub) |
Extract reference from Selection. More... | |
QString | getRefStr (const App::DocumentObject *obj, const std::vector< std::string > &sub) |
Return reference as string for UI elements (format <obj>:<subelement> More... | |
PyObject * | initModule () |
bool | isAnyNonPartDesignLinksTo (PartDesign::Feature *feature, bool respectGroups=false) |
Returns true if document has any non-PartDesign objects that links to the given object. More... | |
bool | isFeatureMovable (App::DocumentObject *feature) |
Check if feature is dependent on anything except movable sketches and datums. More... | |
bool | isLegacyWorkflow (App::Document *doc) |
Returns true if the workflow of the given document is Workflow::Legacy. More... | |
bool | isModernWorkflow (App::Document *doc) |
Returns true if the workflow of the given document is Workflow::Modern. More... | |
bool | isPartDesignAwareObjecta (App::DocumentObject *obj, bool respectGroups=false) |
PartDesign::Body * | makeBody (App::Document *doc) |
Create a Body object in doc, set it active, and return pointer to it. More... | |
void | needActiveBodyError (void) |
Display error when there are existing Body objects, but none are active. More... | |
void | relinkToBody (PartDesign::Feature *feature) |
Relink all nonPartDesign features to the body instead of the given partDesign Feature. More... | |
void | relinkToOrigin (App::DocumentObject *feature, PartDesign::Body *body) |
Relink sketches and datums to target body's origin. More... | |
bool | setEdit (App::DocumentObject *obj, PartDesign::Body *body=0) |
Activate edit mode of the given object. More... | |
Typedef Documentation
◆ ViewProviderPython
Enumeration Type Documentation
◆ Workflow
|
strong |
Defines allowded tool set provided by the workbench Legacy mode provides a free PartDesign features but forbids bodies and parts.
Enumerator | |
---|---|
Undetermined | No workflow was chosen yet. |
Legacy | Old-style workflow with free features and no bodies. |
Modern | New-style workflow with bodies, parts etc. |
Function Documentation
◆ assertActivePart()
App::Part* PartDesignGui::assertActivePart | ( | ) |
Returns active part, if there is no such, creates a new part, if it fails, shows a message.
◆ assureLegacyWorkflow()
bool PartDesignGui::assureLegacyWorkflow | ( | App::Document * | doc | ) |
Assures that workflow of the given document is determined and returns true if it is Workflow::Legacy.
References PartDesignGui::WorkflowManager::determineWorkflow(), PartDesignGui::WorkflowManager::instance(), and Legacy.
◆ assureModernWorkflow()
bool PartDesignGui::assureModernWorkflow | ( | App::Document * | doc | ) |
Assures that workflow of the given document is determined and returns true if it is Workflow::Modern.
References PartDesignGui::WorkflowManager::determineWorkflow(), PartDesignGui::WorkflowManager::instance(), and Modern.
Referenced by getBody().
◆ buildLinkListPythonStr()
std::string PartDesignGui::buildLinkListPythonStr | ( | const std::vector< App::DocumentObject * > & | objs | ) |
Return reference as string for python in the format [obj1, obj2, ...,].
References Gui::Command::getObjectCmd().
Referenced by relinkToBody().
◆ buildLinkSingleSubPythonStr()
std::string PartDesignGui::buildLinkSingleSubPythonStr | ( | const App::DocumentObject * | obj, |
const std::vector< std::string > & | subs | ||
) |
Return reference as string for python in the format (<obj> ["sub"?])
References Gui::Command::getObjectCmd(), and PartDesign::Feature::isDatum().
Referenced by PartDesignGui::TaskDlgDraftParameters::accept(), PartDesignGui::TaskDlgMirroredParameters::accept(), PartDesignGui::TaskRevolutionParameters::apply(), PartDesignGui::TaskLinearPatternParameters::apply(), and PartDesignGui::TaskPolarPatternParameters::apply().
◆ buildLinkSubListPythonStr()
std::string PartDesignGui::buildLinkSubListPythonStr | ( | const std::vector< App::DocumentObject * > & | objs, |
const std::vector< std::string > & | subs | ||
) |
Returns sub reference list as a python string in the format [(obj1,"sub1"),(obj2,"sub2"),...].
References Gui::Command::getObjectCmd().
Referenced by relinkToBody().
◆ buildLinkSubPythonStr()
std::string PartDesignGui::buildLinkSubPythonStr | ( | const App::DocumentObject * | obj, |
const std::vector< std::string > & | subs | ||
) |
Return reference as string for python in the format (<obj> ["sub1", "sub2", ...])
Referenced by relinkToBody().
◆ collectMovableDependencies()
std::vector< App::DocumentObject * > PartDesignGui::collectMovableDependencies | ( | std::vector< App::DocumentObject * > & | features | ) |
Collect dependencies of the features during the move. Dependencies should only be dependent on origin.
References collectMovableDependencies(), Base::Persistence::getClassTypeId(), Base::Persistence::getTypeId(), and Base::Type::isDerivedFrom().
Referenced by collectMovableDependencies(), and PartDesignGui::ViewProviderBody::dropObject().
◆ fixSketchSupport()
void PartDesignGui::fixSketchSupport | ( | Sketcher::SketchObject * | sketch | ) |
Fix sketch support after moving a free sketch into a body.
References fixSketchSupport(), Base::Vector3< _Precision >::GetAngle(), getBodyFor(), App::DocumentObject::getDocument(), Attacher::AttachEngine::getModeName(), Gui::Command::getObjectCmd(), App::OriginGroupExtension::getOrigin(), Base::Placement::getPosition(), Base::Placement::getRotation(), App::PropertyPlacement::getValue(), App::PropertyLinkSubList::getValue(), App::Origin::getXY(), App::Origin::getXZ(), App::Origin::getYZ(), Attacher::mmFlatFace, Base::Rotation::multVec(), App::GeoFeature::Placement, Part::AttachExtension::Support, Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
Referenced by PartDesignGui::TaskFeaturePick::buildFeatures(), and fixSketchSupport().
◆ getActivePart()
App::Part * PartDesignGui::getActivePart | ( | ) |
◆ getBody()
PartDesign::Body * PartDesignGui::getBody | ( | bool | messageIfNot, |
bool | autoActivate, | ||
bool | assertModern, | ||
App::DocumentObject ** | topParent, | ||
std::string * | subname | ||
) |
Return active body or show a warning message. If autoActivate is true (the default) then if there is only single body in the document it will be activated.
Return active body or show a warning message.
- Parameters
-
messageIfNot autoActivate
- Returns
- Body
References Gui::Application::activeView(), assureModernWorkflow(), Gui::MDIView::getActiveObject(), Gui::BaseView::getAppDocument(), getBody(), Base::Persistence::getClassTypeId(), App::DocumentObject::getDocument(), Gui::getMainWindow(), Gui::Command::getObjectCmd(), App::DocumentObject::getParents(), and Gui::Application::Instance.
Referenced by PartDesignGui::ReferenceSelection::allow(), PartDesignGui::TaskFeaturePick::buildFeatures(), getBody(), and getBodyFor().
◆ getBodyFor()
PartDesign::Body * PartDesignGui::getBodyFor | ( | const App::DocumentObject * | , |
bool | messageIfNot, | ||
bool | autoActivate = true , |
||
bool | assertModern = true , |
||
App::DocumentObject ** | topParent = 0 , |
||
std::string * | subname = 0 |
||
) |
Finds a body for the given feature.
And shows a message if not found Also unlike Body::findBodyFor it checks if the active body has the feature first.
References PartDesign::Body::findBodyOf(), getBody(), getBodyFor(), Gui::getMainWindow(), and App::OriginGroupExtension::hasObject().
Referenced by PartDesignGui::TaskDlgDatumParameters::accept(), PartDesignGui::TaskDlgPipeParameters::accept(), PartDesignGui::TaskFeaturePick::buildFeatures(), PartDesignGui::ViewProviderDatum::doubleClicked(), fixSketchSupport(), getBodyFor(), getPartFor(), getReferencedSelection(), setEdit(), and PartDesignGui::Workbench::setupContextMenu().
◆ getPartFor()
App::Part * PartDesignGui::getPartFor | ( | const App::DocumentObject * | obj, |
bool | messageIfNot | ||
) |
◆ getReferencedSelection()
void PartDesignGui::getReferencedSelection | ( | const App::DocumentObject * | thisObj, |
const Gui::SelectionChanges & | msg, | ||
App::DocumentObject *& | selObj, | ||
std::vector< std::string > & | selSub | ||
) |
Extract reference from Selection.
References PartDesign::Body::addObject(), getBodyFor(), Base::Persistence::getClassTypeId(), App::DocumentObject::getDocument(), Gui::getMainWindow(), App::Document::getName(), App::Document::getObject(), getPartFor(), PartDesign::Feature::isDatum(), Base::BaseClass::isDerivedFrom(), PartDesignGui::TaskFeaturePick::makeCopy(), and App::Document::openTransaction().
Referenced by PartDesignGui::TaskDraftParameters::onSelectionChanged(), PartDesignGui::TaskMirroredParameters::onSelectionChanged(), PartDesignGui::TaskPolarPatternParameters::onSelectionChanged(), PartDesignGui::TaskRevolutionParameters::onSelectionChanged(), and PartDesignGui::TaskLinearPatternParameters::onSelectionChanged().
◆ getRefStr()
QString PartDesignGui::getRefStr | ( | const App::DocumentObject * | obj, |
const std::vector< std::string > & | sub | ||
) |
Return reference as string for UI elements (format <obj>:<subelement>
References PartDesign::Feature::isDatum().
Referenced by PartDesignGui::TaskRevolutionParameters::fillAxisCombo(), PartDesignGui::TaskDraftParameters::onSelectionChanged(), and PartDesignGui::TaskDraftParameters::TaskDraftParameters().
◆ initModule()
PyObject* PartDesignGui::initModule | ( | ) |
◆ isAnyNonPartDesignLinksTo()
bool PartDesignGui::isAnyNonPartDesignLinksTo | ( | PartDesign::Feature * | feature, |
bool | respectGroups = false |
||
) |
Returns true if document has any non-PartDesign objects that links to the given object.
If respectGroups is true don't count links from App::GeoFeatureGroup-derived objects (default is false)
References DraftVecUtils::find(), Base::Persistence::getClassTypeId(), App::DocumentObject::getDocument(), App::PropertyContainer::getPropertyList(), isAnyNonPartDesignLinksTo(), and isPartDesignAwareObjecta().
Referenced by isAnyNonPartDesignLinksTo().
◆ isFeatureMovable()
bool PartDesignGui::isFeatureMovable | ( | App::DocumentObject *const | feat | ) |
Check if feature is dependent on anything except movable sketches and datums.
References Base::Persistence::getClassTypeId(), App::ExtensionContainer::getExtensionByType(), Base::Persistence::getTypeId(), PartDesign::ProfileBased::getVerifiedSketch(), App::ExtensionContainer::hasExtension(), Base::Type::isDerivedFrom(), and isFeatureMovable().
Referenced by PartDesignGui::ViewProviderBody::dropObject(), and isFeatureMovable().
◆ isLegacyWorkflow()
bool PartDesignGui::isLegacyWorkflow | ( | App::Document * | doc | ) |
Returns true if the workflow of the given document is Workflow::Legacy.
References PartDesignGui::WorkflowManager::getWorkflowForDocument(), PartDesignGui::WorkflowManager::instance(), and Legacy.
◆ isModernWorkflow()
bool PartDesignGui::isModernWorkflow | ( | App::Document * | doc | ) |
Returns true if the workflow of the given document is Workflow::Modern.
References PartDesignGui::WorkflowManager::getWorkflowForDocument(), PartDesignGui::WorkflowManager::instance(), and Modern.
Referenced by PartDesignGui::Workbench::setupContextMenu().
◆ isPartDesignAwareObjecta()
bool PartDesignGui::isPartDesignAwareObjecta | ( | App::DocumentObject * | obj, |
bool | respectGroups = false |
||
) |
References Base::Persistence::getClassTypeId(), PartDesign::Body::isAllowed(), and isPartDesignAwareObjecta().
Referenced by isAnyNonPartDesignLinksTo(), isPartDesignAwareObjecta(), and relinkToBody().
◆ makeBody()
PartDesign::Body * PartDesignGui::makeBody | ( | App::Document * | doc | ) |
Create a Body object in doc, set it active, and return pointer to it.
References Gui::Command::Doc, Gui::ViewProvider::doubleClicked(), Gui::Application::getViewProvider(), Gui::Application::Instance, and makeBody().
Referenced by makeBody().
◆ needActiveBodyError()
void PartDesignGui::needActiveBodyError | ( | void | ) |
Display error when there are existing Body objects, but none are active.
References Gui::getMainWindow(), and needActiveBodyError().
Referenced by needActiveBodyError().
◆ relinkToBody()
void PartDesignGui::relinkToBody | ( | PartDesign::Feature * | feature | ) |
Relink all nonPartDesign features to the body instead of the given partDesign Feature.
References buildLinkListPythonStr(), buildLinkSubListPythonStr(), buildLinkSubPythonStr(), PartDesign::Body::findBodyOf(), Base::Persistence::getClassTypeId(), App::DocumentObject::getDocument(), Gui::Command::getObjectCmd(), App::PropertyLinkSub::getSubValues(), App::PropertyLinkSubList::getSubValues(), App::PropertyLink::getValue(), App::PropertyLinkSub::getValue(), App::PropertyListsT< T, ListT, ParentT >::getValues(), App::PropertyLinkSubList::getValues(), isPartDesignAwareObjecta(), and relinkToBody().
Referenced by relinkToBody().
◆ relinkToOrigin()
void PartDesignGui::relinkToOrigin | ( | App::DocumentObject * | feat, |
PartDesign::Body * | targetbody | ||
) |
Relink sketches and datums to target body's origin.
References Base::Persistence::getClassTypeId(), App::ExtensionContainer::getExtensionByType(), App::OriginGroupExtension::getOrigin(), App::Origin::getOriginFeature(), Base::Persistence::getTypeId(), App::ExtensionContainer::hasExtension(), Base::Type::isDerivedFrom(), and relinkToOrigin().
Referenced by relinkToOrigin().
◆ setEdit()
bool PartDesignGui::setEdit | ( | App::DocumentObject * | obj, |
PartDesign::Body * | body | ||
) |
Activate edit mode of the given object.
References Gui::Application::activeView(), getBodyFor(), App::DocumentObject::getNameInDocument(), Gui::Command::getObjectCmd(), Gui::Application::Instance, and setEdit().
Referenced by PartDesignGui::ViewProviderDatum::doubleClicked(), PartDesignGui::ViewProvider::doubleClicked(), PartDesignGui::ViewProviderLoft::doubleClicked(), PartDesignGui::ViewProviderPipe::doubleClicked(), and setEdit().