Dimension List...

Dimension List...

Anonymous
Not applicable
296 Views
1 Reply
Message 1 of 2

Dimension List...

Anonymous
Not applicable
what i would like to do is create a push button that will let the user start making dimensions on a drawing, when they are completed as the hit enter i would like a list to the side of how many dims there are and the dimension itself....

Example list:
1. 4'-3"
2. 7'-5"

and so on.... anyone send me down the correct path?
0 Likes
297 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
Matthew,

I'm not sure if this is quite what you're after, but there are a few things
to learn from this (you said you were a new to VBA in another post, so I'm
explaining a lot here). If you're trying to display all the dimension values
at the completion of every Dimension command, you'll want to tap into the
AcadDocument's EndCommand event. In VBAIDE, you get to this by
double-clicking the ThisDrawing object in the Project window, then selecting
"AcadDocument" in the left drop-down list at the top of the code module
window, and then selecting EndCommand from the right drop-down list.

Every time a command ends, it triggers the EndCommand event and sends the
name of the command just ending. By examining this name, you can then decide
whether you want to do something or not. The code below watches for any
command with "DIM" as part of the command name, then iterates all the
objects in PaperSpace to find aligned and rotated dimensions. When it finds
one of these types of objects, it finds the measured length via the
Measurement property, then converts it to a string in the current drawing's
settings for units and precision and displays it in the text screen.

Private Sub AcadDocument_EndCommand(ByVal CommandName As String)
Dim oDimension As AcadDimRotated
Dim oEnt As AcadEntity
Dim Util As AcadUtility
Dim dMeasurement As Double

Set Util = ThisDrawing.Utility
If InStr(1, CommandName, "DIM") > 0 Then
For Each oEnt In ThisDrawing.PaperSpace 'where are your dimensions???
Debug.Print TypeName(oEnt)
If TypeOf oEnt Is AcadDimAligned Or TypeOf oEnt Is AcadDimRotated
Then 'include other types of dimensions???
dMeasurement = oEnt.Measurement
Util.Prompt vbCrLf & "Dim Length: " &
Util.RealToString(dMeasurement, ThisDrawing.GetVariable("lunits"),
ThisDrawing.GetVariable("luprec"))
End If
Next oEnt
End If
End Sub

This obviously gets out of control once you have a lot of dimensions in your
drawing...but should get you going in the right direction, unless I
completely misinterpreted your question.

Ben Rand
CAD Manager
CEntry Constructors & Engineers
brand@centry.net

>what i would like to do is create a push button that will let the user
>start making dimensions on a drawing, when they are completed as the hit
>enter i would >like a list to the side of how many dims there are and the
>dimension itself....

>Example list:
>1. 4'-3"
>2. 7'-5"

>and so on.... anyone send me down the correct path?
0 Likes