请帮忙看一下在VBA中的页面设置为什么不能把打印范围改成 窗口 型式?
Option ExplicitSub addPlotCon()On Error Resume Next
'删除所有的设置
Call delAllPlotCon
addPlotConfiguration "HP5000LE--A3", "\\Laserjet server\HP5000LE", "acad.ctb", _
"A3", True, True
End SubFunction addPlotConfiguration(plotConName As String, configName As String, styleSheet As String, mediaName As String, _
isRotate90 As Boolean, ifFit As Boolean) As AcadPlotConfiguration
'On Error Resume Next
Dim PlotConfigurations As AcadPlotConfigurations
Dim plotCon As AcadPlotConfiguration
Set PlotConfigurations = ThisDrawing.PlotConfigurations
Set plotCon = PlotConfigurations.Add(plotConName, True)
With plotCon
.configName = configName
.CanonicalMediaName = mediaName
.PaperUnits = acMillimeters
.styleSheet = styleSheet
.CenterPlot = True
'.PlotHidden = False
If isRotate90 Then
.PlotRotation = ac90degrees
Else
.PlotRotation = ac0degrees
End If
If ifFit Then
.StandardScale = acScaleToFit
Else
.StandardScale = ac1_1
End If
.PlotType = acExtents '这一步可以运行
.PlotType = acWindow '可是这一步就不行了
.PlotType = acView
'.PlotViewportBorders = False
'.PlotViewportsFirst = True
'.PlotWithLineweights = True
.PlotWithPlotStyles = True
'.ScaleLineweights = False
'.ShowPlotStyles = False
'.UseStandardScale = True
End With
Set addPlotConfiguration = plotCon
End Function
Sub delAllPlotCon()
Dim plotCon As AcadPlotConfiguration
'删除所有的设置
For Each plotCon In ThisDrawing.PlotConfigurations
plotCon.Delete
Next
End Sub代码运行到 .PlotType = acExtents '这一步可以运行
.PlotType = acWindow '可是这一步就不行了不知道如何才能把PlotType改成acwindow?请各位高手指点一下。
先设置打印WINDOWS的两个角坐标,再.PlotType = acWindow ,就可以至少我的程序是这样的
ThisDrawing.ModelSpace.Layout.SetWindowToPlot LowerLeft, UpperRight <BR> hisDrawing.ModelSpace.Layout.PlotType = acWindow 谢谢nxy_918,按你的方法已经解决了,下面是改变后的函数,可以满足要求了。Function addPlotConfiguration(plotConName As String, configName As String, styleSheet As String, mediaName As String, _
isRotate90 As Boolean, ifFit As Boolean) As AcadPlotConfiguration
On Error Resume Next
Dim leftPnt(0 To 1) As Double, rightPnt(0 To 1) As Double
leftPnt(0) = 0: leftPnt(1) = 0
rightPnt(0) = 1: rightPnt(1) = 1
Dim PlotConfigurations As AcadPlotConfigurations
Dim plotCon As AcadPlotConfiguration
Set PlotConfigurations = ThisDrawing.PlotConfigurations
Set plotCon = PlotConfigurations.Add(plotConName, True)
With plotCon
.configName = configName
.CanonicalMediaName = mediaName
.PaperUnits = acMillimeters
.styleSheet = styleSheet
.CenterPlot = True
'.PlotHidden = False
If isRotate90 Then
.PlotRotation = ac90degrees
Else
.PlotRotation = ac0degrees
End If
If ifFit Then
.StandardScale = acScaleToFit
Else
.StandardScale = ac1_1
End If
.SetWindowToPlot leftPnt, rightPnt
.PlotType = acWindow
'.PlotViewportBorders = False
'.PlotViewportsFirst = True
'.PlotWithLineweights = True
.PlotWithPlotStyles = True
'.ScaleLineweights = False
'.ShowPlotStyles = False
'.UseStandardScale = True
End With
Set addPlotConfiguration = plotCon
End Function 正也遇到出图问题,怎样在用 ThisDrawing.Plot.PlotToDevice 语句时让楼上的程序设置起作用,我要输出黑白没有灰度的图,用vb程序实现不了,请帮忙. <P> 请教老兄帮忙给我解释一下这句是什么意思好吧,谢谢了!</P>
<P> addPlotConfiguration "HP5000LE--A3", "<A href="http://www.mjtd.com/bbs/file://Laserjet/" target=_blank><FONT color=#000000>\\Laserjet</FONT></A> server\HP5000LE", "acad.ctb", _<BR> "A3", True, True</P>
<P>能详细点最好的啦!!!<BR> <BR></P>
页:
[1]