Cannot Convert Inventor._Document to Inventor.AssemblyDocument

Cannot Convert Inventor._Document to Inventor.AssemblyDocument

shiftctrl.io
Enthusiast Enthusiast
746 Views
1 Reply
Message 1 of 2

Cannot Convert Inventor._Document to Inventor.AssemblyDocument

shiftctrl.io
Enthusiast
Enthusiast

Hi All,

 

As I'm learning C#, I thought I'd play with converting some of my VB.NET stuff over to C# as practice. I'm getting jammed up pretty quick here, as I can't figure why I'm getting this error:

 

Cannot Convert Inventor._Document to Inventor.AssemblyDocument

 
 

devenv_M2FRNEcnaE.png

 

If I declare it as a Document instead of an AssemblyDocument, then I can't access the AssemblyComponentDefinition interface. 

 

 

If I cast the ActiveDocument then the error goes away, but I get another message of a suspicious cast. 

 

devenv_BkZYTpPreb.png

 

How do you normally going about getting the Active (assembly) Document via C#?

Accepted solutions (1)
747 Views
1 Reply
Reply (1)
Message 2 of 2

shiftctrl.io
Enthusiast
Enthusiast
Accepted solution

Well, not sure what is going on with that suspicious cast alert, regardless - it works just fine as long as you cast the _Document to an AssemblyDocument.

 

devenv_uDy0Q3Ccqt.png