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 1e8a304036
commit ca60024447
62 changed files with 2071 additions and 423 deletions

View File

@ -35,11 +35,12 @@
#include "ItemPart.h"
#include "ConstraintAngle.h"
#include "ConstraintAxis.h"
#include "ConstraintContact.h"
#include "ConstraintCoincidence.h"
#include "ConstraintFix.h"
#include "ConstraintGroup.h"
#include "ConstraintOffset.h"
#include "ConstraintAlignment.h"
#include "ConstraintDistance.h"
#include "ConstraintOrientation.h"
extern struct PyMethodDef Assembly_methods[];
@ -80,10 +81,11 @@ void AssemblyExport initAssembly()
// constraint hirachy
Assembly::Constraint ::init();
Assembly::ConstraintAngle ::init();
Assembly::ConstraintAxis ::init();
Assembly::ConstraintContact ::init();
Assembly::ConstraintDistance::init();
Assembly::ConstraintCoincidence::init();
Assembly::ConstraintFix ::init();
Assembly::ConstraintOffset ::init();
Assembly::ConstraintAlignment ::init();
Assembly::ConstraintOrientation::init();
Assembly::ConstraintGroup ::init();
}

View File

@ -30,7 +30,6 @@ generate_from_xml(ItemPy)
generate_from_xml(ItemAssemblyPy)
generate_from_xml(ItemPartPy)
generate_from_xml(ConstraintPy)
generate_from_xml(ConstraintAxisPy)
generate_from_xml(ConstraintGroupPy)
SET(Features_SRCS
@ -46,14 +45,16 @@ SET(Features_SRCS
ConstraintGroup.h
ConstraintAngle.cpp
ConstraintAngle.h
ConstraintAxis.cpp
ConstraintAxis.h
ConstraintContact.cpp
ConstraintContact.h
ConstraintDistance.cpp
ConstraintDistance.h
ConstraintCoincidence.cpp
ConstraintCoincidence.h
ConstraintFix.cpp
ConstraintFix.h
ConstraintOffset.cpp
ConstraintOffset.h
ConstraintAlignment.cpp
ConstraintAlignment.h
ConstraintOrientation.cpp
ConstraintOrientation.h
)
SOURCE_GROUP("Features" FILES ${Features_SRCS})
@ -74,8 +75,6 @@ SET(Python_SRCS
ItemPartPyImp.cpp
ConstraintPy.xml
ConstraintPyImp.cpp
ConstraintAxisPy.xml
ConstraintAxisPyImp.cpp
ConstraintGroupPy.xml
ConstraintGroupPyImp.cpp
)

View File

@ -49,6 +49,7 @@
#include "ConstraintPy.h"
#include "Item.h"
#include "ItemPart.h"
#include "ItemAssembly.h"
using namespace Assembly;
@ -74,40 +75,44 @@ short Constraint::mustExecute() const
App::DocumentObjectExecReturn *Constraint::execute(void)
{
touch();
return App::DocumentObject::StdReturn;
}
void Constraint::init(boost::shared_ptr< Solver > solver) {
boost::shared_ptr<Geometry3D> Constraint::initLink(ItemAssembly* ass, App::PropertyLinkSub& link) {
//check if we have Assembly::ItemPart's
if( First.getValue()->getTypeId() != ItemPart::getClassTypeId() ||
Second.getValue()->getTypeId() != ItemPart::getClassTypeId() ) {
Base::Console().Message("Links are not ItemPart's, the constraint is invalid\n");
return;
//check if we have Assembly::ItemPart
if( link.getValue()->getTypeId() != ItemPart::getClassTypeId() ) {
Base::Console().Message("Link is not ItemPart, the constraint is invalid\n");
return boost::shared_ptr<Geometry3D>();
};
//see if the parts are already initialized for the solver
Assembly::ItemPart* part1 = static_cast<Assembly::ItemPart*>(First.getValue());
if(!part1->m_part) {
part1->m_part = solver->createPart(part1->Placement.getValue(), part1->Uid.getValueStr());
part1->m_part->connectSignal<dcm::recalculated>(boost::bind(&ItemPart::setCalculatedPlacement, part1, _1));
}
Assembly::ItemPart* part2 = static_cast<Assembly::ItemPart*>(Second.getValue());
if(!part2->m_part) {
part2->m_part = solver->createPart(part2->Placement.getValue(), part2->Uid.getValueStr());
part2->m_part->connectSignal<dcm::recalculated>(boost::bind(&ItemPart::setCalculatedPlacement, part2, _1));
}
//let's get the geometrys
m_first_geom = part1->getGeometry3D(First.getSubValues()[0].c_str());
m_second_geom = part2->getGeometry3D(Second.getSubValues()[0].c_str());
Assembly::ItemPart* part = static_cast<Assembly::ItemPart*>(link.getValue());
if(!part)
return boost::shared_ptr<Geometry3D>();
if(!m_first_geom || !m_second_geom) {
Base::Console().Message("Unable to initialize geometry\n");
return;
};
//get the relevant solver in which the part needs to be added
Assembly::ItemAssembly* p_ass = ass->getParentAssembly(part);
if(!p_ass)
return boost::shared_ptr<Geometry3D>();
boost::shared_ptr<Solver> solver = p_ass->m_solver;
if(!solver)
return boost::shared_ptr<Geometry3D>();
if(!solver->hasPart(part->Uid.getValueStr())) {
part->m_part = solver->createPart(part->Placement.getValue(), part->Uid.getValueStr());
part->m_part->connectSignal<dcm::recalculated>(boost::bind(&ItemPart::setCalculatedPlacement, part, _1));
};
return part->getGeometry3D(link.getSubValues()[0].c_str());
}
void Constraint::init(ItemAssembly* ass)
{
m_first_geom = initLink(ass, First);
m_second_geom = initLink(ass, Second);
}
PyObject *Constraint::getPyObject(void)
@ -120,4 +125,7 @@ PyObject *Constraint::getPyObject(void)
}
}
}

View File

@ -31,6 +31,7 @@
#include <TopoDS_Shape.hxx>
#include "Solver.h"
#include "ItemAssembly.h"
namespace Assembly
@ -44,6 +45,8 @@ protected:
boost::shared_ptr<Constraint3D> m_constraint;
boost::shared_ptr<Geometry3D> m_first_geom, m_second_geom;
boost::shared_ptr< Geometry3D > initLink(Assembly::ItemAssembly* ass, App::PropertyLinkSub& link);
public:
Constraint();
@ -63,7 +66,7 @@ public:
/** @brief initialize the constraint in the assembly solver
*/
virtual void init(boost::shared_ptr<Solver> solver);
virtual void init(ItemAssembly* ass);
};
} //namespace Assembly

View File

@ -0,0 +1,87 @@
/***************************************************************************
* Copyright (c) 2010 Juergen Riegel <FreeCAD@juergen-riegel.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"
#ifndef _PreComp_
#endif
#include <Base/Placement.h>
#include "ConstraintAlignment.h"
using namespace Assembly;
namespace Assembly {
PROPERTY_SOURCE(Assembly::ConstraintAlignment, Assembly::Constraint)
ConstraintAlignment::ConstraintAlignment()
{
ADD_PROPERTY(Offset,(0));
ADD_PROPERTY(Orientation, (long(0)));
std::vector<std::string> vec;
vec.push_back("Parallel");
vec.push_back("Equal");
vec.push_back("Opposite");
Orientation.setEnumVector(vec);
}
short ConstraintAlignment::mustExecute() const
{
//if (Sketch.isTouched() ||
// Length.isTouched())
// return 1;
return 0;
}
App::DocumentObjectExecReturn *ConstraintAlignment::execute(void)
{
return App::DocumentObject::StdReturn;
}
void ConstraintAlignment::init(ItemAssembly* ass) {
//cant use the base class init as we only need one part
Constraint::init(ass);
//init the constraint
dcm::Direction dir;
switch(Orientation.getValue()) {
case 0:
dir = dcm::parallel;
break;
case 1:
dir = dcm::equal;
break;
default:
dir = dcm::opposite;
};
m_constraint = ass->m_solver->createConstraint3D(getNameInDocument(), m_first_geom, m_second_geom, dcm::alignment(dir, Offset.getValue()));
};
}

View File

@ -0,0 +1,61 @@
/***************************************************************************
* Copyright (c) 2010 Juergen Riegel <FreeCAD@juergen-riegel.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 Assembly_ConstraintAlignment_H
#define Assembly_ConstraintAlignment_H
#include <App/PropertyStandard.h>
#include "Constraint.h"
namespace Assembly
{
class AssemblyExport ConstraintAlignment : public Assembly::Constraint
{
PROPERTY_HEADER(Assembly::ConstraintAlignment);
public:
ConstraintAlignment();
App::PropertyFloat Offset;
App::PropertyEnumeration Orientation;
/** @name methods override feature */
//@{
/// recalculate the feature
App::DocumentObjectExecReturn *execute(void);
short mustExecute() const;
/// returns the type name of the view provider
const char* getViewProviderName(void) const {
return "AssemblyGui::ViewProviderConstraintAlignment";
}
//@}
virtual void init(ItemAssembly* ass);
};
} //namespace PartDesign
#endif // PART_ConstraintAlignment_H

View File

@ -27,6 +27,7 @@
#include <Base/Placement.h>
#include <math.h>
#include "ConstraintAngle.h"
@ -56,4 +57,13 @@ App::DocumentObjectExecReturn *ConstraintAngle::execute(void)
return App::DocumentObject::StdReturn;
}
void ConstraintAngle::init(ItemAssembly* ass)
{
//init the parts and geometries
Constraint::init(ass);
//init the constraint
m_constraint = ass->m_solver->createConstraint3D(getNameInDocument(), m_first_geom, m_second_geom, dcm::angle = Angle.getValue()*M_PI/180.);
}
}

