convert type "Inventor.Document" to "Inventor.PartDocument"

convert type "Inventor.Document" to "Inventor.PartDocument"

Anonymous
Not applicable
895 Views
1 Reply
Message 1 of 2

convert type "Inventor.Document" to "Inventor.PartDocument"

Anonymous
Not applicable

Hi,

i want to get the ComponetDefinition Object from a Document, but i can get it only from objects with type Inventor.PartDocument. Do I need some type conversion or anything different? VB.net/VBA is also fine for my 🙂

 

 

Inventor.Document oDoc = null;
oDoc = _invApp.Documents.Open(fileName, false); if (oDoc.DocumentType == Inventor.DocumentTypeEnum.kPartDocumentObject) { Inventor.PartDocument oPartDoc = convertToPartDoc(oDoc); Inventor.PartComponentDefinition oPartComponentDefinition = oPartDoc.ComponentDefinition; }

 

0 Likes
Accepted solutions (1)
896 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
Accepted solution

I figured it out! You just need "as".

 

PartDocument oPartDoc = oDoc as PartDocument;
0 Likes