明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 4286|回复: 3

[打印] 请教有关打印设置数据的访问

[复制链接]
发表于 2006-8-23 15:32:00 | 显示全部楼层 |阅读模式

想用.net访问CAD的文档打印设置字典(PlotSettings),查了一些资料,只知这些数据是存在字典里,可不知如何访问和修改,请高人指教。

另,若想在自己的对话框中调用CAD自带的打印设置对话框(如下图),并能让设置好的打印数据传回自己的对话框,用什么函数可以实现??

谢谢

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
发表于 2009-2-2 11:56:00 | 显示全部楼层
关注。。。。
发表于 2010-8-25 12:07:00 | 显示全部楼层
关注中,怎么没人回答
发表于 2010-8-27 16:32:00 | 显示全部楼层
看这个
  1. Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
  2. Dim acCurDb As Database = acDoc.Database
  3. Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()
  4. Dim acLayoutMgr As LayoutManager
  5. acLayoutMgr = LayoutManager.Current
  6. Dim acLayout As Layout
  7. acLayout = acTrans.GetObject(acLayoutMgr.GetLayoutId(acLayoutMgr.CurrentLayout), _
  8. OpenMode.ForRead)
  9. Dim acPlInfo As PlotInfo = New PlotInfo()
  10. acPlInfo.Layout = acLayout.ObjectId
  11. Dim acPlSet As PlotSettings = New PlotSettings(acLayout.ModelType)
  12. acPlSet.CopyFrom(acLayout)
  13. Dim acPlSetVdr As PlotSettingsValidator = PlotSettingsValidator.Current
  14. '' 打印比例
  15. acPlSetVdr.SetUseStandardScale(acPlSet, True)
  16. acPlSetVdr.SetStdScaleType(acPlSet, StdScaleType.ScaleToFit)  
  17. '' 居中打印
  18. acPlSetVdr.SetPlotCentered(acPlSet, True)
  19. '' 打印设备和图纸
  20. acPlSetVdr.SetPlotConfigurationName(acPlSet, "PublishToWeb JPG.pc3", _
  21. "User-1")
  22. '先GetPoint然后再GetCorner
  23. Dim pPtRes As PromptPointResult
  24. Dim pPtOpts As PromptPointOptions = New PromptPointOptions("")
  25. pPtOpts.Message = vbLf & "请选择其中一个角点: "
  26. pPtRes = acDoc.Editor.GetPoint(pPtOpts)
  27. Dim PT1 As Point3d = pPtRes.Value
  28. Dim pCnOpts As PromptCornerOptions = New PromptCornerOptions("请选择一个对角点:", PT1)
  29. pPtRes = acDoc.Editor.GetCorner(pCnOpts)
  30. Dim PT2 As Point3d = pPtRes.Value
  31. '设置打印窗口
  32. Dim minX As Double = System.Math.Min(PT1.X, PT2.X)
  33. Dim minY As Double = System.Math.Min(PT1.Y, PT2.Y)
  34. Dim maxX As Double = System.Math.Max(PT1.X, PT2.X)
  35. Dim maxY As Double = System.Math.Max(PT1.Y, PT2.Y)
  36. Dim E2d As Extents2d = New Extents2d(minX, minY, maxX, maxY)
  37. acPlSetVdr.SetPlotWindowArea(acPlSet, E2d)
  38. acPlSetVdr.SetPlotType(acPlSet, Autodesk.AutoCAD.DatabaseServices.PlotType.Window)
  39. acPlInfo.OverrideSettings = acPlSet
  40. Dim acPlInfoVdr As PlotInfoValidator = New PlotInfoValidator()
  41. acPlInfoVdr.MediaMatchingPolicy = MatchingPolicy.MatchEnabled
  42. acPlInfoVdr.Validate(acPlInfo)
  43. If PlotFactory.ProcessPlotState = Autodesk.AutoCAD.PlottingServices. _
  44. ProcessPlotState.NotPlotting Then
  45. Using acPlEng As PlotEngine = PlotFactory.CreatePublishEngine()
  46. Dim acPlProgDlg As PlotProgressDialog = New PlotProgressDialog(False, _
  47. 1, _
  48. True)
  49. Using (acPlProgDlg)
  50. acPlProgDlg.PlotMsgString(PlotMessageIndex.DialogTitle) = "打印进度"
  51. acPlProgDlg.PlotMsgString(PlotMessageIndex.CancelSheetButtonMessage) = "取消打印"
  52. acPlProgDlg.PlotMsgString(PlotMessageIndex.SheetProgressCaption) ="打印进度"
  53. acPlProgDlg.LowerPlotProgressRange = 0
  54. acPlProgDlg.UpperPlotProgressRange = 100
  55. acPlProgDlg.PlotProgressPos = 0
  56. acPlProgDlg.OnBeginPlot()
  57. acPlProgDlg.IsVisible = True
  58. acPlEng.BeginPlot(acPlProgDlg, Nothing)
  59. acPlEng.BeginDocument(acPlInfo, _
  60. acDoc.Name, _
  61. Nothing, _
  62. 1, _
  63. True, _
  64. "c:\PlotTest")
  65. acPlProgDlg.PlotMsgString(PlotMessageIndex.Status) = _
  66. "正在打印 " & acDoc.Name & _
  67. " - " & acLayout.LayoutName
  68. acPlProgDlg.OnBeginSheet()
  69. acPlProgDlg.LowerSheetProgressRange = 0
  70. acPlProgDlg.UpperSheetProgressRange = 100
  71. acPlProgDlg.SheetProgressPos = 0
  72. Dim acPlPageInfo As PlotPageInfo = New PlotPageInfo()
  73. acPlEng.BeginPage(acPlPageInfo, _
  74. acPlInfo, _
  75. True, _
  76. Nothing)
  77. acPlEng.BeginGenerateGraphics(Nothing)
  78. acPlEng.EndGenerateGraphics(Nothing)
  79. acPlEng.EndPage(Nothing)
  80. acPlProgDlg.SheetProgressPos = 100
  81. acPlProgDlg.OnEndSheet()
  82. acPlEng.EndDocument(Nothing)
  83. acPlProgDlg.PlotProgressPos = 100
  84. acPlProgDlg.OnEndPlot()
  85. acPlEng.EndPlot(Nothing)
  86. End Using
  87. End Using
  88. End If
  89. End Using
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-26 00:29 , Processed in 0.170088 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表