View File

@ -46,10 +46,12 @@ public:
App::DocumentObjectExecReturn *execute(void);
short mustExecute() const;
/// returns the type name of the view provider
//const char* getViewProviderName(void) const {
// return "PartDesignGui::ViewProviderConstraintAngle";
//}
const char* getViewProviderName(void) const {
return "AssemblyGui::ViewProviderConstraintAngle";
}
//@}
virtual void init(ItemAssembly* ass);
};
} //namespace Assembly

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport
Father="ConstraintPy"
Name="ConstraintAxisPy"
Twin="ConstraintAxis"
TwinPointer="ConstraintAxis"
Include="Mod/Assembly/App/ConstraintAxis.h"
Namespace="Assembly"
FatherInclude="Mod/Assembly/App/ConstraintPy.h"
FatherNamespace="Assembly">
<Documentation>
<Author Licence="LGPL" Name="Stefan Tröger" EMail="stefantroeger@gmx.net" />
<UserDocu>Base class of all objects in Assembly</UserDocu>
</Documentation>
</PythonExport>
</GenerateModel>

View File

@ -1,29 +0,0 @@
#include "PreCompiled.h"
#include "Mod/Assembly/App/Constraint.h"
// inclusion of the generated files (generated out of ItemAssemblyPy.xml)
#include "ConstraintAxisPy.h"
#include "ConstraintAxisPy.cpp"
using namespace Assembly;
// returns a string which represents the object e.g. when printed in python
std::string ConstraintAxisPy::representation(void) const
{
return std::string("<ConstraintAxisAssembly object>");
}
PyObject *ConstraintAxisPy::getCustomAttributes(const char* /*attr*/) const
{
return 0;
}
int ConstraintAxisPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
{
return 0;
}

View File

@ -0,0 +1,87 @@
/***************************************************************************
* Copyright (c) 2012 Juergen Riegel <FreeCAD@juergen-riegel.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"
#ifndef _PreComp_
#endif
#include <Base/Placement.h>
#include "ConstraintCoincidence.h"
using namespace Assembly;
namespace Assembly {
PROPERTY_SOURCE(Assembly::ConstraintCoincidence, Assembly::Constraint)
ConstraintCoincidence::ConstraintCoincidence()
{
ADD_PROPERTY(Orientation, (long(0)));
std::vector<std::string> vec;
vec.push_back("Parallel");
vec.push_back("Equal");
vec.push_back("Opposite");
Orientation.setEnumVector(vec);
}
short ConstraintCoincidence::mustExecute() const
{
//if (Sketch.isTouched() ||
// Length.isTouched())
// return 1;
return 0;
}
App::DocumentObjectExecReturn *ConstraintCoincidence::execute(void)
{
return App::DocumentObject::StdReturn;
}
void ConstraintCoincidence::init(ItemAssembly* ass) {
//cant use the base class init as we only need one part
Constraint::init(ass);
//init the constraint
dcm::Direction dir;
switch(Orientation.getValue()) {
case 0:
dir = dcm::parallel;
break;
case 1:
dir = dcm::equal;
break;
default:
dir = dcm::opposite;
};
m_constraint = ass->m_solver->createConstraint3D(getNameInDocument(), m_first_geom, m_second_geom, dcm::coincidence = dir);
};
}

View File

@ -0,0 +1,60 @@
/***************************************************************************
* Copyright (c) 2012 Juergen Riegel <FreeCAD@juergen-riegel.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 Assembly_ConstraintCoincidence_H
#define Assembly_ConstraintCoincidence_H
#include <App/PropertyStandard.h>
#include "Constraint.h"
namespace Assembly
{
class AssemblyExport ConstraintCoincidence : public Assembly::Constraint
{
PROPERTY_HEADER(Assembly::ConstraintCoincidence);
public:
ConstraintCoincidence();
App::PropertyEnumeration Orientation;
/** @name methods override feature */
//@{
/// recalculate the feature
App::DocumentObjectExecReturn *execute(void);
short mustExecute() const;
/// returns the type name of the view provider
const char* getViewProviderName(void) const {
return "AssemblyGui::ViewProviderConstraintCoincidence";
}
//@}
virtual void init(ItemAssembly* ass);
};
} //namespace Assembly
#endif // Assembly_ConstraintCoincidence_H

View File

@ -0,0 +1,83 @@
/***************************************************************************
* Copyright (c) 2012 Juergen Riegel <FreeCAD@juergen-riegel.net>
* 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"
#ifndef _PreComp_
#endif
#include <Base/Placement.h>
#include <Base/Console.h>
#include "ConstraintDistance.h"
#include "ConstraintPy.h"
#include "ItemPart.h"
using namespace Assembly;
namespace Assembly {
PROPERTY_SOURCE(Assembly::ConstraintDistance, Assembly::Constraint)
ConstraintDistance::ConstraintDistance()
{
ADD_PROPERTY(Distance,(0));
}
PyObject *ConstraintDistance::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);
}
short ConstraintDistance::mustExecute() const
{
//if (Sketch.isTouched() ||
// Length.isTouched())
// return 1;
return 0;
}
App::DocumentObjectExecReturn *ConstraintDistance::execute(void)
{
Base::Console().Message("Recalculate axis constraint\n");
touch();
return App::DocumentObject::StdReturn;
}
void ConstraintDistance::init(ItemAssembly* ass)
{
//init the parts and geometries
Constraint::init(ass);
//init the constraint
m_constraint = ass->m_solver->createConstraint3D(getNameInDocument(), m_first_geom, m_second_geom, dcm::distance = Distance.getValue());
}
}

View File

@ -0,0 +1,62 @@
/***************************************************************************
* Copyright (c) 2012 Juergen Riegel <FreeCAD@juergen-riegel.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 Assembly_ConstraintAxis_H
#define Assembly_ConstraintAxis_H
#include <App/PropertyStandard.h>
#include "Constraint.h"
namespace Assembly
{
class AssemblyExport ConstraintDistance : public Assembly::Constraint
{
PROPERTY_HEADER(Assembly::ConstraintAxis);
public:
ConstraintDistance();
App::PropertyFloat Distance;
PyObject *getPyObject(void);
/** @name methods override feature */
//@{
/// recalculate the feature
App::DocumentObjectExecReturn *execute(void);
short mustExecute() const;
/// returns the type name of the view provider
const char* getViewProviderName(void) const {
return "AssemblyGui::ViewProviderConstraintDistance";
}
//@}
virtual void init(ItemAssembly* ass);
};
} //namespace Assembly
#endif // Assembly_ConstraintAxis_H

View File

@ -26,6 +26,8 @@
#endif
#include <Base/Placement.h>
#include <Base/Console.h>
#include "ItemPart.h"
#include "ConstraintFix.h"
@ -37,23 +39,43 @@ namespace Assembly {
PROPERTY_SOURCE(Assembly::ConstraintFix, Assembly::Constraint)
ConstraintFix::ConstraintFix()
{
ConstraintFix::ConstraintFix() {
}
short ConstraintFix::mustExecute() const
{
ConstraintFix::~ConstraintFix() {
Assembly::ItemPart* part = static_cast<Assembly::ItemPart*>(First.getValue());
if(part && part->m_part) {
part->m_part->fix(false);
}
}
short ConstraintFix::mustExecute() const {
//if (Sketch.isTouched() ||
// Length.isTouched())
// return 1;
return 0;
}
App::DocumentObjectExecReturn *ConstraintFix::execute(void)
{
App::DocumentObjectExecReturn* ConstraintFix::execute(void) {
return App::DocumentObject::StdReturn;
}
}
void ConstraintFix::init(ItemAssembly* ass) {
//cant use the base class init as we only need one part
initLink(ass, First);
//get the part
Assembly::ItemPart* part = static_cast<Assembly::ItemPart*>(First.getValue());
if(!part)
return;
//init the constraint
part->m_part->fix(true);
};
}

View File

@ -37,6 +37,7 @@ class AssemblyExport ConstraintFix : public Assembly::Constraint
public:
ConstraintFix();
~ConstraintFix();
/** @name methods override feature */
//@{
@ -44,10 +45,12 @@ public:
App::DocumentObjectExecReturn *execute(void);
short mustExecute() const;
/// returns the type name of the view provider
//const char* getViewProviderName(void) const {
// return "AssemblyGui::ViewProviderConstraintFix";
//}
const char* getViewProviderName(void) const {
return "AssemblyGui::ViewProviderConstraintFix";
}
//@}
virtual void init(ItemAssembly* ass);
};
} //namespace Assembly

View File

@ -56,51 +56,6 @@ PyObject *ConstraintGroup::getPyObject(void)
return Py::new_reference_to(PythonObject);
}
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);
newVals.push_back(c);
this->Constraints.setValues(newVals);
//let's retrieve the solver if not already done
ItemAssembly* assembly = NULL;
if(!m_solver || !assembly) {
typedef std::vector<App::DocumentObject*>::iterator iter;
std::vector<App::DocumentObject*> vec = getInList();
for(iter it = vec.begin(); it!=vec.end(); it++) {
if( (*it)->getTypeId() == ItemAssembly::getClassTypeId() ) {
assembly = static_cast<ItemAssembly*>(*it);
m_solver = assembly->m_solver;
break;
};
}
};
//check if we have been successfull
if(!m_solver) {
Base::Console().Message("ConstraintGroup: Unable to retrieve assembly solver\n");
return;
};
if(!assembly) {
Base::Console().Message("ConstraintGroup: Unable to retrieve assembly\n");
return;
};
//init the constraint
c->init(m_solver);
//solve the system and propagate the change upstream
m_solver->solve();
assembly->touch();
}
short ConstraintGroup::mustExecute() const
{
@ -114,7 +69,21 @@ App::DocumentObjectExecReturn *ConstraintGroup::execute(void)
{
Base::Console().Message("Recalculate constraint group\n");
touch();
return App::DocumentObject::StdReturn;
}
void ConstraintGroup::init(ItemAssembly* ass) {
std::vector<App::DocumentObject*> obj = Constraints.getValues();
std::vector<App::DocumentObject*>::iterator it;
for (it = obj.begin(); it != obj.end(); ++it) {
if ((*it)->getTypeId().isDerivedFrom(Assembly::Constraint::getClassTypeId())) {
static_cast<Assembly::Constraint*>(*it)->init(ass);
}
}
}
}

