See the top rated post in this thread. Click here

Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: Redefine or Remove an OSNAP?

  1. #11
    Member
    Join Date
    2009-09
    Location
    Johannesburg ,South Africa
    Posts
    9
    Login to Give a bone
    0

    Default Re: Redefine or Remove an OSNAP?

    I agree with you, it kills me when I have to stand behind someone's PC to help with something,
    only 01% users know that you can TAB (toggle trough) your chosen running snaps of an object when they are close to each other.
    I gave up trying to explain why Nearest (very useful in some situations) as running snap is bad habit,
    I use it but I only evoke it through SHFT Right Click OSNAP shortcut menu (I rearranged them to have it second on top of the list with break lines in-between to space them nicely for quick hovering).2023-05-30 09 17 37.png

  2. #12
    All AUGI, all the time
    Join Date
    2003-07
    Posts
    560
    Login to Give a bone
    1

    Default Re: Redefine or Remove an OSNAP?

    The current osnap setting is stored in the Osmode variable. so Near can be set with any other combination, maybe a 2x4 will help. yes had some one similar that would do his own thing to dwgs because he liked to work that way. You can only ask nicely dont do t. Say only use some osmode values that don have nearest set. You can do defuns that you type on command line to set osnaps.


    It may be possible to do a reactor that checks osmode and resets, a lot of possible work, v's the 2x4.

  3. #13
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    1

    Default Re: Redefine or Remove an OSNAP?

    If you load this in your acaddoc.lsp file it will KILL the nearest osmode automatically at the beginning of each command.

    P=

    Code:
    ;___________________________________________________________________________________________________________|
    ;
    ; Written By: Peter Jamtgaard copyright 2023 All Rights Reserved
    ;___________________________________________________________________________________________________________|
    
    ; Abstract: This routine will (when loaded) will autmatically remove the nearest osnap at the beiginning of
    ; every command (started from command line)
    
    ;___________________________________________________________________________________________________________|
    ;
    ; General Function Header List
    ;___________________________________________________________________________________________________________|
    ;
    ;  Function List		Argument1	Argument2 	Arguement3
    
    ;* (ActiveDocumentGetObject)
    ;* Function to get the active document vla-object
    
    ;* (BitCodesListAll intExponent)
    ;* Function to get a list of bits (2^x)
    
    ;* (ErrorTrap symFunction)
    ;* Function to Trap Errors without crashing lisp routine
    
    ;* (OSModeListItemRemove intBitCode)
    ;* Function to remove an osnap bit code from osmode system variable
    
    ;* (OSModeReactorNoNearest (Call CallBack)
    ;* Function to remove an nearest osnap bit code from osmode system variable
    
    ;* (OSModeToList intOSMode)
    ;* Function to convert a bitvalue to a list of bit codes
    
    ;$ End Header
    
    ;___________________________________________________________________________________________________________|
    ;
    ; Initialize CommandWillStart Reactor
    ;___________________________________________________________________________________________________________|
    
    (or rxnCommandWillStart
        (setq rxnCommandWillStart (vlr-editor-reactor nil '((:vlr-commandwillstart . OSModeReactorNoNearest))))
    )
    
    ;___________________________________________________________________________________________________________|
    ;
    ; Function to get the active document vla-object
    ;___________________________________________________________________________________________________________|
    
    (defun ActiveDocumentGetObject ()
     (if (or objACADApplication
             (setq objACADApplication (vlax-get-acad-object))
         )
      (vlax-get objACADApplication "ActiveDocument")
     )
    )
    
    ;___________________________________________________________________________________________________________|
    ;
    ; Function to get a list of bits (2^x)
    ;___________________________________________________________________________________________________________|
    
    (defun BitCodesListAll (intExponent / lstBitCodesAll)
     (repeat  (1+ intExponent)
      (setq intExponent (1- intExponent))
      (setq lstBitCodesAll   (cons (expt 2 intExponent) lstBitCodesAll))
     )
     lstBitCodesAll
    )
    
    ;___________________________________________________________________________________________________________|
    ;
    ; Function to Trap Errors without crashing lisp routine
    ;___________________________________________________________________________________________________________|
    
    (defun ErrorTrap (symFunction / objError result)
     (if (vl-catch-all-error-p
          (setq objError (vl-catch-all-apply
                         '(lambda (X)(set X (eval symFunction)))
                          (list 'result))))
      nil 
      (if result result 'T)
     )
    )
    
    ;___________________________________________________________________________________________________________|
    ;
    ; Function to remove an osnap bit code from osmode system variable
    ;___________________________________________________________________________________________________________|
    
    (defun OSModeListItemRemove (intBitCode / intOSMode lstOSMode objActiveDocument)
     (if (and (setq objActiveDocument (ActiveDocumentGetObject))                   
              (setq intOSMode         (vlax-invoke objActiveDocument "getvariable" "osmode"))
              (setq lstOSMode         (OSModeToList intOSMode))
              (setq lstOSMode         (vl-remove intBitCode lstOSMode))
              (setq intOSMode         (apply '+ lstOSMode))
         )
      (errortrap '(vlax-invoke objActiveDocument "setvariable" "osmode" intOSMode))
     )
    )
    
    ;___________________________________________________________________________________________________________|
    ;
    ; Function to remove an nearest osnap bit code from osmode system variable
    ;___________________________________________________________________________________________________________|
    
    (defun OSModeReactorNoNearest (Call CallBack)
     (if (not (wcmatch (strcase (car Callback)) "U,UNDO*"))
      (OSModeListItemRemove 512)
     )
    )
    
    ;___________________________________________________________________________________________________________|
    ;
    ; Function to convert a bitvalue to a list of bit codes
    ;___________________________________________________________________________________________________________|
    
    (defun OSModeToList (intOSMode / intBitCode lstOSMode)
     (if (and (setq lstBitCodes (BitCodesListAll 15))
              (/= intOSMode 0)
         )
      (foreach intBitCode (reverse lstBitCodes)
       (if (>= intOSMode intBitCode)
        (progn
         (setq intOSMode (- intOSMode intBitCode))
         (if (/= intBitCode 0)
          (setq lstOSMode (cons intBitCode lstOSMode))
         )
        )
       )
      )
     )
     lstOSMode
    )
    
    (princ "!")
    (vl-load-com)
    
    ; Osnap Bit Codes
    ;0	NONe
    ;1	ENDpoint
    ;2	MIDpoint
    ;4	CENter
    ;8	NODe
    ;16	QUAdrant
    ;32	INTersection
    ;64	INSertion
    ;128	PERpendicular
    ;256	TANgent
    ;512	NEArest
    ;1024	Geometric CEnter
    ;2048	APParent Intersection
    ;4096	EXTension
    ;8192	PARallel
    ;16384	Suppresses the current running object snaps
    Attached Files Attached Files
    Last edited by peter; 2023-05-31 at 09:49 PM.
    AutomateCAD

  4. #14
    Active Member
    Join Date
    2008-12
    Location
    JODHPUR/RAJASTHAN/INDIA
    Posts
    66
    Login to Give a bone
    1

    Lightbulb Re: Redefine or Remove an OSNAP?

    Hi all,

    same problem was with my office guy, so I have made a simple command/tool and located in draw tool bar carrying my default setting, whenever I start working & found that nearest point osnap is also ON, I simply click on that command/tool & done. (I have attached screenshot of my command/tool marked in RED BOX, Please refer the same). That would help only if you are working in Autocad Classic mode. (thats what I like and prefer for my workstyle only.)

    further simply Acaddoc.lsp edit is also worth it, but that needs restart of CAD software or open new file.

    Tool/command making looks simpler than any LSP routine. Just click and your settings are back.

    Regards,
    LALIT
    Attached Images Attached Images

  5. #15
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,419
    Login to Give a bone
    1

    Default Re: Redefine or Remove an OSNAP?

    That's a nice idea, but I wouldn't call the command OSMODE. That name is already in use by a system variable. Perhaps call it OsmodeReset., or MyOsmode.
    C:> ED WORKING....


    LinkedIn

  6. #16
    100 Club
    Join Date
    2000-11
    Posts
    140
    Login to Give a bone
    0

    Default Re: Redefine or Remove an OSNAP?

    He needs to have multiple osnaps along with nearest. For example if you are over a line the nearest snap will show but when you get to the endpoint of the line the osnap changes to END. I run an OSMODE of 543 which is end, mid, cen, node, qua and nea. I don't have intersection because I mainly create 3D solid models and there aren't osnaps at what would be intersections in 2D. AutoCAD has priorities build into how the osnaps work. You might want to make sure or show him how to use a bigger pickbox/aperture. The tiny amounts he is off a small pickbox probably is not part of the problem.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 5
    Last Post: 2007-04-26, 07:19 PM
  2. Redefine Qleader
    By jpaulsen in forum AutoLISP
    Replies: 5
    Last Post: 2004-11-18, 12:49 PM
  3. ATTEDIT and DDATTE Redefine
    By anovelli in forum AutoLISP
    Replies: 1
    Last Post: 2004-10-19, 11:41 AM
  4. Another redefine problem ...
    By moshira_hassan in forum AutoCAD General
    Replies: 1
    Last Post: 2004-10-17, 06:18 PM
  5. Redefine Block insertion point
    By robert.1.hall72202 in forum AutoCAD General
    Replies: 5
    Last Post: 2004-08-17, 02:38 PM

Posting Permissions

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