Author Topic: overlay blocks  (Read 1934 times)

0 Members and 1 Guest are viewing this topic.

aswin

  • Mosquito
  • Posts: 12
overlay blocks
« on: January 16, 2019, 12:13:47 AM »
hi.. Is there any way  to place new blocks (overlay) on top of existing blocks without replacing..?
Abu Dhabi

renkor

  • Newt
  • Posts: 27
Re: overlay blocks
« Reply #1 on: January 23, 2019, 04:49:25 AM »
Hello all,

Any suggestions to this?

ronjonp

  • Needs a day job
  • Posts: 7527
Re: overlay blocks
« Reply #2 on: January 23, 2019, 09:35:49 AM »
Try this:
Code - Auto/Visual Lisp: [Select]
  1. (defun c:foo (/ _dxf e o p s)
  2.   ;; RJP » 2019-01-15
  3.   (defun _dxf (c e) (cdr (assoc c (entget e))))
  4.   (cond ((and (setq e (car (entsel "\nPick source block: ")))
  5.               (= "INSERT" (_dxf 0 e))
  6.               (setq s (ssget ":L" '((0 . "insert"))))
  7.          )
  8.          (ssdel e s)
  9.          (setq p (_dxf 10 e))
  10.          (setq e (vlax-ename->vla-object e))
  11.          (foreach b (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
  12.            (setq o (vla-copy e))
  13.            (vlax-invoke o 'move p (_dxf 10 b))
  14.            ;; (entdel b)
  15.          )
  16.         )
  17.   )
  18.   (princ)
  19. )

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

renkor

  • Newt
  • Posts: 27
Re: overlay blocks
« Reply #3 on: January 23, 2019, 01:29:58 PM »
Hello ronjonp,

It works perfectly, thanks!

ronjonp

  • Needs a day job
  • Posts: 7527
Re: overlay blocks
« Reply #4 on: January 23, 2019, 03:11:42 PM »
You're welcome! :)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC