View Full Version : adding values to points in alisp
2nd Oct 2004, 07:13 pm
Could someone tell me how to add values to points. I want to make a square using a user input first point. How would I create a second point by adding values to the first point?
2nd Oct 2004, 10:16 pm
after you have the first point, you then extract the X & Y values (and possibly Z), then you add the figures you need to concoct the next point. which figures all depend upon which way you want to draw the rectangle from the first point.
I think you need to provide a little bit more info here
2nd Oct 2004, 10:24 pm
There are several ways to approach this:
(setq p1 '(2 3 0))
(setq p2 (mapcar '+ p1 '(2 2 0)))
(setq ap (lambda (p s)
(list (+ (car p) s)
(+ (cadr p) s))
(setq p2 (ap p1 2))
13th Oct 2004, 12:31 am
Here are some more examples.
Lets start at point 2,2 and go around a square.
(setq x 2
(setq p1 (list x y)
p2 (list x (+ y 5))
p3 (list (+ x 5) (+ y 5))
p4 (list (+ x 5) y)
(command "._pline" p1 p2 p3 p4 p1 "")
Lets go from p3 to 10,10
We need to add 3 to x & y
(setq p5 (list (+ (car p3) 3)(+ (cadr p3) 3)))
13th Oct 2004, 03:53 pm
There's always "getcorner"
Powered by vBulletin™ Version 4.1.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.