Peri Posted May 16, 2011 Posted May 16, 2011 Hi, I'm new to writing LISP's and have finnished a couple for my studio. Just to keep busy when tides are low. The last I'm almost done with is an offset lisp that offsets in sequence (I do't really care if there are lisps already made for this, I've been trying to practice on my lisp routine making). I first choose the number of offsets, then the value for each offset and finally the side to offset. My problem is that when I zoom in close to the line the lisp works great - I mean, it offsets to the valeus I inputed. But when I'm a bit far out on the zoom it offsets to different values. I really don't know why it is doing this. Do I need to adjust the zoom sesitivity or something? Is there such a thing? Here is the code I wrote (it's in portuguese). Don't mind the messy way it's wirten. Thanks ;Criado por Rodrigo Líbano (defun c:offseq (/ numof numof2 numof3 list carl carls carlss voffx vof2x vof1x p2x side) (initget 7) (setq numof (getint "\nNúmero de offsets [2 ou mais]:")) (initget 7) (setq voffx (getdist "\nValor do primeiro offset:")) (setq numof (- numof 1)) (setq numof2 numof) (setq numof3 numof) (setq list (cons voffx voffx)) (setq vof1x voffx) (while numof (initget 7) (setq vof2x (getdist (strcat "\nValor do próximo offset [Restam:" (rtos numof 2 0)"]:"))) (setq vof2x (+ vof2x vof1x)) (setq list (cons vof2x list)) (setq vof1x vof2x) (setq numof (1- numof)) (if (= numof 0) (setq numof nil) (setq numof numof) ) ); end while (princ list) (setq carlss carls) (while (setq p2x (cadr (entsel "\nSelecione Objeto:"))) (setq side (getpoint "\nSelecione lado:")) (while numof2 (setq carl (nth numof2 list)) (if (= numof2 numof3) (setq carls (- carl carl)) (setq carls (nth (+ numof2 1) list)) ); end if (setq carls (- carl carls)) (setvar "OFFSETDIST" carl) (command "._UNDO" "_GROUP") (command ".OFFSET" carl p2x side "") (if (= numof2 0) (setq numof2 nil) (setq numof2 (- numof2 1)) ); end if ); end while (setq numof2 numof3) (setq carl carlss) ); end while (princ) ) Quote
Tharwat Posted May 16, 2011 Posted May 16, 2011 First of all , you can not use a function as a name of variable . (setq list (cons voffx voffx)) I would look into your codes and will see if I could help you with it . Quote
Peri Posted May 16, 2011 Author Posted May 16, 2011 First of all , you can not use a function as a name of variable . I would look into your codes and will see if I could help you with it . Funny, the routine works nevertheless. Chagend it, though, to see if that was the problem, but it wasn't. To give more info on the problem. Let's say I ask the lisp for 3 offsets, values 1, 2 and 3. (what the lisp is doing is actually offsetting the same original line, so the values change to 1, 3 and 6, keeping the intervals between lines to the input values). When zoomed in closely, the distance between lines is correct (1,2,3), but when a retry a little zoomed out the distances I get are 1, 3 and 6. Could it be something related to the pickbox variable? (I don't really understand this, but found something about it in another lisp). Thanks! Quote
Tharwat Posted May 16, 2011 Posted May 16, 2011 Funny, the routine works nevertheless. Chagend it, though, to see if that was the problem, but it wasn't. It is not funny , it is the truth that you should take care of . Quote
Peri Posted May 16, 2011 Author Posted May 16, 2011 (edited) Thanks for the tip, took care of it already but the problem remains. I wasn't trying to be a smart***. Edited May 16, 2011 by fuccaro Deleting part of a word that could offend Quote
BIGAL Posted May 17, 2011 Posted May 17, 2011 I have had this problem before changed snap mode etc some times set it to 0 works, my work around was to zoom to a certain scale so the objects are visible before acting on them, then jump back to scale where you were. This was the case with a wall cleanup lisp if you zoom to far out would not work would pick wrong lines zoom in a bit works perfect every time. There are undocumented little bugs that you find. Written code for Intellicad, MAC acad and had to change working code depending on which version running on. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.