PDA

View Full Version : How to turn ssget "x" into a vla-object


d_m_hopper
2009-07-29, 11:16 PM
I need to filter for a bunch of text, then get its text value, so it can be diplayed and edited in a DCL dialog

see post #14 for attached .lsp and .dcl, if you think you can help me

thanks

Opie
2009-07-29, 11:23 PM
To extract a vla-object from an ename, use the vlax-ename->vla-object function.

d_m_hopper
2009-07-30, 02:19 PM
Opie I knew that piece of the puzzle, just not how to do it without selecting something.

So I am not sure if this is correct, but it works?

(defun c:Getgontext (/ GON_Quote-Text cnt Vlaobject-Text txtstr)
(vl-load-com)
(setq GON_Quote-Text
(ssget "x" '((0 . "TEXT")(410 . "Model")(8 . "CPSHA")(62 . 6)
)
)
)
(setq cnt 0)
(setq Vlaobject-Text
(vlax-ename->vla-object (ssname GON_Quote-Text cnt))
)
(setq Txtstr (vla-get-textstring Vlaobject-Text))
)

trouble is I would like the filter to include the start point of the text I need, when I add the (10 62.0 -73.7083 0.0) I get a bad ssget

I am browsing the Developer Help and canot see how to treat this

Opie
2009-07-30, 02:57 PM
You will probably want to create a point list with a CP or WP selection and including your other filters.

d_m_hopper
2009-07-30, 02:59 PM
You will probably want to create a point list with a CP or WP selection and including your other filters.

ok will try that

d_m_hopper
2009-07-30, 04:17 PM
Thanks for the tip Opie

works like I need it to

(defun c:GetChecktext (/ sschecked cnt pt1 pt2 Vlaobject-Text CBtxtstr)
(vl-load-com)
(setq pt1 '(1675.79 -925.8)
pt2 '(1663.16 -923.691))
(setq sschecked (ssget "c" pt1 pt2'((0 . "TEXT")(410 . "Model")(8 . "border")(62 . 6))))
(setq cnt 0)
(setq Vlaobject-Text
(vlax-ename->vla-object (ssname sschecked cnt))
)
(setq CBTxtstr (vla-get-textstring Vlaobject-Text))
)

ccowgill
2009-07-30, 05:30 PM
You will probably want to create a point list with a CP or WP selection and including your other filters.
sorry to piggyback this thread, but, how would you use a fence to accomplish a similar type of thing. Right now I am using getpoint to select a 3d point on an object, can fence be used to return a selection set and a 3d point? Help isnt very clear on what information to provide to fence, and what information is output when a fence ssget is used.

Opie
2009-07-30, 06:04 PM
I would surmise that you provide a point list with the selection method of fence. I have not tested it. It would also guess the points would need to be in the viewable screen area of the drawing.

d_m_hopper
2009-07-30, 06:11 PM
sorry to piggyback this thread, but, how would you use a fence to accomplish a similar type of thing. Right now I am using getpoint to select a 3d point on an object, can fence be used to return a selection set and a 3d point? Help isnt very clear on what information to provide to fence, and what information is output when a fence ssget is used.

Unfortunately, I can't answer that. I took Opies advice and was able to get the info I needed from the Dev Help for my issue.

Sorry Chris

peter
2009-07-30, 07:48 PM
Using ActiveX include

(vl-load-com)

You can directly access the activeselectionset object and iterate through it.

(ssget "X")

(vlax-for objItem (vla-get-activeselectionset
(vla-get-activedocument
(vlax-get-acad-object)))
(vla-put-color objItem 1)
)

alanjt
2009-07-31, 05:55 PM
just another option:
(and (setq SSX (ssget "_X"))
(setq SSL (mapcar
'(lambda (x)
(vlax-ename->vla-object
(cadr x)
)
)
(ssnamex SSX)
)
)
)

d_m_hopper
2009-08-04, 02:53 PM
Ok I can get the text string, but I cannot get it to show up in the edit box...I am positve that I have confused myself pouring over DCL help sites.
What I ultimately want to do is get the string to display in the edit box, then put it back if it is edited or not by the user.
Can anyone help?

;TB GON/QUOTE GREEN TEXT
(defun TBGONQT (/ ssTBGONQT cnt pt5 pt6 Vlaobject-Text1 TBGONQTTxtstr)
(setq pt5 '(1619 -938)
pt6 '(1607 -936))
(setq ssTBGONQT (ssget "c" pt5 pt6 '((0 . "TEXT")(410 . "Model")(8 . "BORDER")(62 . 3))))
(setq cnt 0)
(setq Vlaobject-Text1
(vlax-ename->vla-object (ssname ssTBGONQT cnt))
)
(setq edit1 (vla-get-textstring Vlaobject-Text1))
)

d_m_hopper
2009-08-04, 03:05 PM
Ok so one last search and I found something on afralisp that might help

afralisp (http://www.afralisp.net/vl/attab-vl.htm)

d_m_hopper
2009-08-04, 05:38 PM
totally stumped now...:?:

alanjt
2009-08-05, 02:41 PM
your comments (titles for subroutines) aren't commented out, put a semicolon in front of them.

d_m_hopper
2009-08-05, 03:17 PM
your comments (titles for subroutines) aren't commented out, put a semicolon in front of them.

ok, fixed that, now error: bad argument type: stringp nil

d_m_hopper
2009-08-13, 09:56 PM
does anyone see my error? I tried to modify a routine from afralisp to suit my needs, link on page 2

attached dwg