Jump to content

Recommended Posts

Posted

This lisp is for separate single text only

 

~'J'~

  • 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

Posted

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)

Posted

Guess you'll have to just sit down and write it yourself.

Posted

I DO NOT KNOW ALREADY YAZMAYI prompted a writer

JUST WANT TO HELP

PLEASE

Posted (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 by ReMark
Posted
I DO NOT KNOW ALREADY YAZMAYI prompted a writer

JUST 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

Posted

I want to thank AutoCAD discovery and metering

pipe diameters and lengths of the blocks in autocad

I want to export to Excel

Posted
I want to thank AutoCAD discovery and metering

pipe 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'~

Posted

Are those TEXT,MTEXT,ATTRIBUTES?

 

To HELP you........

>>>>>>>>>>>>>>>>

And let the entities do the talking for you . ;)

Posted

We need an actual DWG file NOT an image taken from a drawing. It makes a big difference.

Posted
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?

Posted

yes; enhanced attribute editor

 

I installed to finance the project

English is no more excuse

Thank you for helping

Posted

"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.

Posted

I can not explain my problem

dimensions and the size of the project I want to excel

Have a divisor lips

Posted

Attributes Remark AND Text AND Mrext ;) but mostly attributes.

Posted
I can not explain my problem

dimensions 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'~

Posted

Geez.. you are fast fixo... i'm still looking at the drawing file :lol:

Posted
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

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...