Autocad [exclusive] - Raster

(command "_.UNDO" "_END") (setvar "cmdecho" 1) (princ) )

;; Loop through rows (Y direction) and columns (X direction) (setq i 0) ; row index (while (< i rows) (setq y-pos (+ (cadr p1) (* i y-spacing))) (setq j 0) ; col index (while (< j cols) (setq x-pos (+ (car p1) (* j x-spacing))) ;; Create point at (x-pos, y-pos, elevation z from p1) (setq point-obj (command "_.POINT" (list x-pos y-pos (caddr p1)))) (setq j (1+ j)) ) (setq i (1+ i)) ) raster autocad

;; --- User Input --- (princ "\nSpecify first corner of raster area: ") (setq p1 (getpoint "\nPick first corner: ")) (if (null p1) (exit)) (setq p2 (getcorner p1 "\nSpecify opposite corner: ")) (if (null p2) (exit)) (command "_

;; Optional: Create a polyline border around the grid (initget "Yes No") (if (= (getkword "\nDraw border around grid? [Yes/No] <No>: ") "Yes") (progn (command "_.PLINE" (list (car p1) (cadr p1) (caddr p1)) (list (car p2) (cadr p1) (caddr p1)) (list (car p2) (cadr p2) (caddr p1)) (list (car p1) (cadr p2) (caddr p1)) "_C") (princ "\nBorder drawn.") ) ) (princ (strcat "\nDone

;; Check if spacing is too small (if (or (< x-spacing 0.001) (< y-spacing 0.001)) (progn (princ "\nError: Spacing too small. Increase grid size or reduce rows/columns.") (exit) ) )

includes an optional Z-axis sine wave pattern – replace the math with your own elevation data (e.g., from a CSV file or formula).

(princ (strcat "\nDone. " (itoa total-points) " points created."))