Robert,
Run the attached CMM program in a new drawing from the Model tab, and change to the layer you want to use. I've also attached my WordList program which is perfect for processing these types of text files.
Terry Cadd
Code:
;-------------------------------------------------------------------------------
; c:CMM - Draws a polyline connecting the points of a CMM file
;-------------------------------------------------------------------------------
(defun c:CMM (/ Filename% First Line1@ Line2@ Line3@ Text$)
(if (not *CMMFilename$)(setq *CMMFilename$ ""))
(setq *CMMFilename$ (getfiled "Select CMM file to Process" *CMMFilename$ "txt" 2))
(if (not *CMMFilename$)(exit))
(setq Filename% (open *CMMFilename$ "r"))
(setq First t Line2@ (list "") Line3@ (list ""))
(while (setq Text$ (read-line FileName%))
(setq Line1@ Line2@ Line2@ Line3@)
(setq Line3@ (Wordlist Text$))
(if (and (= (nth 0 Line1@) "X")(= (nth 0 Line2@) "Y")(= (nth 0 Line3@) "Z"))
(if First
(progn
(setq First nil)
(command "PLINE" (list (atof (nth 1 Line1@))(atof (nth 1 Line2@))(atof (nth 1 Line3@))))
);progn
(command (list (atof (nth 1 Line1@))(atof (nth 1 Line2@))(atof (nth 1 Line3@))))
);if
);if
);while
(close Filename%)
(command "")
(command "ZOOM" "E")
(princ)
);defun c:CMM
;-------------------------------------------------------------------------------
; WordList - Returns a list of words in a sentence
; Arguments: 1
; Sentence$ = String to convert into a list strings
; Syntax: (WordList "Words in a sentence") = (list "Words" "in" "a" "sentence")
; Returns: List of words or strings that were seperated by spaces in a sentence
;-------------------------------------------------------------------------------
(defun WordList (Sentence$ / Cnt# Item$ Mid$ Num# ReturnList@)
(setq Cnt# 1 Num# 1)
(repeat (strlen Sentence$)
(setq Mid$ (substr Sentence$ Cnt# 1))
(if (= Mid$ " ")
(progn
(setq Item$ (substr Sentence$ Num# (- Cnt# Num#)))
(if (/= Item$ "")
(setq ReturnList@ (append ReturnList@ (list Item$)))
);if
(setq Num# (1+ Cnt#))
);progn
);if
(setq Cnt# (1+ Cnt#))
);repeat
(if (not ReturnList@)
(setq ReturnList@ (list Sentence$))
(if (/= (substr Sentence$ Num#) "")
(setq ReturnList@ (append ReturnList@ (list (substr Sentence$ Num#))))
);if
);if
ReturnList@
);defun WordList
;-------------------------------------------------------------------------------