明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1574|回复: 2

[LISP]关于这个LISP

[复制链接]
发表于 2004-8-5 09:23:00 | 显示全部楼层 |阅读模式
(setq #dim_sc 100)
(defun c:qt (/ dimobj oldDimscale newDimscale)
(setvar "cmdecho" 0)
(command "_.undo" "be")
(setq dim_sc_old (getvar "dimscale"))
(princ "\n调整尺寸全局比例!")
(setq ss (ssget '((0 . "DIMENSION"))))
(setq dim_sc (getint (strcat "\n请输入尺寸全局比例<" (itoa #dim_sc) ">:")))
(setq #dim_sc (if (= dim_sc nil) #dim_sc dim_sc))
(setq newDimscale (/ (float #dim_sc) (float 100)))
(vl-load-com)
(setq num (sslength ss) ee 0)
(while (< ee num)
(setq nam (ssname ss ee))
(setq dimobj (vlax-ename->vla-object nam)
oldDimscale (vla-get-ScaleFactor dimobj))
(if (and (/= nil newDimscale) (/= oldDimscale newDimscale))
(vla-put-ScaleFactor dimobj newDimscale))
(setq ee (1+ ee))
);end while
(setvar "dimscale" dim_sc_old)
(command "_.undo" "e")
(setvar "cmdecho" 1)
(princ))
(princ "\n输入qt,调整尺寸出图比例!") 这是一个改尺寸全局比例(dimscale)的LISP,我不会vlisp,现在急求大侠仿这个改一个尺寸比例(DIMLFAC)的LISP。或者是仿下面这个(看看有没有问题,好像有时候不能运行) (defun c:ttt (/ el oldDimscale newDimscale xdata)
(setq el (entget (car (entsel "\n选择尺寸:")) '("ACAD")))
(setq oldDimscale
(cdr (assoc 1040 (setq xdata (cdadr (assoc -3 el))))))
(princ "\n新的Dimscale <")
(princ oldDimscale)
(setq newDimscale (getreal ">: "))
(if (and (/= nil newDimscale) (/= oldDimscale newDimscale))
(progn
(setq
el
(subst (cons -3
(list
(cons "ACAD"
(subst (cons 1040 newDimscale)
(assoc 1040 xdata)
xdata))))
(assoc -3 el)
el))
(entmod el)
)
)
(princ)
)
发表于 2004-8-5 13:10:00 | 显示全部楼层
In the first routine:


Change all "DIMSCALE" to "DIMLFAC"


change all "ScaleFactor" to "LinearScaleFactor"
 楼主| 发表于 2004-8-5 14:25:00 | 显示全部楼层
多谢alin。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-18 21:25 , Processed in 0.217486 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表