View File

@ -38,13 +38,9 @@ namespace Assembly
class AssemblyExport ConstraintGroup : public App::DocumentObject
{
PROPERTY_HEADER(Assembly::ConstraintGroup);
protected:
boost::shared_ptr<Solver> m_solver;
public:
ConstraintGroup();
void addConstraint(Constraint* c);
PyObject *getPyObject(void);
@ -60,6 +56,8 @@ public:
return "AssemblyGui::ViewProviderConstraintGroup";
}
//@}
void init(ItemAssembly* ass);
};
} //namespace Assembly

View File

@ -13,11 +13,6 @@
<Author Licence="LGPL" Name="Juergen Riegel" EMail="FreeCAD@juergen-riegel.net" />
<UserDocu>Base class of all objects in Assembly</UserDocu>
</Documentation>
<Methode Name="addConstraint">
<Documentation>
<UserDocu>Adds a constraint object to the constraint group</UserDocu>
</Documentation>
</Methode>
</PythonExport>
</GenerateModel>

View File

@ -16,20 +16,6 @@ std::string ConstraintGroupPy::representation(void) const
return std::string("<ConstraintGroup object>");
}
PyObject* ConstraintGroupPy::addConstraint(PyObject * args)
{
PyObject *pcObj;
if (!PyArg_ParseTuple(args, "O", &pcObj))
return 0;
if (PyObject_TypeCheck(pcObj, &(Assembly::ConstraintPy::Type))) {
Base::Console().Message("Add constraint\n");
Assembly::Constraint *c = static_cast<Assembly::ConstraintPy*>(pcObj)->getConstraintPtr();
this->getConstraintGroupPtr()->addConstraint(c);
}
Py_Return;
}
PyObject *ConstraintGroupPy::getCustomAttributes(const char* /*attr*/) const
{
return 0;

View File

@ -0,0 +1,93 @@
/***************************************************************************
* Copyright (c) 2012 Juergen Riegel <FreeCAD@juergen-riegel.net>
* 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"
#ifndef _PreComp_
#endif
#include <Base/Placement.h>
#include <Base/Console.h>
#include "ConstraintOrientation.h"
#include "ConstraintPy.h"
#include "ItemPart.h"
using namespace Assembly;
namespace Assembly {
PROPERTY_SOURCE(Assembly::ConstraintOrientation, Assembly::Constraint)
ConstraintOrientation::ConstraintOrientation() {
ADD_PROPERTY(Orientation, (long(0)));
std::vector<std::string> vec;
vec.push_back("Parallel");
vec.push_back("Perpendicular");
vec.push_back("Equal");
vec.push_back("Opposite");
Orientation.setEnumVector(vec);
}
short ConstraintOrientation::mustExecute() const {
//if (Sketch.isTouched() ||
// Length.isTouched())
// return 1;
return 0;
}
App::DocumentObjectExecReturn* ConstraintOrientation::execute(void) {
Base::Console().Message("Recalculate orientation constraint\n");
touch();
return App::DocumentObject::StdReturn;
}
void ConstraintOrientation::init(ItemAssembly* ass) {
//init the parts and geometries
Constraint::init(ass);
//init the constraint
dcm::Direction dir;
switch(Orientation.getValue()) {
case 0:
dir = dcm::parallel;
break;
case 1:
dir = dcm::perpendicular;
break;
case 2:
dir = dcm::equal;
break;
default:
dir = dcm::opposite;
};
m_constraint = ass->m_solver->createConstraint3D(getNameInDocument(), m_first_geom, m_second_geom, dcm::orientation = dir);
}
}

View File

@ -0,0 +1,60 @@
/***************************************************************************
* Copyright (c) 2012 Juergen Riegel <FreeCAD@juergen-riegel.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 Assembly_ConstraintOrientation_H
#define Assembly_ConstraintOrientation_H
#include <App/PropertyStandard.h>
#include "Constraint.h"
namespace Assembly
{
class AssemblyExport ConstraintOrientation : public Assembly::Constraint
{
PROPERTY_HEADER(Assembly::ConstraintOrientation);
public:
ConstraintOrientation();
App::PropertyEnumeration Orientation;
/** @name methods override feature */
//@{
/// recalculate the feature
App::DocumentObjectExecReturn *execute(void);
short mustExecute() const;
/// returns the type name of the view provider
const char* getViewProviderName(void) const {
return "AssemblyGui::ViewProviderConstraintOrientation";
}
//@}
virtual void init(ItemAssembly* ass);
};
} //namespace Assembly
#endif // Assembly_ConstraintAxis_H

View File

@ -12,7 +12,7 @@ using namespace Assembly;
// returns a string which represents the object e.g. when printed in python
std::string ConstraintPy::representation(void) const
{
return std::string("<ConstraintAssembly object>");
return std::string("<Assembly constraint object>");
}

View File

