TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: rude dog on March 18, 2004, 11:52:59 AM

Title: mapcar
Post by: rude dog on March 18, 2004, 11:52:59 AM
Code: [Select]

(defun c:gl ()
(setq pt (getpoint "\nPick a point "))
(setq npt (mapcar '0.5* (list pt)))
)
(princ)

stumped...trying to multiply 0.5 by the X value of (list pt) (which then would be the X value in a new list) then the Y value  of (list pt) (which then would be the Y value in a new list) and then the Z value of  (list pt) (which then would be the Z value in a new list) I have never used mapcar before and didnt know if this (when written properly) would work.
Title: mapcar
Post by: Xlisper on March 18, 2004, 12:15:27 PM
Try this:

   
Code: [Select]

       
        (mapcar '(lambda (x) (* x 0.5)) ptlist)

   


    where ptlist is the point list
Title: mapcar
Post by: rude dog on March 18, 2004, 12:41:53 PM
wonderful..saves me alot of steps..thanks
Title: mapcar
Post by: Mark on March 19, 2004, 06:16:56 AM
Also have a look at this thread;
http://theswamp.org/phpBB2/viewtopic.php?t=340
Title: mapcar
Post by: rude dog on March 19, 2004, 11:23:55 AM
thanks MT....