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
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") )
0
Comments
-
You may have to revert back to (nth x record)0
-
Thanks AlanH,
i am a LISP novice and did not assume there is a nth function
We'll try that soon.
Anyway what does the VLE stuff do ? Is it a lisp flavour ?
Regards Harold0 -
Anyway what does the VLE stuff do ? Is it a lisp flavour ?
Answer is in Bricscad help. https://www.bricsys.com/bricscad/help/en_US/CurVer/DevRef/index.html?page=source/TX_01.htm
But yes limited to 0-9
nth I dont know thousands.0