回复 carrot1983 的帖子
- '
- ' 由SharpDevelop创建。
- ' 用户: cjw
- ' 日期: 2011-5-12
- ' 时间: 9:14
- '
- ' 要改变这种模板请点击 工具|选项|代码编写|编辑标准头文件
- '
- Imports System
- Imports System.Collections.Generic
- Imports Autodesk.AutoCAD.DatabaseServices
- Imports Autodesk.AutoCAD.ApplicationServices
- Imports Autodesk.AutoCAD.Runtime
- Namespace vb20110512a
- ''' <summary>
- ''' Description of NewClass.
- ''' </summary>
- Public Class [NewClass]
- <CommandMethod("test")> _
- Public Sub CreateLayout()
- Dim doc As Document = Application.DocumentManager.MdiActiveDocument
- Dim db As Database = doc.Database
- Using tr As Transaction = db.TransactionManager.StartTransaction()
- Try
- Dim lm As LayoutManager = LayoutManager.Current
- Dim layoutId As ObjectId = lm.CreateLayout("新的布局")
- lm.CurrentLayout = "新的布局"
- Dim layout As Layout = TryCast(tr.GetObject(layoutId, OpenMode.ForRead), Layout)
- Catch
- Throw
- End Try
- tr.Commit()
- End Using
- End Sub
- End Class
- End Namespace
|