Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

String from DocumentTypeEnum in C++

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
oransen
347 Views, 2 Replies

String from DocumentTypeEnum in C++

Just so I don't reinvent the wheel, is there a function which returns the currently open document type as a string, something like this:

 

const char* const GetInventorDocTypeDesc(DocumentTypeEnum eDocTypeEnum);

 

? If you see what I mean. Any sort of string will be fine.

2 REPLIES 2
Message 2 of 3
oransen
in reply to: oransen

I've written my own:

 

 

 

typedef struct {
    DocumentTypeEnum eEnum ;
    const char* const pszDesc ;
} DocDesc_t;

const DocDesc_t kDocDescs [] = {
    {kAssemblyDocumentObject,      "Assembly Document"}, 
    {kDesignElementDocumentObject, "Design Element Document"}, 
    {kDrawingDocumentObject,       "Drawing Document"},
    {kForeignModelDocumentObject,  "Foreign Model Document"}, 
    {kNoDocument,                  "No Document"},
    {kPartDocumentObject,          "Part Document"}, 
    {kPresentationDocumentObject,  "Presentation Document"}, 
    {kSATFileDocumentObject,       "SAT File Document"},
    {kUnknownDocumentObject,       "Unknown Document"}
} ;

static const UINT ikNumDocTypeDescs = sizeof (kDocDescs)/sizeof(kDocDescs[0]) ;


const char* const GetInventorDocTypeDesc(const DocumentTypeEnum eDocTypeEnum) 
{
    for (UINT i = 0 ; i < ikNumDocTypeDescs ; i++) {
        if (kDocDescs[i].eEnum == eDocTypeEnum) {
            return kDocDescs[i].pszDesc ;
        }
    }

    // This is an error, I handle it recursively...
    return (GetInventorDocTypeDesc(kUnknownDocumentObject)) ;
}

 

Message 3 of 3
oransen
in reply to: oransen

Thanks!

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report