.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ObjectDBX / ARX Replace Layout Tabs with ones from New Drawing (VBA)

1 REPLY 1
Reply
Message 1 of 2
JCC.Cadsystems
426 Views, 1 Reply

ObjectDBX / ARX Replace Layout Tabs with ones from New Drawing (VBA)

- 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

1 REPLY 1
Message 2 of 2

If you meant to how to use the code in your VBA project, you'd better to post in Visual Basic forum. This forum is for topic of using AutoCAD .NET API, mainly.

 

 

Norman Yuan

Drive CAD With Code

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost