Jump to content

Recommended Posts

Posted

Hi all

 

I Basically want to create a lisp to use on an AutoCAD table to adjust the style, width and height.

 

I have had a look at the entity data to see if they were anything obvious but instantly realised that i was out of my depth.

 

Has anyone done anything like this before? if so how??

Posted

It not so difficult. Define function like this to draw some table and retrieve ActiveX object of it:

 

(defun AddNewTable()

 (vl-load-com) ; load Visual LISP extension

 (setq mSp(vla-get-ModelSpace  ; get ModelSpace object
     (vla-get-ActiveDocument
       (vlax-get-acad-object)))
iPt(getpoint "\nSpecify insertion point: ") ; specify insertion point
nTbl(vla-AddTable mSp ; add new table in Model Space
                  (vlax-3d-point iPt) ; in insertion point
                  5  ; 5 rows
                  3  ; 3 columns
                  25.0  ; row height
                  400.0) ; column width
); end setq
 ); end of AddNewTable

 

You can to try it in command line:

 

Command: (setq nTbl(AddNewTable))
Specify insertion point: #<VLA-OBJECT IAcadTable2 0e9f41fc>

 

Now you can change any of table properties, for example add two columns with width 200.0 after 3-rd column:

 

Command: (vla-InsertColumns nTbl 3 200.0 2)
nil

 

Or change height of 3 row to 100.0:

 

Command: (vla-SetRowHeight nTbl 3 100.0)
nil

 

Look for all Table object properties and methods in ActiveX and VBA reference (inside Developer Help).

Posted

Thank you for the detailed explaination.

 

I'm a bit baffled tbh!

 

All i want to be able to do is modify an existing AutoCAD table, looking at what you have posted it looks like it isn't going to be that easy.

 

Problem is the AutoCAD table is generated by third party software (CadDuct) as a bill of materials, when the table inserts it inserts on standard Table style. I then have to place the table on the correct style then i have to resize the table, by selecting it then in the properties window input a new width and height. This is basically the process i want to automate in a lisp.

 

So i guess all i need to know is how i can modify the width and hight of an existing AutoCAD table.

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