bool
RationalBSplineSurface::Load(STEPWrapper *sw, SDAI_Application_instance *sse)
{
    step = sw;
    id = sse->STEPfile_id;

    // load base class attributes
    if (!BSplineSurface::Load(sw, sse)) {
	std::cout << CLASSNAME << ":Error loading base class ::BSplineSurface." << std::endl;
	sw->entity_status[id] = STEP_LOAD_ERROR;
	return false;
    }

    // need to do this for local attributes to makes sure we have
    // the actual entity and not a complex/supertype parent
    sse = step->getEntity(sse, ENTITYNAME);

    if (weights_data.empty()) {
	std::string attrval;
	STEPattribute *attr = step->getAttribute(sse, "weights_data");

	if (attr) {
	    GenericAggregate_ptr gp = (GenericAggregate_ptr)attr->ptr.a;
	    if (!gp) goto step_error;
	    STEPnode *sn = (STEPnode *)gp->GetHead();
	    const char *eaStr;

	    while (sn != NULL) {
		eaStr = sn->asStr(attrval);
		LIST_OF_REALS *uv = step->parseListOfReals(eaStr);
		weights_data.push_back(uv);
		sn = (STEPnode *)sn->NextNode();
	    }
	    /*
	      RealNode *rn = (RealNode *)sa->GetHead();
	      while ( rn != NULL) {
	      weights_data.insert(weights_data.end(),rn->value);
	      rn = (RealNode *)rn->NextNode();
	      }
	    */
	} else {
	    std::cout << CLASSNAME << ": Error loading RationalBSplineSurface(weights_data)." << std::endl;
	    goto step_error;
	}
    }
    sw->entity_status[id] = STEP_LOADED;
    return true;
step_error:
    sw->entity_status[id] = STEP_LOAD_ERROR;
    return false;
}
示例#2
0
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;
}