Consulting

Results 1 to 10 of 10

Thread: AutoCAD 2004 - User Preferences

  1. #1
    Administrator
    2nd VP-Knowledge Base
    VBAX Master malik641's Avatar
    Joined
    Jul 2005
    Location
    Florida baby!
    Posts
    1,533
    Location

    AutoCAD 2004 - User Preferences

    Hey everyone

    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




    New to the forum? Check out our Introductions section to get to know some of the members here. Feel free to tell us a little about yourself as well.

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    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.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    Administrator
    2nd VP-Knowledge Base VBAX Master malik641's Avatar
    Joined
    Jul 2005
    Location
    Florida baby!
    Posts
    1,533
    Location
    Quote Originally Posted by lucas
    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.




    New to the forum? Check out our Introductions section to get to know some of the members here. Feel free to tell us a little about yourself as well.

  4. #4
    Administrator
    2nd VP-Knowledge Base VBAX Master malik641's Avatar
    Joined
    Jul 2005
    Location
    Florida baby!
    Posts
    1,533
    Location
    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....




    New to the forum? Check out our Introductions section to get to know some of the members here. Feel free to tell us a little about yourself as well.

  5. #5
    Moderator VBAX Master Tommy's Avatar
    Joined
    May 2004
    Location
    Houston, TX
    Posts
    1,184
    Location
    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!

  6. #6
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Hey Tommy, Glad to see you......guess your doin ok or I would have heard, right.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  7. #7
    Moderator VBAX Master Tommy's Avatar
    Joined
    May 2004
    Location
    Houston, TX
    Posts
    1,184
    Location
    Lots and Lots of work, haven't even had time to play

  8. #8
    Administrator
    2nd VP-Knowledge Base VBAX Master malik641's Avatar
    Joined
    Jul 2005
    Location
    Florida baby!
    Posts
    1,533
    Location
    Tommy,

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

    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 Thanks for the help guys!




    New to the forum? Check out our Introductions section to get to know some of the members here. Feel free to tell us a little about yourself as well.

  9. #9
    Moderator VBAX Master Tommy's Avatar
    Joined
    May 2004
    Location
    Houston, TX
    Posts
    1,184
    Location
    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

  10. #10
    Administrator
    2nd VP-Knowledge Base VBAX Master malik641's Avatar
    Joined
    Jul 2005
    Location
    Florida baby!
    Posts
    1,533
    Location
    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 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




    New to the forum? Check out our Introductions section to get to know some of the members here. Feel free to tell us a little about yourself as well.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •