Jump to content

xy coordinate and text extractor Lisp


gugamg

Recommended Posts

I'm sorry if I'm posting this question on the wrong place, it's my first one on the forum :?

 

I have a drawing in which there are some polylines/objects drawn (usually rectangles) with some text next to them. I'm using a lisp to get their x and y coordinates to excel, but my problem is that I have to associate them to the text somehow.

 

Just so you'll understand, I'm doing this because I'm trying to automatize my project drawings, in which I have to paste blocks to the center of each of these rectangles. I’ll use excel to build the command lines for a script with the block name and x,y coordinates, and the script will paste the blocks on these coordinates provided by the lisp. But without the text there’s no reference of which block belongs to which line on excel.

 

I have a simple drawing to illustrate it, along with the lisps and script I'm using. If anybody could help me I would really appreciate it, since these projects can sometimes add up to more than a 100 rectangles :ouch:. If you have any other solutions I’ll be happy to try them.

 

Thank you very much

 

PS: The insert block script is just an example with some random coordinates

Excel Script Builder.xlsx

BLOCO118.dwg

BLOCO116.dwg

Insert Block Script.scr

409-OC-E01R0 - Planta de cargas - Formas - SALAO.dwg

Center Extract.lsp

Link to comment
Share on other sites

gugamg, I've looked your lisp and drawing and read your text message... So according to your problem, how to associate text data with rectangles (polylines) consider following...

 

Make sstxt (sel. set of all text entities) before ss in your code, so that last sel. set could be used in active selection and iteration through it (vlax-for) in your code... Before this iteration begins, create list of associations - insertion point of text and text entities... This list should look like (((x1 y1 z1) (ename of text1)) ((x2 y2 z2) (ename of text2)) ...)... Then when iteration through polylines begins and when each centroid coordinates are found, you should sort this list by shortest distances between centroid and insertion points of text... Obtain 3 nearest text enames as there are 3 texts surrounding each polyline (rectangle)... Obtain texts data (stored in DXF 1)... When these 3 texts data are stored, implement each of them into csv file with centroid coordinates and pline handle... And that's it associations are done, then you'll have to figure how to use this data in csv file to make corresponding block be inserted on right centroid coordinates... According to this csv file you should make lisp that will create and execute script with appropriate block insertions, or even better read data of csv into variable list and do insertions through running lisp - this method is faster then with script... Alternatively if you have more this csv files and more dwgs that are to be processed, then I would suggest that you still use script as it can open and process operations and save dwg and close it and then repeat this procedure again on next dwg with next csv file...

 

I don't have right now time to code this for you, as I am on vacation, but I am sure you understood what I explained...

For example showing the same approach on similar task look into this code...

http://www.autolisp.com/forum/threads/892-Help-me-edit-complete-my-lisp!/page2&p=#11

 

HTH,

Regards, Marko Ribar, d.i.a.

Link to comment
Share on other sites

Looking at your dwg I would maybe go in a different direction I would create two blocks 1 a sq which is your rectangle with a hidden attribute the rectang number, the 2nd block is you text, simply use the x & y scale for size of the rectang and fill in the text display a known offset away. The table can be created by just reading the attribs from the blocks.

 

