7 Replies Latest reply on Jun 26, 2014 6:47 AM by joseph.spang1

    Table of contents in DxDesigner possible?

    o.knitterscheidt

      Hi all,

      how do I generate table  of Blocks, Page and Decription of a hierarchical design on a seperate page? Scout doens  provide such capabilities afaik.

      Regards Oliver

        • 2. Re: Table of contents in DxDesigner possible?
          volker.hetzer

          We do our own, using automation.

          • 3. Re: Table of contents in DxDesigner possible?
            o.knitterscheidt

            Wow, cool for you. I guess your automation is company private only or is it possible to leverage from it?

            Regards

            • 4. Re: Table of contents in DxDesigner possible?
              volker.hetzer

              It's rather specialized code, requiring certain frame properties and stuff, so it wouldn' be of much help to you.

              But it really is not much, depending on how your project looks like.

               

              If you have a flat design, you just get all frame symbols, get the property values you want (page number, page title), and put it onto the first sheet.

              Do you have any experience at all with automation?

               

              I could try a little ten liner or so demonstrating page/property access and putting text.

               

              By the way, if you feel more comfortabe using .NET, with .NET 4 it's really easy yo use C#  with Mentor too.

               

              Lots of Greetings!

              Volker

              • 5. Re: Table of contents in DxDesigner possible?
                o.knitterscheidt

                if you could make it, it would be a great entry in Automation for us.

                Regrads Oliver

                • 6. Re: Table of contents in DxDesigner possible?
                  volker.hetzer

                  Hi!

                  This, I think, is the minimum of effort you need to put in in order to get a table of contents. You'll probably want to do more fancy stuff with alignment, fonts and colours. And you would probablywant it to create a menu entry and get loaded during the DxDesigner startup.

                   

                  Also, we don't use hierarchical designs, so I have no idea how to traverse one. Much less, what to put into a table of contents for it.

                   

                  Thirdly, it is much more fun doing this in .NET, with all that intellisense and much more powerful data structures. But this needs a lot of initial investment in terms of becoming a real pro with all the COM interop issues.
                  It would definitely not be worth it if you only want two or three small extensions.

                   

                  Anyway, here goes:

                   

                  'Which symbol is a frame?
                      set Frame=New Regexp
                      Frame.Pattern="^frame"
                      Frame.IgnoreCase=true
                  
                  ' Design Name (we don't use hierarchical designs)
                      DesignName="flat"
                  'What properties do I read?
                      TitlePropName="FSC_TITLE2"
                      SheetNumPropName="@SHEET"
                  
                  'What's the sheet number of the contents sheet?
                      FirstSheetNum="001"
                  
                  'Where do I put the text
                      X=400
                      Y=2500
                      DeltaY=30
                  
                  'This will hold the table of contents data
                      set Contents=createobject("Scripting.Dictionary")
                  
                  'This function processes one sheet
                      function checkDoc(Doc)
                          Doc.Activate
                          set View=ActiveView
                          for each Comp in ActiveView.Query(VDM_COMP,VD_ALL)
                              if Frame.Test(Comp.Symbolblock.getName(SHORT_NAME)) then
                                  set PageAtt=Comp.FindAttribute(SheetNumPropName)
                                  set TitleAtt=Comp.FindAttribute(TitlePropName)
                                  if (not (TitleAtt is Nothing or PageAtt is Nothing)) then
                                      Contents(PageAtt.EitherValue)=TitleAtt.EitherValue
                                      end if
                                  End if
                              Next
                          end function
                  
                  'We close all open sheets
                      if (Documents.Count>0) then
                          SchematicSheetDocuments.Close
                          end if
                  
                  'Then we process each sheet,
                      for each Page in QueryPages(DesignName)
                          StatusBarText="Processing page " & Page.SheetNum
                          set Doc=Documents.Open(DesignName,Page.SheetNum)
                          checkDoc Doc
                          Doc.Close true,DesignName+Page.SheetNum
                          Next
                      StatusBarText="finished scanning"
                  
                  'create a list of formatted lines (trick: we use a .Net data structure
                  'which grows and can sort. You'll probably put more effort in this)
                      set LineList=createobject("System.Collections.ArrayList")
                      for each Key in Contents.Keys
                          LineList.Add(Key&"/"&Contents(Key))
                          Next
                      LineList.Sort
                  
                  'and lastly, write the toc
                      StatusBarText="writing TOC"
                      set Doc=Documents.Open(DesignName,FirstSheetNum)
                      Doc.Activate
                      set View=ActiveView
                      set Block=View.Block
                      ' first we delete the old stuff
                          for each Text in View.Query(4,0)
                              Text.Selected=true
                              Next
                          Block.DeleteSelected(true)
                      'and the nwe add the new lines
                          for each Line in LineList.ToArray()
                              Block.AddText Line,X,Y
                              Y=Y-DeltaY
                              Next
                      StatusBarText=""
                  

                   

                  You run it by saving it into a vbs file, opening the command line toolbar within DxDesigner and then typing "run c:\x.vbs".

                  It worked for me but it is very unlikely to work for you. :-(

                  But it should at least give you an idea of what's involved in doing an Extension for DxDesigner.

                   

                  Lots of Greetings!

                  Volker

                  • 7. Re: Table of contents in DxDesigner possible?
                    joseph.spang1

                    Hi Volker,

                     

                    I need your help.

                    I'm not sure it still working with the last release.

                    The script create a new page in the Block section and then nothing.

                    The collection seems not working...

                     

                    Thanks for your help

                     

                    Joseph