fixo Posted April 27, 2012 Posted April 27, 2012 (edited) Try add: (vl-load-com) before of routine... (defun c:tocsv(/ file lst data datum dia ent1 ent2 ent3 leng pos) [color=red](vl-load-com)[/color] ;;list to file (defun wrs (file lst / filename atts blockname en obj ss) (setq filename (open file "W")) (foreach x lst (write-line x filename) ) (close filename) (princ) ) (setq file (strcat (getvar "dwgprefix")(vl-filename-base (getvar "dwgname"))".csv"));<-- or change file name here (setq data (list (strcat "pos no" "\t" "pipe diameter" "\t" "pipe length (m)"))) (while ;(setq ent (entsel"\nSelect block: ")) (setq ss (ssget "_:S" (list (cons 0 "insert")(cons 2 "YAZI KANAL")))) (setq blkobj (vlax-ename->vla-object (ssname ss 0))) (foreach att (vlax-invoke blkobj 'getattributes) (cond ((eq (vla-get-tagstring att)"A")(setq aa (vla-get-textstring att))) ((eq (vla-get-tagstring att)"B")(setq ba (vla-get-textstring att))) ((eq (vla-get-tagstring att)"DEBI")(setq da (vla-get-textstring att)))) (setq tmp (strcat (vl-princ-to-string aa) "\t" (vl-princ-to-string ba) "\t"(vl-princ-to-string da))) ) (setq data (cons tmp data))) (setq data (reverse data)) (wrs file data) (princ) ) (princ "Start command with: TOCSV") (prin1) But it sounds ugly, it does work on my machine, thus I can't help with other questions, bye ~'J'~ Edited April 27, 2012 by fixo Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.