surfacebody and parent feature

surfacebody and parent feature

Anonymous
Not applicable
265 Views
0 Replies
Message 1 of 1

surfacebody and parent feature

Anonymous
Not applicable
Hi,

when setting up a derived part I need to select a specific surface that is the result of a thicken feature. How can I individuate a specific surface by code and not by mouse clic? It would be nice to select by name. Is this possible?

I attach my piece of code which is as far as I am able to go. But, alas, it does not allow me to individuate the specific feature.

Thanks for your always very much appreciated help.

Ezio.



CComPtr pDerivedPartSurfaces;
pDerivedPartSurfaces=oDerivedPartDef->GetSurfaces();
nCount=pDerivedPartSurfaces->GetCount();

for( nIndex=1; nIndex<=nCount; nIndex++) {

CComPtr pDerivedPartEntity=pDerivedPartSurfaces->GetItem(CComVariant( nIndex));
CComPtr pIDispatch=pDerivedPartEntity->GetReferencedEntity();

ObjectTypeEnum nEntityType;
hr = Rx::GetObjectType( pIDispatch, &nEntityType);

switch( nEntityType) {

case kSurfaceBodyObject:

CComPtr pSurfaceBody;
hr=pIDispatch->QueryInterface( &pSurfaceBody);

CComPtr pComponentDefinition=pSurfaceBody->GetComponentDefinition();

CComPtr pIDispatchParent;
pIDispatchParent=pSurfaceBody->GetParent();

ObjectTypeEnum nEntityType;
hr = Rx::GetObjectType( pIDispatchParent, &nEntityType);

if( nEntityType == kWorkSurfaceObject) {
CComPtr pWorkSurface;
hr = pIDispatchParent->QueryInterface( &pWorkSurface);

CComPtr pIDispatch;
pIDispatch=pWorkSurface->GetParent();

CComPtr pComponentDefinition;
hr = pIDispatch->QueryInterface( &pComponentDefinition);

CComPtr pComponentOccurrences=pComponentDefinition->GetOccurrences();
int nCount=pComponentOccurrences->GetCount();

nEntityType=pComponentDefinition->GetType();

}

break;

}

}
0 Likes
266 Views
0 Replies
Replies (0)