❗ Inventor Apprentice 2022 - cannot retrieve master propertysets

❗ Inventor Apprentice 2022 - cannot retrieve master propertysets

CattabianiI
Collaborator Collaborator
2,385 Views
29 Replies
Message 1 of 30

❗ Inventor Apprentice 2022 - cannot retrieve master propertysets

CattabianiI
Collaborator
Collaborator

Apprentice is widely use to get iProperties from outside Inventor,  the manual statesIf only the FullFileName is specified for part and assembly documents, the master document within the file is opened.
This is no longer true in Inventor 2022, what I get now are the property sets of factory document in the latest saved model state.
This definitely breaks any apprentice based application.

Could you please confirm this behaviour and let me know when it will be fixed?

0 Likes
2,386 Views
29 Replies
Replies (29)
Message 2 of 30

nmunro
Collaborator
Collaborator

The 2022 API added a FilePropertySets property to the Document object. This property returns the master document property sets whereas the PropertySets property returns the property sets from the currently active model state document. You should be able to access this from an ApprenticeServer app as long as you update the Inventor Interop reference to the 2022 version.

        


https://c3mcad.com

0 Likes
Message 3 of 30

CattabianiI
Collaborator
Collaborator

FilePropertySets is not an ApprenticeServerDocument property and it does not work indeed.

FilePropertySet is equivalent to the iProperties that got from Shell Extension and you're right to suppose that a property like that should work in apprentice but it doesn't

0 Likes
Message 4 of 30

nmunro
Collaborator
Collaborator

Agreed, it does seem like they have missed this in the 2022 apprentice server implementation. I tried a couple of ideas but there didn't appear to be a way to get to the master property sets.

        


https://c3mcad.com

0 Likes
Message 5 of 30

JaneFan
Autodesk
Autodesk

Hello @CattabianiI , 

 

Sorry for the inconvience. We've already tracked this issue and will try to provide a fix in the coming release. 




Jane Fan
Inventor/Fusion QA Engineer
0 Likes
Message 6 of 30

chrisw01a
Collaborator
Collaborator

Hey guys/gals, I have a similar issue here do you think this is related?

 

https://forums.autodesk.com/t5/inventor-ilogic-api-vba-forum/help-with-sdk-quot-copy-design-quot-cop...

 

0 Likes
Message 7 of 30

chrisw01a
Collaborator
Collaborator

Is this why my part number is not being written?  The code gets the correct part number, but it does not write it into the "part number" field in iProperties.

 

---

'Get the iProperty "part number" from the current document.
Dim partNumber As Inventor.Property = openedDoc.FilePropertySets.Item("Design Tracking Properties").Item("Part Number")
'Set the partnumber field
partNumber.Value = renamePartNumber(dwgDoc)

 

---

 

 

 

Working with part 54321-101.ipt and renaming it to 99999-101.ipt

The "renamePartNumber" routine just strips out the "-101" which seems to be working fine.

 

During debug, if I hover on "partNumber.Value", I get the correct value which in this case is "-101", but it does not get written to the iProperties, it is left blank.

 

chrisw01a_0-1635424769107.png

 

 

 

0 Likes
Message 8 of 30

JaneFan
Autodesk
Autodesk

Hello @chrisw01a ,  

 

As @CattabianiI  mentioned in another thread that PropertySets.FlushToFile  is needed to make the property change be written back to the file. Do you have this step in your code?




Jane Fan
Inventor/Fusion QA Engineer
0 Likes
Message 9 of 30

chrisw01a
Collaborator
Collaborator

I do not yet but I will give it a try.  How can I know if I am manipulating the properties for "Master" model state or any other model state?

 

Thanks

0 Likes
Message 10 of 30

chrisw01a
Collaborator
Collaborator

Here is what I get when I try your suggestion:

 

chrisw01a_0-1635516143056.png

 

0 Likes
Message 11 of 30

chrisw01a
Collaborator
Collaborator

I feel like I do not have the correct reference to "Autodesk.Inventor.Interop.dll"

How can I tell?  One time I changed it and then my project would not build stating something about requiring .NET 4.0 or something...

 

chrisw01a_0-1635516371221.png

 

0 Likes
Message 12 of 30

CattabianiI
Collaborator
Collaborator

As I said in the other thread you have to update the .NET framework of your project to 4.8, update the inventor reference that you can find here: C:\Program Files\Autodesk\Inventor 2022\Bin\Public Assemblies
and then fix the compile errors due to this big update on your project.
After that looking into objects through watcher in VS or checking the inventor api manual you can find which modelstate FilePropertySets is referring to. 

0 Likes
Message 13 of 30

chrisw01a
Collaborator
Collaborator

I really appreciate your help.  I have the Inventor reference updated now, but I don't understand how to update the project to .NET 4.8.  Do I need to install something?

0 Likes
Message 14 of 30

chrisw01a
Collaborator
Collaborator

I think I got it updated.  Lol

 

chrisw01a_0-1635518417466.png

 

0 Likes
Message 15 of 30

chrisw01a
Collaborator
Collaborator

Got it!

Now to run through some scenarios.

Thank you guys!

 

chrisw01a_0-1635518899783.png

 

chrisw01a_1-1635518940093.png

 

 

0 Likes
Message 16 of 30

chrisw01a
Collaborator
Collaborator

I did not mean to hijack this thread.  Can a moderator separate my posts to a new thread or something?  Sorry about that.

 

Well I have the program working, but it looks like I have a lot of work to do in order to allow it to handle the new model states.  I do not see any reference to model states in the Apprentice documents.  Do any of you know if Apprentice can recognize model states?

 

I think when the original file is selected, the program needs to get all referenced files from the master model state even if they are suppressed that way all the files will be available in the new folder.  The way it is now, if any of the items are suppressed, they are not added to the list.  

 

Anyhow, I will probably make a new post to address this.

 

Once again, thank you all for your help.

 

Chris

 

chrisw01a_0-1635609926258.png

 

0 Likes
Message 17 of 30

CattabianiI
Collaborator
Collaborator

@chrisw01a read this thread and linked documents to better understand model states, and then go with a new post 🙂

0 Likes
Message 18 of 30

chrisw01a
Collaborator
Collaborator

Will do.  Thanks for your time.

0 Likes
Message 19 of 30

gilsdorf_e
Collaborator
Collaborator
Hello Jane,
we have tested it with Vault 2022.2 and Inventor 2022.2 and it is still not working with apprentice?

Regards
Erik
0 Likes
Message 20 of 30

CattabianiI
Collaborator
Collaborator

we have tested it with Vault 2022.2 and Inventor 2022.2 and it is still not working with apprentice?
What are you talking about?