@ -32,6 +32,7 @@
#include <Base/Exception.h>
#include "ItemAssembly.h"
#include "ConstraintGroup.h"
#include <ItemAssemblyPy.h>
@ -42,7 +43,7 @@ namespace Assembly {
PROPERTY_SOURCE(Assembly::ItemAssembly, Assembly::Item)
ItemAssembly::ItemAssembly() : m_solver(new Solver)
ItemAssembly::ItemAssembly()
{
ADD_PROPERTY(Items,(0));
ADD_PROPERTY(Annotations,(0));
@ -56,6 +57,24 @@ short ItemAssembly::mustExecute() const
App::DocumentObjectExecReturn *ItemAssembly::execute(void)
{
Base::Console().Message("Execute ItemAssembly\n");
//create a solver and init all child assemblys with subsolvers
m_solver = boost::shared_ptr<Solver>(new Solver);
init(boost::shared_ptr<Solver>());
//get the constraint group and init the constraints
typedef std::vector<App::DocumentObject*>::const_iterator iter;
const std::vector<App::DocumentObject*>& vector = Annotations.getValues();
for(iter it=vector.begin(); it != vector.end(); it++) {
if( (*it)->getTypeId() == Assembly::ConstraintGroup::getClassTypeId() )
static_cast<ConstraintGroup*>(*it)->init(this);
};
//solve the system
m_solver->solve();
this->touch();
return App::DocumentObject::StdReturn;
}
@ -101,37 +120,44 @@ PyObject *ItemAssembly::getPyObject(void)
return Py::new_reference_to(PythonObject);
}
void ItemAssembly::addPart(ItemPart* part) {
bool ItemAssembly::isParentAssembly(ItemPart* part) {
if(part->m_part) {
//TODO: destroy old part
}
//add the part to our list
const std::vector< App::DocumentObject * > &vals = this->Items.getValues();
std::vector< App::DocumentObject * > newVals(vals);
newVals.push_back(part);
this->Items.setValues(newVals);
typedef std::vector<App::DocumentObject*>::const_iterator iter;
part->m_part = m_solver->createPart(part->Placement.getValue(), part->Uid.getValueStr());
const std::vector<App::DocumentObject*>& vector = Items.getValues();
for(iter it=vector.begin(); it != vector.end(); it++) {
if( (*it)->getTypeId() == Assembly::ItemPart::getClassTypeId() )
if(*it == part) return true;
};
return false;
}
void ItemAssembly::addComponent(ItemAssembly* assembly) {
ItemAssembly* ItemAssembly::getParentAssembly(ItemPart* part) {
if(assembly->m_solver) {
//TODO: destroy old solver system
}
typedef std::vector<App::DocumentObject*>::const_iterator iter;
//add the component to our list
const std::vector< App::DocumentObject * > &vals = this->Items.getValues();
std::vector< App::DocumentObject * > newVals(vals);
newVals.push_back(assembly);
this->Items.setValues(newVals);
const std::vector<App::DocumentObject*>& vector = Items.getValues();
for(iter it=vector.begin(); it != vector.end(); it++) {
if( (*it)->getTypeId() == Assembly::ItemPart::getClassTypeId() ) {
if(*it == part)
return this;
}
else if ( (*it)->getTypeId() == Assembly::ItemAssembly::getClassTypeId() ) {
Assembly::ItemAssembly* assembly = static_cast<Assembly::ItemAssembly*>(*it)->getParentAssembly(part);
if(assembly)
return assembly;
}
};
assembly->m_solver = boost::shared_ptr<Solver>(m_solver->createSubsystem());
assembly->m_solver->setTransformation(assembly->Placement.getValue());
return (ItemAssembly*)NULL;
}
ItemPart* ItemAssembly::getContainingPart(App::DocumentObject* obj) {
typedef std::vector<App::DocumentObject*>::const_iterator iter;
@ -154,5 +180,22 @@ ItemPart* ItemAssembly::getContainingPart(App::DocumentObject* obj) {
return NULL;
}
void ItemAssembly::init(boost::shared_ptr<Solver> parent) {
if(parent)
m_solver = boost::shared_ptr<Solver>(parent->createSubsystem());
typedef std::vector<App::DocumentObject*>::const_iterator iter;
const std::vector<App::DocumentObject*>& vector = Items.getValues();
for(iter it=vector.begin(); it != vector.end(); it++) {
if ( (*it)->getTypeId() == Assembly::ItemAssembly::getClassTypeId() ) {
static_cast<Assembly::ItemAssembly*>(*it)->init(m_solver);
}
};
}
}

View File

@ -57,10 +57,12 @@ public:
virtual TopoDS_Shape getShape(void) const;
void addPart(Assembly::ItemPart* part);
void addComponent(Assembly::ItemAssembly* assembly);
//the toplevel assembly is the direct parent of the part
bool isParentAssembly(ItemPart* part);
ItemAssembly* getParentAssembly(ItemPart* part);
Assembly::ItemPart* getContainingPart(App::DocumentObject* obj);
ItemPart* getContainingPart(App::DocumentObject* obj);
void init(boost::shared_ptr<Solver> parent);
boost::shared_ptr<Solver> m_solver;
};

View File

@ -13,15 +13,5 @@
<Author Licence="LGPL" Name="Juergen Riegel" EMail="FreeCAD@juergen-riegel.net" />
<UserDocu>Base class of all objects in Assembly</UserDocu>
</Documentation>
<Methode Name="addPart">
<Documentation>
<UserDocu>Adds a Assembly::ItemPart object to the assembly</UserDocu>
</Documentation>
</Methode>
<Methode Name="addComponent">
<Documentation>
<UserDocu>Adds a Assembly::ItemAssembly object to the assembly</UserDocu>
</Documentation>
</Methode>
</PythonExport>
</GenerateModel>

View File

@ -17,41 +17,6 @@ std::string ItemAssemblyPy::representation(void) const
}
PyObject* ItemAssemblyPy::addPart(PyObject * args)
{
PyObject *pcObj;
if (!PyArg_ParseTuple(args, "O", &pcObj)) {
Base::Console().Message("Test 1 fails\n");
return 0;
}
if (PyObject_TypeCheck(pcObj, &(Assembly::ItemPartPy::Type))) {
Assembly::ItemPart *c = static_cast<Assembly::ItemPartPy*>(pcObj)->getItemPartPtr();
getItemAssemblyPtr()->addPart(c);
Base::Console().Message("Add Part\n");
}
else Base::Console().Message("Test 2 fails\n");
Py_Return;
}
PyObject* ItemAssemblyPy::addComponent(PyObject * args)
{
PyObject *pcObj;
if (!PyArg_ParseTuple(args, "O", &pcObj)) {
Base::Console().Message("Test 1 fails\n");
return 0;
}
if (PyObject_TypeCheck(pcObj, &(Assembly::ItemAssemblyPy::Type))) {
Assembly::ItemAssembly *c = static_cast<Assembly::ItemAssemblyPy*>(pcObj)->getItemAssemblyPtr();
getItemAssemblyPtr()->addComponent(c);
Base::Console().Message("Add Component\n");
}
else Base::Console().Message("Test 2 fails\n");
Py_Return;
}
PyObject *ItemAssemblyPy::getCustomAttributes(const char* /*attr*/) const
{
return 0;

View File

@ -143,17 +143,17 @@ boost::shared_ptr< Geometry3D > ItemPart::getGeometry3D(const char* Type)
gp_Dir dir = plane.Axis().Direction();
plane = gp_Pln(plane.Location(), dir.Reversed());
}
geometry = m_part->addGeometry3D(plane, Type, dcm::Global);
geometry = m_part->addGeometry3D(plane, Type, dcm::Local);
break;
}
case GeomAbs_Cylinder: {
//Base::Console().Message("cylinder selected\n");
gp_Cylinder cyl = surface.Cylinder();
geometry = m_part->addGeometry3D(cyl, Type, dcm::Global);
geometry = m_part->addGeometry3D(cyl, Type, dcm::Local);
break;
}
default:
Base::Console().Message("Unsuported Surface Geometrie Type at selection 1\n");
Base::Console().Message("Unsuported Surface Geometrie Type at selection\n");
return boost::shared_ptr< Geometry3D >();
}
@ -163,24 +163,29 @@ boost::shared_ptr< Geometry3D > ItemPart::getGeometry3D(const char* Type)
switch(curve.GetType()) {
case GeomAbs_Line: {
gp_Lin line = curve.Line();
geometry = m_part->addGeometry3D(line, Type, dcm::Global);
geometry = m_part->addGeometry3D(line, Type, dcm::Local);
break;
}
default:
//Base::Console().Message("Unsuported Curve Geometrie Type at selection 1\n");
Base::Console().Message("Unsuported Curve Geometrie Type at selection \n");
return boost::shared_ptr< Geometry3D >();
}
} else if(s.ShapeType() == TopAbs_VERTEX) {
TopoDS_Vertex v1 = TopoDS::Vertex(s);
gp_Pnt point = BRep_Tool::Pnt(v1);
geometry = m_part->addGeometry3D(point, Type, dcm::Global);
geometry = m_part->addGeometry3D(point, Type, dcm::Local);
} else {
Base::Console().Message("Unsuported Topologie Type at selection 1\n");
Base::Console().Message("Unsuported Topologie Type at selection\n");
return boost::shared_ptr< Geometry3D >();
}
};
std::stringstream s;
s<<geometry->m_global;
Base::Console().Message("Added geom: %s, %s\n", Type, s.str().c_str());
return geometry;
}

View File

@ -20,7 +20,6 @@
* *
***************************************************************************/
#ifndef SOLVER_H
#define SOLVER_H

View File

@ -20,6 +20,11 @@
#ifndef DCM_CORE_H
#define DCM_CORE_H
#ifdef _WIN32
//warning about to long decoraded names, won't affect the code correctness
#pragma warning( disable : 4503 )
#endif
#include "core/geometry.hpp"
#include "core/kernel.hpp"
#include "core/system.hpp"

View File

