Jump to content

Table (Tablestyle) modification after the fact? Scriptable? Command Line Options?


ILoveMadoka

Recommended Posts

Autocad 2020
Out of the box, to make a change to an existing table / tablestyle (specifically the border line weights/fonts) to BYLAYER
You have to start the TABLESTYLE command,
pick the desired style (we have 12 separate ones)
Pick the Borders tab, pick modify, pick the cell style (3ea), pick the border and assign
the lineweight, linetype and color to ALL BORDERS.
Pick the Text tab and change the font and text height and color.
Change to the next cell style and repeat all those steps again.

 

I have a directory full of drawings that have screwed up tables and wanted to know if there was an easier way?

 

Is there a command line option?

Any way to "Save" a table in order to replace one with another?
Can such changes be scripted?

 

Has anyone seen any autolisp routines for accomplishing such?

 

Any help/advice is greatly appreciated...

 

here is an example:

 

image.thumb.png.34d8bec9db3fb89d4351e52f352f2071.png

I want it to look more like the one below (without having to jump thru all the hoops to get it this way)

maybe not quite this light but all the lines the same thickness

image.thumb.png.89977e26059e3c27c408b3891b3be247.png

 

 

Edited by ILoveMadoka
Link to comment
Share on other sites

Maybe this (vlax-put obj 'StyleName "Standard") need multi tables to test. It may need some other table regen to take affect. It was returning change of style name in a simple test.

Link to comment
Share on other sites

  • 2 years later...

Revisiting this topic....

I came across this code from Tharwat

 

(defun c:Test ( / sty tbl obj row col r c)
 ;;	Tharwat - Date:  11.Jul.2017	;;

 (setq sty "Standard") ;; Change the Text Style to suit your desired one.
 (if (and (or (tblsearch "STYLE" sty)
            (alert (strcat "Text style <" sty "> is not found in drawing <!>"))
            )
        (princ "\nPick on Table :")
        (setq tbl (ssget "_+.:S:E:L" '((0 . "ACAD_TABLE"))))
        (setq obj (vlax-ename->vla-object (ssname tbl 0))
              row (vla-get-rows obj)
              col (vla-get-columns obj)
              r 0 c 0
              )
        )
   (repeat row
     (repeat col
       (vla-setcelltextstyle obj r c sty) (setq c (1+ c))
       )
     (setq r (1+ r) c 0)
     )
   )
 (princ)
 ) (vl-load-com)

 

and I was wondering can this methodology be used to change the border color of all cell styles to Bylayer?
I was hoping the BYLAYER command would do it but it does not change Tablestyles or Cell Styles.

I don't know where to begin.

I also created a "clean" table style then changed my existing tables to that new style but the cell styles kept their original settings.

 

Should I make this a new question?

Link to comment
Share on other sites

I also found this setting cell margins

 

(defun c:Example_CellMargin_by_Jef()
  (setq acadObj (vlax-get-acad-object))
  (setq doc (vla-get-ActiveDocument acadObj))
  (setq dictionaries (vla-get-Dictionaries doc))
  (setq dictObj (vla-Item dictionaries "acad_tablestyle"))
  (setq keyName "Copy of Standard");name of table style to be changed
  (setq tempObj (vla-GetObject dictObj keyName))
  (vla-put-HorzCellMargin tempObj 0.22)
  (vla-put-VertCellMargin tempObj 0.25)
  )

 

I'm dancing all around this with no luck...

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