0 Members and 1 Guest are viewing this topic.
The methods and properties are ActiveX controls of the object. They are pretty much the same as VBA. To see and explanation look in the help files. Get to the 'Developer Documentation' and then you will see a section called 'ActiveX and VBA Developer's Guide'. In there you will see sections for properties, methods and objects, these are what you are looking for. They are explained in VBA terms, so the syntax is a little different, but you have many people here who know what they are doing, so if the help isn't enough post a question.
From what I gather from a quick pass am I correct to assume that I can not edit the text string, I have to delete the text and recreate it with the new text string?
(vla-put-TextString (vlax-ename->vla-object (car (entsel "\n Select text entity to change: ") ) ) "This is a test!!")
Quote from: Krushert on November 09, 2006, 01:35:07 PMFrom what I gather from a quick pass am I correct to assume that I can not edit the text string, I have to delete the text and recreate it with the new text string?Nope, you can change the string of an existing text string.Code: [Select](vla-put-TextString (vlax-ename->vla-object (car (entsel "\n Select text entity to change: ") ) ) "This is a test!!")Is this what you were thinking? Sorry if I misinterpreted your intentions.
Good to hear Krushert. One thing, not sure if you know or not, but when using the ActiveX controls in Lisp, you need to call (vl-load-com) at least once per ACAD session, more is okay.Let us know when you need help/finish your program. Have fun.
;;; VPort-Scale Lisp 11/09/2006 Ted Krush with a lot help from TheSwamp.org;;; Adds the viewport scale factor to an existing textstring with use of a feild;;;(defun c:vpsc (/ ID) (princ) (vl-cmdf ".undo" "m") (vl-load-com) (setq ID (vla-get-objectid (vlax-ename->vla-object (car (entsel "\n Select Viewport Entity ")) ) ) ) (vla-put-TextString (vlax-ename->vla-object (car (entsel "\n Select text entity to change: ") ) ) (strcat "SCALE: " "%<\\AcObjProp Object(%<\\_ObjId " (itoa ID) ">%).CustomScale \\f \"%lu4%pr8%ct2%qf2816 = 1'-0\\\"\">%" ) ) (princ))
;;; VPort-Scale Lisp 11/09/2006 Ted Krush with a lot help from TheSwamp.org;;; Adds the viewport scale factor to an existing textstring with use of a feild;;;(defun c:vpsc (/ ID)
1'-0\\\"\">%"
One slight change!Quote;;; VPort-Scale Lisp 11/09/2006 Ted Krush with a lot help from TheSwamp.org;;; Adds the viewport scale factor to an existing textstring with use of a feild;;;(defun c:vpsc (/ ID)
Glad you got it working... I was having a heck of a time with this part:Quote1'-0\\\"\">%"The slashes and quotes were throwing me for a loop.
">%).CustomScale \\f \"%lu4%pr8%ct2%qf2816 = 1'-0\\\"\">%"
No that is what I am exactly looking for.Thanks. Now I am going to hack all this together. Thanks Tim & Matt & Ronjonp[I will be back.
Yeah what is that line doing anywayCode: [Select] ">%).CustomScale \\f \"%lu4%pr8%ct2%qf2816 = 1'-0\\\"\">%"
Quote from: Krushert on November 09, 2006, 04:06:00 PMYeah what is that line doing anywayCode: [Select] ">%).CustomScale \\f \"%lu4%pr8%ct2%qf2816 = 1'-0\\\"\">%"It's basically telling the text (or mtext or whatever) how to display the viewport's scale.The attached image might help to explain things better.All of this gobble-dee-goop (CustomScale \\f \"%lu4%pr8%ct2%qf2816 = 1') is contained in the field expression section at the bottom of the dialog box.
One slight change!Quote;;; VPort-Scale Lisp 11/09/2006 Ted Krush with a lot help from TheSwamp.org;;; Adds the viewport scale factor to an existing textstring with use of a feild;;;(defun c:vpsc (/ ID)I think I'm gonna pirate a copy of this and use to change entity values to the CTAB value. We use that in our title blocks and just rename the layout tabs; also used for batch plotting.Glad you got it working... I was having a heck of a time with this part:Quote1'-0\\\"\">%"The slashes and quotes were throwing me for a loop.
(defun c:ctabfield (/) (vla-put-TextString (vlax-ename->vla-object (car (entsel "\n Select text: ")) ) "%<\\AcVar ctab \\f \"%tc1\">%" ) (princ))
We do the same thing here with the CTAB field....thanks for the idea.