implement clone command for part design
This commit is contained in:
@@ -298,6 +298,49 @@ bool CmdPartDesignShapeBinder::isActive(void)
|
||||
return hasActiveDocument ();
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// PartDesign_Clone
|
||||
//===========================================================================
|
||||
|
||||
DEF_STD_CMD_A(CmdPartDesignClone)
|
||||
|
||||
CmdPartDesignClone::CmdPartDesignClone()
|
||||
:Command("PartDesign_Clone")
|
||||
{
|
||||
sAppModule = "PartDesign";
|
||||
sGroup = QT_TR_NOOP("PartDesign");
|
||||
sMenuText = QT_TR_NOOP("Create a clone");
|
||||
sToolTipText = QT_TR_NOOP("Create a new clone");
|
||||
sWhatsThis = "PartDesign_Clone";
|
||||
sStatusTip = sToolTipText;
|
||||
sPixmap = "PartDesign_Clone";
|
||||
}
|
||||
|
||||
void CmdPartDesignClone::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
std::string FeatName = getUniqueObjectName("Clone");
|
||||
std::vector<App::DocumentObject*> objs = getSelection().getObjectsOfType
|
||||
(Part::Feature::getClassTypeId());
|
||||
if (objs.size() == 1) {
|
||||
openCommand("Create Clone");
|
||||
doCommand(Command::Doc,"App.ActiveDocument.addObject('PartDesign::FeatureBase','%s')",
|
||||
FeatName.c_str());
|
||||
doCommand(Command::Doc,"App.ActiveDocument.ActiveObject.BaseFeature = App.ActiveDocument.%s",
|
||||
objs.front()->getNameInDocument());
|
||||
doCommand(Command::Doc,"App.ActiveDocument.ActiveObject.Placement = App.ActiveDocument.%s.Placement",
|
||||
objs.front()->getNameInDocument());
|
||||
doCommand(Command::Doc,"App.ActiveDocument.ActiveObject.setEditorMode('Placement',0)");
|
||||
commitCommand();
|
||||
updateActive();
|
||||
}
|
||||
}
|
||||
|
||||
bool CmdPartDesignClone::isActive(void)
|
||||
{
|
||||
return getSelection().countObjectsOfType(Part::Feature::getClassTypeId()) == 1;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// PartDesign_Sketch
|
||||
//===========================================================================
|
||||
@@ -2158,6 +2201,7 @@ void CreatePartDesignCommands(void)
|
||||
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
|
||||
rcCmdMgr.addCommand(new CmdPartDesignShapeBinder());
|
||||
rcCmdMgr.addCommand(new CmdPartDesignClone());
|
||||
rcCmdMgr.addCommand(new CmdPartDesignPlane());
|
||||
rcCmdMgr.addCommand(new CmdPartDesignLine());
|
||||
rcCmdMgr.addCommand(new CmdPartDesignPoint());
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
<file>icons/PartDesign_Body.svg</file>
|
||||
<file>icons/PartDesign_Boolean.svg</file>
|
||||
<file>icons/PartDesign_ShapeBinder.svg</file>
|
||||
<file>icons/PartDesign_Clone.svg</file>
|
||||
<file>icons/PartDesign_Plane.svg</file>
|
||||
<file>icons/PartDesign_Line.svg</file>
|
||||
<file>icons/PartDesign_Point.svg</file>
|
||||
|
||||
250
src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Clone.svg
Normal file
250
src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Clone.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 12 KiB |
@@ -447,11 +447,12 @@ Gui::MenuItem* Workbench::setupMenuBar() const
|
||||
<< "PartDesign_Line"
|
||||
<< "PartDesign_Plane"
|
||||
<< "PartDesign_ShapeBinder"
|
||||
<< "PartDesign_Clone"
|
||||
<< "Separator"
|
||||
<< "PartDesign_Pad"
|
||||
<< "PartDesign_Revolution"
|
||||
<< "PartDesign_Pad"
|
||||
<< "PartDesign_Revolution"
|
||||
<< "PartDesign_AdditiveLoft"
|
||||
<< "PartDesign_AdditivePipe"
|
||||
<< "PartDesign_AdditivePipe"
|
||||
<< "PartDesign_CompPrimitiveAdditive"
|
||||
<< "Separator"
|
||||
<< "PartDesign_Pocket"
|
||||
@@ -510,14 +511,15 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
|
||||
<< "PartDesign_Point"
|
||||
<< "PartDesign_Line"
|
||||
<< "PartDesign_Plane"
|
||||
<< "PartDesign_ShapeBinder";
|
||||
|
||||
<< "PartDesign_ShapeBinder"
|
||||
<< "PartDesign_Clone";
|
||||
|
||||
part = new Gui::ToolBarItem(root);
|
||||
part->setCommand("Part Design Modeling");
|
||||
*part << "PartDesign_Pad"
|
||||
<< "PartDesign_Revolution"
|
||||
*part << "PartDesign_Pad"
|
||||
<< "PartDesign_Revolution"
|
||||
<< "PartDesign_AdditiveLoft"
|
||||
<< "PartDesign_AdditivePipe"
|
||||
<< "PartDesign_AdditivePipe"
|
||||
<< "PartDesign_CompPrimitiveAdditive"
|
||||
<< "Separator"
|
||||
<< "PartDesign_Pocket"
|
||||
|
||||
Reference in New Issue
Block a user