|
发表于 2016-1-19 21:46:00
|
显示全部楼层
ivde:
谢谢!
测试是这个原因,理解了。
Public Sub ccc()
Dim myCurve As Curve
Dim db As Database = HostApplicationServices.WorkingDatabase
Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
Dim optEnt As New PromptEntityOptions(vbLf & "选择曲线:")
Dim resEnt As PromptEntityResult = ed.GetEntity(optEnt)
If (resEnt.Status = PromptStatus.OK) Then
Using trans As Transaction = db.TransactionManager.StartTransaction()
Dim bt As BlockTable = CType(trans.GetObject(db.BlockTableId, OpenMode.ForRead), BlockTable)
Dim btr As BlockTableRecord = CType(trans.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite), BlockTableRecord)
myCurve = TryCast(trans.GetObject(resEnt.ObjectId, OpenMode.ForWrite), Curve)
If Not myCurve Is Nothing And TypeOf myCurve Is Polyline Then
CType(myCurve, Polyline).SetPointAt(0, New Point2d(0, 0))
trans.Commit()
End If
End Using
End If
End Sub |
|