用的是帮助文件的代码,把打印机提示覆盖文件不选就可以了
可是新问题来了,只能打印一次,cad提示:已经有一个打印或发布作业在后台进行处理。一次只能处理一个作业... ...
 - (defun c:tt()
- ;; This example allows the user to define an area in the current layout to plot
- ;; and displays a plot preview of the defined area.
- ;;
- ;; * Note: You will have to exit the plot preview
- ;; before the VBA example will stop and control will be returned
- (setq acadObj (vlax-get-acad-object))
- (setq doc (vla-get-ActiveDocument acadObj))
- ;; Get first point in window
- (setq point1 (vlax-variant-value (vla-GetPoint (vla-get-Utility doc) nil "Click the lower-left of the window to plot.")))
- ;; Change this to a 2D array by removing the Z position
- (setq pointTemp1 (vlax-make-safearray vlax-vbDouble '(0 . 1)))
- (vlax-safearray-put-element pointTemp1 0 (vlax-safearray-get-element point1 0))
- (vlax-safearray-put-element pointTemp1 1 (vlax-safearray-get-element point1 1))
-
- ;; Get second point in window
- (setq point2 (vlax-variant-value (vla-GetCorner (vla-get-Utility doc) point1 "Click the upper-right of the window to plot.")))
- ;; Change this to a 2D array by removing the Z position
- (setq pointTemp2 (vlax-make-safearray vlax-vbDouble '(0 . 1)))
- (vlax-safearray-put-element pointTemp2 0 (vlax-safearray-get-element point2 0))
- (vlax-safearray-put-element pointTemp2 1 (vlax-safearray-get-element point2 1))
-
- ;; Send information about window to current layout
- (vla-SetWindowToPlot (vla-get-ActiveLayout doc) pointTemp1 pointTemp2)
-
- ;; Read back window information
- (vla-GetWindowToPlot (vla-get-ActiveLayout doc) 'point1 'point2)
- (setq point1 (vlax-safearray->list point1)
- point2 (vlax-safearray->list point2))
-
- (alert (strcat "Press any key to plot the following window:"
- "\nLower Left: " (rtos (nth 0 point1) 2) ", " (rtos (nth 1 point1) 2)
- "\nUpper Right: " (rtos (nth 0 point2) 2) ", " (rtos (nth 1 point2) 2)))
-
- ;; Make sure the instruction is to plot a view, not some other plot style
- (vla-put-PlotType (vla-get-ActiveLayout doc) acWindow)
-
- ;; Send Plot To Window - A plot device must be set before a preview can be created
- (vla-put-ConfigName (vla-get-ActiveLayout doc) "adobe PDF.pc3")
- ;(vla-DisplayPlotPreview (vla-get-Plot doc) acFullPreview)
- (vla-PlotToDevice (vla-get-Plot doc))
- )
|