Results 1 to 3 of 3

Thread: Copy LISP doesn't work when zoomed out!

  1. #1
    Member
    Join Date
    2012-09
    Posts
    2
    Login to Give a bone
    0

    Question Copy LISP doesn't work when zoomed out!

    This LISP makes n copies of an object and distribute it evenly between two points. It woks fine, but if I zoom out after picking points, the objects just ends up in a lump. (AutoCAD 2011)

    Does zooming affect the values of p1 and pt? How can i fix this? I Use the copy command with basepoint p1 and new point pt.

    Code:
    (defun c:c2 (/ ss p1 p2 n l pt)
         (if
            (and
                (setq ss (ssget))
                (setq p1 (getpoint "\nSpecify first point:"))
                (setq p2 (getpoint p1 "\nSpecify Second point:"))
                (setq n (getint "\nSpecify number of objects between points:"))
            )
             (progn 
                (setq pt p1)
                (setq l (/ (distance p1 p2) (+ n 1))) 
                (repeat n
                    (setq pt (polar pt (angle p1 p2) l))
                    (command "COPY" ss "" p1 pt)
                )
            )
        (princ)
        )
    (princ)
    )

  2. #2
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    Login to Give a bone
    0

    Default Re: Copy LISP doesn't work when zoomed out!

    If you're going to use the copy command you need to disable osnaps. Store the osmode value, set it to 0 before the copy command and restore it afterwards.

  3. #3
    Member
    Join Date
    2012-09
    Posts
    2
    Login to Give a bone
    0

    Default Re: Copy LISP doesn't work when zoomed out!

    Thank you! Looks like this works if anyone would like to know:

    Code:
    (defun c:c2 (/ ss p1 p2 n osmode l pt)
     	(if
    		(and
    			(setq ss (ssget))
    			(setq p1 (getpoint "\nSpecify first point:"))
    			(setq p2 (getpoint p1 "\nSpecify Second point:"))
    			(setq n (getint "\nSpecify number of objects between points:"))
    			(setq osmode (getvar "osmode"))
    		)
    	 	(progn
    			(setvar "osmode" 0)
    			(setq pt p1)
    			(setq l (/ (distance p1 p2) (+ n 1))) 
    			(repeat n
    				(setq pt (polar pt (angle p1 p2) l))
    				(command "COPY" ss "" p1 pt)
    			)
    			(setvar "osmode" osmode)
    		)
    	(princ)
    	)
    (princ)
    )

Similar Threads

  1. Lisp routine doesn't work
    By boyerd492098 in forum AutoLISP
    Replies: 16
    Last Post: 2015-01-27, 10:13 PM
  2. why doesn't this lisp work in a macro?
    By chuh in forum AutoLISP
    Replies: 12
    Last Post: 2014-09-09, 05:56 PM
  3. LISP to Explode Dynamic Blocks Doesn't Work
    By stusic in forum AutoLISP
    Replies: 35
    Last Post: 2013-06-26, 05:20 PM
  4. lisp worked in 07 doesn't work in 09?
    By Hammer.John.J in forum AutoLISP
    Replies: 9
    Last Post: 2009-08-07, 04:22 PM
  5. copy to clipboard doesn't work...
    By jeff.95551 in forum Revit - Rendering
    Replies: 4
    Last Post: 2008-06-26, 04:26 PM

Tags for this Thread

Posting Permissions

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