3 Replies Latest reply on Jan 27, 2016 10:23 AM by chuckt

    How to import a Cam Document by using  a Macro

    matthias

      Hi,

      Is it possible to import a Cam-Document by using a Macro?

      I've tryed it with the following code, but PADS shut down, if I try it like this :

       

          Application.ExecuteCommand("Define Cam Documents")

          DefineCamDocumentsDlg.Import("C:\CAM_Doku.cam")

       

      Thanks in advance

      Matthias

        • 1. Re: How to import a Cam Document by using  a Macro
          chuckt

          If you add the proper header/footer to your.cam file & rename to .asc, you can just do a normal ASC import.

           

          !PADS-POWERPCB-V9.0-MILS! DESIGN DATABASE ASCII FILE 1.0

          *MISC*      MISCELLANEOUS PARAMETERS

           

          *YOUR CAM FILE*

           

          *END*

          • 2. Re: How to import a Cam Document by using  a Macro
            matthias

            Thanks for your answer

            • 3. Re: How to import a Cam Document by using  a Macro
              chuckt

              Here's some code (script NOT macro) that seems to work:

               

              Sub Main

                CAMdir$ = Application.GetConfigParamString("directories", " CAMDir", " C:\PADS Projects\CAM\default")

                CAMfile$ = GetFilePath(,"CAM", CAMdir, "Pick a .CAM File to Import",)

                If CAMfile = "" Then End

                ASCfile$ = Mid(CAMfile,1,Len(CAMfile)-3) & "ASC"

                ASCheader$ = "!PADS-POWERPCB-V9.0-BASIC! DESIGN DATABASE ASCII FILE 1.0"

                MISCheader$ = "*MISC*      MISCELLANEOUS PARAMETERS"

                Open ASCfile For Output As #1

                     Print #1, ASCheader; vbCrLf

                     Print #1, MISCheader; vbCrLf

                Open CAMfile For Input As #2

                     While Not EOF (2)

                         Line Input #2, L$

                         Print #1, L

                     Wend

                Close #2

                Print #1, "*END*"

                Close #1

                ActiveDocument.ImportNetList(ASCfile)

                Kill ASCfile

              End Sub