PDA

View Full Version : vla-get-tablestyles


hofcad
2006-02-15, 02:49 PM
Hello CAD friends,

I was wondering if anyone know why there is a
problem with vla-get-tablestyles.
This is because I can get already the ObjectId in a similar way
from Blocks, Dimstyles, Layers, Linetypes, TextStyles and Views for the Named object type of a Field.

How can I find the Object ID of a tablestyle?

(defun c:test1()
(vl-load-com)
(setq ActDoc (vla-get-ActiveDocument (vlax-get-Acad-Object)))
(setq TabCol (vla-get-TableStyles ActDoc))
(setq TabSty (vla-Item TabCol "Standard"))
(stq ObjID (vla-get-ObjectID TabSty))
(command "_TEXT" '(30 30) "5" "0"
(strcat "%<\\AcObjProp Object(%<\\_ObjId " (itoa objID) ">%).Name>%"))
)

Thanks

HofCAD CSI

[ Moderator Action = ON ] What are [ CODE ] tags... (http://forums.augi.com/misc.php?do=bbcode#code) [ Moderator Action = OFF ]

kennet.sjoberg
2006-02-15, 04:39 PM
I think you can find something interesting in (entget (namedobjdict))

: ) Happy Computing !

kennet

hofcad
2006-02-15, 08:15 PM
I think you can find something interesting in (entget (namedobjdict))

: ) Happy Computing !

kennet

Kennet,

Thanks for the solution!
I can get now the Object ID of a tablestyle, but I am still wondering.

HofCAD CSI

RobertB
2006-02-16, 05:44 AM
I can get now the Object ID of a tablestyle, but I am still wondering.TableStyles are not stored in a "traditional" table/collection, but rather a dictionary. Examine the object model in the ActiveX Reference and you will not find a "TableStyles" collection.

CADmium
2006-02-16, 08:18 AM
Here (http://autocad.cad.de/modules.php?name=News&file=article&sid=25) you can find an example how to handle tablestyles.

dbrower
2006-02-23, 07:49 PM
Not sure if this helps but:...


;;Slightly modified by Dann Brower
(defun c:test1 ()
(vl-load-com)
(setq ActDoc (vla-get-ActiveDocument (vlax-get-Acad-Object))
dict (vla-get-Dictionaries adoc)
)
(setq TabCol (vla-item dict "ACAD_TABLESTYLE"))
(setq TabSty (vla-Item TabCol "Standard"))
(setq ObjID (vla-get-ObjectID TabSty))
(command "_TEXT"
'(30 30)
"5"
"0"
(strcat "%<\\AcObjProp Object(%<\\_ObjId "
(itoa objID)
">%).Name>%"
)
)
)

[ Moderator Action = ON ] What are [ CODE ] tags... (http://forums.augi.com/misc.php?do=bbcode#code) [ Moderator Action = OFF ]

hofcad
2006-03-29, 06:32 PM
Friends,

Thank you so much for this. It's exactly what I have been looking for.
But is it also possible to make an Table-Style with Lisp?

HofCAD CSI

RobertB
2006-03-30, 01:47 AM
Thank you so much for this. It's exactly what I have been looking for.
But is it also possible to make an Table-Style with Lisp?I far prefer to do it in VBA. If you are a Subscription customer, download my AU class CP35-1, Programming Tables to Do More. There is code in there that creates a table style.