On This Page (20)
- Which API Should I Use?
- 1. Altium's Four Layer-Identity Schemes
- A. Legacy PcbLayer (TV6_Layer, 1..75)
- B. Serialized V7 Saved Layer IDs (32-bit)
- C. Runtime TV7_Layer IDs in LayerKindMapping/Data
- D. FabView Layer Keys
- 2. How Altium Stores Layer Stacks (And How altium-monkey Unifies Them)
- Native Board6 Family Precedence
- Unified Model Pipeline
- 3. Canonical Read API: PcbLayerContext
- 4. AltiumLayerStackDocument: Inspection & Authoring
- Inspecting Rigid-Flex & Multi-Stack Boards
- Authoring New Board Stacks
- 5. .stackup And .stackupx Interchange
- .stackup (Pipe-Delimited V8 LSM Text)
- .stackupx (Altium Layer Stack Manager XML)
- 6. Board Stack Declaration Evidence
- 7. Authoring Matrix & Hard Gates
- 8. Common Gotchas
- Related Pages
PCB Layers & Layer Stacks
Altium Designer evolved across several file generations, so a single .PcbDoc can simultaneously carry legacy 1-byte layer numbers, 32-bit V7 saved layer IDs, runtime TV7_Layer mechanical-kind IDs, legacy LAYERnNEXT chains, V8 Layer Stack Manager rows, V9 Board6 stack/cache rows, and an embedded .stackupx XML payload.
This guide maps every layer and stack representation in altium-monkey, shows which API to use for reading vs. authoring, and documents the exact boundaries and gotchas.
Which API Should I Use?
| Task | Recommended API | Import module |
|---|---|---|
| Read layers, names, substacks, regions, faces, mounts, drill pairs, or Z envelopes from a board or library | pcbdoc.layers(), pcblib.layers(), footprint.layers() (PcbLayerContext) | altium_monkey.altium_pcb_layer_context |
Pass a layer to a PCB primitive helper (add_track, add_region, …) | PcbLayer (legacy) or PcbLayerRef (V7-aware) | altium_monkey |
| Inspect source-aware stack topology, rigid-flex branches, bend lines, or impedance profiles | AltiumLayerStackDocument.from_pcbdoc(pcbdoc) | altium_monkey |
| Author a new rigid or rigid-flex board stack | AltiumLayerStackDocument.from_rigid_layer_rows(...) (rigid) or multi-substack AltiumLayerStackDocument with board_regions (rigid-flex), plus builder.set_layer_stack_document(...) | altium_monkey |
Read or write .stackup / .stackupx interchange files | AltiumStackupDocument, AltiumStackupXDocument | altium_monkey |
| Audit raw Board6 stack declaration keys without inflating embedded XML | pcbdoc.board_stack_declaration_evidence() | altium_monkey.altium_layer_stack_document |
| Select layers for Gerber, IPC-2581, or PCB SVG output | FabView string layer keys ("TOP", "MID31", "MECHANICAL33", "PROFILE", "DRILLS") | board.fab().view().layers() |
Deprecated:
ResolvedLayerStack(altium_monkey.altium_resolved_layer_stack,resolved_layer_stack_from_pcbdoc,AltiumLayerStackDocument.to_resolved_layer_stack) is deprecated and emitsDeprecationWarning. Usepcbdoc.layers()(PcbLayerContext) instead.
1. Altium's Four Layer-Identity Schemes
Understanding which ID scheme a number belongs to prevents the most common PCB layer bugs.
A. Legacy PcbLayer (TV6_Layer, 1..75)
PcbLayer represents Altium's classic 1-byte layer enumeration:
| Range | PcbLayer values |
|---|---|
1 | TOP |
2..31 | MID1..MID30 |
32 | BOTTOM |
33..38 | TOP_OVERLAY, BOTTOM_OVERLAY, TOP_PASTE, BOTTOM_PASTE, TOP_SOLDER, BOTTOM_SOLDER |
39..54 | INTERNAL_PLANE_1..INTERNAL_PLANE_16 |
55..56 | DRILL_GUIDE, KEEPOUT |
57..72 | MECHANICAL_1..MECHANICAL_16 |
73..75 | DRILL_DRAWING, MULTI_LAYER, CONNECT |
Do not extrapolate PcbLayer linearly:
32isBOTTOM, not Mid31.73isDRILL_DRAWING, not Mechanical 17.- Native Altium files also use
0(NoLayer) and76..82(Background,DRC Error,Highlight,Grid Color 1,Grid Color 10,Pad Hole,Via Hole), which are intentionally omitted fromPcbLayer.
B. Serialized V7 Saved Layer IDs (32-bit)
Board6 stack/cache rows, configuration tables, and V7 primitive side fields (v7_layer_id, layer_v7_save_id, barcode_layer_v7) store 32-bit saved IDs (0x01000000 flag plus family and index):
| Family | Formula / Hex Range | Examples |
|---|---|---|
Signal (Top, Mid1..Mid126) | 0x01000000 + ordinal | 0x01000001 = Top, 0x0100001F = Mid30, 0x01000020 = Mid31 |
| Bottom sentinel | 0x0100FFFF (16842751) | Bottom copper |
Internal Plane (1..16) | 0x01010000 + n | 0x01010001 = Plane 1, 0x01010010 = Plane 16 |
Mechanical (1..65535) | 0x01020000 + n | 0x01020011 = Mech 17, 0x01020021 = Mech 33 |
Misc / System (TLayerPartition 6..26) | 0x01030000 + partition | 0x01030006 = Top Overlay, 0x0103000F = Multi-Layer, 0x01030000 = surface-finish stack row |
Stack Dielectric (1..n) | 0x01040000 + n | Physical dielectric stack rows only (never primitive layers) |
Reserved mechanical numbers in Altium include 32767 (route guide) and 64530 + 2*k / 64530 + 2*k + 1 (top and bottom coverlay outlines for substack index k).
Legacy placeholder clamping: When Altium writes a primitive on an extended V7 layer, the legacy 1-byte layer field is clamped to a placeholder (Mid31+ → 31, Plane17+ → 54, Mech17+ → 72, coverlay outlines → 0), while the exact layer is stored in the V7 side field. On read, nonzero v7_layer_id / layer_v7_save_id, positive barcode_layer_v7, or textual V7_LAYER takes precedence over the legacy byte.
Collision warning: Stripping the 0x01000000 prefix from Mid31 (0x01000020) yields 0x20 (32), which collides with PcbLayer.BOTTOM. Never pass raw 32-bit V7 saved IDs as layer=; construct a PcbLayerRef instead (PcbLayerRef.from_v7_saved_layer_id(0x01000020)).
C. Runtime TV7_Layer IDs in LayerKindMapping/Data
LayerKindMapping/Data (mechanical layer semantic kinds such as 3D Body, Assembly, Courtyard) uses Altium's runtime TV7_Layer encoding rather than serialized V7 saved IDs:
Mechanical 1..16 -> 57..72 (classic V6 byte)
Mechanical 17..32 -> 0x04000000 | mechanical_number (runtime TV7_Layer family 4)For example, Mechanical 17 is 0x04000011 in LayerKindMapping/Data but 0x01020011 as a serialized V7 saved layer ID. Python's mechanical-kind codec currently supports Mechanical 1..32.
D. FabView Layer Keys
board.fab().view() and Fab SVG (to_svg, to_layer_svgs) address layers by canonical uppercase string keys:
- Copper:
TOP,MID<n>,BOTTOM,PLANE<n>(negative plane film),PLANE<n>COPPER(derived positive copper) - Mask & paste:
TOPSOLDER,BOTTOMSOLDER,TOPPASTE,BOTTOMPASTE, plus numbered rigid-flex substack films (TOPSOLDER<n>,BOTTOMSOLDER<n>,TOPPASTE<n>,BOTTOMPASTE<n>) andTOPSOLDERCOVER/BOTTOMSOLDERCOVER - Silkscreen, mechanical, keepout:
TOPOVERLAY,BOTTOMOVERLAY,MECHANICAL<n>,KEEPOUT - Derived / fabrication:
DIELECTRIC<n>,TOPPADMASTER,BOTTOMPADMASTER,DRILLGUIDE<n>,DRILLDRAWING<n>,PROFILE,ROUT(plus"DRILLS"into_svg(layers=...))
2. How Altium Stores Layer Stacks (And How altium-monkey Unifies Them)
A single .PcbDoc may contain up to four overlapping stack encodings inside Board6/Data plus BoardRegions/Data, and Altium also exchanges standalone stacks as .stackup or .stackupx files:
- Legacy
LAYERnNEXTchain (Board6/Data): A singly linked list of conductive layers from Top (1) to Bottom (32) including Internal Planes (39..54), with predecessor-owned dielectric fields (LAYERnDIELTYPE,LAYERnDIELCONST,LAYERnDIELHEIGHT,LAYERnDIELMATERIAL). A cut chain keeps only the layers reached before the break; if a legacy-only chain is cyclic or yields no layers,AltiumBoard.from_record()falls back to the default board stackup (andAltiumLayerStackDocumentusesboard.layer_stackuponly when the chain walk is empty). - V8 Layer Stack Manager rows (
Board6/Dataand.stackup):LAYERMASTERSTACK_V8*,LAYERSUBSTACK_V8_{N}*,LAYER_V8_{N}*(with saved V7LAYERID,TYPEIDGUIDs,$LSM$*properties, and per-substack_{GUID}CONTEXT), plusVIASPAN_V8_*,DRILLPAIR_V8_*,DRILLSPAN_V8_*,IMPEDANCEPROFILE_V8_*,TRACEIMPEDANCE_V8_*, andBRANCH_V8_*. - V9 Board6 stack/cache rows (
Board6/Data):V9_MASTERSTACK_*,V9_SUBSTACK{N}_*,V9_STACK_LAYER{N}_*(per-substack_{GUID}CONTEXT:0= enabled, nonzero = disabled), and flat layer-registry rowsV9_CACHE_LAYER{N}_*(display names,MECHENABLED,MECHKIND, extended mechanical/signal entries). - Embedded
V9_STACKCUSTOMDATA(Board6/Data): Base64 + zlib compressed StackupX XML embedded inside V9 boards. When present, Board6 provides the base stack andV9_STACKCUSTOMDATAmerges richer metadata over it (custom properties, adhesive kind over native prepreg, surface-finish rows, impedance profiles withCustomName, feature flags, rigid-flex branches, and per-substack enablement).
Native Board6 Family Precedence
When reading a .PcbDoc, altium-monkey selects the native Board6 stack family by the first present non-blank master key — with no per-field fall-through between families:
V9_MASTERSTACK_ID ──► LAYERMASTERSTACK_V8ID ──► LAYER1NAME
(V9) (V8) (Legacy)V8 master electrical attributes (such as roughness model parameters, which have no V9 key) are read across all families.
Unified Model Pipeline
Board6/Data + BoardRegions/Data (+ V9_STACKCUSTOMDATA)
or .stackup (AltiumStackupDocument)
or .stackupx (AltiumStackupXDocument)
│
▼
AltiumLayerStackDocument (source-aware stack model, authoring, .stackup/.stackupx I/O)
│
└─► PcbLayerContext (pcbdoc.layers() / pcblib.layers() / footprint.layers():
canonical read API for layers, substacks, regions,
faces, mounts, drill pairs, via spans, and nm Z envelopes)3. Canonical Read API: PcbLayerContext
Call pcbdoc.layers() (or pcblib.layers() / footprint.layers()) for all normal layer and stack queries. The context is cached per document and invalidates automatically when high-level authoring helpers mutate the document (call pcbdoc.mark_modified() if you mutate raw record lists directly).
from altium_monkey import AltiumPcbDoc, PcbLayerRef
from altium_monkey.altium_pcb_layer_context import PcbLayerFace
board = AltiumPcbDoc.from_file("board.PcbDoc")
ctx = board.layers()
# Resolve any layer ref or token to a context layer entry
lookup = ctx.resolve(PcbLayerRef.top())
if lookup.found is not None:
layer = ctx.layer(lookup.found)
print(layer.ref.token, layer.name, layer.kind, layer.order)
# Physical Z envelope for the primary substack (integer nanometres, z=0 at top, downward negative)
if ctx.primary is not None:
env = ctx.envelope(ctx.primary)
for entry in env.rows:
print(f"{entry.row.name}: z=[{entry.z_top_nm}, {entry.z_bottom_nm}] nm (thick={entry.row.thickness_nm} nm)")
# Rigid-flex spatial lookup (board coordinates in mils)
region_id = ctx.region_at(1500.0, 800.0)
if region_id is not None:
substack_id = ctx.substack_of_region(region_id).found
if substack_id is not None:
top_surfaces = ctx.surface_layers(substack_id, PcbLayerFace.TOP)
print("Top copper:", top_surfaces.copper, "overlay:", top_surfaces.overlay)
# Component mounting
for comp in board.components[:5]:
mount = ctx.component_mount(comp)
if mount.found is not None:
print(comp.designator, mount.found.face, mount.found.substack)Key capabilities on PcbLayerContext:
- Layer lookup:
.layers,.layer(id),.resolve(ref),.by_token(token),.layer_metadata(ref),.multilayer,.coverlay_outline(layer_id). - Substacks & rigid-flex regions:
.substacks,.primary,.board_regions,.region_at(x_mils, y_mils),.substack_at(x_mils, y_mils),.enabled_in(layer_id, region_id),.face(layer_id, substack_id),.opposite(layer_id, substack_id),.surface_layers(substack_id, face),.cavity_side(layer_id, substack_id). - Physical stack & Z envelope:
.physical_rows,.envelope(substack_id)(nanometre thicknesses andz_top_nm/z_bottom_nmwithz = 0at the substack top surface going negative downward; helpersinternal_units_to_nmandnm_to_internal_units). - Drill pairs & via spans:
.drill_pairs,.hole_span(pair, substack_id),.drill_pairs_through(layer_id, substack_id),.via_span(start, end),.via_span_of(via).
Via-span nuance: Altium's Vias6 stream stores only legacy 1-byte start and end layers (not V7 saved IDs). When a via's start or end byte is a legacy placeholder (such as 31 for Mid31+), ctx.via_span(...) provisionally resolves it against ctx.drill_pairs (provisional=True); if multiple drill pairs clamp to the same placeholder byte (for example, Mid31..Bottom and Mid35..Bottom), the lookup returns PcbLayerLookupStatus.AMBIGUOUS.
4. AltiumLayerStackDocument: Inspection & Authoring
Use AltiumLayerStackDocument when you need source-aware stack inspection, .stackup / .stackupx conversion, or new-board stack synthesis.
Inspecting Rigid-Flex & Multi-Stack Boards
GUIDs across Board6/Data, BoardRegions/Data, and .stackupx vary in case and braces. AltiumLayerStackDocument join helpers normalize both automatically:
from altium_monkey import AltiumLayerStackDocument, AltiumPcbDoc
board = AltiumPcbDoc.from_file("rigid_flex.PcbDoc")
stack_doc = AltiumLayerStackDocument.from_pcbdoc(board)
for region in stack_doc.board_regions:
substack = stack_doc.substack_by_source_ref(region.layerstack_id)
layers = stack_doc.layers_for_board_region(region)
print(region.name, "->", substack.name if substack else None, len(layers), "layers")Note that read-only inspection types (AltiumPhysicalStack, AltiumStackLayer, AltiumStackSubstack, AltiumStackRegion, AltiumStackBendLine, AltiumStackBranch, AltiumImpedanceProfile, AltiumTransmissionLine) live in altium_monkey.altium_layer_stack_document rather than the root package.
Authoring New Board Stacks
For new boards (PcbDocBuilder), choose the constructor that matches your control level:
AltiumLayerStackDocument.two_layer_rigid()/.four_layer_rigid()/.canonical_empty()— standard presets.AltiumLayerStackDocument.from_rigid_stack(name=..., copper_layers=..., dielectrics_between=...)— 2..32 copper layers with explicitAltiumRigidCopperLayerSpec/AltiumRigidDielectricLayerSpecentries (len(dielectrics_between) == len(copper_layers) - 1).AltiumLayerStackDocument.from_rigid_layer_rows(name=..., rows=..., ...)— exact physical row order viaAltiumRigidStackRowSpecfactories (.overlay,.solder_mask,.copper,.prepreg,.core,.dielectric,.from_stack_layer), supporting 2..128 copper layers,AltiumStackupSettings,AltiumLayerPair, impedance profiles, and transmission lines.- Immutable drill/via span helpers:
.with_layer_pair(...),.with_via_span(...), and.with_backdrill_span(...). - Check write eligibility up front with
stack_doc.native_pcbdoc_write_support().
Hard gates enforced by PcbDocBuilder.set_layer_stack_document(...) for semantic writes:
- Exactly one
physical_stacksentry. - Between 2 and 128 copper layers.
- At least one
dielectricrow between every adjacent pair of copper layers. - Every present
board_regionsentry must have at least 3 outline vertices; if multiple substacks are present,board_regionsmust also be non-empty. - For
stackupx-origin documents, every non-emptystack_refandsource_record_idmust be a valid GUID string.
Arbitrary in-place stack rewriting of already-loaded .PcbDoc files is not yet part of the public writer contract; use set_layer_stack_document(...) when synthesizing new boards via PcbDocBuilder.
5. .stackup And .stackupx Interchange
.stackup (Pipe-Delimited V8 LSM Text)
AltiumStackupDocument parses and writes Altium's pipe-delimited .stackup format (STACKUPVERSION, FEATURE_*, LAYER_V8_*, VIASPAN_V8_*, IMPEDANCEPROFILE_V8_*, BRANCH_V8_*).
from altium_monkey import AltiumStackupDocument
text_doc = AltiumStackupDocument.from_file("vendor.stackup")
stack_doc = text_doc.to_layer_stack_document()
stack_doc.to_stackup().write("out.stackup")Export limitations: to_stackup() / AltiumStackupDocument.from_layer_stack_document(...) requires exactly one physical stack, rejects flex stacks (is_flex=True), requires copper layers, silently drops paste rows, and allows only {overlay, solder_mask, copper, dielectric, surface_finish, plating, misc, marking} row families.
.stackupx (Altium Layer Stack Manager XML)
AltiumStackupXDocument handles Altium's XML stackup format (http://altium.com/ns/LayerStackManager), including typed StackupXLayerType (27 well-known TypeId GUIDs), StackupXFeatureId (5 feature GUIDs: STANDARD_STACKUP, IMPEDANCE_CALCULATOR, RIGID_FLEX, RIGID_FLEX_ADVANCED, BACK_DRILLS), rigid-flex multi-stacks, impedance profiles, and branches.
from altium_monkey import AltiumStackupXDocument, PcbDocBuilder
xml_doc = AltiumStackupXDocument.from_file("rigid_stack.stackupx")
stack_doc = xml_doc.to_layer_stack_document()
# Author a new PcbDoc directly from a single-stack rigid .stackupx (including Mid31..Mid126)
builder = PcbDocBuilder()
builder.set_layer_stack_document(stack_doc)
builder.save("from_stackupx.PcbDoc")Important .stackupx rules:
- GUID gate on write/convert:
to_layer_stack_document()andAltiumLayerStackDocument.from_stackupx(...)raiseValueErrorif anydocument.id,revision_id,stack.id,layer.id,via_span.id, ordrill_span.idis not a valid UUID/GUID string (Altium's Layer Stack Manager crashes on non-GUID IDs).AltiumStackupXDocumentand the authored stack, layer, span, profile, and branchStackupX*dataclasses defaultid(andrevision_id) touuid.uuid4()as keyword-only fields — omit them unless you are preserving real GUIDs (StackupXFeatureis the exception and requires aStackupXFeatureId). - Embedded
V9_STACKCUSTOMDATAbytes: Always useAltiumStackupXDocument.from_embedded_bytes(data)rather thanfrom_bytes, because Altium embeds ANSI/Windows-1252 XML with a leading?<prefix or a UTF-8 BOM. - Round-trip omissions: Standalone
.stackupxdoes not carryBoardRegions/Dataoutlines or bend lines;to_stackupx()dropspasterows and cavity service substacks (service_stackup=True).
6. Board Stack Declaration Evidence
pcbdoc.board_stack_declaration_evidence() is a lightweight, read-only audit of the raw Board6/Data scalar keys for six stack-feature families (embedded_stackup, substack_context, branch, split_line, bend_line, feature). It never inflates V9_STACKCUSTOMDATA, never re-serializes the board, and never inspects BoardRegions:
evidence = board.board_stack_declaration_evidence()
if evidence.status == "current":
for decl in evidence.declarations:
print(decl.family, decl.source_key, decl.state)
else:
print("Unresolved:", evidence.unresolved_reason)Treat negative states ("absent" / "empty") as authoritative only when evidence.status == "current". Authored builders, modified board.raw_record maps, non-standard Board6 framing, or projected fallback boards report status == "unresolved" with a specific unresolved_reason (authored_source, unretained_source, board_text_unaccounted, projected_board, or changed_board).
7. Authoring Matrix & Hard Gates
| Helper / Target | Legacy / Planes (Plane1..16) | V7 Mech (17+) | V7 Signal (Mid31+) |
|---|---|---|---|
PcbDoc / PcbDocBuilder: add_track, add_arc, add_fill, add_text, add_region | Supported | Mech17..53 auto-register (legacy byte 72); Mech54+ rejected¹ | Supported with matching enabled stack evidence² (legacy byte 31) |
PcbDoc / PcbDocBuilder: add_component_body³ | Supported | Mech17..53 supported; Mech54+ rejected | Rejected |
AltiumPcbFootprint: add_track, add_arc, add_fill, add_text, add_region, add_component_body | Supported | Mech17..53 supported; Mech54+ rejected¹ | Rejected (no board stack context) |
add_pad (PcbDoc & PcbLib) | Supported | Rejected | Rejected |
add_via (PcbDoc & PcbLib: layer_start, layer_end) | Signal + Planes (1..32, 39..54) | Rejected | Rejected |
set_mechanical_layer / set_mechanical_layer_pair | Mechanical 1..16 | Mech17..53 supported; Mech54+ rejected | N/A |
get_mechanical_layer_kind / set_mechanical_layer_kind | Mechanical 1..16 | Mech17..32 supported; Mech33+ rejected | N/A |
¹ Exception: add_region on both PcbDoc / PcbDocBuilder and AltiumPcbFootprint allows coverlay-outline replay with layer=0 and MECHANICAL64530..65535. ² Stack evidence comes either from a loaded .PcbDoc's enabled stack layers or from PcbDocBuilder.set_layer_stack_document(...). ³ PcbDocBuilder.add_component_body(body) accepts a prebuilt AltiumPcbComponentBody record rather than a layer= keyword; the layer gate applies to body.layer / body.v7_layer_id.
8. Common Gotchas
PcbLayerRef == PcbLayeris alwaysFalse:PcbLayerRef.top() == PcbLayer.TOPevaluates toFalse. Useref.matches(PcbLayer.TOP)or normalize both sides withcoerce_pcb_layer_ref(...).AltiumDielectricLayerKind.CORE(0) vs. readbackdielectric_type(1): The authoring enum definesCORE = 0,PREPREG = 2,COVERLAY = 4, whereas parsedAltiumStackLayer.dielectric_typeandPcbDielectricTypeexpose Altium's nativeTDielectricType(0 = NO_DIELECTRIC,1 = CORE,2 = PREPREG,3 = SURFACE_MATERIAL,4 = FILM). Never comparelayer.dielectric_type == AltiumDielectricLayerKind.CORE.- Different
layerconventions onset_mechanical_layer*vs.add_*: Primitive helpers acceptPcbLayerRefand treat any bareintas a legacyTV6_LayerID (1= Top,13= Mid12,57= Mech 1). By contrast,set_mechanical_layer,set_mechanical_layer_pair,get_mechanical_layer_kind, andset_mechanical_layer_kinddo not acceptPcbLayerRefobjects (passref.token, e.g."MECHANICAL13") and treat bareint1..53(1..32for kinds) as a mechanical layer number while57..72remain legacy TV6 IDs (54..56raiseValueErroronset_mechanical_layer*, and33..56raiseValueErroronget/set_mechanical_layer_kind). - Transient dense IDs on
PcbLayerContext:layer.id,substack.id, andregion.idare per-context dense integers that reset when the context rebuilds. PersistPcbLayerReftokens and substacksource_refGUIDs instead. - Units and Z origin differ by API:
PcbLayerContext.envelope()uses integer nanometres withz = 0at the substack top surface going negative downward (whileregion_at(x_mils, y_mils)is in mils);AltiumLayerStackDocumentuses mils (orthickness_mm=on row factories); deprecatedResolvedStackEnvelopeused mils withz = 0at the midplane. - Never infer layer side or family from English names: A board can rename an inner copper layer to
"Bottom Layer"or Top Solder to"F.Mask". Always inspectlayer.kind,layer.ref.family, orctx.face(layer_id, substack_id). - Direct record mutations require
pcbdoc.mark_modified(): Editingpcbdoc.tracksorpcbdoc.boardin place does not automatically invalidate the cachedpcbdoc.layers()context; callpcbdoc.mark_modified()afterward.
Related Pages
- PcbDoc Guide — board authoring, mechanical layer kinds, and vias
- PcbLib Guide — footprint layer authoring and mechanical layer kinds
- Fab & FabView — FabView layer keys, Gerber X2/X1, IPC-2581B, and PCB SVG
- SVG Format Contract —
data-key,data-layer,data-role,data-side, anddata-polarityattributes on emitted SVG layers - Examples:
pcbdoc_inspect_layer_heights,pcbdoc_create_jlcpcb_rigid_stack,pcbdoc_create_from_stackup_files,pcbdoc_flex_topology_report