Display full version of the post: Simple Lisp Problem?

jpkibble
19.11.2010, 17:01

I've recently been getting into Lisp with AutoCAD2006 with some success, however the following routine is giving me a headache.It should draw a simple array of vertical lines 100 high at 25 unit intervals, it works fine but after a few test runs it starts doing funny things, missing every other line...missing lots of random lines or even spuriously joining lines to nearby objects. All very strange - have you any ideas why it might be happening?(defun c:SPR ()(setq leng (getint "Enter Length of Section in Metres:"))(setq sectionstart (getpoint "\nPick Insertion point:"))(setq aa (car sectionstart))(setq bb (cadr sectionstart))(setq rptn (+ 1 (fix (/ leng 25))))(command "line" (list (+ aa leng) bb) (list (+ aa leng) (+ bb 100)) ""); Repeat loop starts here(repeat rptn(command "line" (list aa bb) (list aa (+ bb 100) ) "") (setq aa (+ aa 25)) ); Repeat loop stops here)jpkibble2010-11-19 17:02:35

CarlB
20.11.2010, 07:20
Sounds like a common problem, for people learning Lisp...You have a running Osnap set, so line snaps to an endpoint rather than the desired coordinate. It's erratic because it depends on the zoom level/pickbox size.

jpkibble
20.11.2010, 08:55
That's great - problem solved with the use of OSMODE.Thanks.