elise_moss
2005-03-29 18:49:06 UTC
I am trying to automate the process for entering data into an ACAD_TABLE. I read an excel spreadsheet and create a list in lisp then try to populate the table.
Here are my code snippets:
**************************
;;;placing a table from scratch
(setq ins-point (getpoint "\nSelect point to place table: "))
(setq rowno (getint "\nNumber of rows for table: "))
(setq colno (getint "\nNumber of columns for table: "))
(setq colno 4)
(setq rowno (/ list-len 4))
(entmake (list(cons 0 "ACAD_TABLE")))
(entmake (list(cons 10 ins-point)))
(entmake (list(cons 91 rowno)))
(entmake (list(cons 92 colno)))
(setq list-counter 0)
(setq table-text (nth list-counter xcel-list))
(while (< list-counter list-len)
(entmake (list(cons 1 table-text)))
(entmake (list(cons 7 table-text-style)))
(setq list-counter (1+ list-counter))
);end while
(entmake (list(cons 0 "seqend")))
(setq ent (entlast))
(entupd ent)
)
*************************************************
This one looks like like it would work and when I make the first couple of entmake calls, they look like they go thru OK. But it does not create the table.
Next snippet, using an existing table:
************************************************
(while (< itemno ent-count)
; get the first item in the list to put in the table
(setq table-text (nth list-counter xcel-list))
(setq ent-list-line (nth itemno ent-list))
(setq ent-list (subst (cons 1 table-text)(cons 1 ent-list-line) ent-list))
(setq itemno (1+ itemno))
(setq ent-list-line (nth itemno ent-list))
(setq ent-list (subst (cons 7 table-text-style)(cons 7 ent-list) ent-list))
(setq itemno (+ itemno 9))
(setq list-counter (1+ list-counter))
(setq ent (entnext ent))
) ;end while
*********************************************************
This one will actually place the data into the first cell, but none of the other cells, it just keeps overwriting the data in the first cell. So, it obviously not advancing to the next cell. When I try using an entnext call, it looks like a table is not a nested entity, even though it looks like a polyline when you inspect the dxf data.
Suggestions are most welcome...prefer not to do this in VBA.
Thanks,
Elise Moss
www.mossdesigns.com
Here are my code snippets:
**************************
;;;placing a table from scratch
(setq ins-point (getpoint "\nSelect point to place table: "))
(setq rowno (getint "\nNumber of rows for table: "))
(setq colno (getint "\nNumber of columns for table: "))
(setq colno 4)
(setq rowno (/ list-len 4))
(entmake (list(cons 0 "ACAD_TABLE")))
(entmake (list(cons 10 ins-point)))
(entmake (list(cons 91 rowno)))
(entmake (list(cons 92 colno)))
(setq list-counter 0)
(setq table-text (nth list-counter xcel-list))
(while (< list-counter list-len)
(entmake (list(cons 1 table-text)))
(entmake (list(cons 7 table-text-style)))
(setq list-counter (1+ list-counter))
);end while
(entmake (list(cons 0 "seqend")))
(setq ent (entlast))
(entupd ent)
)
*************************************************
This one looks like like it would work and when I make the first couple of entmake calls, they look like they go thru OK. But it does not create the table.
Next snippet, using an existing table:
************************************************
(while (< itemno ent-count)
; get the first item in the list to put in the table
(setq table-text (nth list-counter xcel-list))
(setq ent-list-line (nth itemno ent-list))
(setq ent-list (subst (cons 1 table-text)(cons 1 ent-list-line) ent-list))
(setq itemno (1+ itemno))
(setq ent-list-line (nth itemno ent-list))
(setq ent-list (subst (cons 7 table-text-style)(cons 7 ent-list) ent-list))
(setq itemno (+ itemno 9))
(setq list-counter (1+ list-counter))
(setq ent (entnext ent))
) ;end while
*********************************************************
This one will actually place the data into the first cell, but none of the other cells, it just keeps overwriting the data in the first cell. So, it obviously not advancing to the next cell. When I try using an entnext call, it looks like a table is not a nested entity, even though it looks like a polyline when you inspect the dxf data.
Suggestions are most welcome...prefer not to do this in VBA.
Thanks,
Elise Moss
www.mossdesigns.com