Ramana Posted August 21, 2010 Posted August 21, 2010 Dear friends, Greetings Thanks for your support. I have written a program for my requirement, i am facing some problem in exporting the text to txt file. My requirement is i would like send information of the drawing with comma. I have taken our friends help to export the co-ordinates of pline vertices, i am able to send the selected polylines coordinates. but when i run my program pline vertex are exporting well. but the first selected text only exporting to txt file repeatedly, I think there is some problem with my logic. i am attaching the drawing files also. when i select all the objects of the drawing the co-ordinates of the polyline along with its related text should goto txt file. Please help me where i am going wrong. Ramana (defun c:test (/ ed v-lst fn pt str) (vl-load-com) (setq pl(ssget '( ( 0 . "LWPOLYLINE"))) mtxt(ssget '((0 . "MTEXT"))) PLNO(SSLENGTH PL) mtno (sslength mtxt) POS 0 MTPOS 0 PTLIST1(LIST "") fn (open "c:\\test.txt" "w") OUTPUT "" ) (REPEAT PLNO (SETQ BOOTH(SSNAME PL POS)) (setq ed (entget BOOTH) v-lst (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= 10 (car x))) ed));list of vertices str "" str1 "") (foreach pt v-lst (setq x (rtos (car pt) 2 4) y (rtos (cadr pt) 2 4) str (strcat x "," y ) str1 (strcat str1 "," str) ) ;(setq str (strcat x "," y )) ;CALCULATING CO-ORINDATES FOR TESTING TEXT (setq x (car pt) y (cadr pt) ) (setq ptlist(list x y ) ptlist1(append ptlist1 ptlist)) ); FOR EACH (while (/= count 2) (SETQ MTEXT(SSNAME MTXT MTPOS) MTEXTinfo(entget MTEXT) MTXY(CDR (ASSOC 10 MTEXTINFO)) MTX(CAR MTXY) MTY(CADR MTXY) ) (IF (AND (< MTX (NTH 3 PTLIST1) ) (< MTY (NTH 4 PTLIST1) )(> MTX (NTH 7 PTLIST1) ) (> MTY (NTH 8 PTLIST1) )) (PROGN (SETQ MTCONT(cdr (assoc 1 MTEXTINFO)) COUNT(1+ COUNT) MTPOS(1+ MTPOS) ) (setq output(strcat output "," mtcont)) ) (PROGN (SETQ MTPOS(1+ MTPOS))) );IF ); while (alert output) (write-line (strcat output str1) fn) (SETQ pos(1+ pos) count 0 mtpos 0 output "" ) );PL REPEAT (close fn) ) i ext_text_layers(2).dwg 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.