Main Content


Create PCB board definitions from 2-D PCB designs

Since R2021b


Use the PCBWriter object to create a printed circuit board (PCB) design files based on multilayer 2-D PCB design. A set of manufacturing files known as Gerber files describes a PCB. A Gerber file uses an ASCII vector format for 2-D binary images.




b = PCBWriter(pcbcomponentObject) creates a PCBWriter object that generates Gerber-format PCB design files based on a 2-D PCB design geometry using PCB stack.

b = PCBWriter(pcbcomponentObject,rfConnector) creates a customized PCB file using specified rfConnector type.

b = PCBWriter(pcbcomponentObject,writer) creates a customized PCB file using a specified PCB service, writer.

b = PCBWriter(pcbcomponentObject,rfConnector,writer) creates customised PCB file using specified PCB service and PCB connector type.

Input Arguments

expand all

Single feed PCB, specified as a pcbComponent object.

Example: p1 = pcbComponent creates a PCB component object, p1 . a = PCBWriter(p1) uses p1 to create a PCBWriter object a.

PCB service to view PCB design, specified as a PCBServices object.

Example: s = PCBServices.MayhewWriter; a = PCBWriter(p1,s) uses Mayhew Labs PCB service to view the PCB design.

RF connector type for PCB feedpoint, specified as a PCBConnectors object.

Example: c = PCBConnectors.SMA_Cinch; a = PCBWriter(p1,c) uses SMA_Cinch RF connector at feedpoint.


expand all

Use default connector, specified as 0 or 1.

Example: a.UseDefaultConnector = 1, where a is a PCBWriter object.

Data Types: logical

Line widths drawn around components on silk screens, specified as a positive scalar in mils.

Example: a.ComponentBoundaryLineWidth = 10, where a is a PCBWriter object.

Data Types: double

Font size to label components on silk screen, specified as a positive scalar in points.

Example: a.ComponentNameFontSize = 12, where a is a PCBWriter object.

Data Types: double

Design information text font size added outside board profile, specified as a positive scalar.

Example: a.DesignInfoFontSize = 12, where a is a PCBWriter object.

Data Types: double

Font used for component name and design info, specified as a character vector.

Example: a.Font = 'TimesNewRoman', where a is a PCBWriter object.

Data Types: char | string

Copper free margin around board, specified as a positive scalar in meters.

Example: a.PCBMargin = 0.7e-3, where a is a PCBWriter object.

Data Types: double

Add solder mask to top and bottom of PCB, specified as 'both', 'top', 'bottom' or 'none'.

Example: a.SolderMask = 'top', where a is a PCBWriter object.

Data Types: char | string

Generate solder paste files as a part of PCB stack, specified as 1 or 0.

Example: a.SolderPaste = 0, where a is a PCBWriter object.

Data Types: logical

Object Functions

gerberWriteGenerate Gerber files


collapse all

Create a coplanar waveguide.

cpw = coplanarWaveguide
cpw = 
  coplanarWaveguide with properties:

              Length: 0.0231
               Width: 0.0039
             Spacing: 2.0000e-04
          ViaSpacing: [0.0011 0.0070]
         ViaDiameter: 5.0000e-04
              Height: 0.0016
    GroundPlaneWidth: 0.0300
           Substrate: [1x1 dielectric]
           Conductor: [1x1 metal]
          IsShielded: 0

Use this waveguide to create a pcbComponent object.

p = pcbComponent(cpw);
p.Name = 'Coplanar Waveguide'
p = 
  pcbComponent with properties:

              Name: 'Coplanar Waveguide'
          Revision: 'v1.0'
        BoardShape: [1x1 antenna.Rectangle]
    BoardThickness: 0.0016
            Layers: {[1x1 antenna.Polygon]  [1x1 dielectric]  [1x1 antenna.Rectangle]}
     FeedLocations: [2x4 double]
      FeedDiameter: 0.0019
      ViaLocations: [42x4 double]
       ViaDiameter: 5.0000e-04
      FeedViaModel: 'strip'
         Conductor: [1x1 metal]
              Tilt: 0
          TiltAxis: [0 0 1]
              Load: [1x1 lumpedElement]
        IsShielded: 0


Use an SMA_Cinch as an RF connector and Mayhew Writer as a 3-D viewer.

c = PCBConnectors.SMA_Cinch
c = 
  SMA_Cinch with properties:

                    Type: 'SMA'
                     Mfg: 'Cinch'
                    Part: '142-0711-202'
              Annotation: 'SMA'
               Impedance: 50
               Datasheet: ''
                Purchase: ''
               TotalSize: [0.0071 0.0071]
           GroundPadSize: [0.0024 0.0024]
       SignalPadDiameter: 0.0017
         PinHoleDiameter: 0.0013
           IsolationRing: 0.0041
    VerticalGroundStrips: 1

   Cinch 142-0711-202 (Example Purchase)

s = PCBServices.MayhewWriter
s = 
  MayhewWriter with properties:

               BoardProfileFile: 'legend'
          BoardProfileLineWidth: 1
                 CoordPrecision: [2 6]
                     CoordUnits: 'in'
              CreateArchiveFile: 0
                 DefaultViaDiam: 3.0000e-04
             DrawArcsUsingLines: 1
                 ExtensionLevel: 1
                       Filename: 'untitled'
                          Files: {}
         IncludeRootFolderInZip: 0
                   PostWriteFcn: @(obj)sendTo(obj)
    SameExtensionForGerberFiles: 0
                    UseExcellon: 1

Create a PCB component design file.

PW = PCBWriter(p,s,c)
PW = 
  PCBWriter with properties:

                        Design: [1x1 struct]
                        Writer: [1x1 PCBServices.MayhewWriter]
                     Connector: {[1x1 PCBConnectors.SMA_Cinch]  [1x1 PCBConnectors.SMA_Cinch]}
           UseDefaultConnector: 0
    ComponentBoundaryLineWidth: 8
         ComponentNameFontSize: []
            DesignInfoFontSize: []
                          Font: 'Arial'
                     PCBMargin: 5.0000e-04
                    Soldermask: 'both'
                   Solderpaste: 1

   See info for details

Version History

Introduced in R2021b