Message 1 of 1
surfacebody and parent feature

Not applicable
04-10-2009
06:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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;
}
}
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=oDerivedPartDef->GetSurfaces();
nCount=pDerivedPartSurfaces->GetCount();
for( nIndex=1; nIndex<=nCount; nIndex++) {
CComPtr
CComPtr
ObjectTypeEnum nEntityType;
hr = Rx::GetObjectType( pIDispatch, &nEntityType);
switch( nEntityType) {
case kSurfaceBodyObject:
CComPtr
hr=pIDispatch->QueryInterface( &pSurfaceBody);
CComPtr
CComPtr
pIDispatchParent=pSurfaceBody->GetParent();
ObjectTypeEnum nEntityType;
hr = Rx::GetObjectType( pIDispatchParent, &nEntityType);
if( nEntityType == kWorkSurfaceObject) {
CComPtr
hr = pIDispatchParent->QueryInterface( &pWorkSurface);
CComPtr
pIDispatch=pWorkSurface->GetParent();
CComPtr
hr = pIDispatch->QueryInterface( &pComponentDefinition);
CComPtr
int nCount=pComponentOccurrences->GetCount();
nEntityType=pComponentDefinition->GetType();
}
break;
}
}