Some way to turn off GUI? Needed fast opening of ipt file

Some way to turn off GUI? Needed fast opening of ipt file

MaciejWojda
Enthusiast Enthusiast
574 Views
6 Replies
Message 1 of 7

Some way to turn off GUI? Needed fast opening of ipt file

MaciejWojda
Enthusiast
Enthusiast

Hello dear community,

 

I have hundreds of ipt files in folder which all are programatically opened to be somehow edited by VBA script. Actions performed on the model last a small fraction of second, but the process of opening the file takes some seconds. This makes, that the time of processing all files is measured in hours.

 

Is there some way to openf ipt file without GUI? Or some other trick to accelerate the process of opening it? Or maybe some way to make VBA actions without opening by Inventor?

 

Any ideas to reduce the time to be spent for opening? Please help !

 

Best regards,

Maciej Wojda

0 Likes
Accepted solutions (1)
575 Views
6 Replies
Replies (6)
Message 2 of 7

JelteDeJong
Mentor
Mentor

- You can open files invissible by using the overload method of the open function.

ThisApplication.Documents.Open("Your file name here", False)

- Depending on what kind of actions you want to do when the file is open you could try using the Inventor Apprentice. (An example use you can find in this blog post "iProperties Without Inventor (Apprentice)")

- It sounds like you close and restart Inventor for each drawing. that is not ver efficient you could improve on that.

- You can have a look at this blog post "Improving Your Program’s Performance"

 

 

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

Message 3 of 7

MaciejWojda
Enthusiast
Enthusiast

Thank you @JelteDeJong for your fast answer, looks great.

But do you know why I have syntax error while giving second argument?

 

maciej5XLAT_1-1637838117191.png

 

 

Best regards,

Maciej Wojda

0 Likes
Message 4 of 7

JelteDeJong
Mentor
Mentor

it looks like you are trying to open the document 2 times. That will not work. Also, you are trying to close that active document. I'm not sure that an invisible document can be the active document...

This is what I expect that you need to do:

Dim doc As Document = ThisApplication.Documents.Open(File, True)

' do your stuf her with the just opend document
MsgBox("The name of the invisable opend documet is: " & doc.DisplayName)

doc.Save()
doc.Close(True)

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 5 of 7

MaciejWojda
Enthusiast
Enthusiast

Well, it in fact looks misleading, but it was just to show you that ThisApplication.Documents.Open(File) has good syntax and ThisApplication.Documents.Open(File,False) has syntax error and gets red color.

 

Anyway, your proposition also throws me syntax errors. 

maciej5XLAT_0-1637843016269.png

0 Likes
Message 6 of 7

JelteDeJong
Mentor
Mentor
Accepted solution

I didn't realise that you were using VBA. try this:

Sub test()
    Dim file
    file = "your file name"
    
    Dim doc As Document
    Set doc = ThisApplication.Documents.Open(file, True)
    ' do your stuf her with the just opend document
    MsgBox ("The name of the invisable opend documet is: " & doc.DisplayName)
    
    Call doc.Save
    doc.Close (True)
End Sub

On a side note: Last week I wrote an article with the title "Is VBA in Inventor obsolete?". You might want to read that.

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

Message 7 of 7

MaciejWojda
Enthusiast
Enthusiast

Thank you! Now it works, hovewer I tried this way before and also was wrong. I restarted Inventor tried again and it helped. 

 

Apprentice also looks nice, I will test it too.

 

I cannot find your article that you've mentioned, can you give me url?

0 Likes