Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA Classes and Enum help

Status
Not open for further replies.

JRDumont

Programmer
Apr 4, 2004
7
US
I am programming using VBA in an Autodesk product. I am able to create an array based on a propertyset. The property set has an Enum. I am not familiar with Enums. Here is the code I am using to fill a list box with the names of each item within the property set. I would like to know how to extract the rest of the information.

Dim oApp As Application
Dim oCurrentDoc As Document
Set oApp = ThisApplication
Set oCurrentDoc = oApp.ActiveDocument

Set invDocList = ThisApplication.ActiveDocument
Set invSummaryInfoList = invDocList.PropertySets.item("Inventor Summary Information")

Dim MyiPropertyList
For Each MyiPropertyList In invSummaryInfoList
UserSetupFrm.LBiPropertyList.AddItem MyiPropertyList.name
Next

Below is the information listed under the Object browser:

Member of Inventor.PropertiesForSummaryInformationEnum
Author: String (VT_STR), Editable, UI on Summary Page, Always present (default=current login name), Creator of this file.

My code will display "Author" into my list. I would like to know how to get the rest of the information that pertains to the object. For example, String, Editable etc.

I would appreciate any assistance on this.
 
Briefly, ...

Enums are a way of defining related constants as a group such that the names can be displayed by the Intellisense in the VB editor.

The enumeration names are not normally available at run time but can be obtained using the TypeLib Information Library.

All that said, I don't quite understand what you are describing - it looks like a list of attributes.

Enjoy,
Tony

------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.

I'm working (slowly) on my own website
 
Hi Tony,
Thanks for the response.

I don't know if I'm explaining it correctly. In short, I create a list of names from the proporty sets. The list can contain names like "Author", "Part Number", "Revision" and so on. However, some of the names can be "Editable" or "Read Only", I would like to excluse any names that are read only from the list. Would it be better to build the list from the TypeLib? If so, any suggestions as to where to start.

Thanks.
 
Hello,

I am not quite clear on this...are you trying to set the drawing properties using VBA?

My older version of AutoCAD does not support this, but take a look at the example in Excel for displaying the BuiltInDocumentProperties. Also look at Excel's CustomDocumentProperties.

I think "Author: String (VT_STR), Editable, UI on Summary Page, Always present (default=current login name), Creator of this file" is simply stating that the Author is a string (not an integer etc), that it is editable, that the dialog box always has a space for one, the default will be whoever logged onto the computer when the file was created, and that the author is defined as the creator of the file.

if...
Code:
MsgBox ThisDrawing.PropertiesForSummaryInformation("Author")
actually returns something then try stepping through the PropertiesForSummaryInformation

Code:
For Each PL In ThisDrawing.PropertiesForSummaryInformation
UserSetupFrm.LBiPropertyList.AddItem PL.name
Next

Some of the items cannot be changed (Read Only) like the date the file was created. Some properties (like revision level, part number, etc.) would have to be created (if they can be in Inventor) as CustomProperties. Even my old copy of autocad 2000 has custom properties in the Drawing Properties dialog box but they don't seem to be accessible to VBA.

Anyway, it's a start (unless I completely missed the point. If I did then I'm sorry for wasting your time).

GVF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top