ObjectDBX / ARX Replace Layout Tabs with ones from New Drawing (VBA)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
- Background: I wrote a VBA code to setup new projects. The code creates dummy files that include layout tabs, blocks and xrefs. Inevitably the project changes and adjustments need to be made. I have a file called XX_template_XX.dwg that includes the new layouts that I will use to update the existing file(s).
The believe the solution I am looking for involves using the ObjectDBX utility and goes something like this as I dont have experience using this utility:
Private ReplaceLayouts_Click()
Dim oDBX
Dim newLayout, newBlock
Dim oldLayout, oldBlock
Dim strFileName As String
'open template and copy layouts?
strFileName = "Q:\Project\XX_Template_XX.dwg"
'open strFileName
'copy layouts using ObjectDBX utility
Set oDBX = GetInterfaceObject("ObjectDBX.AxDbDocument.19")
Set newLayout = ThisDrawing.Layouts.Add("New Layout")
Set newBlock = newLayout.Block
ThisDrawing.CopyObjects newBlock, newLayout
'close template
'open file (that has old layouts) and re-place with new layouts
'delete Layouts
'paste Layouts
ThisDrawing.PasteObjects newBlock, newLayout
'close file
End Sub
As you can see I have no idea what i am doing. please help or forward me a link that will help me learn how to run this function.
Thank You!
-K
Link copied