Zeusovsky Posted February 11, 2010 Posted February 11, 2010 I have a drawing but I want to know if is possible to detect if a "AcDbText" Object is Inside of Circle Object. Circle.EntityName = "AcDbCircle" The objects are in ThisDrawing.ModelSpace The Circle is inside of other circle, the Circle1.Radius = 8" and the Circle2.Radius= 7" and inside of the both circles it's the text object I need to be sure if the text is inside. I have a list in Excel for example the value 002, I need to find this text on drawing but 002 could be appear in other place of the drawing. The key is 002 inside of the circles. If anybody could help me with code for do that, I would be grateful Eng. Zeus Alberto Paez Renteria Triumph Aerospace Group Example.dxf Quote
Lee Mac Posted February 11, 2010 Posted February 11, 2010 Are you wanting to test whether just the insertion point of the text is inside the circle? Or whether all of the text object is inside the circle? If its just the insertion point, you can just test the distance from the center of the circle to the insertion point. If its all the text object, you could get the bounding box of the text object and check that all four points are within the radius of the circle. Lee Quote
JohnM Posted February 11, 2010 Posted February 11, 2010 Try a selection set filtering for the circle and radius Then step through the selection set and use the get bounding box function Do another selection set with a window using the points returned from the bounding box and filter for AcDbText and the value if needed. Then you can have a message appear if it is inside or not Quote
Lee Mac Posted February 11, 2010 Posted February 11, 2010 Example: (defun inCircle (obj CirObj / Mi Ma cen rad) (mapcar (function set) '(obj CirObj) (mapcar (function (lambda (x) (if (eq 'VLA-OBJECT (type x)) x (vlax-ename->vla-object x)))) (list obj CirObj))) (vla-getBoundingBox obj 'Mi 'Ma) (mapcar (function set) '(Mi Ma) (mapcar (function vlax-safearray->list) (list Mi Ma))) (setq cen (vlax-get CirObj 'Center) rad (vla-get-Radius CirObj)) (and (<= (distance Mi cen) rad) (<= (distance Ma cen) rad) (<= (distance (list (car Mi) (cadr Ma)) cen) rad) (<= (distance (list (car Ma) (cadr Mi)) cen) rad))) Test function: (defun c:test (/ ent Cir) (if (and (setq ent (car (entsel "\nSelect Object to Test: "))) (setq Cir (car (entsel "\nSelect Circle: "))) (eq "CIRCLE" (cdr (assoc 0 (entget Cir))))) (inCircle ent Cir))) Sorry its not VBA :wink: Quote
fixo Posted February 13, 2010 Posted February 13, 2010 I have a drawing but I want to know if is possible to detect if a "AcDbText" Object is Inside of Circle Object.Circle.EntityName = "AcDbCircle" The objects are in ThisDrawing.ModelSpace The Circle is inside of other circle, the Circle1.Radius = 8" and the Circle2.Radius= 7" and inside of the both circles it's the text object I need to be sure if the text is inside. I have a list in Excel for example the value 002, I need to find this text on drawing but 002 could be appear in other place of the drawing. The key is 002 inside of the circles. If anybody could help me with code for do that, I would be grateful Eng. Zeus Alberto Paez Renteria Triumph Aerospace Group See my response here: http://discussion.autodesk.com/forums/thread.jspa?threadID=762108&tstart=0 ~'J'~ Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.