本帖最后由 kucha007 于 2023-4-26 22:17 编辑
需求来自这里:
http://bbs.mjtd.com/forum.php?mod=viewthread&tid=187696&fromuid=7329538
- ;分解缩放块的同时,恢复块内文字状态 by kucha
- (defun C:RTB (/ Old_Cmd K:DXF Blk SCVar SS i en TmeVar)
- (setq Old_Cmd (getvar "cmdecho"))
- (defun K:DXF (key en) (cdr (assoc key (entget en))))
- (command "undo" "be");记录编组
- (setvar "cmdecho" 0)
- (if
- (and
- (setq Blk (car (entsel "\n→请点选块: ")))
- (eq (K:DXF 0 Blk) "INSERT")
- )
- (progn
- (setq SCVar (list (K:DXF 42 Blk) (/ (K:DXF 41 Blk) (K:DXF 42 Blk))));高宽
- (command "Explode" Blk)
- (setq SS (ssget "p"))
- (repeat (setq i (sslength SS))
- (setq en (ssname SS (setq i (1- i))))
- (if (eq (K:DXF 0 en) "TEXT")
- (progn
- (setq TmeVar (mapcar '(lambda (x y) (/ x y))
- (list (K:DXF 40 en) (K:DXF 41 en));高宽
- SCVar
- )
- )
- (entmod (subst (cons 40 (car TmeVar)) (assoc 40 (entget en)) (entget en)))
- (entmod (subst (cons 41 (cadr TmeVar)) (assoc 41 (entget en)) (entget en)))
- )
- )
- )
- (princ (strcat "\n——★★★ 块内文字已恢复到缩放前的状态 ★★★——"))
- )
- (princ (strcat "\n——★★★ 请选择块对象! ★★★——"))
- )
- (setvar "cmdecho" Old_Cmd)
- (command "undo" "e");结束编组
- (princ)
- )
|