乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 82|回复: 5

页面设置

[复制链接]

5

主题

38

帖子

3

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
58
发表于 2004-10-24 22:07:33 | 显示全部楼层 |阅读模式
我不知道我是愚蠢还是只是愚蠢,但我无法让它发挥作用。我试图绘制一个模型空间限制的EPS文件,这样我就可以通过ghostscript传递它,生成pdf文件。但是,当我运行此代码时,它不会更改任何modelspace布局属性。
  1. Public Function PlotToEPS(OutputFile As String) As Boolean
  2. Dim Layout As AcadLayout
  3. Dim Plot As AcadPlot
  4. Dim orig(0 To 1) As Double
  5. orig(0) = 0
  6. orig(1) = 0
  7. For Each Layout In ThisDrawing.Layouts
  8.     If LCase(Layout.Name) = "model" Then
  9.         With Layout
  10.             .ConfigName = "PostScript.pc3"
  11.             .CanonicalMediaName = "ANSI_B_(17.00_x_11.00_Inches)"
  12.             .PaperUnits = acInches
  13.             .PlotType = acLimits
  14.             .StandardScale = acScaleToFit
  15.             .PlotOrigin = orig
  16.             .StyleSheet = "Ricoh.ctb"
  17.             .PlotHidden = True
  18.             .UseStandardScale = True
  19.             .PlotRotation = ac90degrees
  20.             .CenterPlot = True
  21.         End With
  22.         
  23.         Set Plot = ThisDrawing.Plot
  24.         Plot.PlotToFile OutputFile, "PostScript.pc3"
  25.         Set Plot = Nothing
  26.         PlotToEPS = True
  27.     Else:
  28.         PlotToEPS = False
  29.     End If
  30. Next
  31. End Function
  32. [/end]
  33. Note: I use the "For Each Layout In ThisDrawing.Layouts" in case I never need to make this work with paperspace.

本帖以下内容被隐藏保护;需要你回复后,才能看到!

游客,如果您要查看本帖隐藏内容请回复
回复

使用道具 举报

0

主题

5

帖子

1

银币

初来乍到

Rank: 1

铜币
5
发表于 2004-10-27 20:47:42 | 显示全部楼层
我会变得又笨又笨,你怎么用这个?
我用脚本创建了一个类似的东西来绘制创建图。
使用这个有什么好处吗?
我要学的东西太多了...彼得
回复

使用道具 举报

0

主题

5

帖子

1

银币

初来乍到

Rank: 1

铜币
5
发表于 2004-10-29 20:51:53 | 显示全部楼层
我最近没有机会看这个,但我认为这是我的pc3文件中的错误,而不是代码中的错误。
我选择以这种方式而不是通过绘图脚本执行此操作的原因是,此方法在完成时将返回 true,这将允许我继续编写代码。现在我想到它可能无论如何都不起作用,我将不得不手动检查该文件。
回复

使用道具 举报

0

主题

5

帖子

1

银币

初来乍到

Rank: 1

铜币
5
发表于 2006-4-18 15:55:02 | 显示全部楼层
尝试用粗体行调整您的代码...
对于ThisDrawing.Layouts中的每个布局
如果LCase(Layout.Name)="model",那么
使用Layout
。刷新PlotDeviceInfo
。ConfigName="PostScript.pc3"
。刷新PlotDeviceInfo
...
不确定为什么我们需要刷新两次,但这是我可以让我的绘图例程正常工作的唯一方法。
回复

使用道具 举报

0

主题

5

帖子

1

银币

初来乍到

Rank: 1

铜币
5
发表于 2006-4-18 16:00:49 | 显示全部楼层
呜呜。别担心,那是行不通的。我在想别的事。。。
回复

使用道具 举报

0

主题

5

帖子

1

银币

初来乍到

Rank: 1

铜币
5
发表于 2006-4-18 16:44:55 | 显示全部楼层
这就是我使用的
  1. Public Sub SetupAndPlot(ByRef Plotter As String, CTB As String, SIZE As String, PSCALE As String, ROT As String)
  2.     Dim Layout As AcadLayout
  3.     On Error GoTo Err_Control
  4.     Set Layout = ThisDrawing.ActiveLayout
  5.     Layout.RefreshPlotDeviceInfo
  6.     Layout.ConfigName = Plotter    ' CALL PLOTTER
  7.     Layout.PlotType = acExtents
  8.     Layout.PlotRotation = ROT    ' CALL ROTATION
  9.     Layout.StyleSheet = CTB    ' CALL CTB FILE
  10.     Layout.PlotWithPlotStyles = True
  11.     Layout.CanonicalMediaName = SIZE    ' CALL SIZE
  12.     Layout.PaperUnits = acInches
  13.     Layout.StandardScale = PSCALE    'CALL PSCALE
  14.     Layout.ShowPlotStyles = False
  15.     ThisDrawing.Plot.NumberOfCopies = 1
  16.     Layout.CenterPlot = True
  17.     Layout.ScaleLineweights = False
  18.     Layout.RefreshPlotDeviceInfo
  19.     ThisDrawing.Regen acAllViewports
  20.     ZoomExtents
  21.     Set Layout = Nothing
  22.     ThisDrawing.Save
  23. Exit_Here:
  24.     Exit Sub
  25. Err_Control:
  26.     Select Case Err.Number
  27.         Case "-2145320861"
  28.             MsgBox "Unable to Save Drawing- " & Err.Description
  29.         Case "-2145386493"
  30.             MsgBox "Drawing is setup for Named Plot Styles." & (Chr(13)) & (Chr(13)) & "Run CONVERTPSTYLES command", vbCritical, "Change Plot Style"
  31.         Case Else
  32.             MsgBox "Unknown Error " & Err.Number
  33.     End Select
  34. End Sub
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-7-5 11:49 , Processed in 1.412427 second(s), 64 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表