;;; Same.lsp ;;; ;;; Same version 1.0 ; ; *** Still needs some work to handle text justification matching *** ; ; ;;; ;;; Pick a block or text. Will insert another copy of the block ;;; on the same layer with the same scale factor. ;;; You select a new point and rotation of the new block. ;;; ;;; The new block is inserted using the xscale factor. It is assumed ;;; that y and z scale factors are the same as the x scale factor. ;;; ;;; If text is selected, will ,match text height and style. ;;; ;;; Copyright (C) 1998 by J. Marsden DeLapp ;;; Author J. Marsden DeLapp ;;; ;;; v1.00 4/23/98 ; ;***************************************************************** ;dxf function takes an integer dxf code and ent data list and ;returns the value for that dxf code (defun dxf (code elist) (cdr (assoc code elist)) ) ;***************************************************************** (defun c:same ( / blknam ed en etype justif) (princ "Same V1.0 Copyright 1998 by J. Marsden DeLapp.") (setq en (entsel "\nSelect a block or text to match: ") ed (entget (car en)) ) (setq etype (dxf 0 ed)) (cond ((= etype "INSERT") (progn (setq blknam (dxf 2 ed));get blockname (setvar "CLAYER" (dxf 8 ed));change current layer to match block (princ (strcat "\nBlock: " blknam " on layer: " (getvar "CLAYER"))) (command ".insert" blknam "s" (dxf 41 ed) pause pause) );progn ) ((= etype "TEXT") (progn (setvar "CLAYER" (dxf 8 ed));change current layer to match block (setvar "TEXTSTYLE" (dxf 7 ed));match text style (setvar "TEXTSIZE" (dxf 40 ed));match text height (setq justif (dxf 72 ed));justification (princ (strcat "\nTextStyle: " (getvar "textstyle") "; Height: " (rtos (getvar "textsize")) "; On layer: " (getvar "clayer"))) (command ".dtext" "J" justif (getpoint "\nPick text insertion point") "") ) ) (T (princ "\nEntity was not a block or text! Nothing to do. ") ) );cond (princ) ) (princ "\nSame loaded. Start with \"Same\".") (princ)