woodman78 发表于 2022-7-6 08:00:24

使用自定义打印所有布局

大家好,
 
我使用了一个绘图例程,因为它在绘图之前更新所有字段并清除图形。我可以修改它,使其更新整个图形中的字段(如所有布局中的字段),然后打印所有布局吗。
 
;Based on PageSetups from Alan J. Thompson
(defun c:A1 ()
(PlotReactorOFF)
(if (findfile "T:/Drawing Tools/Templates/CCC2009.dwt")
   (progn
   (command "_.psetupin" (findfile "T:/Drawing Tools/Templates/CCC2009.dwt") "A1")
   (while (wcmatch (getvar "cmdnames") "*PSETUPIN*")
       (command "_yes")
   ) ;_ while
   T
   ) ;_ progn
) ;_ if
(command "-plot" "n" "" "A1" "" "n" "y" "n")
(command "_-purge" "a" "*" "N")
(setq CCC_Sheet "A1")
(command "updatefield" "all" "")
(command "regenall")
(command "_zoom" "e")
(initdia)
(command "._plot")
(PlotReactorON)
;(princ)
)

BIGAL 发表于 2022-7-6 08:06:29

在“updatefieldall”代码中,为什么不将其放入一个循环中,在运行之前更改所有布局选项卡
 
很确定昨天发布了示例代码
 
是的http://www.cadtutor.net/forum/showthread.php?67943-需要此lisp的帮助,请参阅最后的备注

woodman78 发表于 2022-7-6 08:16:59

谢谢Bigal,
 
这是我拥有的,但我得到的;错误:输入列表格式不正确
;Based on PageSetups from Alan J. Thompson
(defun c:A1_All ()
(PlotReactorOFF)
(if (findfile "T:/Drawing Tools/Templates/CCC2009.dwt")
   (progn
   (command "_.psetupin" (findfile "T:/Drawing Tools/Templates/CCC2009.dwt") "A1")
   (while (wcmatch (getvar "cmdnames") "*PSETUPIN*")
       (command "_yes")
   ) ;_ while
   T
   ) ;_ progn
) ;_ if

(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(vlax-for lay (vla-get-Layouts doc)
(setq plotabs (cons (vla-get-name lay) plotabs))
)
(setq plottablist (acad_strlsort plotabs))
(setq len (length plottablist))
(setq x 0)
(repeat len
(setq name (nth x plottablist))
(princ name)
(if (/= name "Model")
   (progn
   (setvar "ctab" name)
)
)
(command "-plot" "n" "" "A1" "" "n" "y" "n")
(command "_-purge" "a" "*" "N")
(setq CCC_Sheet "A1")
(command "updatefield" "all" "")
(command "regenall")
(command "_zoom" "e")
(initdia)
(command "._plot")
(PlotReactorON)
;(princ)
)
 
你能帮忙吗?

MSasu 发表于 2022-7-6 08:21:06

乍一看,似乎你需要一个终结的妄想;此外,您还需要一个页面计数器索引器。
如果希望防止打印模型选项卡,则应将打印操作放置在If测试中。
...
(repeat len
(setq name (nth x plottablist))
(princ name)
(if (/= name "Model")
(progn
   (setvar "ctab" name)
   (command "-plot" "n" "" "A1" "" "n" "y" "n")
   (command "_-purge" "a" "*" "N")
   (setq CCC_Sheet "A1")
   (command "updatefield" "all" "")
   (command "regenall")
   (command "_zoom" "e")
   (initdia)
   (command "._plot")
   (PlotReactorON)
   ) ;<- IF
);<- PROGN
;(princ)
(setq x (1+ x))
)
)    ;<- DEFUN

MSasu 发表于 2022-7-6 08:28:55

谢谢米尔恰,但这似乎也不起作用。我出错了
 
(defun c:chkbrk (/ opf bkt chekdfile rdctl wkfile currentln wln ltr ncln)
(setvar "cmdecho" 0)
(prompt "\nlook at end of line")
;(setq chekdfile (getstring "enter name of file :"))
(SETQ chekdfile (getfiled "Enter file name:" " " "LSP" 4))

(setq opf (open chekdfile "r"))
(setq bkt 0)
(setq blkl 0)
(setq rdctl 1)
(setq wkfile (open "c:\\acadtemp\\wow.lsp" "w"))

(setq currentln "a")
(while (/= blkl 6)
(setq currentln (read-line opf))
(if (= currentln nil)(setq currentln ""))
(if (= currentln "")(setq blkl (+ 1 blkl))(setq blkl 1))
(setq wln currentln)                                                      
(while (/= wln "")
       (setq ltr (substr wln 1 1))
       (setq wln (substr wln 2))
       (cond ((= (ascii ltr) 34) (if (= rdctl 0)(setq rdctl 1)(setq rdctl 0)))
               ((and (= ltr "(")(= rdctl 1))(setq bkt (+ bkt 1)))
               ((and (= ltr ")")(= rdctl 1))(setq bkt (- bkt 1)))
               ((and (= ltr ";")(= rdctl 1))(setq wln ""))
               ;(t (prompt ltr))
       )
)
(setq ncln (strcat currentln ";" (itoa bkt)
(princ (itoa bkt))
(if (= rdctl 0) "string open" "")))
(if (/= currentln "")(write-line ncln wkfile))
)
(close wkfile)
(close opf)
(prompt (strcat "open brakets= " (itoa bkt) "."))
)

(setq ang1 nil
   pt1 nil
   pt2 nil
   pt3 nil
   pt4 nil
   pt5 nil)

(princ)


 
运行appload时。

pBe 发表于 2022-7-6 08:31:44

你有没有注意到这只是你代码的摘录?
但有一个额外的右偏执,我现在已经修复了。

BIGAL 发表于 2022-7-6 08:38:44

米尔恰,
我仍然收到这个错误。我错过什么了吗?我复制了你更新代码的最后几行,并用它们替换了我的代码,但当我去appload时,我得到了这个。
 
; 错误:错误的参数类型:numberp:nil

woodman78 发表于 2022-7-6 08:44:28

哦,是的,我现在知道了。谢谢

MSasu 发表于 2022-7-6 08:54:09

woodman78 发表于 2022-7-6 08:59:35

Mircea,
I am still getting this error.Am i missing something?I copied the last lines of your updated code and replaced my code with them but when i go appload I get this.
 
; error: bad argument type: numberp: nil
页: [1] 2
查看完整版本: 使用自定义打印所有布局