LIST_OF_ENTITIES * STEPWrapper::getListOfEntities(int STEPid, const char *name) { LIST_OF_ENTITIES *l = new LIST_OF_ENTITIES; 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) { STEPaggregate *sa = (STEPaggregate *)attr->ptr.a; EntityNode *sn = (EntityNode *)sa->GetHead(); SDAI_Application_instance *se; while (sn != NULL) { se = (SDAI_Application_instance *)sn->node; l->push_back(se); sn = (EntityNode *)sn->NextNode(); } break; } } return l; }
LIST_OF_STRINGS * STEPWrapper::getAttributes(int STEPid) { LIST_OF_STRINGS *l = new LIST_OF_STRINGS; SDAI_Application_instance *sse = instance_list->FindFileId(STEPid)->GetSTEPentity(); sse->ResetAttributes(); STEPattribute *attr; while ((attr = sse->NextAttribute()) != NULL) { std::string name = attr->Name(); l->push_back(name); } return l; }
LIST_OF_LIST_OF_POINTS * STEPWrapper::getListOfListOfPoints(int STEPid, const char *attrName) { LIST_OF_LIST_OF_POINTS *l = new LIST_OF_LIST_OF_POINTS; SDAI_Application_instance *sse = instance_list->FindFileId(STEPid)->GetSTEPentity(); sse->ResetAttributes(); STEPattribute *attr; while ((attr = sse->NextAttribute()) != NULL) { std::string attrval; std::string name = attr->Name(); if (name.compare(attrName) == 0) { ErrorDescriptor errdesc; //std::cout << attr->asStr(attrval) << std::endl; //std::cout << attr->TypeName() << std::endl; GenericAggregate_ptr gp = (GenericAggregate_ptr)attr->ptr.a; STEPnode *sn = (STEPnode *)gp->GetHead(); //EntityAggregate *ag = new EntityAggregate(); const char *eaStr; LIST_OF_POINTS *points; while (sn != NULL) { //sn->STEPwrite(std::cout); //std::cout << std::endl; eaStr = sn->asStr(attrval); points = parseListOfPointEntities(eaStr); l->push_back(points); sn = (STEPnode *)sn->NextNode(); } break; } } return l; }
double STEPWrapper::getRealAttribute(int STEPid, const char *name) { double retValue = 0.0; SDAI_Application_instance *sse = instance_list->FindFileId(STEPid)->GetSTEPentity(); sse->ResetAttributes(); STEPattribute *attr; while ((attr = sse->NextAttribute()) != NULL) { std::string attrname = attr->Name(); if (attrname.compare(name) == 0) { retValue = *attr->ptr.r; break; } } return retValue; }
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; }
Logical STEPWrapper::getLogicalAttribute(int STEPid, const char *name) { Logical retValue = LUnknown; SDAI_Application_instance *sse = instance_list->FindFileId(STEPid)->GetSTEPentity(); sse->ResetAttributes(); STEPattribute *attr; while ((attr = sse->NextAttribute()) != NULL) { std::string attrname = attr->Name(); if (attrname.compare(name) == 0) { retValue = (Logical)(*attr->ptr.e).asInt(); if (retValue > LUnknown) { retValue = LUnknown; } break; } } return retValue; }
Boolean STEPWrapper::getBooleanAttribute(int STEPid, const char *name) { Boolean retValue = BUnset; SDAI_Application_instance *sse = instance_list->FindFileId(STEPid)->GetSTEPentity(); sse->ResetAttributes(); STEPattribute *attr; while ((attr = sse->NextAttribute()) != NULL) { std::string attrname = attr->Name(); if (attrname.compare(name) == 0) { retValue = (Boolean)(*attr->ptr.e).asInt(); if (retValue > BUnset) { retValue = BUnset; } break; } } return retValue; }