- 积分
 - 24658
 
- 明经币
 -  个
 
- 注册时间
 - 2004-3-17
 
- 在线时间
 -  小时
 
- 威望
 -  
 
- 金钱
 -  个
 
- 贡献
 -  
 
- 激情
 -  
 
 
 
 
 
 
 | 
 
 
发表于 2004-4-6 00:08:00
|
显示全部楼层
 
 
 
这是ARX的方法 - Imports Autodesk.AutoCAD.ApplicationServices
 - Imports Autodesk.AutoCAD.DatabaseServices
 - Imports Autodesk.AutoCAD.Runtime
 - Imports Autodesk.AutoCAD.Interop
 - Imports Autodesk.AutoCAD.Geometry
 - Imports DBTransMan = Autodesk.AutoCAD.DatabaseServices.TransactionManager
 - Public Class TLCad
 -        <CommandMethod("test")> Public Shared Sub MytestCmd()
 -                Dim db As Database = Application.DocumentManager.MdiActiveDocument.Database
 -                Dim tm As DBTransMan = db.TransactionManager
 -                Dim myT As Transaction = tm.StartTransaction()
 -                Try
 -                        Dim line As New Line(New Point3d(0, 0, 0), New Point3d(1, 1, 0))
 -                        Dim bt As BlockTable = CType(tm.GetObject(db.BlockTableId, OpenMode.ForRead, False), BlockTable)
 -                        Dim btr As BlockTableRecord = CType(tm.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite, False), BlockTableRecord)
 -                        btr.AppendEntity(line)
 -                        tm.AddNewlyCreatedDBObject(line, True)
 -                        Dim tbl As RegAppTable = CType(myT.GetObject(db.RegAppTableId, OpenMode.ForWrite, False), RegAppTable)
 -                        Dim app As New RegAppTableRecord
 -                        app.Name = "test1"
 -                        tbl.Add(app)
 -                        tm.AddNewlyCreatedDBObject(app, True)
 -                        line.XData = New ResultBuffer( _
 -                                        New TypedValue(CInt(DxfCode.ExtendedDataRegAppName), "test1"), _
 -                                        New TypedValue(CInt(DxfCode.ExtendedDataAsciiString), "tlcad test"))
 -                        myT.Commit()
 -                Finally
 -                        myT.Dispose()
 -                End Try
 -        End Sub
 - End Class
 
  |   
 
 
 
 |