void AddSolidsProperties(std::list<Property *> *list, HeeksObj* object) { std::list<int> solids; for(HeeksObj* child = object->GetFirstChild(); child; child = object->GetNextChild()) { if(child->GetIDGroupType() == SolidType)solids.push_back(child->GetID()); } #else void AddSolidsProperties(std::list<Property *> *list, const std::list<int> &solids) { #endif if(solids.size() == 0)list->push_back(new PropertyString(_("solids"), _("None"), NULL)); else if(solids.size() == 1)list->push_back(new PropertyInt(_("solid id"), solids.front(), NULL)); else list->push_back(new PropertyString(_("solids"), GetIntListString(solids), NULL)); } #ifdef OP_SKETCHES_AS_CHILDREN void AddSketchesProperties(std::list<Property *> *list, HeeksObj* object) { std::list<int> sketches; for(HeeksObj* child = object->GetFirstChild(); child; child = object->GetNextChild()) { if(child->GetIDGroupType() == SketchType)sketches.push_back(child->GetID()); } #else void AddSketchesProperties(std::list<Property *> *list, const std::list<int> &sketches) { #endif if(sketches.size() == 0)list->push_back(new PropertyString(_("sketches"), _("None"), NULL)); else if(sketches.size() == 1)list->push_back(new PropertyInt(_("sketch id"), sketches.front(), NULL)); else list->push_back(new PropertyString(_("sketches"), GetIntListString(sketches), NULL)); }
static void GetWorldBox(CBox &box) { // gets the extents of the volume of all the solids for(HeeksObj* object = wxGetApp().GetFirstChild(); object != NULL; object = wxGetApp().GetNextChild()) { if(object->GetIDGroupType() == SolidType) { object->GetBox(box); } } }
static bool GetSymbols(std::list< std::pair<int,unsigned int> >& symbols ) { // check for at least one sketch selected const std::list<HeeksObj*>& list = heeksCAD->GetMarkedList(); for(std::list<HeeksObj*>::const_iterator It = list.begin(); It != list.end(); It++) { HeeksObj* object = *It; if(object->GetIDGroupType() == SketchType) { symbols.push_back(std::make_pair(object->GetType(), object->m_id)); } } if(symbols.size() == 0)return false; return true; }
void CWaterline::WriteXML(TiXmlNode *root) { TiXmlElement * element = heeksCAD->NewXMLElement( "Waterline" ); heeksCAD->LinkXMLEndChild( root, element ); m_params.WriteXMLAttributes(element); // write solid ids for (HeeksObj *object = GetFirstChild(); object != NULL; object = GetNextChild()) { if (object->GetIDGroupType() != SolidType)continue; int solid = object->GetID(); TiXmlElement * solid_element = heeksCAD->NewXMLElement( "solid" ); heeksCAD->LinkXMLEndChild( element, solid_element ); solid_element->SetAttribute("id", solid); } WriteBaseXML(element); }
static bool GetSketches(std::list<int>& sketches ) { // check for at least one sketch selected const std::list<HeeksObj*>& list = heeksCAD->GetMarkedList(); for(std::list<HeeksObj*>::const_iterator It = list.begin(); It != list.end(); It++) { HeeksObj* object = *It; if(object->GetIDGroupType() == SketchType) { sketches.push_back(object->m_id); } } if(sketches.size() == 0)return false; return true; }
void CAttachOp::WriteXML(TiXmlNode *root) { TiXmlElement * element = heeksCAD->NewXMLElement( "AttachOp" ); heeksCAD->LinkXMLEndChild( root, element ); element->SetDoubleAttribute( "tolerance", m_tolerance); element->SetDoubleAttribute( "minz", m_min_z); element->SetDoubleAttribute( "material_allowance", m_material_allowance); // write solid ids #ifdef OP_SKETCHES_AS_CHILDREN for (HeeksObj *object = GetFirstChild(); object != NULL; object = GetNextChild()) { if (object->GetIDGroupType() != SolidType)continue; int solid = object->GetID(); #else for (std::list<int>::iterator It = m_solids.begin(); It != m_solids.end(); It++) { int solid = *It; #endif TiXmlElement * solid_element = heeksCAD->NewXMLElement( "solid" ); heeksCAD->LinkXMLEndChild( element, solid_element ); solid_element->SetAttribute("id", solid); } COp::WriteBaseXML(element); } // static member function HeeksObj* CAttachOp::ReadFromXMLElement(TiXmlElement* element) { CAttachOp* new_object = new CAttachOp; element->Attribute("tolerance", &new_object->m_tolerance); element->Attribute("minz", &new_object->m_min_z); element->Attribute("material_allowance", &new_object->m_material_allowance); std::list<TiXmlElement *> elements_to_remove; // read solid ids for(TiXmlElement* pElem = heeksCAD->FirstXMLChildElement( element ) ; pElem; pElem = pElem->NextSiblingElement()) { std::string name(pElem->Value()); if(name == "solid"){ for(TiXmlAttribute* a = pElem->FirstAttribute(); a; a = a->Next()) { std::string name(a->Name()); if(name == "id"){ int id = a->IntValue(); new_object->m_solids.push_back(id); } } elements_to_remove.push_back(pElem); } } for (std::list<TiXmlElement*>::iterator itElem = elements_to_remove.begin(); itElem != elements_to_remove.end(); itElem++) { heeksCAD->RemoveXMLChild( element, *itElem); } new_object->ReadBaseXML(element); return new_object; }