void STEPWrapper::printEntity(SDAI_Application_instance *se, int level) { for (int i = 0; i < level; i++) { std::cout << " "; } std::cout << "Entity:" << se->EntityName() << "(" << se->STEPfile_id << ")" << std::endl; for (int i = 0; i < level; i++) { std::cout << " "; } std::cout << "Description:" << se->eDesc->Description() << std::endl; for (int i = 0; i < level; i++) { std::cout << " "; } std::cout << "Entity Type:" << se->eDesc->Type() << std::endl; for (int i = 0; i < level; i++) { std::cout << " "; } std::cout << "Attributes:" << std::endl; STEPattribute *attr; se->ResetAttributes(); while ((attr = se->NextAttribute()) != NULL) { std::string attrval; for (int i = 0; i <= level; i++) { std::cout << " "; } std::cout << attr->Name() << ": " << attr->asStr(attrval) << " TypeName: " << attr->TypeName() << " Type: " << attr->Type() << std::endl; if (attr->Type() == 256) { if (attr->IsDerived()) { for (int i = 0; i <= level; i++) { std::cout << " "; } std::cout << " ********* DERIVED *********" << std::endl; } else { printEntity(*(attr->ptr.c), level + 2); } } else if ((attr->Type() == SET_TYPE) || (attr->Type() == LIST_TYPE)) { STEPaggregate *sa = (STEPaggregate *)(attr->ptr.a); // std::cout << "aggr:" << sa->asStr(attrval) << " BaseType:" << attr->BaseType() << std::endl; if (attr->BaseType() == ENTITY_TYPE) { printEntityAggregate(sa, level + 2); } } } //std::cout << std::endl << std::endl; }
std::string STEPWrapper::getStringAttribute(int STEPid, const char *name) { std::string retValue = ""; SDAI_Application_instance *sse = instance_list->FindFileId(STEPid)->GetSTEPentity(); sse->ResetAttributes(); STEPattribute *attr; while ((attr = sse->NextAttribute()) != NULL) { std::string attrval; std::string attrname = attr->Name(); if (attrname.compare(name) == 0) { retValue = attr->asStr(attrval); //if (retValue.empty()) // std::cout << "String retValue:" << retValue << ":" << std::endl; break; } } return retValue; }
std::string STEPWrapper::getStringAttribute(SDAI_Application_instance *sse, const char *name) { std::string retValue = ""; sse->ResetAttributes(); STEPattribute *attr; while ((attr = sse->NextAttribute()) != NULL) { std::string attrval; std::string attrname = attr->Name(); if (attrname.compare(name) == 0) { const char *str = attr->asStr(attrval); if (str != NULL) { retValue = str; } break; } } return retValue; }