Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Running a macro on a part that is not in memory

1 REPLY 1
Reply
Message 1 of 2
isocam
239 Views, 1 Reply

Running a macro on a part that is not in memory

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

1 REPLY 1
Message 2 of 2
ekinsb
in reply to: isocam

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

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

Post to forums  

Autodesk Design & Make Report