写块克隆--WblockCloneObjects
来源:互联网 发布:apache storm java应用 编辑:程序博客网 时间:2024/05/27 09:47
Imports ZwSoft.ZwCAD.Runtime
Imports ZwSoft.ZwCAD.DatabaseServices
Imports ZwSoft.ZwCAD.Geometry
Imports ZwSoft.ZwCAD.EditorInput
Imports ZwSoft.ZwCAD.ApplicationServices
Public Class Commands
<CommandMethod("WblockClone")> _
Public Shared Sub WblockClone()
Dim ZwDoc As Document = Application.DocumentManager.MdiActiveDocument
Dim ZwDb As Database = ZwDoc.Database
Dim ed As Editor = ZwDoc.Editor
Dim entity As Entity = Nothing
Dim entityCollection As New DBObjectCollection()
Dim ents As PromptSelectionResult = ed.GetSelection()
If ents.Status = PromptStatus.OK Then
Using transaction As Transaction = ZwDb.TransactionManager.StartTransaction()
Dim SS As SelectionSet = ents.Value
For Each id As ObjectId In SS.GetObjectIds()
entity = DirectCast(transaction.GetObject(id, OpenMode.ForWrite, True), Entity)
If entity IsNot Nothing Then
entityCollection.Add(entity)
End If
Next
transaction.Commit()
End Using
End If
Dim Idc As New ObjectIdCollection()
For Each obj As DBObject In entityCollection
Idc.Add(obj.ObjectId)
Next
Dim nZwDb As New Database(True, True)
Dim idBtr As New ObjectId()
Dim map As New IdMapping()
Using trans As Transaction = nZwDb.TransactionManager.StartTransaction()
Dim bt As BlockTable = DirectCast(trans.GetObject(nZwDb.BlockTableId, OpenMode.ForRead), BlockTable)
Dim modelSpace As BlockTableRecord = DirectCast(trans.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForRead), BlockTableRecord)
idBtr = modelSpace.ObjectId
trans.Commit()
End Using
ZwDb.WblockCloneObjects(Idc, idBtr, map, DuplicateRecordCloning.Replace, False)
nZwDb.SaveAs("d:\newDrawing.dwg", DwgVersion.Current)
End Sub
End Class
Imports ZwSoft.ZwCAD.DatabaseServices
Imports ZwSoft.ZwCAD.Geometry
Imports ZwSoft.ZwCAD.EditorInput
Imports ZwSoft.ZwCAD.ApplicationServices
Public Class Commands
<CommandMethod("WblockClone")> _
Public Shared Sub WblockClone()
Dim ZwDoc As Document = Application.DocumentManager.MdiActiveDocument
Dim ZwDb As Database = ZwDoc.Database
Dim ed As Editor = ZwDoc.Editor
Dim entity As Entity = Nothing
Dim entityCollection As New DBObjectCollection()
Dim ents As PromptSelectionResult = ed.GetSelection()
If ents.Status = PromptStatus.OK Then
Using transaction As Transaction = ZwDb.TransactionManager.StartTransaction()
Dim SS As SelectionSet = ents.Value
For Each id As ObjectId In SS.GetObjectIds()
entity = DirectCast(transaction.GetObject(id, OpenMode.ForWrite, True), Entity)
If entity IsNot Nothing Then
entityCollection.Add(entity)
End If
Next
transaction.Commit()
End Using
End If
Dim Idc As New ObjectIdCollection()
For Each obj As DBObject In entityCollection
Idc.Add(obj.ObjectId)
Next
Dim nZwDb As New Database(True, True)
Dim idBtr As New ObjectId()
Dim map As New IdMapping()
Using trans As Transaction = nZwDb.TransactionManager.StartTransaction()
Dim bt As BlockTable = DirectCast(trans.GetObject(nZwDb.BlockTableId, OpenMode.ForRead), BlockTable)
Dim modelSpace As BlockTableRecord = DirectCast(trans.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForRead), BlockTableRecord)
idBtr = modelSpace.ObjectId
trans.Commit()
End Using
ZwDb.WblockCloneObjects(Idc, idBtr, map, DuplicateRecordCloning.Replace, False)
nZwDb.SaveAs("d:\newDrawing.dwg", DwgVersion.Current)
End Sub
End Class
0 0
- 写块克隆--WblockCloneObjects
- ceph rbd 块命令 块扩容 创建快照 rbd分层 rbd快照克隆 可写快照 rbd 导入导出,池、块、快照命令
- 【怎样写代码】对象克隆 -- 原型模式(四):浅克隆与深克隆
- Git克隆子模块出现错误的解决办法
- 写一个块设备驱动
- 写一个块设备驱动
- 自己动手写拖动滑块
- 数据块写函数fwrite
- 克隆
- 克隆
- 克隆
- 克隆
- 克隆
- 克隆
- 克隆
- UserClone 自己写的克隆帐户工具 附VC源码
- 【像黑客一样写博客之五】博客克隆
- 自己写的php curl库实现整站克隆
- hibernate多表查询
- 5分钟了解Mockito
- NSObject详解
- HDU4960:Another OCD Patient
- jmeter 数据库测试
- 写块克隆--WblockCloneObjects
- Maven学习(一)之初识
- 在Hadoop2.2下安装配置Hive
- shell awk实现实时监控网卡流量脚本(常见应用二)
- 在keil开发stm32问题
- eclipse Egit解决冲突的方法
- 程序猿感悟 开发者如何利用工具快速开发出完美APP
- MFC多国语言实现
- 防撞扶手改造项目完善