Skip to content

Instantly share code, notes, and snippets.

@sgrodnik
sgrodnik / divpl.lsp
Created July 14, 2025 11:56
This AutoLISP routine, DIVPL, divides a polyline, including arc segments, into points at a specified interval. It then exports the X, Y, Z coordinates of these points to a temporary tab-delimited text file and automatically opens the file.
(defun c:DIVPL ( / ss ent obj len interval counter param pt output_file file_path temp_path )
(vl-load-com) ; Load Visual LISP functions
;; Get the path to the user's temporary directory
(setq temp_path (getenv "TEMP"))
;; Use MILLISECS for a unique temporary file name
(setq file_path (strcat temp_path "\\polyline_points_" (itoa (getvar "MILLISECS")) ".txt"))
;; --- Check for existing selection ---
(setq ss (ssget "_I")) ; Get implicit selection set (already selected objects)