7 Replies Latest reply on Jan 25, 2011 4:54 PM by hoi.fhoon.lim

    Schematic2DXF

    chris_czernel

      A question was raised recently regarding whether it was possible to loop through schematic data and generate DXF files for the schematic sheets.

       

      One way to implement this is to use CCZ files and CAMCAD. Export CCZ from the schematic tool, load into CAMCAD and run this utility (zip file attached).Note - CAMCAD must be running with a schematic file loaded for this utility to execute properly.

       

      The code is very simple:

      ScreenHunter_16 Jul. 20 17.04.gif

       

      All the user interface does is allow the user to select the output directory and drive.

       

      Here is the code (below). The actual creation of DXF files is caused by the ExportDXF API from CAMCAD.

       

      Another way to implement this is to use the Export API from CAMCAD (as opposed to ExportDXF), although this method would invoke and display the Export dialogs and the user would need to click through those dialogs as they come up. The implemented method does not show any export dialogs.

       

      Option Explicit
      Public objCAMCAD As CAMCAD.Application

       

       

       

      Private Sub Command1_Click()
      Dim lPosition As Long
      Dim returnValue As Integer
      Dim tempArray As Variant
      Dim x As Integer
      Dim path As String
      Dim counter As Integer
      Dim intReturn As Integer

       

       

       

          objCAMCAD.GetActiveFile lPosition ' call camcad api to get the active file position
         
          ' this api takes a fileposition of a view and gives an array of geometry numbers
          ' of sheets of that view
           returnValue = objCAMCAD.GetSchematicSheetArray(lPosition, tempArray)
           path = App.path
           counter = 1
          
           ' now set the view to each sheet, and export dxf
           For x = 0 To UBound(tempArray)
          
              objCAMCAD.SetSchematicSheet lPosition, tempArray(x)
              intReturn = objCAMCAD.ExportDXF(Dir1.path & "\Sheet" & counter & ".dxf", 0.01, True, True, False)
              counter = counter + 1
                 
           Next x
          
         
      End Sub

       

      Private Sub Drive1_Change()
      Dir1.path = Drive1.Drive
      End Sub

       

      Private Sub Form_Load()
          ' these commands establish the connection to CAMCAD
          Set objCAMCAD = New CAMCAD.Application
          Drive1.Drive = "C"
          Dir1.path = App.path
        
      End Sub

       

       

      The code first gets the Active File (a CAMCAD term for the currently loaded file in CAMCAD). Then it uses the Active File pointer and gets the schematic sheets associated with the active file. It then loops through the sheets, sets the sheets (makes them the visible sheet), and exports DXF for each one. The output file names are "Sheet1.dxf", "Sheet2.dxf", "Sheet3.dxf", and so on for each sheet.

       

      This code may be helpful for anyone who is looking for CAMCAD automation possibilities.

        • 1. Re: Schematic2DXF
          jim.granville

          Interesting.

          - Which Mentor Schematic flows does this work with ?

          - Does this preserve Text Strings in the DXF ?

           

          For PADS Logic we have achieved DXF via Logic -> Photoplot > CAMCAD -> DXF,

          but that loses  text strings. (ie the text renders as vectors)

          • 2. Re: Schematic2DXF
            chris_czernel

            - Which Mentor Schematic flows does this work with ?

            Answer: DxDesigner can export CCZ files directly, and that was the original thought behind the tool. However, CAMCAD also can import EDIF, and once the data is in CAMCAD this script/utility can be executed.

             

            - Does this preserve Text Strings in the DXF ?

            Answer: Yes. In some cases  the text string placement or justification in the DXF file may be slightly off. However if you need text for searching, this should be ok.

             

            For PADS Logic we have achieved DXF via Logic -> Photoplot > CAMCAD -> DXF, but that loses  text strings. (ie the text renders as vectors)

            Comment: If you mean Logic > HPGL > CAMCAD > DXF, yes HPGL is just pen down - draw - pen up commands, and like Gerber does not contain true text. I believe the HPGL2 format does contain true text though.

             

            Comment 2: The action of the objCAMCAD.ExportDXF command flattens the drawing data into just one graphical layer in the DXF file during export. If different layers need to be preserved, the utility can be adjusted to use the objCAMCAD.Export API. The disadvantage of this approach is that the Export dialog in CAMCAD is displayed, and requires the user to hit the [OK] button for each sheet exported. The advantage is that layers are better preserved. Depending on your purpose for using the utility, one  approach may work better for you than the other.

            • 3. Re: Schematic2DXF
              jim.granville

              Thanks,

               

              >- Does this preserve Text Strings in the DXF ?

              > Answer: Yes. In some cases  the text string placement or justification in the DXF file may be slightly off. However if you need text for searching, this should be ok.

               

              On this topic: We have already raised some test cases, and I believe a fix is scheduled for CAMCAD's Text justify problems,

              which occur on some pathways (but not all)

              We did get very good results from CAMCAD to Adobe Illustrator CS3 to Layered, Searchable PDFs

              (Illustrator CS2 had some minor visual line handling issues)

              • 4. Re: Schematic2DXF
                jim.granville

                just came across this older thread, and there is a wider discussion on DXF from schematics here

                 

                https://na5.brightidea.com/ct/ct_a_view_idea.bix?c=CD718BE9-B00A-4E64-83AB-BEC03879E1E0&idea_id=521F935B-88FC-424A-A8DD-27F80B24EB92#comments

                 

                This one we tested, and gace some minor feedback on:

                 

                http://www.cadkas.com/downengpdf11.php

                • 5. Re: Schematic2DXF
                  chris_czernel

                  Thanks Jim. Schematic to DXF is an interesting topic. Hopefully one day PADS Logic will have a CCZ exporter, so you could use the same process as DxDesigner -> CCZ -> DXF, which works pretty well.

                   

                  The 2nd link you offered is PDF to DXF, which probably involves vectorization of the pdf file in order to derive dxf polylines. Interesting concept, thanks for sharing!

                  • 6. Re: Schematic2DXF
                    jim.granville

                    CCZ would be good - perhaps that could also provide the needed Dxd to Logic pathway as well.

                     

                    Yes, the CAD-KAS flow extracts correct polyline paths

                     

                    The issues it has, that I fed back, are cosmetic but do need to be addressed - seems they are still on the to-do list ?

                     

                    * Text height is a little 'overcooked', so I suggested he add a user-defined Text Height/Size Scale multiplier. Very simple to do.

                       ~ 80% seems to do nicely.

                    * import preview shows line widths, but the DXF exported drops to zero width. Preserving linewidths as an option, would

                      give a close to 100% visual clone of the original drawing.

                    • 7. Re: Schematic2DXF
                      hoi.fhoon.lim

                      Hi chris_czernel,

                       

                      We have install CAMCAD Professional 4.6.330 on the server.

                      We have developed a web application to automate the CAMCAD Professional using PERL in order to process Agilent 5DX output.

                       

                      Do you facing any problem when you call CAMCAD.Application?

                        Public objCAMCAD As CAMCAD.Application (is it calling CAMCAD Professional?)

                       

                      We call the CAMCAD.Application in PERL and the script as below:

                        my $ex = Win32::OLE->new('CamCad.Application') or die "oops\n";

                      But it is call CAMCAD Graphic by default

                       

                      Do you know how to call CAMCAD Professional by using PERL script?

                      Open command prompt:

                        cd C:\MentorGraphics\CAMCAD\SDD_HOME

                      if  we type: 

                        CAMCADPro.EXE (calling CAMCAD Graphic)

                      else

                         CAMCADPro.EXE /Professional (calling CAMCAD Professional)