Hi... Some example of CopyObject with ObjectDBX??. Thanks
Here's a sub from a routine that copies multiple objects from a set window crossing area in the current drawing and creates any number of new drawings with those objects. I have not commented it at all, but it should give you an idea of how to handle it. HTH, Jeff Public Sub dwgsplit(dblMin, numX, numY) Dim dwgSS As AcadSelectionSet Dim y As Long Dim x As Long Dim llp(0 To 2) As Double Dim urp(0 To 2) As Double Dim dwgPath As String Dim dwgName As String Dim dwgPre As String Dim dwgPost As String Dim newdwg As AcadDocument Dim docs As AcadDocuments Dim dwgOrig As String dwgOrig = doc.Name Set docs = doc.Application.Documents dwgPath = doc.Path dwgPre = GridData.PrefixBox.Value dwgPost = GridData.SuffixBox.Value For y = 0 To numY - 2 For x = 0 To numX - 2 On Error Resume Next doc.SelectionSets.Item("split").Delete Set dwgSS = doc.SelectionSets.Add("split") llp(0) = dblMin(0) + (GridX * x) llp(1) = dblMin(1) + (GridY * y) urp(0) = llp(0) + GridX urp(1) = llp(1) + GridY doc.Application.ZoomWindow llp, urp dwgSS.Select acSelectionSetCrossing, llp, urp On Error GoTo 0 If dwgSS.Count > 4 Then ReDim exportSS(0 To dwgSS.Count - 1) As Object Dim I As Long For I = 0 To dwgSS.Count - 1 Set exportSS(I) = dwgSS.Item(I) Next I dwgCount = dwgCount + 1 dwgName = dwgPath & "\" & dwgPre & Format(dwgCount, "00") _ & dwgPost & ".dwg" Set newdwg = docs.Add docs.Item(dwgOrig).CopyObjects exportSS, newdwg.ModelSpace newdwg.SaveAs (dwgName) newdwg.Close End If Next x Next y doc.Application.ZoomExtents End Sub
ObjecDBX? yes, essentially the same code except here... <snip> Set newdwg = docs.Add docs.Item(dwgOrig).CopyObjects exportSS, newdwg.ModelSpace newdwg.SaveAs (dwgName) newdwg.Close <snip> replace with something like <snip> Set newdwg = OpenDbx 'assuming you have a function named open to open a dbxdoc 'and return the dbxDocObject docs.Item(dwgOrig).CopyObjects exportSS, newdwg.ModelSpace newdwg.SaveAs (dwgName) Set newDwg = Nothing ' that closes the dbx doc <snip>
Hi Mark Propst... Yes, I understand it. But my idea is I make it only with ObjectDBX. I Create a drawing via ObjectDBX and next I use CopyObject. My idea is simulate the command WBLOCK, which is not in ObjectDBX.
SpeedCAD, Looks to me like you need to use the Add method, immediately SaveAs, close, then access via DBX. ObjectDBX was apparently designed to work with existing Objects, not create them. Jeff Create a drawing via ObjectDBX and next I use CopyObject.
No, not really. A new AxDbDocument can be created from scratch and any number of objects can be copied into it or created in it directly. AcadX for AutoCAD 2004 Beta 1 http://mysite.verizon.net/~vze2vjds/acadx/AcadX16.zip
Hi Master Tony Tanzillo. How I can create a new AxDbDocument and copy objects to him with ObjectDBX? Thanks for all Master
You create a new AxDbDocument every time you use an object variable of that type. You don't have to use the Open() method to open an existing file, you can just treat the existing object as a new, unnamed DWG file. You copy objects into it using the CopyObjects method of the source document or database. AcadX for AutoCAD 2004 Beta 1 http://mysite.verizon.net/~vze2vjds/acadx/AcadX16.zip
Thanks for the clarification, Tony. I could've sworn I looked at doing this and failed. But I just looked back at what I was testing and I was doing exactly what SpeedCAD had been asking ..... sometimes I just can't see the forest through the trees..... Jeff