我已经使用这个例程很多年了(不是我的,是在网上找到的),但是如果块未设置为默认查找,那么它将不适用于具有查找表的动态块。
该例程允许您选择一个块并再次插入,无需查找名称、比例等。
如果有人可以将其更改为非默认查找设置的动态块上的无故障,我将不胜感激。
- ; Purpose: To insert a block by selecting an already inserted block to
- ; determine block name and scale.
- (defun c:IE (/ params hdrlst typ)
- ;======================================================================================================
- ; Initialize memory and important system variables
- (setq marker 'mark mark 0)
- (setq hdrlst (list
- (cons "limcheck" (getvar "limcheck" ))
- ) )
- (setvar "cmdecho" 0)
- (setvar "limcheck" 0)
- ;==================================================================================================
- ; Select the block to determine the block name
- (menucmd "s=x")
- (menucmd "s=insert")
- (while (null (setq ent (entsel "\nSelect the block to be reinserted: "))))
- (setq params (entget (car ent)))
- ;==================================================================================================
- ; Is the entity selected an inserted block?
- (if (= (setq typ (cdr (assoc 0 params))) "INSERT")
- ;================================================================================================
- ; Yes - Insert the block
- (progn
- (command "insert")
- (command (cdr (assoc 2 params)) "x" (cdr (assoc 41 params))
- "y" (cdr (assoc 42 params))
- "z" (cdr (assoc 41 params))
- )
- )
- ;================================================================================================
- ; No - Cancel the command and display error message.
- (prompt "\nEntity is not a block.")
- )
- ;==================================================================================================
- ; Clean up the atomlist
- (foreach cnt hdrlst (setvar (car cnt) (cdr cnt)))
- (princ)
- )
|