add more constraints and rebuild solver system everytime it needs to be executed

This commit is contained in:
Stefan Tröger
2013-05-13 16:21:19 +02:00
committed by Stefan Tröger
parent f4331f28c9
commit d700fff649
62 changed files with 2071 additions and 423 deletions

View File

@@ -36,6 +36,12 @@
#include "ViewProviderPart.h"
#include "ViewProviderAssembly.h"
#include "ViewProviderConstraintGroup.h"
#include "ViewProviderConstraintFix.h"
#include "ViewProviderConstraintDistance.h"
#include "ViewProviderConstraintAngle.h"
#include "ViewProviderConstraintOrientation.h"
#include "ViewProviderConstraintCoincidence.h"
#include "ViewProviderConstraintAlignment.h"
#include <Mod/Assembly/App/ItemAssembly.h>
@@ -84,6 +90,12 @@ void AssemblyGuiExport initAssemblyGui()
AssemblyGui::ViewProviderItemAssembly::init();
AssemblyGui::ViewProviderConstraintGroup::init();
AssemblyGui::ViewProviderConstraintFix::init();
AssemblyGui::ViewProviderConstraintDistance::init();
AssemblyGui::ViewProviderConstraintAngle::init();
AssemblyGui::ViewProviderConstraintOrientation::init();
AssemblyGui::ViewProviderConstraintCoincidence::init();
AssemblyGui::ViewProviderConstraintAlignment::init();
// add resources and reloads the translators
loadAssemblyResource();

View File

