Roy_043 Posted March 1, 2018 Posted March 1, 2018 (edited) I am attaching my solution below as it is different from what Lee has come up with. But keep in mind that both pieces of code return the center in block space coordinates. If the array is moved, rotated, scaled etc. the point will no longer match WCS coordinates. You can use Gile's excellent matrix code to translate it. ; (KGA_Sys_ArrayPolarCenter (car (entsel))) (defun KGA_Sys_ArrayPolarCenter (enm / elst pt) (if (and (setq elst (entget enm)) (vl-position '(0 . "INSERT") elst) (wcmatch (cdr (assoc 2 elst)) "`*[uu]*") (setq elst (cdr (member '(102 . "{ACAD_REACTORS") elst))) (= (caar elst) 330) (setq elst (entget (cdar elst))) (vl-position '(0 . "ACDBASSOCDEPENDENCY") elst) ; Required? (setq elst (entget (cdr (assoc 330 elst)))) (vl-position '(0 . "ACDBASSOCACTION") elst) ; Required? (vl-position '(1 . "Radius") elst) ; Polar check. ) (vl-some '(lambda (sub / elst) (if (and (= 360 (car sub)) (setq elst (entget (cdr sub))) (vl-position '(0 . "ACDBASSOCVERTEXACTIONPARAM") elst) (vl-position '(1 . "Origin") elst) ) (cdr (assoc 10 elst)) ; Point in block space. ) ) elst ) ) ) Edited March 1, 2018 by Roy_043 Quote
Roy_043 Posted March 2, 2018 Posted March 2, 2018 Just digging around Lee. Mind you I didn't find this 'digging down'. Instead I created an array with a know center, saved as DXF and looked for the coords in that file. Using the handle of the entity I was then able to 'dig up' in the dwg. This approach, although not very sophisticated, can be quite effective. Quote
Grrr Posted March 2, 2018 Posted March 2, 2018 Just digging around Lee.Mind you I didn't find this 'digging down'. Instead I created an array with a know center, saved as DXF and looked for the coords in that file. Using the handle of the entity I was then able to 'dig up' in the dwg. This approach, although not very sophisticated, can be quite effective. Interesting approach, Roy. 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.