diff --git a/src/Mod/Assembly/App/CMakeLists.txt b/src/Mod/Assembly/App/CMakeLists.txt
index 2c44c9c2f5..5a67cc0284 100644
--- a/src/Mod/Assembly/App/CMakeLists.txt
+++ b/src/Mod/Assembly/App/CMakeLists.txt
@@ -4,10 +4,6 @@ else(MSVC)
add_definitions(-DHAVE_LIMITS_H -DHAVE_CONFIG_H)
endif(MSVC)
-if (CMAKE_BUILD_TYPE STREQUAL "Debug")
- add_definitions( -DUSE_LOGGING )
-endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
-
include_directories(
${CMAKE_SOURCE_DIR}/src
${CMAKE_BINARY_DIR}/src
@@ -28,11 +24,6 @@ set(Assembly_LIBS
${OCC_LIBRARIES}
Part
FreeCADApp
- boost_log
- rt
- ${Boost_SYSTEM_LIBRARY}
- ${Boost_FILESYSTEM_LIBRARY}
- ${Boost_THREAD_LIBRARY}
)
generate_from_xml(ItemPy)
diff --git a/src/Mod/Assembly/App/Constraint.cpp b/src/Mod/Assembly/App/Constraint.cpp
index 62f1265cb0..bbfeef4fcf 100644
--- a/src/Mod/Assembly/App/Constraint.cpp
+++ b/src/Mod/Assembly/App/Constraint.cpp
@@ -46,6 +46,7 @@
#include
#include "Constraint.h"
+#include "ConstraintPy.h"
#include "Item.h"
#include "ItemPart.h"
@@ -109,5 +110,14 @@ void Constraint::init(boost::shared_ptr< Solver > solver) {
};
}
+PyObject *Constraint::getPyObject(void)
+{
+ if (PythonObject.is(Py::_None())){
+ // ref counter is set to 1
+ PythonObject = Py::Object(new ConstraintPy(this),true);
+ }
+ return Py::new_reference_to(PythonObject);
+}
+
}
\ No newline at end of file
diff --git a/src/Mod/Assembly/App/Constraint.h b/src/Mod/Assembly/App/Constraint.h
index 00562fb51f..9dd8064c71 100644
--- a/src/Mod/Assembly/App/Constraint.h
+++ b/src/Mod/Assembly/App/Constraint.h
@@ -59,6 +59,7 @@ public:
const char* getViewProviderName(void) const {
return "Gui::ViewProviderDocumentObject";
}
+ PyObject *getPyObject(void);
/** @brief initialize the constraint in the assembly solver
*/
diff --git a/src/Mod/Assembly/App/ConstraintFix.h b/src/Mod/Assembly/App/ConstraintFix.h
index c2b28035b1..ae7ca43573 100644
--- a/src/Mod/Assembly/App/ConstraintFix.h
+++ b/src/Mod/Assembly/App/ConstraintFix.h
@@ -45,7 +45,7 @@ public:
short mustExecute() const;
/// returns the type name of the view provider
//const char* getViewProviderName(void) const {
- // return "PartDesignGui::ViewProviderConstraintFix";
+ // return "AssemblyGui::ViewProviderConstraintFix";
//}
//@}
};
diff --git a/src/Mod/Assembly/App/ConstraintGroup.cpp b/src/Mod/Assembly/App/ConstraintGroup.cpp
index 2241be58e0..24beb69017 100644
--- a/src/Mod/Assembly/App/ConstraintGroup.cpp
+++ b/src/Mod/Assembly/App/ConstraintGroup.cpp
@@ -58,6 +58,8 @@ PyObject *ConstraintGroup::getPyObject(void)
void ConstraintGroup::addConstraint(Constraint* c)
{
+ Base::Console().Message("add constraint to group\n");
+
//add the constraint to our list
const std::vector< App::DocumentObject * > &vals = this->Constraints.getValues();
std::vector< App::DocumentObject * > newVals(vals);
diff --git a/src/Mod/Assembly/App/Solver.h b/src/Mod/Assembly/App/Solver.h
index 5948b71675..83ea19bcaa 100644
--- a/src/Mod/Assembly/App/Solver.h
+++ b/src/Mod/Assembly/App/Solver.h
@@ -30,7 +30,6 @@
#include
#include
#include
-#include
#include "opendcm/core.hpp"
#include "opendcm/module3d.hpp"
@@ -312,18 +311,11 @@ struct geometry_traits {
typedef modell::quaternion_wxyz_vec3 modell;
typedef placement_accessor accessor;
};
-template<>
-struct geometry_traits {
- typedef tag::point3D tag;
- typedef modell::XYZ modell;
- typedef orderd_bracket_accessor accessor;
-};
}
-
//our constraint solving system
typedef dcm::Kernel Kernel;
-typedef dcm::Module3D< mpl::vector5< gp_Pnt, gp_Lin, gp_Pln, gp_Cylinder, SbVec3f>, std::string > Module3D;
+typedef dcm::Module3D< mpl::vector4< gp_Pnt, gp_Lin, gp_Pln, gp_Cylinder>, std::string > Module3D;
typedef dcm::ModulePart< mpl::vector1< Base::Placement >, std::string > ModulePart;
typedef dcm::System Solver;
diff --git a/src/Mod/Assembly/Gui/CommandConstraints.cpp b/src/Mod/Assembly/Gui/CommandConstraints.cpp
index 349950c56d..e46651e4f5 100644
--- a/src/Mod/Assembly/Gui/CommandConstraints.cpp
+++ b/src/Mod/Assembly/Gui/CommandConstraints.cpp
@@ -143,9 +143,56 @@ void CmdAssemblyConstraintAxle::activated(int iMsg)
}
+/******************************************************************************************/
+
+DEF_STD_CMD(CmdAssemblyConstraintFix);
+
+CmdAssemblyConstraintFix::CmdAssemblyConstraintFix()
+ :Command("Assembly_ConstraintFix")
+{
+ 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");
+ sWhatsThis = sToolTipText;
+ sStatusTip = sToolTipText;
+ sPixmap = "Assembly_ConstraintLock";
+}
+
+
+void CmdAssemblyConstraintFix::activated(int iMsg)
+{
+ Assembly::ItemAssembly *Asm=0;
+ Assembly::ConstraintGroup *ConstGrp=0;
+
+ // retrive the standard objects needed
+ if(getConstraintPrerequisits(&Asm,&ConstGrp))
+ return;
+
+ std::vector objs = Gui::Selection().getSelectionEx();
+ if(objs.size() != 1) {
+ Base::Console().Message("you must select one part\n");
+ return;
+ };
+
+ Assembly::ItemPart* part = Asm->getContainingPart(objs[0].getObject());
+ if(!part) {
+ Base::Console().Message("The selected object need to belong to the active assembly\n");
+ return;
+ };
+
+ openCommand("Insert Constraint Fix");
+ 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());
+
+}
+
void CreateAssemblyConstraintCommands(void)
{
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
+ rcCmdMgr.addCommand(new CmdAssemblyConstraintFix());
rcCmdMgr.addCommand(new CmdAssemblyConstraintAxle());
}
diff --git a/src/Mod/Assembly/Gui/Resources/Assembly.qrc b/src/Mod/Assembly/Gui/Resources/Assembly.qrc
index df4638f442..d670d89566 100644
--- a/src/Mod/Assembly/Gui/Resources/Assembly.qrc
+++ b/src/Mod/Assembly/Gui/Resources/Assembly.qrc
@@ -1,6 +1,7 @@
icons/actions/Axle_constraint.svg
+ icons/Assembly_ConstraintLock.svg
translations/Assembly_af.qm
translations/Assembly_de.qm
translations/Assembly_fi.qm
diff --git a/src/Mod/Assembly/Gui/Resources/icons/Assembly_ConstraintLock.svg b/src/Mod/Assembly/Gui/Resources/icons/Assembly_ConstraintLock.svg
new file mode 100644
index 0000000000..b97df38c1d
--- /dev/null
+++ b/src/Mod/Assembly/Gui/Resources/icons/Assembly_ConstraintLock.svg
@@ -0,0 +1,442 @@
+
+
+
+
diff --git a/src/Mod/Assembly/Gui/Workbench.cpp b/src/Mod/Assembly/Gui/Workbench.cpp
index 2831e0a6c8..6d042316d1 100644
--- a/src/Mod/Assembly/Gui/Workbench.cpp
+++ b/src/Mod/Assembly/Gui/Workbench.cpp
@@ -52,6 +52,7 @@ 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 << "Separator";
*part << "Assembly_AddNewPart";