Jump to content

Recommended Posts

Posted (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 by fixo
  • Replies 40
  • Created
  • Last Reply

Top Posters In This Topic

  • MTTLP

    19

  • fixo

    7

  • ReMark

    6

  • Lt Dan's legs

    3

Top Posters In This Topic

Posted Images

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...