Author Topic: Table Maker Anyone?  (Read 5474 times)

0 Members and 1 Guest are viewing this topic.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Table Maker Anyone?
« on: May 23, 2008, 03:13:17 PM »
Has anyone created a lisp or seen a lisp that will take an ACAD Table object & create the lisp code needed to make the table?
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Table Maker Anyone?
« Reply #1 on: May 23, 2008, 03:52:46 PM »
Has anyone created a lisp or seen a lisp that will take an ACAD Table object & create the lisp code needed to make the table?
I make one from scratch in my import text routine.  Are you looking to copy one?
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Table Maker Anyone?
« Reply #2 on: May 23, 2008, 04:58:34 PM »
Yes.
What i have is a request to dynamically make a table. That is parts of the master table may be left out.
Rather than importing the table I thought that extracting the necessary data into a lisp table maker routine
would make it easier to break the table into separate parts.
But I wouldn't create a lisp to do that for just one use.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Table Maker Anyone?
« Reply #3 on: May 23, 2008, 05:08:52 PM »
I don't have anything like that, but it might be do able.  I take it you would want to keep the header, and title rows of the the table, and then just copy the selected rows of the table to the new one?
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Table Maker Anyone?
« Reply #4 on: May 23, 2008, 05:17:08 PM »
I wasn't going to go that far with it.
Just have the user select a table & the routine create a lisp subroutine that would recreate the table.
Then I would manually manipulate the new lisp routine to make it more flexable.

This would be a tool to fast track the table creator portion of a lisp.
So you would manually create a table & teak it until it was just right & then run the lisp to make the creator subroutine.

Just like the EntityMaker.lsp for complex entities.

In theory like this routine.
http://www.theswamp.org/index.php?topic=4814.msg112107#msg112107
PS I have a newer version.
« Last Edit: May 23, 2008, 05:22:46 PM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Table Maker Anyone?
« Reply #5 on: May 23, 2008, 05:39:29 PM »
I don't know if I would go that route as the dxf code for tables is long and confusing, and I think you might have to make a block definition also for the new table.  Here is the code for a table that is 3x7
Quote
(-1 . <Entity name: 7ed2c050>)
(0 . "ACAD_TABLE")
(330 . <Entity name: 7ed10cf8>)
(5 . "BA")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "0")
(100 . "AcDbBlockReference")
(2 . "*T1")
(10 11.8979 23.124 0.0)
(41 . 1.0)
(42 . 1.0)
(43 . 1.0)
(50 . 0.0)
(70 . 0)
(71 . 0)
(44 . 0.0)
(45 . 0.0)
(210 0.0 0.0 1.0)
(100 . "AcDbTable")
(342 . <Entity name: 7ed10e78>)
(343 . <Entity name: 7ed2c058>)
(11 1.0 0.0 0.0)
(90 . 54)
(91 . 7)
(92 . 3)
(93 . 65539)
(94 . 0)
(95 . 0)
(96 . 0)
(280 . 1)
(281 . 1)
(170 . 5)
(141 . 0.386667)
(141 . 0.386667)
(141 . 0.386667)
(141 . 0.386667)
(141 . 0.386667)
(141 . 0.386667)
(141 . 0.386667)
(142 . 1.30476)
(142 . 1.66667)
(142 . 1.72381)
(171 . 1)
(172 . 0)
(173 . 0)
(174 . 0)
(175 . 1)
(176 . 1)
(177 . 48)
(178 . 0)
(145 . 0.0)
(1 . "ASDFA")
(7 . "RomanD")
(140 . 0.2)
(171 . 1)
(172 . 0)
(173 . 0)
(174 . 0)
(175 . 1)
(176 . 1)
(177 . 48)
(178 . 0)
(145 . 0.0)
(1 . "ASDFA-1")
(7 . "RomanD")
(140 . 0.2)
(171 . 1)
(172 . 0)
(173 . 0)
(174 . 0)
(175 . 1)
(176 . 1)
(177 . 48)
(178 . 0)
(145 . 0.0)
(1 . "ASDFA-2")
(7 . "RomanD")
(140 . 0.2)
(171 . 1)
(172 . 0)
(173 . 0)
(174 . 0)
(175 . 1)
(176 . 1)
(177 . 48)
(178 . 0)
(145 . 0.0)
(1 . "FDA")
(7 . "RomanD")
(140 . 0.2)
(171 . 1)
(172 . 0)
(173 . 0)
(174 . 0)
(175 . 1)
(176 . 1)
(177 . 48)
(178 . 0)
(145 . 0.0)
(1 . "FDA-1")
(7 . "RomanD")
(140 . 0.2)
(171 . 1)
(172 . 0)
(173 . 0)
(174 . 0)
(175 . 1)
(176 . 1)
(177 . 48)
(178 . 0)
(145 . 0.0)
(1 . "FDA-2")
(7 . "RomanD")
(140 . 0.2)
(171 . 1)
(172 . 0)
(173 . 0)
(174 . 0)
(175 . 1)
(176 . 1)
(177 . 48)
(178 . 0)
(145 . 0.0)
(1 . "DF")
(7 . "RomanD")
(140 . 0.2)
(171 . 1)
(172 . 0)
(173 . 0)
(174 . 0)
(175 . 1)
(176 . 1)
(177 . 48)
(178 . 0)
(145 . 0.0)
(1 . "DF-1")
(7 . "RomanD")
(140 . 0.2)
(171 . 1)
(172 . 0)
(173 . 0)
(174 . 0)
(175 . 1)
(176 . 1)
(177 . 48)
(178 . 0)
(145 . 0.0)
(1 . "DF-2")
(7 . "RomanD")
(140 . 0.2)
(171 . 1)
(172 . 0)
(173 . 0)
(174 . 0)
(175 . 1)
(176 . 1)
(177 . 48)
(178 . 0)
(145 . 0.0)
(1 . "AFD")
(7 . "RomanD")
(140 . 0.2)
(171 . 1)
(172 . 0)
(173 . 0)
(174 . 0)
(175 . 1)
(176 . 1)
(177 . 48)
(178 . 0)
(145 . 0.0)
(1 . "AFD-1")
(7 . "RomanD")
(140 . 0.2)
(171 . 1)
(172 . 0)
(173 . 0)
(174 . 0)
(175 . 1)
(176 . 1)
(177 . 48)
(178 . 0)
(145 . 0.0)
(1 . "AFD-2")
(7 . "RomanD")
(140 . 0.2)
(171 . 1)
(172 . 0)
(173 . 0)
(174 . 0)
(175 . 1)
(176 . 1)
(177 . 48)
(178 . 0)
(145 . 0.0)
(1 . "ASD")
(7 . "RomanD")
(140 . 0.2)
(171 . 1)
(172 . 0)
(173 . 0)
(174 . 0)
(175 . 1)
(176 . 1)
(177 . 48)
(178 . 0)
(145 . 0.0)
(1 . "ASD-1")
(7 . "RomanD")
(140 . 0.2)
(171 . 1)
(172 . 0)
(173 . 0)
(174 . 0)
(175 . 1)
(176 . 1)
(177 . 48)
(178 . 0)
(145 . 0.0)
(1 . "ASD-2")
(7 . "RomanD")
(140 . 0.2)
(171 . 1)
(172 . 0)
(173 . 0)
(174 . 0)
(175 . 1)
(176 . 1)
(177 . 48)
(178 . 0)
(145 . 0.0)
(1 . "FA")
(7 . "RomanD")
(140 . 0.2)
(171 . 1)
(172 . 0)
(173 . 0)
(174 . 0)
(175 . 1)
(176 . 1)
(177 . 48)
(178 . 0)
(145 . 0.0)
(1 . "FA-1")
(7 . "RomanD")
(140 . 0.2)
(171 . 1)
(172 . 0)
(173 . 0)
(174 . 0)
(175 . 1)
(176 . 1)
(177 . 48)
(178 . 0)
(145 . 0.0)
(1 . "FA-2")
(7 . "RomanD")
(140 . 0.2)
(171 . 1)
(172 . 0)
(173 . 0)
(174 . 0)
(175 . 1)
(176 . 1)
(177 . 48)
(178 . 0)
(145 . 0.0)
(1 . "FD")
(7 . "RomanD")
(140 . 0.2)
(171 . 1)
(172 . 0)
(173 . 0)
(174 . 0)
(175 . 1)
(176 . 1)
(177 . 48)
(178 . 0)
(145 . 0.0)
(1 . "FD-1")
(7 . "RomanD")
(140 . 0.2)
(171 . 1)
(172 . 0)
(173 . 0)
(174 . 0)
(175 . 1)
(176 . 1)
(177 . 48)
(178 . 0)
(145 . 0.0)
(1 . "FD-2")
(7 . "RomanD")
(140 . 0.2)
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Table Maker Anyone?
« Reply #6 on: May 23, 2008, 06:39:01 PM »
I was just using that as an example of the process. I think the vla method would be the way to go.
Basically reversing the AddTable process.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Table Maker Anyone?
« Reply #7 on: May 24, 2008, 11:05:33 AM »
Well I found the next best thing.
Converts a plain table to an ACAD Table.
http://tinyurl.com/6ol54s
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Fatty

  • Guest