; example for creating a table form blocks
; dwg index to a table
; by Alan H NOV 2013
(defun AH:dwgindex (/ doc objtable ss1 lay ans ans2 plotabs ss1 tag2 tag3 list1 list2 curlayout colwidth numcolumns numrows INC rowheight )
(vl-load-com)
(setq curlayout (getvar "ctab"))
(if (= curlayout "Model")
(progn
(Alert "You need to be in a layout for this option")
(exit)
) ; end progn
) ; end if model
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(setq curspace (vla-get-paperspace doc))
(setq pt1 (vlax-3d-point (getpoint "\nPick point for top left hand of table:  "))) 
; read values from title blocks
(setq bname "DA1DRTXT")
(setq tag2 "DRG_NO") ;attribute tag name
(setq tag3 "WORKS_DESCRIPTION") ;attribute tag name
(setq ss1 (ssget "x"  (list (cons 0 "INSERT") (cons 2 bname))))
(if (= ss1 nil) ; for tomkinson jobs
(progn 
(setq bname "TITLE")
(setq ss1 (ssget "x"  (list (cons 0 "INSERT") (cons 2 bname))))
)
)
(setq INC (sslength ss1))  
(repeat INC
(foreach att (vlax-invoke (vlax-ename->vla-object (ssname SS1 (SETQ INC (- INC 1)) )) 'getattributes) 
       (if (= tag2 (strcase (vla-get-tagstring att)))
           (progn
           (setq ans (vla-get-textstring att))
           (if (/= ans NIL)
           (setq list1 (cons ans list1))
           ) ; if 
           ); end progn
         ) ; end if
       (if (= tag3 (strcase (vla-get-tagstring att)))
         (progn
         (setq ans2 (vla-get-textstring att))
         (if (/= ans2 NIL)
             (setq list2 (cons ans2 list2)) 
          ) ; end if
          ) ; end progn
 ) ; end if tag3 
   
) ; end foreach
) ; end repeat
(setvar 'ctab curlayout)
(command "Zoom" "E")
(command "regen")

(reverse list1)
;(reverse list2)
; now do table 
(setq numrows (+ 2 (sslength ss1)))
(setq numcolumns 2)
(setq rowheight 0.2)
(setq colwidth 150)
(setq objtable (vla-addtable curspace pt1 numrows numcolumns rowheight colwidth))
(vla-settext objtable 0 0 "DRAWING REGISTER")
(vla-settext objtable 1 0 "DRAWING NUMBER") 
(vla-settext objtable 1 1 "DRAWING TITLE") 
(SETQ X 0)
(SETQ Y 2)
(REPEAT (sslength ss1)
 (vla-settext objtable Y 0 (NTH X LIST1))
 (vla-settext objtable Y 1 (NTH X LIST2))
 (vla-setrowheight objtable y 7)
 (SETQ X (+ X 1))
 (SETQ Y (+ Y 1))
)
(vla-setcolumnwidth objtable 0 55)
(vla-setcolumnwidth objtable 1 170)
(command "_zoom" "e")
); end AH defun
(AH:dwgindex)
(princ)

Link to comment
Share on other sites

gugamg, I've looked your lisp and drawing and read your text message... So according to your problem, how to associate text data with rectangles (polylines) consider following...

 

Make sstxt (sel. set of all text entities) before ss in your code, so that last sel. set could be used in active selection and iteration through it (vlax-for) in your code... Before this iteration begins, create list of associations - insertion point of text and text entities... This list should look like (((x1 y1 z1) (ename of text1)) ((x2 y2 z2) (ename of text2)) ...)... Then when iteration through polylines begins and when each centroid coordinates are found, you should sort this list by shortest distances between centroid and insertion points of text... Obtain 3 nearest text enames as there are 3 texts surrounding each polyline (rectangle)... Obtain texts data (stored in DXF 1)... When these 3 texts data are stored, implement each of them into csv file with centroid coordinates and pline handle... And that's it associations are done, then you'll have to figure how to use this data in csv file to make corresponding block be inserted on right centroid coordinates... According to this csv file you should make lisp that will create and execute script with appropriate block insertions, or even better read data of csv into variable list and do insertions through running lisp - this method is faster then with script... Alternatively if you have more this csv files and more dwgs that are to be processed, then I would suggest that you still use script as it can open and process operations and save dwg and close it and then repeat this procedure again on next dwg with next csv file...

 

I don't have right now time to code this for you, as I am on vacation, but I am sure you understood what I explained...

For example showing the same approach on similar task look into this code...

http://www.autolisp.com/forum/threads/892-Help-me-edit-complete-my-lisp!/page2&p=#11

 

HTH,

Regards, Marko Ribar, d.i.a.

 

First of all, thank you for taking the time to answer me marko_ribar

 

I've actually never written a line of code before in my life, that first lisp was found after a lot of searching on blogs. I understood the logic of what you explained and even tried the code on the link you posted, that´s exactly what I want to do (get the nearest text to each polyline/rectangle). Actually just the first line (P1, P2, ...) would be enough to link with the excel spreadsheet.

 

If I understand correctly the next step you mentioned would be a huge improvement oh what my first idea was. I was going to use excel to build the command lines and paste them on a script, and then run it on autocad. If I get what you’re saying right, there’s a way I can create a lisp that would build this script for me, and that script would read a csv (like a block list?) and make the insertions on the drawing?

 

This is what I need the output file to look like:

P1 x1 y1

P2 x2 y2

P3 x3 y3

 

Anyway, I don´t want to take too much of your time, so could you just show me which part of your lisp I should insert on the lisp I already have that would be great! I’ll try to do the rest for myself, I don’t want to cause too much trouble! When you have the time of course, I would feel bad if I knew I interrupted your vacation :)

Link to comment
Share on other sites

Looking at your dwg I would maybe go in a different direction I would create two blocks 1 a sq which is your rectangle with a hidden attribute the rectang number, the 2nd block is you text, simply use the x & y scale for size of the rectang and fill in the text display a known offset away. The table can be created by just reading the attribs from the blocks.

 

; example for creating a table form blocks
; dwg index to a table
; by Alan H NOV 2013
(defun AH:dwgindex (/ doc objtable ss1 lay ans ans2 plotabs ss1 tag2 tag3 list1 list2 curlayout colwidth numcolumns numrows INC rowheight )
(vl-load-com)
(setq curlayout (getvar "ctab"))
(if (= curlayout "Model")
(progn
(Alert "You need to be in a layout for this option")
(exit)
) ; end progn
) ; end if model
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(setq curspace (vla-get-paperspace doc))
(setq pt1 (vlax-3d-point (getpoint "\nPick point for top left hand of table:  "))) 
; read values from title blocks
(setq bname "DA1DRTXT")
(setq tag2 "DRG_NO") ;attribute tag name
(setq tag3 "WORKS_DESCRIPTION") ;attribute tag name
(setq ss1 (ssget "x"  (list (cons 0 "INSERT") (cons 2 bname))))
(if (= ss1 nil) ; for tomkinson jobs
(progn 
(setq bname "TITLE")
(setq ss1 (ssget "x"  (list (cons 0 "INSERT") (cons 2 bname))))
)
)
(setq INC (sslength ss1))  
(repeat INC
(foreach att (vlax-invoke (vlax-ename->vla-object (ssname SS1 (SETQ INC (- INC 1)) )) 'getattributes) 
       (if (= tag2 (strcase (vla-get-tagstring att)))
           (progn
           (setq ans (vla-get-textstring att))
           (if (/= ans NIL)
           (setq list1 (cons ans list1))
           ) ; if 
           ); end progn
         ) ; end if
       (if (= tag3 (strcase (vla-get-tagstring att)))
         (progn
         (setq ans2 (vla-get-textstring att))
         (if (/= ans2 NIL)
             (setq list2 (cons ans2 list2)) 
          ) ; end if
          ) ; end progn
 ) ; end if tag3 
   
) ; end foreach
) ; end repeat
(setvar 'ctab curlayout)
(command "Zoom" "E")
(command "regen")

(reverse list1)
;(reverse list2)
; now do table 
(setq numrows (+ 2 (sslength ss1)))
(setq numcolumns 2)
(setq rowheight 0.2)
(setq colwidth 150)
(setq objtable (vla-addtable curspace pt1 numrows numcolumns rowheight colwidth))
(vla-settext objtable 0 0 "DRAWING REGISTER")
(vla-settext objtable 1 0 "DRAWING NUMBER") 
(vla-settext objtable 1 1 "DRAWING TITLE") 
(SETQ X 0)
(SETQ Y 2)
(REPEAT (sslength ss1)
 (vla-settext objtable Y 0 (NTH X LIST1))
 (vla-settext objtable Y 1 (NTH X LIST2))
 (vla-setrowheight objtable y 7)
 (SETQ X (+ X 1))
 (SETQ Y (+ Y 1))
)
(vla-setcolumnwidth objtable 0 55)
(vla-setcolumnwidth objtable 1 170)
(command "_zoom" "e")
); end AH defun
(AH:dwgindex)
(princ)

 

Thank you for your answer BIGAL

 

I tried your code and got an error message, I must be doing something wrong. Could you show me how to use it properly?

It asked me to pick point for top left hand of table, when I try to select the whole drawing or just click some random point I get this message: error: bad argument type: lselsetp nil

Link to comment
Share on other sites

You need to change the block name and tag names this an example of coding to meet the request.

 

I'm sorry Bigal, tried to do as you instructed but it's a little dificult as I never used a block hidden atribute. Would I need to do this manually to each polyline? After searching google for a while I managed to make the atribute, but still got the same error message from the lisp. I even tried to use the data extraction tool, but all I got was a column with each block name and another with their quantity. Not really sure if I did it right :?

409-OC-E01R0 - Planta de cargas - Formas - SALAO.dwg

Link to comment
Share on other sites

Hi,

 

What is the meaning of the last two values in the column Fx (tf) and Fy (tf) ? and where did you get them from as long as they are different ?

 

Hi Tharwat,

 

Those are horizontal loads on a pillar, that will be transfered to the pile foundation which I already dimensioned (on the excel spreadsheet). The blocks I'll insert on each rectangle (pillar) centroid represent those piles.

 

Just so it´s clear, the table that I'm trying to assemble needs to be on excel, so I can build the command lines and paste them on a script. I've just started to learn about lisp, so I wouldn't be able to build one that would do that for me.

 

The table would look something like this:

 

P1 x1 y1

P2 x2 y2

P3 x3 y3

 

I attached a new excel spreadsheet with an example of the script, the part I'm need is in red.

 

Thank you very much

409-OC-E01R0 - Planta de cargas - Formas - SALAO.dwg

Excel Script Builder.xlsx

Link to comment
Share on other sites

You have too much columns in that attached Excel sheet and I just need to know how to get the values of the last two columns to allow me to include them in program .

 

The process of the program is to select TEXTS ( with the same form of yours in the attached drawing ) then write them in a acad table .

Link to comment
Share on other sites

You have too much columns in that attached Excel sheet and I just need to know how to get the values of the last two columns to allow me to include them in program .

 

The process of the program is to select TEXTS ( with the same form of yours in the attached drawing ) then write them in a acad table .

 

I've attached the Excel spreadsheet with the values I need, and the Autocad drawing to get it from. The columns are supressed from the drawing, the only information I need are the rectangle (pillar) centroid and it's reference text (P1, P2, ...).

 

I actually use that Autocad table information when I dimension the pile foundation, but I already have a add in that converts it to excel. I've attached it since it may be usefull to someone, along with the table if you want to try it ;)

Excel Script Builder - Copy.xlsx

409-OC-E01R0 - Planta de cargas - Formas - SALAO.dwg

CADXL.rar

Table.dwg

Link to comment
Share on other sites

Why with every reply you attach the same drawings ????

 

In you first drawing you have included a table with values , and I NEED TO KNOW HOW TO GET THESE VALUES TO INCLUDE THEM IN THE TABLE . that is it.

Link to comment
Share on other sites

Why with every reply you attach the same drawings ????

 

In you first drawing you have included a table with values , and I NEED TO KNOW HOW TO GET THESE VALUES TO INCLUDE THEM IN THE TABLE . that is it.

 

Tharwat,

 

I don't understand what you mean with how to get these values since I didn't calculate them, the table comes ready on the projects I receive from the Structural Engineers (like on the first drawing I attached). I keep sending the same drawing (without the table) because the values on that table are irrelevant to me at this point, I already managed to import them to excel. Not all projects I work with come with a table like that, that's why I'm insisting that you use the second drawing.

 

I'm sorry if I'm not understanding your question, I attached other examples to try to explain better what I need. On these cases the information I use to dimension is next to each rectangle (pillar) instead of on a table. If your routine can import that information along with the pillar number (P1, P2,...) and corresponding centroids that would be perfect. I use that excel add in to do that, and specially in example 1 it takes a lot of work.

Example 1.dwg

Example 2.dwg

Link to comment
Share on other sites

It is up to you .

 

With the following program m you should select Texts ONLY that are with the same form of your first drawing in this thread .

 

(defun c:Test (/ _lst _add:table ss i sn pt st a b c v1 v2 lst)
 ;;						;;
 ;;	Author : Tharwat Al Shoufi		;;
 ;;	Date   : 16. Sep. 2014			;;
 ;;						;;
 (if (setq ss (ssget '((0 . "TEXT") (1 . "P*,* cm,N máx*tf"))))
   (repeat (setq i (sslength ss))
      (setq sn (ssname ss (setq i (1- i)))
           pt (cdr (assoc 10 (entget sn)))
     )
     (cond ((wcmatch (setq st (cdr (assoc 1 (entget sn)))) "P*")
            (setq a (cons (list st sn pt) a))
           )
           ((wcmatch st "* cm") (setq b (cons (list st sn pt) b)))
           ((wcmatch st "N máx*tf") (setq c (cons (list st sn pt) c)))
     )
   )
 )
 (if (and a b c)
   (progn
     (defun _lst (_l / l)
       (mapcar '(lambda (x)
                  (setq l (cons (list (car x)
                                      (cadr x)
                                      (distance (caddr v) (caddr x))
                                )
                                 l
                          )
                  )
                )
               _l
       )
       (vl-sort l '(lambda (j k) (< (caddr j) (caddr k))))
     )
     (defun _add:table (_doc pt _rows _columns hgt _title _head:strings
                        _data:strings _data:alignment / _write:data r
                         tbl r c
                       )
       ;;								;;
       ;; ----------=====[ Function to add Acad table ]=====----------	;;
       ;;								;;
       (defun _write:title:data (r c s align)
         (vla-settext tbl r c s)
         (vla-setcelltextheight tbl r c hgt)
         (vla-setrowheight tbl r (* hgt  2.0))
         (vla-setcellalignment tbl r c align)
       )
       ;;						;;
       (setq tbl (vla-addtable
                   (vlax-get (vla-get-activelayout _doc) 'BLOCK)
                   (vlax-3d-point pt)
                   (+ _rows 2)
                   _columns
                   (* hgt 1.5)
                   (* hgt 1.5)
                 )
       )
       (vla-put-RegenerateTableSuppressed tbl :vlax-true)
       ;;	-----===== { Title part } =====-----	;;
       (_write:title:data 0 0 _title acMiddleCenter)
       ;;	-----===== { Head part } =====-----	;;
       (setq c -1)
        (vla-setrowheight tbl 0 (* hgt 2.5))
       (vla-setrowheight tbl 1 (* hgt 3.5))
       (foreach _h _head:strings
         (vla-settext tbl 1 (setq c (1+ c)) _h)
         (vla-setcelltextheight tbl 1 c hgt)
         (if (eq c 2)
           (vla-setcolumnwidth tbl c (* hgt 10.))
           (vla-setcolumnwidth tbl c (* hgt 5.))
         )
         (vla-setcellalignment tbl 1 c acMiddleCenter)
       )
       ;;	-----===== { Data part } =====-----	;;
       (setq r 2
             c 0
       )
       (foreach x _data:strings
         (foreach _st x
           (_write:title:data r c _st _data:alignment)
           (setq c (1+ c))
         )
         (setq r (1+ r)
               c  0
         )
       )
       ;;						;;
       (vla-put-RegenerateTableSuppressed tbl :vlax-false)
       (princ)
     )
     (foreach v (vl-sort a
                         '(lambda (j k)
                            (< (atoi (substr (car j) 2))
                                (atoi (substr (car k) 2))
                            )
                          )
                )
       (setq v1 (_lst b)
             v2 (_lst c)
       )
       (setq lst (cons (list (car v)
                             (vl-string-right-trim " cm" (caar v1))
                              (vl-string-left-trim
                               "N máx = "
                               (vl-string-right-trim " tf" (caar v2))
                             )
                       )
                       lst
                 )
       )
     )
     (setq lst (reverse lst))
   )
 )
 (if (and lst (setq pt (getpoint "\n Specify Table location :")))
   (_add:table
     (vla-get-activedocument (vlax-get-acad-object))
     pt
     (length lst)
     5
     (cdr (assoc 40 (entget (cadr (car a)))))
     "Pilar"
     '("Nome" "Seção\\P(cm)" "Carga Máx.\\P(tf)" "Fx\\P(tf)"
       "Fy\\P(tf)"
      )
     lst
     acMiddleCenter
   )
 )
 (princ)
)


Link to comment
Share on other sites

It is up to you .

 

With the following program m you should select Texts ONLY that are with the same form of your first drawing in this thread .

 

(defun c:Test (/ _lst _add:table ss i sn pt st a b c v1 v2 lst)
 ;;						;;
 ;;	Author : Tharwat Al Shoufi		;;
 ;;	Date   : 16. Sep. 2014			;;
 ;;						;;
 (if (setq ss (ssget '((0 . "TEXT") (1 . "P*,* cm,N máx*tf"))))
   (repeat (setq i (sslength ss))
      (setq sn (ssname ss (setq i (1- i)))
           pt (cdr (assoc 10 (entget sn)))
     )
     (cond ((wcmatch (setq st (cdr (assoc 1 (entget sn)))) "P*")
            (setq a (cons (list st sn pt) a))
           )
           ((wcmatch st "* cm") (setq b (cons (list st sn pt) b)))
           ((wcmatch st "N máx*tf") (setq c (cons (list st sn pt) c)))
     )
   )
 )
 (if (and a b c)
   (progn
     (defun _lst (_l / l)
       (mapcar '(lambda (x)
                  (setq l (cons (list (car x)
                                      (cadr x)
                                      (distance (caddr v) (caddr x))
                                )
                                 l
                          )
                  )
                )
               _l
       )
       (vl-sort l '(lambda (j k) (< (caddr j) (caddr k))))
     )
     (defun _add:table (_doc pt _rows _columns hgt _title _head:strings
                        _data:strings _data:alignment / _write:data r
                         tbl r c
                       )
       ;;								;;
       ;; ----------=====[ Function to add Acad table ]=====----------	;;
       ;;								;;
       (defun _write:title:data (r c s align)
         (vla-settext tbl r c s)
         (vla-setcelltextheight tbl r c hgt)
         (vla-setrowheight tbl r (* hgt  2.0))
         (vla-setcellalignment tbl r c align)
       )
       ;;						;;
       (setq tbl (vla-addtable
                   (vlax-get (vla-get-activelayout _doc) 'BLOCK)
                   (vlax-3d-point pt)
                   (+ _rows 2)
                   _columns
                   (* hgt 1.5)
                   (* hgt 1.5)
                 )
       )
       (vla-put-RegenerateTableSuppressed tbl :vlax-true)
       ;;	-----===== { Title part } =====-----	;;
       (_write:title:data 0 0 _title acMiddleCenter)
       ;;	-----===== { Head part } =====-----	;;
       (setq c -1)
        (vla-setrowheight tbl 0 (* hgt 2.5))
       (vla-setrowheight tbl 1 (* hgt 3.5))
       (foreach _h _head:strings
         (vla-settext tbl 1 (setq c (1+ c)) _h)
         (vla-setcelltextheight tbl 1 c hgt)
         (if (eq c 2)
           (vla-setcolumnwidth tbl c (* hgt 10.))
           (vla-setcolumnwidth tbl c (* hgt 5.))
         )
         (vla-setcellalignment tbl 1 c acMiddleCenter)
       )
       ;;	-----===== { Data part } =====-----	;;
       (setq r 2
             c 0
       )
       (foreach x _data:strings
         (foreach _st x
           (_write:title:data r c _st _data:alignment)
           (setq c (1+ c))
         )
         (setq r (1+ r)
               c  0
         )
       )
       ;;						;;
       (vla-put-RegenerateTableSuppressed tbl :vlax-false)
       (princ)
     )
     (foreach v (vl-sort a
                         '(lambda (j k)
                            (< (atoi (substr (car j) 2))
                                (atoi (substr (car k) 2))
                            )
                          )
                )
       (setq v1 (_lst b)
             v2 (_lst c)
       )
       (setq lst (cons (list (car v)
                             (vl-string-right-trim " cm" (caar v1))
                              (vl-string-left-trim
                               "N máx = "
                               (vl-string-right-trim " tf" (caar v2))
                             )
                       )
                       lst
                 )
       )
     )
     (setq lst (reverse lst))
   )
 )
 (if (and lst (setq pt (getpoint "\n Specify Table location :")))
   (_add:table
     (vla-get-activedocument (vlax-get-acad-object))
     pt
     (length lst)
     5
     (cdr (assoc 40 (entget (cadr (car a)))))
     "Pilar"
     '("Nome" "Seção\\P(cm)" "Carga Máx.\\P(tf)" "Fx\\P(tf)"
       "Fy\\P(tf)"
      )
     lst
     acMiddleCenter
   )
 )
 (princ)
)


 

Thank You for your help Tharwat,

 

The code is really great but the tables are being created without the polylines x,y coordinates, I'm not sure if I'm doing something wrong...

Link to comment
Share on other sites

Thank You for your help Tharwat,

The code is really great

 

You are welcome gugamg .

 

 

..... but the tables are being created without the polylines x,y coordinates, I'm not sure if I'm doing something wrong...

 

That is what I have been asking you for to add into the table ;)

 

Please remove the codes from your quote of the reply because I will modify the program as soon as you clarify the last two columns' values. :)

Link to comment
Share on other sites

I don't have the polylines x,y coordinates, I extracted them with the Center Extract.lsp on the original post (result attached). Is it possible to combine these results (except the handle and z column) to the table your code generates, and the output to be in excel?

Handles & Centroids.csv

Link to comment
Share on other sites

Tharwat,

 

Sorry if I didn't understand you, but I tried. The Fx and Fy columns you asked me about come with the projects I receive from a Structural Engineer, so that's where I got them from. These are the loads calculated by a program he uses to model the Structure of a building. I don't know why the program this Engineer uses puts only some of the table columns as a text near each pilar, I would have to ask him that. I didn't make the table you see on the first drawing, or the text next to each polyline. Attached is the exact drawing I received.

 

What I really don't get is why these 2 columns are important to your code. Or even that table at all. The only information I'm trying to get are the polylines centroid x,y coordinates and their corresponding names (P1, P2, ...), and those don't depend on that table. I thought all it would take was to adapt the lisp on my original post so it would get the closest text to each polyline...

 

Anyway, I just wanted to thank you again for taking the time and trying to help me. I'm really sorry it didn't work out and hope I didn't cause you any trouble. If you ever come to Brazil just give me a shout, I'll pay you a Caipirinha :)

 

Cheers

409-OC-E01R0 - Planta de cargas - Formas - SALAO.dwg

Link to comment
Share on other sites

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