Solved! Go to Solution.
Solved by richie_hodgson. Go to Solution.
Your ssget format is incorrect. This is the acceptable formatting:
(ssget [sel-method] [pt1 [pt2]] [pt-list] [filter-list])
Your prompt will have to occur separately:
(princ"\nPick Tile text to Extract Image:")
(setq im (ssname (ssget '((0 . "TEXT"))) 0))
Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator | Layer Apps | List on Steroids | VP Zoom Scales
Exchange App Store
Thanks for that, I worke out the following works as well
(setq obj1 (car (entsel "\nSelect the text string ")))
(setq IM (vla-get-textstring (vlax-ename->vla-object OBJ1)))
thanks again.
Will try your method as it will only select text whereas mine may throw an error if something else is selected.
You have to be careful with (entsel...since this will allow you to select other objects and not just Text which would crash the rest of your code.
Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator | Layer Apps | List on Steroids | VP Zoom Scales
Exchange App Store
Hi
I tried your method in the code and it didn't perform the function, i think it has promis though, essentially there is a grid of text relating to image tiles. With my method you select the text and it puts the relevent image tile there, select the next text and the next image tile is added. It would be nice to be able to select a bunch of those texts and then report those as a list to the insert function so a bunch of tiles get inserted in one go, but I am not yet adept enough a lisp to work that bit out. Maybe someone can help me out with that bit.
Hello again, though tabout it overnight and came up with the following modification:
(setq eset (ssget '((0 . "TEXT"))));Select grid text lables
(setq cntr 0);setup a counter
(while (< cntr (sslength eset));loop through all entities in the selection set
(setq en (nth cntr eset)); get the value of the nth item
(if (setq Found (assoc en DataList)); if it exists on the datalist <---- Something possibly wrong
(progn
(setq pt1 (cdr Found))
(setq ff (strcat "s:/2012urban/" en ".jpg" )); add en to the file path and <---- Something possibly wrong
(command "-image" "A" ff pt1 "479.8697" "358.3897"); put the image in the right place
);end progn
); end of iff
(setq cntr(+ cntr 1));increment the counter
); end of while
I get the following ; error: bad argument type: consp <Selection set: 1e94a> so I think there is something wrong where indicated am I missing a text conversion or something? I have a grid of text that relates to image tile names, so I want to be able to select the relevent text's and cycle through putting the image on the screen. I have attached the full lisp as it differs from the previous. Any clues as to why the error is occuring.
try replacing this line of code:
(setq en (nth cntr eset)); get the value of the nth item
with this line of code:
(setq en (ssname eset cntr)); get the entity from the selection set eset at index cntr
And after this line of code:
(setq pt1 (cdr Found))
You're also missing this line of code that grabs the Text string from the entity which you included in the past:
(setq en (vla-get-textstring (vlax-ename->vla-object en)))
Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator | Layer Apps | List on Steroids | VP Zoom Scales
Exchange App Store
Hi
Thanks for that, I understood your adjustments and put them in the code but it didn't work, however I just changed the location of the
(setq en (vla-get-textstring (vlax-ename->vla-object en))) to just after the (setq en (ssname eset cntr)); get the entity from the selection set eset at index cntr and it all worked wonderfully. I need to put a few more error captures in the code but it has made a painfully slow repetitive process rather pleasent. Thanks for your help.
(setq eset (ssget '((0 . "TEXT"))));Select grid text lables
(setq cntr 0);setup a counter
(while (< cntr (sslength eset));loop through all entities in the selection set
(setq en (ssname eset cntr)); get the entity from the selection set eset at index cntr
(setq en (vla-get-textstring (vlax-ename->vla-object en))); make en a textstring value <--- Put it here instead
(if (setq Found (assoc en DataList)); if it exists on the datalist <---- this needed the textstring value too
(progn
(setq pt1 (cdr Found)); get the insert coordinate <---Not after here
(setq ff (strcat "s:/2012urban/" en ".jpg" )); add en to the file path and
(command "-image" "A" ff pt1 "479.8697" "358.3897"); put the image in the right place
);end progn
); end of iff
(setq cntr(+ cntr 1));increment the counter
); end of while
Regards
Richie
Hi
Thanks for that, I understood your adjustments and put them in the code but it didn't work, however I just changed the location of the
(setq en (vla-get-textstring (vlax-ename->vla-object en))) to just after the (setq en (ssname eset cntr)); get the entity from the selection set eset at index cntr and it all worked wonderfully. I need to put a few more error captures in the code but it has made a painfully slow repetitive process rather pleasent. Thanks for your help.
Regards
Richie
I see your adjustments and they make perfect sense.
BTW, you may also want to include this statement at the beginning since you are using visual lisp functions (vl-...
(vl-load-com)
Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator | Layer Apps | List on Steroids | VP Zoom Scales
Exchange App Store