metaldan 发表于 2022-7-6 22:24:35

cut & paste in second drawing

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.
 
 

Dim ssp As AcadSelectionSetSet ssp = ThisDrawing.SelectionSets.Add("TEST_SSET") ssp.Select acSelectionSetAll If ssp.Count = 0 Then Exit Sub         Dim DOC1 As AcadDocumentSet DOC1 = Documents.AddDim 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

BlackBox 发表于 2022-7-6 22:49:04

I'm not understanding the non-.NET syntax; that must be VBA?

SEANT 发表于 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.

BIGAL 发表于 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.

Bill Tillman 发表于 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?
页: [1]
查看完整版本: cut & paste in second drawing