hi, Bill here(BTLSP)
I make the most use of vectors I can so the centroid of a square:
(defun csq
(setq
i (list 1 0)
j (list 0 1)
ul (entget "Point of Square upper-left corner")
d (getreal "Square dimension")
centroid
(vadd
(vadd (car ul)(cadr ul))
(vadd (vmultiply m i) (vmultiply m j) )
)
)
(defun vadd (u v)
(list (+ (car u) (cad v)) (+ (cadr u) (cadr v))
)
(defun vmultiply (m v)
(list (* m (car v)) (* m (cadr v)))
)
@Bill, I would recommend you look into the mapcar function
Hello awe, occasionally I will do the unexpected. What a simple task to find the centroid of a square on the paper. Lori, she was my lovely supervisor at SMI-Joist would use the most elegant ways to get what she wanted always nothing I would have done. But Jeri had a terrible time grabing all she wanted to transpose and leave the remainder untouched. That was then. I'm 63 and still having fun I'm not sure what era is the most fun. I did have a lot more energy back then and desire to explore the next thing but it's true today too. In 11 days I am heading to Cheyenne Wyoming and plunge into a new world. I've been in Paridise here in Portland now for 7 years.
I always knew Vectors( https://www.youtube.com/watch?v=cQqAVWKFoJ8 ) had what I needed to perform miracles but it took 3 semesters of Calculus to get there. I handled a t-square and triangles like a juggler but the computer, well we all know........ Then Web Sites intrigued and since I was already programming I learned html/css and now I'm looking at doing everything in html in a Web page. Of my 200+ Autolisp routines the spiral stair case was challenging, and the roof slope with facia and neither of the 2 could have been done without the one I created in 2 hours as a reply to a request from a fellow student of the instructor one night for a way to extend like "Extend" in 2d, a 3dface to a 3dface. You can get it from the Library of Congress where I registered it in 1993. It's 1 page long and uses everything from the vector functions, all of them, and the modulus to look for the right line to use to form the bases for the extension.
...Bill
for my blog: Lonely Road --> http://btlsp2000.tripod.com/a-inkwell/inkwell.html
Okay, I surrender, PTP is pretty good, the 3dface to 3dface routine I did in 2 hours in class one night in 1993. It was an Architectural night class. I knew little about Architecture but was just getting into programming after buying a Timex-Sinclair 2000 computer for $44 and making an extremely simple racing car game that required me to write 200 lines of code...........................................Bill