;************************************* RINSERT.LSP ************************************************** ;AUTOLISP PROGRAM TO REPLACE INSERTS ; DEVELOPED BY: Patrick J. Hughes Jr. ; ENGINEERED DESIGN SOLUTIONS ; 2620 Auburn Street ; Rockford Il, 61101 ; (815) 965-0882 ; e-mail: duhvinci@engds.com ; website: http://www.engds.com ; ; Visit http://www.engds.com/Products/Chronos/Chronos.html to download a 30 day free ; trial of Chronos for AutoCAD - a time logging utility for AutoCAD based products. ; ; ; Visit http://www.engds.com/Products/DwgGrid/DwgGrid.html to download a 15 day free ; trial of DwgGrid for AutoCAD - Preview ,Print, and save the AutoCAD preview image ; including Inventor, Apprentice, and Revit file types. ; ; ;******************************************************************************** (defun C:RINSERT ( / en ed) (setq rinsname (USTR 0 "\nBlock to Insert" rinsname nil)) (setq ss1 (ssget)) ;Blocks to Replace (if (= nil ss1) (setq ss1max 0) (setq ss1max (sslength ss1)) );if (setq count 0) (while (< count ss1max) (setq en (ssname ss1 count) ed (entget en) );setq (if (= "INSERT" (dxf 0 ed)) (progn (if rinsname (progn (command "INSERT" rinsname nil) (setq ed (subst (cons 2 rinsname) (assoc 2 ed) ed)) (entmod ed) );progn );if );progn );if (setq count (1+ count)) );while (princ) );defun (defun dxf(code elist) (cdr (assoc code elist)) ;finds the association pair, strips 1st element );defun (princ)