插入带有LISP not wor的块
嘿,社区新手,虽然对VBA、autolisp cuis等有点经验。。。对不起,如果我在这里的咆哮听起来有点混乱
我发现有人和我有类似的问题,但没有解决办法。
http://www.cadtutor.net/forum/showthread.php?t=40367
我有一个非常简单的脚本,它设置了一些参数,然后插入一个块,已经运行了很多年了
但在这张图上,它进入了块的插入,要求x比例,并重复我在使用工具栏lisp命令之前所做的任何命令。
如果我打开一个新的绘图或任何其他已绘制的绘图,插入效果很好,但在这张绘图中它不会,我可以重新开始绘图,但这让我发疯!
您可以在下面看到我的命令提示符的副本,以及它尝试执行我的最后一个命令的位置(即第行)
如果有人有想法,请告诉我
命令:(load“05-02-03”)正交输入模式[开/关]:开
命令:输入New、Existing、removing或Future?[新]n
-图层
当前层:“T-Data-Devc-Wall-N”
输入选项
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/MATerial/Plot/PStyle/Freeze/Thaw/LOck
/解锁/状态]:s
输入要置为当前的图层名或:T-Data-Devc-Wall-N Enter
A选项
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/MATerial/Plot/PStyle/Freeze/Thaw/LOck
/解锁/状态]:
命令:插入点
插入输入块名或[?]:05-02-03-NW。图纸
单位:英寸换算:0'-1“
指定插入点或[基点/比例/X/Y/Z/旋转]:
输入X比例因子,指定对角点或[角点/XYZ]:
命令:LINE指定第一个点:nil
指定第一点:*取消*
;Wall-Mounted Data Devices
;A.ARNONE
;UPDATED (7.11.06)
;start variable definition
(setq usr3 (* (getvar "userr3")))
(if (= usr3 3600.0) (setq r3 50))
(if (= usr3 2400.0) (setq r3 25))
(if (= usr3 1200.0) (setq r3 12.5))
(IF (= USR3 600.0)(setq r3 6.25))
(if (= usr3 480.0)(setq r3 5))
(if (= usr3 360.0)(setq r3 3.75))
(if (= usr3 240.0)(setq r3 2.5))
(if (= usr3 120.0)(setq r3 1.25))
(IF (= USR3 384.0)(SETQ r3 4))
(IF (= USR3 192.0)(SETQ r3 2))
(IF (= USR3 128.0)(SETQ r3 1.33333333333))
(IF (= USR3 96.0) (SETQ r3 1))
(IF (= USR3 64.0) (SETQ r3 0.666666666667))
(IF (= USR3 48.0) (SETQ r3 0.5))
(IF (= USR3 32.0) (SETQ r3 0.333333333333))
(IF (= USR3 24.0) (SETQ r3 0.25))
(IF (= USR3 16.0) (SETQ r3 0.166666666667))
(IF (= USR3 12.0) (SETQ r3 0.125))
(IF (= USR3 8.0) (SETQ r3 0.083333333333))
(IF (= USR3 4.0) (SETQ r3 0.041666666667))
(IF (= USR3 2.0) (SETQ r3 0.020833333333))
(IF (= USR3 1.0) (SETQ r3 0.010416666667))
(IF (= USR3 0) (SETQ r3 1))
(setq newlayer "T-Data-Devc-Wall-N")
(setq newlayercolor "3")
(setq newlayerlineweight "0.50")
(setq newlayerlinetype "Continuous")
(setq newlayerplotstyle "Black")
(setq lookupnew (tblsearch "LAYER" newlayer))
(setq atriblocknw "05-02-03-NW.dwg")
;end variable definition
(command "ortho" "on")
;Sets Working Layer
(setq workinglayer (GETSTRING "Enter <N> New, <E> Existing, <D> Demolition, or <F> Future? ")) (terpri)
(cond
((= workinglayer "N")
;checks and/or defines layer to draw on
(if (= lookupnew nil)
(command "-layer" "n" newlayer "s" newlayer "C" newlayercolor "" "L" newlayerlinetype "" "Lw" newlayerlineweight "" "PS" newlayerplotstyle "" "")
(command "-layer" "s" newlayer "")
); END IF
;Sets P1 TO start point of Receptacle and Inserts Block
(prompt "Insertion Point") (terpri)
(setq p1 (getpoint))
(command "insert" atriblocknw p1 r3 "")
)
((= workinglayer "n")
;checks and/or defines layer to draw on
(if (= lookupnew nil)
(command "-layer" "n" newlayer "s" newlayer "C" newlayercolor "" "L" newlayerlinetype "" "Lw" newlayerlineweight "" "PS" newlayerplotstyle "" "")
(command "-layer" "s" newlayer "")
); END IF
;Sets P1 TO start point of Receptacle and Inserts Block
(prompt "Insertion Point") (terpri)
(setq p1 (getpoint))
(command "insert" atriblocknw p1 r3 "")
)
((= workinglayer "")
;checks and/or defines layer to draw on
(if (= lookupnew nil)
(command "-layer" "n" newlayer "s" newlayer "C" newlayercolor "" "L" newlayerlinetype "" "Lw" newlayerlineweight "" "PS" newlayerplotstyle "" "")
(command "-layer" "s" newlayer "")
); END IF
;Sets P1 TO start point of Receptacle and Inserts Block
(prompt "Insertion Point") (terpri)
(setq p1 (getpoint))
(command "insert" atriblocknw p1 r3 "")
)
);end condition
您好,欢迎来到论坛。
因为您的问题只发生在一个图形中,我想知道您是否在命令提示符中键入(getvar“userr3”)输出是否等于代码顶部的if语句之一?
此外,为了让事情更清楚,我更新了你的代码;在此处设置工作层。
;Wall-Mounted Data Devices
;A.ARNONE
;UPDATED (7.11.06)
;start variable definition
(setq usr3 (* (getvar "userr3")))
(if (= usr3 3600.0) (setq r3 50))
(if (= usr3 2400.0) (setq r3 25))
(if (= usr3 1200.0) (setq r3 12.5))
(IF (= USR3 600.0)(setq r3 6.25))
(if (= usr3 480.0)(setq r3 5))
(if (= usr3 360.0)(setq r3 3.75))
(if (= usr3 240.0)(setq r3 2.5))
(if (= usr3 120.0)(setq r3 1.25))
(IF (= USR3 384.0)(SETQ r3 4))
(IF (= USR3 192.0)(SETQ r3 2))
(IF (= USR3 128.0)(SETQ r3 1.33333333333))
(IF (= USR3 96.0) (SETQ r3 1))
(IF (= USR3 64.0) (SETQ r3 0.666666666667))
(IF (= USR3 48.0) (SETQ r3 0.5))
(IF (= USR3 32.0) (SETQ r3 0.333333333333))
(IF (= USR3 24.0) (SETQ r3 0.25))
(IF (= USR3 16.0) (SETQ r3 0.166666666667))
(IF (= USR3 12.0) (SETQ r3 0.125))
(IF (= USR3 8.0) (SETQ r3 0.083333333333))
(IF (= USR3 4.0) (SETQ r3 0.041666666667))
(IF (= USR3 2.0) (SETQ r3 0.020833333333))
(IF (= USR3 1.0) (SETQ r3 0.010416666667))
(IF (= USR3 0) (SETQ r3 1))
(setq newlayer "T-Data-Devc-Wall-N")
(setq newlayercolor "3")
(setq newlayerlineweight "0.50")
(setq newlayerlinetype "Continuous")
(setq newlayerplotstyle "Black")
(setq lookupnew (tblsearch "LAYER" newlayer))
(setq atriblocknw "05-02-03-NW.dwg")
;end variable definition
(command "ortho" "on")
;Sets Working Layer
(initget "New Existing Demolition Future")
(setq workinglayer (getKWord "\nEnter <N> New, <E> Existing, <D> Demolition, or <F> Future? : "))
(cond
((or (not workinglayer) (eq workinglayer "New"))
;checks and/or defines layer to draw on
(if (= lookupnew nil)
(command "_-layer" "n" newlayer "s" newlayer "C" newlayercolor "" "L" newlayerlinetype "" "Lw" newlayerlineweight "" "PS" newlayerplotstyle "" "")
(command "_-layer" "s" newlayer "")
); END IF
;Sets P1 TO start point of Receptacle and Inserts Block
(setq p1 (getpoint "\nGet Insertion Point: "))
(command "_-insert" atriblocknw p1 r3 "")
)
);end condition 快速提示-我会使用COND statment来代替所有这些IF,这将使程序更快,并且是更好的编程实践。 我同意。
因此,不是:
你可以把:
末尾突出显示的位是,如果不满足任何条件,则它会将r3(您的刻度)设置为1。我认为这是你的问题。
如果您需要进一步了解条件语句,请查看http://www.cadtutor.net/forum/showpost.php?p=173196 这里还有一个“错误”——我说“错误”,它不会抛出错误,但没有必要
你为什么要使用USERR3? Steve1!非常感谢。你的第一个帖子让我意识到出了什么问题
我的userr3在整个if语句中并没有任何选项
所以我要把它改成一个计算usr3的公式,这样就没有问题了
谢谢大家的帮助,我以后会记住这一点,但是因为我不再使用一百万个if语句了,很好的摆脱了!
李-你问我为什么使用userr3
我们有一个脚本,可以在其中设置图形的比例,我们将比例放入userr3设置中,然后如果需要比例,我们的所有其他脚本都引用userr3
我没有写所有这些原始脚本,我想知道,有没有更简单的方法来查找和设置图形的比例(例如进入图形设置页面的值低于比例)
我尝试了dimscale,但这似乎不会影响绘图设置下的比例
如果我可以直接找到/设置绘图的比例,我就可以避免整个userr3的事情 很高兴解决了主要问题。
关于获取/设置比例,您是在谈论绘图比例吗?我不知道是否有分配给它的系统变量。也许试着在论坛的另一个部分问这个问题。。。 我可以问你朱比,你会在哪里手动设置绘图比例吗?即你的userr3值。
页:
[1]