Sie sind auf Seite 1von 2

(defun LM:setdynpropvalue ( blk prp val )

(setq prp (strcase prp))


(vl-some
'(lambda ( x )
(if (= prp (strcase (vla-get-propertyname x)))
(progn
(vla-put-value x (vlax-make-variant val (vlax-variant-type
(vla-get-value x))))
(cond (val) (t))
)
)
)
(vlax-invoke blk 'getdynamicblockproperties)
)
)

(defun LM:lst->str ( lst del )


(if (cdr lst)
(strcat (car lst) del (LM:lst->str (cdr lst) del))
(car lst)
)
)

(defun C:BCSV4 (/ listtostr strtolist read_csv blk_data dwg_path field1 field2


field3 field4 field5 file filename line pt pt_coord retlist)
;; helpers:

;; by gile
(defun strtolist ( str del / pos lst )
(while (setq pos (vl-string-search del str))
(setq lst (cons (substr str 1 pos) lst)
str (substr str (+ pos 1 (strlen del))))
)
(reverse (cons str lst))
)

;; by VK
(defun listtostr ( lst del / n str)
(setq str "")
(while (setq n (car lst))
(setq str (strcat str n del))
(setq lst (cdr lst)))
(substr str 1 (1- (strlen str)))
)

;; by John Unden
(defun read_csv(FileName sep / rtlist)
(setq file (open FileName "r"))
(while (setq line (read-line file))
(setq retlist (cons (strtolist line sep) retlist))
)
(close file)
(reverse retlist)
)
(setvar "cmdecho" 0)

;;;;;;;;;;; GET FILE

(setq dwg_path (getvar "DWGPREFIX"))


(princ "\n...Get File With Information...")
(setq filename (getfiled "Select Input Data File" dwg_path "csv" 4))
(setq blk_data (read_csv filename ","))
(setvar "clayer" "0")(setvar "cecolor" "bylayer")(setvar "attreq" 1)(setvar
"attdia" 0)
(setq laynume (getstring "\nDenumire layer? "))
(setq laynumetext (LM:lst->str '(laynume "text") "_")
(command "_.Layer" "_Make" laynume "_Color" "84" "" "LType" "Continuous" "" "")
(setvar "clayer" laynume)
(foreach line blk_data
(setq pt_coord (list (nth 1 line)(nth 2 line)(nth 3 line))
pt_coord (mapcar 'atof pt_coord))
(setq Field1 (nth 5 line)
Field2 (nth 0 line)
Field3 (nth 4 line)
Field4 (nth 7 line)
Field5 (nth 12 line)
Field6 (nth 6 line)
Field7 (nth 8 line)
Field8 (nth 9 line)
Field9 (nth 10 line)
Field10 (nth 11 line)
Field11 (nth 13 line)
)
;;(command "_insert" "ARBORE FOIOS" "_non" pt_coord "1" "0" Field1 Field2
Field3 Field4 Field5 Field6 Field7)
;; Or :
(setq blocu Field11)
(command "-insert" blocu "_S" "1" "_R" "0" "_non" pt_coord Field1 Field4
Field3 Field2 Field5 Field6 Field7 Field8 Field9 Field10)
;(command "-insert" blocu "_S" "1" "_R" "0" "_non" pt_coord Field1 Field2
Field4)
(setq dynBlock (vlax-ename->vla-object (entlast)))
(setq dynProp "Distance1")
(setq value (/ (atof Field4) 2))
(if (= value nil) (setq value 0.8))
(if (= value 0) (setq value 0.8))
(LM:setdynpropvalue dynBlock dynProp value)
)

;(COMMAND "_layerp")
(setvar "cmdecho" 1)
(setvar "clayer" "0")
;(command "_pdmode" 32)
;(command "_pdsize" 0.5)
(princ)
)

Das könnte Ihnen auch gefallen