The M4 Circuit Macro Python Build Automation Tool (m4cm.py) is a Python script to automate the creation of Encapsulated Postscript (.eps), and/or “encapsulated” Portable Document Format (.pdf), or Joint Photographic Experts Group (*.jpg) or Portable Network Graphics (*.png) output directly from the M4 Circuit Macro source file.
The website will try and show how to get started with M4 Circuit macros and how to automate the creation of loose standing PDF, JPG and PNG pictures using m4cm.py, as well as some other tips and tricks.
Below is an example of a simple M4 Circuit Macro file:
.PS
include(pstricks.m4) scale=25.4 cct_init dx = 12.5 dy = 12.5 O: (0,0) Vs: source(up_ dy from O,S); llabel(,\mathbf{V}_s,) L: inductor(right_ 2*dx,,3,,dimen_/5); llabel(,jX_s,) Zl: ebox(down_ to (Here.x,O.y)); llabel(,\mathbf{Z}_l,) line to O dot ground .PE
Then use m4cm.py to compile to a “encapsulated” PDF picture.
$: m4cm -p ex0.m4cm
This would result in the following “encapsulated” PDF picture
To make a PNG picture, issue the following command
$: m4cm -n ex0.m4cm
which would result in this very nice PNG picture with a transparent background, ideal for webpages or Word documents,

Or the following command,
$: m4cm -j ex0.m4cm
to make a nice JPG picture with a white background,

To get started with M4 Circuit Macros, have a look at the Getting started with M4 Circuit Macros – Part I blog.
