getType and ObjectTypeEnum

Top  Previous  Next

You can use GetType (or get_Type()) to see what sort of object you have.

 

For example:

 

   CComPtr<ModelParameter> pModelParam ;

   ... other stuff

 

   // Two ways of getting the object type...

   TRACE (L"pModelParam->GetType()=%d\n",pModelParam->GetType()) ;

 

   ObjectTypeEnum ObjType ;

   pModelParam->get_Type (&ObjType) ;

 

   TRACE (L"pModelParam->get_Type()=%d\n",ObjType) ;

 

If you have initialised pModelParam properly it will return 50348544 (kModelParameterObject).

 

Other common values are:

 

    kComponentOccurrenceObject = 67113776,

    kAssemblyDocumentObject = 12291

    kPartComponentDefinitionObject = 83886592,

    kFeaturePatternElementObject = 83923968,

    kObjectCollectionObject = 2130706443,

    kWorkPlaneObject = 83887616,

    kWorkPointObject = 83893504,

    kWorkPointProxyObject = 83893664,

    kTwoPointDistanceDimConstraintProxyObject = 83905904

    kDiameterDimConstraintProxyObject = 83906672

 

This example shows that get_Type will give you a high level description, it does not tell you which sort of model parameter it is (double, count, etc). For that you need the ParameterTypeEnum.

 

The full set of values can be found in rxinventor.tlh, which will be somewhere like:

 

C:\Users\Public\Documents\Autodesk\Inventor 2017\SDK\DeveloperTools\Samples\VC++\AddIns\SimpleAddIn\x64\Debug\rxinventor.tlh

 

or in the API help file.

 

You may find this function useful, adding more cases as you need/find them:

 

CString GetObjTypeDesc (const ObjectTypeEnum eObjType)

/*

Returns a string version of the object type.

*/

{

   switch (eObjType) {

       case kWorkAxisObject:

           return CString ("kWorkAxisObject") ;

 

       case kWorkPointObject:

           return CString ("kWorkPointObject") ;

 

       case kWorkPlaneObject:

           return CString ("kWorkPlaneObject") ;

 

       case kTwoPointDistanceDimConstraintProxyObject:

           return CString ("kTwoPointDistanceDimConstraintProxyObject") ;

 

       case kDiameterDimConstraintProxyObject:

           return CString ("kDiameterDimConstraintProxyObject") ;

 

       case kTwoLineAngleDimConstraintProxyObject:

           return CString ("kTwoLineAngleDimConstraintProxyObject") ;

 

       case kTangentDistanceDimConstraintProxyObject:

           return CString ("kTangentDistanceDimConstraintProxyObject") ;

 

       case kOffsetDimConstraintProxyObject:

           return CString ("kOffsetDimConstraintProxyObject") ;

 

       case kRadiusDimConstraintProxyObject:

           return CString ("kRadiusDimConstraintProxyObject") ;

 

       case kDrawingViewObject:

           return CString ("kDrawingViewObject") ;

 

       case kMateiMateDefinitionObject:

           return CString ("kMateiMateDefinitionObject") ;

 

       case kiMateDefinitionObject :

           return CString("kiMateDefinitionObject");

 

       case kAngleiMateDefinitionObject:

           return CString("");

 

       case kFlushiMateDefinitionObject:

           return CString("kFlushiMateDefinitionObject");

 

       case kInsertiMateDefinitionObject:

           return CString("kInsertiMateDefinitionObject");

 

       case kTangentiMateDefinitionObject:

           return CString("kTangentiMateDefinitionObject");

 

       case kCompositeiMateDefinitionObject:

           return CString("kCompositeiMateDefinitionObject");

 

       case kRotateRotateiMateDefinitionObject:

           return CString("kRotateRotateiMateDefinitionObject");

 

       case kRotateTranslateiMateDefinitionObject:

           return CString("kRotateTranslateiMateDefinitionObject");

 

       case kiMateResultsObject:

           return CString("kiMateResultsObject");

 

       case kiMateResultObject:

           return CString("kiMateResultObject");

 

       case kLinearGeneralDimensionObject:

           return CString("kLinearGeneralDimensionObject");

 

       case kDiameterGeneralDimensionObject:

           return CString("kDiameterGeneralDimensionObject");

 

       default:

           {

               CString csUnknown ;

               csUnknown.Format  (L"Unknown ObjTypeEnum %d",eObjType) ;

               return csUnknown ;

           }

   }

}

 

 

 

Text, images and diagrams © 2021 Owen F. Ransen. All rights reserved. (But copy the source code as much as you want!)