Jump to content

Batch blocking


Shib Sankar

Recommended Posts

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

Link to comment
Share on other sites

Posted (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 by BIGAL
  • Like 1
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...