kicad-python 0.6.0__tar.gz → 0.7.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {kicad_python-0.6.0 → kicad_python-0.7.0}/PKG-INFO +14 -2
- {kicad_python-0.6.0 → kicad_python-0.7.0}/README.md +11 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/board.py +150 -5
- kicad_python-0.7.0/build/lib/kipy/board_jobs.py +1557 -0
- kicad_python-0.7.0/build/lib/kipy/board_rules.py +1096 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/board_types.py +259 -12
- {kicad_python-0.6.0 → kicad_python-0.7.0/build/lib}/kipy/common_types.py +12 -14
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/geometry.py +69 -5
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/kicad_api_version.py +1 -1
- kicad_python-0.7.0/build/lib/kipy/packaging/__init__.py +28 -0
- kicad_python-0.7.0/build/lib/kipy/packaging/__main__.py +24 -0
- kicad_python-0.7.0/build/lib/kipy/packaging/cli.py +64 -0
- kicad_python-0.7.0/build/lib/kipy/packaging/types.py +81 -0
- kicad_python-0.7.0/build/lib/kipy/packaging/validate.py +387 -0
- kicad_python-0.7.0/build/lib/kipy/proto/board/board_commands_pb2.py +111 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0/build/lib}/kipy/proto/board/board_commands_pb2.pyi +129 -7
- kicad_python-0.7.0/build/lib/kipy/proto/board/board_jobs_pb2.py +86 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0/build/lib}/kipy/proto/board/board_jobs_pb2.pyi +197 -12
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/proto/board/board_pb2.py +1 -1
- kicad_python-0.7.0/build/lib/kipy/proto/board/board_types_pb2.py +176 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/proto/board/board_types_pb2.pyi +409 -24
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/proto/common/commands/base_commands_pb2.py +1 -1
- kicad_python-0.7.0/build/lib/kipy/proto/common/commands/editor_commands_pb2.py +113 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/proto/common/commands/editor_commands_pb2.pyi +48 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0/build/lib}/kipy/proto/common/commands/project_commands_pb2.py +1 -1
- {kicad_python-0.6.0 → kicad_python-0.7.0/build/lib}/kipy/proto/common/envelope_pb2.py +1 -1
- kicad_python-0.7.0/build/lib/kipy/proto/common/types/base_types_pb2.py +106 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/proto/common/types/base_types_pb2.pyi +22 -3
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/proto/common/types/enums_pb2.py +9 -9
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/proto/common/types/enums_pb2.pyi +4 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/proto/common/types/jobs_pb2.py +1 -1
- kicad_python-0.7.0/build/lib/kipy/proto/common/types/project_settings_pb2.py +31 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/proto/common/types/project_settings_pb2.pyi +10 -3
- {kicad_python-0.6.0 → kicad_python-0.7.0/build/lib}/kipy/proto/common/types/wizards_pb2.py +1 -1
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/proto/schematic/schematic_commands_pb2.py +1 -1
- kicad_python-0.7.0/build/lib/kipy/proto/schematic/schematic_jobs_pb2.py +41 -0
- kicad_python-0.7.0/build/lib/kipy/proto/schematic/schematic_jobs_pb2.pyi +393 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/proto/schematic/schematic_types_pb2.py +1 -1
- kicad_python-0.7.0/build/lib/kipy/schematic.py +326 -0
- kicad_python-0.7.0/build/lib/kipy/schematic_types.py +1759 -0
- kicad_python-0.7.0/build/lib/kipy/server.py +303 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0/build/lib}/kipy/util/proto.py +1 -0
- kicad_python-0.7.0/build/lib/kipy/wizards.py +798 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/board.py +150 -5
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/board_types.py +259 -12
- {kicad_python-0.6.0/build/lib → kicad_python-0.7.0}/kipy/common_types.py +12 -14
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/geometry.py +69 -5
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/kicad_api_version.py +1 -1
- kicad_python-0.7.0/kipy/packaging/__init__.py +28 -0
- kicad_python-0.7.0/kipy/packaging/__main__.py +24 -0
- kicad_python-0.7.0/kipy/packaging/cli.py +64 -0
- kicad_python-0.7.0/kipy/packaging/schemas/__init__.py +0 -0
- kicad_python-0.7.0/kipy/packaging/schemas/api.v1.schema.json +125 -0
- kicad_python-0.7.0/kipy/packaging/schemas/pcm.v1.schema.json +397 -0
- kicad_python-0.7.0/kipy/packaging/schemas/pcm.v2.schema.json +304 -0
- kicad_python-0.7.0/kipy/packaging/types.py +81 -0
- kicad_python-0.7.0/kipy/packaging/validate.py +387 -0
- kicad_python-0.7.0/kipy/proto/board/board_commands_pb2.py +111 -0
- {kicad_python-0.6.0/build/lib → kicad_python-0.7.0}/kipy/proto/board/board_commands_pb2.pyi +129 -7
- kicad_python-0.7.0/kipy/proto/board/board_jobs_pb2.py +86 -0
- {kicad_python-0.6.0/build/lib → kicad_python-0.7.0}/kipy/proto/board/board_jobs_pb2.pyi +197 -12
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/proto/board/board_pb2.py +1 -1
- kicad_python-0.7.0/kipy/proto/board/board_types_pb2.py +176 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/proto/board/board_types_pb2.pyi +409 -24
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/proto/common/commands/base_commands_pb2.py +1 -1
- kicad_python-0.7.0/kipy/proto/common/commands/editor_commands_pb2.py +113 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/proto/common/commands/editor_commands_pb2.pyi +48 -0
- {kicad_python-0.6.0/build/lib → kicad_python-0.7.0}/kipy/proto/common/commands/project_commands_pb2.py +1 -1
- {kicad_python-0.6.0/build/lib → kicad_python-0.7.0}/kipy/proto/common/envelope_pb2.py +1 -1
- kicad_python-0.7.0/kipy/proto/common/types/base_types_pb2.py +106 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/proto/common/types/base_types_pb2.pyi +22 -3
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/proto/common/types/enums_pb2.py +9 -9
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/proto/common/types/enums_pb2.pyi +4 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/proto/common/types/jobs_pb2.py +1 -1
- kicad_python-0.7.0/kipy/proto/common/types/project_settings_pb2.py +31 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/proto/common/types/project_settings_pb2.pyi +10 -3
- {kicad_python-0.6.0/build/lib → kicad_python-0.7.0}/kipy/proto/common/types/wizards_pb2.py +1 -1
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/proto/schematic/schematic_commands_pb2.py +1 -1
- kicad_python-0.7.0/kipy/proto/schematic/schematic_jobs_pb2.py +41 -0
- kicad_python-0.7.0/kipy/proto/schematic/schematic_jobs_pb2.pyi +393 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/proto/schematic/schematic_types_pb2.py +1 -1
- kicad_python-0.7.0/kipy/py.typed +0 -0
- {kicad_python-0.6.0/build/lib → kicad_python-0.7.0}/kipy/util/proto.py +1 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/pyproject.toml +11 -3
- {kicad_python-0.6.0 → kicad_python-0.7.0}/setup.py +9 -3
- kicad_python-0.6.0/build/lib/kipy/proto/board/board_commands_pb2.py +0 -103
- kicad_python-0.6.0/build/lib/kipy/proto/board/board_jobs_pb2.py +0 -74
- kicad_python-0.6.0/build/lib/kipy/proto/board/board_types_pb2.py +0 -152
- kicad_python-0.6.0/build/lib/kipy/proto/common/commands/editor_commands_pb2.py +0 -109
- kicad_python-0.6.0/build/lib/kipy/proto/common/types/base_types_pb2.py +0 -104
- kicad_python-0.6.0/build/lib/kipy/proto/common/types/project_settings_pb2.py +0 -31
- kicad_python-0.6.0/build/lib/kipy/proto/schematic/schematic_jobs_pb2.py +0 -27
- kicad_python-0.6.0/build/lib/kipy/proto/schematic/schematic_jobs_pb2.pyi +0 -73
- kicad_python-0.6.0/build/lib/kipy/wizards.py +0 -700
- kicad_python-0.6.0/kipy/proto/board/board_commands_pb2.py +0 -103
- kicad_python-0.6.0/kipy/proto/board/board_jobs_pb2.py +0 -74
- kicad_python-0.6.0/kipy/proto/board/board_types_pb2.py +0 -152
- kicad_python-0.6.0/kipy/proto/common/commands/editor_commands_pb2.py +0 -109
- kicad_python-0.6.0/kipy/proto/common/types/base_types_pb2.py +0 -104
- kicad_python-0.6.0/kipy/proto/common/types/project_settings_pb2.py +0 -31
- kicad_python-0.6.0/kipy/proto/schematic/schematic_jobs_pb2.py +0 -27
- kicad_python-0.6.0/kipy/proto/schematic/schematic_jobs_pb2.pyi +0 -73
- {kicad_python-0.6.0 → kicad_python-0.7.0}/LICENSE +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/__init__.py +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/client.py +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/errors.py +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/kicad.py +0 -0
- /kicad_python-0.6.0/kipy/py.typed → /kicad_python-0.7.0/build/lib/kipy/packaging/schemas/__init__.py +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/project.py +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/project_types.py +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/proto/__init__.py +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/proto/board/__init__.py +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/proto/board/board_pb2.pyi +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/proto/common/__init__.py +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/proto/common/commands/__init__.py +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/proto/common/commands/base_commands_pb2.pyi +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/proto/common/commands/project_commands_pb2.pyi +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/proto/common/envelope_pb2.pyi +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/proto/common/types/__init__.py +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/proto/common/types/generators_pb2.py +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/proto/common/types/generators_pb2.pyi +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/proto/common/types/jobs_pb2.pyi +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/proto/common/types/wizards_pb2.pyi +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/proto/schematic/schematic_commands_pb2.pyi +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/proto/schematic/schematic_types_pb2.pyi +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/util/__init__.py +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/util/board_layer.py +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/util/units.py +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build/lib/kipy/wrapper.py +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/build.py +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/__init__.py +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/client.py +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/errors.py +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/kicad.py +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/project.py +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/project_types.py +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/proto/__init__.py +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/proto/board/__init__.py +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/proto/board/board_pb2.pyi +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/proto/common/__init__.py +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/proto/common/commands/__init__.py +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/proto/common/commands/base_commands_pb2.pyi +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/proto/common/commands/project_commands_pb2.pyi +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/proto/common/envelope_pb2.pyi +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/proto/common/types/__init__.py +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/proto/common/types/generators_pb2.py +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/proto/common/types/generators_pb2.pyi +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/proto/common/types/jobs_pb2.pyi +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/proto/common/types/wizards_pb2.pyi +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/proto/schematic/schematic_commands_pb2.pyi +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/proto/schematic/schematic_types_pb2.pyi +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/util/__init__.py +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/util/board_layer.py +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/util/units.py +0 -0
- {kicad_python-0.6.0 → kicad_python-0.7.0}/kipy/wrapper.py +0 -0
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: kicad-python
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
4
4
|
Summary: KiCad API Python Bindings
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
License-File: LICENSE
|
|
7
7
|
Author: The KiCad Development Team
|
|
8
8
|
Requires-Python: >=3.9
|
|
9
|
-
Classifier: Development Status ::
|
|
9
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
10
10
|
Classifier: Intended Audience :: Developers
|
|
11
11
|
Classifier: Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)
|
|
12
12
|
Classifier: Typing :: Typed
|
|
13
|
+
Requires-Dist: jsonschema (>=4.23.0,<5)
|
|
13
14
|
Requires-Dist: protobuf (>=5.29,<6)
|
|
14
15
|
Requires-Dist: pynng (>=0.9.0,<0.10.0)
|
|
15
16
|
Requires-Dist: typing_extensions (>=4.13.2) ; python_version < "3.13"
|
|
@@ -98,6 +99,17 @@ plugins, copy or symlink them into the appropriate plugins path in order for KiC
|
|
|
98
99
|
|
|
99
100
|
## Release History
|
|
100
101
|
|
|
102
|
+
### 0.7.0 (April 17, 2026)
|
|
103
|
+
|
|
104
|
+
- Add `Board.get_items_by_id` and groups support via `Board.get_groups` (requires KiCad 10) (Anthonypark, !15)
|
|
105
|
+
- Add support for barcodes and `Board.get_barcodes` (requires KiCad 10.0.1)
|
|
106
|
+
- Add support for reference images and `Board.get_reference_images` (requires KiCad 10.0.1)
|
|
107
|
+
- Add `Board.set_title_block_info` (requires KiCad 10.0.1)
|
|
108
|
+
- Add `Board.get_connected_items`, `Board.get_items_by_net`, and `Board.get_items_by_netclass` (requires KiCad 10.0.1)
|
|
109
|
+
- Fix several bounding box calculation bugs
|
|
110
|
+
- Support building with older versions of protoc
|
|
111
|
+
- Fix `KiCad.run_action` (leommxj)
|
|
112
|
+
|
|
101
113
|
### 0.6.0 (March 15, 2026)
|
|
102
114
|
|
|
103
115
|
- Fix missing conversion of rectangles into polygons when rotating by non-cardinal amounts (#86)
|
|
@@ -77,6 +77,17 @@ plugins, copy or symlink them into the appropriate plugins path in order for KiC
|
|
|
77
77
|
|
|
78
78
|
## Release History
|
|
79
79
|
|
|
80
|
+
### 0.7.0 (April 17, 2026)
|
|
81
|
+
|
|
82
|
+
- Add `Board.get_items_by_id` and groups support via `Board.get_groups` (requires KiCad 10) (Anthonypark, !15)
|
|
83
|
+
- Add support for barcodes and `Board.get_barcodes` (requires KiCad 10.0.1)
|
|
84
|
+
- Add support for reference images and `Board.get_reference_images` (requires KiCad 10.0.1)
|
|
85
|
+
- Add `Board.set_title_block_info` (requires KiCad 10.0.1)
|
|
86
|
+
- Add `Board.get_connected_items`, `Board.get_items_by_net`, and `Board.get_items_by_netclass` (requires KiCad 10.0.1)
|
|
87
|
+
- Fix several bounding box calculation bugs
|
|
88
|
+
- Support building with older versions of protoc
|
|
89
|
+
- Fix `KiCad.run_action` (leommxj)
|
|
90
|
+
|
|
80
91
|
### 0.6.0 (March 15, 2026)
|
|
81
92
|
|
|
82
93
|
- Fix missing conversion of rectangles into polygons when rotating by non-cardinal amounts (#86)
|
|
@@ -24,8 +24,10 @@ from google.protobuf.empty_pb2 import Empty
|
|
|
24
24
|
|
|
25
25
|
from kipy.board_types import (
|
|
26
26
|
ArcTrack,
|
|
27
|
+
Barcode,
|
|
27
28
|
BoardEditorAppearanceSettings,
|
|
28
29
|
BoardItem,
|
|
30
|
+
ReferenceImage,
|
|
29
31
|
BoardText,
|
|
30
32
|
BoardTextBox,
|
|
31
33
|
Dimension,
|
|
@@ -36,6 +38,7 @@ from kipy.board_types import (
|
|
|
36
38
|
Track,
|
|
37
39
|
Via,
|
|
38
40
|
Zone,
|
|
41
|
+
Group,
|
|
39
42
|
to_concrete_board_shape,
|
|
40
43
|
to_concrete_dimension,
|
|
41
44
|
unwrap
|
|
@@ -57,7 +60,7 @@ from kipy.proto.common.commands.editor_commands_pb2 import (
|
|
|
57
60
|
EndCommit, EndCommitResponse,
|
|
58
61
|
CreateItems, CreateItemsResponse,
|
|
59
62
|
UpdateItems, UpdateItemsResponse,
|
|
60
|
-
GetItems, GetItemsResponse,
|
|
63
|
+
GetItems, GetItemsById, GetItemsResponse,
|
|
61
64
|
DeleteItems, DeleteItemsResponse,
|
|
62
65
|
HitTest, HitTestResponse, HitTestResult
|
|
63
66
|
)
|
|
@@ -350,8 +353,10 @@ class Board:
|
|
|
350
353
|
]
|
|
351
354
|
|
|
352
355
|
def _to_concrete_items(self, items: Sequence[Wrapper]) -> List[BoardItem]:
|
|
353
|
-
items_converted = []
|
|
356
|
+
items_converted: List[BoardItem] = []
|
|
354
357
|
for it in items:
|
|
358
|
+
assert isinstance(it, BoardItem)
|
|
359
|
+
|
|
355
360
|
if isinstance(it, BoardShape):
|
|
356
361
|
items_converted.append(to_concrete_board_shape(cast(BoardShape, it)))
|
|
357
362
|
elif isinstance(it, Dimension):
|
|
@@ -362,7 +367,7 @@ class Board:
|
|
|
362
367
|
|
|
363
368
|
def get_items(
|
|
364
369
|
self, types: Union[KiCadObjectType.ValueType, Sequence[KiCadObjectType.ValueType]]
|
|
365
|
-
) -> Sequence[
|
|
370
|
+
) -> Sequence[Item]:
|
|
366
371
|
"""Retrieves items from the board, optionally filtering to a single or set of types"""
|
|
367
372
|
command = GetItems()
|
|
368
373
|
command.header.document.CopyFrom(self._doc)
|
|
@@ -376,6 +381,105 @@ class Board:
|
|
|
376
381
|
[unwrap(item) for item in self._kicad.send(command, GetItemsResponse).items]
|
|
377
382
|
)
|
|
378
383
|
|
|
384
|
+
def get_items_by_id(
|
|
385
|
+
self, ids: Union[KIID, Sequence[KIID]]
|
|
386
|
+
) -> Sequence[Item]:
|
|
387
|
+
"""Retrieves items from the board by their KIID (internal unique identifier)
|
|
388
|
+
|
|
389
|
+
.. versionadded:: 0.7.0 (KiCad 10.0.0)
|
|
390
|
+
"""
|
|
391
|
+
command = GetItemsById()
|
|
392
|
+
command.header.document.CopyFrom(self._doc)
|
|
393
|
+
if isinstance(ids, KIID):
|
|
394
|
+
command.items.append(ids)
|
|
395
|
+
else:
|
|
396
|
+
command.items.extend(ids)
|
|
397
|
+
|
|
398
|
+
return self._to_concrete_items(
|
|
399
|
+
[unwrap(item) for item in self._kicad.send(command, GetItemsResponse).items]
|
|
400
|
+
)
|
|
401
|
+
|
|
402
|
+
def get_items_by_net(
|
|
403
|
+
self,
|
|
404
|
+
nets: Union[Net, Sequence[Net]],
|
|
405
|
+
types: Optional[
|
|
406
|
+
Union[KiCadObjectType.ValueType, Sequence[KiCadObjectType.ValueType]]
|
|
407
|
+
] = None,
|
|
408
|
+
) -> Sequence[Item]:
|
|
409
|
+
"""Retrieves items from the board, filtered by one or more nets
|
|
410
|
+
|
|
411
|
+
.. versionadded:: 0.7.0 (KiCad 10.0.1)"""
|
|
412
|
+
command = board_commands_pb2.GetItemsByNet()
|
|
413
|
+
command.header.document.CopyFrom(self._doc)
|
|
414
|
+
|
|
415
|
+
if isinstance(types, int):
|
|
416
|
+
command.types.append(types)
|
|
417
|
+
elif types is not None:
|
|
418
|
+
command.types.extend(types)
|
|
419
|
+
|
|
420
|
+
if isinstance(nets, Net):
|
|
421
|
+
command.nets.append(nets.proto)
|
|
422
|
+
else:
|
|
423
|
+
command.nets.extend([net.proto for net in nets])
|
|
424
|
+
|
|
425
|
+
return self._to_concrete_items(
|
|
426
|
+
[unwrap(item) for item in self._kicad.send(command, GetItemsResponse).items]
|
|
427
|
+
)
|
|
428
|
+
|
|
429
|
+
def get_items_by_netclass(
|
|
430
|
+
self,
|
|
431
|
+
net_classes: Union[str, Sequence[str]],
|
|
432
|
+
types: Optional[
|
|
433
|
+
Union[KiCadObjectType.ValueType, Sequence[KiCadObjectType.ValueType]]
|
|
434
|
+
] = None,
|
|
435
|
+
) -> Sequence[Item]:
|
|
436
|
+
"""Retrieves items from the board, filtered by one or more net class names
|
|
437
|
+
|
|
438
|
+
.. versionadded:: 0.7.0 (KiCad 10.0.1)"""
|
|
439
|
+
command = board_commands_pb2.GetItemsByNetClass()
|
|
440
|
+
command.header.document.CopyFrom(self._doc)
|
|
441
|
+
|
|
442
|
+
if isinstance(types, int):
|
|
443
|
+
command.types.append(types)
|
|
444
|
+
elif types is not None:
|
|
445
|
+
command.types.extend(types)
|
|
446
|
+
|
|
447
|
+
if isinstance(net_classes, str):
|
|
448
|
+
command.net_classes.append(net_classes)
|
|
449
|
+
else:
|
|
450
|
+
command.net_classes.extend(net_classes)
|
|
451
|
+
|
|
452
|
+
return self._to_concrete_items(
|
|
453
|
+
[unwrap(item) for item in self._kicad.send(command, GetItemsResponse).items]
|
|
454
|
+
)
|
|
455
|
+
|
|
456
|
+
def get_connected_items(
|
|
457
|
+
self,
|
|
458
|
+
items: Union[BoardItem, KIID, Sequence[Union[BoardItem, KIID]]],
|
|
459
|
+
types: Optional[
|
|
460
|
+
Union[KiCadObjectType.ValueType, Sequence[KiCadObjectType.ValueType]]
|
|
461
|
+
] = None,
|
|
462
|
+
) -> Sequence[Item]:
|
|
463
|
+
"""Retrieves items that are copper-connected to the given source item(s) or item IDs
|
|
464
|
+
|
|
465
|
+
.. versionadded:: 0.7.0 (KiCad 10.0.1)"""
|
|
466
|
+
command = board_commands_pb2.GetConnectedItems()
|
|
467
|
+
command.header.document.CopyFrom(self._doc)
|
|
468
|
+
|
|
469
|
+
if isinstance(types, int):
|
|
470
|
+
command.types.append(types)
|
|
471
|
+
elif types is not None:
|
|
472
|
+
command.types.extend(types)
|
|
473
|
+
|
|
474
|
+
source_items = [items] if isinstance(items, (BoardItem, KIID)) else items
|
|
475
|
+
|
|
476
|
+
for source in source_items:
|
|
477
|
+
command.items.append(source.id if isinstance(source, BoardItem) else source)
|
|
478
|
+
|
|
479
|
+
return self._to_concrete_items(
|
|
480
|
+
[unwrap(item) for item in self._kicad.send(command, GetItemsResponse).items]
|
|
481
|
+
)
|
|
482
|
+
|
|
379
483
|
def get_tracks(self) -> Sequence[Union[Track, ArcTrack]]:
|
|
380
484
|
"""Retrieves all tracks and arc tracks on the board"""
|
|
381
485
|
return [
|
|
@@ -432,10 +536,42 @@ class Board:
|
|
|
432
536
|
)
|
|
433
537
|
]
|
|
434
538
|
|
|
539
|
+
def get_barcodes(self) -> Sequence[Barcode]:
|
|
540
|
+
"""Retrieves all barcode objects on the board
|
|
541
|
+
|
|
542
|
+
.. versionadded:: 0.7.0"""
|
|
543
|
+
return [
|
|
544
|
+
cast(Barcode, item)
|
|
545
|
+
for item in self.get_items(types=[KiCadObjectType.KOT_PCB_BARCODE])
|
|
546
|
+
]
|
|
547
|
+
|
|
548
|
+
def get_reference_images(self) -> Sequence[ReferenceImage]:
|
|
549
|
+
"""Retrieves all reference image objects on the board
|
|
550
|
+
|
|
551
|
+
.. versionadded:: 0.7.0"""
|
|
552
|
+
return [
|
|
553
|
+
cast(ReferenceImage, item)
|
|
554
|
+
for item in self.get_items(types=[KiCadObjectType.KOT_PCB_REFERENCE_IMAGE])
|
|
555
|
+
]
|
|
556
|
+
|
|
435
557
|
def get_zones(self) -> Sequence[Zone]:
|
|
436
558
|
"""Retrieves all zones (including rule areas and graphic zones) on the board"""
|
|
437
559
|
return [cast(Zone, item) for item in self.get_items(types=[KiCadObjectType.KOT_PCB_ZONE])]
|
|
438
560
|
|
|
561
|
+
def get_groups(self) -> Sequence[Group]:
|
|
562
|
+
"""Retrieves all groups on the board
|
|
563
|
+
|
|
564
|
+
.. versionadded:: 0.7.0 (KiCad 10.0.0)"""
|
|
565
|
+
groups = [cast(Group, item) for item in self.get_items(types=[KiCadObjectType.KOT_PCB_GROUP])]
|
|
566
|
+
|
|
567
|
+
# Unwrap items in groups
|
|
568
|
+
if len(groups) > 0:
|
|
569
|
+
for group in groups:
|
|
570
|
+
items = self.get_items_by_id(group._item_ids)
|
|
571
|
+
group._unwrapped_items = items
|
|
572
|
+
|
|
573
|
+
return groups
|
|
574
|
+
|
|
439
575
|
def get_as_string(self) -> str:
|
|
440
576
|
"""Returns the board as a string in KiCad's board file format"""
|
|
441
577
|
command = editor_commands_pb2.SaveDocumentToString()
|
|
@@ -682,6 +818,15 @@ class Board:
|
|
|
682
818
|
cmd.document.CopyFrom(self._doc)
|
|
683
819
|
return TitleBlockInfo(self._kicad.send(cmd, base_types_pb2.TitleBlockInfo))
|
|
684
820
|
|
|
821
|
+
def set_title_block_info(self, title_block: TitleBlockInfo):
|
|
822
|
+
"""Sets the title block information for the board
|
|
823
|
+
|
|
824
|
+
.. versionadded:: 0.7.0 (with KiCad 10.0.1)"""
|
|
825
|
+
cmd = editor_commands_pb2.SetTitleBlockInfo()
|
|
826
|
+
cmd.document.CopyFrom(self._doc)
|
|
827
|
+
cmd.title_block.CopyFrom(title_block.proto)
|
|
828
|
+
self._kicad.send(cmd, Empty)
|
|
829
|
+
|
|
685
830
|
def get_origin(self, origin_type: board_commands_pb2.BoardOriginType.ValueType) -> Vector2:
|
|
686
831
|
"""Retrieves the specified (grid or drill/place) board origin
|
|
687
832
|
|
|
@@ -833,7 +978,7 @@ class Board:
|
|
|
833
978
|
cmd = board_commands_pb2.CheckPadstackPresenceOnLayers()
|
|
834
979
|
cmd.board.CopyFrom(self._doc)
|
|
835
980
|
|
|
836
|
-
items_map = {}
|
|
981
|
+
items_map: Dict[str, BoardItem] = {}
|
|
837
982
|
|
|
838
983
|
if isinstance(items, BoardItem):
|
|
839
984
|
cmd.items.append(items.id)
|
|
@@ -849,7 +994,7 @@ class Board:
|
|
|
849
994
|
|
|
850
995
|
response = self._kicad.send(cmd, board_commands_pb2.PadstackPresenceResponse)
|
|
851
996
|
|
|
852
|
-
result = {}
|
|
997
|
+
result: Dict[BoardItem, Dict[board_types_pb2.BoardLayer.ValueType, bool]] = {}
|
|
853
998
|
for entry in response.entries:
|
|
854
999
|
if entry.item.value not in items_map:
|
|
855
1000
|
continue
|