My first suggestion is to use "CL" instead of "C"
Other way to use entmake to create 3d poly,
here is Q&D routine to do it:
Code:
(defun C:3PE (/ *error* dimz file file-to-list p points split-string)
(defun *error* (msg)
(if
(vl-position
msg
'("console break"
"Function cancelled"
"quit / exit abort"
)
)
(princ "Error!")
(princ msg)
)
(if dimz (setvar "dimzin" dimz))
(princ)
)
;; local defuns
(defun file-to-list (filename / file result line)
(if (findfile filename)
(progn (setq file (open filename "r"))
(while (setq line (read-line file))
(setq result (cons line result))
)
(close file)
(reverse result)
)
(alert (strcat "File " filename " not found!"))
)
)
(defun split-string (str delim / pos)
;; Splits a string into a list of strings at every
;; occurrence of the delimiter (single-letter string).
(setq pos (vl-string-position (ascii delim) str))
(if (null pos)
(list str)
(cons (substr str 1 pos)
(split-string (substr str (+ pos 2)) delim)
)
)
)
;; main part
(setq dimz (getvar "dimzin"))
(setvar "dimzin" 0)
;; choose delimited csv file
(setq file (getfiled "Select points file:" "" "CSV;TXT" 4))
;; text file is semicolon delimited, values are in order of: X , Y , Z
;;(setq file (findfile "C:\\Test\\3Points.csv"));for test only
(setq points (file-to-list file))
(if points (progn
(setq points (mapcar '(lambda (p)(mapcar 'atof (split-string p ";"))) points)); <-- char ";" is a separator, change on your separator here
;; entmake polyline
;; create polyline first
(entmake
(list (cons 0 "POLYLINE")
(cons 100 "AcDbEntity")
(cons 8 "0");< -- layer
(cons 100 "AcDb3dPolyline")
(cons 66 1)
(cons 70 9)); <-- 9 is flag for closed (non fit/smooth) 3d poly
)
;; pline vertices
(foreach pt points
; creates new vertex
(entmake
(list
(cons 0 "VERTEX")
(cons 100 "AcDbEntity")
(cons 8 "0");< -- layer
(cons 100 "AcDbVertex")
(cons 100 "AcDb3dPolylineVertex")
(cons 10 pt)
(cons 42 0.0)
(cons 70 32)
))
) ;end foreach
(entmake (list
(cons 0 "SEQEND")
(cons 100 "AcDbEntity")
(cons 8 "0");< -- layer)
)
)
(gc)
(command "_zoom" "_ob" (entlast) "")
)
)
(*error* nil)
(princ)
)
(prompt "\n\t\t---\tStart command with: 3PE \t---")
(prin1)