woodman78 发表于 2022-7-6 08:31:46

好的,我现在就在这里。我不得不放弃使用“dwg-to-pdf”,这主要是因为哮喘的原因。lisp工作正常,但使用“dwg-to-pdf”查看图像和pdf质量较差。

老实说,这不会影响我们的生活。多年来,我们一直在使用“Cutepdf”,并取得了很好的效果。所以我回到这里来批量绘制pdf。
 
 
;Based on PageSetups from Alan J. Thompson
(defun c:A3_all_pdf ()
(PlotReactorOFF)
(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")
(princ x)(setq x (+ x 1))
   ) ;_ 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" "" "A3-pdf" "" "n" "y" "y")
   (command "_-purge" "a" "*" "N")
   (setq CCC_Sheet "A3")
   (command "updatefield" "all" "")
   (command "regenall")
   (command "_zoom" "e")
   (initdia)
   (command "._plot")
) ;<- IF
);<- PROGN
;(princ)
(setq x (1+ x))
)
   (PlotReactorON)
)    ;<- DEFUN

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(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
)
 
如果您不本地化变量,则下次使用该命令时,列表将继续“增长”
 

(vlax-for lay (vla-get-Layouts doc)
(setq plotabs (cons (vla-get-name lay) plotabs))
)

 
这就是为什么我在你之前的帖子中建议使用(layoutlist),因为这将给你一个没有“Model”的列表,它已经排序,并且不需要分配给变量。
 
HTH公司
 
干杯
 
顺便问一下:CCC_Sheet变量的用途是什么?

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

谢谢pBe,我试着合并你的评论,这是我拥有的,但我没有运行。我一直在寻找,但我的头脑不太清楚我需要删除或保留什么。
 
(defun c:A3_all_pdf ( / PlotReactorOFF doc lay plotabs plottablist ....)

 
该代码应该使用cutepdf打印机将所有布局绘制为pdf。问题是它一次又一次地绘制相同的布局。

pBe 发表于 2022-7-6 08:38:10

(PlotReactorOFF)和(PlotReactorON)来自您的帖子Woodman78

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

它们是李的子程序。我刚刚从变量列表中删除了它们,现在一切正常。谢谢pBe。

pBe 发表于 2022-7-6 08:45:34

很高兴它帮助了伍德曼78。继续编码
 
干杯

woodman78 发表于 2022-7-6 08:48:53

pBe 发表于 2022-7-6 08:51:08

(PlotReactorOFF) and (PlotReactorON) came from your post Woodman78

woodman78 发表于 2022-7-6 08:56:02

They are LeeMac's subroutines.I just removed them from the variable list and it works fine now.Thanks pBe.

pBe 发表于 2022-7-6 08:59:45

Glad it helps Woodman78. keep on coding
 
Cheers
页: 1 [2]
查看完整版本: 正在打印LISP帮助。。。