绘图:设置副本数
大家好,我找到了一段代码,用于设置绘图例程中的绘图数量。我曾尝试将其合并到一个用于绘制所有布局的函数中,但它没有设置副本的数量。我是不是完全走错了路?
AP3
: dialog
{
label = "Plot All A3";
: edit_box
{
label = "Enter Number of Plots :";
mnemonic = "N";
key = "noc";
alignment = centered;
edit_limit = 3;
edit_width = 3;
value = "";
}
: button
{
key = "accept";
label = "OK";
is_default = true;
fixed_width = true;
alignment = centered;
}
: errtile
{
width = 34;
}
}
(defun C:AP3 (/ CURRENTTAB noc dcl_id)
(setq dcl_id (load_dialog "AP3.dcl"))
(if (not (new_dialog "AP3" dcl_id))
(exit)
);if
(set_tile "noc" "1")
(mode_tile "noc" 2)
(action_tile "noc" "(setq noc (atof $value))")
(start_dialog)
(unload_dialog dcl_id)
(setq CURRENTTAB (getvar "ctab"))
(PlotReactorOFF)
(command "_.-layer" "_LW" "0.13" "CCC_LAYOUT_Dimensions" "")
(if (findfile "T:/Drawing Tools/Templates/CCC2009.dwt")
(progn
(command "_.psetupin" (findfile "T:/Drawing Tools/Templates/CCC2009.dwt") "A3")
(while (wcmatch (getvar "cmdnames") "*PSETUPIN*")
(command "_yes")
) ;_ while
T
) ;_ progn
) ;_ if
(command "_-purge" "a" "*" "N")
(setq CCC_Sheet "A3")
(foreach LAYOUT (layoutlist)
(setvar "ctab" LAYOUT)
;;;;;;;;;;;;;;;;;;;;;;;;;;;
(command "-plot" "n" "" "A3" "" "n" "y" "n")
(command "_zoom" "e")
(command "updatefield" "all" "")
(command "regenall")
(vlax-put-property (vla-get-Plot (vla-get-ActiveDocument
(vlax-get-acad-object))) "NumberOfCopies" noc)
(command "-plot" "n" "" "A3" "" "n" "y" "y")
;;;;;;;;;;;;;;;;;;;;;;;;;;
(setvar "ctab" CURRENTTAB)
(PlotReactorON)
(princ)
)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun PlotReactorON nil
(vl-load-com)
;; © Lee Mac 2010
((lambda ( data foo / react )
(if (setq react
(vl-some
(function
(lambda ( reactor )
(if (eq data (vlr-data reactor)) reactor)
)
)
(cdar
(vlr-reactors :vlr-command-reactor)
)
)
)
(if (not (vlr-added-p react))
(vlr-add react)
)
(setq react
(vlr-command-reactor data
(list
(cons :vlr-commandwillstart foo)
)
)
)
)
(if (vlr-added-p react)
(princ "\n** Reactor Activated **")
(princ "\n** Reactor Failed to Activate **")
)
react
)
"Plot-Reactor"
'Plot-Callback
)
(princ)
)
(defun PlotReactorOFF nil
(vl-load-com)
;; © Lee Mac 2010
((lambda ( data foo / react )
(if (setq react
(vl-some
(function
(lambda ( reactor )
(if (eq data (vlr-data reactor)) reactor)
)
)
(cdar
(vlr-reactors :vlr-command-reactor)
)
)
)
(if (vlr-added-p react)
(vlr-remove react)
)
)
(if (or (not react) (not (vlr-added-p react)))
(princ "\n** Reactor Deactivated **")
(princ "\n** Reactor Failed to Deactivate **")
)
react
)
"Plot-Reactor"
'Plot-Callback
)
(princ)
)
(defun Plot-Callback ( reactor arguments )
(vl-load-com)
(if (eq (strcase (car arguments)) "PLOT")
(LM:Popup "Warning" 64 "Gotcha!!! Please use the NNRDO Plot tools when plotting standard layouts!!")
)
(princ)
)
(defun LM:Popup ( title flags msg / WSHShell result )
;; © Lee Mac 2010
(setq WSHShell (vlax-create-object "WScript.Shell"))
(setq result (vlax-invoke WSHShell 'Popup msg 0 title flags))
(vlax-release-object WSHShell)
result
)
这就是我得到代码的地方。。。。
http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Controlling-the-Number-of-Copies-in-a-Plot-Routine/td-p/823809 不确定为什么代码的绘图部分是两次,第一次是单拷贝,第二次是再次执行,但对于noc,不确定为什么这两个选项不在IF do 1或更多中。
Woodman回到你的另一篇文章,在开始时添加拨号代码,并在开始时添加NOC代码。我认为这段代码过于复杂了。
这可能很有用,您也可以将其用于任何程序,而不是硬编码DCL
to use (load "getval")(load "your plot")
;code for getval
(setq title "Please enter dwg number")
(setq width " edit_width = 12;")
(setq limit " edit_limit = 9;")
(ah:getval title width limit)
(setq dwgname item)
;; InputDialog box with variable title
;; By Ah June 2012
;; code (ah:getval title)
(defun AH:Getval (title width limit / fo)
(setq fname "C://acadtemp//getval.dcl")
(setq fo (open fname "w"))
(write-line "ddgetval : dialog {" fo)
(write-line " : row {" fo)
(write-line ": edit_box {" fo)
(write-line (strcat " key = "(chr 34) "sizze" (chr 34) ";") fo)
(write-line(strcat " label = "(chr 34) title (chr 34) ";") fo)
; these can be replaced with shorter value etc
;(write-line " edit_width = 18;" fo)
;(write-line " edit_limit = 15;" fo)
(write-line width fo)
(write-line limit fo)
(write-line " is_enabled = true;" fo)
(write-line " }" fo)
(write-line "}" fo)
(write-line "ok_cancel;}" fo)
(close fo)
(setq dcl_id (load_dialog"c:\\acadtemp\\getval"))
(if (not (new_dialog "ddgetval" dcl_id))
(exit))
(action_tile "sizze" "(setq item$value)(done_dialog)")
(mode_tile "sizze" 3)
(start_dialog)
; returns the value of item
) 比加尔,
我运行plot命令两次,因为第一次它设置页面设置,我需要先设置,这样我可以更新所有字段,因为我的标题栏包含一个图纸尺寸字段。当一切都设置好后,第二次运行命令将进行实际打印。 为什么使用对话框而不是命令行?下面是一个例程,它会在命令行中询问您“有多少副本”。
试试这个。
;;;布局打印18x24(defun c:Tab(/CURRENTTAB)(pltnum)(setq CURRENTTAB(getvar“ctab”))(重复xplta(foreach LAYOUT(layoutlist)(setvar“ctab”LAYOUT)(命令“-plot”“yes”“”“TFC-ENGXER6204.pc3”“拱门c(18x24 in.)”“英寸”“横向”“否”;倒置打印“EXTENTS”“FIT”“0.076012,0.00”“YES”;用PLOTSYTLES“单色”打印。CTB“否”;线宽为“否”的打印;使用打印比例“是”缩放线宽;打印图纸空间最后一个“否”;删除隐藏行“否”;将绘图写入文件“否”;保存对布局的更改“是”);继续绘图))(defun pltnum()(setq numplt(getint“\n输入绘图数:”)(if(=numplt nil)(setq xplt 1)(setq xplt numplt))(if( 我认为将vl put用于NOC比重复使用要好,因为您实际运行的plot命令是按图的数量进行的
10个标签
NOC=4绘图=10次
重复4次绘图=40次
优点是你是否想要打印集v的只是生产表,我会排序。最终用户问题。
对于小数字,我只需运行我的do 1集多次。 你能看看我的代码这么大,看看有什么问题吗?我看不出哪里出了错。 2.总是先加载defun,最后加载代码,lisp从上到下逐级遍历代码,因此,如果在遍历过程中调用尚未加载的defun,即使它存在于代码中,也会出错(Plotreactor off)
foreach LAYOUT(layoutlist)其中是layoutlist代码这是一个defun
此外,使用VLide调试时,可以“出错时中断”,您可以在停止时执行“检查”变量之类的操作。Lee mac对此有很好的教程。
在代码(princ“wow2”)中进一步放置(princ“wow1”)的简单调试有时会有所帮助。
页:
[1]