Hello,
I am trying to use command ThisApplication.Documents.Open("fullFileName", False) to open the file silently, but it does not want to open it. If I use boolean as True (to open it visible), it works ok. Any idea what is happening, a bug?
If I remember correctly I tried the same thing with version 2016 or some version older than 2020.3.4 - not sure which one exacly and this worked.
Currently I am using Inventor 2020.3.4.
Best regards,
Rene Repina
Solved! Go to Solution.
Hello,
I am trying to use command ThisApplication.Documents.Open("fullFileName", False) to open the file silently, but it does not want to open it. If I use boolean as True (to open it visible), it works ok. Any idea what is happening, a bug?
If I remember correctly I tried the same thing with version 2016 or some version older than 2020.3.4 - not sure which one exacly and this worked.
Currently I am using Inventor 2020.3.4.
Best regards,
Rene Repina
Solved! Go to Solution.
Solved by WCrihfield. Go to Solution.
Hello again,
nevermind about upper post. I just figured out that it opens the file silently (not visible) and I can read properties from it. One thing that is still bothering me is that when I open the file silenty, it does not count it in bottom right corner. Is this normal? As far as I know, all documents should be counted in bottom right corner - visible and not visible. Correct?
Best regards,
Rene
Hello again,
nevermind about upper post. I just figured out that it opens the file silently (not visible) and I can read properties from it. One thing that is still bothering me is that when I open the file silenty, it does not count it in bottom right corner. Is this normal? As far as I know, all documents should be counted in bottom right corner - visible and not visible. Correct?
Best regards,
Rene
That number in the lower right corner of the screen can be a little unpredictable. Sometimes you have to update the document, before the number in the corner of the screen will be updated after using one of these techniques.
When you open a document invisibly (in the background) using this process:
Dim oDoc As PartDocument = ThisApplication.Documents.Open("C:\\Temp\Part3.ipt",False)
, it does not seem to add to the total number of open documents.
However when you create a new document like this:
Dim oDoc As PartDocument = ThisApplication.Documents.Add(DocumentTypeEnum.kPartDocumentObject, , False)
(which is also 'invisible'), it does add it to the total number of open documents.
There are several other scenarios that can leave behind invisible and/or 'unreferenced' documents too.
Here are a couple tools available to help clean up those documents, which are invisibly open in the background, to help free up system memory & help performance in high number situations.
You can release the reference to an invisible document, as long as it is, in fact, not being referenced by anything.
oDoc.ReleaseReference
You can also use this following line to close all invisible unreferenced documents that may be in memory. When you specify True, it releases all the unreferenced documents, and when you specify False, it works like normal to close all regular open documents.
ThisApplication.Documents.CloseAll(True)
Here is a simple iLogic rule to test this, that incorporates all the above code. To test the Add technique, un-comment that first line, then comment out the secont (Open) line, then run the rule. Then reverse the commented lines to test the Open line. Of course you may have to change the path and file name of the part is attemting to open.
'Dim oDoc As PartDocument = ThisApplication.Documents.Add(DocumentTypeEnum.kPartDocumentObject, , False)
Dim oDoc As PartDocument = ThisApplication.Documents.Open("C:\\Temp\Part3.ipt",False)
ThisApplication.ActiveDocument.Update
MsgBox("ThisApplication.Documents.Count = " & ThisApplication.Documents.Count & vbCrLf & _
"Check the number in the lower right corner of the Inventor screen to see if this is the same.",vbOKOnly," ")
'oDoc.Close(True) 'skip save
oDoc.ReleaseReference
ThisApplication.Documents.CloseAll(True)
MsgBox("ThisApplication.Documents.Count = " & ThisApplication.Documents.Count & vbCrLf & _
"Check the number in the lower right corner of the Inventor screen to see if this is the same.",vbOKOnly," ")
If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click 'LIKE' 👍.
If you have time, please... Vote For My IDEAS :light_bulb:and Explore My CONTRIBUTIONS
Inventor 2021 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum
Wesley Crihfield
(Not an Autodesk Employee)
That number in the lower right corner of the screen can be a little unpredictable. Sometimes you have to update the document, before the number in the corner of the screen will be updated after using one of these techniques.
When you open a document invisibly (in the background) using this process:
Dim oDoc As PartDocument = ThisApplication.Documents.Open("C:\\Temp\Part3.ipt",False)
, it does not seem to add to the total number of open documents.
However when you create a new document like this:
Dim oDoc As PartDocument = ThisApplication.Documents.Add(DocumentTypeEnum.kPartDocumentObject, , False)
(which is also 'invisible'), it does add it to the total number of open documents.
There are several other scenarios that can leave behind invisible and/or 'unreferenced' documents too.
Here are a couple tools available to help clean up those documents, which are invisibly open in the background, to help free up system memory & help performance in high number situations.
You can release the reference to an invisible document, as long as it is, in fact, not being referenced by anything.
oDoc.ReleaseReference
You can also use this following line to close all invisible unreferenced documents that may be in memory. When you specify True, it releases all the unreferenced documents, and when you specify False, it works like normal to close all regular open documents.
ThisApplication.Documents.CloseAll(True)
Here is a simple iLogic rule to test this, that incorporates all the above code. To test the Add technique, un-comment that first line, then comment out the secont (Open) line, then run the rule. Then reverse the commented lines to test the Open line. Of course you may have to change the path and file name of the part is attemting to open.
'Dim oDoc As PartDocument = ThisApplication.Documents.Add(DocumentTypeEnum.kPartDocumentObject, , False)
Dim oDoc As PartDocument = ThisApplication.Documents.Open("C:\\Temp\Part3.ipt",False)
ThisApplication.ActiveDocument.Update
MsgBox("ThisApplication.Documents.Count = " & ThisApplication.Documents.Count & vbCrLf & _
"Check the number in the lower right corner of the Inventor screen to see if this is the same.",vbOKOnly," ")
'oDoc.Close(True) 'skip save
oDoc.ReleaseReference
ThisApplication.Documents.CloseAll(True)
MsgBox("ThisApplication.Documents.Count = " & ThisApplication.Documents.Count & vbCrLf & _
"Check the number in the lower right corner of the Inventor screen to see if this is the same.",vbOKOnly," ")
If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click 'LIKE' 👍.
If you have time, please... Vote For My IDEAS :light_bulb:and Explore My CONTRIBUTIONS
Inventor 2021 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum
Wesley Crihfield
(Not an Autodesk Employee)
Usually, iLogic rule runs in a document. Can you please explain whole idea to open the document as invisible?
Thanks and regards,
Usually, iLogic rule runs in a document. Can you please explain whole idea to open the document as invisible?
Thanks and regards,
@chandra.shekar.g In our company, there's a certain (configuration) tool that opens parts invisibly, because it needs to read some custom iproperties from it. The part is not placed in the assembly in which the tool is run and 'we' don't want to open, read and close the part visibly because that looks bad (especially when multiple parts are to be read).
If there's a different solution, I'm very interested.
P.S. In early versions, the tool didn't read iproperties from parts. But users complained they had no indication of the result (size) during configuration. The custom info could have been stored in a config file or be hard coded in the tool, but it was decided it would be easier to manage this custom info by storing it in the part itself.
@chandra.shekar.g In our company, there's a certain (configuration) tool that opens parts invisibly, because it needs to read some custom iproperties from it. The part is not placed in the assembly in which the tool is run and 'we' don't want to open, read and close the part visibly because that looks bad (especially when multiple parts are to be read).
If there's a different solution, I'm very interested.
P.S. In early versions, the tool didn't read iproperties from parts. But users complained they had no indication of the result (size) during configuration. The custom info could have been stored in a config file or be hard coded in the tool, but it was decided it would be easier to manage this custom info by storing it in the part itself.
Hoping that suggestions in the belwo link may be helpful.
https://modthemachine.typepad.com/my_weblog/2010/03/iproperties-without-inventor-apprentice.html
Thanks and regards,
Hoping that suggestions in the belwo link may be helpful.
https://modthemachine.typepad.com/my_weblog/2010/03/iproperties-without-inventor-apprentice.html
Thanks and regards,
Hello everybody (after 2,5 - 3,5 years lol).
You are correct. The number is update, when we update the document. If it is updated right away due to some code, probably that code has automatic run for updating the document (or similar).
Also thank you for the other suggestions.
As stated in the original post, we use the "silent" open, to read from the properties (we do not have to see the model visually) and it is faster.
Also as @_dscholtes_ stated.
Hello everybody (after 2,5 - 3,5 years lol).
You are correct. The number is update, when we update the document. If it is updated right away due to some code, probably that code has automatic run for updating the document (or similar).
Also thank you for the other suggestions.
As stated in the original post, we use the "silent" open, to read from the properties (we do not have to see the model visually) and it is faster.
Also as @_dscholtes_ stated.
Can't find what you're looking for? Ask the community or share your knowledge.