- 积分
- 466
- 明经币
- 个
- 注册时间
- 2011-2-13
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
楼主 |
发表于 2016-1-19 21:46:51
|
显示全部楼层
ivde:
谢谢!
测试是这个原因,理解了。
<CommandMethod("ccc")>
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
|
|