I am working on a project that uses VB to control the application, DWGeditor. Basically, I am starting with a template .dwg file and then inserting others as blocks; essentially layering the files to create a final product. VB has allowed me to create an interface so that I can select various options. Depending on which options are selected different blocks are inserted thereby creating a different diagram. All in all there are about 4,000 different combinations which results in 4,000 unique diagrams. As you can imagine it would not be feasible to generate all these files by hand so I need to automate the process.

This is where I need help. I'm sure I can loop the process pretty easily, but I have no idea where to begin in order to export the file in the automation process. There is a "PDF Out..." feature that exists under the File menu of DWGeditor which I use to manually save the files. If there a way to call this function? The end result should just be a single "Generate" button that will start the process that:

1. Opens template file
2. Inserts blocks
3. Export PDF
4. Close file
5. Go back to #1

Currently I have a .dwg file with the VB script/interface attached. It will open the template file and populate the diagram with the options selected from the interface. I can then manually stop the VB script then select "PDF out..." to create my file. Hopefully this makes sense.

I've found this... can't figure out what the syntax is to actually call the subroutine though.

Sub Export(FileName As String, Extension As String, [SelectionSet As SelectionSet])
Member of DWGeditor.Document
Exports the file to any of the supported formats. Optionally, pass in a selection set to export only a part of the file. Format is based on the extension in the FileName (default is the DXF format).

I was thinking something like:

docMx.Export("pdffile", ".pdf")

That just gives an error though. docMx is a Document variable set to the created file.

I also just tried:

Call ActiveDocument.Export("pdffile", ".pdf")

That compiled but gave a runtime error.

This article has been dead for over six months. Start a new discussion instead.