PDA

View Full Version : Solved: AutoCAD 2004 - User Preferences



malik641
02-28-2006, 08:55 AM
Hey everyone :hi:

I'm new to AutoCAD VBA, so bear with me.

I'm looking for a way to have...in a sense...a switch. What I'm looking to switch is in the Right-Click Customization section under Tools --> Options... --> User Preferences --> Right-Click Customization... --> Edit mode

In the Edit Mode frame, I want to switch from "Repeat Last Command" to "Shortcut Menu" and vice versa. It could just be a boolean check or something. Just a switch from one to the other. Independant from what has already been selected.

Any ideas to get me rolling on the right track?

TIA

lucas
02-28-2006, 11:16 AM
Hi Joseph,
could you be more specific about what you want to happen when you right click on an object. Do you want to see the shortcut menu or do you want to repeat last command? I may not understand your question.

malik641
02-28-2006, 12:11 PM
Hi Joseph,
could you be more specific about what you want to happen when you right click on an object. Do you want to see the shortcut menu or do you want to repeat last command? I may not understand your question.
I want the code to switch this option from one to the other for when I right click, based on what the option is already set to.

What I'm going to do is make this procedure execute via Toolbar button. If my right click repeats the last command, then when I press the button I want it to switch to the shortcut menu for right clicks. And if I right click and I get the shortcut menu, then when I press the button I want the code to switch it to "Repeat Last Command" for right clicks.

Basically like a ON<-->ON switch. Make sense?

If not then I'm sorry and I'll try to explain further.

malik641
02-28-2006, 01:37 PM
Well, we're getting there.

Here's what I ended up with:

Option Explicit
Sub Change_RightClick()
Dim AcadPrefUser As AcadPreferencesUser
Set AcadPrefUser = ThisDrawing.Application.Preferences.User
If AcadPrefUser.ShortCutMenuDisplay = True Then
AcadPrefUser.ShortCutMenuDisplay = False
Else
AcadPrefUser.ShortCutMenuDisplay = True
End If

End Sub

Unfortunately all this does is Uncheck the "ShortCutMenu In Drawing Area" checkbox in the "Windows Standard Behavior" frame...outside the "Right Click Customization..." button.

Hmmmm....:think:

Tommy
03-01-2006, 02:51 PM
Hi Joseph,

You almost had it, once you turn on the shorcut menu display you have to set the default action, also I placed it in the ThisDocument code pane. I couldn't get the Change_RightClick to fire so I moved it to the sub below. I have 2000i so that may be the problem.


Private Sub AcadDocument_BeginRightClick(ByVal PickPoint As Variant)
Dim AcadPrefUser As AcadPreferencesUser
Set AcadPrefUser = ThisDrawing.Application.Preferences.User
If AcadPrefUser.ShortCutMenuDisplay = True Then
AcadPrefUser.ShortCutMenuDisplay = False
AcadPrefUser.SCMDefaultMode = acRepeatLastCommand
Else
AcadPrefUser.ShortCutMenuDisplay = True
AcadPrefUser.SCMDefaultMode = acSCM
End If
End Sub


Hey lucas! :hi:

lucas
03-01-2006, 03:12 PM
Hey Tommy, Glad to see you......guess your doin ok or I would have heard, right.

Tommy
03-01-2006, 03:46 PM
Lots and Lots of work, haven't even had time to play :(

malik641
03-02-2006, 08:56 AM
Tommy,

Thanks for the code, it got me to where I needed to go :thumb

I wasn't wording myself correctly...sorry guys, I still have plenty to learn about the ins and outs of AutoCAD. Apparently I wanted to change the value of the "Edit" mode.

You'll see what I was trying to accomplish with the following code:

Option Explicit
Sub Change_RightClick()
Dim AcadPrefUser As AcadPreferencesUser
Set AcadPrefUser = ThisDrawing.Application.Preferences.User
If AcadPrefUser.SCMEditMode = acEdRepeatLastCommand Then
AcadPrefUser.SCMEditMode = acEdSCM
Else
AcadPrefUser.SCMEditMode = acEdRepeatLastCommand
End If
End Sub
And to make this fire, I set it to a ToolBar user defined button. I basically wanted a switch...and now I have it :)

Whoo! First macro in AutoCAD :rofl: Thanks for the help guys!

Tommy
03-02-2006, 09:10 AM
Joseph, just for more information there is a way to customize the default pop-up menu to run your macros. It is very useful. The link below will show how in acad 2000i.

http://www.vbaexpress.com/forum/showthread.php?t=2696

If you need more help let me know :)

malik641
03-03-2006, 10:54 AM
Tommy,
I see what you're saying about the pop-up menu, and thanks for showing me how to customize it...I know I'll have a good use for it :thumb But for this case, I won't have a use for it. Because this macro is specifically for me, and I like the Repeat Last Command for the right-click more than the shortcut menu....I only use the SCM for a few things, which is why I won't have much use putting macros inside them.

But I do know a couple people at my job that would love to have that, so thanks again for the info :yes