请教有关打印设置数据的访问
<P>想用.net访问CAD的文档打印设置字典(PlotSettings),查了一些资料,只知这些数据是存在字典里,可不知如何访问和修改,请高人指教。</P><P>另,若想在自己的对话框中调用CAD自带的打印设置对话框(如下图),并能让设置好的打印数据传回自己的对话框,用什么函数可以实现??</P>
<P>谢谢</P> 关注。。。。 <div id="textstyle_2" style="FONT-SIZE: 12pt; OVERFLOW: hidden; WORD-BREAK: break-all; TEXT-INDENT: 0px; WORD-WRAP: break-word">关注中,怎么没人回答</div> 看这个
Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
Dim acCurDb As Database = acDoc.Database
Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()
Dim acLayoutMgr As LayoutManager
acLayoutMgr = LayoutManager.Current
Dim acLayout As Layout
acLayout = acTrans.GetObject(acLayoutMgr.GetLayoutId(acLayoutMgr.CurrentLayout), _
OpenMode.ForRead)
Dim acPlInfo As PlotInfo = New PlotInfo()
acPlInfo.Layout = acLayout.ObjectId
Dim acPlSet As PlotSettings = New PlotSettings(acLayout.ModelType)
acPlSet.CopyFrom(acLayout)
Dim acPlSetVdr As PlotSettingsValidator = PlotSettingsValidator.Current
'' 打印比例
acPlSetVdr.SetUseStandardScale(acPlSet, True)
acPlSetVdr.SetStdScaleType(acPlSet, StdScaleType.ScaleToFit)
'' 居中打印
acPlSetVdr.SetPlotCentered(acPlSet, True)
'' 打印设备和图纸
acPlSetVdr.SetPlotConfigurationName(acPlSet, "PublishToWeb JPG.pc3", _
"User-1")
'先GetPoint然后再GetCorner
Dim pPtRes As PromptPointResult
Dim pPtOpts As PromptPointOptions = New PromptPointOptions("")
pPtOpts.Message = vbLf & "请选择其中一个角点: "
pPtRes = acDoc.Editor.GetPoint(pPtOpts)
Dim PT1 As Point3d = pPtRes.Value
Dim pCnOpts As PromptCornerOptions = New PromptCornerOptions("请选择一个对角点:", PT1)
pPtRes = acDoc.Editor.GetCorner(pCnOpts)
Dim PT2 As Point3d = pPtRes.Value
'设置打印窗口
Dim minX As Double = System.Math.Min(PT1.X, PT2.X)
Dim minY As Double = System.Math.Min(PT1.Y, PT2.Y)
Dim maxX As Double = System.Math.Max(PT1.X, PT2.X)
Dim maxY As Double = System.Math.Max(PT1.Y, PT2.Y)
Dim E2d As Extents2d = New Extents2d(minX, minY, maxX, maxY)
acPlSetVdr.SetPlotWindowArea(acPlSet, E2d)
acPlSetVdr.SetPlotType(acPlSet, Autodesk.AutoCAD.DatabaseServices.PlotType.Window)
acPlInfo.OverrideSettings = acPlSet
Dim acPlInfoVdr As PlotInfoValidator = New PlotInfoValidator()
acPlInfoVdr.MediaMatchingPolicy = MatchingPolicy.MatchEnabled
acPlInfoVdr.Validate(acPlInfo)
If PlotFactory.ProcessPlotState = Autodesk.AutoCAD.PlottingServices. _
ProcessPlotState.NotPlotting Then
Using acPlEng As PlotEngine = PlotFactory.CreatePublishEngine()
Dim acPlProgDlg As PlotProgressDialog = New PlotProgressDialog(False, _
1, _
True)
Using (acPlProgDlg)
acPlProgDlg.PlotMsgString(PlotMessageIndex.DialogTitle) = "打印进度"
acPlProgDlg.PlotMsgString(PlotMessageIndex.CancelSheetButtonMessage) = "取消打印"
acPlProgDlg.PlotMsgString(PlotMessageIndex.SheetProgressCaption) ="打印进度"
acPlProgDlg.LowerPlotProgressRange = 0
acPlProgDlg.UpperPlotProgressRange = 100
acPlProgDlg.PlotProgressPos = 0
acPlProgDlg.OnBeginPlot()
acPlProgDlg.IsVisible = True
acPlEng.BeginPlot(acPlProgDlg, Nothing)
acPlEng.BeginDocument(acPlInfo, _
acDoc.Name, _
Nothing, _
1, _
True, _
"c:\PlotTest")
acPlProgDlg.PlotMsgString(PlotMessageIndex.Status) = _
"正在打印 " & acDoc.Name & _
" - " & acLayout.LayoutName
acPlProgDlg.OnBeginSheet()
acPlProgDlg.LowerSheetProgressRange = 0
acPlProgDlg.UpperSheetProgressRange = 100
acPlProgDlg.SheetProgressPos = 0
Dim acPlPageInfo As PlotPageInfo = New PlotPageInfo()
acPlEng.BeginPage(acPlPageInfo, _
acPlInfo, _
True, _
Nothing)
acPlEng.BeginGenerateGraphics(Nothing)
acPlEng.EndGenerateGraphics(Nothing)
acPlEng.EndPage(Nothing)
acPlProgDlg.SheetProgressPos = 100
acPlProgDlg.OnEndSheet()
acPlEng.EndDocument(Nothing)
acPlProgDlg.PlotProgressPos = 100
acPlProgDlg.OnEndPlot()
acPlEng.EndPlot(Nothing)
End Using
End Using
End If
End Using
页:
[1]