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 Determine the identifier number of a dimension in a drawing

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
799 Views, 3 Replies

VBA Determine the identifier number of a dimension in a drawing

Hello again,

 

I'm busy with some VBA to override the text on a General dimension in a drawing.

I know how to edit the text by using:

 

Dim oDoc As DrawingDocument

Set oDoc = ThisApplication.ActiveDocument

 

Dim oDimension As GeneralDimension
Set oDimension= oDoc.ActiveSheet.DrawingDimensions.GeneralDimensions.Item(2)
oDimension.Text.FormattedText = ("Custom text here")

 

The dimension which will be edited is stated in the 'Item(2)' part of the code, thus meaning this is the 2nd dimension created.

 

Is there a way to determine which dimension has which itemnumber?

For example, I select a dimension, run a macro, and a messagebox shows me the identifier of the dimension (in this case '2').

Something like:

Msgbox(oDoc.SelectSet.Item)

 

Thanks in advance

 

 

3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

Anyone? Smiley Sad

Message 3 of 4
pball
in reply to: Anonymous

Just a word of advice. It's better to ask VBA related questions in the Inventor Customization section of the forum, better chance someone with an answer will see your thread there.
http://forums.autodesk.com/t5/Inventor-Customization/bd-p/120

Also I can't quite figure out exactly what you are looking to do. Do you want to select a dimension then edit it? If you can explain what you want your code to do someone might be able to help more.
Message 4 of 4
mrattray
in reply to: Anonymous

As pball said, it depends on what you're trying to do. There are three ways I know of that you can reference a dimension.
1) Work with the object directly. i.e. pull it from the selection set and do whatever it is your trying to do.
2) Use the GetReferenceKey method
3) Create a custom attribute embedded into the dimension object

Mike (not Matt) Rattray

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

Post to forums  

Autodesk Design & Make Report