yyrr1984 发表于 2007-6-6 19:54:00

[求助]打印的程序为什么出错?帮忙指正下!!

我自己边的一个打印程序,其中有三处错误,请高手指点一下为什么错了,我找了半天都没找出来,小弟初学
Public Sub PLprint()
ThisDrawing.ActiveLayout = ThisDrawing.Layouts.Item("Model")
ThisDrawing.ActiveLayout.ConfigName = "DWF6 ePlot.pc3"
'设置打印方式是窗口
    ThisDrawing.ModelSpace.Layout.PlotType = acWindow
Dim ptMin As Variant, ptMax As Variant
Dim ent As AcadEntity
ThisDrawing.SetVariable "BACKGROUNDPLOT", 0
'这里显示设置系统变量时出错
    For Each ent In ThisDrawing.ModelSpace
      If TypeOf ent Is AcadBlockReference Then
         If StrComp(ent.Name, "actj2tk", vbTextCompare) = 0 Then
               ent.GetBoundingBox ptMin, ptMax
            End If
      End If
    Next ent
      
      ' 设置打印范围
      
      ReDim Preserve ptMin(0 To 1)
      ReDim Preserve ptMax(0 To 1)
      ThisDrawing.ModelSpace.Layout.SetWindowToPlot ptMin, ptMax
      
'设置打印比例为缩放到图纸大小,并中心对正
    ThisDrawing.ModelSpace.Layout.StandardScale = acScaleToFit
    ThisDrawing.ModelSpace.Layout.CenterPlot = True
   
       '设置笔为彩色
      
   ThisDrawing.ActiveLayout.StyleSheet = "DWF Virtual Pens.ctb"
   '这里显示输入有无效,可我看了cad中打印样式就这样的呀!
      
   
    '选择打印机和纸张
    ThisDrawing.ModelSpace.Layout.ConfigName = "WINDOW.PC3"
    ThisDrawing.ModelSpace.Layout.CanonicalMediaName = "600*2000 毫米"
    '这里提示输入无效,我自己设的纸张大小是600*2000的,要是有错该写成什么样呢?
   
    ' 设置打印份数为1
    ThisDrawing.Plot.NumberOfCopies = 1
   
    ' 设置安静打印
    ThisDrawing.Plot.QuietErrorMode = True
   
'打印
    ThisDrawing.Plot.PlotToDevice
   
    ThisDrawing.SetVariable "BACKGROUNDPLOT", 2
End Sub

yyrr1984 发表于 2007-6-13 19:57:00

为什么没有人回答呀?我等着用

fjfhgdwfn 发表于 2007-6-14 09:02:00

应是没有样式表和不支持你的图纸。

fjfhgdwfn 发表于 2007-6-14 09:02:00

应是没有样式表和不支持你的图纸。

qazllqaz 发表于 2009-2-13 18:58:00


    ThisDrawing.ActiveLayout = ThisDrawing.Layouts.Item("Model")

    ThisDrawing.ActiveLayout.PlotType = acWindow
    ThisDrawing.SetVariable "BACKGROUNDPLOT", 0
我用这句是对的

jfcui 发表于 2009-6-24 17:27:00

我输入样式的时候也出现这样的问题,不知道是什么原因,急死人了。提示输入无效。
页: [1]
查看完整版本: [求助]打印的程序为什么出错?帮忙指正下!!