示例#1
0
LIST_OF_ENTITIES *
STEPWrapper::getListOfEntities(SDAI_Application_instance *sse, const char *name)
{
    LIST_OF_ENTITIES *l = new LIST_OF_ENTITIES;

    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;
}
示例#2
0
bool
Direction::Load(STEPWrapper *sw,SDAI_Application_instance *sse) {
    step=sw;
    id = sse->STEPfile_id;

    if ( !GeometricRepresentationItem::Load(step,sse) ) {
	std::cout << CLASSNAME << ":Error loading base class ::GeometricRepresentationItem." << std::endl;
	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);

    STEPattribute *attr = step->getAttribute(sse,"direction_ratios");
    if (attr != NULL) {
	STEPaggregate *sa = (STEPaggregate *)(attr->ptr.a);
	RealNode *rn = (RealNode *)sa->GetHead();
	int index = 0;
	while ( rn != NULL) {
	    direction_ratios[index++] = rn->value;
	    rn = (RealNode *)rn->NextNode();
	}
    } else {
	std::cout << CLASSNAME << ": error loading 'coordinate' attribute." << std::endl;
    }

    return true;
}
示例#3
0
bool
RationalBSplineCurve::Load(STEPWrapper *sw, SDAI_Application_instance *sse)
{
    step = sw;
    id = sse->STEPfile_id;

    // load base class attributes
    if (!BSplineCurve::Load(sw, sse)) {
	std::cout << CLASSNAME << ":Error loading base class ::BSplineCurve." << std::endl;
	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()) {
	STEPattribute *attr = step->getAttribute(sse, "weights_data");

	if (attr) {
	    STEPaggregate *sa = (STEPaggregate *)(attr->ptr.a);
	    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 RationalBSplineCurve(weights_data)." << std::endl;
	    return false;
	}
    }

    return true;
}
bool
BSplineSurfaceWithKnots::Load(STEPWrapper *sw,SDAI_Application_instance *sse) {
    step=sw;
    id = sse->STEPfile_id;

    // load base class attributes
    if ( !BSplineSurface::Load(step,sse) ) {
	std::cout << CLASSNAME << ":Error loading base class ::BSplineCurve." << std::endl;
	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 (u_multiplicities.empty()) {
	STEPattribute *attr = step->getAttribute(sse,"u_multiplicities");
	if (attr) {
	    STEPaggregate *sa = (STEPaggregate *)(attr->ptr.a);
	    IntNode *in = (IntNode *)sa->GetHead();

	    while ( in != NULL) {
		u_multiplicities.push_back(in->value);
		in = (IntNode *)in->NextNode();
	    }
	} else {
	    std::cout << CLASSNAME << ": Error loading BSplineSurfaceWithKnots(u_multiplicities)." << std::endl;
	    return false;
	}
    }
    if (v_multiplicities.empty()) {
	STEPattribute *attr = step->getAttribute(sse,"v_multiplicities");
	if (attr) {
	    STEPaggregate *sa = (STEPaggregate *)(attr->ptr.a);
	    IntNode *in = (IntNode *)sa->GetHead();

	    while ( in != NULL) {
		v_multiplicities.push_back(in->value);
		in = (IntNode *)in->NextNode();
	    }
	} else {
	    std::cout << CLASSNAME << ": Error loading BSplineSurfaceWithKnots(v_multiplicities)." << std::endl;
	    return false;
	}
    }
    if (u_knots.empty()) {
	STEPattribute *attr = step->getAttribute(sse,"u_knots");
	if (attr) {
	    STEPaggregate *sa = (STEPaggregate *)(attr->ptr.a);
	    RealNode *rn = (RealNode *)sa->GetHead();

	    while ( rn != NULL) {
		u_knots.push_back(rn->value);
		rn = (RealNode *)rn->NextNode();
	    }
	} else {
	    std::cout << CLASSNAME << ": Error loading BSplineSurfaceWithKnots(knots)." << std::endl;
	    return false;
	}
    }
    if (v_knots.empty()) {
	STEPattribute *attr = step->getAttribute(sse,"v_knots");
	if (attr) {
	    STEPaggregate *sa = (STEPaggregate *)(attr->ptr.a);
	    RealNode *rn = (RealNode *)sa->GetHead();

	    while ( rn != NULL) {
		v_knots.push_back(rn->value);
		rn = (RealNode *)rn->NextNode();
	    }
	} else {
	    std::cout << CLASSNAME << ": Error loading BSplineSurfaceWithKnots(knots)." << std::endl;
	    return false;
	}
    }

    knot_spec = (Knot_type)step->getEnumAttribute(sse,"knot_spec");
    if (knot_spec > Knot_type_unset)
	knot_spec = Knot_type_unset;

    return true;
}