0 Replies Latest reply on Jul 21, 2009 11:58 AM by chris_czernel

    How to create script that uses CAMCAD to import layout data and create CCZ file

    chris_czernel

      The question was asked, how to create a script that automates CAMCAD to import a layout file and create a CCZ file.The question centered around importing Allegro layout, but really can mean any layout data format.

       


      I have a few comments on this.

       


      First, there was an old tool called ccPublisher that does automatic CCZ conversions, however I'm not sure if this tool is even around any longer. If you don't want to code CCZ file automation yourself, I would inquire with the CAMCAD marketing group to see if ccPublisher is available and if it suits your purposes.

       


      Second, I tried this out in VB6 and the CAMCAD scripting window. This example should be ok for users with VB6, VB.Net, or  the CAMCAD scripting window. I make no claims of compatibility of this code beyond this.

       


      1) When CAMCAD is programmatically launched, it expects to be programmatically licensed through API calls. If you do not have code or experience licensing CAMCAD through the API,  you should just launch CAMCAD manually. That way your standard license file will be read.

       


      2) To import data into CAMCAD, there are a few choices:
      objCAMCAD.LoadDataFile = loads a CCZ file;

       

      objCAMCAD.OpenCADFile = uses an "auto detect" mechanism like dragging and dropping a file into CAMCAD. However, this method fails in some cases when multiple files are involved;

       

      objCAMCAD.Import = needs to be told what file format to import. I used the constant "25" passed to this function to identify the imported data as Cadence Allegro for this example.

       


      3) To save a CCZ file from CAMCAD, use objCAMCAD.SaveCompressedFileAs

       


      4) To do this in batch mode, you will need to use functions that open and close project windows in CAMCAD. You will also need programmatic logic for looping through design directories for whatever designs need to be converted.

       


      Attached to this discussion is a small help file I wrote on CAMCAD APIs. It does not list all the available APIs but it will definitely help anyone interested in CAMCAD automation.

       

      Here is code that you can copy / paste into the CAMCAD scripting window. When played, it will open a project window, load Allegro data, save a CCZ file, and close the project window. You will need to adjust the Path variable to point to where you have your data files.

       

      Sub Main
          Dim objCAMCAD
          Set objCAMCAD = CreateObject("CAMCAD.Application")

       

           Dim strPath As String
         

           ' adjust this path to point to where your design files are. Don't forget the trailing backslash
          strPath = "C:\Program Files\Router Solutions\CAMCAD\Samples\Allegro\"


          objCAMCAD.OpenNewDocument
          objCAMCAD.Import 25, strPath & "brd.txt," & _
              strPath & "pad.txt," & _
              strPath & "rte.txt," & _
              strPath & "sym.txt", ""
          objCAMCAD.SaveCompressedDataFileAs strPath & "saveddata.ccz"
          objCAMCAD.CloseActiveDocument

       

      End Sub

       

      Good luck,
      Chris