allow to set rigid property via context menu
This commit is contained in:
parent
e9e1b45280
commit
f61ae2e90c
|
@ -52,7 +52,7 @@ bool ViewProviderItemAssembly::doubleClicked(void)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewProviderItemAssembly::attach(App::DocumentObject *pcFeat)
|
void ViewProviderItemAssembly::attach(App::DocumentObject* pcFeat)
|
||||||
{
|
{
|
||||||
// call parent attach method
|
// call parent attach method
|
||||||
ViewProviderGeometryObject::attach(pcFeat);
|
ViewProviderGeometryObject::attach(pcFeat);
|
||||||
|
@ -64,10 +64,10 @@ void ViewProviderItemAssembly::attach(App::DocumentObject *pcFeat)
|
||||||
|
|
||||||
void ViewProviderItemAssembly::setDisplayMode(const char* ModeName)
|
void ViewProviderItemAssembly::setDisplayMode(const char* ModeName)
|
||||||
{
|
{
|
||||||
if ( strcmp("Main",ModeName)==0 )
|
if(strcmp("Main",ModeName)==0)
|
||||||
setDisplayMaskMode("Main");
|
setDisplayMaskMode("Main");
|
||||||
|
|
||||||
ViewProviderGeometryObject::setDisplayMode( ModeName );
|
ViewProviderGeometryObject::setDisplayMode(ModeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> ViewProviderItemAssembly::getDisplayModes(void) const
|
std::vector<std::string> ViewProviderItemAssembly::getDisplayModes(void) const
|
||||||
|
@ -98,3 +98,31 @@ std::vector<App::DocumentObject*> ViewProviderItemAssembly::claimChildren3D(void
|
||||||
return static_cast<Assembly::ItemAssembly*>(getObject())->Items.getValues();
|
return static_cast<Assembly::ItemAssembly*>(getObject())->Items.getValues();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ViewProviderItemAssembly::setupContextMenu(QMenu* menu, QObject* receiver, const char* member)
|
||||||
|
{
|
||||||
|
ViewProviderItem::setupContextMenu(menu, receiver, member); // call the base class
|
||||||
|
|
||||||
|
QAction* toggle = menu->addAction(QObject::tr("Rigid subassembly"), receiver, member);
|
||||||
|
toggle->setData(QVariant(1000)); // identifier
|
||||||
|
toggle->setCheckable(true);
|
||||||
|
toggle->setToolTip(QObject::tr("Set if the subassembly shall be solved as on part (rigid) or if all parts of this assembly are solved for themselfe."));
|
||||||
|
toggle->setStatusTip(QObject::tr("Set if the subassembly shall be solved as on part (rigid) or if all parts of this assembly are solved for themself."));
|
||||||
|
bool prop = static_cast<Assembly::ItemAssembly*>(getObject())->Rigid.getValue();
|
||||||
|
toggle->setChecked(prop);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ViewProviderItemAssembly::setEdit(int ModNum)
|
||||||
|
{
|
||||||
|
if(ModNum == 1000) { // identifier
|
||||||
|
Gui::Command::openCommand("Change subassembly solving behaviour");
|
||||||
|
if(!static_cast<Assembly::ItemAssembly*>(getObject())->Rigid.getValue())
|
||||||
|
Gui::Command::doCommand(Gui::Command::Doc,"FreeCAD.getDocument(\"%s\").getObject(\"%s\").Rigid = True",getObject()->getDocument()->getName(), getObject()->getNameInDocument());
|
||||||
|
else
|
||||||
|
Gui::Command::doCommand(Gui::Command::Doc,"FreeCAD.getDocument(\"%s\").getObject(\"%s\").Rigid = False",getObject()->getDocument()->getName(), getObject()->getNameInDocument());
|
||||||
|
|
||||||
|
Gui::Command::commitCommand();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return ViewProviderItem::setEdit(ModNum); // call the base class
|
||||||
|
}
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
#define ASSEMBLYGUI_ViewProviderAssembly_H
|
#define ASSEMBLYGUI_ViewProviderAssembly_H
|
||||||
|
|
||||||
#include "ViewProvider.h"
|
#include "ViewProvider.h"
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
|
||||||
namespace AssemblyGui {
|
namespace AssemblyGui {
|
||||||
|
@ -48,6 +50,9 @@ public:
|
||||||
virtual std::vector<App::DocumentObject*> claimChildren(void)const;
|
virtual std::vector<App::DocumentObject*> claimChildren(void)const;
|
||||||
|
|
||||||
virtual std::vector<App::DocumentObject*> claimChildren3D(void)const;
|
virtual std::vector<App::DocumentObject*> claimChildren3D(void)const;
|
||||||
|
|
||||||
|
virtual void setupContextMenu(QMenu* menu, QObject* receiver, const char* member);
|
||||||
|
virtual bool setEdit(int ModNum);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -170,9 +170,17 @@ void ViewProviderConstraint::attach(App::DocumentObject* pcFeat)
|
||||||
internal_vp.setDisplayMM("Flat Lines");
|
internal_vp.setDisplayMM("Flat Lines");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ViewProviderConstraint::update(const App::Property* prop) {
|
||||||
|
|
||||||
void ViewProviderConstraint::updateData(const App::Property* prop)
|
if(Visibility.getValue() && m_selected) {
|
||||||
{
|
|
||||||
|
draw();
|
||||||
|
}
|
||||||
|
ViewProviderPart::update(prop);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ViewProviderConstraint::updateData(const App::Property* prop) {
|
||||||
if(Visibility.getValue() && m_selected) {
|
if(Visibility.getValue() && m_selected) {
|
||||||
|
|
||||||
draw();
|
draw();
|
||||||
|
|
|
@ -70,6 +70,8 @@ public:
|
||||||
//annotation nodes
|
//annotation nodes
|
||||||
virtual void attach(App::DocumentObject* pcObj);
|
virtual void attach(App::DocumentObject* pcObj);
|
||||||
|
|
||||||
|
//update is for visual only
|
||||||
|
virtual void update(const App::Property*);
|
||||||
//needs to be overridden as this viewprovider dos not represent a Part::Feature
|
//needs to be overridden as this viewprovider dos not represent a Part::Feature
|
||||||
virtual void updateData(const App::Property*);
|
virtual void updateData(const App::Property*);
|
||||||
//needs to be overridden as this viewprovider dos not represent a Part::Feature
|
//needs to be overridden as this viewprovider dos not represent a Part::Feature
|
||||||
|
|
Loading…
Reference in New Issue
Block a user