Open every schematic in an existing project asset, iterate through common schematic object collections, normalize visual style in place, and save cleaned copies.
This sample uses the Hydroscope project asset to demonstrate bulk schematic
mutation across multiple .SchDoc files.
- iterating project schematic files from an asset folder
- walking components, pins, component parameters, and component graphics
- mutating document-level wires, ports, net labels, power ports, harnesses, and sheet symbols
- using
schdoc.objects.of_type(...)for generic type-based object queries - using
ColorValue,SchFontSpec,LineWidth, and record collections instead of raw Altium field names - saving modified schematics with
AltiumSchDoc.save(...)
From the package root:
uv run python examples\schdoc_clean\schdoc_clean.pyThis sample reads every .SchDoc in:
examples/assets/projects/hydroscope/
The script writes:
examples/schdoc_clean/output/hydroscope_clean/
examples/schdoc_clean/output/hydroscope_clean/Hydroscope.PrjPcb
examples/schdoc_clean/output/clean_manifest.json
Open the copied Hydroscope.PrjPcb from the output folder to load the cleaned
schematics through the original project-relative document names.
The example applies these style rules:
- component pin names and pin designators use Courier New 10 in black
- document sheet backgrounds become pure white
- the document system font becomes Courier New 10
- component body rectangles with either dimension larger than 100 mil become solid white with a small black border
- component line, polyline, and arc graphics become black
- small component polygons get black border and black fill
- filled component circles get black border and black fill
- component designators use black Courier New, bold, preserving the existing size
- visible component parameters use black Courier New 10
- schematic wires become
#434343 - power ports become black with Courier New 10 bold text
- dotted voltage-style power names normalize from forms like
+3.3Vto+3v3 - net labels use black Courier New 9 bold
- page ports get black border, black fill, white Courier New 10 bold text
- free text strings use Courier New, preserving the existing size
- note text uses Courier New 10
- note fill becomes
#F3F3F3 - no-ERC directives use the black Small Cross symbol
- signal harnesses become black
- harness connector borders become black and fills become
#D9D9D9 - harness entries use Courier New 10 bold in black
- harness type labels use black Courier New 10 bold
- sheet symbols use pure white fill and small borders
- sheet-symbol entries get black border, black fill, black Courier New 10 bold text, and Triangle shape
- underscores in net labels, page ports, power ports, and sheet entries are replaced with hyphens