+ issue #0001475: Implement a 3 point arc similar to solidworks in sketcher
This commit is contained in:
parent
35b10d68aa
commit
d1341f36f7
|
@ -503,8 +503,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
|
||||||
<< "Sketcher_LeaveSketch"
|
<< "Sketcher_LeaveSketch"
|
||||||
<< "Separator"
|
<< "Separator"
|
||||||
<< "Sketcher_CreatePoint"
|
<< "Sketcher_CreatePoint"
|
||||||
<< "Sketcher_CreateArc"
|
<< "Sketcher_CompCreateArc"
|
||||||
<< "Sketcher_Create3PointArc"
|
|
||||||
<< "Sketcher_CreateCircle"
|
<< "Sketcher_CreateCircle"
|
||||||
<< "Sketcher_CreateLine"
|
<< "Sketcher_CreateLine"
|
||||||
<< "Sketcher_CreatePolyline"
|
<< "Sketcher_CreatePolyline"
|
||||||
|
|
|
@ -260,8 +260,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
|
||||||
Gui::ToolBarItem* geom = new Gui::ToolBarItem(root);
|
Gui::ToolBarItem* geom = new Gui::ToolBarItem(root);
|
||||||
geom->setCommand("Sketcher geometries");
|
geom->setCommand("Sketcher geometries");
|
||||||
*geom << "Sketcher_CreatePoint"
|
*geom << "Sketcher_CreatePoint"
|
||||||
<< "Sketcher_CreateArc"
|
<< "Sketcher_CompCreateArc"
|
||||||
<< "Sketcher_Create3PointArc"
|
|
||||||
<< "Sketcher_CreateCircle"
|
<< "Sketcher_CreateCircle"
|
||||||
<< "Sketcher_CreateLine"
|
<< "Sketcher_CreateLine"
|
||||||
<< "Sketcher_CreatePolyline"
|
<< "Sketcher_CreatePolyline"
|
||||||
|
|
|
@ -24,12 +24,15 @@
|
||||||
#include "PreCompiled.h"
|
#include "PreCompiled.h"
|
||||||
#ifndef _PreComp_
|
#ifndef _PreComp_
|
||||||
# include <Inventor/nodes/SoPickStyle.h>
|
# include <Inventor/nodes/SoPickStyle.h>
|
||||||
|
# include <QApplication>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <boost/math/special_functions/fpclassify.hpp>
|
#include <boost/math/special_functions/fpclassify.hpp>
|
||||||
#include <Base/Console.h>
|
#include <Base/Console.h>
|
||||||
|
|
||||||
|
#include <Gui/Action.h>
|
||||||
#include <Gui/Application.h>
|
#include <Gui/Application.h>
|
||||||
|
#include <Gui/BitmapFactory.h>
|
||||||
#include <Gui/Document.h>
|
#include <Gui/Document.h>
|
||||||
#include <Gui/Command.h>
|
#include <Gui/Command.h>
|
||||||
#include <Gui/MainWindow.h>
|
#include <Gui/MainWindow.h>
|
||||||
|
@ -1502,6 +1505,83 @@ bool CmdSketcherCreate3PointArc::isActive(void)
|
||||||
return isCreateGeoActive(getActiveGuiDocument());
|
return isCreateGeoActive(getActiveGuiDocument());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEF_STD_CMD_ACL(CmdSketcherCompCreateArc);
|
||||||
|
|
||||||
|
CmdSketcherCompCreateArc::CmdSketcherCompCreateArc()
|
||||||
|
: Command("Sketcher_CompCreateArc")
|
||||||
|
{
|
||||||
|
sAppModule = "Sketcher";
|
||||||
|
sGroup = QT_TR_NOOP("Sketcher");
|
||||||
|
sMenuText = QT_TR_NOOP("Create arc");
|
||||||
|
sToolTipText = QT_TR_NOOP("Create an arc in the sketcher");
|
||||||
|
sWhatsThis = sToolTipText;
|
||||||
|
sStatusTip = sToolTipText;
|
||||||
|
eType = ForEdit;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CmdSketcherCompCreateArc::activated(int iMsg)
|
||||||
|
{
|
||||||
|
if (iMsg==0)
|
||||||
|
ActivateHandler(getActiveGuiDocument(),new DrawSketchHandlerArc());
|
||||||
|
else if (iMsg==1)
|
||||||
|
ActivateHandler(getActiveGuiDocument(),new DrawSketchHandler3PointArc());
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Since the default icon is reset when enabing/disabling the command we have
|
||||||
|
// to explicitly set the icon of the used command.
|
||||||
|
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(_pcAction);
|
||||||
|
QList<QAction*> a = pcAction->actions();
|
||||||
|
|
||||||
|
assert(iMsg < a.size());
|
||||||
|
pcAction->setIcon(a[iMsg]->icon());
|
||||||
|
}
|
||||||
|
|
||||||
|
Gui::Action * CmdSketcherCompCreateArc::createAction(void)
|
||||||
|
{
|
||||||
|
Gui::ActionGroup* pcAction = new Gui::ActionGroup(this, Gui::getMainWindow());
|
||||||
|
pcAction->setDropDownMenu(true);
|
||||||
|
applyCommandData(pcAction);
|
||||||
|
|
||||||
|
QAction* arc1 = pcAction->addAction(QString());
|
||||||
|
arc1->setIcon(Gui::BitmapFactory().pixmapFromSvg("Sketcher_CreateArc", QSize(24,24)));
|
||||||
|
QAction* arc2 = pcAction->addAction(QString());
|
||||||
|
arc2->setIcon(Gui::BitmapFactory().pixmapFromSvg("Sketcher_Create3PointArc", QSize(24,24)));
|
||||||
|
|
||||||
|
_pcAction = pcAction;
|
||||||
|
languageChange();
|
||||||
|
|
||||||
|
pcAction->setIcon(arc1->icon());
|
||||||
|
int defaultId = 0;
|
||||||
|
pcAction->setProperty("defaultAction", QVariant(defaultId));
|
||||||
|
|
||||||
|
return pcAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CmdSketcherCompCreateArc::languageChange()
|
||||||
|
{
|
||||||
|
Command::languageChange();
|
||||||
|
|
||||||
|
if (!_pcAction)
|
||||||
|
return;
|
||||||
|
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(_pcAction);
|
||||||
|
QList<QAction*> a = pcAction->actions();
|
||||||
|
|
||||||
|
QAction* arc1 = a[0];
|
||||||
|
arc1->setText(QApplication::translate("CmdSketcherCompCreateArc","Center and end points"));
|
||||||
|
arc1->setToolTip(QApplication::translate("Sketcher_CreateArc","Create an arc by its center and by its end points"));
|
||||||
|
arc1->setStatusTip(QApplication::translate("Sketcher_CreateArc","Create an arc by its center and by its end points"));
|
||||||
|
QAction* arc2 = a[1];
|
||||||
|
arc2->setText(QApplication::translate("CmdSketcherCompCreateArc","End point and rim point"));
|
||||||
|
arc2->setToolTip(QApplication::translate("Sketcher_Create3PointArc","Create an arc by its end points and a point along the arc"));
|
||||||
|
arc2->setStatusTip(QApplication::translate("Sketcher_Create3PointArc","Create an arc by its end points and a point along the arc"));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CmdSketcherCompCreateArc::isActive(void)
|
||||||
|
{
|
||||||
|
return isCreateGeoActive(getActiveGuiDocument());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ======================================================================================
|
// ======================================================================================
|
||||||
|
@ -2432,6 +2512,7 @@ void CreateSketcherCommandsCreateGeo(void)
|
||||||
rcCmdMgr.addCommand(new CmdSketcherCreatePoint());
|
rcCmdMgr.addCommand(new CmdSketcherCreatePoint());
|
||||||
rcCmdMgr.addCommand(new CmdSketcherCreateArc());
|
rcCmdMgr.addCommand(new CmdSketcherCreateArc());
|
||||||
rcCmdMgr.addCommand(new CmdSketcherCreate3PointArc());
|
rcCmdMgr.addCommand(new CmdSketcherCreate3PointArc());
|
||||||
|
rcCmdMgr.addCommand(new CmdSketcherCompCreateArc());
|
||||||
rcCmdMgr.addCommand(new CmdSketcherCreateCircle());
|
rcCmdMgr.addCommand(new CmdSketcherCreateCircle());
|
||||||
rcCmdMgr.addCommand(new CmdSketcherCreateLine());
|
rcCmdMgr.addCommand(new CmdSketcherCreateLine());
|
||||||
rcCmdMgr.addCommand(new CmdSketcherCreatePolyline());
|
rcCmdMgr.addCommand(new CmdSketcherCreatePolyline());
|
||||||
|
|
|
@ -122,8 +122,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
|
||||||
Gui::ToolBarItem* geom = new Gui::ToolBarItem(root);
|
Gui::ToolBarItem* geom = new Gui::ToolBarItem(root);
|
||||||
geom->setCommand("Sketcher geometries");
|
geom->setCommand("Sketcher geometries");
|
||||||
*geom << "Sketcher_CreatePoint"
|
*geom << "Sketcher_CreatePoint"
|
||||||
<< "Sketcher_CreateArc"
|
<< "Sketcher_CompCreateArc"
|
||||||
<< "Sketcher_Create3PointArc"
|
|
||||||
<< "Sketcher_CreateCircle"
|
<< "Sketcher_CreateCircle"
|
||||||
<< "Sketcher_CreateLine"
|
<< "Sketcher_CreateLine"
|
||||||
<< "Sketcher_CreatePolyline"
|
<< "Sketcher_CreatePolyline"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user