@@ -28,6 +28,10 @@ set(AssemblyGui_LIBS
qt4_add_resources(AssemblyGui_SRCS Resources/Assembly.qrc)
set(AssemblyGui_UIC_SRCS
AlignmentDialog.ui
)
qt4_wrap_ui(AssemblyGui_UIC_HDRS ${AssemblyGui_UIC_SRCS})
SET(AssemblyGuiViewProvider_SRCS
ViewProvider.cpp
@@ -38,14 +42,26 @@ SET(AssemblyGuiViewProvider_SRCS
ViewProviderAssembly.h
ViewProviderConstraintGroup.cpp
ViewProviderConstraintGroup.h
ViewProviderConstraintFix.cpp
ViewProviderConstraintFix.h
ViewProviderConstraintDistance.cpp
ViewProviderConstraintDistance.h
ViewProviderConstraintAngle.cpp
ViewProviderConstraintAngle.h
ViewProviderConstraintOrientation.cpp
ViewProviderConstraintOrientation.h
ViewProviderConstraintCoincidence.cpp
ViewProviderConstraintCoincidence.h
ViewProviderConstraintAlignment.cpp
ViewProviderConstraintAlignment.h
)
SOURCE_GROUP("ViewProvider" FILES ${AssemblyGuiViewProvider_SRCS})
SET(AssemblyGuiModule_SRCS
SET(AssemblyGuiModule_SRCS
AppAssemblyGui.cpp
AppAssemblyGuiPy.cpp
Command.cpp
CommandConstraints.cpp
CommandConstraints.cpp
Resources/Assembly.qrc
qrc_Assembly.cxx
PreCompiled.cpp
@@ -60,6 +76,7 @@ SET(AssemblyGui_SRCS
${AssemblyGui_SRCS}
${AssemblyGuiViewProvider_SRCS}
${AssemblyGuiModule_SRCS}
${AssemblyGui_UIC_HDRS}
)
add_library(AssemblyGui SHARED ${AssemblyGui_SRCS})

View File

@@ -77,7 +77,7 @@ void CmdAssemblyAddNewPart::activated(int iMsg)
doCommand(Doc,"App.activeDocument().addObject('Assembly::ItemPart','%s')",PartName.c_str());
if(dest){
std::string fatherName = dest->getNameInDocument();
doCommand(Doc,"App.activeDocument().%s.addPart(App.activeDocument().%s) ",fatherName.c_str(),PartName.c_str());
doCommand(Doc,"App.activeDocument().%s.Items = App.activeDocument().%s.Items + [App.activeDocument().%s] ",fatherName.c_str(),fatherName.c_str(),PartName.c_str());
}
Command::addModule(App,"PartDesign");
Command::addModule(Gui,"PartDesignGui");
@@ -139,7 +139,7 @@ void CmdAssemblyAddNewComponent::activated(int iMsg)
doCommand(Doc,"App.activeDocument().addObject('Assembly::ItemAssembly','%s')",CompName.c_str());
if(dest){
std::string fatherName = dest->getNameInDocument();
doCommand(Doc,"App.activeDocument().%s.addComponent(App.activeDocument().%s) ",fatherName.c_str(), CompName.c_str());
doCommand(Doc,"App.activeDocument().%s.Items = App.activeDocument().%s.Items + [App.activeDocument().%s] ",fatherName.c_str(),fatherName.c_str(),CompName.c_str());
}
}

View File

@@ -24,6 +24,7 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <QMessageBox>
#include <QInputDialog>
#endif
#include <Gui/Application.h>
@@ -31,6 +32,7 @@
#include <Gui/MainWindow.h>
#include <Gui/FileDialog.h>
#include <Gui/Selection.h>
#include "ui_AlignmentDialog.h"
#include <Mod/Assembly/App/ItemAssembly.h>
#include <Mod/Assembly/App/ConstraintGroup.h>
@@ -97,22 +99,22 @@ std::string asSubLinkString(Assembly::ItemPart* part, std::string element) {
//===========================================================================
DEF_STD_CMD(CmdAssemblyConstraintAxle);
DEF_STD_CMD(CmdAssemblyConstraintDistance);
CmdAssemblyConstraintAxle::CmdAssemblyConstraintAxle()
:Command("Assembly_ConstraintAxle")
CmdAssemblyConstraintDistance::CmdAssemblyConstraintDistance()
:Command("Assembly_ConstraintDistance")
{
sAppModule = "Assembly";
sGroup = QT_TR_NOOP("Assembly");
sMenuText = QT_TR_NOOP("Constraint Axle...");
sToolTipText = QT_TR_NOOP("set a axle constraint between two objects");
sMenuText = QT_TR_NOOP("Constraint Distance...");
sToolTipText = QT_TR_NOOP("Set the distance between two selected entitys");
sWhatsThis = sToolTipText;
sStatusTip = sToolTipText;
sPixmap = "actions/Axle_constraint";
sPixmap = "Assembly_ConstraintDistance";
}
void CmdAssemblyConstraintAxle::activated(int iMsg)
void CmdAssemblyConstraintDistance::activated(int iMsg)
{
Assembly::ItemAssembly *Asm=0;
Assembly::ConstraintGroup *ConstGrp=0;
@@ -133,13 +135,23 @@ void CmdAssemblyConstraintAxle::activated(int iMsg)
Base::Console().Message("The selected objects need to belong to the active assembly\n");
return;
};
bool ok;
double d = QInputDialog::getDouble(NULL, QObject::tr("Constraint value"),
QObject::tr("Distance:"), 0., -10000., 10000., 2, &ok);
if(!ok)
return;
openCommand("Insert Constraint Axle");
std::string ConstrName = getUniqueObjectName("Axle");
doCommand(Doc,"App.activeDocument().addObject('Assembly::ConstraintAxis','%s')",ConstrName.c_str());
openCommand("Insert Constraint Distance");
std::string ConstrName = getUniqueObjectName("Distance");
doCommand(Doc,"App.activeDocument().addObject('Assembly::ConstraintDistance','%s')",ConstrName.c_str());
doCommand(Doc,"App.activeDocument().ActiveObject.First = %s", asSubLinkString(part1, objs[0].getSubNames()[0]).c_str());
doCommand(Doc,"App.activeDocument().ActiveObject.Second = %s", asSubLinkString(part2, objs[1].getSubNames()[0]).c_str());
doCommand(Doc,"App.activeDocument().%s.addConstraint(App.activeDocument().ActiveObject)",ConstGrp->getNameInDocument());
doCommand(Doc,"App.activeDocument().ActiveObject.Distance = %f", d);
doCommand(Doc,"App.activeDocument().%s.Constraints = App.activeDocument().%s.Constraints + [App.activeDocument().ActiveObject]",ConstGrp->getNameInDocument(),ConstGrp->getNameInDocument());
commitCommand();
updateActive();
}
@@ -153,7 +165,7 @@ CmdAssemblyConstraintFix::CmdAssemblyConstraintFix()
sAppModule = "Assembly";
sGroup = QT_TR_NOOP("Assembly");
sMenuText = QT_TR_NOOP("Constraint Fix...");
sToolTipText = QT_TR_NOOP("Fixes a part in it's rotation and translation");
sToolTipText = QT_TR_NOOP("Fix a part in it's rotation and translation");
sWhatsThis = sToolTipText;
sStatusTip = sToolTipText;
sPixmap = "Assembly_ConstraintLock";
@@ -185,7 +197,257 @@ void CmdAssemblyConstraintFix::activated(int iMsg)
std::string ConstrName = getUniqueObjectName("Fix");
doCommand(Doc,"App.activeDocument().addObject('Assembly::ConstraintFix','%s')",ConstrName.c_str());
doCommand(Doc,"App.activeDocument().ActiveObject.First = %s", asSubLinkString(part, objs[0].getSubNames()[0]).c_str());
doCommand(Doc,"App.activeDocument().%s.addConstraint(App.activeDocument().ActiveObject)",ConstGrp->getNameInDocument());
doCommand(Doc,"App.activeDocument().%s.Constraints = App.activeDocument().%s.Constraints + [App.activeDocument().ActiveObject]",ConstGrp->getNameInDocument(),ConstGrp->getNameInDocument());
commitCommand();
updateActive();
}
/******************************************************************************************/
DEF_STD_CMD(CmdAssemblyConstraintAngle);
CmdAssemblyConstraintAngle::CmdAssemblyConstraintAngle()
:Command("Assembly_ConstraintAngle")
{
sAppModule = "Assembly";
sGroup = QT_TR_NOOP("Assembly");
sMenuText = QT_TR_NOOP("Constraint Angle...");
sToolTipText = QT_TR_NOOP("Set the angle between two selected entitys");
sWhatsThis = sToolTipText;
sStatusTip = sToolTipText;
sPixmap = "Assembly_ConstraintAngle";
}
void CmdAssemblyConstraintAngle::activated(int iMsg)
{
Assembly::ItemAssembly *Asm=0;
Assembly::ConstraintGroup *ConstGrp=0;
// retrive the standard objects needed
if(getConstraintPrerequisits(&Asm,&ConstGrp))
return;
std::vector<Gui::SelectionObject> objs = Gui::Selection().getSelectionEx();
if(objs.size() != 2) {
Base::Console().Message("you must select two geometries on two diffrent parts\n");
return;
};
Assembly::ItemPart* part1 = Asm->getContainingPart(objs[0].getObject());
Assembly::ItemPart* part2 = Asm->getContainingPart(objs[1].getObject());
if(!part1 || !part2) {
Base::Console().Message("The selected objects need to belong to the active assembly\n");
return;
};
bool ok;
double d = QInputDialog::getDouble(NULL, QObject::tr("Constraint value"),
QObject::tr("Angle:"), 0., 0., 360., 2, &ok);
if(!ok)
return;
openCommand("Insert Constraint Angle");
std::string ConstrName = getUniqueObjectName("Angle");
doCommand(Doc,"App.activeDocument().addObject('Assembly::ConstraintAngle','%s')",ConstrName.c_str());
doCommand(Doc,"App.activeDocument().ActiveObject.First = %s", asSubLinkString(part1, objs[0].getSubNames()[0]).c_str());
doCommand(Doc,"App.activeDocument().ActiveObject.Second = %s", asSubLinkString(part2, objs[1].getSubNames()[0]).c_str());
doCommand(Doc,"App.activeDocument().ActiveObject.Angle = %f", d);
doCommand(Doc,"App.activeDocument().%s.Constraints = App.activeDocument().%s.Constraints + [App.activeDocument().ActiveObject]",ConstGrp->getNameInDocument(),ConstGrp->getNameInDocument());
commitCommand();
updateActive();
}
/******************************************************************************************/
DEF_STD_CMD(CmdAssemblyConstraintOrientation);
CmdAssemblyConstraintOrientation::CmdAssemblyConstraintOrientation()
:Command("Assembly_ConstraintOrientation")
{
sAppModule = "Assembly";
sGroup = QT_TR_NOOP("Assembly");
sMenuText = QT_TR_NOOP("Constraint Orientation...");
sToolTipText = QT_TR_NOOP("Set the orientation of two selected entitys in regard to each other");
sWhatsThis = sToolTipText;
sStatusTip = sToolTipText;
sPixmap = "Assembly_ConstraintOrientation";
}
void CmdAssemblyConstraintOrientation::activated(int iMsg)
{
Assembly::ItemAssembly *Asm=0;
Assembly::ConstraintGroup *ConstGrp=0;
// retrive the standard objects needed
if(getConstraintPrerequisits(&Asm,&ConstGrp))
return;
std::vector<Gui::SelectionObject> objs = Gui::Selection().getSelectionEx();
if(objs.size() != 2) {
Base::Console().Message("you must select two geometries on two diffrent parts\n");
return;
};
Assembly::ItemPart* part1 = Asm->getContainingPart(objs[0].getObject());
Assembly::ItemPart* part2 = Asm->getContainingPart(objs[1].getObject());
if(!part1 || !part2) {
Base::Console().Message("The selected objects need to belong to the active assembly\n");
return;
};
QStringList items;
items << QObject::tr("Parallel") << QObject::tr("Perpendicular") << QObject::tr("Equal") << QObject::tr("Opposite");
bool ok;
QString item = QInputDialog::getItem(NULL, QObject::tr("Constraint value"),
QObject::tr("Orientation:"), items, 0, false, &ok);
if (!ok || item.isEmpty())
return;
openCommand("Insert Constraint Orientation");
std::string ConstrName = getUniqueObjectName("Orientation");
doCommand(Doc,"App.activeDocument().addObject('Assembly::ConstraintOrientation','%s')",ConstrName.c_str());
doCommand(Doc,"App.activeDocument().ActiveObject.First = %s", asSubLinkString(part1, objs[0].getSubNames()[0]).c_str());
doCommand(Doc,"App.activeDocument().ActiveObject.Second = %s", asSubLinkString(part2, objs[1].getSubNames()[0]).c_str());
doCommand(Doc,"App.activeDocument().ActiveObject.Orientation = '%s'", item.toStdString().c_str());
doCommand(Doc,"App.activeDocument().%s.Constraints = App.activeDocument().%s.Constraints + [App.activeDocument().ActiveObject]",ConstGrp->getNameInDocument(),ConstGrp->getNameInDocument());
commitCommand();
updateActive();
}
/******************************************************************************************/
DEF_STD_CMD(CmdAssemblyConstraintCoincidence);
CmdAssemblyConstraintCoincidence::CmdAssemblyConstraintCoincidence()
:Command("Assembly_ConstraintCoincidence")
{
sAppModule = "Assembly";
sGroup = QT_TR_NOOP("Assembly");
sMenuText = QT_TR_NOOP("Constraint coincidence...");
sToolTipText = QT_TR_NOOP("Make the selected entitys coincident");
sWhatsThis = sToolTipText;
sStatusTip = sToolTipText;
sPixmap = "Assembly_ConstraintCoincidence";
}
void CmdAssemblyConstraintCoincidence::activated(int iMsg)
{
Assembly::ItemAssembly *Asm=0;
Assembly::ConstraintGroup *ConstGrp=0;
// retrive the standard objects needed
if(getConstraintPrerequisits(&Asm,&ConstGrp))
return;
std::vector<Gui::SelectionObject> objs = Gui::Selection().getSelectionEx();
if(objs.size() != 2) {
Base::Console().Message("you must select two geometries on two diffrent parts\n");
return;
};
Assembly::ItemPart* part1 = Asm->getContainingPart(objs[0].getObject());
Assembly::ItemPart* part2 = Asm->getContainingPart(objs[1].getObject());
if(!part1 || !part2) {
Base::Console().Message("The selected objects need to belong to the active assembly\n");
return;
};
QStringList items;
items << QObject::tr("Parallel") << QObject::tr("Equal") << QObject::tr("Opposite");
bool ok;
QString item = QInputDialog::getItem(NULL, QObject::tr("Constraint value"),
QObject::tr("Orientation:"), items, 0, false, &ok);
if (!ok || item.isEmpty())
return;
openCommand("Insert Constraint Coincidence");
std::string ConstrName = getUniqueObjectName("Coincidence");
doCommand(Doc,"App.activeDocument().addObject('Assembly::ConstraintCoincidence','%s')",ConstrName.c_str());
doCommand(Doc,"App.activeDocument().ActiveObject.First = %s", asSubLinkString(part1, objs[0].getSubNames()[0]).c_str());
doCommand(Doc,"App.activeDocument().ActiveObject.Second = %s", asSubLinkString(part2, objs[1].getSubNames()[0]).c_str());
doCommand(Doc,"App.activeDocument().ActiveObject.Orientation = '%s'", item.toStdString().c_str());
doCommand(Doc,"App.activeDocument().%s.Constraints = App.activeDocument().%s.Constraints + [App.activeDocument().ActiveObject]",ConstGrp->getNameInDocument(),ConstGrp->getNameInDocument());
commitCommand();
updateActive();
}
/******************************************************************************************/
DEF_STD_CMD(CmdAssemblyConstraintAlignment);
CmdAssemblyConstraintAlignment::CmdAssemblyConstraintAlignment()
:Command("Assembly_ConstraintAlignment")
{
sAppModule = "Assembly";
sGroup = QT_TR_NOOP("Assembly");
sMenuText = QT_TR_NOOP("Constraint allignment...");
sToolTipText = QT_TR_NOOP("Align the selected entitys");
sWhatsThis = sToolTipText;
sStatusTip = sToolTipText;
sPixmap = "Assembly_ConstraintAlignment";
}
void CmdAssemblyConstraintAlignment::activated(int iMsg)
{
Assembly::ItemAssembly *Asm=0;
Assembly::ConstraintGroup *ConstGrp=0;
// retrive the standard objects needed
if(getConstraintPrerequisits(&Asm,&ConstGrp))
return;
std::vector<Gui::SelectionObject> objs = Gui::Selection().getSelectionEx();
if(objs.size() != 2) {
Base::Console().Message("you must select two geometries on two diffrent parts\n");
return;
};
Assembly::ItemPart* part1 = Asm->getContainingPart(objs[0].getObject());
Assembly::ItemPart* part2 = Asm->getContainingPart(objs[1].getObject());
if(!part1 || !part2) {
Base::Console().Message("The selected objects need to belong to the active assembly\n");
return;
};
QStringList items;
items << QObject::tr("Parallel") << QObject::tr("Equal") << QObject::tr("Opposite");
QDialog dialog;
Ui_AlignmentDialog ui;
ui.setupUi(&dialog);
ui.comboBox->addItems(items);
if( dialog.exec() != QDialog::Accepted )
return;
openCommand("Insert Constraint Alignment");
std::string ConstrName = getUniqueObjectName("Alignment");
doCommand(Doc,"App.activeDocument().addObject('Assembly::ConstraintAlignment','%s')",ConstrName.c_str());
doCommand(Doc,"App.activeDocument().ActiveObject.First = %s", asSubLinkString(part1, objs[0].getSubNames()[0]).c_str());
doCommand(Doc,"App.activeDocument().ActiveObject.Second = %s", asSubLinkString(part2, objs[1].getSubNames()[0]).c_str());
doCommand(Doc,"App.activeDocument().ActiveObject.Orientation = '%s'", ui.comboBox->currentText().toStdString().c_str());
doCommand(Doc,"App.activeDocument().ActiveObject.Offset = %f", ui.doubleSpinBox->value());
doCommand(Doc,"App.activeDocument().%s.Constraints = App.activeDocument().%s.Constraints + [App.activeDocument().ActiveObject]",ConstGrp->getNameInDocument(),ConstGrp->getNameInDocument());
commitCommand();
updateActive();
}
@@ -194,5 +456,9 @@ void CreateAssemblyConstraintCommands(void)
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
rcCmdMgr.addCommand(new CmdAssemblyConstraintFix());
rcCmdMgr.addCommand(new CmdAssemblyConstraintAxle());
rcCmdMgr.addCommand(new CmdAssemblyConstraintDistance());
rcCmdMgr.addCommand(new CmdAssemblyConstraintAngle());
rcCmdMgr.addCommand(new CmdAssemblyConstraintOrientation());
rcCmdMgr.addCommand(new CmdAssemblyConstraintCoincidence());
rcCmdMgr.addCommand(new CmdAssemblyConstraintAlignment());
}

View File

@@ -1,7 +1,11 @@
<RCC>
<qresource>
<file>icons/actions/Axle_constraint.svg</file>
<file>icons/Assembly_ConstraintLock.svg</file>
<file>icons/Assembly_ConstraintDistance.svg</file>
<file>icons/Assembly_ConstraintAngle.svg</file>
<file>icons/Assembly_ConstraintOrientation.svg</file>
<file>icons/Assembly_ConstraintCoincidence.svg</file>
<file>icons/Assembly_ConstraintAlignment.svg</file>
<file>translations/Assembly_af.qm</file>
<file>translations/Assembly_de.qm</file>
<file>translations/Assembly_fi.qm</file>

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -0,0 +1,34 @@
/***************************************************************************
* Copyright (c) 2013 Stefan Tröger <stefantroeger@gmx.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#include "ViewProviderConstraintAlignment.h"
using namespace AssemblyGui;
PROPERTY_SOURCE(AssemblyGui::ViewProviderConstraintAlignment, Gui::ViewProviderDocumentObject)
ViewProviderConstraintAlignment::ViewProviderConstraintAlignment() {
sPixmap = "Assembly_ConstraintAlignment";
}

View File

@@ -0,0 +1,42 @@
/***************************************************************************
* Copyright (c) 2013 Stefan Tröger <stefantroeger@gmx.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef ASSEMBLYGUI_VIEWPROVIDERCONSTRAINTAlignment_H
#define ASSEMBLYGUI_VIEWPROVIDERCONSTRAINTAlignment_H
#include <Gui/ViewProviderDocumentObject.h>
namespace AssemblyGui {
class AssemblyGuiExport ViewProviderConstraintAlignment : public Gui::ViewProviderDocumentObject {
PROPERTY_HEADER(AssemblyGui::ViewProviderConstraintAlignment);
public:
ViewProviderConstraintAlignment();
};
};
#endif // VIEWPROVIDERCONSTRAINTFIX_H

View File

@@ -0,0 +1,34 @@
/***************************************************************************
* Copyright (c) 2013 Stefan Tröger <stefantroeger@gmx.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#include "ViewProviderConstraintAngle.h"
using namespace AssemblyGui;
PROPERTY_SOURCE(AssemblyGui::ViewProviderConstraintAngle, Gui::ViewProviderDocumentObject)
ViewProviderConstraintAngle::ViewProviderConstraintAngle() {
sPixmap = "Assembly_ConstraintAngle";
}

View File

@@ -0,0 +1,42 @@
/***************************************************************************
* Copyright (c) 2013 Stefan Tröger <stefantroeger@gmx.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef ASSEMBLYGUI_VIEWPROVIDERCONSTRAINTANGLE_H
#define ASSEMBLYGUI_VIEWPROVIDERCONSTRAINTANGLE_H
#include <Gui/ViewProviderDocumentObject.h>
namespace AssemblyGui {
class AssemblyGuiExport ViewProviderConstraintAngle : public Gui::ViewProviderDocumentObject {
PROPERTY_HEADER(AssemblyGui::ViewProviderConstraintAngle);
public:
ViewProviderConstraintAngle();
};
};
#endif // VIEWPROVIDERCONSTRAINTFIX_H

View File

@@ -0,0 +1,34 @@
/***************************************************************************
* Copyright (c) 2013 Stefan Tröger <stefantroeger@gmx.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#include "ViewProviderConstraintCoincidence.h"
using namespace AssemblyGui;
PROPERTY_SOURCE(AssemblyGui::ViewProviderConstraintCoincidence, Gui::ViewProviderDocumentObject)
ViewProviderConstraintCoincidence::ViewProviderConstraintCoincidence() {
sPixmap = "Assembly_ConstraintCoincidence";
}

View File

@@ -0,0 +1,42 @@
/***************************************************************************
* Copyright (c) 2013 Stefan Tröger <stefantroeger@gmx.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef ASSEMBLYGUI_VIEWPROVIDERCONSTRAINTCoincidence_H
#define ASSEMBLYGUI_VIEWPROVIDERCONSTRAINTCoincidence_H
#include <Gui/ViewProviderDocumentObject.h>
namespace AssemblyGui {
class AssemblyGuiExport ViewProviderConstraintCoincidence : public Gui::ViewProviderDocumentObject {
PROPERTY_HEADER(AssemblyGui::ViewProviderConstraintCoincidence);
public:
ViewProviderConstraintCoincidence();
};
};
#endif // VIEWPROVIDERCONSTRAINTFIX_H

View File

@@ -0,0 +1,34 @@
/***************************************************************************
* Copyright (c) 2013 Stefan Tröger <stefantroeger@gmx.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#include "ViewProviderConstraintDistance.h"
using namespace AssemblyGui;
PROPERTY_SOURCE(AssemblyGui::ViewProviderConstraintDistance, Gui::ViewProviderDocumentObject)
ViewProviderConstraintDistance::ViewProviderConstraintDistance() {
sPixmap = "Assembly_ConstraintDistance";
}

View File

@@ -0,0 +1,42 @@
/***************************************************************************
* Copyright (c) 2013 Stefan Tröger <stefantroeger@gmx.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef ASSEMBLYGUI_VIEWPROVIDERCONSTRAINTDISTANCE_H
#define ASSEMBLYGUI_VIEWPROVIDERCONSTRAINTDISTANCE_H
#include <Gui/ViewProviderDocumentObject.h>
namespace AssemblyGui {
class AssemblyGuiExport ViewProviderConstraintDistance : public Gui::ViewProviderDocumentObject {
PROPERTY_HEADER(AssemblyGui::ViewProviderConstraintDistance);
public:
ViewProviderConstraintDistance();
};
};
#endif // VIEWPROVIDERCONSTRAINTFIX_H

View File

@@ -65,7 +65,7 @@ void ViewProviderConstraintGroup::setDisplayMode(const char* ModeName)
if ( strcmp("Main",ModeName)==0 )
setDisplayMaskMode("Main");
// ViewProviderDocumentObject::setDisplayMode( ModeName );
ViewProviderDocumentObject::setDisplayMode( ModeName );
}
std::vector<std::string> ViewProviderConstraintGroup::getDisplayModes(void) const
@@ -74,7 +74,7 @@ std::vector<std::string> ViewProviderConstraintGroup::getDisplayModes(void) cons
std::vector<std::string> StrList = ViewProviderDocumentObject::getDisplayModes();
// add your own modes
// StrList.push_back("Main");
StrList.push_back("Main");
return StrList;
}

View File

@@ -0,0 +1,34 @@
/***************************************************************************
* Copyright (c) 2013 Stefan Tröger <stefantroeger@gmx.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#include "ViewProviderConstraintOrientation.h"
using namespace AssemblyGui;
PROPERTY_SOURCE(AssemblyGui::ViewProviderConstraintOrientation, Gui::ViewProviderDocumentObject)
ViewProviderConstraintOrientation::ViewProviderConstraintOrientation() {
sPixmap = "Assembly_ConstraintOrientation";
}

View File

@@ -0,0 +1,42 @@
/***************************************************************************
* Copyright (c) 2013 Stefan Tröger <stefantroeger@gmx.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef ASSEMBLYGUI_VIEWPROVIDERCONSTRAINTORIENTATION_H
#define ASSEMBLYGUI_VIEWPROVIDERCONSTRAINTORIENTATION_H
#include <Gui/ViewProviderDocumentObject.h>
namespace AssemblyGui {
class AssemblyGuiExport ViewProviderConstraintOrientation : public Gui::ViewProviderDocumentObject {
PROPERTY_HEADER(AssemblyGui::ViewProviderConstraintOrientation);
public:
ViewProviderConstraintOrientation();
};
};
#endif // VIEWPROVIDERCONSTRAINTFIX_H

View File

@@ -52,8 +52,12 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
Gui::ToolBarItem* root = StdWorkbench::setupToolBars();
Gui::ToolBarItem* part = new Gui::ToolBarItem(root);
part->setCommand(QT_TR_NOOP("Assembly"));
//*part << "Assembly_ConstraintFix";
*part << "Assembly_ConstraintAxle";
*part << "Assembly_ConstraintFix";
*part << "Assembly_ConstraintDistance";
*part << "Assembly_ConstraintOrientation";
*part << "Assembly_ConstraintAngle";
*part << "Assembly_ConstraintCoincidence";
*part << "Assembly_ConstraintAlignment";
*part << "Separator";
*part << "Assembly_AddNewPart";
*part << "Assembly_AddNewComponent";
@@ -70,7 +74,12 @@ Gui::MenuItem* Workbench::setupMenuBar() const
Gui::MenuItem* asmCmd = new Gui::MenuItem();
root->insertItem(item, asmCmd);
asmCmd->setCommand("&Assembly");
*asmCmd << "Assembly_ConstraintAxle"
*asmCmd << "Assembly_ConstraintFix"
<< "Assembly_ConstraintDistance"
<< "Assembly_ConstraintOrientation"
<< "Assembly_ConstraintAngle"
<< "Assembly_ConstraintCoincidence"
<< "Assembly_ConstraintAlignment"
<< "Separator"
<< "Assembly_AddNewPart"
<< "Assembly_AddNewComponent"