There are a number of sticky areas surrounding your questions.
1. It is possible to iterate through design sheets using something like this:
Public schms As ViewDraw.IStringList
Public sheets As ViewDraw.IStringList
schms = app.SchematicSheetDocuments.GetAvailableSchematics
For n = 1 To schms.GetCount
sheets = app.SchematicSheetDocuments.GetAvailableSheets(tmp1)
For i = 1 To sheets.GetCount
'some code here for each sheet
2. One would expect that the resulting iteration would always match what you see in the Navigator. It doesn't.
3. If the sheets are re-ordered, the sheet iteration above will produce results that do not match the Navigator sheet order.
4. This indicates that there are two separate indices that control the Navigator and the iteration through sheets. To my knowledge, they do not mingle and there is no accessible way to correlate the two.
5. I discovered the following, which indirectly gets you to the Navigator index:
Public sheet_names as New ArrayList
Public design_name as String
Dim blocks as Object
dim block as ViewDraw.Block
design_name = app.GetProjectData.GetiCDBDesignRootBlock(app.GetActiveDesign()) 'this is the schematic, not the board
blocks = app.QueryPages(design_name)
For Each block In blocks
6. The result of the above is an arraylist with all the names of the sheets in it that matches the Navigator sheet numbering and order. It needs some error-checking and validation steps added but it's a starting point for being able to step through your schematic sheets. Further exploration needs to be done to find the full capabilities of app.GetProjectData.GetiCDBDesignRootBlock and anything that might work around it.
7. There is no way I know of to correlate or connect any of this to the PDF output routine. It's been a while since I looked at that but I do not remember any way of getting automation hooks into it or even being able to use command-line switches or other parameters to affect it. Another useful tool that is completely under lock and key. And somewhat limited in what it is allowed to do.
I realize that I have not directly answered your question, but I hope you can use some of this as a starting point for further exploration. Please report back if you are able to find anything else on this subject that will assist the rest of us.
Edit: This code is for vb.net. May not be compatible with other VB systems.
You will also want to look at this technote regarding hierarchical sheet numbering using the Scout Cross Reference tool. If that is set up properly, you should be able to programatically change the SHEET property while stepping through the different schematics/blocks in the design and thus define the dxPDF output.
Thanks for your info. I was able to work this out using your guidance and an appnote for scout and John Dubes code for visiting each sheet in a hierarchical design.
1. Creating a Page Number File for Use with Cross Reference, Scout and DxPDF
2. How to visit each schematic sheet in DxDesigner 2007.x
Controlling the print order and sheet numbering is fairly straight forward. You may need to be able to change or influence someone to change the border symbol properties. You will need to export a hierarchical schematic sheet list with VBA. You will need to augment your scout.ini file to update the numbers during cross referencing.
1. Export a list of sheets from the schematic. I like to use Excel VBA editor because it has an object browser. Set a reference to the Viewdraw object model and to the Microsoft Scripting Runtime.
2. Open your DxD project but don't open any sheets.
3. Hard code the sTopBlock string in the main function that is specific to your design.
4. Run the main subroutine. The WalkDesign routine will print the sheet_order.txt data into the output window in DxD.
5. Copy/Paste this into a blank text file and call it SHEET_ORDER.txt. Save the file in your "additional files" project subfolder.
If you want to reorder the sheets, you simply modify the numbers in the SHEET_ORDER.txt file.
6. Open up your scout.ini file. Add the following lines:
page_number_file "[FULLY QUALIFIED PATH TO]\SHEET_ORDER.txt"
7. Add the following "direct_reference" command. I Notice that directref1 applies to my border symbol. You need to specify yours there. Also notice that I placed this at 32.1, 0.70 with upper_center. That is where I want the @PRINTORDER attribute placed. I was using D size sheets. Also - our librarian team had used "SHEETNUM" instead of "@PRINTORDER" so we had to augment our border symbols. You may need to do the same.
attr any [YOUR_BORDER_SYMBOL_NAME] comp_attr any 32.10,0.70 upper_center
8. Add the following "direct_reference" command.Notice that directref1 applies to any composite symbol. I don't know for sure but this seems to apply in part to hierarchical blocks. As soon as I realized that this was starting to work I also grimaced because I was sloppy with my hierarchical block symbols in that I didn't really care at first where the origin was. Since I wanted a uniform apperance of the print order on each composite symbol, I had to update >60 blocks so that 0,0 corresponded to the upper right corner of the block. I also added a square border around the location where I would drop the @printorder attribute.
attr composite any comp_attr any 0.00,0.00 middle_center
9. use "Tools --> Cross Reference" and add cross referencing.
This was based on John Dube's code from Ref. 2.
**Use at your own risk
Set vdapp = GetObject(, "ViewDraw.Application")
Call WalkDesign("[YOUR TOP BLOCK HERE]")
Dim sPath, sSchematic
Dim objComp As ViewDraw.Component
Dim sSheets As ViewDraw.StringList
Dim dictPaths As Scripting.Dictionary
Set dictPaths = CreateObject("Scripting.Dictionary")
dictPaths.Add "", sTopBlock
For Each objComp In vdapp.DesignComponents("", sTopBlock, "-1", "STD", True)
If objComp.SymbolBlock.SymbolType = VDB_COMPOSITE Then
sPath = objComp.GetName(0)
On Error Resume Next
sSchematic = objComp.SymbolBlock.GetChildBlock.GetName(FULL_PATH_FROM_BLOCK)
If Err.Number > 0 Then
sSchematic = objComp.SymbolBlock.GetName(2) ' not sure what this is but it was in the code from the user group.
End If 'if Error
dictPaths.Add sPath, sSchematic 'This loads the schematic and hierarchy paths into a hash table.
End If 'objComp is composite symbol
j = 0 'This will be the sheet numbering index
For Each sPath In dictPaths.Keys 'loop through the hash table
sSchematic = dictPaths.Item(sPath) 'extract the schematic item from the path key
Set sSheets = vdapp.SchematicSheetDocuments.GetAvailableSheets(sSchematic) 'string list of sheets from path\schematic
For Each sSheet In sSheets 'iterate through each sheet
j = j + 1
vdapp.PushPath sTopBlock, sPath, sSheet 'Set the active view in DxD to the sheet target from the hash
'Debug.Print vdapp.ActiveView.block.GetName(FULL_PATH_FROM_BLOCK) 'Test the code
'Print the hierarchical path and sheet index to the output windows called "List Sheets" in DxD
vdapp.AppendOutput "List Sheets", sPath & "\" & sSchematic & "." & sSheet & "," & j