01The requirement: design and test families, not single items
| Requirement | Why | What automation offered |
|---|---|---|
| Standard parts in many sizes | Flanges, brackets, gears and fasteners follow rules | Parametric programs that draw from a table of dimensions |
| Company drawing standards | Title blocks, layers and text styles must be consistent | Start-up routines and checking macros |
| Many analysis cases | Load cases, temperatures and design variants | Batch runs from command files and scripts |
| Long unattended tests | Endurance tests run day and night for weeks | Test sequencers with limits, alarms and logs |
| Instrument control | Meters, supplies and analysers must be set and read the same way every time | GPIB, SCPI, VISA and drivers called from scripts |
02Automating CAD
.scr file of typed commands — still useful for batch plotting and simple drawings.03Try it: one program, any flange
Set the dimensions. The generator writes the same drawing three ways: an AutoLISP command, an AutoCAD script file, and a Python ezdxf program that writes a DXF without AutoCAD.
04Automating analysis
| Software | Automation layer | Typical use |
|---|---|---|
| ANSYS Mechanical APDL | ANSYS Parametric Design Language — command files with variables, loops and macros; PyAnsys (Python) since the 2020s | Parametric models, many load cases, design optimisation |
| NASTRAN | Text input decks (bulk data cards) | Generated by pre-processors or scripts; run in batch |
| Abaqus | Python scripting of Abaqus/CAE; every GUI action is journalled as Python | Model generation, result extraction |
| COMSOL | LiveLink for MATLAB, Java API, applications built in the Application Builder | Packaging simulations as simple apps for non-specialists |
| MATLAB / Octave | Scripts and functions; matlab -batch (R2019a and later) runs without the desktop | Post-processing test data overnight (Episode 27) |
| FreeCAD, CalculiX, Code_Aster | Python and text input files | Fully scripted open-source workflows (Episodes 19, 29) |
05Automating test rigs
*IDN?, MEAS:VOLT:DC? and *RST.06Try it: run a test sequence
A sequencer runs steps in order, compares each measurement with its limits, and writes a report. Inject a fault and run again: the sequence stops safely at the first critical failure.
07Ready-to-use scripts
A. Change a dimension and rebuild (SolidWorks VBA macro)
' Tools → Macro → New; set the dimension name to one in your model
' (right-click a dimension → Properties shows names like D1@Sketch1).
Dim swApp As Object
Sub main()
Dim part As Object
Set swApp = Application.SldWorks
Set part = swApp.ActiveDoc
If part Is Nothing Then MsgBox "Open a part first": Exit Sub
part.Parameter("D1@Sketch1").SystemValue = 0.2 ' API units are metres: 200 mm
part.EditRebuild3
End SubB. Read a meter through SCPI (Python + PyVISA)
# pip install pyvisa pyvisa-py (or install NI-VISA / Keysight IO Libraries)
import time
import pyvisa
rm = pyvisa.ResourceManager()
print(rm.list_resources()) # find your instrument's address
dmm = rm.open_resource("GPIB0::22::INSTR") # replace with the address listed above
dmm.timeout = 5000 # ms
print(dmm.query("*IDN?").strip())
dmm.write("*RST")
dmm.write("CONF:VOLT:DC 10") # 10 V range
with open("dmm_log.csv", "w") as f:
f.write("time_s,volts\n")
t0 = time.time()
for _ in range(60): # one reading per second for a minute
v = float(dmm.query("READ?"))
f.write(f"{time.time() - t0:.1f},{v:.6f}\n")
time.sleep(1)
dmm.close()C. Process every run overnight (MATLAB batch from a Windows task)
rem run_matlab.bat — schedule with Task Scheduler (Episode 35); needs MATLAB R2019a or later
"C:\Program Files\MATLAB\R2026a\bin\matlab.exe" -batch "process_runs('D:\Archive\Data')" > D:\Archive\matlab_log.txt 2>&1process_runs.m is your own function on the MATLAB path; -batch exits with a non-zero code if it fails, so the log and Task Scheduler history show errors.
08Version explorer
Blue chips: CAD and CAE automation. Amber chips: test and instrument automation.
09Lessons for engineers
- Put the rules in one place. A table of dimensions driving one program beats twenty hand-drawn variants.
- Separate sequence from code. Limits and step order belong in a sequence file engineers can review; instrument code belongs in tested modules.
- Fail safe. Every automated rig sequence needs a defined safe state on error, loss of communication or operator stop.
- Version and validate scripts. A script that sets test conditions is part of the test procedure; review and record it as such.