How to use ApprenticeServerComponent and ApprenticeServerDocument in .Net classlibrary(c# dll)

How to use ApprenticeServerComponent and ApprenticeServerDocument in .Net classlibrary(c# dll)

vijaykumarreddy25
Contributor Contributor
669 Views
4 Replies
Message 1 of 5

How to use ApprenticeServerComponent and ApprenticeServerDocument in .Net classlibrary(c# dll)

vijaykumarreddy25
Contributor
Contributor

Hi,

Please provide solution for how to use ApprenticeServerComponent and ApprenticeServerDocument in .Net classlibrary(c# dll).

My requirement is to open document using ApprenticeServerComponent in .Net classlibrary(c# dll).

 

Thanks & Regards,

Vijay

0 Likes
670 Views
4 Replies
Replies (4)
Message 2 of 5

pcrawley
Advisor
Advisor

You might have more luck reposting over on the customisation forum here: 

Inventor iLogic and VB.net Forum - Autodesk Community

 

One of the forum moderators can move this post for you.

Peter
Message 3 of 5

JelteDeJong
Mentor
Mentor

You might want to look at this post "iProperties Without Inventor (Apprentice)". In the post, they use vb.net. I translated to C# (but did not test it.) it looks something like this:

Inventor.ApprenticeServerComponent apprentice = new Inventor.ApprenticeServerComponent();
Inventor.ApprenticeServerDocument apprenticeDoc = apprentice.Open(Filename);

Inventor.PropertySet summaryPropSet = apprenticeDoc.PropertySets["Inventor Document Summary Information"];
Inventor.Property companyProp = summaryPropSet["Company"];
companyProp.Value = "www.hjalte.nl";

apprenticeDoc.PropertySets.FlushToFile();

apprenticeDoc.Close();

 

Jelte de Jong
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.

EESignature


Blog: hjalte.nl - github.com

0 Likes
Message 4 of 5

vijaykumarreddy25
Contributor
Contributor

Thank you for your response JelteDeJong.


Inventor.ApprenticeServerComponent apprentice = new Inventor.ApprenticeServerComponent();
Inventor.ApprenticeServerDocument apprenticeDoc = apprentice.Open(Filename);
Inventor.PropertySet summaryPropSet = apprenticeDoc.PropertySets["Inventor Document Summary Information"];
Inventor.Property companyProp = summaryPropSet["Company"];
companyProp.Value = "www.hjalte.nl";
apprenticeDoc.PropertySets.FlushToFile();
apprenticeDoc.Close();


The above code it is working fine for Console Application(C#) or Windows Application(C#).
But in class library (dll) it is not working.
Can you please let me know is there any solution is there to execute in class library (dll).

Thanks & Regards,
Vijay

0 Likes
Message 5 of 5

jjstr8
Collaborator
Collaborator

Is the platform target for your application using the DLL set to x64? It cannot be 'Any CPU'

 

Edit:  Just to clarify, it can't be 'Any CPU' with 'Prefer 32-bit' checked (which is the default).  So either unchecking 'Prefer 32-bit' with 'Any CPU' or selecting x64 will work.

0 Likes