Re: Table Maker Anyone?
« Reply #8 on: May 25, 2008, 07:09:40 AM »
Ask VovKa, he knows how to
entmake table
I have this lisp but I can't share it with you
because of I'm not an author :)

~'J'~

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Table Maker Anyone?
« Reply #9 on: May 25, 2008, 08:28:39 AM »
Thanks Fatty but The method the table is created is not that important.
My main goal was to be able to select an existing TABLE & have the routine generate a lisp
that would be able to recreate the TABLE. Or maybe you knew that already.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Crank

  • Water Moccasin
  • Posts: 1503
Re: Table Maker Anyone?
« Reply #10 on: May 25, 2008, 10:05:37 AM »
http://au.autodesk.com/sessions/?speaker=Peter+Jamtgaard&year=All
Take a look at Peter's TableMagic stuff. There is much information to study if you're interested. I think the UpdateTable function is what you're looking for.
BTW.: I also have an update of the main function that came from waun.org.
« Last Edit: May 25, 2008, 10:08:43 AM by Crank »
Vault Professional 2023     +     AEC Collection

VovKa

  • Water Moccasin
  • Posts: 1632
  • Ukraine
Re: Table Maker Anyone?
« Reply #11 on: May 25, 2008, 11:38:41 AM »
Ask VovKa, he knows how to
entmake table
I have this lisp but I can't share it with you
because of I'm not an author :)

~'J'~
VovKa knows nothing about acad table creation, he is using acad 2004 which is too old to know anything about tables :)
i see a little misunderstanding here...

anyway, Oleg, feel free to share anything you think is mine :)

Fatty

  • Guest
Re: Table Maker Anyone?
« Reply #12 on: May 25, 2008, 03:27:49 PM »
Ah, sorry
Attached is written by VK  :-)

~'J'~

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Table Maker Anyone?
« Reply #13 on: May 25, 2008, 04:46:03 PM »
Thanks Crank, here is the Table Magic routine  http://www.theswamp.org/index.php?topic=13878.msg167603#msg167603
I was aware of the routine but  was hoping someone had already done what I was after.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Table Maker Anyone?
« Reply #14 on: May 27, 2008, 02:30:15 PM »
Was bored, and this seemed like a challenge, so here is what I came up with to copy part of a table to a new table.  The object selected has to be a table table.

It will copy the title, if any, always.  If you select in the header row, then it will copy the header as a header type, else if will copy the data as a data type.  Only works on text tables.

