Writing an Excel program to retrieve desired dimensions from a list of Inventor Drawings

Writing an Excel program to retrieve desired dimensions from a list of Inventor Drawings

Lauren_healey
Explorer Explorer
182 Views
2 Replies
Message 1 of 3

Writing an Excel program to retrieve desired dimensions from a list of Inventor Drawings

Lauren_healey
Explorer
Explorer

I am trying to write a program in Excel to run through a list of Inventor Drawings and retrieve the desired dimensions from each drawing.

 

Right now, I am starting off simple and just trying to retrieve dimensions from the currently active document. The current issue I am facing is ActiveDocument() and ActiveEditDocument() not returning anything even when I have a drawing checked out from Vault and open in Inventor. This causes an error whenever I try to retrieve the active sheet. I know that I can at least "talk" to the Inventor application because I can have it return the filepath. So I know that it's not an issue of connecting to Inventor.

 

This is the main issue I want to solve right now, but any advice on how to handle this task as a whole would be appreciated. For instance, do I need an Add-In so that my program can access dimensions from drawings checked into Vault? The drawings do not have established parameters so I might need to find a clever way of identifying the desired dimensions. The desired dimensions do have text attached, so that might help with identification. Additionally, I would like a way to confirm whether or not a specific phrase is found in the notes of the drawing. 

0 Likes
183 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor

Hi @Lauren_healey.  After looking at the attached image, I see that you are using 'CreateObject' method, instead of 'GetObject' method.  When you 'create' a new instance of the Inventor.Application, it will not have an 'active' document yet, unless maybe you have Inventor set-up to open one every time you start Inventor.  You would need to 'get' the already running instance of Inventor, if you want to get the already 'active' document that was opened in that pre-existing instance of Inventor.

Beyond that, why are you putting "()" at the end of every 'Set' line?  That is only needed when calling a 'method' (Sub or Function) which is not asking for any 'required' input parameters.  It is not needed when just getting the value of a property.

How were the dimensions created...manually, through 'retrieve from model' process, or were they created by code?  If created by code, then with the built-in iLogic snippets, or with regular Inventor API code?  If they were created by the built-in iLogic snippets, then they may already have 'names' assigned to them, which may have been specified by the code that created them.  If so, there is a special way to retrieve those by their names (using Attributes).  If they were created by retrieving them into the drawing from the model, then there is a property of the dimension which can be checked for that (GeneralDimension.Retrieved), and another property for accessing its source object (GeneralDimension.RetrievedFrom).

I do not currently have, and have never used Vault before, so I would not be much help there.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 3

Lauren_healey
Explorer
Explorer

The dimensions that I wish to retrieve were created in the drawing view. 

0 Likes