TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: mohan on September 05, 2021, 02:55:01 AM

Title: Array of points
Post by: mohan on September 05, 2021, 02:55:01 AM
I wanted to paste objects on array of points pls fix my lisp
Code: [Select]
(defun c:somefun  ( / x y pt )
(setq x 0) (setq y 0)
(while (setq pt '(( + x 20) ( + y 20) 0.00 ))
(command "_.cutclip" (ssget) "" "_.pasteclip" pt )) (princ))

thanks


Title: Re: Array of points
Post by: BIGAL on September 05, 2021, 11:22:42 PM
Why not just array in a lisp. Just write down the steps when running manually.
Title: Re: Array of points
Post by: mohan on September 06, 2021, 07:26:25 AM
Array will copy objects, but my one is existing objects
Ok guys, I understood it is a difficult one !

Please help for this shape . . .  (ssget) I am not doing anything here manually I will replace (ssget) with (ssget "_x" '((0 . "INSERT") (2 . "myblockname")) for block selection or any other objects
I just need a lisp to finish my work out (It will work through layouts & model spaces)
Title: Re: Array of points
Post by: BIGAL on September 07, 2021, 08:28:36 PM
Back to request 1 this is 250 blocks at spacing of 10 X and Y

Code: [Select]
(setq x -10.0 y 0.0)
(repeat 50
(setq x (+ 10 x))
(repeat 50
(vl-cmdf "-insert" "Test" (list x y 0.0) 1 1 0 )
(setq y (+ y 10))
)
(setq y 0.0)
)

request 2 just get start pt and set x & y
Code: [Select]
(repeat 10
(vl-cmdf "-insert" "Test" (list x y 0.0) 1 1 0)
(setq y (+ y 10))
(setq x (+ x 10))
)
Title: Re: Array of points
Post by: mohan on September 08, 2021, 10:49:17 AM
That was awesome !  thank you so much dear . . .  :smitten:

small correction on the 2nd
add this: (setq x 0.0) (setq y 0.0)
(repeat 10
(vl-cmdf "-insert" "Test" (list x y 0.0) 1 1 0)
(setq y (+ y 10))
(setq x (+ x 10)))

If you know any (design / pattern of points program by mathematics) in the google just share with me (Example: Lee Mac sir website has)
Title: Re: Array of points
Post by: BIGAL on September 08, 2021, 10:11:57 PM
Remove the "c" code was pasted from a block with 1 attribute.