Code: [Select]
(defun c:CopyPartOfTable (/ Pt ss EndPt VwDir cnt Ent Obj sRow sCol eRow eCol RowColList InsPt maxRow Title Header TblObj
    cntRow cntCol tempCntCol oOsMode)
   
    (if
        (and
            (setq oOsMode (getvar 'OsMode))
            (setvar 'OsMode 0)
            (setq Pt (getpoint "\n Select first point of window (not in title row): "))
            (setq ss
                (ssget
                    "_C"
                    (getvar 'VsMin)
                    (getvar 'VsMax)
                    '((0 . "ACAD_TABLE"))
                )
            )
            (setq EndPt (getcorner Pt "\n Select second point of window (not in title row): "))
            (setq VwDir (getvar 'ViewDir))
            (setq cnt -1)
            (progn
                (while (setq Ent (ssname ss (setq cnt (1+ cnt))))
                    (setq Obj (vlax-ename->vla-object Ent))
                    (if
                        (and
                            (equal (vla-HitTest Obj (vlax-3d-point Pt) (vlax-3d-point VwDir) 'sRow 'sCol) :vlax-true)
                            (equal (vla-HitTest Obj (vlax-3d-point EndPt) (vlax-3d-point VwDir) 'eRow 'eCol) :vlax-true)
                            sRow sCol eRow eCol
                            (not RowColList)
                        )
                        (setq RowColList (list Obj sRow sCol eRow eCol))
                    )
                )
                (equal (length RowColList) 5)
            )
            (setq InsPt (getpoint "\n Insertion point for new table: "))
        )
        (progn
            (setq MaxRow (1+ (abs (- (nth 1 RowColList) (nth 3 RowColList)))))
            (setq sRow 1)
            (if (equal (vla-get-TitleSuppressed (car RowColList)) :vlax-true)
                (progn
                    (setq Title :vlax-true)
                    (setq sRow (1- sRow))
                )
                (progn
                    (setq Title :vlax-false)
                    (setq MaxRow (1+ MaxRow))
                )
            )
            (setq TblObj
                (vlax-invoke
                    (vlax-get
                        (vla-get-ActiveDocument (vlax-get-Acad-Object))
                        (if (equal (getvar 'CVport) 1)
                            'PaperSpace
                            'ModelSpace
                        )
                    )
                    'AddTable
                    InsPt
                    MaxRow
                    (1+ (abs (- (nth 2 RowColList) (nth 4 RowColList))))
                    (vla-GetRowHeight (car RowColList) (cadr RowColList))
                    (vla-GetColumnWidth (car RowColList) (caddr RowColList))
                )
            )
            (vla-put-RegenerateTableSuppressed TblObj :vlax-true)
            (vla-put-TitleSuppressed TblObj Title)
            (if (equal Title :vlax-false)
                (progn
                    (vla-SetText TblObj 0 0 (vla-GetText (car RowColList) 0 0))
                    (vla-SetCellTextHeight TblObj 0 0 (vla-GetCellTextHeight (car RowColList) 0 0))
                    (vla-SetCellAlignment TblObj 0 0 (vla-GetCellAlignment (car RowColList)  0 0))
                )
            )
            (setq eRow
                (if (< (cadr RowColList) (cadddr RowColList))
                    (cadr RowColList)
                    (cadddr RowColList)
                )
            )
            (if
                (and
                    (equal (vla-get-HeaderSuppressed (car RowColList)) :vlax-flase)
                    (equal eRow 1)
                )
                (vla-put-HeaderSuppressed TblObj :vlax-false)
            )
            (setq cntRow (1+ (abs (- (cadr RowColList) (cadddr RowColList)))))
            (setq eCol
                (if (< (caddr RowColList) (last RowColList))
                    (caddr RowColList)
                    (last RowColList)
                )
            )
            (setq cntCol (1+ (abs (- (caddr RowColList) (last RowColList)))))
            (repeat cntRow
                (setq cnt 0)
                (setq tempCntCol eCol)
                (repeat cntCol
                    (vla-SetText TblObj sRow cnt (vla-GetText (car RowColList) eRow tempCntCol))
                    (vla-SetCellTextHeight TblObj sRow cnt (vla-GetCellTextHeight (car RowColList) eRow tempCntCol))
                    (vla-SetCellAlignment TblObj sRow cnt (vla-GetCellAlignment (car RowColList) eRow tempCntCol))
                    (setq cnt (1+ cnt))
                    (setq tempCntCol (1+ tempCntCol))
                )
                (setq eRow (1+ eRow))
                (setq sRow (1+ sRow))
            )
            (vla-put-RegenerateTableSuppressed TblObj :vlax-false)
        )
    )
    (setvar 'OsMode oOsMode)
    (princ)
)
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.