Sketcher: Section Command enabling the clipping planes
This commit is contained in:
committed by
Yorik van Havre
parent
cf55431980
commit
dbfb81dc47
@@ -852,6 +852,42 @@ bool CmdSketcherMergeSketches::isActive(void)
|
||||
return (hasActiveDocument() && !Gui::Control().activeDialog());
|
||||
}
|
||||
|
||||
// Acknowledgement of idea and original python macro goes to SpritKopf:
|
||||
// https://github.com/Spritkopf/freecad-macros/blob/master/clip-sketch/clip_sketch.FCMacro
|
||||
// https://forum.freecadweb.org/viewtopic.php?p=231481#p231085
|
||||
DEF_STD_CMD_A(CmdSketcherViewSection);
|
||||
|
||||
CmdSketcherViewSection::CmdSketcherViewSection()
|
||||
: Command("Sketcher_ViewSection")
|
||||
{
|
||||
sAppModule = "Sketcher";
|
||||
sGroup = QT_TR_NOOP("Sketcher");
|
||||
sMenuText = QT_TR_NOOP("View section");
|
||||
sToolTipText = QT_TR_NOOP("Switches between section and full view");
|
||||
sWhatsThis = "Sketcher_ViewSection";
|
||||
sStatusTip = sToolTipText;
|
||||
sPixmap = "Sketcher_ViewSection";
|
||||
eType = 0;
|
||||
}
|
||||
|
||||
void CmdSketcherViewSection::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
doCommand(Doc,"ActiveSketch.ViewObject.TempoVis.sketchClipPlane(ActiveSketch)");
|
||||
}
|
||||
|
||||
bool CmdSketcherViewSection::isActive(void)
|
||||
{
|
||||
Gui::Document *doc = getActiveGuiDocument();
|
||||
if (doc) {
|
||||
// checks if a Sketch Viewprovider is in Edit and is in no special mode
|
||||
SketcherGui::ViewProviderSketch* vp = dynamic_cast<SketcherGui::ViewProviderSketch*>(doc->getInEdit());
|
||||
if (vp /*&& vp->getSketchMode() == ViewProviderSketch::STATUS_NONE*/)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void CreateSketcherCommands(void)
|
||||
{
|
||||
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
@@ -865,4 +901,5 @@ void CreateSketcherCommands(void)
|
||||
rcCmdMgr.addCommand(new CmdSketcherValidateSketch());
|
||||
rcCmdMgr.addCommand(new CmdSketcherMirrorSketch());
|
||||
rcCmdMgr.addCommand(new CmdSketcherMergeSketches());
|
||||
rcCmdMgr.addCommand(new CmdSketcherViewSection());
|
||||
}
|
||||
|
||||
@@ -347,6 +347,7 @@ inline void Sketcher_addWorkbenchSketchActions(T& sketch){
|
||||
<< "Sketcher_EditSketch"
|
||||
<< "Sketcher_LeaveSketch"
|
||||
<< "Sketcher_ViewSketch"
|
||||
<< "Sketcher_ViewSection"
|
||||
<< "Sketcher_MapSketch";
|
||||
SketcherAddWorkspaceSketchExtra( sketch );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user