CAD的lisp怎么实现原位放大数值?
使用CAD处理数据时,有时需要将所有数据放大一定的倍数,此时逐个修改计算费事费力,所以CAD的lisp怎么实现原位放大数值呢?来分享一个简单的方法。
工具/软件
硬件型号:华为MateBook D 14
系统版本:Windows7
所需软件:CAD2010
方法/步骤
第1步
(defun c:fff(/ num)
(princ"主要功能为原位数值放大")
(setvar "cmdecho" 0)
(if(= nil xsz) (c:szcs))
(princ"\n当前放大系数为:")(princ xsz)
(princ"\n如需重新设置请退出执行 szcs")
(setq newlayer(tblsearch "layer" "WT"))
(if(= newlayer nil) (command "layer" "n" "WT" "c" "2" "WT" ""))
(setq nse(ssget))
(setq nse_len(sslength nse))
(setq nn 0)
(repeat nse_len
(setq nse_sub(ssname nse nn))
(setq nse_data(entget nse_sub))
(setq old_num_list(assoc 1 nse_data))
(setq old_layer_list(assoc 8 nse_data));
(setq num(cdr (assoc 1 nse_data)))
(setq layer(cdr (assoc 8 nse_data)))
(setq cal_old_num(atof num))
(setq cal_new_num(* xsz cal_old_num))
(setq new_num_list(cons 1 (rtos cal_new_num 2 1)))
(setq new_lay_list(cons 8 "WT"))
(setq nse_data(subst new_num_list old_num_list nse_data))
(setq nse_data(subst new_lay_list old_layer_list nse_data))
(entmod nse_data)
(setq nn ( nn 1))
(setq new_word(entlast))
)
(prin1)
)
(defun c:szcs()
(setq xsz (getreal"放大系数"))
)
第2步
执行_vlide命令,打开LISP编辑器,将第一步代码复制粘贴到编辑器中
第3步
点击加载命令
第4步
执行fff命令,如需重新设置放大系数执行SZCS
评论列表