Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

VBA Print Drawing from File

1 REPLY 1
Reply
Message 1 of 2
CAD-e-Shack
1323 Views, 1 Reply

VBA Print Drawing from File

Ive written a program in Inventor that finds all the drawings associated with a part/assembly.

 

it is supposed to find and open the selected drawings invisibly but for some reason the print manager wont work unless the drawing is opened and the drawing is active. In order to make the program work I have to open each drawing then close them. every time the user must input for save changes, and checking out (which is not necessary and takes forever).

 

Is there a way I can print without opening the drawing and making it active?

 

in the attached file, Ln 49-63

 

'Activate the selected document
            Set doc = ThisApplication.Documents.Open(Archive, False)

           ' The only way to make it work is to change this value to True
            Set osheets = doc.Sheets
                For X = 1 To osheets.Count
                size = osheets.item(X).size
                If first = False Then
                    Compare = size
                    first = True
                End If
' on second iteration print the document
                If Y = 2 Then
                    Call printMacro
                    Printed = True
                    'ThisApplication.ActiveDocument.Close

                ' But then I am forced to close it later. This sends up all sorts of pop up windows.
                    Exit For
                End If

 

1 REPLY 1
Message 2 of 2
pball
in reply to: CAD-e-Shack

I have two suggestions that could help. I've done basically the same before and there are tricks to dealing with popups.

 

First off when you close the drawing you can make it skip trying to save it. Try the following, the true causes it not to prompt to save when you close it.

 

ThisApplication.ActiveDocument.Close True

 

If you still get popups which need to be clicked through there is an addition thing that can be done. But if that works you shouldn't need this.

 

You can set inventor to silent operation, which will stop prompts from appearing so the script can continue to run. You would set this at the beginning of your script and you must also unset at the end or the setting will still be set after the script runs.

 

 ThisApplication.SilentOperation = True

'script here

 ThisApplication.SilentOperation = False

 

Also for VBA help using the Autodesk Inventor Customization section of the forum might get you more responses.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report