+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 15
  1. #1
    Junior Member
    Using
    AutoCAD 2008
    Join Date
    Jul 2011
    Posts
    10

    Default changing OSNAP shortcut through LISP

    Registered forum members do not see this ad.

    i usually turn this off on my snap settings so i frequently use shortcuts for it

    perpendicular- per
    nearest- nea
    tangent-tan
    mid bet 2 points-m2p ; mtp
    from- fro
    intersection- int

    but im wondering if there's a way through lisp that can change this shortcut. for e.g. fro id like to change to ff and mtp to mm (because i used this a lot when im drafting) i know there's a shift+right click and also to put a keyboard shortcut override (but it uses shift or control combi keys) but i really like to see this on a lisp routine thanks in advance

  2. #2
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    3,008

    Default

    Please check the OSMODE system variable - the example below will set the END mode:
    Code:
    [setvar OSMODE 1)
    Regards,
    Mircea

    AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3

  3. #3
    Junior Member
    Using
    AutoCAD 2008
    Join Date
    Jul 2011
    Posts
    10

    Default

    thanks for the quick reply
    but my question is how to change the shortcut value of the default

    in my e.g. i want to use "mm" key for "mtp" after the command ask for a displacement.

    even in cui i tried and cant do that so i figured maybe on lisp i can change that parameter.

    what i understand for your given system varia is to turn the snap on which corresponds to value

  4. #4
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    3,008

    Default

    The shortcuts are defined in acad.pgp file - although I'm not sure if this includes Osnap modes, too. To locate this file input the line below on your command prompt followed by <Enter>:
    Code:
    (findfile "acad.pgp")
    Regards,
    Mircea

    AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3

  5. #5
    Junior Member
    Using
    AutoCAD 2008
    Join Date
    Jul 2011
    Posts
    10

    Default

    have tried that already... but i think pgp is only for commands

  6. #6
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    3,008

    Default

    An AutoLISP command may be called transparently - see below example for END mode:
    Code:
    (defun c:EE( / oldOsMode myPoint )
     (setq oldOsMode (getvar "OSMODE"))
     (setvar "OSMODE" 1)
     (setq myPoint (getpoint))
     (setvar "OSMODE" oldOsMode)
     myPoint
    )
    However to call it will require an extra quote symbol:
    Command: LINE
    Specify first point: 'ee
    Regards,
    Mircea

    AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3

  7. #7
    Junior Member
    Using
    AutoCAD 2008
    Join Date
    Jul 2011
    Posts
    10

    Default

    now i get it... sorry, my bad... so that's the reason why you told me to check the OSMODE sys varia
    thanks again but the reason i want to change the shortcut of it is for me to have an easy access on my left hand but the quote key is across... anyway you can remove the extra quote symbol when i like to call it in... thanks again

  8. #8
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    3,008

    Default

    Quote Originally Posted by minion View Post
    anyway you can remove the extra quote symbol when i like to call it in...
    Not sure that understand what you mean. To call transparently a command - that it, call a command while another command is in progress - you should use the quote mark; otherwise the input will be rejected.
    Command: LINE
    Specify first point: ZOOM
    Invalid point.
    Command: LINE
    Specify first point: 'ZOOM
    >>Specify corner of window, enter a scale factor (nX or nXP), or [All/Center/Dynamic/Extents/Previous/Scale/Window/Object] <real time>:
    >>>>Specify opposite corner:
    Resuming LINE command.
    Specify first point:
    Regards,
    Mircea

    AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3

  9. #9
    Junior Member
    Using
    AutoCAD 2008
    Join Date
    Jul 2011
    Posts
    10

    Default

    thanks a lot

  10. #10
    Forum Deity BlackBox's Avatar
    Using
    Civil 3D 2011
    Join Date
    Nov 2009
    Posts
    3,953

    Default

    Registered forum members do not see this ad.

    Mircea,

    Perhaps using the built-in transparent OSNAPS would be preferred to defining a custom LISP for each, for example the END transparent command (no quote needed) in the above sample.

    Newer version of AutoCAD have made it more difficult (at least Civil 3D has) to add custom shortcut menus via the Control (Ctrl) key + Right click. Now, one must use Shift instead.
    "Potential has a shelf life." - Margaret Atwood

Similar Threads

  1. How can I get this LISP to use OSNAP
    By NTX JK in forum AutoLISP, Visual LISP & DCL
    Replies: 5
    Last Post: 6th May 2010, 05:59 pm
  2. Changing the Orbit mouse button shortcut
    By 3Dcadder in forum AutoCAD General
    Replies: 0
    Last Post: 24th Jul 2009, 12:53 pm
  3. Osnap Shortcut
    By StevenMc in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 7
    Last Post: 16th Jun 2009, 02:03 pm
  4. OSNAP Shortcut
    By grain in forum AutoCAD General
    Replies: 3
    Last Post: 12th Nov 2008, 01:44 pm
  5. Shortcut for changing text style on very large drawing?
    By Molloy in forum AutoCAD Drawing Management & Output
    Replies: 41
    Last Post: 5th Sep 2007, 01:36 pm

Bookmarks

Posting Permissions

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