AL, I did see that and that makes sense, thank you, I just am not sure how to implement what you suggested. I am just picking my way thru writing this. This is the third time I've tried to write a lisp routine, so I am having to figure out every command as I go.
Pbe, Thank you as well. I am looking at what you wrote and trying to make sense of it. Did you just write that from scratch? If so, I am even more intimidated by this now. There is a LOT going on there that I don't understand. I basically have to go thru one line at a time and figure it out and its taking me a while. I ran the routine on my example and it worked great, but when I tried it on a full drawing, it doesn't work, just returns nil. I am not able to attach a full drawing for you (proprietary).
To try and clarify what I am trying to accomplish, I'll attempt to give a better explanation. The company I am working for has approx. 1000 P&IDs that have been drawn/modified over the past 25 years with very little standardization. I have tried to standardize symbology, but for years they let various contractors modify the drawings with little oversight. The result is nothing is the same from drawing to drawing. I need all of the instrument bubbles to be a block with 3 attributes (unit/instrument type/instrument number). There may be 5 instrument bubbles on one drawing and 80 on the next.
Some of the existing bubbles are a circle with 3 lines of text, some are a block (a circle with various hidden attribute data that is not needed) with 3 lines of text, and some are various other things. Really too many different examples to show them all.
I want to automate as much of this process as I can, but I have to make sure that I get them all, even if I have to manually do a few odd ones.
I am attaching a new example drawing that shows some of the various different examples I'm dealing with.
example3.dwg
its an easy fix, at least now i have some other conditions to work on..... i'll see what i can do.
EDIT:
At first glance, we need to somehow filter those BLOCKS/CIRCLE "at the same coord",
65% OF THE OCCURANCES ON ALL OF MY DRAWINGS: Done
Also blocks with a none center insertion point. the rest is easy: Done
Circles with two or three TEXT : Done
1 or 2 Attributes: Done
Text/Attribute: DONE
Block/Circle: DONE
Circle radius: DONE
Watch this space I wrote last night use a circle as ssget filter to retrieve the text its still a work in progress. Doinf it for anyone that may need something like that.
I appreciate Pbe is working hard on a full answer, here is a method of finding objects inside a circle along the lines of the code you started to write which uses a more automated approach, at the moment it uses a manual pick of circles but that would be removed to a pick all to be changed. A word of caution it deletes the objects as a test stage, undo will bring back. As I hinted I would make it find all wether it be 1 2 3 or more text entries.
; started life as converts a circle to a series of chords; now find objects inside a circle(vl-load-com)(setq oldsnap (getvar "osmode"))(setvar "osmode" 0)(setq oldecho (getvar "cmdecho"))(setvar "cmdecho" 0)(while (setq ent (entsel "\nPick circle: "));(if (= div nil) (setq div (getint "\nEnter number of chords: "))) (setq div 20) ; works ok(setq obj (vlax-ename->vla-object (car ent))) (setq angdiv (/ (* 2.0 pi) div))(setq cenpt (vlax-safearray->list (vlax-variant-value (vla-get-center obj))))(setq rad (vla-get-radius obj))(setq ang 0.0)(repeat div(setq newpt (polar cenpt ang rad))(setq lst (cons (list (car newpt)(cadr newpt)) lst))(setq ang (+ ang angdiv))) ;repeat; select text inside a circle; selection set of text within polygon(setq ss (ssget "_WP" lst '((0 . "Text,Mtext"))));if always 3 do this way else repeat as required for sslength of ss for variable number of texts(setq t1 (vla-get-textstring (vlax-ename->vla-object (ssname ss 0))))(setq t2 (vla-get-textstring (vlax-ename->vla-object (ssname ss 1))))(setq t3 (vla-get-textstring (vlax-ename->vla-object (ssname ss 2))))(alert (strcat t1 " " t2 " " t3)); now lets delete all (setq x (sslength ss))(while (setq ent2 (ssname ss (setq x (- x 1)))) (entdel ent2)) ; delete text inside(entdel (car ent)) ;delete circle(setq ss nil lst nil)) ; end while ; now do insert new block !!!!(alert "stage 2 not done yet")) ; end while (setvar "cmdecho" oldecho)(setvar "osmode" oldsnap)(princ)
part 2 this makes squares and circles as block with text or numbers