2 Replies Latest reply on Mar 7, 2017 5:37 AM by fireraizor

    DxDesigner: Get name of active board

    fireraizor

      Hello,

      I want to find out the board name of the active board.

      I tried following:

        Application.GetProjectData.GetiCDBDesigns.GetItem(1)

      But with this call, I only get a list of all designs but not of the currently opened design.

      Has anyone an idea how to realize that?

        • 1. Re: DxDesigner: Get name of active board
          matthias.cosaert

          Hello,
          you can get this with application.GetActiveDesign()

           

          Here is an example with some extra checks:

           

          Dim vdapp : Set vdapp = application
          Dim RootName,DesignName

           

          Call main

           

          Sub Main

          DesignName = vdapp.GetActiveDesign()
          Dim IcdbCount : IcdbCount = vdapp.GetProjectData.GetiCDBDesigns.Getcount

          if LEN(DesignName) = 0 then
            if IcdbCount > 1 then
             Msgbox "No design selected. (Project contains multiple boards)" & vbnewline & "Set a sheet from the required design as the active view.",0+16
            elseif IcdbCount = 0 then
             Msgbox "No design selected." & vbnewline & "(Project does not contain ICDB designs)",0+16 'VX uses Dxdesigner application as symbol editor
            else
             Msgbox "No design selected." & vbnewline & "(Failed to get active design)" ,0+16 'unknown error
            end if
            exit sub 'don't execute code
          else
            msgbox DesignName
            RootName = Vdapp.GetProjectData().getiCDBDesignRootBlock(DesignName)
          end if

          '.. code here

          end sub


          • 2. Re: DxDesigner: Get name of active board
            fireraizor

            thank you for the quick answer, that was what I have been looking for.