Running a macro on a part that is not in memory

Running a macro on a part that is not in memory

isocam
Collaborator Collaborator
383 Views
1 Reply
Message 1 of 2

Running a macro on a part that is not in memory

isocam
Collaborator
Collaborator

Can anybody help???

 

If I have Inventor open can I do the following with a Inventor VBA macro?

 

Run a VBA macro on a drawing (idw) if that drawing is not visible on the screen (eg is not open in inventor)?

 

At present I have to open the drawing and run the macro. The macro in question automatically creates a "Pdf" file of the drawing.

 

I have a routine that checks to see if all drawings associated with a particular assembly (iam) have a Pdf file of the drawing. If a drawing does not the macro opens the drawing in question so that I can run the macro that creates the Pdf file.

 

All I want to do is to eliminate the drawing from being opened. I need to be able to create the Pdf file ofthe drawing silently.

 

Can this be done?

 

Many thanks in advance!!!!

 

Darren

0 Likes
384 Views
1 Reply
Reply (1)
Message 2 of 2

ekinsb
Alumni
Alumni

The drawings has to be opened by Inventor to be able to do anything with it.  However, the Documents.Open method has an argument that lets you specify if the document should be opened visibly or not.  The code below will open the drawing invisibly.  Even though it's not visible you can still use the returned Document object and the API.

 

    Dim drawDoc As DrawingDocument
    Set drawDoc = ThisApplication.Documents.Open("C:\Temp\Drawing.idw", False)

 

Double-check that the resulting PDF file is ok.  I believe it will be but there are just a few things that are dependent on the display and don't work correctly if the document is not visible.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
0 Likes