Lisp填写自定义正确
大家好,我正在努力建立一个lisp,用户可以编辑标题栏,更新revblocks。我们有使用图形属性框上的“自定义”选项卡的模板,该选项卡与我们使用的标题栏相关联。我只是想让用户可以使用这个lisp,而不是每次打开dwgprops框。
以下是dwgprops框的外观:
这是我目前得到的:
(defun c:TB ()
(if (setq Opt
(getint
"\nDo you want to: 1- Update Titleblock 2- Update RevBlock 3- Update Drawing Titles: "
)
);;user input for variable "opt"
(progn
(cond
((= opt 1);;if user picks to update titleblock
(setq titletop (getstring "\nWhat is title top? "))
(setq titlemiddle (getstring "\nWhat is title middle? "))
(setq titlebottom (getstring "\nWhat is title bottom? "))
)
((= opt 2);;if user picks to update revblock
(setq
row (getint "\nWhich revision row do you wish to edit? ")
)
(progn
(cond
((= row 1)
(setq 1rowrev (getstring "\n1st row rev: "))
(setq 1rowyy (getstring "\n1st row year: "))
(setq 1rowmm (getstring "\n1st row month: "))
(setq 1rowdd (getstring "\n1st row day: "))
(setq 1rdesc (getstring T "\n1st row description: "))
(setq 1rowby (getstring "\n1st row by: "))
(setq 1rowchk (getstring "\n1st row chk: "))
(setq 1roweng (getstring "\n1st row eng: "))
(setq 1rowapp (getstring "\n1st row app: "))
)
((= row 2)
(setq 2rowrev (getstring "\n2nd row rev: "))
(setq 2rowyy (getstring "\n2nd row year: "))
(setq 2rowmm (getstring "\n2nd row month: "))
(setq 2rowdd (getstring "\n2nd row day: "))
(setq 2rdesc (getstring T "\n2nd row description: "))
(setq 2rowby (getstring "\n2nd row by: "))
(setq 2rowchk (getstring "\n2nd row chk: "))
(setq 2roweng (getstring "\n2nd row eng: "))
(setq 2rowapp (getstring "\n2nd row app: "))
)
((= row 3)
(setq 3rowrev (getstring "\n3rd row rev: "))
(setq 3rowyy (getstring "\n3rd row year: "))
(setq 3rowmm (getstring "\n3rd row month: "))
(setq 3rowdd (getstring "\n3rd row day: "))
(setq 3rdesc (getstring T "\n3rd row description: "))
(setq 3rowby (getstring "\n3rd row by: "))
(setq 3rowchk (getstring "\n3rd row chk: "))
(setq 3roweng (getstring "\n3rd row eng: "))
(setq 3rowapp (getstring "\n3rd row app: "))
)
((= row 4)
(setq 4rowrev (getstring "\n4th row rev: "))
(setq 4rowyy (getstring "\n4th row year: "))
(setq 4rowmm (getstring "\n4th row month: "))
(setq 4rowdd (getstring "\n4th row day: "))
(setq 4rdesc (getstring T "\n4th row description: "))
(setq 4rowby (getstring "\n4th row by: "))
(setq 4rowchk (getstring "\n4th row chk: "))
(setq 4roweng (getstring "\n4th row eng: "))
(setq 4rowapp (getstring "\n4th row app: "))
)
);;end cond
);; end progn
);;end opt 2
((= opt 3);;if user picks to update drawing titles, still figuring this section out
)
);;end cond
);;end 1st progn
);;end 1st if
);;end defun
我最难弄清楚的是如何将用户输入的值放入正确的自定义图形属性中,这只适用于revbock更新。
我也不知道如何将标题用户输入放入正确的图形属性位置(尽管我认为它们密切相关)
我确实发现这个列表可能对狩猎有帮助,但我不知道如何把它翻译成有用的东西。。。
谢谢你的帮助! 使用从文档对象派生的ActiveX SummaryInfo对象的属性和方法:
这里有一个参考:SummaryInfo对象
谢谢李。
我对ActiveX没有任何经验,但这是我在黑暗中拍摄的一张照片。
(defun c:TB ()
(if (setq Opt
(getint
"\nDo you want to: 1- Update Titleblock 2- Update RevBlock 3- Update Drawing Titles: "
)
);;user input for variable "opt"
(progn
(cond
((= opt 1);;if user picks to update titleblock
(setq titletop (getstring "\nWhat is title top? "))
(setq titlemiddle (getstring "\nWhat is title middle? "))
(setq titlebottom (getstring "\nWhat is title bottom? "))
)
((= opt 2);;if user picks to update revblock
(setq
row (getint "\nWhich revision row do you wish to edit? ")
)
(progn
(cond
((= row 1)
(setq 1rowrev (getstring "\n1st row rev: "))
(setq 1rowyy (getstring "\n1st row year: "))
(setq 1rowmm (getstring "\n1st row month: "))
(setq 1rowdd (getstring "\n1st row day: "))
(setq 1rdesc (getstring T "\n1st row description: "))
(setq 1rowby (getstring "\n1st row by: "))
(setq 1rowchk (getstring "\n1st row chk: "))
(setq 1roweng (getstring "\n1st row eng: "))
(setq 1rowapp (getstring "\n1st row app: "))
(vla-get-summaryinfo (vla-get-activedocument (vlax-get-acad-object.addcustominfo(1rrev, 1rowrev))))
)
((= row 2)
(setq 2rowrev (getstring "\n2nd row rev: "))
(setq 2rowyy (getstring "\n2nd row year: "))
(setq 2rowmm (getstring "\n2nd row month: "))
(setq 2rowdd (getstring "\n2nd row day: "))
(setq 2rdesc (getstring T "\n2nd row description: "))
(setq 2rowby (getstring "\n2nd row by: "))
(setq 2rowchk (getstring "\n2nd row chk: "))
(setq 2roweng (getstring "\n2nd row eng: "))
(setq 2rowapp (getstring "\n2nd row app: "))
)
((= row 3)
(setq 3rowrev (getstring "\n3rd row rev: "))
(setq 3rowyy (getstring "\n3rd row year: "))
(setq 3rowmm (getstring "\n3rd row month: "))
(setq 3rowdd (getstring "\n3rd row day: "))
(setq 3rdesc (getstring T "\n3rd row description: "))
(setq 3rowby (getstring "\n3rd row by: "))
(setq 3rowchk (getstring "\n3rd row chk: "))
(setq 3roweng (getstring "\n3rd row eng: "))
(setq 3rowapp (getstring "\n3rd row app: "))
)
((= row 4)
(setq 4rowrev (getstring "\n4th row rev: "))
(setq 4rowyy (getstring "\n4th row year: "))
(setq 4rowmm (getstring "\n4th row month: "))
(setq 4rowdd (getstring "\n4th row day: "))
(setq 4rdesc (getstring T "\n4th row description: "))
(setq 4rowby (getstring "\n4th row by: "))
(setq 4rowchk (getstring "\n4th row chk: "))
(setq 4roweng (getstring "\n4th row eng: "))
(setq 4rowapp (getstring "\n4th row app: "))
)
);;end cond
);; end progn
);;end opt 2
((= opt 3);;if user picks to update drawing titles, still figuring this section out
)
);;end cond
);;end 1st progn
);;end 1st if
);;end defun
我只是在第1行rev中试用了一下,看看它是否能正常工作,然后再尝试全面实施
这是我得到的错误;错误:无函数定义:1RREV,
你能指出的任何参考资料都能帮助我吗?
再次感谢。 仅仅阅读post和我可能是错误的,但可能是基于使用带属性的普通块的注释,对每个变量进行回答似乎很困难,并且作为一种逐行输入类型过于致命。
1更新标题栏,仅更改所有标题上要更改的标题的一些预定义行,请参见下面的7
2更新版本只需转到布局“更新版本”自动知道块名称,因此搜索下一个可用的空行,然后提示用户输入
3更新标题是一种情况,如果你拼写了一个错误的名称或新公司,那么为什么不只是说“输入要更新的行号”“输入信息”,然后在所有块中替换,根据需要重复。
4我认为可以选择一个块并返回在块中选择的属性,然后说将所有标题块更新为新值
5您可以设置要更新的布局的限制。
6可以使用excell链接创建布局/标题栏详细信息。通过这种方式,您可以使用复制和粘贴。电子表格仅适用于您的标题栏,而不适用于任何项目。
7我有一个大项目,它会自动更新标题栏中的大约20个项目,这些项目是预定义的,并从dwg中读取其他信息。
有机会再次尝试。。。仍然出现错误。代码见下文。
(defun c:TB ()
(vl-load-com)
(setq doc (vla-get-ActiveDocument (vlax-get-Acad-Object)))
(setq db (vla-get-Database doc))
(setq si (vla-get-SummaryInfo db))
(if (setq Opt
(getint
"\nDo you want to: 1- Update Titleblock 2- Update RevBlock 3- Update Drawing Titles: "
)
);;user input for variable "opt"
(progn
(cond
((= opt 1);;if user picks to update titleblock
(setq titletop (getstring "\nWhat is title top? "))
(setq titlemiddle (getstring "\nWhat is title middle? "))
(setq titlebottom (getstring "\nWhat is title bottom? "))
)
((= opt 2);;if user picks to update revblock
(setq
row (getint "\nWhich revision row do you wish to edit? ")
)
(progn
(cond
((= row 1)
(setq 1rowrev (getstring "\n1st row rev: "))
(setq 1rowyy (getstring "\n1st row year: "))
(setq 1rowmm (getstring "\n1st row month: "))
(setq 1rowdd (getstring "\n1st row day: "))
(setq 1rdesc (getstring T "\n1st row description: "))
(setq 1rowby (getstring "\n1st row by: "))
(setq 1rowchk (getstring "\n1st row chk: "))
(setq 1roweng (getstring "\n1st row eng: "))
(setq 1rowapp (getstring "\n1st row app: "))
(vla-SetCustomByIndex(7, 1RREV, 1rowrev))
)
((= row 2)
(setq 2rowrev (getstring "\n2nd row rev: "))
(setq 2rowyy (getstring "\n2nd row year: "))
(setq 2rowmm (getstring "\n2nd row month: "))
(setq 2rowdd (getstring "\n2nd row day: "))
(setq 2rdesc (getstring T "\n2nd row description: "))
(setq 2rowby (getstring "\n2nd row by: "))
(setq 2rowchk (getstring "\n2nd row chk: "))
(setq 2roweng (getstring "\n2nd row eng: "))
(setq 2rowapp (getstring "\n2nd row app: "))
)
((= row 3)
(setq 3rowrev (getstring "\n3rd row rev: "))
(setq 3rowyy (getstring "\n3rd row year: "))
(setq 3rowmm (getstring "\n3rd row month: "))
(setq 3rowdd (getstring "\n3rd row day: "))
(setq 3rdesc (getstring T "\n3rd row description: "))
(setq 3rowby (getstring "\n3rd row by: "))
(setq 3rowchk (getstring "\n3rd row chk: "))
(setq 3roweng (getstring "\n3rd row eng: "))
(setq 3rowapp (getstring "\n3rd row app: "))
)
((= row 4)
(setq 4rowrev (getstring "\n4th row rev: "))
(setq 4rowyy (getstring "\n4th row year: "))
(setq 4rowmm (getstring "\n4th row month: "))
(setq 4rowdd (getstring "\n4th row day: "))
(setq 4rdesc (getstring T "\n4th row description: "))
(setq 4rowby (getstring "\n4th row by: "))
(setq 4rowchk (getstring "\n4th row chk: "))
(setq 4roweng (getstring "\n4th row eng: "))
(setq 4rowapp (getstring "\n4th row app: "))
)
);;end cond
);; end progn
);;end opt 2
((= opt 3);;if user picks to update drawing titles, still figuring this section out
)
);;end cond
);;end 1st progn
);;end 1st if
);;end defun
这是我遇到的错误:
这是我正在使用的参考页。。。还有这个
请将其替换为以下内容,然后重试。
(vla-SetCustomByIndex si 7 1RREV 1rowrev)
虽然我不确定键的值和1RREV、1ROWREV的值
1RREV是在第一个修订行的“图形特性”的“自定义特性”选项卡中设置的名称。如果有帮助的话。
更新了代码,这是我得到的错误:
你有一个额外的括号,变量1RREV没有值,它应该是一个字符串,更重要的是,本地化你的变量。
我运行了VLIDE检查,但括号中没有任何内容。我已经更新了代码来本地化变量,但仍然出现同样的错误。更新代码见下文。
(defun c:TB (/ doc db si opt titletop titlemiddle titlebottom row
1rowrev 1rowyy 1rowmm 1rowdd 1rowdesc 1rowby 1rowchk 1roweng 1rowapp
2rowrev 2rowyy 2rowmm 2rowdd 2rowdesc 2rowby 2rowchk 2roweng 2rowapp
3rowrev 3rowyy 3rowmm 3rowdd 3rowdesc 3rowby 3rowchk 3roweng 3rowapp
4rowrev 4rowyy 4rowmm 4rowdd 4rowdesc 4rowby 4rowchk 4roweng 4rowapp
)
(vl-load-com)
(setq doc (vla-get-ActiveDocument (vlax-get-Acad-Object)))
(setq db (vla-get-Database doc))
(setq si (vla-get-SummaryInfo db))
(if (setq Opt
(getint
"\nDo you want to: 1- Update Titleblock 2- Update RevBlock 3- Update Drawing Titles: "
)
);;user input for variable "opt"
(progn
(cond
((= opt 1);;if user picks to update titleblock
(setq titletop (getstring "\nWhat is title top? "))
(setq titlemiddle (getstring "\nWhat is title middle? "))
(setq titlebottom (getstring "\nWhat is title bottom? "))
)
((= opt 2);;if user picks to update revblock
(setq
row (getint "\nWhich revision row do you wish to edit? ")
)
(progn
(cond
((= row 1)
(setq 1rowrev (getstring "\n1st row rev: "))
(setq 1rowyy (getstring "\n1st row year: "))
(setq 1rowmm (getstring "\n1st row month: "))
(setq 1rowdd (getstring "\n1st row day: "))
(setq 1rdesc (getstring T "\n1st row description: "))
(setq 1rowby (getstring "\n1st row by: "))
(setq 1rowchk (getstring "\n1st row chk: "))
(setq 1roweng (getstring "\n1st row eng: "))
(setq 1rowapp (getstring "\n1st row app: "))
(vla-SetCustomByIndex si 7 1RREV 1rowrev)
)
((= row 2)
(setq 2rowrev (getstring "\n2nd row rev: "))
(setq 2rowyy (getstring "\n2nd row year: "))
(setq 2rowmm (getstring "\n2nd row month: "))
(setq 2rowdd (getstring "\n2nd row day: "))
(setq 2rdesc (getstring T "\n2nd row description: "))
(setq 2rowby (getstring "\n2nd row by: "))
(setq 2rowchk (getstring "\n2nd row chk: "))
(setq 2roweng (getstring "\n2nd row eng: "))
(setq 2rowapp (getstring "\n2nd row app: "))
)
((= row 3)
(setq 3rowrev (getstring "\n3rd row rev: "))
(setq 3rowyy (getstring "\n3rd row year: "))
(setq 3rowmm (getstring "\n3rd row month: "))
(setq 3rowdd (getstring "\n3rd row day: "))
(setq 3rdesc (getstring T "\n3rd row description: "))
(setq 3rowby (getstring "\n3rd row by: "))
(setq 3rowchk (getstring "\n3rd row chk: "))
(setq 3roweng (getstring "\n3rd row eng: "))
(setq 3rowapp (getstring "\n3rd row app: "))
)
((= row 4)
(setq 4rowrev (getstring "\n4th row rev: "))
(setq 4rowyy (getstring "\n4th row year: "))
(setq 4rowmm (getstring "\n4th row month: "))
(setq 4rowdd (getstring "\n4th row day: "))
(setq 4rdesc (getstring T "\n4th row description: "))
(setq 4rowby (getstring "\n4th row by: "))
(setq 4rowchk (getstring "\n4th row chk: "))
(setq 4roweng (getstring "\n4th row eng: "))
(setq 4rowapp (getstring "\n4th row app: "))
)
);;end cond
);; end progn
);;end opt 2
((= opt 3);;if user picks to update drawing titles, still figuring this section out
)
);;end cond
);;end 1st progn
);;end 1st if
);;end defun
同样,变量1RREV是nil,它应该是字符串。或者变量名必须是1rowrev
页:
[1]
2