Lee Mac Posted December 21, 2010 Posted December 21, 2010 not sure what link youre talking about...... Post#5 - program should do what you want and much, much more... Quote
justindm Posted December 21, 2010 Author Posted December 21, 2010 OOOOOOOOHHHHHHHHH.....DUUUUUUDE!!! AWESOME!!! SO AWESOME!!! Thank you!! Quote
Lee Mac Posted December 21, 2010 Posted December 21, 2010 OOOOOOOOHHHHHHHHH.....DUUUUUUDE!!! AWESOME!!! SO AWESOME!!! Thank you!! Glad you like it! Enjoy Quote
Tharwat Posted December 22, 2010 Posted December 22, 2010 @Tharwat - yours works awesome! much simpler than the eattext (and much less filling ) Is there a way to specify the location of the output file? Or just to the same place as the dwg location? You're welcome . Here is one according to your request. (defun c:THex (/ dir fNme ss) ; THARWAT 2010 (if (and (setq dir (getvar 'dwgprefix)) (setq fNme (open (strcat dir "Block-coordinates.txt" ) "w")) (setq ss (ssget "_:L" '((0 . "INSERT")))) ) ( (lambda (i / ss1 e pt1 ) (while (setq ss1 (ssname ss (setq i (1+ i)))) (setq e (entget ss1)) (setq pt1 (cdr (assoc 10 e))) (write-line (strcat (rtos (car pt1) 2) "," (rtos (cadr pt1) 2) "," (rtos (caddr pt1) 2)) fNme) ) ) -1 ) (princ) ) (close fNme) (princ "\n Written by Tharwat") (princ) ) Enjoy. Tharwat Quote
symoin Posted August 3, 2017 Posted August 3, 2017 You're welcome . Here is one according to your request. (defun c:THex (/ dir fNme ss) ; THARWAT 2010 (if (and (setq dir (getvar 'dwgprefix)) (setq fNme (open (strcat dir "Block-coordinates.txt" ) "w")) (setq ss (ssget "_:L" '((0 . "INSERT")))) ) ( (lambda (i / ss1 e pt1 ) (while (setq ss1 (ssname ss (setq i (1+ i)))) (setq e (entget ss1)) (setq pt1 (cdr (assoc 10 e))) (write-line (strcat (rtos (car pt1) 2) "," (rtos (cadr pt1) 2) "," (rtos (caddr pt1) 2)) fNme) ) ) -1 ) (princ) ) (close fNme) (princ "\n Written by Tharwat") (princ) ) Enjoy. Tharwat Thanks for this beautiful code.... Could you please modify to include the layer of the block (layer on which it is inserted) Quote
Tharwat Posted August 3, 2017 Posted August 3, 2017 Thanks for this beautiful code.... Thank you. Could you please modify to include the layer of the block (layer on which it is inserted) Can you show how it should look like in the txt file to allow me to modify the codes with one shot if possible? Quote
symoin Posted August 3, 2017 Posted August 3, 2017 Please find the attached it has Pointid or Sl. No, Easting, Northing, Elevation and Code. Some can like this even without the Sl.No. will be great. Thanks. Quote
Tharwat Posted August 3, 2017 Posted August 3, 2017 (defun c:Test (/ sel dir fil int ent get pnt) ;; Tharwat - Date: 03.Aug.2017 ;; (if (and (setq sel (ssget "_:L" '((0 . "INSERT")))) (setq int -1 dir (getvar 'dwgprefix)) (setq fil (open (strcat dir "Block-coordinates.txt") "w")) ) (while (setq ent (ssname sel (setq int (1+ int)))) (setq get (entget ent) pnt (cdr (assoc 10 get)) ) (write-line (strcat (rtos (car pnt) 2) "," (rtos (cadr pnt) 2) "," (rtos (caddr pnt) 2) "," (cdr (assoc 8 get))) fil) ) ) (if fil (close fil)) (princ) ) Quote
symoin Posted August 7, 2017 Posted August 7, 2017 (defun c:Test (/ sel dir fil int ent get pnt) ;; Tharwat - Date: 03.Aug.2017 ;; (if (and (setq sel (ssget "_:L" '((0 . "INSERT")))) (setq int -1 dir (getvar 'dwgprefix)) (setq fil (open (strcat dir "Block-coordinates.txt") "w")) ) (while (setq ent (ssname sel (setq int (1+ int)))) (setq get (entget ent) pnt (cdr (assoc 10 get)) ) (write-line (strcat (rtos (car pnt) 2) "," (rtos (cadr pnt) 2) "," (rtos (caddr pnt) 2) "," (cdr (assoc 8 get))) fil) ) ) (if fil (close fil)) (princ) ) Firstly I apologize for the delay and Then thanks for this code. This works exactly as required but only one issue is its creating the list in reverse order. (newer first and older last). Can it be reversed to older first and newest last. Thanks Quote
Tharwat Posted August 7, 2017 Posted August 7, 2017 Firstly I apologize for the delay and Then thanks for this code. This works exactly as required but only one issue is its creating the list in reverse order. (newer first and older last). Can it be reversed to older first and newest last. Thanks Its okay - you're welcome anytime. Are you after sorting the list as per the smallest X coordinates? Quote
symoin Posted August 8, 2017 Posted August 8, 2017 not exactly, now your code creates the list with the order of block created or inserted from newer to older into the drawing, required exactly the same with from older to newer.. Thanks Quote
Tharwat Posted August 8, 2017 Posted August 8, 2017 not exactly,now your code creates the list with the order of block created or inserted from newer to older into the drawing, required exactly the same with from older to newer.. Thanks (defun c:Test (/ sel dir fil int ent get pnt) ;; Tharwat - Date: 03.Aug.2017 ;; (if (and (setq sel (ssget "_:L" '((0 . "INSERT")))) (setq int (sslength sel) dir (getvar 'dwgprefix)) (setq fil (open (strcat dir "Block-coordinates.txt") "w")) ) (while (setq ent (ssname sel (setq int (1- int)))) (setq get (entget ent) pnt (cdr (assoc 10 get)) ) (write-line (strcat (rtos (car pnt) 2) "," (rtos (cadr pnt) 2) "," (rtos (caddr pnt) 2) "," (cdr (assoc 8 get))) fil) ) ) (if fil (close fil)) (princ) ) Quote
symoin Posted August 10, 2017 Posted August 10, 2017 Thanks, Exactly what I was looking.... appreciate your help Quote
Tharwat Posted August 10, 2017 Posted August 10, 2017 Thanks,Exactly what I was looking.... appreciate your help You're welcome. Quote
jgarza0422 Posted January 15, 2018 Posted January 15, 2018 What is need to include these attribute information? Quote
Vittorio Posted October 28 Posted October 28 (edited) Hello, I found this post and it is almost exactly what I need. Could someone edit the LISP code so it also shows the Block Names. Info: All my Blocks are Anonymous Blocks (eg. *U1234). What I need at the end is something like this: Block Name | Block Rotation | Block X Scale | Block Y Scale | Block Z Scale | Easting | Northing | Height | Layer Name *U12345,270.000,1.000,1.000,1.000,123456.789,987654.321,123.456,LayerXYZ Is this possible? Many thanks in advance. ________________________________________ This is what I figured out (without rotation and scale): (defun c:XList (/ sel dir fil int ent get pnt) ;; Tharwat - Date: 03.Aug.2017 ;; (if (and (setq sel (ssget "_:L" '((0 . "INSERT")))) (setq int (sslength sel) dir (getvar 'dwgprefix)) (setq fil (open (strcat dir "Block-coordinates.txt") "w")) ) (while (setq ent (ssname sel (setq int (1- int)))) (setq get (entget ent) pnt (cdr (assoc 10 get)) ) (write-line (strcat (cdr (assoc 2 get)) "," (rtos (car pnt) 2) "," (rtos (cadr pnt) 2) "," (rtos (caddr pnt) 2) "," (cdr (assoc 8 get))) fil) ) ) (if fil (close fil)) (princ) ) How can I get the blocks rotation and scale to output? EDIT 2 (10/28/24 13:20 CET) I finally figured it out, maybe someone will find it helpful: (defun c:XList (/ sel dir fil int ent get pnt) (defun RtD (r) (* r 57.29577951)) (if (and (setq sel (ssget "_:L" '((0 . "INSERT")))) (setq int (sslength sel) dir (getvar 'dwgprefix)) (setq fil (open (strcat dir "Block-coordinates.txt") "w")) ) (while (setq ent (ssname sel (setq int (1- int)))) (setq get (entget ent) pnt (cdr (assoc 10 get)) ) (write-line (strcat (cdr (assoc 2 get)) "," (rtos (RtD (cdr (assoc 50 get)))) "," (rtos (cdr (assoc 41 get))) "," (rtos (cdr (assoc 42 get))) "," (rtos (cdr (assoc 43 get))) "," (rtos (car pnt) 2) "," (rtos (cadr pnt) 2) "," (rtos (caddr pnt) 2) "," (cdr (assoc 8 get)) ) fil) ;(write-line (strcat (cdr (assoc 2 get)) "," (rtos (car pnt) 2) "," (rtos (cadr pnt) 2) "," (rtos (caddr pnt) 2) "," (cdr (assoc 41 get))) fil) ; (write-line (strcat (cdr (assoc 2 get)) "," (cdr (assoc 50 get)) "," (cdr (assoc 41 get)) "," (cdr (assoc 42 get)) "," (cdr (assoc 43 get)) "," (rtos (car pnt) 2) "," (rtos (cadr pnt) 2) "," (rtos (caddr pnt) 2) "," (cdr (assoc 8 get))) fil) ) ) (if fil (close fil)) (princ) ) Edited October 28 by Vittorio solved by myself 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.