@Sea-Havenyour Multi getvals.lsp is very useful for many rountines.
I run your wow lisp above and gets some errors. I fixed them with chat PGT and it work perfect.
The errors check by chat GPT
Unmatched ss initialization: You initialize ss before the foreach loops but then reinitialize it at the start of each loop. The initial ss value is overridden and seems unnecessary.
Spelling mistake: "cotner" should be "corner" in the getpoint prompt.
Checking function loading: If the external functions AH:getvalsm and AH:getvalsm2col are not loaded, the script loads them. However, you load "Multi getvals 2col" even though it's not used in this script.
The the fixed code by GPT
(defun c:wow ( / ans rows col lst1 lst2 lst x colans rowans pt pt1 pt2 oldsnap ss dist)
;; Save the current osnap settings and disable osnap
(setq oldsnap (getvar 'osmode))
(setvar 'osmode 0)
;; Load necessary functions if they are not loaded
(if (not AH:getvalsm)
(load "Multi Getvals.lsp")
)
;; Get the number of rows and columns from the user
(setq ans (AH:getvalsm (list "Enter values " "Rows " 5 4 "6" "Columns " 5 4 "4")))
(setq rows (atoi (car ans)) col (atoi (cadr ans)))
;; Initialize lists for row and column values
(setq lst1 '() lst2 '() x rows)
;; Collect row values
(repeat rows
(setq lst1 (cons "600" lst1))
(setq lst1 (cons 4 lst1))
(setq lst1 (cons 5 lst1))
(setq lst1 (cons (strcat "Height " (rtos x 2 0)) lst1))
(setq x (1- x))
)
(setq lst1 (cons "Enter values " lst1))
(setq rowans (AH:getvalsm lst1))
;; Collect column values
(setq x col)
(repeat col
(setq lst2 (cons "600" lst2))
(setq lst2 (cons 4 lst2))
(setq lst2 (cons 5 lst2))
(setq lst2 (cons (strcat "Length " (rtos x 2 0)) lst2))
(setq x (1- x))
)
(setq lst2 (cons "Enter values " lst2))
(setq colans (AH:getvalsm lst2))
;; Prompt the user to pick a point for the top-left corner
(setq pt (getpoint "\nPick a point for top left corner "))
;; Process row values
(setq pt1 pt ss (ssadd))
(foreach val rowans
(setq pt2 (mapcar '+ pt1 (list 0.0 (- (atof val)) 0.0)))
(command "line" pt1 pt2 "")
(setq ss (ssadd (entlast) ss))
(setq pt1 pt2)
)
;; Process column values
(setq dist 0.0)
(foreach val colans
(command "copy" ss "" pt (mapcar '+ pt (list (setq dist (+ dist (atof val))) 0.0 0.0)))
)
;; Redo rows for remaining columns
(setq pt1 pt ss (ssadd))
(setq dist 0.0)
(foreach val colans
(setq pt2 (mapcar '+ pt1 (list (atof val) 0.0 0.0)))
(command "line" pt1 pt2 "")
(setq ss (ssadd (entlast) ss))
(setq pt1 pt2)
)
;; Copy rows downward
(setq dist 0.0)
(foreach val rowans
(command "copy" ss "" pt (mapcar '+ pt (list 0.0 (setq dist (- dist (atof val))) 0.0)))
)
;; Restore the original osnap settings
(setvar 'osmode oldsnap)
;; End the program
(princ)
)
Waiting for your next step to count rectangles and mark them.
I think the labeling step should be done as a separate step and can be skip the making rangtangles at 1st step.
For example, we had the rectangles before and just lable then count them.