1 Reply Latest reply on Oct 6, 2016 1:12 PM by Patrick.Cashman

    Is it possible to add sheets or hierarchical blocks by automation?



      We have an Excel tool for making our motherboards where we specify the connector pinouts and the nets connecting the different pins. This generates a netlist that we import into Expedition PCB.


      In order for us to be able to apply more complex constraints to the nets I'm thinking about writing a script that reads the netlist and automatically draws the nets in a DxDesigner schematic. The schematic itself would not have any greater value to us as such, but it would allow us to use CES for constraint entry.


      Now to my question, since we are talking about a lot of connector pins (e.g. the design I'm working on right now has some 1500 pins) the scheamtic would need to occupy more than one schematic sheet. Therefore I'm wondering if it is possble to let the script create new hierarchic blocks at the top level schematic, or if that's not possible at least add new sheets to the current schematic? I've searched in the DxDesigner Automation Reference but I couldn't find anything.



        • 1. Re: Is it possible to add sheets or hierarchical blocks by automation?

          Here is a function which adds new sheets.,  It also adds the default sheet border, which in your case you may want to take out (the blok.insertborder() command):


          Sub add_sheet()


                   Dim tmp1, tmp2 As String

                   Dim blok As ViewDraw.Block

                   Dim sheets As ViewDraw.IStringList


                   view = app.ActiveView

                   tmp2 = view.document.fullname

                   tmp1 = tmp2.Substring(0, instr(tmp2, ".") - 1)




                   sheets = app.SchematicSheetDocuments.GetAvailableSheets(tmp1)

                   If sheets Is Nothing Then

                       msgbox("sheets not set to an object")

                        Exit Sub

                   End If


                   app.SchematicSheetDocuments.InsertSheet(tmp1, sheets.GetCount + 1)


                   sheets = app.SchematicSheetDocuments.GetAvailableSheets(tmp1)

                   app.SchematicSheetDocuments.open(tmp1, sheets.GetItem(sheets.GetCount))

                   view = app.ActiveView


                   blok = app.ActiveView.Block



                   view = app.ActiveView

          End Sub


          The function assumes you already have a schematic open with an existing sheet, and that you have acquired a reference to the viewdraw application (app) prior to executing the function.


          Or you could just do it all on one sheet.  Nothing says the parts have to be within a certain area of the sheet.  There may be some maximum size, but it's large enough that for practical use you don't need to worry about it.


          You can also add parts to the schematic sheet, with this command:


          comp = blok.AddPartInstance(partition, device, symbol, x, y)


          comp = the new component

          blok  = the schematic sheet block

          partition = the library partition of the component symbol block

          device = part number

          symbol = symbol name

          x,y  = location to place the part on the sheet


          Of course there is a lot more code needed to surround that command.  I have done it by having the components in a text file, reading the file and handling each component one at a time, and doing the math to location the components so that they are not on top of each other.


          And then you can add nets to the pins of the components if you want.  This way you get both components and nets and an accurate netlist in your PCB design. In essence build a design from an existing spreadsheet or text files with the relevant data.  Unorthodox, not pretty, but can get the job done.

          3 of 3 people found this helpful