本文整理汇总了C++中STEPattribute类的典型用法代码示例。如果您正苦于以下问题:C++ STEPattribute类的具体用法?C++ STEPattribute怎么用?C++ STEPattribute使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了STEPattribute类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
LIST_OF_SELECTS *
STEPWrapper::getListOfSelects(SDAI_Application_instance *sse, const char *name)
{
LIST_OF_SELECTS *l = new LIST_OF_SELECTS;
std::string attrval;
sse->ResetAttributes();
STEPattribute *attr;
while ((attr = sse->NextAttribute()) != NULL) {
std::string attrname = attr->Name();
if (attrname.compare(name) == 0) {
SelectAggregate *sa = (SelectAggregate *)attr->ptr.a;
SelectNode *sn = (SelectNode *)sa->GetHead();
while (sn) {
l->push_back(sn->node);
sn = (SelectNode *)sn->NextNode();
}
break;
}
}
return l;
}
示例2: Create_Rational_Surface_Aggregate
STEPentity *
Create_Rational_Surface_Aggregate(ON_NurbsSurface *nsurface, ON_Brep_Info_AP203 *info) {
STEPattribute *attr;
STEPcomplex *stepcomplex;
const char *entNmArr[8] = {"bounded_surface", "b_spline_surface", "b_spline_surface_with_knots",
"surface", "geometric_representation_item", "rational_b_spline_surface", "representation_item", "*"};
STEPcomplex *complex_entity = new STEPcomplex(info->registry, (const char **)entNmArr, info->registry->GetEntityCnt() + 1);
/*
stepcomplex = complex_entity->head;
stepcomplex->ResetAttributes();
while (stepcomplex) {
std::cout << stepcomplex->EntityName() << "\n";
while ((attr = stepcomplex->NextAttribute()) != NULL) {
std::cout << " " << attr->Name() << "," << attr->NonRefType() << "\n";
}
stepcomplex = stepcomplex->sc;
stepcomplex->ResetAttributes();
}
*/
/* Set b_spline_surface data */
stepcomplex = complex_entity->EntityPart("b_spline_surface");
stepcomplex->ResetAttributes();
while ((attr = stepcomplex->NextAttribute()) != NULL) {
if (!bu_strcmp(attr->Name(), "u_degree")) attr->ptr.i = new SDAI_Integer(nsurface->Degree(0));
if (!bu_strcmp(attr->Name(), "v_degree")) attr->ptr.i = new SDAI_Integer(nsurface->Degree(1));
if (!bu_strcmp(attr->Name(), "control_points_list")) {
GenericAggregate *control_pnts= new GenericAggregate();
ON_NurbsSurfaceCV_Initialize(nsurface, complex_entity, info);
attr->ptr.a = control_pnts;
info->surf_genagg[(STEPentity*)complex_entity] = control_pnts;
}
if (!bu_strcmp(attr->Name(), "surface_form")) attr->ptr.e = new SdaiB_spline_surface_form_var(B_spline_surface_form__unspecified);
if (!bu_strcmp(attr->Name(), "u_closed")) attr->ptr.e = new SDAI_LOGICAL((Logical)(nsurface->IsClosed(0)));
if (!bu_strcmp(attr->Name(), "v_closed")) attr->ptr.e = new SDAI_LOGICAL((Logical)(nsurface->IsClosed(1)));
if (!bu_strcmp(attr->Name(), "self_intersect")) attr->ptr.e = new SDAI_LOGICAL(LFalse);
}
/* Set knots */
stepcomplex = complex_entity->EntityPart("b_spline_surface_with_knots");
stepcomplex->ResetAttributes();
IntAggregate *u_multiplicities = new IntAggregate();
IntAggregate *v_multiplicities = new IntAggregate();
RealAggregate *u_knots = new RealAggregate();
RealAggregate *v_knots = new RealAggregate();
ON_NurbsSurfaceKnots_to_Aggregates(u_multiplicities, v_multiplicities, u_knots, v_knots, nsurface);
while ((attr = stepcomplex->NextAttribute()) != NULL) {
if (!bu_strcmp(attr->Name(), "u_multiplicities")) attr->ptr.a = u_multiplicities;
if (!bu_strcmp(attr->Name(), "v_multiplicities")) attr->ptr.a = v_multiplicities;
if (!bu_strcmp(attr->Name(), "u_knots")) attr->ptr.a = u_knots;
if (!bu_strcmp(attr->Name(), "v_knots")) attr->ptr.a = v_knots;
if (!bu_strcmp(attr->Name(), "knot_spec")) attr->ptr.e = new SdaiKnot_type_var(Knot_type__unspecified);
}
/* Set weights */
stepcomplex = complex_entity->EntityPart("rational_b_spline_surface");
stepcomplex->ResetAttributes();
while ((attr = stepcomplex->NextAttribute()) != NULL) {
if (!bu_strcmp(attr->Name(), "weights_data")) {
GenericAggregate *weights = new GenericAggregate();
for (int i = 0; i < nsurface->CVCount(0); i++) {
std::ostringstream ss;
ss << "(";
for (int j = 0; j < nsurface->CVCount(1); j++) {
if (j != 0) ss << ", ";
ss << nsurface->Weight(i,j);
}
ss << ")";
std::string str = ss.str();
weights->AddNode(new GenericAggrNode(str.c_str()));
}
attr->ptr.a = weights;
}
}
/* Representation item */
stepcomplex = complex_entity->EntityPart("representation_item");
stepcomplex->ResetAttributes();
while ((attr = stepcomplex->NextAttribute()) != NULL) {
//std::cout << " " << attr->Name() << "," << attr->NonRefType() << "\n";
if (!bu_strcmp(attr->Name(), "name")) attr->StrToVal("''");
}
return (STEPentity *)complex_entity;
}
示例3: switch
STEPcomplex * STEPutil::Geometric_Context( const LenEnum & len, const AngEnum & angle, const char * tolstr )
{
int instance_cnt = 0;
STEPattribute * attr;
STEPcomplex * stepcomplex;
SdaiDimensional_exponents * dimensional_exp = new SdaiDimensional_exponents();
dimensional_exp->length_exponent_( 0.0 );
dimensional_exp->mass_exponent_( 0.0 );
dimensional_exp->time_exponent_( 0.0 );
dimensional_exp->electric_current_exponent_( 0.0 );
dimensional_exp->thermodynamic_temperature_exponent_( 0.0 );
dimensional_exp->amount_of_substance_exponent_( 0.0 );
dimensional_exp->luminous_intensity_exponent_( 0.0 );
instance_list->Append( ( SDAI_Application_instance * ) dimensional_exp, completeSE );
instance_cnt++;
STEPcomplex * ua_length;
// First set up metric units if appropriate. Default to mm.
// If imperial units, set up mm to be used as base to define imperial units.
Si_prefix pfx = Si_prefix__milli;
switch( len )
{
case u_CM:
pfx = Si_prefix__centi;
break;
case u_M:
pfx = Si_prefix_unset;
break;
case u_MM:
case u_IN:
case u_FT:
case u_YD:
break;
}
const char * ua_length_types[4] = { "length_unit", "named_unit", "si_unit", "*" };
ua_length = new STEPcomplex( registry, ( const char ** ) ua_length_types, instance_cnt );
stepcomplex = ua_length->head;
while( stepcomplex )
{
if( !strcmp( stepcomplex->EntityName(), "Si_Unit" ) )
{
stepcomplex->ResetAttributes();
while( ( attr = stepcomplex->NextAttribute() ) != NULL )
{
if( !strcmp( attr->Name(), "prefix" ) )
{
attr->Raw()->e = new SdaiSi_prefix_var( pfx );
}
if( !strcmp( attr->Name(), "name" ) )
{
attr->Raw()->e = new SdaiSi_unit_name_var( Si_unit_name__metre );
}
}
}
stepcomplex = stepcomplex->sc;
}
instance_list->Append( ( SDAI_Application_instance * ) ua_length, completeSE );
instance_cnt++;
// If imperial, create conversion based unit.
if( len >= u_IN )
{
STEPcomplex * len_mm = ua_length;
char lenname[10];
lenname[0] = '\0';
double lenconv;
switch( len )
{
case u_IN:
strcat( lenname, "'INCH'\0" );
lenconv = 25.4;
break;
case u_FT:
strcat( lenname, "'FOOT'\0" );
lenconv = 25.4 * 12.0;
break;
case u_YD:
strcat( lenname, "'YARD'\0" );
lenconv = 25.4 * 36.0;
break;
case u_MM:
case u_CM:
case u_M:
break;
}
SdaiUnit * len_unit = new SdaiUnit( ( SdaiNamed_unit * ) len_mm );
SdaiMeasure_value * len_measure_value = new SdaiMeasure_value( lenconv, config_control_design::t_measure_value );
len_measure_value->SetUnderlyingType( config_control_design::t_length_measure );
SdaiLength_measure_with_unit * len_measure_with_unit = new SdaiLength_measure_with_unit();
len_measure_with_unit->value_component_( len_measure_value );
len_measure_with_unit->unit_component_( len_unit );
instance_list->Append( ( SDAI_Application_instance * ) len_measure_with_unit, completeSE );
instance_cnt++;
//.........这里部分代码省略.........