Home
Reply
pjp
Contributor
pjp
Posts: 10

R20 asmi_component_find_name

Hi,

 

read a CATIA V5 assembly file using InterOP/ACIS R20 but I didn't get name of sub-components by asmi_component_find_name().

In R19, I got name of components by the same api function. 

Let me know....

Spatial Employee
kedarvai
Posts: 17

Re: R20 asmi_component_find_name

Hello pjp,

You can refer to

GetComponentName function in AcisAsmMiImport.cpp from AcisAsmMiImport sample.

void

GetComponentName( component_handle* ipComponent, wchar_t

opCompName[])

{

bool got = false

;

entity_handle* pNameProp = NULL;

outcome out = asmi_component_find_property( ipComponent, ATTRIB_GEN_NAME_TYPE, pNameProp);

while

( out.ok() && NULL != pNameProp)

{

ATTRIB_GEN_NAME* pNameAttribEnt = ( ATTRIB_GEN_NAME*)( pNameProp->entity_ptr());

const char

* pAttribName = pNameAttribEnt->name();

if( 0 == strcmp( "ATTRIB_XACIS_NAME"

, pAttribName))

{

if

( is_ATTRIB_GEN_WSTRING( pNameAttribEnt))

{

ATTRIB_GEN_WSTRING* pWCharLabel = ( ATTRIB_GEN_WSTRING*)pNameAttribEnt;

const wchar_t

* pCompName = pWCharLabel->value();

wcscpy( opCompName, pCompName);

got =

true

;

}

else if

( is_ATTRIB_GEN_STRING( pNameAttribEnt))

{

ATTRIB_GEN_STRING* pCharLabel = ( ATTRIB_GEN_STRING*)pNameAttribEnt;

const char

* pCompName = pCharLabel->value();

char

compName[1024];

strcpy( compName, pCompName);

CopyFromMBCS( compName, opCompName);

got =

true

;

}

}

if

( got)

{

break

;

}

else

{

entity_handle* pNextNameProp = NULL;

out = asmi_component_find_next_property( ipComponent, ATTRIB_GEN_NAME_TYPE, pNameProp, pNextNameProp);

pNameProp = pNextNameProp;

}

}

}

- Kedar Vaishampayan
(Spatial InterOp Developer)
pjp
Contributor
pjp
Posts: 10

Re: R20 asmi_component_find_name

Hello Kedar Vaishampayan,

I used GetComponentName function, but that unusually worked.

Sometimes, the function returns the parent name of a component.

I want to get the target component's name.

 

By the way, why does asmi_component_find_name function not work in ACIS R20?

Spatial Employee
kedarvai
Posts: 17

Re: R20 asmi_component_find_name

Hello pjp,

 

It should have worked! Please submit an issue if you are seeing any incorrect or unexpectexd results.

 

We changed the way InterOp saves the names of assembly components in asat in R20. InterOp now saves names using ATTRIB_XACIS_NAME for consistency with BRep (sat) entities.

- Kedar Vaishampayan
(Spatial InterOp Developer)