Jump to content

Zoom sensitivity in LISP


Peri

Recommended Posts

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)
)
       

Link to comment
Share on other sites

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 . :)

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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 .

Link to comment
Share on other sites

Thanks for the tip, took care of it already but the problem remains. I wasn't trying to be a smart***.

Edited by fuccaro
Deleting part of a word that could offend
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...