Add command PartDesign_Body and integrate it into the Workbench
This commit is contained in:
parent
ae9aae703c
commit
1b809f305e
|
@ -81,6 +81,36 @@ PartDesign::Body *getBody(void)
|
|||
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// PartDesign_Body
|
||||
//===========================================================================
|
||||
DEF_STD_CMD_A(CmdPartDesignBody);
|
||||
|
||||
CmdPartDesignBody::CmdPartDesignBody()
|
||||
: Command("PartDesign_Body")
|
||||
{
|
||||
sAppModule = "PartDesign";
|
||||
sGroup = QT_TR_NOOP("PartDesign");
|
||||
sMenuText = QT_TR_NOOP("Create body");
|
||||
sToolTipText = QT_TR_NOOP("Create a new body feature");
|
||||
sWhatsThis = sToolTipText;
|
||||
sStatusTip = sToolTipText;
|
||||
sPixmap = "PartDesign_Body";
|
||||
}
|
||||
|
||||
void CmdPartDesignBody::activated(int iMsg)
|
||||
{
|
||||
std::string FeatName = getUniqueObjectName("Body");
|
||||
openCommand("Add a body feature");
|
||||
doCommand(Doc,"App.activeDocument().addObject('PartDesign::Body','%s')",FeatName.c_str());
|
||||
|
||||
}
|
||||
|
||||
bool CmdPartDesignBody::isActive(void)
|
||||
{
|
||||
return hasActiveDocument();
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// PartDesign_Sketch
|
||||
//===========================================================================
|
||||
|
@ -1235,6 +1265,7 @@ void CreatePartDesignCommands(void)
|
|||
{
|
||||
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
|
||||
rcCmdMgr.addCommand(new CmdPartDesignBody());
|
||||
rcCmdMgr.addCommand(new CmdPartDesignPad());
|
||||
rcCmdMgr.addCommand(new CmdPartDesignPocket());
|
||||
rcCmdMgr.addCommand(new CmdPartDesignRevolution());
|
||||
|
|
|
@ -83,7 +83,7 @@ void Workbench::activated()
|
|||
"PartDesign_NewSketch",
|
||||
"PartDesign_Fillet",
|
||||
"PartDesign_Chamfer",
|
||||
// "PartDesign_Draft",
|
||||
"PartDesign_Draft",
|
||||
0};
|
||||
Watcher.push_back(new Gui::TaskView::TaskWatcherCommands(
|
||||
"SELECT Part::Feature SUBELEMENT Face COUNT 1",
|
||||
|
@ -92,10 +92,29 @@ void Workbench::activated()
|
|||
"Part_Box"
|
||||
));
|
||||
|
||||
const char* Body[] = {
|
||||
"PartDesign_NewSketch",
|
||||
0};
|
||||
Watcher.push_back(new Gui::TaskView::TaskWatcherCommands(
|
||||
"SELECT PartDesign::Body COUNT 1",
|
||||
Body,
|
||||
"Start Body",
|
||||
"Part_Box"
|
||||
));
|
||||
|
||||
const char* NoSel[] = {
|
||||
"PartDesign_Body",
|
||||
0};
|
||||
Watcher.push_back(new Gui::TaskView::TaskWatcherCommandsEmptySelection(
|
||||
NoSel,
|
||||
"Start Part",
|
||||
"Part_Box"
|
||||
));
|
||||
|
||||
const char* Faces[] = {
|
||||
"PartDesign_Fillet",
|
||||
"PartDesign_Chamfer",
|
||||
// "PartDesign_Draft",
|
||||
"PartDesign_Draft",
|
||||
0};
|
||||
Watcher.push_back(new Gui::TaskView::TaskWatcherCommands(
|
||||
"SELECT Part::Feature SUBELEMENT Face COUNT 2..",
|
||||
|
@ -109,6 +128,7 @@ void Workbench::activated()
|
|||
"PartDesign_Pad",
|
||||
"PartDesign_Pocket",
|
||||
"PartDesign_Revolution",
|
||||
"PartDesign_Groove",
|
||||
0};
|
||||
Watcher.push_back(new Gui::TaskView::TaskWatcherCommands(
|
||||
"SELECT Sketcher::SketchObject COUNT 1",
|
||||
|
@ -117,29 +137,18 @@ void Workbench::activated()
|
|||
"Part_Box"
|
||||
));
|
||||
|
||||
// const char* Transformed[] = {
|
||||
// "PartDesign_Mirrored",
|
||||
// "PartDesign_LinearPattern",
|
||||
// "PartDesign_PolarPattern",
|
||||
//// "PartDesign_Scaled",
|
||||
// "PartDesign_MultiTransform",
|
||||
// 0};
|
||||
// Watcher.push_back(new Gui::TaskView::TaskWatcherCommands(
|
||||
// "SELECT PartDesign::SketchBased",
|
||||
// Transformed,
|
||||
// "Transformation tools",
|
||||
// "PartDesign_MultiTransform"
|
||||
// ));
|
||||
|
||||
const char* Empty[] = {
|
||||
"PartDesign_NewSketch",
|
||||
"Part_Box",
|
||||
"Part_Cylinder",
|
||||
const char* Transformed[] = {
|
||||
"PartDesign_Mirrored",
|
||||
"PartDesign_LinearPattern",
|
||||
"PartDesign_PolarPattern",
|
||||
// "PartDesign_Scaled",
|
||||
"PartDesign_MultiTransform",
|
||||
0};
|
||||
Watcher.push_back(new Gui::TaskView::TaskWatcherCommandsEmptySelection(
|
||||
Empty,
|
||||
"Create Geometry",
|
||||
"Part_Box"
|
||||
Watcher.push_back(new Gui::TaskView::TaskWatcherCommands(
|
||||
"SELECT PartDesign::SketchBased",
|
||||
Transformed,
|
||||
"Transformation tools",
|
||||
"PartDesign_MultiTransform"
|
||||
));
|
||||
|
||||
// set the previous used active Body
|
||||
|
@ -190,10 +199,12 @@ Gui::MenuItem* Workbench::setupMenuBar() const
|
|||
root->insertItem(item, part);
|
||||
part->setCommand("&Part Design");
|
||||
SketcherGui::addSketcherWorkbenchSketchActions( *part );
|
||||
*part << "PartDesign_NewSketch"
|
||||
*part << "PartDesign_Body"
|
||||
<< "PartDesign_NewSketch"
|
||||
<< "Sketcher_LeaveSketch"
|
||||
<< "Sketcher_ViewSketch"
|
||||
<< "Sketcher_MapSketch"
|
||||
<< "Sketcher_ReorientSketch"
|
||||
<< geom
|
||||
<< cons
|
||||
<< consaccel
|
||||
|
@ -201,15 +212,15 @@ Gui::MenuItem* Workbench::setupMenuBar() const
|
|||
<< "PartDesign_Pad"
|
||||
<< "PartDesign_Pocket"
|
||||
<< "PartDesign_Revolution"
|
||||
// << "PartDesign_Groove"
|
||||
<< "PartDesign_Groove"
|
||||
<< "PartDesign_Fillet"
|
||||
<< "PartDesign_Chamfer";
|
||||
// << "PartDesign_Draft"
|
||||
// << "PartDesign_Mirrored"
|
||||
// << "PartDesign_LinearPattern"
|
||||
// << "PartDesign_PolarPattern"
|
||||
<< "PartDesign_Chamfer"
|
||||
<< "PartDesign_Draft"
|
||||
<< "PartDesign_Mirrored"
|
||||
<< "PartDesign_LinearPattern"
|
||||
<< "PartDesign_PolarPattern"
|
||||
// << "PartDesign_Scaled"
|
||||
// << "PartDesign_MultiTransform";
|
||||
<< "PartDesign_MultiTransform";
|
||||
// For 0.13 a couple of python packages like numpy, matplotlib and others
|
||||
// are not deployed with the installer on Windows. Thus, the WizardShaft is
|
||||
// not deployed either hence the check for the existence of the command.
|
||||
|
@ -228,23 +239,25 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
|
|||
Gui::ToolBarItem* root = StdWorkbench::setupToolBars();
|
||||
Gui::ToolBarItem* part = new Gui::ToolBarItem(root);
|
||||
part->setCommand("Part Design");
|
||||
// TODO: reenable features than rebasing
|
||||
// SketcherGui::addSketcherWorkbenchSketchActions( *part );
|
||||
*part << "PartDesign_NewSketch"
|
||||
*part << "PartDesign_Body"
|
||||
<< "PartDesign_NewSketch"
|
||||
<< "Sketcher_ViewSketch"
|
||||
<< "Sketcher_MapSketch"
|
||||
<< "Sketcher_LeaveSketch"
|
||||
<< "Separator"
|
||||
<< "PartDesign_Pad"
|
||||
<< "PartDesign_Pocket"
|
||||
<< "PartDesign_Revolution"
|
||||
// << "PartDesign_Groove"
|
||||
<< "PartDesign_Groove"
|
||||
<< "PartDesign_Fillet"
|
||||
<< "PartDesign_Chamfer";
|
||||
// << "PartDesign_Draft"
|
||||
// << "PartDesign_Mirrored"
|
||||
// << "PartDesign_LinearPattern"
|
||||
// << "PartDesign_PolarPattern"
|
||||
<< "PartDesign_Chamfer"
|
||||
<< "PartDesign_Draft"
|
||||
<< "PartDesign_Mirrored"
|
||||
<< "PartDesign_LinearPattern"
|
||||
<< "PartDesign_PolarPattern"
|
||||
// << "PartDesign_Scaled"
|
||||
// << "PartDesign_MultiTransform";
|
||||
<< "PartDesign_MultiTransform";
|
||||
|
||||
Gui::ToolBarItem* geom = new Gui::ToolBarItem(root);
|
||||
geom->setCommand("Sketcher geometries");
|
||||
|
|
|
@ -26,3 +26,5 @@ FreeCADGui.activateWorkbench("PartDesignWorkbench")
|
|||
App.newDocument()
|
||||
App.ActiveDocument.addObject("PartDesign::Body")
|
||||
PartDesignGui.setActivePart(App.ActiveDocument.ActiveObject)
|
||||
# Make the "Create sketch" prompt appear in the task panel
|
||||
Gui.Selection.addSelection(App.ActiveDocument.ActiveObject)
|
||||
|
|
Loading…
Reference in New Issue
Block a user