- 积分
- 2250
- 明经币
- 个
- 注册时间
- 2009-5-15
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
本帖最后由 hnzgs 于 2012-12-4 17:27 编辑
代码如下:- '锁定文档
- Using acLckDoc As DocumentLock = doc.LockDocument
- '全部显示
- Autodesk.AutoCAD.Internal.Utils.ZoomAuto(1, 1, 1, 1, 1)
- Using trans As Transaction = db.TransactionManager.StartTransaction()
- Dim lm As LayoutManager = LayoutManager.Current
- Dim layName As String = GenerateLayoutName()
- '创建新布局
- Dim layoutId As ObjectId = lm.CreateLayout(layName)
- '设置为当前布局
- lm.CurrentLayout = layName
- Dim acLayout As Layout = TryCast(trans.GetObject(layoutId, OpenMode.ForRead), Layout)
- Dim pi As PlotInfo = New PlotInfo()
- pi.Layout = acLayout.ObjectId
- Dim ps As PlotSettings = New PlotSettings(acLayout.ModelType)
- ps.CopyFrom(acLayout)
- Dim psv As PlotSettingsValidator = PlotSettingsValidator.Current
- With psv
- '设置打印设备和纸张
- .SetPlotConfigurationName(ps, "Adobe PDF", "A4")
- '设置打印单位
- .SetPlotPaperUnits(ps, PlotPaperUnit.Millimeters)
- '设置打印比例
- .SetUseStandardScale(ps, True)
- .SetStdScaleType(ps, StdScaleType.ScaleToFit)
- ''设置打印区域
- .SetPlotType(ps, Autodesk.AutoCAD.DatabaseServices.PlotType.Extents)
- '设置横向打印
- .SetPlotRotation(ps, PlotRotation.Degrees090)
- ' 设置是否居中打印
- .SetPlotCentered(ps, True)
- End With
- '将布局由只读改为读写模式
- acLayout.UpgradeOpen()
- '置为当前布局
- acLayout.CopyFrom(ps)
-
- acLayout.DowngradeOpen()
-
- '保存新对象到数据库中
- trans.Commit()
- End Using
- '重生成一下,否则显示不正确
- doc.Editor.Regen()
- End Using
直接建好后的效果不大满意,怎样才能实现附图3那种想要的效果~~谢了先!
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注册
x
|