明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1771|回复: 0

请各位大大虾帮个忙,将这个LISP程序改写成VBA,不胜感激

[复制链接]
发表于 2005-6-20 09:47:00 | 显示全部楼层 |阅读模式
请各位大大虾帮个忙,将这个LISP程序改写成VBA,不胜感激。我的LISP水平太差了。 defun dstbm ()
(setq mm (entlast))
(setq pb (entget mm))
(regapp "SOUTH")
(setq
xb
(append
pb
(list
(list '-3
(list "SOUTH" (cons 1000 stbmx))
)
)
)
)
(entmod xb)
(princ)
) ;;;批量展测量点
(defun c:zdtxt (/ l wzcl wzch l3 oldcmd oldblip oldsnap tckz newlayer fle fn pt dm zb xyz h lscale xyz1 xyz2)
(setq l (getvar "ltscale"))
(setq wzcl (* l 2))
(setq wzch (* l 2))
(setq l3 (angle (getvar "ucsorg")
(getvar "ucsxdir")
)
)
(setq oldcmd (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setq oldblip (getvar "blipmode"))
(setvar "blipmode" 0)
(setq oldsnap (getvar "osmode"))
(setvar "osmode" 0)
(setvar "angdir" 1)
(setq fle (getfiled "请选择数据文件"
"*"
"txt;dat;*"
2
)
)
(if (= (tblobjname "layer" "GCD") nil)
(progn
(command "layer" "n" "zd" "C" "1" "GCD" "")
)
)
(setq fn (open fle "r"))
(read-line fn)
(setq n 0)
(while (setq pt (read-line fn))
(setq dm (vl-princ-to-string (read pt)))
(setq zb (substr pt (+ (strlen dm) 1)))
(setq
xyz (trans (read (strcat "(" zb ")"))
1
0
)
)
(setq h (rtos (last xyz) 2 1))
(setq lscale (* l 1))
(entmake
(list (cons 0 "INSERT")
(cons 100 "AcDbEntity")
(cons 8 "GCD")
(cons 100 "AcDbBlockReference")
(cons 10 xyz)
(cons 41 lscale)
(cons 42 lscale)
(cons 43 lscale)
(cons 410 "model")
(cons 2 "gc200")
)
) ;"gc200"为块名
(setq stbmx (itoa 202101))
(dstbm)
(setq xyz1
(polar xyz (/ pi 2) (* l 2))
)
(setq xyz2
(polar xyz (* (/ pi 2) 3) (* l 2))
)
(entmake (list (cons 0 "Text")
(cons 100 "AcDbEntity")
(cons 8 "GCD")
(cons 100 "AcDbText")
(cons 7 "standard")
(cons 1 dm)
(cons 40 wzcl)
(cons 41 0.8)
(cons 410 "model")
(cons 71 0)
(cons 72 4)
(cons 73 0)
(cons 10 xyz1)
(cons 11 xyz1)
)
)
(setq stbmx (itoa 202111))
(dstbm)
(entmake (list (cons 0 "Text")
(cons 100 "AcDbEntity")
(cons 8 "GCD")
(cons 100 "AcDbText")
(cons 7 "hz")
(cons 1 h)
(cons 40 wzch)
(cons 41 0.8)
(cons 410 "model")
(cons 71 0)
(cons 72 4)
(cons 73 0)
(cons 10 xyz2)
(cons 11 xyz2)
)
)
(setq stbmx (itoa 202111))
(dstbm)
(setq n (+ n 1))
)
(if (= pt nil)
(progn
(alert (strcat "*--*展点结束,共展"
(itoa n)
"个点*--*!。"
)
)
(setvar "cmdecho" oldcmd)
(setvar "blipmode" oldblip)
(setvar "osmode" oldsnap)
(setvar "angdir" 1)
(setvar "clayer" "0")
)
)
(close fn)
(command "zoom" "E")
(princ)
)
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-27 15:30 , Processed in 0.206688 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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