vla-GetCellStyles (Not to be confused with vla-GetCellStyle)

vla-GetCellStyles (Not to be confused with vla-GetCellStyle)

SLloydBowen
Enthusiast Enthusiast
882 Views
3 Replies
Message 1 of 4

vla-GetCellStyles (Not to be confused with vla-GetCellStyle)

SLloydBowen
Enthusiast
Enthusiast

I am trying to get the information about the cell styles stored in a table style.  I have been trying to use the vla-GetCellStyles method on the desired table style object.  The documentation for the last few releases of AutoCAD do not include code examples for this method.  I've tried what seems to be a thousand different options in an attempt to get valid results.  Obviously, if I was successful, I wouldn't be here.  Has anyone successfully used this method?  If so, would you mind sharing some sample code?

0 Likes
883 Views
3 Replies
Replies (3)
Message 2 of 4

dlanorh
Advisor
Advisor

This has been asked several times across various forums, and the answer always seems to be the same, nil is returned.

 

See Here 

 

(setq c_dicts (vla-get-Dictionaries (vla-get-activedocument (vlax-get-acad-object))))
(setq tbls_dict (vla-Item dicts "acad_tablestyle"))
(setq tbl_sty (vla-item dictobj 0)) ; the first table style in the tablestyle dictionary

Once you have tbl_sty, and using the undocumented invoke method (allows parameters to be int/real/str/list)

 

(vlax-invoke ts 'getcellstyles 0)
(vlax-invoke ts 'getcellstyles 0.0)
(vlax-invoke ts 'getcellstyles "0")

All return nil, and don't throw an error

So there is a method, there are no examples of how to access it, an at the moment you can't get it to return anything but nil. 🤔

 

Of course it is entirely possible it is there, but is incorrectly configured, disabled or requires something to be set, other than default, first.

I am not one of the robots you're looking for

0 Likes
Message 3 of 4

Sea-Haven
Mentor
Mentor

Buried deep somewhere.

(setq dicts (vla-get-Dictionaries (vla-get-activedocument (vlax-get-acad-object))))
(setq tbls_dict (vla-Item dicts "acad_tablestyle")
(setq tbl_sty (vla-item tbls_dict 0))
(vlax-dump-object tbl_sty)
0 Likes
Message 4 of 4

Sea-Haven
Mentor
Mentor

A bit more need to add has-property- name

(setq x 0)
(repeat (vla-get-count dicts)
(princ (vla-item dicts x))
(princ "\n")
(setq x (+ x 1))
)

Have a look at the log file

0 Likes