Message 1 of 12
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I modified a lisp for CSV to Polyline from Original Lisp
But it working for Points
If I change _point to _pline not make polyline.
(command "_point" pl)
(defun c:CSV2POLY (/ _delimiter _coordinates pt pl theCSVSoure allTheDataNeeded openedCSVFile a b)
(setq
svnames '(osmode cmdecho blipmode plinewid)
svvals (mapcar 'getvar svnames)
); setq
(mapcar 'setvar svnames '(0 0 0 0))
(defun _delimiter (str md / d l str)
(if (listp str)
(apply 'strcat
(cons (car str)
(mapcar '(lambda (r) (strcat (chr md) r))
(cdr str)
)
)
)
(progn
(while (setq d (vl-string-position md str nil T))
(setq l (cons (substr str (+ 2 d)) l)
str (substr str 1 d)
)
)
(cons str l)
)
)
)
(defun _coordinates (lst indx)
(mapcar '(lambda (l) (distof (nth l lst)))
(list (1+ indx) indx)))
(setq o 0)
(if (setq allTheDataNeeded nil
theCSVSoure (getfiled "Select CSV file" (getvar 'dwgprefix) "csv" 16))
(progn
(setq openedCSVFile (open theCSVSoure "r"))
(while
(setq a (read-line openedCSVFile))
(setq b (_delimiter a 44))
(setq allTheDataNeeded (cons b allTheDataNeeded))
); while
(close openedCSVFile)
(foreach data allTheDataNeeded
(foreach pt (list (_coordinates data 1))
(if (= (car pt) nil)
(setq o (+ o 50)) ; if possible
(setq pl (list (+ (car pt) o) (cadr pt))); if not possible
); if - make 50m offset for every sections
(command "_point" pl)
)
);foreach
)
); if
(mapcar 'setvar svnames svvals)
(princ)
)
(vl-load-com)
here is that lisp
Please someone help me and edit this lisp.
I am a beginner for lisp
Solved! Go to Solution.