Jump to content

command 'list' ~ 'props'


Guest snoopy

Recommended Posts

Guest snoopy

When I use the command props, I get all the properties of one selected item. Example: even the coordinates of the start-point of an arc are showed in this window.

 

When I use the list command, I get also properties of one or more selected items. But it does not give alle the properties.

Example: when I select the same arc, I only get a few data like 'center point' , radius,... It does not give the start- and end-point of the arc.

 

So, How can I get a list of all properties of one or more selected items in the Text window that I get with the list command.

The purpose is that I can easly copy the data, past it in a notepad-file and print it. (With the props-command I can not copy the data :( )

 

Does someone have an idea?

 

 

Thanks

 

snoopy 8)

Link to comment
Share on other sites

  • Replies 20
  • Created
  • Last Reply

Top Posters In This Topic

  • fuccaro

    9

  • vipulgos

    5

  • Dommy2Hotty

    1

  • tlyall

    1

The reason you don't see some of the things that you would with just 1 entity selected is because those particular properties aren't the same between the two objects. I know that when you select 2 of the same entites, it will still show all the properties, but the ones that are different, i.e. start point, end point, radius, etc., will be displayed as *VARIES* instead of not showing up at all.

Link to comment
Share on other sites

I think Snoopy need to export some properties to a text file.

 

Snoopy, I can write a Lisp for this, but please write me what entities (arcs, lines...) do you need to export and what properties (end point, center point, start angle,...).

Link to comment
Share on other sites

Guest snoopy
I think Snoopy need to export some properties to a text file.

that's correct :)

 

Snoopy, I can write a Lisp for this, but please write me what entities (arcs, lines...) do you need to export and what properties (end point, center point, start angle,...).

Thanks a lot fuccaro :D

 

The most things that I need is arcs and lines.

The properties that I need:

arc: start point, center point, end point and radius

line: start point, end point and length

 

At the moment it is enough that I can export these two entities with those properties. fuccaro, Thanks again !

 

 

 

snoopy 8)

Link to comment
Share on other sites

Snoopy

Here is my try. It will return the points relative to the WCS.

I don't know in what format you need the data, so I wrote the program to create a CSV file. Open that file in Excel and manipulate the data as you wish.

;|     Program to export properties of ARC and LINE entities
   into a CSV file
   [email="mfuccaro@hotmail.com"]mfuccaro@hotmail.com[/email]
---------------------------August 2004
|;
(defun c:lst( / name file ss ssi enl ln ar c2s)
 ;----------------------------
 (defun ln (l f / s e)    ;To record a LINE l in the file f
   (setq s (cdr (assoc 10 l))    ;Start point
     e (cdr (assoc 11 l)))    ;End point
   (write-line (strcat "LINE," (c2s s) (c2s e) (rtos (distance e s))) f)
   )

 ;----------------------------
 (defun ar (l f / c r s e)            ;To record an ARC
   (setq c (cdr (assoc 10 l))            ;Center
     r (cdr (assoc 40 l))            ;Radius
     s (polar c (cdr (assoc 50 l)) r)    ;Start
     e (polar c (cdr (assoc 51 l)) r))    ;End
   (write-line (strcat "ARC," (c2s s) (c2s e) "," (c2s c) (rtos r)) f)
   )

 ;----------------------------
 (defun c2s (x)    ;Used to transform Coords in String
   (strcat (rtos (car x)) "," (rtos (cadr x)) "," (rtos (caddr x)) ",")
   )
 
 ;----------------------------
 
 (setq name (getvar "dwgname"))
 (if (= "." (substr name (- (strlen name) 3) 1))
   (setq name (substr name 1 (- (strlen name) 4))))
 (setq file (open (getfiled "Output" name "CSV" 1) "w")
   ss (ssget) ssi -1)
 (write-line
   "Typ,Start X,Start Y,Start Z,End X,End Y,EndZ,Length,cen X,cen Y,cenZ,Radius"
   file)
 (repeat (sslength ss)
   (setq enl (entget (ssname ss (setq ssi (1+ ssi)))))
   (cond
     ((= "LINE" (cdr (assoc 0 enl))) (ln enl file))
     ((= "ARC" (cdr (assoc 0 enl))) (ar enl file))
     )
   )
 (close file)
 (princ)
 )

Link to comment
Share on other sites

Fuccaro is the man!

 

You really should update that website of yours with all that lisp knowledge you have pouring out of ya! What an invaluable resource that would be.

 

BTW... Can you do a quick lisp routine for me?

 

I need a lisp that is going to get up at 6:30 am, drive to work, function at max. capacity for 8 hours, drive back home, eat supper, have a cold beer and go to bed!!! :D :D

 

