Message 1 of 15

Not applicable
12-29-2020
09:32 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This has probably already been answered but I haven't found it anywhere in the polls.
I'm trying to create an array from two points.
the objective is to set the corners of the rectangle and return the list with the insertion coordinates of each block.
in my role I can calculate the number of columns and rows, but I am having trouble doing the calculation to define the number of blocks to be inserted so that they never overlap, can someone help me ???
want to thank you.
in the image is the result waiting. I'm attaching a preview of the function I'm creating.
(
(lambda ( / pt1 pt2 )
(setq lst_ nil)
(setq pt1 (getpoint) pt2 (getcorner pt1))
(setq cols 2 rows 2) ;;How to calculate the number of columns and rows ??
(setq x (/ (- (nth 0 pt2) (nth 0 pt1)) cols))
(setq y (/ (- (nth 1 pt2) (nth 1 pt1)) rows))
(setq xl 0 yl 0 )
(repeat rows
(setq pA (+ (nth 0 pt1) (/ x 2 ) (* x xl )))
(setq PB (+ (nth 1 pt1) (/ y 2 ) (* y yl )))
; (insert_block "teste" pA pB) ;just to view
(setq c (append (list (list pA pB 0.00)) lst))
(setq yl (+ yl 1))
)
(setq xl (+ xl 1))
)
)
Solved! Go to Solution.