编辑ZWCAD实体--移动对象
来源:互联网 发布:aj2 wing it 编辑:程序博客网 时间:2024/05/16 17:52
Imports ZwSoft.ZwCAD.Runtime
Imports ZwSoft.ZwCAD.ApplicationServices
Imports ZwSoft.ZwCAD.DatabaseServices
Imports ZwSoft.ZwCAD.EditorInput
Imports ZwSoft.ZwCAD.Geometry
Public Class ZwcadApps
<CommandMethod("MoveObject")> _
Public Sub MoveObject()
Dim ZcDoc As Document = Application.DocumentManager.MdiActiveDocument
Dim ZcDB As Database = ZcDoc.Database
Dim ZcEd As Editor = ZcDoc.Editor
Using ZcTran As Transaction = ZcDB.TransactionManager.StartTransaction()
Dim peo As New PromptEntityOptions(vbLf & "Select object:")
Dim per As PromptEntityResult = ZcEd.GetEntity(peo)
If per.Status <> PromptStatus.OK Then
Return
End If
Dim Ent As Entity = ZcTran.GetObject(per.ObjectId, OpenMode.ForWrite)
Dim pro1 As New PromptPointOptions(vbLf & "Input source point:")
Dim proR1 As PromptPointResult = ZcEd.GetPoint(pro1)
If proR1.Status <> PromptStatus.OK Then
Return
End If
Dim sourcePt As Point3d = proR1.Value
Dim pro2 As New PromptPointOptions(vbLf & "Input target point:")
Dim proR2 As PromptPointResult = ZcEd.GetPoint(pro2)
If proR2.Status <> PromptStatus.OK Then
Return
End If
Dim targetPt As Point3d = proR2.Value
Dim vec As Vector3d = targetPt - sourcePt
Dim Mt As Matrix3d = Matrix3d.Displacement(vec)
Ent.TransformBy(Mt)
ZcTran.Commit()
End Using
End Sub
End Class
Imports ZwSoft.ZwCAD.ApplicationServices
Imports ZwSoft.ZwCAD.DatabaseServices
Imports ZwSoft.ZwCAD.EditorInput
Imports ZwSoft.ZwCAD.Geometry
Public Class ZwcadApps
<CommandMethod("MoveObject")> _
Public Sub MoveObject()
Dim ZcDoc As Document = Application.DocumentManager.MdiActiveDocument
Dim ZcDB As Database = ZcDoc.Database
Dim ZcEd As Editor = ZcDoc.Editor
Using ZcTran As Transaction = ZcDB.TransactionManager.StartTransaction()
Dim peo As New PromptEntityOptions(vbLf & "Select object:")
Dim per As PromptEntityResult = ZcEd.GetEntity(peo)
If per.Status <> PromptStatus.OK Then
Return
End If
Dim Ent As Entity = ZcTran.GetObject(per.ObjectId, OpenMode.ForWrite)
Dim pro1 As New PromptPointOptions(vbLf & "Input source point:")
Dim proR1 As PromptPointResult = ZcEd.GetPoint(pro1)
If proR1.Status <> PromptStatus.OK Then
Return
End If
Dim sourcePt As Point3d = proR1.Value
Dim pro2 As New PromptPointOptions(vbLf & "Input target point:")
Dim proR2 As PromptPointResult = ZcEd.GetPoint(pro2)
If proR2.Status <> PromptStatus.OK Then
Return
End If
Dim targetPt As Point3d = proR2.Value
Dim vec As Vector3d = targetPt - sourcePt
Dim Mt As Matrix3d = Matrix3d.Displacement(vec)
Ent.TransformBy(Mt)
ZcTran.Commit()
End Using
End Sub
End Class
- 编辑ZWCAD实体--移动对象
- 编辑ZWCAD实体--复制对象
- 编辑ZWCAD实体--旋转对象
- 编辑ZWCAD实体--缩放对象
- 编辑ZWCAD实体--偏移对象
- 编辑ZWCAD实体--镜像对象
- 创建ZWCAD实体--对齐标注
- 创建ZWCAD实体--弧长标注
- 03-04 创建和编辑AutoCAD实体(四) 编辑二维命名对象 (1)
- 03-04 创建和编辑AutoCAD实体(四) 编辑二维命名对象 (2)
- 03-04 创建和编辑AutoCAD实体(四) 编辑二维命名对象 (3)
- 03-04 创建和编辑AutoCAD实体(四) 编辑二维命名对象 (4)
- 03-04 创建和编辑AutoCAD实体(四) 编辑二维命名对象 (5)
- 03-04 创建和编辑AutoCAD实体(四) 编辑二维命名对象 (6)
- 03-04 创建和编辑AutoCAD实体(四) 编辑二维命名对象 (7)
- 03-04 创建和编辑AutoCAD实体(四) 编辑二维命名对象 (8)
- 03-04 创建和编辑AutoCAD实体(四) 编辑二维命名对象 (9)
- 03-01 创建和编辑AutoCAD实体(一) 打开和关闭对象
- 用户权限管理数据库表结构设计
- 使用索引优化查询
- SQL 比较 两个 日期 (datetime) 的 年 月 大小,比较到年月,不比较日
- solr 导入csv文件
- android-ndk-r8e与Eclipse自动编译
- 编辑ZWCAD实体--移动对象
- Tomcat部署方案
- Cocos2d-x 的“HelloWorld” 深入分析
- SHELL实现跳板机,只允许用户执行少量允许的命令
- 正则表达式
- JSP 9 大内置对象详解
- qt中QButton实现点击时间不同响应不同槽
- VTD-XML Tutorial - Java - ( I )
- thrift一个例子 (编译c++ 参数)