乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 61|回复: 4

[编程交流] cut & paste in second drawing

[复制链接]

18

主题

32

帖子

14

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
90
发表于 2022-7-6 22:24:35 | 显示全部楼层 |阅读模式
Hi
 
 
I have to select all enties in a drawing and paste my selection in a second drawing.
 
Presently, I found a way to make it, but on a big drawing it's extremely long to execute.  There is a faster way to make a cut / paste of a entire drawing in a second..
 
this is my code.
 
 
  1. Dim ssp As AcadSelectionSet  Set ssp = ThisDrawing.SelectionSets.Add("TEST_SSET") ssp.Select acSelectionSetAll If ssp.Count = 0 Then Exit Sub         Dim DOC1 As AcadDocument  Set DOC1 = Documents.Add  Dim objCollection() As Object         Dim intCount As Integer               intCount = ssp.Count - 1     ReDim objCollection(intCount)     For i = 0 To intCount            Set objCollection(i) = ssp.ITEM(i)     Next   CurrDoc.CopyObjects objCollection, DOC1.ModelSpace
回复

使用道具 举报

44

主题

3166

帖子

2803

银币

中流砥柱

Rank: 25

铜币
557
发表于 2022-7-6 22:49:04 | 显示全部楼层
I'm not understanding the non-.NET syntax; that must be VBA?
回复

使用道具 举报

10

主题

973

帖子

909

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
118
发表于 2022-7-6 23:01:54 | 显示全部楼层
If everything from CurrDoc’s ModelSpace requires copying, would a DOC1.ModelSpace.InsertBlock(…) work?
 
I’m not sure it would be much faster, necessarily, as the InsertBlock call probably uses a similar method as you've demonstrated.  Native code, though, is considerably faster than ActiveX.
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-6 23:20:13 | 显示全部楼层
Whats wrong with Insert ? you can insert an entire dwg in one go into the current dwg no real code needed. Note this is a ALL DWG not a bit of it.
回复

使用道具 举报

180

主题

639

帖子

463

银币

中流砥柱

Rank: 25

铜币
897
发表于 2022-7-6 23:35:45 | 显示全部楼层
If you are indeed copying and pasting everything....and I mean everything, then why not just open the drawing and rename it with a new name. In fact you wouldn't even have to open it. You could also use BIGAL's concept that is to insert the drawing then you could use a different location in the model for the insertion point. I don't mean to over simplify this but if you are wanting everything then why do it piece-meal?
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-4 11:41 , Processed in 0.929483 second(s), 62 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表