Hi
I know that apprentice doesn't work when trying to use it in an Addin however, people have managed to make a dll Class that has apprentice functions and they can be used from an Addin.
Before I delve into a bunch of code that may not work, I wanted to pass these methods as ideas to if its achievable? Maybe one of the Autodesk experts could offer some help?
Option 1
Create a separate dll Class and have the apprentice functions in there. Reference the dll into the Addin. (I understand that there may be instance issues)
Option 2
Create a separate exe Class and have the apprentice functions in there. I would still need to reference the Class from the addin as it needs to collect some ClientView images to display in the Addin.
Obviously there must be a way of doing it because its been done, I just sont really want to spent a few days writing code that ultimately wont work..
Cheers
Nacho
Nacho
Automation & Design Engineer
Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC
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.
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
Hi
That would be great if you could look into it? I have had chance to check anything yet
Cheers
Nacho
Nacho
Automation & Design Engineer
Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC
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.
Hi
I need to collect a client view of a selected assembly (that i would browse to) and display it in a picturebox on a form. I would then need to save the client view as an image.
I know it cant be saved directly but i have already created a class that effectively takes a snapshot of the picturebox to create a new bitmap.
Thanks
Nacho
Nacho
Automation & Design Engineer
Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC
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.
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
Hi
In my addin, i currently have a form. on the form is a picturebox (PicBox1). I need to click a button, show the exe form, browse to the assembly using its controld and then load the clientView into a picturebox (PicBox2) on that exe form. I will then take a snapshot of the Picturebox (PicBox2) to save the visual image as a New Bitmap (Because you cannot save the ClientView as an image).
Because its an addin, i cant use apprentice directly and i cant use ClientViews inside the Addin (because they only work in apprentice). In my addin, i would reference the ClientView.exe and call the form
The form will take the snapshot, show the image in the picturebox (PicBox2), save the image to a location and store the path in a local Member. MY addin can then collect the path through the reference to retrieve the image and display it in PicBox1
Cheers
Nacho
Nacho
Automation & Design Engineer
Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC
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.
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
Hi
In Apprentice, there is a method called ClientView. This provides a visual representation of a part or assembly that is attached to a picturebox. The picturebox is required to display the clientView object even though the clientView is not exactly an image.
There is information on ClientViews in the API help file.
Cheers
Nacho
Automation & Design Engineer
Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC
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.
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
Hi,
I use the following:
Imports Inventor Imports Microsoft.VisualBasic Module MdlPreviewFile Public Sub PreviewFile() Try ' Create an instance of Apprentice. Dim apprentice As New ApprenticeServerComponent ' Open a document. Dim doc As ApprenticeServerDocument 'UFrmUpdateAndCheckInFile = the form you would like t have the image in doc = apprentice.Open(UFrmUpdateAndCheckInFile.oInvApp.ActiveDocument.FullFileName) ' Get the thumbnail image. Dim thumbnail As stdole.IPictureDisp thumbnail = doc.Thumbnail ' Convert the IPictureDisp object to an Image. Dim img As Image = Compatibility.VB6.IPictureDispToImage(thumbnail) ' Display the image in the picture box. UFrmUpdateAndCheckInFile.PbPreview.Image = img Catch ex As Exception End Try End Sub End Module
Does this help or solve the issue?
Regards,
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
I also need to figure out how to use apprentice in an addin.
This blogpost suggests it's possible: http://adndevblog.typepad.com/manufacturing/2013/01/use-apprenticeserver-api-from-an-inventor-addin....
But there is no actual explanation how to do it in this blogpost.
Quoting the first lines of the blog:
"We can create an ActiveX executable, which references the ApprenticeServer API, and which also exposes a suitable API of its own. We can then call into our ActiveX executable from an Inventor AddIn dll to request updates to any file references."
This suggests you can call apprentice as a separate process with its own API from within an Addin.
If anyone has an example visual studio project or something that shows how to do that I am very very grateful.
Hello @Cadkunde.nl
It seems that it is not an easy task to create an out-of-process ActiveX component in .NET using just C# or VB.NET.
There is a short arcticle from Microsoft where they link to some sample code combining C++ and C# or VB.NET:
But I have not looked at that sample so how useable it is I don't know.
Others typically tells you to make an exe and run a command line to do the out-of-process stuff and then use some other mechanism to get data from/to the command line exe and the in-process addin, such as temporary files, shared pipes or other program to program communication.
If you do find some sample code that enables you to run Apprentice out-of-process from an Inventor addin I think there are many others who would like to see this.
In VB6 it was much easier, but that does not help here.
Regards,
Jens Bejer Pedersendeveloper, Symetri A/S
The help file on client views refers to 'InventorViewerCtrl'
http://help.autodesk.com/view/INVNTOR/2018/ENU/?guid=GUID-06D49EB6-7871-4A1B-917F-756735B5D0E7
Maybe that is an alternative to using apprentice.
And here is a forum post with a visual studio example:
Maybe this helps you find a solution to your problem.
Nacho
Automation & Design Engineer
Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC
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.
Hi,
Did you succeed in your attempt to use apprentice from the ADDIN? I would like to do this to.. but can't seem to make it happen.
Haven't been working on this anymore.
This is all the info about apprentice in an addin:
But I haven't solved how to:
"wrap all the Apprentice related functionality into your own exe and call that from inside Inventor"
Can't find what you're looking for? Ask the community or share your knowledge.