Custom Menu buttons

Custom Menu buttons

Anonymous
Not applicable
245 Views
3 Replies
Message 1 of 4

Custom Menu buttons

Anonymous
Not applicable
Does anyone know how to write a macro that overrides dimensions from "<>" to
say "EQ."???
0 Likes
246 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Hi Amy,
Yes. Your looking for the textoveride property of the acaddimension
object. Here's the code.
-Josh

Option Explicit
Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As
Integer

Function GetEnt() As AcadEntity
Dim ent As AcadEntity
Dim Pt As Variant
Set ent = Nothing
On Error Resume Next
Do
ThisDrawing.Utility.getentity ent, Pt, "Pick an Object :"
If Err Then
If GetAsyncKeyState(&H1B) Then
Err.Clear
Exit Do
ElseIf ThisDrawing.GetVariable("errno") = "7" Or
ThisDrawing.GetVariable("errno") = "52" Then
Err.Clear
End If
End If
If Not ent Is Nothing Then
Set GetEnt = ent
Exit Do
End If
Loop
End Function

Sub TextOveride()
Dim myDim As AcadDimension
Dim ent As AcadEntity
Set ent = GetEnt
If TypeOf ent Is AcadDimension Then
Set myDim = ent
myDim.TextOverride = "EQ."
End If
End Sub

Amy Kauper wrote:

> Does anyone know how to write a macro that overrides dimensions from "<>" to
> say "EQ."???
>
>
>
0 Likes
Message 3 of 4

Anonymous
Not applicable
do I have to put the ENTIRE code in the "macro associated with this button"
area of the custom menu box? I got the "dimedit" to come up, but couldn't
ever get it to override the "<>" I would've thought it would be simpler to
get ACAD to type text for me?

"Minkwitz Design" wrote in message
news:3C88EF79.5090301@ameritech.net...
> Hi Amy,
> Yes. Your looking for the textoveride property of the acaddimension
> object. Here's the code.
> -Josh
>
> Option Explicit
> Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As
> Integer
>
> Function GetEnt() As AcadEntity
> Dim ent As AcadEntity
> Dim Pt As Variant
> Set ent = Nothing
> On Error Resume Next
> Do
> ThisDrawing.Utility.getentity ent, Pt, "Pick an Object :"
> If Err Then
> If GetAsyncKeyState(&H1B) Then
> Err.Clear
> Exit Do
> ElseIf ThisDrawing.GetVariable("errno") = "7" Or
> ThisDrawing.GetVariable("errno") = "52" Then
> Err.Clear
> End If
> End If
> If Not ent Is Nothing Then
> Set GetEnt = ent
> Exit Do
> End If
> Loop
> End Function
>
> Sub TextOveride()
> Dim myDim As AcadDimension
> Dim ent As AcadEntity
> Set ent = GetEnt
> If TypeOf ent Is AcadDimension Then
> Set myDim = ent
> myDim.TextOverride = "EQ."
> End If
> End Sub
>
> Amy Kauper wrote:
>
> > Does anyone know how to write a macro that overrides dimensions from
"<>" to
> > say "EQ."???
> >
> >
> >
>
0 Likes
Message 4 of 4

Anonymous
Not applicable
You have to place this code in a vba project and save it somewhere. At
the command prompt, type in "vbaide". When the ide pops up, click the
insert pulldown, then module. When the module window pops up, paste in
the code, then save and close out of the ide. Place the following code
in your toolbar button:

(defun c:TxtOver()(command "-vbarun"
"c:/mydirectory/myname.dvb!textoveride"));txtover;

where mydirectory is the location of where you saved to and myname is
the name you saved as

Then you should be all set to go.
-Josh

Amy Kauper wrote:

> do I have to put the ENTIRE code in the "macro associated with this button"
> area of the custom menu box? I got the "dimedit" to come up, but couldn't
> ever get it to override the "<>" I would've thought it would be simpler to
> get ACAD to type text for me?
>
> "Minkwitz Design" wrote in message
> news:3C88EF79.5090301@ameritech.net...
>
>>Hi Amy,
>>Yes. Your looking for the textoveride property of the acaddimension
>>object. Here's the code.
>>-Josh
>>
>>Option Explicit
>>Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As
>>Integer
>>
>>Function GetEnt() As AcadEntity
>>Dim ent As AcadEntity
>>Dim Pt As Variant
>>Set ent = Nothing
>>On Error Resume Next
>>Do
>> ThisDrawing.Utility.getentity ent, Pt, "Pick an Object :"
>> If Err Then
>> If GetAsyncKeyState(&H1B) Then
>> Err.Clear
>> Exit Do
>> ElseIf ThisDrawing.GetVariable("errno") = "7" Or
>>ThisDrawing.GetVariable("errno") = "52" Then
>> Err.Clear
>> End If
>> End If
>> If Not ent Is Nothing Then
>> Set GetEnt = ent
>> Exit Do
>> End If
>>Loop
>>End Function
>>
>>Sub TextOveride()
>>Dim myDim As AcadDimension
>>Dim ent As AcadEntity
>>Set ent = GetEnt
>>If TypeOf ent Is AcadDimension Then
>> Set myDim = ent
>> myDim.TextOverride = "EQ."
>>End If
>>End Sub
>>
>>Amy Kauper wrote:
>>
>>
>>>Does anyone know how to write a macro that overrides dimensions from
>>>
> "<>" to
>
>>>say "EQ."???
>>>
>>>
>>>
>>>
>
>
0 Likes