This programm put blocks at measured intervals.
I wanna put the blocks at endpoints.
Can somebody help me, please?
Code:
;; Function to place blocks at measured intervals
(defun c:MeasureCSV (/ bname path dist ss n en ed fn f)
;; Ask user to select path, distance & block name
(if (and (setq path (entsel "Select object to measure: ")) ;Check if user's picked an object
(setq dist (getdist "Specify length of segment: ")) ;Check if user's specified distance
(setq bname (getstring t "Enter name of block to insert: ")) ;Check if user's specified block name
(tblsearch "BLOCK" bname) ;Check if block exists
) ;_ end of and
(progn
;; Do the Measure command
(command "_.MEASURE" path "_Block" bname "_Yes" dist)
;; Get a selection set of the blocks created
(if (setq ss (ssget "P")) ;Select previous
(progn
(setq n 0) ;initialize counter
(while (< n (sslength ss)) ;While counter is less than selection set's length
(setq en (ssname ss n) ;Get the nth item from the selection set
ed (entget en) ;Get its DXF data list
) ;_ end of setq
(write-line
(strcat (rtos (cadr (assoc 10 ed))) ;X value
","
(rtos (caddr (assoc 10 ed))) ;Y value
","
(rtos (cadddr (assoc 10 ed))) ;Z value
) ;_ end of strcat
f
) ;_ end of write-line
(setq n (1+ n)) ;Increment counter
) ;_ end of while
) ;_ end of progn
) ;_ end of if
(close f) ;Close the file
) ;_ end of progn
(princ "Stopped.")
) ;_ end of if
) ;_ end of progn
(princ "*Invalid*") ;Else stop & show error
) ;_ end of if
(princ) ;Don't show anything else on command line
) ;_ end of defun
Thanks in advance