@ -52,6 +52,8 @@
#include <boost/variant/recursive_variant.hpp>
#include <boost/bind.hpp>
#include <Eigen/Core>
namespace mpl = boost::mpl;
namespace fusion = boost::fusion;
@ -362,23 +364,23 @@ public:
return std::pair<boost::shared_ptr<ClusterGraph>, LocalVertex>(m_clusters[v] = boost::shared_ptr<ClusterGraph>(new ClusterGraph(sp_base::shared_from_this())), v);
};
boost::shared_ptr<ClusterGraph> parent() {
return m_parent;
inline boost::shared_ptr<ClusterGraph> parent() {
return boost::shared_ptr<ClusterGraph>(m_parent);
};
const boost::shared_ptr<ClusterGraph> parent() const {
return m_parent;
inline const boost::shared_ptr<ClusterGraph> parent() const {
return boost::shared_ptr<ClusterGraph>(m_parent);
};
bool isRoot() const {
return m_parent ? false : true;
return m_parent.expired();
};
boost::shared_ptr<ClusterGraph> root() {
return isRoot() ? sp_base::shared_from_this() : m_parent->root();
return isRoot() ? sp_base::shared_from_this() : parent()->root();
};
const boost::shared_ptr<ClusterGraph> root() const {
return isRoot() ? sp_base::shared_from_this() : m_parent->root();
return isRoot() ? sp_base::shared_from_this() : parent()->root();
};
std::pair<cluster_iterator, cluster_iterator> clusters() {
@ -1303,8 +1305,8 @@ public:
LocalVertex nv = boost::add_vertex(vb, *parent());
//regrouping if needed
if(isCluster(v)) {
m_parent->m_clusters[nv] = m_clusters[v];
m_parent->m_clusters[nv]->m_parent = m_parent;
parent()->m_clusters[nv] = m_clusters[v];
parent()->m_clusters[nv]->m_parent = m_parent;
m_clusters.erase(v);
}
@ -1312,7 +1314,7 @@ public:
//get all out_edges of this cluster in the parentcluster (because only they can hold relevant global_Edgs)
std::vector<LocalEdge> edge_vec;
LocalVertex this_v = m_parent->getClusterVertex(sp_base::shared_from_this());
LocalVertex this_v = parent()->getClusterVertex(sp_base::shared_from_this());
std::pair<local_out_edge_iterator, local_out_edge_iterator> it = boost::out_edges(this_v, *parent());
for(; it.first != it.second; it.first++) {
//iterate all global edges and find relevant ones
@ -1323,14 +1325,14 @@ public:
GlobalEdge global = global_extractor()(*i);
GlobalVertex target;
//a bit cumbersome to allow cluster moving
if(m_parent->getContainingVertex(global.source).first == nv) target = global.target;
else if(m_parent->getContainingVertex(global.target).first == nv) target = global.source;
if(parent()->getContainingVertex(global.source).first == nv) target = global.target;
else if(parent()->getContainingVertex(global.target).first == nv) target = global.source;
else {
i++;
continue;
}
std::pair<LocalVertex, bool> res = m_parent->getContainingVertex(target);
std::pair<LocalVertex, bool> res = parent()->getContainingVertex(target);
//get or create the edge between the new vertex and the target
LocalEdge e;
@ -1379,7 +1381,7 @@ public:
ClusterMap m_clusters;
int test;
protected:
boost::shared_ptr<ClusterGraph> m_parent;
boost::weak_ptr<ClusterGraph> m_parent;
details::IDpointer m_id;
@ -1509,6 +1511,10 @@ protected:
};
public:
//may hold cluster properties which have Eigen3 objects and therefore need alignment
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
} //namespace solver

View File

@ -31,8 +31,12 @@
#include <boost/fusion/include/mpl.hpp>
#include <boost/fusion/include/iterator_range.hpp>
#include <boost/fusion/include/copy.hpp>
#include <boost/fusion/include/advance.hpp>
#include <boost/fusion/include/back.hpp>
#include <boost/fusion/include/iterator_range.hpp>
namespace fusion = boost::fusion;
namespace mpl = boost::mpl;
#include "kernel.hpp"
@ -65,8 +69,9 @@ template<typename Seq, typename T>
struct pushed_seq;
template<typename seq>
struct op_seq : public seq {
struct constraint_sequence : public seq {
//an equation gets added to this equation
template<typename T>
typename boost::enable_if< boost::is_base_of< dcm::EQ, T>, typename pushed_seq<seq, T>::type >::type operator &(T val) {
@ -91,13 +96,51 @@ struct op_seq : public seq {
//and return our new extendet sequence
return vec;
};
template<typename T>
void pretty(T type) {
std::cout<<"pretty: "<<__PRETTY_FUNCTION__<<std::endl;
};
//an sequence gets added to this equation (happens only if sequenced equations like coincident are used)
template<typename T>
typename boost::enable_if< mpl::is_sequence<T>, typename pushed_seq<T, seq>::type >::type operator &(T val) {
typedef typename pushed_seq<T, seq>::type Sequence;
typedef typename fusion::result_of::begin<Sequence>::type Begin;
typedef typename fusion::result_of::end<Sequence>::type End;
typedef typename mpl::distance< typename mpl::begin<T>::type, typename mpl::end<T>::type >::type distanceF;
typedef typename fusion::result_of::advance<Begin, distanceF>::type EndF;
//create the new sequence
Sequence vec;
//copy the given values into the new sequence
Begin b(vec);
EndF ef(vec);
fusion::iterator_range<Begin, EndF> range(b, ef);
fusion::copy(val, range);
//copy the objects value into the new sequence
EndF bb(vec);
End e(vec);
fusion::iterator_range<EndF, End> range2(bb, e);
fusion::copy(*this, range2);
//and return our new extendet sequence
return vec;
};
};
template<typename Seq, typename T>
struct pushed_seq {
typedef typename boost::mpl::if_<boost::mpl::is_sequence<Seq>, Seq, fusion::vector1<Seq> >::type S;
typedef typename fusion::result_of::as_vector< typename boost::mpl::push_back<S, T>::type >::type vec;
typedef op_seq<vec> type;
typedef typename mpl::if_<mpl::is_sequence<Seq>, Seq, fusion::vector1<Seq> >::type S1;
typedef typename mpl::if_<mpl::is_sequence<T>, T, fusion::vector1<T> >::type S2;
typedef typename fusion::result_of::as_vector<typename mpl::fold< S2, S1, mpl::push_back<mpl::_1,mpl::_2> >::type >::type vec;
typedef constraint_sequence<vec> type;
};
template<typename Derived, typename Option>
@ -116,6 +159,7 @@ struct Equation : public EQ {
return operator()(val);
};
//an equation gets added to this equation
template<typename T>
typename boost::enable_if< boost::is_base_of< dcm::EQ, T>, typename pushed_seq<T, Derived>::type >::type operator &(T val) {
@ -124,6 +168,32 @@ struct Equation : public EQ {
fusion::at_c<1>(vec) = *(static_cast<Derived*>(this));
return vec;
};
//an sequence gets added to this equation (happens only if sequenced equations like coincident are used)
template<typename T>
typename boost::enable_if< mpl::is_sequence<T>, typename pushed_seq<T, Derived>::type >::type operator &(T val) {
typedef typename pushed_seq<T, Derived>::type Sequence;
typedef typename fusion::result_of::begin<Sequence>::type Begin;
typedef typename fusion::result_of::end<Sequence>::type End;
typedef typename fusion::result_of::prior<End>::type EndOld;
//create the new sequence
Sequence vec;
//copy the old values into the new sequence
Begin b(vec);
EndOld eo(vec);
fusion::iterator_range<Begin, EndOld> range(b, eo);
fusion::copy(val, range);
//insert this object at the end of the sequence
fusion::back(vec) = *static_cast<Derived*>(this);
//and return our new extendet sequence
return vec;
};
};
struct Distance : public Equation<Distance, double> {
@ -221,12 +291,15 @@ struct Angle : public Equation<Angle, double> {
//template definition
Scalar calculate(Vector& param1, Vector& param2) {
assert(false);
return 0;
};
Scalar calculateGradientFirst(Vector& param1, Vector& param2, Vector& dparam1) {
assert(false);
return 0;
};
Scalar calculateGradientSecond(Vector& param1, Vector& param2, Vector& dparam2) {
assert(false);
return 0;
};
void calculateGradientFirstComplete(Vector& param1, Vector& param2, Vector& gradient) {
assert(false);

View File

@ -168,10 +168,10 @@ public:
typedef mpl::int_<Dim> Dimension;
template<typename T>
Geometry(T geometry, Sys& system);
Geometry(const T& geometry, Sys& system);
template<typename T>
void set(T geometry);
void set(const T& geometry);
template<typename Visitor>
typename Visitor::result_type apply(Visitor& vis) {
@ -229,7 +229,7 @@ public:
typename Kernel::VectorMap m_parameter; //map to the parameters in the solver
template<typename T>
void init(T& t);
void init(const T& t);
void normalize();
@ -280,7 +280,7 @@ public:
template< typename Sys, typename Derived, typename GeometrieTypeList, int Dim>
template<typename T>
Geometry<Sys, Derived, GeometrieTypeList, Dim>::Geometry(T geometry, Sys& system)
Geometry<Sys, Derived, GeometrieTypeList, Dim>::Geometry(const T& geometry, Sys& system)
: m_isInCluster(false), m_geometry(geometry), m_parameter(NULL,0,DS(0,0)),
m_clusterFixed(false), m_init(false) {
@ -294,7 +294,7 @@ Geometry<Sys, Derived, GeometrieTypeList, Dim>::Geometry(T geometry, Sys& system
template< typename Sys, typename Derived, typename GeometrieTypeList, int Dim>
template<typename T>
void Geometry<Sys, Derived, GeometrieTypeList, Dim>::set(T geometry) {
void Geometry<Sys, Derived, GeometrieTypeList, Dim>::set(const T& geometry) {
m_geometry = geometry;
init<T>(geometry);
//Base::template emitSignal<reset>( ((Derived*)this)->shared_from_this() );
@ -325,7 +325,7 @@ boost::shared_ptr<Derived> Geometry<Sys, Derived, GeometrieTypeList, Dim>::clone
template< typename Sys, typename Derived, typename GeometrieTypeList, int Dim>
template<typename T>
void Geometry<Sys, Derived, GeometrieTypeList, Dim>::init(T& t) {
void Geometry<Sys, Derived, GeometrieTypeList, Dim>::init(const T& t) {
m_BaseParameterCount = geometry_traits<T>::tag::parameters::value;
m_parameterCount = m_BaseParameterCount;

View File

@ -201,7 +201,7 @@ public:
Type1::system_init(*this);
Type2::system_init(*this);
Type3::system_init(*this);
};

View File

@ -229,6 +229,9 @@ public:
m_rotation.normalize();
return *this;
}
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
template<typename Scalar, int Dim>

View File

@ -20,6 +20,11 @@
#ifndef DCM_EXTERNALIZE_H
#define DCM_EXTERNALIZE_H
#ifdef _WIN32
//warning about to long decoraded names, won't affect the code correctness
#pragma warning( disable : 4503 )
#endif
#include <boost/preprocessor/list/for_each.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/list/append.hpp>

View File

@ -22,10 +22,16 @@
#define DCM_USE_MODULE3D
#ifdef _WIN32
//warning about to long decoraded names, won't affect the code correctness
#pragma warning( disable : 4503 )
#endif
#include "module3d/geometry.hpp"
#include "module3d/distance.hpp"
#include "module3d/parallel.hpp"
#include "module3d/angle.hpp"
#include "module3d/coincident.hpp"
#include "module3d/module.hpp"
#endif //DCM_MODULE3D_H

View File

@ -21,129 +21,133 @@
#define GCM_ANGLE_HPP
#include "geometry.hpp"
#include <opendcm/core/equations.hpp>
namespace dcm {
//the calculations( same as we always calculate directions we can outsource the work to this functions)
namespace angle_detail {
template<typename Kernel, typename T>
inline typename Kernel::number_type calc(T d1,
T d2,
typename Kernel::number_type angle) {
inline typename Kernel::number_type calc(const T& d1,
const T& d2,
const typename Kernel::number_type& angle) {
return d1.dot(d2) / (d1.norm()*d2.norm()) - angle;
return d1.dot(d2) / (d1.norm()*d2.norm()) - std::cos(angle);
};
template<typename Kernel, typename T>
inline typename Kernel::number_type calcGradFirst(T d1,
T d2,
T dd1) {
inline typename Kernel::number_type calcGradFirst(const T& d1,
const T& d2,
const T& dd1) {
typename Kernel::number_type norm = d1.norm()*d2.norm();
return dd1.dot(d2)/norm - (d1.dot(d2) * (d1.dot(dd1)/d1.norm())*d2.norm()) / std::pow(norm,2);
};
template<typename Kernel, typename T>
inline typename Kernel::number_type calcGradSecond(T d1,
T d2,
T dd2) {
inline typename Kernel::number_type calcGradSecond(const T& d1,
const T& d2,
const T& dd2) {
typename Kernel::number_type norm = d1.norm()*d2.norm();
return d1.dot(dd2)/norm - (d1.dot(d2) * (d2.dot(dd2)/d2.norm())*d1.norm()) / std::pow(norm,2);
};
template<typename Kernel, typename T>
inline void calcGradFirstComp(T d1,
T d2,
T grad) {
inline void calcGradFirstComp(const T& d1,
const T& d2,
const T& grad) {
typename Kernel::number_type norm = d1.norm()*d2.norm();
grad = d2/norm - (d1.dot(d2)/std::pow(norm,2))*d1/d1.norm();
const_cast< T& >(grad) = d2/norm - (d1.dot(d2)/std::pow(norm,2))*d1/d1.norm();
};
template<typename Kernel, typename T>
inline void calcGradSecondComp(T d1,
T d2,
T grad) {
inline void calcGradSecondComp(const T& d1,
const T& d2,
const T& grad) {
typename Kernel::number_type norm = d1.norm()*d2.norm();
grad = d1/norm - (d1.dot(d2)/std::pow(norm,2))*d2/d2.norm();
const_cast< T& >(grad) = d1/norm - (d1.dot(d2)/std::pow(norm,2))*d2/d2.norm();
};
}
/*
template< typename Kernel, typename Tag1, typename Tag2 >
struct Angle3D {
template< typename Kernel >
struct Angle::type< Kernel, tag::line3D, tag::line3D > : public dcm::PseudoScale<Kernel> {
typedef typename Kernel::number_type Scalar;
typedef typename Kernel::VectorMap Vector;
Scalar m_angle;
Angle3D(Scalar d = 0.) : m_angle(std::cos(d)) {};
option_type value;
//template definition
void setScale(Scalar scale){
assert(false);
};
Scalar calculate(Vector& param1, Vector& param2) {
assert(false);
return angle_detail::calc<Kernel>(param1.template segment<3>(3), param2.template segment<3>(3), value);
};
Scalar calculateGradientFirst(Vector& param1, Vector& param2, Vector& dparam1) {
assert(false);
return angle_detail::calcGradFirst<Kernel>(param1.template segment<3>(3), param2.template segment<3>(3), dparam1.template segment<3>(3));
};
Scalar calculateGradientSecond(Vector& param1, Vector& param2, Vector& dparam2) {
assert(false);
return angle_detail::calcGradSecond<Kernel>(param1.template segment<3>(3), param2.template segment<3>(3), dparam2.template segment<3>(3));
};
void calculateGradientFirstComplete(Vector& param1, Vector& param2, Vector& gradient) {
assert(false);
gradient.template head<3>().setZero();
angle_detail::calcGradFirstComp<Kernel>(param1.template segment<3>(3), param2.template segment<3>(3), gradient.template segment<3>(3));
};
void calculateGradientSecondComplete(Vector& param1, Vector& param2, Vector& gradient) {
assert(false);
gradient.template head<3>().setZero();
angle_detail::calcGradSecondComp<Kernel>(param1.template segment<3>(3), param2.template segment<3>(3), gradient.template segment<3>(3));
};
};
template< typename Kernel >
struct Angle3D< Kernel, tag::line3D, tag::line3D > {
struct Angle::type< Kernel, tag::line3D, tag::plane3D > : public Angle::type<Kernel, tag::line3D, tag::line3D> {};
template< typename Kernel >
struct Angle::type< Kernel, tag::line3D, tag::cylinder3D > : public Angle::type<Kernel, tag::line3D, tag::line3D> {
typedef typename Kernel::number_type Scalar;
typedef typename Kernel::VectorMap Vector;
Scalar m_angle;
void calculateGradientSecondComplete(Vector& param1, Vector& param2, Vector& gradient) {
Angle::type<Kernel, tag::line3D, tag::line3D>::calculateGradientSecondComplete(param1, param2, gradient);
gradient(6)=0;
};
};
Angle3D(Scalar d = 0.) : m_angle(std::cos(d)) {};
template< typename Kernel >
struct Angle::type< Kernel, tag::plane3D, tag::plane3D > : public Angle::type<Kernel, tag::line3D, tag::line3D> {};
template< typename Kernel >
struct Angle::type< Kernel, tag::plane3D, tag::cylinder3D > : public Angle::type<Kernel, tag::line3D, tag::line3D> {
typedef typename Kernel::VectorMap Vector;
void calculateGradientSecondComplete(Vector& param1, Vector& param2, Vector& gradient) {
Angle::type<Kernel, tag::line3D, tag::line3D>::calculateGradientSecondComplete(param1, param2, gradient);
gradient(6)=0;
};
};
template< typename Kernel >
struct Angle::type< Kernel, tag::cylinder3D, tag::cylinder3D > : public Angle::type<Kernel, tag::line3D, tag::line3D> {
typedef typename Kernel::VectorMap Vector;
void calculateGradientFirstComplete(Vector& param1, Vector& param2, Vector& gradient) {
Angle::type<Kernel, tag::line3D, tag::line3D>::calculateGradientFirstComplete(param1, param2, gradient);
gradient(6)=0;
};
Scalar getEquationScaling(typename Kernel::Vector& local1, typename Kernel::Vector& local2) {
return 1.;
}
//template definition
Scalar calculate(Vector& param1, Vector& param2) {
return angle::calc<Kernel>(param1.template tail<3>(), param2.template tail<3>(), m_angle);
};
Scalar calculateGradientFirst(Vector& param1, Vector& param2, Vector& dparam1) {
return angle::calcGradFirst<Kernel>(param1.template tail<3>(), param2.template tail<3>(), dparam1.template tail<3>());
};
Scalar calculateGradientSecond(Vector& param1, Vector& param2, Vector& dparam2) {
return angle::calcGradSecond<Kernel>(param1.template tail<3>(), param2.template tail<3>(), dparam2.template tail<3>());
};
void calculateGradientFirstComplete(Vector& param1, Vector& param2, Vector& gradient) {
gradient.template head<3>().setZero();
angle::calcGradFirstComp<Kernel>(param1.template tail<3>(), param2.template tail<3>(), gradient.template tail<3>());
};
void calculateGradientSecondComplete(Vector& param1, Vector& param2, Vector& gradient) {
gradient.template head<3>().setZero();
angle::calcGradSecondComp<Kernel>(param1.template tail<3>(), param2.template tail<3>(), gradient.template tail<3>());
Angle::type<Kernel, tag::line3D, tag::line3D>::calculateGradientSecondComplete(param1, param2, gradient);
gradient(6)=0;
};
};
//planes like lines have the direction as segment 3-5, so we can use the same implementations
template< typename Kernel >
struct Angle3D< Kernel, tag::plane3D, tag::plane3D > : public Angle3D<Kernel, tag::line3D, tag::line3D> {};
template< typename Kernel >
struct Angle3D< Kernel, tag::line3D, tag::plane3D > : public Angle3D<Kernel, tag::line3D, tag::line3D> {};
*/
}
#endif //GCM_ANGLE_HPP
#endif //GCM_ANGLE_HPP

View File

@ -135,6 +135,9 @@ private:
Scalar calcThreePoints(const typename Kernel::Vector3& p1,
const typename Kernel::Vector3& p2, const typename Kernel::Vector3& p3);
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};

View File

@ -99,13 +99,13 @@ struct Module3D {
#endif
public:
template<typename T>
Geometry3D_id(T geometry, Sys& system);
Geometry3D_id(const T& geometry, Sys& system);
template<typename T>
void set(T geometry, Identifier id);
void set(const T& geometry, Identifier id);
//somehow the base class set funtion is not found
template<typename T>
void set(T geometry);
void set(const T& geometry);
Identifier& getIdentifier();
void setIdentifier(Identifier id);
@ -117,7 +117,7 @@ struct Module3D {
typedef vertex_prop vertex_propertie;
template<typename T>
Geometry3D(T geometry, Sys& system);
Geometry3D(const T& geometry, Sys& system);
//allow accessing the internals by module3d classes but not by users
friend struct details::ClusterMath<Sys>;
@ -125,6 +125,10 @@ struct Module3D {
friend struct details::SystemSolver<Sys>;
friend struct details::SystemSolver<Sys>::Rescaler;
friend class detail::Constraint<Sys, Constraint3D, ConsSignal, MES, Geometry3D>;
public:
//the geometry class itself does not hold an aligned eigen object, but maybe the variant
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
template<typename Derived>
@ -290,7 +294,7 @@ template<typename Typelist, typename ID>
template<typename Sys>
template<typename Derived>
template<typename T>
Module3D<Typelist, ID>::type<Sys>::Geometry3D_id<Derived>::Geometry3D_id(T geometry, Sys& system)
Module3D<Typelist, ID>::type<Sys>::Geometry3D_id<Derived>::Geometry3D_id(const T& geometry, Sys& system)
: detail::Geometry<Sys, Derived, Typelist, 3>(geometry, system)
#ifdef USE_LOGGING
, log_id("No ID")
@ -306,7 +310,7 @@ template<typename Typelist, typename ID>
template<typename Sys>
template<typename Derived>
template<typename T>
void Module3D<Typelist, ID>::type<Sys>::Geometry3D_id<Derived>::set(T geometry, Identifier id) {
void Module3D<Typelist, ID>::type<Sys>::Geometry3D_id<Derived>::set(const T& geometry, Identifier id) {
this->template setProperty<id_prop<Identifier> >(id);
Base::set(geometry);
};
@ -315,7 +319,7 @@ template<typename Typelist, typename ID>
template<typename Sys>
template<typename Derived>
template<typename T>
void Module3D<Typelist, ID>::type<Sys>::Geometry3D_id<Derived>::set(T geometry) {
void Module3D<Typelist, ID>::type<Sys>::Geometry3D_id<Derived>::set(const T& geometry) {
Base::set(geometry);
};
@ -343,7 +347,7 @@ void Module3D<Typelist, ID>::type<Sys>::Geometry3D_id<Derived>::setIdentifier(Id
template<typename Typelist, typename ID>
template<typename Sys>
template<typename T>
Module3D<Typelist, ID>::type<Sys>::Geometry3D::Geometry3D(T geometry, Sys& system)
Module3D<Typelist, ID>::type<Sys>::Geometry3D::Geometry3D(const T& geometry, Sys& system)
: mpl::if_<boost::is_same<Identifier, No_Identifier>,
detail::Geometry<Sys, Geometry3D, Typelist, 3>,
Geometry3D_id<Geometry3D> >::type(geometry, system) {

View File

@ -33,9 +33,9 @@ namespace dcm {
namespace orientation_detail {
template<typename Kernel, typename T>
inline typename Kernel::number_type calc(T d1,
T d2,
Direction dir) {
inline typename Kernel::number_type calc(const T& d1,
const T& d2,
const Direction& dir) {
switch(dir) {
case equal:
@ -54,10 +54,10 @@ inline typename Kernel::number_type calc(T d1,
template<typename Kernel, typename T>
inline typename Kernel::number_type calcGradFirst(T d1,
T d2,
T dd1,
Direction dir) {
inline typename Kernel::number_type calcGradFirst(const T& d1,
const T& d2,
const T& dd1,
const Direction& dir) {
typename Kernel::number_type res;
switch(dir) {
@ -80,10 +80,10 @@ inline typename Kernel::number_type calcGradFirst(T d1,
};
template<typename Kernel, typename T>
inline typename Kernel::number_type calcGradSecond(T d1,
T d2,
T dd2,
Direction dir) {
inline typename Kernel::number_type calcGradSecond(const T& d1,
const T& d2,
const T& dd2,
const Direction& dir) {
typename Kernel::number_type res;
switch(dir) {
@ -105,45 +105,45 @@ inline typename Kernel::number_type calcGradSecond(T d1,
};
template<typename Kernel, typename T>
inline void calcGradFirstComp(T d1,
T d2,
T grad,
Direction dir) {
inline void calcGradFirstComp(const T& d1,
const T& d2,
const T& grad,
const Direction& dir) {
switch(dir) {
case equal:
grad = (d1-d2) / (d1-d2).norm();
const_cast< T& >(grad) = (d1-d2) / (d1-d2).norm();
return;
case opposite:
grad = (d1+d2) / (d1+d2).norm();
const_cast< T& >(grad) = (d1+d2) / (d1+d2).norm();
return;
case parallel:
grad = d2 - d1/d1.norm()*d2.norm();
const_cast< T& >(grad) = d2 - d1/d1.norm()*d2.norm();
return;
case perpendicular:
grad = d2;
const_cast< T& >(grad) = d2;
return;
}
};
template<typename Kernel, typename T>
inline void calcGradSecondComp(T d1,
T d2,
T grad,
Direction dir) {
inline void calcGradSecondComp(const T& d1,
const T& d2,
const T& grad,
const Direction& dir) {
switch(dir) {
case equal:
grad = (d2-d1) / (d1-d2).norm();
const_cast< T& >(grad) = (d2-d1) / (d1-d2).norm();
return;
case opposite:
grad = (d2+d1) / (d1+d2).norm();
const_cast< T& >(grad) = (d2+d1) / (d1+d2).norm();
return;
case parallel:
grad = d1 - d2/d2.norm()*d1.norm();
const_cast< T& >(grad) = d1 - d2/d2.norm()*d1.norm();
return;
case perpendicular:
grad = d1;
const_cast< T& >(grad) = d1;
return;
}
};
@ -271,7 +271,16 @@ struct Orientation::type< Kernel, tag::line3D, tag::plane3D > : public Orientati
};
template< typename Kernel >
struct Orientation::type< Kernel, tag::line3D, tag::cylinder3D > : public Orientation::type< Kernel, tag::line3D, tag::line3D > {};
struct Orientation::type< Kernel, tag::line3D, tag::cylinder3D > : public Orientation::type< Kernel, tag::line3D, tag::line3D > {
typedef typename Kernel::number_type Scalar;
typedef typename Kernel::VectorMap Vector;
void calculateGradientSecondComplete(Vector& param1, Vector& param2, Vector& gradient) {
Orientation::type<Kernel, tag::line3D, tag::line3D>::calculateGradientSecondComplete(param1, param2, gradient);
gradient(6)=0;
};
};
template< typename Kernel >
struct Orientation::type< Kernel, tag::plane3D, tag::plane3D > : public Orientation::type< Kernel, tag::line3D, tag::line3D > {};
@ -327,4 +336,4 @@ struct Orientation::type< Kernel, tag::cylinder3D, tag::cylinder3D > : public O
};
}
#endif
#endif

View File

@ -103,16 +103,16 @@ struct ModulePart {
using Object<Sys, Part, PartSignal >::m_system;
template<typename T>
Part_base(T geometry, Sys& system, boost::shared_ptr<Cluster> cluster);
Part_base(const T& geometry, Sys& system, boost::shared_ptr<Cluster> cluster);
template<typename Visitor>
typename Visitor::result_type apply(Visitor& vis);
template<typename T>
Geom addGeometry3D(T geom, CoordinateFrame frame = Global);
Geom addGeometry3D(const T& geom, CoordinateFrame frame = Global);
template<typename T>
void set(T geometry);
void set(const T& geometry);
virtual boost::shared_ptr<Part> clone(Sys& newSys);
@ -123,18 +123,22 @@ struct ModulePart {
void finishCalculation();
void fix(bool fix_value);
public:
//we hold a transform and need therefore a aligned new operator
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
struct Part_id : public Part_base {
template<typename T>
Part_id(T geometry, Sys& system, boost::shared_ptr<typename Part_base::Cluster> cluster);
Part_id(const T& geometry, Sys& system, boost::shared_ptr<typename Part_base::Cluster> cluster);
template<typename T>
typename Part_base::Geom addGeometry3D(T geom, Identifier id, CoordinateFrame frame = Global);
typename Part_base::Geom addGeometry3D(const T& geom, Identifier id, CoordinateFrame frame = Global);
template<typename T>
void set(T geometry, Identifier id);
void set(const T& geometry, Identifier id);
bool hasGeometry3D(Identifier id);
typename Part_base::Geom getGeometry3D(Identifier id);
@ -148,10 +152,14 @@ struct ModulePart {
typedef typename mpl::if_<boost::is_same<Identifier, No_Identifier>, Part_base, Part_id>::type base;
template<typename T>
Part(T geometry, Sys& system, boost::shared_ptr<typename base::Cluster> cluster);
Part(const T& geometry, Sys& system, boost::shared_ptr<typename base::Cluster> cluster);
friend struct PrepareCluster;
friend struct EvaljuateCluster;
public:
//we hold a transform and need therefore a aligned new operator
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
@ -160,11 +168,11 @@ struct ModulePart {
inheriter_base();
template<typename T>
Partptr createPart(T geometry);
Partptr createPart(const T& geometry);
void removePart(Partptr p);
template<typename T>
void setTransformation(T geom) {
void setTransformation(const T& geom) {
typedef typename system_traits<Sys>::template getModule<details::m3d>::type module3d;
details::ClusterMath<Sys>& cm = ((Sys*)this)->m_cluster->template getClusterProperty<typename module3d::math_prop>();
@ -215,7 +223,7 @@ struct ModulePart {
struct inheriter_id : public inheriter_base {
template<typename T>
Partptr createPart(T geometry, Identifier id);
Partptr createPart(const T& geometry, Identifier id);
bool hasPart(Identifier id);
Partptr getPart(Identifier id);
};
@ -256,7 +264,7 @@ struct ModulePart {
template<typename Typelist, typename ID>
template<typename Sys>
template<typename T>
ModulePart<Typelist, ID>::type<Sys>::Part_base::Part_base(T geometry, Sys& system, boost::shared_ptr<Cluster> cluster)
ModulePart<Typelist, ID>::type<Sys>::Part_base::Part_base(const T& geometry, Sys& system, boost::shared_ptr<Cluster> cluster)
: Object<Sys, Part, PartSignal>(system), m_geometry(geometry), m_cluster(cluster) {
#ifdef USE_LOGGING
@ -284,7 +292,7 @@ template<typename Typelist, typename ID>
template<typename Sys>
template<typename T>
typename ModulePart<Typelist, ID>::template type<Sys>::Part_base::Geom
ModulePart<Typelist, ID>::type<Sys>::Part_base::addGeometry3D(T geom, CoordinateFrame frame) {
ModulePart<Typelist, ID>::type<Sys>::Part_base::addGeometry3D(const T& geom, CoordinateFrame frame) {
Geom g(new Geometry3D(geom, *m_system));
if(frame == Local)
g->transform(m_transform);
@ -300,7 +308,7 @@ ModulePart<Typelist, ID>::type<Sys>::Part_base::addGeometry3D(T geom, Coordinate
template<typename Typelist, typename ID>
template<typename Sys>
template<typename T>
void ModulePart<Typelist, ID>::type<Sys>::Part_base::set(T geometry) {
void ModulePart<Typelist, ID>::type<Sys>::Part_base::set(const T& geometry) {
Part_base::m_geometry = geometry;
(typename geometry_traits<T>::modell()).template extract<Kernel,
typename geometry_traits<T>::accessor >(geometry, Part_base::m_transform);
@ -355,7 +363,7 @@ void ModulePart<Typelist, ID>::type<Sys>::Part_base::fix(bool fix_value) {
template<typename Typelist, typename ID>
template<typename Sys>
template<typename T>
ModulePart<Typelist, ID>::type<Sys>::Part_id::Part_id(T geometry, Sys& system, boost::shared_ptr<typename Part_base::Cluster> cluster)
ModulePart<Typelist, ID>::type<Sys>::Part_id::Part_id(const T& geometry, Sys& system, boost::shared_ptr<typename Part_base::Cluster> cluster)
: Part_base(geometry, system, cluster) {
};
@ -364,7 +372,7 @@ template<typename Typelist, typename ID>
template<typename Sys>
template<typename T>
typename ModulePart<Typelist, ID>::template type<Sys>::Part_base::Geom
ModulePart<Typelist, ID>::type<Sys>::Part_id::addGeometry3D(T geom, Identifier id, CoordinateFrame frame) {
ModulePart<Typelist, ID>::type<Sys>::Part_id::addGeometry3D(const T& geom, Identifier id, CoordinateFrame frame) {
typename Part_base::Geom g = Part_base::addGeometry3D(geom, frame);
g->setIdentifier(id);
@ -374,7 +382,7 @@ ModulePart<Typelist, ID>::type<Sys>::Part_id::addGeometry3D(T geom, Identifier i
template<typename Typelist, typename ID>
template<typename Sys>
template<typename T>
void ModulePart<Typelist, ID>::type<Sys>::Part_id::set(T geometry, Identifier id) {
void ModulePart<Typelist, ID>::type<Sys>::Part_id::set(const T& geometry, Identifier id) {
Part_base::set(geometry);
setIdentifier(id);
};
@ -413,7 +421,7 @@ void ModulePart<Typelist, ID>::type<Sys>::Part_id::setIdentifier(Identifier id)
template<typename Typelist, typename ID>
template<typename Sys>
template<typename T>
ModulePart<Typelist, ID>::type<Sys>::Part::Part(T geometry, Sys& system, boost::shared_ptr<typename base::Cluster> cluster)
ModulePart<Typelist, ID>::type<Sys>::Part::Part(const T& geometry, Sys& system, boost::shared_ptr<typename base::Cluster> cluster)
: mpl::if_<boost::is_same<Identifier, No_Identifier>,
Part_base, Part_id>::type(geometry, system, cluster) {
@ -429,13 +437,13 @@ template<typename Typelist, typename ID>
template<typename Sys>
template<typename T>
typename ModulePart<Typelist, ID>::template type<Sys>::Partptr
ModulePart<Typelist, ID>::type<Sys>::inheriter_base::createPart(T geometry) {
ModulePart<Typelist, ID>::type<Sys>::inheriter_base::createPart(const T& geometry) {
typedef typename system_traits<Sys>::Cluster Cluster;
std::pair<boost::shared_ptr<Cluster>, LocalVertex> res = m_this->m_cluster->createCluster();
Partptr p(new Part(geometry, * ((Sys*) this), res.first));
m_this->m_cluster->template setObject<Part> (res.second, p);
m_this->m_cluster->template setObject<Part> (res.second, p);
m_this->push_back(p);
res.first->template setClusterProperty<type_prop>(clusterPart);
@ -487,7 +495,7 @@ template<typename Typelist, typename ID>
template<typename Sys>
template<typename T>
typename ModulePart<Typelist, ID>::template type<Sys>::Partptr
ModulePart<Typelist, ID>::type<Sys>::inheriter_id::createPart(T geometry, Identifier id) {
ModulePart<Typelist, ID>::type<Sys>::inheriter_id::createPart(const T& geometry, Identifier id) {
Partptr p = inheriter_base::createPart(geometry);
p->setIdentifier(id);
return p;

View File

@ -22,6 +22,11 @@
#define DCM_USE_MODULEPART
#ifdef _WIN32
//warning about to long decoraded names, won't affect the code correctness
#pragma warning( disable : 4503 )
#endif
#include "modulePart/geometry.hpp"
#include "modulePart/module.hpp"

View File

@ -22,6 +22,11 @@
#define DCM_USE_MODULESTATE
#ifdef _WIN32
//warning about to long decoraded names, won't affect the code correctness
#pragma warning( disable : 4503 )
#endif
#include "moduleState/module.hpp"
#include "moduleState/traits.hpp"

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>

View File

@ -0,0 +1,276 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="64px"
height="64px"
id="svg2816"
version="1.1"
inkscape:version="0.47 r22583"
sodipodi:docname="Constraint_InternalAngle.svg">
<defs
id="defs2818">
<linearGradient
id="linearGradient3602">
<stop
style="stop-color:#ff2600;stop-opacity:1;"
offset="0"
id="stop3604" />
<stop
style="stop-color:#ff5f00;stop-opacity:1;"
offset="1"
id="stop3606" />
</linearGradient>
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 32 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="64 : 32 : 1"
inkscape:persp3d-origin="32 : 21.333333 : 1"
id="perspective2824" />
<inkscape:perspective
id="perspective3618"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3602-7"
id="linearGradient3608-5"
x1="3.909091"
y1="14.363636"
x2="24.81818"
y2="14.363636"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient3602-7">
<stop
style="stop-color:#c51900;stop-opacity:1;"
offset="0"
id="stop3604-1" />
<stop
style="stop-color:#ff5f00;stop-opacity:1;"
offset="1"
id="stop3606-3" />
</linearGradient>
<inkscape:perspective
id="perspective3677"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3602-5"
id="linearGradient3608-1"
x1="3.909091"
y1="14.363636"
x2="24.81818"
y2="14.363636"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient3602-5">
<stop
style="stop-color:#c51900;stop-opacity:1;"
offset="0"
id="stop3604-9" />
<stop
style="stop-color:#ff5f00;stop-opacity:1;"
offset="1"
id="stop3606-9" />
</linearGradient>
<linearGradient
y2="14.363636"
x2="24.81818"
y1="14.363636"
x1="3.909091"
gradientUnits="userSpaceOnUse"
id="linearGradient3686"
xlink:href="#linearGradient3602-5"
inkscape:collect="always" />
<inkscape:perspective
id="perspective3717"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3602-58"
id="linearGradient3608-8"
x1="3.909091"
y1="14.363636"
x2="24.81818"
y2="14.363636"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient3602-58">
<stop
style="stop-color:#c51900;stop-opacity:1;"
offset="0"
id="stop3604-2" />
<stop
style="stop-color:#ff5f00;stop-opacity:1;"
offset="1"
id="stop3606-2" />
</linearGradient>
<linearGradient
y2="14.363636"
x2="24.81818"
y1="14.363636"
x1="3.909091"
gradientUnits="userSpaceOnUse"
id="linearGradient3726"
xlink:href="#linearGradient3602-58"
inkscape:collect="always" />
<inkscape:perspective
id="perspective4410"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4944"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4966"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective5009"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective5165"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective7581"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective7606"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective7638"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective7660"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective7704"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective7730"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<filter
inkscape:collect="always"
id="filter7748">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="1.0302126"
id="feGaussianBlur7750" />
</filter>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="5.6568543"
inkscape:cx="47.112828"
inkscape:cy="30.388888"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:document-units="px"
inkscape:grid-bbox="true"
inkscape:window-width="1280"
inkscape:window-height="758"
inkscape:window-x="0"
inkscape:window-y="19"
inkscape:window-maximized="0" />
<metadata
id="metadata2821">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<path
style="opacity:0.6;color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2.97040009;marker:none;visibility:visible;display:inline;overflow:visible;filter:url(#filter7748);enable-background:accumulate"
d="m 58.670626,6.1675776 c 0,0 -44.039772,22.2580544 -48.375,24.5000004 -4.3352284,2.241947 -4.4379821,5.168785 -0.21875,7.375 4.17694,2.184101 48.59375,24.875 48.59375,24.875 l 0,-9.53125 -16.28125,-8.3125 c 1.138527,-3.135605 1.787364,-6.507214 1.8125,-10.03125 0.02691,-3.772407 -0.691139,-7.381435 -1.9375,-10.71875 l 16.40625,-8.375 0,-9.7812504 z M 36.701876,27.167578 c 0.838709,2.458011 1.300821,5.099918 1.28125,7.84375 -0.01802,2.525945 -0.445045,4.936818 -1.1875,7.21875 l -14.8125,-7.5625 14.71875,-7.5 z"
id="path7694-7"
transform="matrix(1.0011645,0,0,0.95025798,-0.03776807,1.2751141)" />
<path
style="color:#000000;fill:#ff2600;fill-opacity:1;fill-rule:nonzero;stroke:#731200;stroke-width:2.89726639;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="m 37.985931,15.315296 -5.475118,2.850774 c 2.124098,3.423877 3.348375,7.409763 3.316357,11.670356 -0.03045,4.052358 -1.180311,7.853623 -3.159926,11.135836 l 5.2874,3.088338 c 2.557545,-4.178385 4.059623,-9.018943 4.098517,-14.194479 0.03984,-5.300474 -1.45994,-10.272597 -4.06723,-14.550825 z"
id="path7694" />
<path
style="color:#000000;fill:#ff2600;fill-opacity:1;fill-rule:nonzero;stroke:#731200;stroke-width:2.16241693;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="M 7.8879306,32.73352 C 12.069734,34.80898 56.541549,56.35721 56.541549,56.35721 l 0,-9.046433 -36.712677,-17.792857 36.712677,-17.792859 0,-9.3002872 c 0,0 -44.073783,21.1575562 -48.4140588,23.2879832 -4.3402763,2.130429 -4.4637046,4.92429 -0.2395596,7.020763 z"
id="path7596"
sodipodi:nodetypes="cccccczz" />
</g>
</svg>

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"