Jump to content

Copy and automatically align a block to the existing block


Recommended Posts

Posted

Hello,

I'm looking for a lisp solution to a simple but yet tedious problem. There few hundreds block that had to be placed (copied) and aligned to existing blocks (that is an additional block to be placed under an existing block where would be different pair of blocks in each case).

 

Basically what it has to do is to use an insertion point and rotation angle of an existing block (parent block) to serve as a placement and alignment reference for a different block (child block) to be copied/inserted/placed in. See the attached picture for illustration.

 

Thanks in advance!

Capture.JPG

Posted

When you pick 1st block you can get all the properties like insertionpoint, scale and rotation.

 

So you may need a look up matching the 1st block with second block and the insertion point offset adjustment. 

 

(setq ent (entget (car (entsel "\nPick 1st block "))))
(setq ins (cdr (assoc 10 ent))
ang (cdr (assoc 50 ent))
bname (cdr (assoc 2 ent))
)

; work out new insert point and rotation
(command "-insert" bname2 s 1 newins newrot)

 

  • Like 1

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...