diff --git a/src/Mod/Assembly/App/ItemAssembly.cpp b/src/Mod/Assembly/App/ItemAssembly.cpp index 86cf7d24c..13be0c59a 100644 --- a/src/Mod/Assembly/App/ItemAssembly.cpp +++ b/src/Mod/Assembly/App/ItemAssembly.cpp @@ -173,6 +173,21 @@ bool ItemAssembly::isParentAssembly(ItemPart* part) { return false; } +ItemAssembly* ItemAssembly::getToplevelAssembly() { + + typedef std::vector::const_iterator iter; + + const std::vector& vector = getInList(); + + for(iter it=vector.begin(); it != vector.end(); it++) { + + if((*it)->getTypeId() == Assembly::ItemAssembly::getClassTypeId()) + return static_cast(*it)->getToplevelAssembly(); + }; + + return this; +}; + ItemAssembly* ItemAssembly::getParentAssembly(ItemPart* part) { typedef std::vector::const_iterator iter; @@ -261,28 +276,28 @@ void ItemAssembly::initSolver(boost::shared_ptr parent, Base::Placement& void ItemAssembly::initConstraints(boost::shared_ptr parent) { - if(!parent || !Rigid.getValue()) { - //get the constraint group and init the constraints - typedef std::vector::const_iterator iter; - const std::vector& vector = Annotations.getValues(); + //get the constraint group and init the constraints + typedef std::vector::const_iterator iter; - for(iter it=vector.begin(); it != vector.end(); it++) { + const std::vector& vector = Annotations.getValues(); - if((*it)->getTypeId() == Assembly::ConstraintGroup::getClassTypeId()) - static_cast(*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& vector2 = Items.getValues(); + if((*it)->getTypeId() == Assembly::ConstraintGroup::getClassTypeId()) + static_cast(*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& vector2 = Items.getValues(); - if((*it)->getTypeId() == Assembly::ItemAssembly::getClassTypeId()) - static_cast(*it)->initConstraints(m_solver); + for(iter it=vector2.begin(); it != vector2.end(); it++) { + + if((*it)->getTypeId() == Assembly::ItemAssembly::getClassTypeId()) + static_cast(*it)->initConstraints(m_solver); + + }; - }; - } }; //the callback for the recalculated signal diff --git a/src/Mod/Assembly/App/ItemAssembly.h b/src/Mod/Assembly/App/ItemAssembly.h index fb08ef263..86dc5c308 100644 --- a/src/Mod/Assembly/App/ItemAssembly.h +++ b/src/Mod/Assembly/App/ItemAssembly.h @@ -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 diff --git a/src/Mod/Assembly/App/opendcm/core/imp/system_imp.hpp b/src/Mod/Assembly/App/opendcm/core/imp/system_imp.hpp index 33384fdde..005e11bce 100644 --- a/src/Mod/Assembly/App/opendcm/core/imp/system_imp.hpp +++ b/src/Mod/Assembly/App/opendcm/core/imp/system_imp.hpp @@ -60,7 +60,8 @@ struct cloner { }; template< typename KernelType, typename T1, typename T2, typename T3 > -System::System() : m_cluster(new Cluster), m_storage(new Storage) +System::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 > Systemm_cluster = m_cluster->createCluster().first; s->m_storage = m_storage; s->m_cluster->template setProperty(details::subcluster); + s->m_options = m_options; + #ifdef USE_LOGGING stop_log(s->sink); #endif @@ -182,7 +185,7 @@ template typename boost::enable_if< boost::is_same< typename mpl::find::type, typename mpl::end::type >, typename Option::type& >::type System::getOption() { - return m_options.template getProperty