Read a PcbLib
read_pcblibRead Altium .PcbLib files and output every footprint's primitives as structured JSON in millimetres, for studying library styles or feeding a read-modify-write workflow.
Instructions
Read an Altium .PcbLib file: every footprint with its description, height and primitives (pads, vias, tracks, arcs, regions, fills, text, component_bodies) as structured JSON, all coordinates and dimensions in millimetres. Use it to study a library's footprint style or to fetch data for a read-modify-write. For one footprint whose name you know, get_component is cheaper; to find footprints by name pattern across libraries, search_components; for names alone, list_components. Each footprint is the same JSON shape get_component, export_library and write_pcblib use, so a footprint read here can be passed to write_pcblib or update_component as it is. Fields such as guid, unique_id, raw_tail, raw_block, raw_geometry, raw_layer_id, additional_parameters, param_key_order, primitive_order and storage_name are fidelity carriers: pass them back unchanged and the rewrite is byte-identical to the source; omit them when authoring from scratch. A list with no entries and an optional field with no value are omitted rather than empty or null. compact (default true) omits a pad's per-layer size and shape arrays when its stack_mode is Simple, since they only repeat the top-level values; set it false to see every layer. For a large library, page with limit and offset: the result reports total_count, returned_count, offset and has_more. component_name fetches one footprint and turns paging off.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Optional: maximum number of footprints to return, 1 or more (default: all) | |
| offset | No | Optional: skip the first N footprints, 0 or more (default: 0) | |
| compact | No | If true (default), omit per-layer pad data when stack_mode is Simple. Set to false for full output. | |
| filepath | Yes | Path to the .PcbLib file | |
| component_name | No | Optional: fetch only this footprint, by name in any case; a name the library does not hold is an error naming the available footprints |