Addin Class with Apprentice

Addin Class with Apprentice

NachoShaw
Advisor Advisor
382 Views
2 Replies
Message 1 of 3

Addin Class with Apprentice

NachoShaw
Advisor
Advisor

Hi

 

Are you not able to use InventorApprentice & Inventor in the same Class project?

 

in my addin project, I obviously have Inventor Imported & referenced. A particular function I need requires Apprentice but it keeps erroring. I have tried many ways:

 

Dim apprentice As New InventorApprentice.ApprenticeServerComponent
Dim jdoc As InventorApprentice.ApprenticeServerDocument = apprentice.Open(pPath)
Dim apprentice As New Inventor.ApprenticeServerComponent 
Dim jdoc As Inventor.ApprenticeServerDocument = apprentice.Open(pPath)
Dim apprentice As New ApprenticeServerComponent 
Dim jdoc As ApprenticeServerDocument = apprentice.Open(pPath)

I have even tried placing the members as public in my form but I get the error:

error.png

 

when I create a NEW project and just put this in (with imports & reference)

 

Dim apprentice As New Inventor.ApprenticeServerComponent 
Dim jdoc As Inventor.ApprenticeServerDocument = apprentice.Open(pPath)
Msgbox(jdoc.FullFileName)

it works correctly and give me the full path of the file. Using a msgbox to check the same in my Addin Project gives me the error......

 

Can I use both? If not, is there a workaround? The function I need only works with Apprentice

 

 

 

Thanks

 

Nacho

 

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes
383 Views
2 Replies
Replies (2)
Message 2 of 3

NachoShaw
Advisor
Advisor

OK so I read up and come to realise that you cant use Apprentice & Inventor in the same process.... Limiting I must admit but at least I know why it doesn't work now. Which leads me to the next point..

 

As I cant use both Inventor & Apprentice in the same process, does that would also mean that even if a created a new DLL class exclusively for the Apprentice methods, it still wont work because its in the same process? That being said..

 

What is a good way to accomplish this? I don't really want to change my Addin Class to a Windows Forms application. I'm not entirely sure how I can incorporate a separate Windows Forms application to carry out the Apprentice process and then return the values to my class. My purpose is:

 

I have a picturebox on a form in my Class (Picturebox1)

I need to pass this to the class (or windows forms application) along with a file path to allow Apprentice to open it and get a ClientView

Return the ClientView to the Class Picturebox

 

does anyone have an idea or example to achieve this or similar?

 

 

Thanks

 

Nacho

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes
Message 3 of 3

NachoShaw
Advisor
Advisor

Well, ive got to say that the Inventor API is the most stupidest retarded API probably ever made. Things that should be simple are not simple. As much is I hate to say it, Solidworks API just works. No pissing around with Inventor vs Apprentice, No (you cant use Apprentice in a Class Library addin). The inventor API even leads you to believe that some things can be done inside Inventor itself like ClientViews. There is a whole section in the API for ClientViews. You set it up only to read that it actually ONLY works with Apprentice only which doesn't work from a Class Library Addin.........

 

sort it out guys

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes