+ implement primitive dialog as task panel
git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5365 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
This commit is contained in:
parent
db0ad3a49c
commit
891421d805
|
@ -63,6 +63,8 @@ LocationWidget::LocationWidget (QWidget * parent)
|
|||
QGridLayout* gridLayout = new QGridLayout(this);
|
||||
gridLayout->addLayout(box, 0, 0, 1, 2);
|
||||
|
||||
connect(dValue, SIGNAL(activated(int)),
|
||||
this, SLOT(on_direction_activated(int)));
|
||||
retranslateUi();
|
||||
}
|
||||
|
||||
|
@ -72,7 +74,7 @@ LocationWidget::~LocationWidget()
|
|||
|
||||
QSize LocationWidget::sizeHint() const
|
||||
{
|
||||
return QSize(150,190);
|
||||
return QSize(150,100);
|
||||
}
|
||||
|
||||
void LocationWidget::changeEvent(QEvent* e)
|
||||
|
@ -121,6 +123,13 @@ Base::Vector3f LocationWidget::getPosition() const
|
|||
(float)this->zValue->value());
|
||||
}
|
||||
|
||||
void LocationWidget::setPosition(const Base::Vector3f& v)
|
||||
{
|
||||
this->xValue->setValue(v.x);
|
||||
this->yValue->setValue(v.y);
|
||||
this->zValue->setValue(v.z);
|
||||
}
|
||||
|
||||
void LocationWidget::setDirection(const Base::Vector3f& dir)
|
||||
{
|
||||
if (dir.Length() < FLT_EPSILON) {
|
||||
|
|
|
@ -37,7 +37,7 @@ class QComboBox;
|
|||
|
||||
namespace Gui {
|
||||
|
||||
class LocationWidget : public QWidget
|
||||
class GuiExport LocationWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -47,6 +47,7 @@ public:
|
|||
QSize sizeHint() const;
|
||||
|
||||
Base::Vector3f getPosition() const;
|
||||
void setPosition(const Base::Vector3f&);
|
||||
void setDirection(const Base::Vector3f& dir);
|
||||
Base::Vector3f getDirection() const;
|
||||
Base::Vector3f getUserDirection(bool* ok=0) const;
|
||||
|
|
|
@ -58,6 +58,7 @@ set(PartGui_UIC_SRCS
|
|||
DlgPartImportIges.ui
|
||||
DlgPartImportStep.ui
|
||||
DlgPrimitives.ui
|
||||
Location.ui
|
||||
DlgRevolution.ui
|
||||
DlgSettings3DViewPart.ui
|
||||
DlgSettingsGeneral.ui
|
||||
|
@ -104,6 +105,7 @@ SET(PartGui_SRCS
|
|||
DlgPrimitives.cpp
|
||||
DlgPrimitives.h
|
||||
DlgPrimitives.ui
|
||||
Location.ui
|
||||
DlgRevolution.cpp
|
||||
DlgRevolution.h
|
||||
DlgRevolution.ui
|
||||
|
|
|
@ -208,16 +208,13 @@ CmdPartPrimitives::CmdPartPrimitives()
|
|||
|
||||
void CmdPartPrimitives::activated(int iMsg)
|
||||
{
|
||||
static QPointer<QDialog> dlg = 0;
|
||||
if (!dlg)
|
||||
dlg = new PartGui::DlgPrimitives(Gui::getMainWindow());
|
||||
dlg->setAttribute(Qt::WA_DeleteOnClose);
|
||||
dlg->show();
|
||||
PartGui::TaskPrimitives* dlg = new PartGui::TaskPrimitives();
|
||||
Gui::Control().showDialog(dlg);
|
||||
}
|
||||
|
||||
bool CmdPartPrimitives::isActive(void)
|
||||
{
|
||||
return hasActiveDocument();
|
||||
return (hasActiveDocument() && !Gui::Control().activeDialog());
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include <Gui/Command.h>
|
||||
#include <Gui/View3DInventor.h>
|
||||
#include <Gui/View3DInventorViewer.h>
|
||||
#include <Gui/TaskView/TaskView.h>
|
||||
#include <Mod/Part/App/Tools.h>
|
||||
|
||||
#include "DlgPrimitives.h"
|
||||
|
@ -48,15 +49,13 @@ using namespace PartGui;
|
|||
|
||||
/* TRANSLATOR PartGui::DlgPrimitives */
|
||||
|
||||
DlgPrimitives::DlgPrimitives(QWidget* parent, Qt::WFlags fl)
|
||||
: Gui::LocationDialogComp<Ui_DlgPrimitives>(parent, fl)
|
||||
DlgPrimitives::DlgPrimitives(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "from FreeCAD import Base");
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "import Part,PartGui");
|
||||
|
||||
connect(ui.viewPositionButton, SIGNAL(clicked()),
|
||||
this, SLOT(on_viewPositionButton_clicked()));
|
||||
|
||||
// set limits
|
||||
//
|
||||
// plane
|
||||
|
@ -135,6 +134,247 @@ DlgPrimitives::DlgPrimitives(QWidget* parent, Qt::WFlags fl)
|
|||
*/
|
||||
DlgPrimitives::~DlgPrimitives()
|
||||
{
|
||||
}
|
||||
|
||||
void DlgPrimitives::createPrimitive(const QString& placement)
|
||||
{
|
||||
try {
|
||||
QString cmd; QString name;
|
||||
App::Document* doc = App::GetApplication().getActiveDocument();
|
||||
if (!doc) {
|
||||
QMessageBox::warning(this, tr("Create %1")
|
||||
.arg(ui.comboBox1->currentText()), tr("No active document"));
|
||||
return;
|
||||
}
|
||||
if (ui.comboBox1->currentIndex() == 0) { // plane
|
||||
name = QString::fromAscii(doc->getUniqueObjectName("Plane").c_str());
|
||||
cmd = QString::fromAscii(
|
||||
"App.ActiveDocument.addObject(\"Part::Plane\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Length=%2\n"
|
||||
"App.ActiveDocument.%1.Width=%3\n"
|
||||
"App.ActiveDocument.%1.Placement=%4\n")
|
||||
.arg(name)
|
||||
.arg(ui.planeLength->value(),0,'f',2)
|
||||
.arg(ui.planeWidth->value(),0,'f',2)
|
||||
.arg(placement);
|
||||
}
|
||||
else if (ui.comboBox1->currentIndex() == 1) { // box
|
||||
name = QString::fromAscii(doc->getUniqueObjectName("Box").c_str());
|
||||
cmd = QString::fromAscii(
|
||||
"App.ActiveDocument.addObject(\"Part::Box\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Length=%2\n"
|
||||
"App.ActiveDocument.%1.Width=%3\n"
|
||||
"App.ActiveDocument.%1.Height=%4\n"
|
||||
"App.ActiveDocument.%1.Placement=%5\n")
|
||||
.arg(name)
|
||||
.arg(ui.boxLength->value(),0,'f',2)
|
||||
.arg(ui.boxWidth->value(),0,'f',2)
|
||||
.arg(ui.boxHeight->value(),0,'f',2)
|
||||
.arg(placement);
|
||||
}
|
||||
else if (ui.comboBox1->currentIndex() == 2) { // cylinder
|
||||
name = QString::fromAscii(doc->getUniqueObjectName("Cylinder").c_str());
|
||||
cmd = QString::fromAscii(
|
||||
"App.ActiveDocument.addObject(\"Part::Cylinder\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Radius=%2\n"
|
||||
"App.ActiveDocument.%1.Height=%3\n"
|
||||
"App.ActiveDocument.%1.Angle=%4\n"
|
||||
"App.ActiveDocument.%1.Placement=%5\n")
|
||||
.arg(name)
|
||||
.arg(ui.cylinderRadius->value(),0,'f',2)
|
||||
.arg(ui.cylinderHeight->value(),0,'f',2)
|
||||
.arg(ui.cylinderAngle->value(),0,'f',2)
|
||||
.arg(placement);
|
||||
}
|
||||
else if (ui.comboBox1->currentIndex() == 3) { // cone
|
||||
name = QString::fromAscii(doc->getUniqueObjectName("Cone").c_str());
|
||||
cmd = QString::fromAscii(
|
||||
"App.ActiveDocument.addObject(\"Part::Cone\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Radius1=%2\n"
|
||||
"App.ActiveDocument.%1.Radius2=%3\n"
|
||||
"App.ActiveDocument.%1.Height=%4\n"
|
||||
"App.ActiveDocument.%1.Angle=%5\n"
|
||||
"App.ActiveDocument.%1.Placement=%6\n")
|
||||
.arg(name)
|
||||
.arg(ui.coneRadius1->value(),0,'f',2)
|
||||
.arg(ui.coneRadius2->value(),0,'f',2)
|
||||
.arg(ui.coneHeight->value(),0,'f',2)
|
||||
.arg(ui.coneAngle->value(),0,'f',2)
|
||||
.arg(placement);
|
||||
}
|
||||
else if (ui.comboBox1->currentIndex() == 4) { // sphere
|
||||
name = QString::fromAscii(doc->getUniqueObjectName("Sphere").c_str());
|
||||
cmd = QString::fromAscii(
|
||||
"App.ActiveDocument.addObject(\"Part::Sphere\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Radius=%2\n"
|
||||
"App.ActiveDocument.%1.Angle1=%3\n"
|
||||
"App.ActiveDocument.%1.Angle2=%4\n"
|
||||
"App.ActiveDocument.%1.Angle3=%5\n"
|
||||
"App.ActiveDocument.%1.Placement=%6\n")
|
||||
.arg(name)
|
||||
.arg(ui.sphereRadius->value(),0,'f',2)
|
||||
.arg(ui.sphereAngle1->value(),0,'f',2)
|
||||
.arg(ui.sphereAngle2->value(),0,'f',2)
|
||||
.arg(ui.sphereAngle3->value(),0,'f',2)
|
||||
.arg(placement);
|
||||
}
|
||||
else if (ui.comboBox1->currentIndex() == 5) { // ellipsoid
|
||||
name = QString::fromAscii(doc->getUniqueObjectName("Ellipsoid").c_str());
|
||||
cmd = QString::fromAscii(
|
||||
"App.ActiveDocument.addObject(\"Part::Ellipsoid\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Radius1=%2\n"
|
||||
"App.ActiveDocument.%1.Radius2=%3\n"
|
||||
"App.ActiveDocument.%1.Angle1=%4\n"
|
||||
"App.ActiveDocument.%1.Angle2=%5\n"
|
||||
"App.ActiveDocument.%1.Angle3=%6\n"
|
||||
"App.ActiveDocument.%1.Placement=%7\n")
|
||||
.arg(name)
|
||||
.arg(ui.ellipsoidRadius1->value(),0,'f',2)
|
||||
.arg(ui.ellipsoidRadius2->value(),0,'f',2)
|
||||
.arg(ui.ellipsoidAngle1->value(),0,'f',2)
|
||||
.arg(ui.ellipsoidAngle2->value(),0,'f',2)
|
||||
.arg(ui.ellipsoidAngle3->value(),0,'f',2)
|
||||
.arg(placement);
|
||||
}
|
||||
else if (ui.comboBox1->currentIndex() == 6) { // torus
|
||||
name = QString::fromAscii(doc->getUniqueObjectName("Torus").c_str());
|
||||
cmd = QString::fromAscii(
|
||||
"App.ActiveDocument.addObject(\"Part::Torus\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Radius1=%2\n"
|
||||
"App.ActiveDocument.%1.Radius2=%3\n"
|
||||
"App.ActiveDocument.%1.Angle1=%4\n"
|
||||
"App.ActiveDocument.%1.Angle2=%5\n"
|
||||
"App.ActiveDocument.%1.Angle3=%6\n"
|
||||
"App.ActiveDocument.%1.Placement=%7\n")
|
||||
.arg(name)
|
||||
.arg(ui.torusRadius1->value(),0,'f',2)
|
||||
.arg(ui.torusRadius2->value(),0,'f',2)
|
||||
.arg(ui.torusAngle1->value(),0,'f',2)
|
||||
.arg(ui.torusAngle2->value(),0,'f',2)
|
||||
.arg(ui.torusAngle3->value(),0,'f',2)
|
||||
.arg(placement);
|
||||
}
|
||||
else if (ui.comboBox1->currentIndex() == 7) { // wedge
|
||||
name = QString::fromAscii(doc->getUniqueObjectName("Wedge").c_str());
|
||||
cmd = QString::fromAscii(
|
||||
"App.ActiveDocument.addObject(\"Part::Wedge\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Xmin=%2\n"
|
||||
"App.ActiveDocument.%1.Ymin=%3\n"
|
||||
"App.ActiveDocument.%1.Zmin=%4\n"
|
||||
"App.ActiveDocument.%1.X2min=%5\n"
|
||||
"App.ActiveDocument.%1.Z2min=%6\n"
|
||||
"App.ActiveDocument.%1.Xmax=%7\n"
|
||||
"App.ActiveDocument.%1.Ymax=%8\n"
|
||||
"App.ActiveDocument.%1.Zmax=%9\n"
|
||||
"App.ActiveDocument.%1.X2max=%10\n"
|
||||
"App.ActiveDocument.%1.Z2max=%11\n"
|
||||
"App.ActiveDocument.%1.Placement=%12\n")
|
||||
.arg(name)
|
||||
.arg(ui.wedgeXmin->value(),0,'f',2)
|
||||
.arg(ui.wedgeYmin->value(),0,'f',2)
|
||||
.arg(ui.wedgeZmin->value(),0,'f',2)
|
||||
.arg(ui.wedgeX2min->value(),0,'f',2)
|
||||
.arg(ui.wedgeZ2min->value(),0,'f',2)
|
||||
.arg(ui.wedgeXmax->value(),0,'f',2)
|
||||
.arg(ui.wedgeYmax->value(),0,'f',2)
|
||||
.arg(ui.wedgeZmax->value(),0,'f',2)
|
||||
.arg(ui.wedgeX2max->value(),0,'f',2)
|
||||
.arg(ui.wedgeZ2max->value(),0,'f',2)
|
||||
.arg(placement);
|
||||
}
|
||||
else if (ui.comboBox1->currentIndex() == 8) { // helix
|
||||
name = QString::fromAscii(doc->getUniqueObjectName("Helix").c_str());
|
||||
cmd = QString::fromAscii(
|
||||
"App.ActiveDocument.addObject(\"Part::Helix\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Pitch=%2\n"
|
||||
"App.ActiveDocument.%1.Height=%3\n"
|
||||
"App.ActiveDocument.%1.Radius=%4\n"
|
||||
"App.ActiveDocument.%1.Angle=%5\n"
|
||||
"App.ActiveDocument.%1.Placement=%6\n")
|
||||
.arg(name)
|
||||
.arg(ui.helixPitch->value(),0,'f',2)
|
||||
.arg(ui.helixHeight->value(),0,'f',2)
|
||||
.arg(ui.helixRadius->value(),0,'f',2)
|
||||
.arg(ui.helixAngle->value(),0,'f',2)
|
||||
.arg(placement);
|
||||
}
|
||||
else if (ui.comboBox1->currentIndex() == 9) { // circle
|
||||
name = QString::fromAscii(doc->getUniqueObjectName("Circle").c_str());
|
||||
cmd = QString::fromAscii(
|
||||
"App.ActiveDocument.addObject(\"Part::Circle\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Radius=%2\n"
|
||||
"App.ActiveDocument.%1.Angle0=%3\n"
|
||||
"App.ActiveDocument.%1.Angle1=%4\n"
|
||||
"App.ActiveDocument.%1.Placement=%5\n")
|
||||
.arg(name)
|
||||
.arg(ui.circleRadius->value(),0,'f',2)
|
||||
.arg(ui.circleAngle0->value(),0,'f',2)
|
||||
.arg(ui.circleAngle1->value(),0,'f',2)
|
||||
.arg(placement);
|
||||
}
|
||||
else if (ui.comboBox1->currentIndex() == 10) { // vertex
|
||||
name = QString::fromAscii(doc->getUniqueObjectName("Vertex").c_str());
|
||||
cmd = QString::fromAscii(
|
||||
"App.ActiveDocument.addObject(\"Part::Vertex\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.X=%2\n"
|
||||
"App.ActiveDocument.%1.Y=%3\n"
|
||||
"App.ActiveDocument.%1.Z=%4\n"
|
||||
"App.ActiveDocument.%1.Placement=%5\n")
|
||||
.arg(name)
|
||||
.arg(ui.vertexX->value(),0,'f',2)
|
||||
.arg(ui.vertexY->value(),0,'f',2)
|
||||
.arg(ui.vertexZ->value(),0,'f',2)
|
||||
.arg(placement);
|
||||
}
|
||||
else if (ui.comboBox1->currentIndex() == 11) { // edge
|
||||
name = QString::fromAscii(doc->getUniqueObjectName("Edge").c_str());
|
||||
cmd = QString::fromAscii(
|
||||
"App.ActiveDocument.addObject(\"Part::Edge\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.X1=%2\n"
|
||||
"App.ActiveDocument.%1.Y1=%3\n"
|
||||
"App.ActiveDocument.%1.Z1=%4\n"
|
||||
"App.ActiveDocument.%1.X2=%5\n"
|
||||
"App.ActiveDocument.%1.Y2=%6\n"
|
||||
"App.ActiveDocument.%1.Z2=%7\n"
|
||||
"App.ActiveDocument.%1.Placement=%8\n")
|
||||
.arg(name)
|
||||
.arg(ui.edgeX1->value(),0,'f',2)
|
||||
.arg(ui.edgeY1->value(),0,'f',2)
|
||||
.arg(ui.edgeZ1->value(),0,'f',2)
|
||||
.arg(ui.edgeX2->value(),0,'f',2)
|
||||
.arg(ui.edgeY2->value(),0,'f',2)
|
||||
.arg(ui.edgeZ2->value(),0,'f',2)
|
||||
.arg(placement);
|
||||
}
|
||||
|
||||
// Execute the Python block
|
||||
QString prim = tr("Create %1").arg(ui.comboBox1->currentText());
|
||||
Gui::Application::Instance->activeDocument()->openCommand(prim.toUtf8());
|
||||
Gui::Command::doCommand(Gui::Command::Doc, (const char*)cmd.toAscii());
|
||||
Gui::Application::Instance->activeDocument()->commitCommand();
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()");
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "Gui.SendMsgToActiveView(\"ViewFit\")");
|
||||
}
|
||||
catch (const Base::PyException& e) {
|
||||
QMessageBox::warning(this, tr("Create %1")
|
||||
.arg(ui.comboBox1->currentText()), QString::fromLatin1(e.what()));
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
|
||||
/* TRANSLATOR PartGui::Location */
|
||||
|
||||
Location::Location(QWidget* parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
|
||||
connect(ui.viewPositionButton, SIGNAL(clicked()),
|
||||
this, SLOT(on_viewPositionButton_clicked()));
|
||||
}
|
||||
|
||||
Location::~Location()
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
if (!this->activeView.isNull()) {
|
||||
Gui::View3DInventorViewer* viewer = static_cast<Gui::View3DInventor*>
|
||||
|
@ -143,11 +383,60 @@ DlgPrimitives::~DlgPrimitives()
|
|||
viewer->setRedirectToSceneGraph(false);
|
||||
viewer->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), pickCallback,this);
|
||||
}
|
||||
}
|
||||
|
||||
void Location::on_viewPositionButton_clicked()
|
||||
{
|
||||
Gui::Document* doc = Gui::Application::Instance->activeDocument();
|
||||
if (!doc) {
|
||||
return;
|
||||
}
|
||||
|
||||
Gui::View3DInventor* view = static_cast<Gui::View3DInventor*>(doc->getActiveView());
|
||||
if (view && !this->activeView) {
|
||||
Gui::View3DInventorViewer* viewer = view->getViewer();
|
||||
if (!viewer->isEditing()) {
|
||||
this->activeView = view;
|
||||
viewer->setEditing(true);
|
||||
viewer->setRedirectToSceneGraph(true);
|
||||
viewer->addEventCallback(SoMouseButtonEvent::getClassTypeId(), pickCallback, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString DlgPrimitives::toPlacement() const
|
||||
void Location::pickCallback(void * ud, SoEventCallback * n)
|
||||
{
|
||||
Base::Vector3f d = ui.getDirection();
|
||||
const SoMouseButtonEvent * mbe = static_cast<const SoMouseButtonEvent*>(n->getEvent());
|
||||
Gui::View3DInventorViewer* view = reinterpret_cast<Gui::View3DInventorViewer*>(n->getUserData());
|
||||
|
||||
// Mark all incoming mouse button events as handled, especially, to deactivate the selection node
|
||||
n->getAction()->setHandled();
|
||||
if (mbe->getButton() == SoMouseButtonEvent::BUTTON1) {
|
||||
if (mbe->getState() == SoButtonEvent::UP) {
|
||||
n->setHandled();
|
||||
view->setEditing(false);
|
||||
view->setRedirectToSceneGraph(false);
|
||||
Location* dlg = reinterpret_cast<Location*>(ud);
|
||||
dlg->activeView = 0;
|
||||
view->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), pickCallback,ud);
|
||||
}
|
||||
else if (mbe->getState() == SoButtonEvent::DOWN) {
|
||||
const SoPickedPoint * point = n->getPickedPoint();
|
||||
if (point) {
|
||||
SbVec3f pnt = point->getPoint();
|
||||
SbVec3f nor = point->getNormal();
|
||||
Location* dlg = reinterpret_cast<Location*>(ud);
|
||||
dlg->ui.loc->setPosition(Base::Vector3f(pnt[0],pnt[1],pnt[2]));
|
||||
dlg->ui.loc->setDirection(Base::Vector3f(nor[0],nor[1],nor[2]));
|
||||
n->setHandled();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString Location::toPlacement() const
|
||||
{
|
||||
Base::Vector3f d = ui.loc->getDirection();
|
||||
gp_Dir dir = gp_Dir(d.x,d.y,d.z);
|
||||
gp_Pnt pnt = gp_Pnt(0.0,0.0,0.0);
|
||||
gp_Ax3 ax3;
|
||||
|
@ -190,293 +479,62 @@ QString DlgPrimitives::toPlacement() const
|
|||
Trf.GetRotation(theAxis,theAngle);
|
||||
|
||||
Base::Rotation rot(Base::convertTo<Base::Vector3d>(theAxis), theAngle);
|
||||
Base::Vector3f loc = ui.loc->getPosition();
|
||||
|
||||
return QString::fromAscii("Base.Placement(Base.Vector(%1,%2,%3),Base.Rotation(%4,%5,%6,%7))")
|
||||
.arg(ui.xPos->value(),0,'f',2)
|
||||
.arg(ui.yPos->value(),0,'f',2)
|
||||
.arg(ui.zPos->value(),0,'f',2)
|
||||
.arg(loc.x,0,'f',2)
|
||||
.arg(loc.y,0,'f',2)
|
||||
.arg(loc.z,0,'f',2)
|
||||
.arg(rot[0],0,'f',2)
|
||||
.arg(rot[1],0,'f',2)
|
||||
.arg(rot[2],0,'f',2)
|
||||
.arg(rot[3],0,'f',2);
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
|
||||
/* TRANSLATOR PartGui::TaskPrimitives */
|
||||
|
||||
TaskPrimitives::TaskPrimitives()
|
||||
{
|
||||
Gui::TaskView::TaskBox* taskbox;
|
||||
widget = new DlgPrimitives();
|
||||
taskbox = new Gui::TaskView::TaskBox(QPixmap(), widget->windowTitle(),true, 0);
|
||||
taskbox->groupLayout()->addWidget(widget);
|
||||
Content.push_back(taskbox);
|
||||
|
||||
location = new Location();
|
||||
taskbox = new Gui::TaskView::TaskBox(QPixmap(), location->windowTitle(),true, 0);
|
||||
taskbox->groupLayout()->addWidget(location);
|
||||
Content.push_back(taskbox);
|
||||
}
|
||||
|
||||
TaskPrimitives::~TaskPrimitives()
|
||||
{
|
||||
// automatically deleted in the sub-class
|
||||
}
|
||||
|
||||
QDialogButtonBox::StandardButtons TaskPrimitives::getStandardButtons() const
|
||||
{
|
||||
return QDialogButtonBox::Close|
|
||||
QDialogButtonBox::Ok;
|
||||
}
|
||||
|
||||
void DlgPrimitives::pickCallback(void * ud, SoEventCallback * n)
|
||||
void TaskPrimitives::modifyStandardButtons(QDialogButtonBox* box)
|
||||
{
|
||||
const SoMouseButtonEvent * mbe = static_cast<const SoMouseButtonEvent*>(n->getEvent());
|
||||
Gui::View3DInventorViewer* view = reinterpret_cast<Gui::View3DInventorViewer*>(n->getUserData());
|
||||
|
||||
// Mark all incoming mouse button events as handled, especially, to deactivate the selection node
|
||||
n->getAction()->setHandled();
|
||||
if (mbe->getButton() == SoMouseButtonEvent::BUTTON1) {
|
||||
if (mbe->getState() == SoButtonEvent::UP) {
|
||||
n->setHandled();
|
||||
view->setEditing(false);
|
||||
view->setRedirectToSceneGraph(false);
|
||||
DlgPrimitives* dlg = reinterpret_cast<DlgPrimitives*>(ud);
|
||||
dlg->activeView = 0;
|
||||
view->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), pickCallback,ud);
|
||||
}
|
||||
else if (mbe->getState() == SoButtonEvent::DOWN) {
|
||||
const SoPickedPoint * point = n->getPickedPoint();
|
||||
if (point) {
|
||||
SbVec3f pnt = point->getPoint();
|
||||
SbVec3f nor = point->getNormal();
|
||||
DlgPrimitives* dlg = reinterpret_cast<DlgPrimitives*>(ud);
|
||||
dlg->ui.xPos->setValue(pnt[0]);
|
||||
dlg->ui.yPos->setValue(pnt[1]);
|
||||
dlg->ui.zPos->setValue(pnt[2]);
|
||||
dlg->ui.setDirection(Base::Vector3f(nor[0],nor[1],nor[2]));
|
||||
n->setHandled();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DlgPrimitives::on_viewPositionButton_clicked()
|
||||
{
|
||||
Gui::Document* doc = Gui::Application::Instance->activeDocument();
|
||||
if (!doc) {
|
||||
QMessageBox::warning(this, tr("Create %1")
|
||||
.arg(ui.comboBox1->currentText()), tr("No active document"));
|
||||
return;
|
||||
}
|
||||
|
||||
Gui::View3DInventor* view = static_cast<Gui::View3DInventor*>(doc->getActiveView());
|
||||
if (view && !this->activeView) {
|
||||
Gui::View3DInventorViewer* viewer = view->getViewer();
|
||||
if (!viewer->isEditing()) {
|
||||
this->activeView = view;
|
||||
viewer->setEditing(true);
|
||||
viewer->setRedirectToSceneGraph(true);
|
||||
viewer->addEventCallback(SoMouseButtonEvent::getClassTypeId(), pickCallback, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DlgPrimitives::accept()
|
||||
{
|
||||
try {
|
||||
QString cmd; QString name;
|
||||
App::Document* doc = App::GetApplication().getActiveDocument();
|
||||
if (!doc) {
|
||||
QMessageBox::warning(this, tr("Create %1")
|
||||
.arg(ui.comboBox1->currentText()), tr("No active document"));
|
||||
return;
|
||||
}
|
||||
if (ui.comboBox1->currentIndex() == 0) { // plane
|
||||
name = QString::fromAscii(doc->getUniqueObjectName("Plane").c_str());
|
||||
cmd = QString::fromAscii(
|
||||
"App.ActiveDocument.addObject(\"Part::Plane\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Length=%2\n"
|
||||
"App.ActiveDocument.%1.Width=%3\n"
|
||||
"App.ActiveDocument.%1.Placement=%4\n")
|
||||
.arg(name)
|
||||
.arg(ui.planeLength->value(),0,'f',2)
|
||||
.arg(ui.planeWidth->value(),0,'f',2)
|
||||
.arg(this->toPlacement());
|
||||
}
|
||||
else if (ui.comboBox1->currentIndex() == 1) { // box
|
||||
name = QString::fromAscii(doc->getUniqueObjectName("Box").c_str());
|
||||
cmd = QString::fromAscii(
|
||||
"App.ActiveDocument.addObject(\"Part::Box\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Length=%2\n"
|
||||
"App.ActiveDocument.%1.Width=%3\n"
|
||||
"App.ActiveDocument.%1.Height=%4\n"
|
||||
"App.ActiveDocument.%1.Placement=%5\n")
|
||||
.arg(name)
|
||||
.arg(ui.boxLength->value(),0,'f',2)
|
||||
.arg(ui.boxWidth->value(),0,'f',2)
|
||||
.arg(ui.boxHeight->value(),0,'f',2)
|
||||
.arg(this->toPlacement());
|
||||
}
|
||||
else if (ui.comboBox1->currentIndex() == 2) { // cylinder
|
||||
name = QString::fromAscii(doc->getUniqueObjectName("Cylinder").c_str());
|
||||
cmd = QString::fromAscii(
|
||||
"App.ActiveDocument.addObject(\"Part::Cylinder\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Radius=%2\n"
|
||||
"App.ActiveDocument.%1.Height=%3\n"
|
||||
"App.ActiveDocument.%1.Angle=%4\n"
|
||||
"App.ActiveDocument.%1.Placement=%5\n")
|
||||
.arg(name)
|
||||
.arg(ui.cylinderRadius->value(),0,'f',2)
|
||||
.arg(ui.cylinderHeight->value(),0,'f',2)
|
||||
.arg(ui.cylinderAngle->value(),0,'f',2)
|
||||
.arg(this->toPlacement());
|
||||
}
|
||||
else if (ui.comboBox1->currentIndex() == 3) { // cone
|
||||
name = QString::fromAscii(doc->getUniqueObjectName("Cone").c_str());
|
||||
cmd = QString::fromAscii(
|
||||
"App.ActiveDocument.addObject(\"Part::Cone\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Radius1=%2\n"
|
||||
"App.ActiveDocument.%1.Radius2=%3\n"
|
||||
"App.ActiveDocument.%1.Height=%4\n"
|
||||
"App.ActiveDocument.%1.Angle=%5\n"
|
||||
"App.ActiveDocument.%1.Placement=%6\n")
|
||||
.arg(name)
|
||||
.arg(ui.coneRadius1->value(),0,'f',2)
|
||||
.arg(ui.coneRadius2->value(),0,'f',2)
|
||||
.arg(ui.coneHeight->value(),0,'f',2)
|
||||
.arg(ui.coneAngle->value(),0,'f',2)
|
||||
.arg(this->toPlacement());
|
||||
}
|
||||
else if (ui.comboBox1->currentIndex() == 4) { // sphere
|
||||
name = QString::fromAscii(doc->getUniqueObjectName("Sphere").c_str());
|
||||
cmd = QString::fromAscii(
|
||||
"App.ActiveDocument.addObject(\"Part::Sphere\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Radius=%2\n"
|
||||
"App.ActiveDocument.%1.Angle1=%3\n"
|
||||
"App.ActiveDocument.%1.Angle2=%4\n"
|
||||
"App.ActiveDocument.%1.Angle3=%5\n"
|
||||
"App.ActiveDocument.%1.Placement=%6\n")
|
||||
.arg(name)
|
||||
.arg(ui.sphereRadius->value(),0,'f',2)
|
||||
.arg(ui.sphereAngle1->value(),0,'f',2)
|
||||
.arg(ui.sphereAngle2->value(),0,'f',2)
|
||||
.arg(ui.sphereAngle3->value(),0,'f',2)
|
||||
.arg(this->toPlacement());
|
||||
}
|
||||
else if (ui.comboBox1->currentIndex() == 5) { // ellipsoid
|
||||
name = QString::fromAscii(doc->getUniqueObjectName("Ellipsoid").c_str());
|
||||
cmd = QString::fromAscii(
|
||||
"App.ActiveDocument.addObject(\"Part::Ellipsoid\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Radius1=%2\n"
|
||||
"App.ActiveDocument.%1.Radius2=%3\n"
|
||||
"App.ActiveDocument.%1.Angle1=%4\n"
|
||||
"App.ActiveDocument.%1.Angle2=%5\n"
|
||||
"App.ActiveDocument.%1.Angle3=%6\n"
|
||||
"App.ActiveDocument.%1.Placement=%7\n")
|
||||
.arg(name)
|
||||
.arg(ui.ellipsoidRadius1->value(),0,'f',2)
|
||||
.arg(ui.ellipsoidRadius2->value(),0,'f',2)
|
||||
.arg(ui.ellipsoidAngle1->value(),0,'f',2)
|
||||
.arg(ui.ellipsoidAngle2->value(),0,'f',2)
|
||||
.arg(ui.ellipsoidAngle3->value(),0,'f',2)
|
||||
.arg(this->toPlacement());
|
||||
}
|
||||
else if (ui.comboBox1->currentIndex() == 6) { // torus
|
||||
name = QString::fromAscii(doc->getUniqueObjectName("Torus").c_str());
|
||||
cmd = QString::fromAscii(
|
||||
"App.ActiveDocument.addObject(\"Part::Torus\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Radius1=%2\n"
|
||||
"App.ActiveDocument.%1.Radius2=%3\n"
|
||||
"App.ActiveDocument.%1.Angle1=%4\n"
|
||||
"App.ActiveDocument.%1.Angle2=%5\n"
|
||||
"App.ActiveDocument.%1.Angle3=%6\n"
|
||||
"App.ActiveDocument.%1.Placement=%7\n")
|
||||
.arg(name)
|
||||
.arg(ui.torusRadius1->value(),0,'f',2)
|
||||
.arg(ui.torusRadius2->value(),0,'f',2)
|
||||
.arg(ui.torusAngle1->value(),0,'f',2)
|
||||
.arg(ui.torusAngle2->value(),0,'f',2)
|
||||
.arg(ui.torusAngle3->value(),0,'f',2)
|
||||
.arg(this->toPlacement());
|
||||
}
|
||||
else if (ui.comboBox1->currentIndex() == 7) { // wedge
|
||||
name = QString::fromAscii(doc->getUniqueObjectName("Wedge").c_str());
|
||||
cmd = QString::fromAscii(
|
||||
"App.ActiveDocument.addObject(\"Part::Wedge\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Xmin=%2\n"
|
||||
"App.ActiveDocument.%1.Ymin=%3\n"
|
||||
"App.ActiveDocument.%1.Zmin=%4\n"
|
||||
"App.ActiveDocument.%1.X2min=%5\n"
|
||||
"App.ActiveDocument.%1.Z2min=%6\n"
|
||||
"App.ActiveDocument.%1.Xmax=%7\n"
|
||||
"App.ActiveDocument.%1.Ymax=%8\n"
|
||||
"App.ActiveDocument.%1.Zmax=%9\n"
|
||||
"App.ActiveDocument.%1.X2max=%10\n"
|
||||
"App.ActiveDocument.%1.Z2max=%11\n"
|
||||
"App.ActiveDocument.%1.Placement=%12\n")
|
||||
.arg(name)
|
||||
.arg(ui.wedgeXmin->value(),0,'f',2)
|
||||
.arg(ui.wedgeYmin->value(),0,'f',2)
|
||||
.arg(ui.wedgeZmin->value(),0,'f',2)
|
||||
.arg(ui.wedgeX2min->value(),0,'f',2)
|
||||
.arg(ui.wedgeZ2min->value(),0,'f',2)
|
||||
.arg(ui.wedgeXmax->value(),0,'f',2)
|
||||
.arg(ui.wedgeYmax->value(),0,'f',2)
|
||||
.arg(ui.wedgeZmax->value(),0,'f',2)
|
||||
.arg(ui.wedgeX2max->value(),0,'f',2)
|
||||
.arg(ui.wedgeZ2max->value(),0,'f',2)
|
||||
.arg(this->toPlacement());
|
||||
}
|
||||
else if (ui.comboBox1->currentIndex() == 8) { // helix
|
||||
name = QString::fromAscii(doc->getUniqueObjectName("Helix").c_str());
|
||||
cmd = QString::fromAscii(
|
||||
"App.ActiveDocument.addObject(\"Part::Helix\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Pitch=%2\n"
|
||||
"App.ActiveDocument.%1.Height=%3\n"
|
||||
"App.ActiveDocument.%1.Radius=%4\n"
|
||||
"App.ActiveDocument.%1.Angle=%5\n"
|
||||
"App.ActiveDocument.%1.Placement=%6\n")
|
||||
.arg(name)
|
||||
.arg(ui.helixPitch->value(),0,'f',2)
|
||||
.arg(ui.helixHeight->value(),0,'f',2)
|
||||
.arg(ui.helixRadius->value(),0,'f',2)
|
||||
.arg(ui.helixAngle->value(),0,'f',2)
|
||||
.arg(this->toPlacement());
|
||||
}
|
||||
else if (ui.comboBox1->currentIndex() == 9) { // circle
|
||||
name = QString::fromAscii(doc->getUniqueObjectName("Circle").c_str());
|
||||
cmd = QString::fromAscii(
|
||||
"App.ActiveDocument.addObject(\"Part::Circle\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Radius=%2\n"
|
||||
"App.ActiveDocument.%1.Angle0=%3\n"
|
||||
"App.ActiveDocument.%1.Angle1=%4\n"
|
||||
"App.ActiveDocument.%1.Placement=%5\n")
|
||||
.arg(name)
|
||||
.arg(ui.circleRadius->value(),0,'f',2)
|
||||
.arg(ui.circleAngle0->value(),0,'f',2)
|
||||
.arg(ui.circleAngle1->value(),0,'f',2)
|
||||
.arg(this->toPlacement());
|
||||
}
|
||||
else if (ui.comboBox1->currentIndex() == 10) { // vertex
|
||||
name = QString::fromAscii(doc->getUniqueObjectName("Vertex").c_str());
|
||||
cmd = QString::fromAscii(
|
||||
"App.ActiveDocument.addObject(\"Part::Vertex\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.X=%2\n"
|
||||
"App.ActiveDocument.%1.Y=%3\n"
|
||||
"App.ActiveDocument.%1.Z=%4\n"
|
||||
"App.ActiveDocument.%1.Placement=%5\n")
|
||||
.arg(name)
|
||||
.arg(ui.vertexX->value(),0,'f',2)
|
||||
.arg(ui.vertexY->value(),0,'f',2)
|
||||
.arg(ui.vertexZ->value(),0,'f',2)
|
||||
.arg(this->toPlacement());
|
||||
}
|
||||
else if (ui.comboBox1->currentIndex() == 11) { // edge
|
||||
name = QString::fromAscii(doc->getUniqueObjectName("Edge").c_str());
|
||||
cmd = QString::fromAscii(
|
||||
"App.ActiveDocument.addObject(\"Part::Edge\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.X1=%2\n"
|
||||
"App.ActiveDocument.%1.Y1=%3\n"
|
||||
"App.ActiveDocument.%1.Z1=%4\n"
|
||||
"App.ActiveDocument.%1.X2=%5\n"
|
||||
"App.ActiveDocument.%1.Y2=%6\n"
|
||||
"App.ActiveDocument.%1.Z2=%7\n"
|
||||
"App.ActiveDocument.%1.Placement=%8\n")
|
||||
.arg(name)
|
||||
.arg(ui.edgeX1->value(),0,'f',2)
|
||||
.arg(ui.edgeY1->value(),0,'f',2)
|
||||
.arg(ui.edgeZ1->value(),0,'f',2)
|
||||
.arg(ui.edgeX2->value(),0,'f',2)
|
||||
.arg(ui.edgeY2->value(),0,'f',2)
|
||||
.arg(ui.edgeZ2->value(),0,'f',2)
|
||||
.arg(this->toPlacement());
|
||||
}
|
||||
|
||||
// Execute the Python block
|
||||
QString prim = tr("Create %1").arg(ui.comboBox1->currentText());
|
||||
Gui::Application::Instance->activeDocument()->openCommand(prim.toUtf8());
|
||||
Gui::Command::doCommand(Gui::Command::Doc, (const char*)cmd.toAscii());
|
||||
Gui::Application::Instance->activeDocument()->commitCommand();
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()");
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "Gui.SendMsgToActiveView(\"ViewFit\")");
|
||||
}
|
||||
catch (const Base::PyException& e) {
|
||||
QMessageBox::warning(this, tr("Create %1")
|
||||
.arg(ui.comboBox1->currentText()), QString::fromLatin1(e.what()));
|
||||
}
|
||||
QPushButton* btn = box->button(QDialogButtonBox::Ok);
|
||||
btn->setText(QApplication::translate("PartGui::DlgPrimitives", "&Create"));
|
||||
}
|
||||
|
||||
bool TaskPrimitives::accept()
|
||||
{
|
||||
widget->createPrimitive(location->toPlacement());
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TaskPrimitives::reject()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
#include "moc_DlgPrimitives.cpp"
|
||||
|
|
|
@ -24,21 +24,34 @@
|
|||
#define PARTGUI_DLGPRIMITIVES_H
|
||||
|
||||
#include <QPointer>
|
||||
#include <Gui/InputVector.h>
|
||||
#include <Gui/TaskView/TaskDialog.h>
|
||||
#include "ui_DlgPrimitives.h"
|
||||
#include "ui_Location.h"
|
||||
|
||||
class SoEventCallback;
|
||||
|
||||
namespace PartGui {
|
||||
|
||||
class DlgPrimitives : public Gui::LocationDialogComp<Ui_DlgPrimitives>
|
||||
class DlgPrimitives : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DlgPrimitives(QWidget* parent = 0, Qt::WFlags fl = 0);
|
||||
DlgPrimitives(QWidget* parent = 0);
|
||||
~DlgPrimitives();
|
||||
void accept();
|
||||
void createPrimitive(const QString&);
|
||||
|
||||
private:
|
||||
Ui_DlgPrimitives ui;
|
||||
};
|
||||
|
||||
class Location : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Location(QWidget* parent = 0);
|
||||
~Location();
|
||||
QString toPlacement() const;
|
||||
|
||||
private Q_SLOTS:
|
||||
|
@ -47,6 +60,27 @@ private Q_SLOTS:
|
|||
private:
|
||||
static void pickCallback(void * ud, SoEventCallback * n);
|
||||
QPointer<QWidget> activeView;
|
||||
Ui_Location ui;
|
||||
};
|
||||
|
||||
class TaskPrimitives : public Gui::TaskView::TaskDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TaskPrimitives();
|
||||
~TaskPrimitives();
|
||||
|
||||
public:
|
||||
bool accept();
|
||||
bool reject();
|
||||
|
||||
QDialogButtonBox::StandardButtons getStandardButtons() const;
|
||||
void modifyStandardButtons(QDialogButtonBox*);
|
||||
|
||||
private:
|
||||
DlgPrimitives* widget;
|
||||
Location* location;
|
||||
};
|
||||
|
||||
} // namespace PartGui
|
||||
|
|
|
@ -1,96 +1,102 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PartGui::DlgPrimitives</class>
|
||||
<widget class="QDialog" name="PartGui::DlgPrimitives">
|
||||
<widget class="QWidget" name="PartGui::DlgPrimitives">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>480</width>
|
||||
<height>341</height>
|
||||
<width>258</width>
|
||||
<height>331</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Geometric Primitives</string>
|
||||
</property>
|
||||
<property name="sizeGripEnabled">
|
||||
<property name="sizeGripEnabled" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<property name="margin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="createSolidButton">
|
||||
<property name="text">
|
||||
<string>&Create</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Alt+C</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonClose">
|
||||
<property name="text">
|
||||
<string>Cl&ose</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Alt+O</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<layout class="QGridLayout" name="gridLayout_7">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox1">
|
||||
<property name="title">
|
||||
<string>Primitive</string>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<property name="margin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="1" column="1">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="comboBox1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maxVisibleItems">
|
||||
<number>14</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Plane</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Box</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Cylinder</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Cone</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Sphere</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Ellipsoid</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Torus</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Wedge</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Helix</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Circle</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Vertex</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Edge</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Parameter</string>
|
||||
|
@ -1464,196 +1470,6 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>221</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="comboBox1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maxVisibleItems">
|
||||
<number>14</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Plane</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Box</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Cylinder</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Cone</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Sphere</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Ellipsoid</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Torus</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Wedge</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Helix</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Circle</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Vertex</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Edge</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Position</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<layout class="QGridLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="zPos">
|
||||
<property name="minimum">
|
||||
<double>-2147480000.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>2147480000.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="TextLabel_Z">
|
||||
<property name="text">
|
||||
<string>Z:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="TextLabel_X">
|
||||
<property name="text">
|
||||
<string>X:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="TextLabel_Direction">
|
||||
<property name="text">
|
||||
<string>Direction:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="xPos">
|
||||
<property name="minimum">
|
||||
<double>-2147480000.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>2147480000.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="TextLabel_Y">
|
||||
<property name="text">
|
||||
<string>Y:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="direction">
|
||||
<property name="currentIndex">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="yPos">
|
||||
<property name="minimum">
|
||||
<double>-2147480000.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>2147480000.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="viewPositionButton">
|
||||
<property name="text">
|
||||
<string>3D View</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -1662,10 +1478,6 @@
|
|||
<layoutdefault spacing="6" margin="11"/>
|
||||
<tabstops>
|
||||
<tabstop>comboBox1</tabstop>
|
||||
<tabstop>xPos</tabstop>
|
||||
<tabstop>yPos</tabstop>
|
||||
<tabstop>zPos</tabstop>
|
||||
<tabstop>direction</tabstop>
|
||||
<tabstop>planeLength</tabstop>
|
||||
<tabstop>planeWidth</tabstop>
|
||||
<tabstop>boxLength</tabstop>
|
||||
|
@ -1692,8 +1504,6 @@
|
|||
<tabstop>torusAngle1</tabstop>
|
||||
<tabstop>torusAngle2</tabstop>
|
||||
<tabstop>torusAngle3</tabstop>
|
||||
<tabstop>createSolidButton</tabstop>
|
||||
<tabstop>buttonClose</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
|
@ -1713,37 +1523,5 @@
|
|||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonClose</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>PartGui::DlgPrimitives</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>254</x>
|
||||
<y>282</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>44</x>
|
||||
<y>268</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>createSolidButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>PartGui::DlgPrimitives</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>160</x>
|
||||
<y>276</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>8</x>
|
||||
<y>277</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
|
81
src/Mod/Part/Gui/Location.ui
Normal file
81
src/Mod/Part/Gui/Location.ui
Normal file
|
@ -0,0 +1,81 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PartGui::Location</class>
|
||||
<widget class="QWidget" name="PartGui::Location">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>209</width>
|
||||
<height>205</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Location</string>
|
||||
</property>
|
||||
<property name="sizeGripEnabled" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Position</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="Gui::LocationWidget" name="loc"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="viewPositionButton">
|
||||
<property name="text">
|
||||
<string>3D View</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Gui::LocationWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>Gui/InputVector.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -12,6 +12,7 @@ BUILT_SOURCES=\
|
|||
ui_DlgPartImportIges.h \
|
||||
ui_DlgPartImportStep.h \
|
||||
ui_DlgPrimitives.h \
|
||||
ui_Location.h \
|
||||
ui_DlgSettings3DViewPart.h \
|
||||
ui_DlgSettingsGeneral.h \
|
||||
ui_Mirroring.h \
|
||||
|
@ -220,6 +221,7 @@ EXTRA_DIST = \
|
|||
DlgPartImportIges.ui \
|
||||
DlgPartImportStep.ui \
|
||||
DlgPrimitives.ui \
|
||||
Location.ui \
|
||||
DlgSettings3DViewPart.ui \
|
||||
DlgSettingsGeneral.ui \
|
||||
Mirroring.ui \
|
||||
|
|
|
@ -115,7 +115,7 @@ LocationWidget::~LocationWidget()
|
|||
|
||||
QSize LocationWidget::sizeHint() const
|
||||
{
|
||||
return QSize(150,190);
|
||||
return QSize(150,100);
|
||||
}
|
||||
|
||||
void LocationWidget::changeEvent(QEvent* e)
|
||||
|
|
Loading…
Reference in New Issue
Block a user