Jump to content

Table creation with LISP running too slow


JackStone

Recommended Posts

Good afternoon.

 

In my line of work it is necessary for me to create tables (bills of materials) and I have automated this process with some AutoLISP programs.

 

The problem is that when I'm done collecting and organizing the data and it is time to actually draw the table the program takes forever to finish the task.

 

One table, for example, has 6 columns and a variable number of rows. If I create it with, say, 10 rows the program will run quite fast, taking only a couple of seconds to draw the table.

 

If, however, I try to create this table with 100 (one hundred) rows then it takes the program 40 (forty) minutes to finish the task! That depends a bit on the computer hardware, but not so significantly.

 

The method I'm using to create the table is vla-AddTable etc. I start by creating an empty table with the final number of rows and columns and then proceed to set the contents of each cell (always a string) and the type of the cell ("Data", "Header" or "Title").

 

I may post the code here if necessary, but it's a bit long and I feel the explanation above should make things clear enough.

 

So my question is this: why is AutoCAD taking so long to draw the table? The time elapsed does not scale linearly with the size of the table. Why would that be?

 

I know there are some workarounds to this problem (such as drawing the table as exploded text and lines or dividing a 100-row table into twenty 5-row tables, which are quick to draw individually), but I wanted to get a better understanding of the problem before I attempted to solve it in another way.

 

So, has anyone encountered such difficulty before? Any tips for me?

 

I thank you all in advance for your time and interest!

Link to comment
Share on other sites

I would suggest setting the regeneratetablesuppressed property to :vlax-true before modifying the table contents, and setting it back to :vlax-false when all operations have been performed.

  • Like 1
Link to comment
Share on other sites

Fantastic! Works like a charm, Lee! A two hundred-line table was created in two seconds, literally.

 

Yet again you have saved my sloppy programs! :)

 

Thank you very much! This topic may be closed now.

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