Shib Sankar Posted May 24 Posted May 24 Can anyone help me to write a code ?? Which Identifies each closed polyline (rectangle) on the "ss-bor" layer. Finds the text entity (content) of text on the "ss-pre" layer which is within (rectangle) on the "ss-bor" layer . Selects all entities on the "ss-part" layer within the (rectangle) on the "ss-bor" layer. Creates a block using the text value from the "ss-pre" layer as the block name, including all selected entities from the "ss-part" layer within the (rectangle) on the "ss-bor" layer. and loop though each (rectangle) on the "ss-bor" layer and make block of each as above mentioned.. For information i have attached my dwg file G27.dwg Quote
BIGAL Posted May 25 Posted May 25 (edited) Do you know much about lisp ? 1st returns 8 entities in your dwg as you have before and after remove "X" if you want to select dwg area objects. (setq ss (ssget "X" '((0 . "LWPOLYLINE")(cons 8 "ss-bor")(cons 410 (getvar 'ctab))))) Loop through ss and get co-ordinates of each rectang. (if plent (setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (car plent)))))) Then get the text with another ssget, it should only get 1 then retrieve Text string (setq ss2 (ssget "CP" co-ords '((0 . "TEXT")"(cons 8 "ss-pre")(cons 410 (getvar 'ctab))))) Then get line work (setq ss3 (ssget "CP" co-ords '((0 . "*LINE")"(cons 8 "ss-part")(cons 410 (getvar 'ctab))))) Then make block using ss3. Continue looping till end. This is just sequence not a full program. Edited May 25 by BIGAL 1 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.