Take care my friend!

 

Tom

Link to comment
Share on other sites

Fuccaro is the man!
Tlyall

The LST routine worked for you and in your opinion is a good one, right? Thank you for the feed-back!

 

I need a lisp that...
Yes, I can write that program but it will have 2 side effects;

After work it will pick up and spend your salary and it will go in bed with your girlfriend/wife. Are you sure that you want it? :D :D :D

 

You really should update that website of yours with all that lisp knowledge you have pouring out of ya!
About my website: is true, I should update it. But I don't keep all the lisp routines I wrote. I keep organized the routines I frequently use. I wrote some routines for my friends and for other members (in this Forum and in others), so I let them to take care about those.
Link to comment
Share on other sites

I modified the program to handle the circles too. Also the length is exported for all of the records.

In this version as in the previous one too, you may use any selection method you wish. The program will filter out the other elements included in the selection set.

Here is the code:

;|    Program to export properties of ARC, CIRCLE and LINE entities 
  into a CSV file 
  [email="mfuccaro@hotmail.com"]mfuccaro@hotmail.com[/email] 
---------------------------August 2004 
|;

;REVISIONS: September 2004
;    - Added CIRCLES to the list
;    - Length calculation for all recorded entities
;    - Handle the error if nothing is selected

(defun c:LST( / name file ss ssi enl ln ar ci c2s)
 
 ;---------------------------- 
 (defun ln (l f)       ;To record a LINE l in the file f
   (write-line (strcat "LINE,"
           (c2s (cdr (assoc 10 l)))
           (c2s (cdr (assoc 11 l)))
           (rtos (distance
               (cdr (assoc 10 l))
               (cdr (assoc 11 l))))) f) 
   ) 

 ;---------------------------- 
 (defun ar (l f / c r u1 u2)    ;Record an ARC
   (setq c (cdr (assoc 10 l))    ;Center
     r (cdr (assoc 40 l))    ;Radius
     u1 (cdr (assoc 50 l))    ;Start...
     u2 (cdr (assoc 51 l))    ;...and End angle
     )
   (write-line (strcat "ARC,"
           (c2s (polar c u1 r))
           (c2s (polar c u2 r))
           (rtos (* r (abs (- u2 u1)))) ","
           (c2s c) (rtos r)) f) 
   )

 ;-----------------------------
 (defun ci (l f / r)        ;To record a CIRCLE
   (setq r (cdr (assoc 40 l)))    ;Radius
   (write-line (strcat "CIRCLE,,,,,,,"
           (rtos (* 2 PI r)) ","
           (c2s (cdr (assoc 10 l)))
           (rtos (cdr (assoc 40 l)))) f)
   )

 ;---------------------------- 
 (defun c2s (x)   ;Used to transform Coords in String 
   (strcat (rtos (car x)) "," (rtos (cadr x)) "," (rtos (caddr x)) ",") 
   ) 
 
 ;---------------------------- 
 
 (setq name (getvar "dwgname")) 
 (if (= "." (substr name (- (strlen name) 3) 1))
   (setq name (substr name 1 (- (strlen name) 4)))) 
 (setq file (open (getfiled "Output file..." name "CSV" 1) "w")
   ss (ssget) ssi -1) 
 (write-line 
   "Typ,Start X,Start Y,Start Z,End X,End Y,EndZ,Length,cen X,cen Y,cenZ,Radius" 
   file)
 (if ss
   (progn
     (repeat (sslength ss)
   (setq enl (entget (ssname ss (setq ssi (1+ ssi)))))
   (cond
     ((= "LINE" (cdr (assoc 0 enl))) (ln enl file))
     ((= "ARC" (cdr (assoc 0 enl))) (ar enl file))
     ((= "CIRCLE" (cdr (assoc 0 enl))) (ci enl file))
     )
   )))    ;end IF SS
 (close file) 
 (princ) 
 ) 

Link to comment
Share on other sites

  • 5 years later...

Dear all,

I am new bee on this forum, I found out this post after 5 years!!. O.K. I have used this lsp command, works nicely. Can you please tell me how the lines are written in excel. I mean what is there in first line of CSV file? Is the line one we draw in CAD or last line we draw in CAD. How the line no 1, 2 ,3 and so on are written in CSV. Is there any sequence or it may be in random? This is very vital info for me, as I want to use this in my Estimation program which is in Excel only.

Link to comment
Share on other sites

The program walks through the AutoCAD database and prints info about entities as it founds them. With other words: it honors the creation order.

However: when copy-pasting more entities, I saw the order of pasted entities was reversed.

Link to comment
Share on other sites

