2 Replies Latest reply on Mar 19, 2010 10:16 AM by french1

    Automation for DxDesigner VB.net

    french1

      I'm trying to get my hooks into doing some automation for DxDesigner and having some issues hopefully you all can set me straight.  Ultimately I want to use pdDX to set specific settings like the border.ini file and such.  Im not sure what type I should declare docDX as and what to set pdDX variable equal to in order to get this to work.

       

      Public Class Form1

      Dim WithEvents appDX As ViewDraw.Application
          Dim docDX As ?????????
          Dim pdDX As ViewDraw.ProjectData

       

      Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

       

              GetDX()
              setINI()


          End Sub

       

      Private Function GetDX() As Boolean


              GetDX = True
              If appDX Is Nothing Then
                  On Error Resume Next
                  appDX = GetObject(, "ViewDraw.Application")
                  appDX.Visible = True
                  On Error GoTo 0
                  If appDX Is Nothing Then
                      MsgBox("DxDesigner is not running.  Please start DxDesigner." & vbNewLine)
                      GetDX = False
                      Exit Function
                  End If
              End If

       

              docDX = appDX.GetActiveDesign  '?????????

       

              'If docPCB Is Nothing Then
                  'MsgBox("No design is open.  Please open a design." & vbNewLine)
                  'GetDX = False
              'Else
                  'If MGCPCB_licenseDoc(docPCB) = False Then GetDX = False
              'End If

       

          End Function

       

          Private Sub setINI()


              pdDX = docDX.?????????

              pdDX.SetBordersFilePath("M:\WDIR07\borders.ini")
              pdDX.SetBusContentsFilePath("M:\WDIR07\busLabels.ini")
              pdDX.SetPinComponentsFilePath("M:\WDIR07\builtin.ini")

       

          End Sub

       

      End Class

        • 1. Re: Automation for DxDesigner VB.net
          john_dube

          GetActiveDesign returns a String, which is the name of the design being edited, or an empty string if there is no design being edited.

           

          The design name is not needed in your SetIni function, so there is no reason to call GetActiveDesign.

           

          You declared pdDX as ViewDraw.ProjectData, so you would use appDX.GetProjectData to set pdDX.

           

          So your code would look like this:

           

          Public Class Form1

              Dim WithEvents appDX As ViewDraw.Application

              Dim pdDX As ViewDraw.ProjectData

           

          Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

           

              If GetDX() Then
                 setINI()

              End If


          End Sub

           

          Private Function GetDX() As Boolean


                  GetDX = True
                  If appDX Is Nothing Then
                      On Error Resume Next
                      appDX = GetObject(, "ViewDraw.Application")
                      appDX.Visible = True
                      On Error GoTo 0
                      If appDX Is Nothing Then
                          MsgBox("DxDesigner is not running.  Please start DxDesigner." & vbNewLine)
                          GetDX = False
                          Exit Function
                      End If
                  End If

           

              End Function

           

              Private Sub setINI()


                  pdDX = appDX.GetProjectData()

                  pdDX.SetBordersFilePath("M:\WDIR07\borders.ini")
                  pdDX.SetBusContentsFilePath("M:\WDIR07\busLabels.ini")
                  pdDX.SetPinComponentsFilePath("M:\WDIR07\builtin.ini")

           

              End Sub

           

          End Class

           

          • 2. Re: Automation for DxDesigner VB.net
            french1

            okay cool that worked for me, thank you!