4 Replies Latest reply on Feb 6, 2015 2:10 AM by marcosewtz

    Import .dxf file with automation

    Marco.Sewtz

      Hello,

       

      I am writing a script, which is importing a cell, which is saved as a .dxf file. I'm trying to use the DXFImport object, but I get an error when executing go(). Does someone have a solution for this problem? See code below.

       

      Thanks in advance

      Marco

       


      Sub ImportDXF(Path, LayerSuffix, CellName)
          Dim DXF : Set DXF = Document.DXFImport


          
          'Settings
          DXF.ImportFileName = Path
          DXF.CellName = CellName
          DXF.ImportMode = epcbDXFImportModeOverWriteCell
          DXF.Scale(epcbUnitMM) = 1.0
          DXF.Units = epcbUnitMM


          
          'Create and clean Layers
          Dim LayerName
          ForEach LayerNameIn DXF.DXFLayerNames
              Call Plot("Creating Layer """ & LayerName & """ for DXF Import", Info)   
              
              'Create
              Call CreateLayer(LayerName, True)
              
              'Map
              Call DXF.MapDXFLayerNameToUserLayer(LayerName, LayerName & LayerSuffix)
          Next


          
          'Map fonts
          Dim Font
          ForEach FontIn DXF.DXFFontNames
              Call DXF.MapDXFFontNameToTrueTypeFontName(Font, "VERIBEST_GERBER_0")
          Next


          
          If DXF.Errors.Count > 0Then
              Dim ErrorObject
              ForEach ErrorObjectIn DXF.Errors
                  Call Plot(ErrorObject.ErrorString, Exception)
              Next
          EndIf


          
          'Import
        Call DXF.Go()
      EndSub

      Error.png

      Line 144 is "Call DXF.Go()"