make subassembly constraints always accessible
This commit is contained in:
parent
0a750b1bc5
commit
4441d9d2c7
|
@ -173,6 +173,21 @@ bool ItemAssembly::isParentAssembly(ItemPart* part) {
|
|||
return false;
|
||||
}
|
||||
|
||||
ItemAssembly* ItemAssembly::getToplevelAssembly() {
|
||||
|
||||
typedef std::vector<App::DocumentObject*>::const_iterator iter;
|
||||
|
||||
const std::vector<App::DocumentObject*>& vector = getInList();
|
||||
|
||||
for(iter it=vector.begin(); it != vector.end(); it++) {
|
||||
|
||||
if((*it)->getTypeId() == Assembly::ItemAssembly::getClassTypeId())
|
||||
return static_cast<Assembly::ItemAssembly*>(*it)->getToplevelAssembly();
|
||||
};
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
ItemAssembly* ItemAssembly::getParentAssembly(ItemPart* part) {
|
||||
|
||||
typedef std::vector<App::DocumentObject*>::const_iterator iter;
|
||||
|
@ -261,28 +276,28 @@ void ItemAssembly::initSolver(boost::shared_ptr<Solver> parent, Base::Placement&
|
|||
void ItemAssembly::initConstraints(boost::shared_ptr<Solver> parent) {
|
||||
|
||||
|
||||
if(!parent || !Rigid.getValue()) {
|
||||
//get the constraint group and init the constraints
|
||||
typedef std::vector<App::DocumentObject*>::const_iterator iter;
|
||||
|
||||
const std::vector<App::DocumentObject*>& vector = Annotations.getValues();
|
||||
//get the constraint group and init the constraints
|
||||
typedef std::vector<App::DocumentObject*>::const_iterator iter;
|
||||
|
||||
for(iter it=vector.begin(); it != vector.end(); it++) {
|
||||
const std::vector<App::DocumentObject*>& vector = Annotations.getValues();
|
||||
|
||||
if((*it)->getTypeId() == Assembly::ConstraintGroup::getClassTypeId())
|
||||
static_cast<ConstraintGroup*>(*it)->init(this);
|
||||
};
|
||||
for(iter it=vector.begin(); it != vector.end(); it++) {
|
||||
|
||||
// iterate down as long as a non-rigid subsystem exists
|
||||
const std::vector<App::DocumentObject*>& vector2 = Items.getValues();
|
||||
if((*it)->getTypeId() == Assembly::ConstraintGroup::getClassTypeId())
|
||||
static_cast<ConstraintGroup*>(*it)->init(this);
|
||||
};
|
||||
|
||||
for(iter it=vector2.begin(); it != vector2.end(); it++) {
|
||||
// iterate down as long as a non-rigid subsystem exists
|
||||
const std::vector<App::DocumentObject*>& vector2 = Items.getValues();
|
||||
|
||||
if((*it)->getTypeId() == Assembly::ItemAssembly::getClassTypeId())
|
||||
static_cast<Assembly::ItemAssembly*>(*it)->initConstraints(m_solver);
|
||||
for(iter it=vector2.begin(); it != vector2.end(); it++) {
|
||||
|
||||
if((*it)->getTypeId() == Assembly::ItemAssembly::getClassTypeId())
|
||||
static_cast<Assembly::ItemAssembly*>(*it)->initConstraints(m_solver);
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
//the callback for the recalculated signal
|
||||
|
|
|
@ -60,6 +60,7 @@ public:
|
|||
virtual TopoDS_Shape getShape(void) const;
|
||||
|
||||
bool isParentAssembly(ItemPart* part);
|
||||
ItemAssembly* getToplevelAssembly();
|
||||
ItemAssembly* getParentAssembly(ItemPart* part);
|
||||
|
||||
//returns the ItemPart which holds the given document object and the ItemAssembly, which holds
|
||||
|
|
|
@ -60,7 +60,8 @@ struct cloner {
|
|||
};
|
||||
|
||||
template< typename KernelType, typename T1, typename T2, typename T3 >
|
||||
System<KernelType, T1, T2, T3>::System() : m_cluster(new Cluster), m_storage(new Storage)
|
||||
System<KernelType, T1, T2, T3>::System() : m_cluster(new Cluster),
|
||||
m_storage(new Storage), m_options(new OptionOwner)
|
||||
#ifdef USE_LOGGING
|
||||
, sink(init_log())
|
||||
#endif
|
||||
|
@ -153,6 +154,8 @@ boost::shared_ptr<System<KernelType, T1, T2, T3> > System<KernelType, T1, T2, T3
|
|||
s->m_cluster = m_cluster->createCluster().first;
|
||||
s->m_storage = m_storage;
|
||||
s->m_cluster->template setProperty<dcm::type_prop>(details::subcluster);
|
||||
s->m_options = m_options;
|
||||
|
||||
#ifdef USE_LOGGING
|
||||
stop_log(s->sink);
|
||||
#endif
|
||||
|
@ -182,7 +185,7 @@ template<typename Option>
|
|||
typename boost::enable_if< boost::is_same< typename mpl::find<typename KernelType::PropertySequence, Option>::type,
|
||||
typename mpl::end<typename KernelType::PropertySequence>::type >, typename Option::type& >::type
|
||||
System<KernelType, T1, T2, T3>::getOption() {
|
||||
return m_options.template getProperty<Option>();
|
||||
return m_options->template getProperty<Option>();
|
||||
};
|
||||
|
||||
template< typename KernelType, typename T1, typename T2, typename T3 >
|
||||
|
@ -198,7 +201,7 @@ template<typename Option>
|
|||
typename boost::enable_if< boost::is_same< typename mpl::find<typename KernelType::PropertySequence, Option>::type,
|
||||
typename mpl::end<typename KernelType::PropertySequence>::type >, void >::type
|
||||
System<KernelType, T1, T2, T3>::setOption(typename Option::type value) {
|
||||
m_options.template setProperty<Option>(value);
|
||||
m_options->template setProperty<Option>(value);
|
||||
};
|
||||
|
||||
template< typename KernelType, typename T1, typename T2, typename T3 >
|
||||
|
|
|
@ -199,7 +199,7 @@ public:
|
|||
//we hold our own PropertyOwner which we use for system settings. Don't inherit it as the user
|
||||
//should not access the settings via the proeprty getter and setter functions.
|
||||
typedef PropertyOwner<typename details::properties_by_kind<properties, setting_property>::type> OptionOwner;
|
||||
OptionOwner m_options;
|
||||
boost::shared_ptr<OptionOwner> m_options;
|
||||
|
||||
|
||||
protected:
|
||||
|
|
|
@ -21,10 +21,15 @@
|
|||
#define GCM_DEFINES_3D_H
|
||||
|
||||
namespace dcm {
|
||||
|
||||
|
||||
enum SolverFailureHandling {
|
||||
IgnoreResults,
|
||||
ApplyResults
|
||||
IgnoreResults,
|
||||
ApplyResults
|
||||
};
|
||||
|
||||
enum SubsystemSolveHandling {
|
||||
Automatic,
|
||||
Manual
|
||||
};
|
||||
|
||||
//options
|
||||
|
@ -39,8 +44,19 @@ struct solverfailure {
|
|||
};
|
||||
};
|
||||
|
||||
struct subsystemsolving {
|
||||
|
||||
typedef SubsystemSolveHandling type;
|
||||
typedef setting_property kind;
|
||||
struct default_value {
|
||||
SubsystemSolveHandling operator()() {
|
||||
return Manual;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
namespace details {
|
||||
|
||||
|
||||
enum { cluster3D = 100};
|
||||
|
||||
struct m3d {}; //base of module3d::type to allow other modules check for it
|
||||
|
|
|
@ -224,7 +224,9 @@ void SystemSolver<Sys>::solveCluster(boost::shared_ptr<Cluster> cluster, Sys& sy
|
|||
boost::shared_ptr<Cluster> c = (*cit.first).second;
|
||||
|
||||
if(c->template getProperty<changed_prop>() &&
|
||||
c->template getProperty<type_prop>() == details::cluster3D)
|
||||
((c->template getProperty<type_prop>() == details::cluster3D)
|
||||
|| ((c->template getProperty<type_prop>() == details::subcluster) &&
|
||||
(sys.template getOption<subsystemsolving>() == Automatic))))
|
||||
solveCluster(c, sys);
|
||||
}
|
||||
|
||||
|
|
|
@ -269,7 +269,8 @@ struct Module3D {
|
|||
typedef GlobalEdge type;
|
||||
};
|
||||
|
||||
typedef mpl::vector5<vertex_prop, edge_prop, math_prop, fix_prop, solverfailure> properties;
|
||||
typedef mpl::vector6<vertex_prop, edge_prop, math_prop,
|
||||
fix_prop, solverfailure, subsystemsolving> properties;
|
||||
typedef mpl::vector2<Geometry3D, Constraint3D> objects;
|
||||
typedef mpl::vector5<tag::point3D, tag::direction3D, tag::line3D, tag::plane3D, tag::cylinder3D> geometries;
|
||||
typedef mpl::map0<> signals;
|
||||
|
|
|
@ -83,7 +83,9 @@ TaskAssemblyConstraints::TaskAssemblyConstraints(ViewProviderConstraint* vp)
|
|||
};
|
||||
|
||||
if(ass)
|
||||
ass->execute();
|
||||
ass->getToplevelAssembly()->execute();
|
||||
else
|
||||
return;
|
||||
|
||||
//get the individual constraint settings
|
||||
ui->value->setValue(obj->Value.getValue());
|
||||
|
|
Loading…
Reference in New Issue
Block a user