fixo Posted April 27, 2012 Posted April 27, 2012 This lisp is for separate single text only ~'J'~ Quote
transcad Posted April 27, 2012 Posted April 27, 2012 This lisp is not working properly, all text is inserted in a single cell ... "\t" not good?? or a variable not good? (defun c:tocsv(/ file lst data datum dia ent1 ent2 ent3 leng pos) ;;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"));<-- you may want to change the file name here (setq data (list (strcat "pos no" "\t" "pipe diameter" "\t" "pipe length (m)"))) (setq lst nil) (while (setq ent1 (entsel "\nSelect position text (or press Enter to stop): ")) (progn (setq pos (cdr (assoc 1 (entget (car ent1))))) (setq ent2 (entsel "\nSelect diameter text: ")) (setq dia (cdr (assoc 1 (entget (car ent2))))) (setq ent3 (entsel "\nSelect length text: ")) (setq leng (cdr (assoc 1 (entget (car ent3))))) (setq datum (strcat pos "\t" dia "\t" leng)) (setq data (cons datum data )) ) ) (setq data (reverse data)) (wrs file data) (princ) ) (princ "Start command with: TOCSV") (prin1) Quote
ReMark Posted April 27, 2012 Posted April 27, 2012 Guess you'll have to just sit down and write it yourself. Quote
MTTLP Posted April 27, 2012 Author Posted April 27, 2012 I DO NOT KNOW ALREADY YAZMAYI prompted a writer JUST WANT TO HELP PLEASE Quote
ReMark Posted April 27, 2012 Posted April 27, 2012 (edited) Yes, I'm aware of the fact you want help but our different languages are getting in the way. Is there no AutoCAD help forum in your country that you could turn to? Do you know any other users of AutoCAD in your country? If so, have you sought their help or advice? Maybe one of them knows someone else who is familiar with AutoLisp and they can assist you. Suggestion: Maybe you should start up a AutoCAD Users Group in your area and start holding monthly meetings. Members can share information, ideas, techniques and support each other when the need arises. Edited April 27, 2012 by ReMark Quote
fixo Posted April 27, 2012 Posted April 27, 2012 I DO NOT KNOW ALREADY YAZMAYI prompted a writerJUST WANT TO HELP PLEASE Firstly say us what you need exactly Do you have the blocks with attributes inside your drawing or? Do you want to write block attributes to Excel or otherwise you want to get attributes from Excel and pull them all in AutoCAD? And also you can to use machine translator from here: http://translation2.paralink.com/Turkish-English-Translation Quote
MTTLP Posted April 27, 2012 Author Posted April 27, 2012 I want to thank AutoCAD discovery and metering pipe diameters and lengths of the blocks in autocad I want to export to Excel Quote
fixo Posted April 27, 2012 Posted April 27, 2012 I want to thank AutoCAD discovery and meteringpipe diameters and lengths of the blocks in autocad I want to export to Excel Are these parameters is block attributes or just a single text only? ~'J'~ Quote
pBe Posted April 27, 2012 Posted April 27, 2012 Are those TEXT,MTEXT,ATTRIBUTES? To HELP you........ >>>>>>>>>>>>>>>> And let the entities do the talking for you . Quote
ReMark Posted April 27, 2012 Posted April 27, 2012 We need an actual DWG file NOT an image taken from a drawing. It makes a big difference. Quote
ReMark Posted April 27, 2012 Posted April 27, 2012 I want to thank AutoCAD discovery and metering pipe diameters and lengths of the blocks in autocad I want to export to Excel Do these blocks have attributes? Yes or No? Quote
MTTLP Posted April 27, 2012 Author Posted April 27, 2012 http://s2.dosya.tc/server13/HuBiHf/Drawing2.rar.html okay I added You know another Quote
MTTLP Posted April 27, 2012 Author Posted April 27, 2012 yes; enhanced attribute editor I installed to finance the project English is no more excuse Thank you for helping Quote
ReMark Posted April 27, 2012 Posted April 27, 2012 "English is no more excuse"? That's pretty ballsy of you. What the heck does "yes; enhanced attribute editor" mean? Can you just plainly answer the question: DO THESE BLOCKS HAVE ATTRIBUTES? "Editor" doesn't really mean much. Quote
MTTLP Posted April 27, 2012 Author Posted April 27, 2012 I can not explain my problem dimensions and the size of the project I want to excel Have a divisor lips Quote
pBe Posted April 27, 2012 Posted April 27, 2012 Attributes Remark AND Text AND Mrext but mostly attributes. Quote
fixo Posted April 27, 2012 Posted April 27, 2012 I can not explain my problemdimensions and the size of the project I want to excel Have a divisor lips Try this code (without explanations) (defun c:tocsv(/ file lst data datum dia ent1 ent2 ent3 leng pos) ;;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) If you want to pull data back to AutoCAD just let us know about ~'J'~ Quote
pBe Posted April 27, 2012 Posted April 27, 2012 Geez.. you are fast fixo... i'm still looking at the drawing file Quote
MTTLP Posted April 27, 2012 Author Posted April 27, 2012 Try this code (without explanations) (defun c:tocsv(/ file lst data datum dia ent1 ent2 ent3 leng pos) ;;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) If you want to pull data back to AutoCAD just let us know about ~'J'~ I added the project to finance lisp does not work 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.