You are right, but Still confused, can I make it possible to directly communicate with these data for estimation work? and if so, from where should I started. Is there any way like keeping first line yellow, then red and so on and the same will be reflected in excel sheet by that colour or like that. I think, you can understand my point...

Link to comment
Share on other sites

Sorry... I never did estimation work :(

You wish to identify the exported data with the corresponding line or circle on the screen?

There are only a few colors in AutoCAD -Yes, I know about true type colors, but I meant colors you can make the difference by eye. So if you export 160 object properties in the CSV file, using 16 colors you end-up with 10 red elements, 10 yellow and so on. This will still cause problems to you. How about inserting numbers? I could rewrite the lisp to place small numbers say at the middle of the lines and at the circles and arcs center point.

But now I am at home. Expect urgent help from other members, or you will have to wait until the 11th of January.

Link to comment
Share on other sites

if numbering line may help, it will be a better option. please guide accordingly. I will wait for you. In the mean while, if others can do it, it will be a great help for me thanks

Link to comment
Share on other sites

  • 3 weeks later...
;|    Program to export properties of ARC, CIRCLE and LINE entities 
  into a CSV file 
  mfuccaro@hotmail.com 
---------------------------August 2004 
|;

;REVISIONS: September 2004
;    - Added CIRCLES to the list
;    - Length calculation for all recorded entities
;    - Handle the error if nothing is selected
;
;January 2010
;   - numbering entities

(defun putno(n p)
 (setq txtheight 3.5)
 (entmake (list '(0 . "TEXT") (cons 1 (rtos n)) (cons 10 p) (cons 40 txtheight) '(50 . 0.785398)))
 (eval n)
 )

(defun c:LST( / name file ss ssi enl ln ar ci c2s)
 
 ;---------------------------- 
 (defun ln (l f n / p)       ;To record a LINE l in the file f
   (write-line (strcat "LINE,"
           (c2s (cdr (assoc 10 l)))
           (c2s (cdr (assoc 11 l)))
           (rtos (distance
               (cdr (assoc 10 l))
               (cdr (assoc 11 l))))) f)
   (setq p (mapcar '* (mapcar '+ (cdr (assoc 10 l)) (cdr (assoc 11 l))) '(0.5 0.5 0.5)))
   (putno n p)
   ) 

 ;---------------------------- 
 (defun ar (l f n / c r u1 u2)    ;Record an ARC
   (setq c (cdr (assoc 10 l))    ;Center
     r (cdr (assoc 40 l))    ;Radius
     u1 (cdr (assoc 50 l))    ;Start...
     u2 (cdr (assoc 51 l))    ;...and End angle
     )
   (write-line (strcat "ARC,"
           (c2s (polar c u1 r))
           (c2s (polar c u2 r))
           (rtos (* r (abs (- u2 u1)))) ","
           (c2s c) (rtos r)) f)
   (putno n c)
   )

 ;-----------------------------
 (defun ci (l f n / r)        ;To record a CIRCLE
   (setq r (cdr (assoc 40 l)))    ;Radius
   (write-line (strcat "CIRCLE,,,,,,,"
           (rtos (* 2 PI r)) ","
           (c2s (cdr (assoc 10 l)))
           (rtos (cdr (assoc 40 l)))) f)
   (putno n (cdr (assoc 10 l)))
   )

 ;---------------------------- 
 (defun c2s (x)   ;Used to transform Coords in String 
   (strcat (rtos (car x)) "," (rtos (cadr x)) "," (rtos (caddr x)) ",") 
   ) 
 
 ;---------------------------- 
 
 (setq name (getvar "dwgname")) 
 (if (= "." (substr name (- (strlen name) 3) 1))
   (setq name (substr name 1 (- (strlen name) 4)))) 
 (setq file (open (getfiled "Output file..." name "CSV" 1) "w")
   ss (ssget) ssi -1) 
 (write-line 
   "Typ,Start X,Start Y,Start Z,End X,End Y,EndZ,Length,cen X,cen Y,cenZ,Radius" 
   file)
 (setq n 1)
 (if ss
   (progn
     (repeat (sslength ss)
   (setq enl (entget (ssname ss (setq ssi (1+ ssi)))))
   (cond
     ((= "LINE" (cdr (assoc 0 enl))) (ln enl file (setq n (1+ n))))
     ((= "ARC" (cdr (assoc 0 enl))) (ar enl file (setq n (1+ n))))
     ((= "CIRCLE" (cdr (assoc 0 enl))) (ci enl file (setq n (1+ n))))
     )
   )))    ;end IF SS
 (close file) 
 (princ) 
 )

Link to comment
Share on other sites

Excellent!

It has lot more than earlier code. In length column, there are entries which shows the difference between related fields. So, the differnece are being written as length.....

Now, if this is possible, then I think, it may be possible to have line no. column also in the csv file after Typ column.

Why I am interesting is because, once this is happened, then, looking to autoCAD drawing repeatedly, may be avoided....

also, the numbering is being done in drawing file as 1.0000, 2.0000, instead of 1,2 etc.

Link to comment
Share on other sites

The Excel row number for each record is the same as the number placed in AutoCAD to the coresponding entity.

As for the trailing zeros: it doesn't appear on my computer, it should be an issue of a sysvar (Luprec?).

Try to change in the code: replace (rtos n) with (rtos n 2 0)

Other than that I can't help you. These days I use AutoCAD only ocasionally.

Link to comment
Share on other sites

o.k. the problem of trailing zeros has been solved by UNIT command. The row number you suggested is also very much appreciated. This much help is quite good and appreciated....

Link to comment
Share on other sites

I am getting old... Please forget about the RTOS command, it will try to convert a Real TO String. To convert an integer, use ITOA.

Here is the code again:

;|    Program to export properties of ARC, CIRCLE and LINE entities 
  into a CSV file 
  mfuccaro@hotmail.com 
---------------------------August 2004 
|;

;REVISIONS: September 2004
;    - Added CIRCLES to the list
;    - Length calculation for all recorded entities
;    - Handle the error if nothing is selected
;
;January 2010
;   - numbering entities

(defun putno(n p)
 (setq txtheight 3.5)
 (entmake (list '(0 . "TEXT") (cons 1 (itoa n)) (cons 10 p) (cons 40 txtheight) '(50 . 0.785398)))
 (eval n)
 )

(defun c:LST( / name file ss ssi enl ln ar ci c2s)
 
 ;---------------------------- 
 (defun ln (l f n / p)       ;To record a LINE l in the file f
   (write-line (strcat "LINE,"
           (c2s (cdr (assoc 10 l)))
           (c2s (cdr (assoc 11 l)))
           (rtos (distance
               (cdr (assoc 10 l))
               (cdr (assoc 11 l))))) f)
   (setq p (mapcar '* (mapcar '+ (cdr (assoc 10 l)) (cdr (assoc 11 l))) '(0.5 0.5 0.5)))
   (putno n p)
   ) 

 ;---------------------------- 
 (defun ar (l f n / c r u1 u2)    ;Record an ARC
   (setq c (cdr (assoc 10 l))    ;Center
     r (cdr (assoc 40 l))    ;Radius
     u1 (cdr (assoc 50 l))    ;Start...
     u2 (cdr (assoc 51 l))    ;...and End angle
     )
   (write-line (strcat "ARC,"
           (c2s (polar c u1 r))
           (c2s (polar c u2 r))
           (rtos (* r (abs (- u2 u1)))) ","
           (c2s c) (rtos r)) f)
   (putno n c)
   )

 ;-----------------------------
 (defun ci (l f n / r)        ;To record a CIRCLE
   (setq r (cdr (assoc 40 l)))    ;Radius
   (write-line (strcat "CIRCLE,,,,,,,"
           (rtos (* 2 PI r)) ","
           (c2s (cdr (assoc 10 l)))
           (rtos (cdr (assoc 40 l)))) f)
   (putno n (cdr (assoc 10 l)))
   )

 ;---------------------------- 
 (defun c2s (x)   ;Used to transform Coords in String 
   (strcat (rtos (car x)) "," (rtos (cadr x)) "," (rtos (caddr x)) ",") 
   ) 
 
 ;---------------------------- 
 
 (setq name (getvar "dwgname")) 
 (if (= "." (substr name (- (strlen name) 3) 1))
   (setq name (substr name 1 (- (strlen name) 4)))) 
 (setq file (open (getfiled "Output file..." name "CSV" 1) "w")
   ss (ssget) ssi -1) 
 (write-line 
   "Typ,Start X,Start Y,Start Z,End X,End Y,EndZ,Length,cen X,cen Y,cenZ,Radius" 
   file)
 (setq n 1)
 (if ss
   (progn
     (repeat (sslength ss)
   (setq enl (entget (ssname ss (setq ssi (1+ ssi)))))
   (cond
     ((= "LINE" (cdr (assoc 0 enl))) (ln enl file (setq n (1+ n))))
     ((= "ARC" (cdr (assoc 0 enl))) (ar enl file (setq n (1+ n))))
     ((= "CIRCLE" (cdr (assoc 0 enl))) (ci enl file (setq n (1+ n))))
     )
   )))    ;end IF SS
 (close file) 
 (princ) 
 )

Link to comment
Share on other sites

  • 10 years later...

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