Apprentice - iProperties

Apprentice - iProperties

NachoShaw
Advisor Advisor
427 Views
0 Replies
Message 1 of 1

Apprentice - iProperties

NachoShaw
Advisor
Advisor

Hey

 

im having a bit of an issue with saving the iProperties through apprentice. With every process that adds an iproperty to a file, i am using m_oDocument.PropertySets.FlushToFile() which should be saving the changes on the document but after the process is complete and i manually go through the document, i still get the popup message

iprops.jpg

question is, if i am flushing to file, why am i still getting the popup and more importantly, how do i suppress it? I have looked for an ApprenticeDocumentSave but i cant see one. Im thinking it might be related to how i am setting this up so a little bit of guidance would be greatly appreciated. Below is what i am doing currently:

 

Private m_oServer As New Inventor.ApprenticeServerComponent
Private m_oDocument As Inventor.ApprenticeServerDocument
Private m_oRefDoc As Inventor.ApprenticeServerDocument

Sub Test(ByRef CurrDoc As AssemblyDocument)
Dim oRefDocs As DocumentsEnumerator = CurrDoc.AllReferencedDocuments
  For Each oRefDoc As Inventor.ApprenticeServerDocument In oRefDocs
     m_oDocument = m_oServer.Open(oRefDoc.FullFileName)

     'do something here to the document properties
    m_oDocument.PropertySets.FlushToFile()
    m_oDocument.Close()
    m_oDocument = Nothing
  Next
End Sub

 

Looking at my code: i am iterating through an open top level assembly. Its visible to the user so its not an apprentice model. Then for each referenced document, i am declaring it as ApprenticeServerDocument. Directly underneasth that i am setting m_oDocument as an ApprenticeServerDocument.Open("") and this is the one i am flushing to file.

 

Questions:

  1. Do i need to set oRefDoc as an ApprenticeServerDocument and if i do, do i need to open the document or can i process by simply referencing it as above?
  2. Do i also need to set m_oDocument as an ApprenticeServerDocument if i an setting oRefDoc as the same? It appears that i am opening the document twice

What is the right way to approach the document reference as an apprentice document?

 

 

Thanks

 

 

 

 

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
428 Views
0 Replies
Replies (0)