LISP bminsert parametric block with the help of CSV datafile

Hi everyone,

I found a nifty script to bm insert blocks with the help of a csv data file and want to alter it to my needs ;

Importing the data is no problem, however "vle-nth" has a limit of 10 columns (position 0 .... 9 )
is it possible tot pass more then 10 variables to a parametric block in a lisp routine ?
I could wrap the params in a single CSV column en then in the loop unfold again, but this means more programming
; Very basic function.
(defun ReadCsv (fnm)
  (mapcar
    '(lambda (str) (mapcar 'read (vle-string-split "," str)))
    (cdr (vle-file->list fnm "")) ; Cdr to skip headers.
  )
)

(defun c:mm ( / compPath csvDat)
  (setvar 'cmdecho 1)
  (setq compPath "D:/ProjectDir/")
  (setq csvDat (ReadCsv "D:/ProjectDir/DataFile.CSV" ))
  (foreach record csvDat
    (command
      "_.-bminsert"
        (strcat compPath (car record) ".dwg")
          "_name"
            (vle-nth1 record))
          "_edit"
            "v1" (vle-nth2 record)
            "v2"  (vle-nth3 record)
            "v3"  (vle-nth4 record)
            etc etc
          ""
          "_rotate"
          (vle-nth5 record)          
          (list (vle-nth8 record) (vle-nth7 record) 0.0)
    )
  )
  (command "_.zoom" "_extents")
  (command "_.zoom" "0.9x")
)

Comments