PDA

View Full Version : Add text within a table to a selection set?



anderson.scottglen
2007-03-15, 11:32 PM
Is there a way with Lisp to add text within a table to a selection set? I'm not looking for (nentsel), more like something that doesn't ask for any user input, like (ssget)

Thanks

Adesu
2007-03-16, 12:10 AM
Is there a way with Lisp to add text within a table to a selection set? I'm not looking for (nentsel), more like something that doesn't ask for any user input, like (ssget)

Thanks

Hi anderson,
Maybe like this,but I'm not sure this code would help you,test it


(defun c:sct (/ colwidth numcolumns numrows objtable rowheight sp vgad vgao vgms)
(vl-load-com)
(setq sp (vlax-3d-point '(0 0 0)))
(setq vgao (vlax-get-acad-object))
(setq vgad (vla-get-activedocument vgao))
(setq vgms (vla-get-modelspace vgad))
(setq numrows 5)
(setq numcolumns 5)
(setq rowheight 0.5)
(setq colwidth 1)
(setq objtable (vla-addtable vgms sp numrows numcolumns rowheight colwidth))
; RetVal = object.AddTable(InsertionPoint, NumRows, NumColumns, RowHeight, ColWidth)
(vla-settext objtable 0 0 "TABLE title")
(vla-settext objtable 1 0 "A")
(vla-settext objtable 1 1 "B")
(vla-settext objtable 1 2 "C")
(vla-settext objtable 1 3 "D")
(vla-settext objtable 1 4 "E")
(vla-settext objtable 2 0 "1")
(vla-settext objtable 3 0 "2")
(vla-settext objtable 4 0 "3")
(command "_zoom" "e")
(princ)
)

anderson.scottglen
2007-03-16, 03:20 PM
That's not quite what I'm looking for, but thanks anyway for the effort. I would like to grab the existing mtext objects in an existing table, as opposed to creating a new table.

Also, my Map 06 help file has no commands that begin with vla-*. Is there a list of them somewhere? All I get through the help file is vl-*, vlax-* and vlr-*.

T.Willey
2007-03-16, 03:59 PM
What are you trying to do? You can grab the table object, then you can step through it's columns and rows and do what you want to the mtext objects. If you give a little more information, we might be able to help you out.

anderson.scottglen
2007-03-16, 10:17 PM
Nothing too complicated, just want to change all the mtext in a table to be uppercase. I have a couple dozen tables I need to edit soon.

T.Willey
2007-03-16, 11:32 PM
((lambda (/ ss Rcnt Ccnt Ent Obj)

(if (setq ss (ssget "x" '((0 . "ACAD_TABLE"))))
(while (setq Ent (ssname ss 0))
(setq Obj (vlax-ename->vla-object Ent))
(setq Rcnt 0)
(repeat (vla-get-Rows Obj)
(setq Ccnt 0)
(repeat (vla-get-Columns Obj)
(vlax-invoke Obj 'SetText Rcnt Ccnt (strcase (vlax-invoke Obj 'GetText Rcnt Ccnt)))
(setq Ccnt (1+ Ccnt))
)
(setq Rcnt (1+ Rcnt))
)
(ssdel Ent ss)
)
)
(princ)
))


??

anderson.scottglen
2007-03-18, 08:54 PM
That just about did it, there's just some occasional fields I need to preserve, but they're rare and I can manually edit those. Thanks for your help!

Is there a place to find those visual lisp commands? Like I said above, they're not all in my developer's help file

T.Willey
2007-03-19, 03:10 PM
That just about did it, there's just some occasional fields I need to preserve, but they're rare and I can manually edit those. Thanks for your help!

You're welcome.



Is there a place to find those visual lisp commands? Like I said above, they're not all in my developer's help file

They are in the help file, but they don't look exactly like this. The help files show you the way to use them in VBA, so you have to do some deciphering. Once in the help you want to look for the 'ActiveX and VBA Reference'.