kicad-python 0.6.0__tar.gz → 0.7.1__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.
Files changed (156) hide show
  1. {kicad_python-0.6.0 → kicad_python-0.7.1}/PKG-INFO +19 -5
  2. {kicad_python-0.6.0 → kicad_python-0.7.1}/README.md +16 -3
  3. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/board.py +150 -5
  4. kicad_python-0.7.1/build/lib/kipy/board_jobs.py +1557 -0
  5. kicad_python-0.7.1/build/lib/kipy/board_rules.py +1096 -0
  6. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/board_types.py +259 -12
  7. {kicad_python-0.6.0 → kicad_python-0.7.1/build/lib}/kipy/common_types.py +12 -14
  8. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/geometry.py +69 -5
  9. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/kicad.py +3 -1
  10. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/kicad_api_version.py +1 -1
  11. kicad_python-0.7.1/build/lib/kipy/packaging/__init__.py +28 -0
  12. kicad_python-0.7.1/build/lib/kipy/packaging/__main__.py +24 -0
  13. kicad_python-0.7.1/build/lib/kipy/packaging/cli.py +64 -0
  14. kicad_python-0.7.1/build/lib/kipy/packaging/types.py +81 -0
  15. kicad_python-0.7.1/build/lib/kipy/packaging/validate.py +387 -0
  16. kicad_python-0.7.1/build/lib/kipy/proto/board/board_commands_pb2.py +111 -0
  17. {kicad_python-0.6.0 → kicad_python-0.7.1/build/lib}/kipy/proto/board/board_commands_pb2.pyi +129 -7
  18. kicad_python-0.7.1/build/lib/kipy/proto/board/board_jobs_pb2.py +86 -0
  19. {kicad_python-0.6.0 → kicad_python-0.7.1/build/lib}/kipy/proto/board/board_jobs_pb2.pyi +197 -12
  20. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/proto/board/board_pb2.py +1 -1
  21. kicad_python-0.7.1/build/lib/kipy/proto/board/board_types_pb2.py +176 -0
  22. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/proto/board/board_types_pb2.pyi +409 -24
  23. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/proto/common/commands/base_commands_pb2.py +1 -1
  24. kicad_python-0.7.1/build/lib/kipy/proto/common/commands/editor_commands_pb2.py +113 -0
  25. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/proto/common/commands/editor_commands_pb2.pyi +48 -0
  26. {kicad_python-0.6.0 → kicad_python-0.7.1/build/lib}/kipy/proto/common/commands/project_commands_pb2.py +1 -1
  27. {kicad_python-0.6.0 → kicad_python-0.7.1/build/lib}/kipy/proto/common/envelope_pb2.py +1 -1
  28. kicad_python-0.7.1/build/lib/kipy/proto/common/types/base_types_pb2.py +106 -0
  29. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/proto/common/types/base_types_pb2.pyi +22 -3
  30. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/proto/common/types/enums_pb2.py +9 -9
  31. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/proto/common/types/enums_pb2.pyi +4 -0
  32. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/proto/common/types/jobs_pb2.py +1 -1
  33. kicad_python-0.7.1/build/lib/kipy/proto/common/types/project_settings_pb2.py +31 -0
  34. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/proto/common/types/project_settings_pb2.pyi +10 -3
  35. {kicad_python-0.6.0 → kicad_python-0.7.1/build/lib}/kipy/proto/common/types/wizards_pb2.py +1 -1
  36. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/proto/schematic/schematic_commands_pb2.py +1 -1
  37. kicad_python-0.7.1/build/lib/kipy/proto/schematic/schematic_jobs_pb2.py +41 -0
  38. kicad_python-0.7.1/build/lib/kipy/proto/schematic/schematic_jobs_pb2.pyi +393 -0
  39. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/proto/schematic/schematic_types_pb2.py +1 -1
  40. kicad_python-0.7.1/build/lib/kipy/schematic.py +326 -0
  41. kicad_python-0.7.1/build/lib/kipy/schematic_types.py +1759 -0
  42. kicad_python-0.7.1/build/lib/kipy/server.py +303 -0
  43. {kicad_python-0.6.0 → kicad_python-0.7.1/build/lib}/kipy/util/proto.py +1 -0
  44. kicad_python-0.7.1/build/lib/kipy/wizards.py +798 -0
  45. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/board.py +150 -5
  46. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/board_types.py +259 -12
  47. {kicad_python-0.6.0/build/lib → kicad_python-0.7.1}/kipy/common_types.py +12 -14
  48. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/geometry.py +69 -5
  49. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/kicad.py +3 -1
  50. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/kicad_api_version.py +1 -1
  51. kicad_python-0.7.1/kipy/packaging/__init__.py +28 -0
  52. kicad_python-0.7.1/kipy/packaging/__main__.py +24 -0
  53. kicad_python-0.7.1/kipy/packaging/cli.py +64 -0
  54. kicad_python-0.7.1/kipy/packaging/schemas/__init__.py +0 -0
  55. kicad_python-0.7.1/kipy/packaging/schemas/api.v1.schema.json +125 -0
  56. kicad_python-0.7.1/kipy/packaging/schemas/pcm.v1.schema.json +397 -0
  57. kicad_python-0.7.1/kipy/packaging/schemas/pcm.v2.schema.json +304 -0
  58. kicad_python-0.7.1/kipy/packaging/types.py +81 -0
  59. kicad_python-0.7.1/kipy/packaging/validate.py +387 -0
  60. kicad_python-0.7.1/kipy/proto/board/board_commands_pb2.py +111 -0
  61. {kicad_python-0.6.0/build/lib → kicad_python-0.7.1}/kipy/proto/board/board_commands_pb2.pyi +129 -7
  62. kicad_python-0.7.1/kipy/proto/board/board_jobs_pb2.py +86 -0
  63. {kicad_python-0.6.0/build/lib → kicad_python-0.7.1}/kipy/proto/board/board_jobs_pb2.pyi +197 -12
  64. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/proto/board/board_pb2.py +1 -1
  65. kicad_python-0.7.1/kipy/proto/board/board_types_pb2.py +176 -0
  66. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/proto/board/board_types_pb2.pyi +409 -24
  67. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/proto/common/commands/base_commands_pb2.py +1 -1
  68. kicad_python-0.7.1/kipy/proto/common/commands/editor_commands_pb2.py +113 -0
  69. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/proto/common/commands/editor_commands_pb2.pyi +48 -0
  70. {kicad_python-0.6.0/build/lib → kicad_python-0.7.1}/kipy/proto/common/commands/project_commands_pb2.py +1 -1
  71. {kicad_python-0.6.0/build/lib → kicad_python-0.7.1}/kipy/proto/common/envelope_pb2.py +1 -1
  72. kicad_python-0.7.1/kipy/proto/common/types/base_types_pb2.py +106 -0
  73. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/proto/common/types/base_types_pb2.pyi +22 -3
  74. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/proto/common/types/enums_pb2.py +9 -9
  75. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/proto/common/types/enums_pb2.pyi +4 -0
  76. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/proto/common/types/jobs_pb2.py +1 -1
  77. kicad_python-0.7.1/kipy/proto/common/types/project_settings_pb2.py +31 -0
  78. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/proto/common/types/project_settings_pb2.pyi +10 -3
  79. {kicad_python-0.6.0/build/lib → kicad_python-0.7.1}/kipy/proto/common/types/wizards_pb2.py +1 -1
  80. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/proto/schematic/schematic_commands_pb2.py +1 -1
  81. kicad_python-0.7.1/kipy/proto/schematic/schematic_jobs_pb2.py +41 -0
  82. kicad_python-0.7.1/kipy/proto/schematic/schematic_jobs_pb2.pyi +393 -0
  83. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/proto/schematic/schematic_types_pb2.py +1 -1
  84. kicad_python-0.7.1/kipy/py.typed +0 -0
  85. {kicad_python-0.6.0/build/lib → kicad_python-0.7.1}/kipy/util/proto.py +1 -0
  86. {kicad_python-0.6.0 → kicad_python-0.7.1}/pyproject.toml +11 -3
  87. kicad_python-0.7.1/setup.py +48 -0
  88. kicad_python-0.6.0/build/lib/kipy/proto/board/board_commands_pb2.py +0 -103
  89. kicad_python-0.6.0/build/lib/kipy/proto/board/board_jobs_pb2.py +0 -74
  90. kicad_python-0.6.0/build/lib/kipy/proto/board/board_types_pb2.py +0 -152
  91. kicad_python-0.6.0/build/lib/kipy/proto/common/commands/editor_commands_pb2.py +0 -109
  92. kicad_python-0.6.0/build/lib/kipy/proto/common/types/base_types_pb2.py +0 -104
  93. kicad_python-0.6.0/build/lib/kipy/proto/common/types/project_settings_pb2.py +0 -31
  94. kicad_python-0.6.0/build/lib/kipy/proto/schematic/schematic_jobs_pb2.py +0 -27
  95. kicad_python-0.6.0/build/lib/kipy/proto/schematic/schematic_jobs_pb2.pyi +0 -73
  96. kicad_python-0.6.0/build/lib/kipy/wizards.py +0 -700
  97. kicad_python-0.6.0/kipy/proto/board/board_commands_pb2.py +0 -103
  98. kicad_python-0.6.0/kipy/proto/board/board_jobs_pb2.py +0 -74
  99. kicad_python-0.6.0/kipy/proto/board/board_types_pb2.py +0 -152
  100. kicad_python-0.6.0/kipy/proto/common/commands/editor_commands_pb2.py +0 -109
  101. kicad_python-0.6.0/kipy/proto/common/types/base_types_pb2.py +0 -104
  102. kicad_python-0.6.0/kipy/proto/common/types/project_settings_pb2.py +0 -31
  103. kicad_python-0.6.0/kipy/proto/schematic/schematic_jobs_pb2.py +0 -27
  104. kicad_python-0.6.0/kipy/proto/schematic/schematic_jobs_pb2.pyi +0 -73
  105. kicad_python-0.6.0/setup.py +0 -42
  106. {kicad_python-0.6.0 → kicad_python-0.7.1}/LICENSE +0 -0
  107. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/__init__.py +0 -0
  108. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/client.py +0 -0
  109. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/errors.py +0 -0
  110. /kicad_python-0.6.0/kipy/py.typed → /kicad_python-0.7.1/build/lib/kipy/packaging/schemas/__init__.py +0 -0
  111. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/project.py +0 -0
  112. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/project_types.py +0 -0
  113. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/proto/__init__.py +0 -0
  114. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/proto/board/__init__.py +0 -0
  115. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/proto/board/board_pb2.pyi +0 -0
  116. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/proto/common/__init__.py +0 -0
  117. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/proto/common/commands/__init__.py +0 -0
  118. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/proto/common/commands/base_commands_pb2.pyi +0 -0
  119. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/proto/common/commands/project_commands_pb2.pyi +0 -0
  120. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/proto/common/envelope_pb2.pyi +0 -0
  121. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/proto/common/types/__init__.py +0 -0
  122. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/proto/common/types/generators_pb2.py +0 -0
  123. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/proto/common/types/generators_pb2.pyi +0 -0
  124. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/proto/common/types/jobs_pb2.pyi +0 -0
  125. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/proto/common/types/wizards_pb2.pyi +0 -0
  126. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/proto/schematic/schematic_commands_pb2.pyi +0 -0
  127. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/proto/schematic/schematic_types_pb2.pyi +0 -0
  128. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/util/__init__.py +0 -0
  129. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/util/board_layer.py +0 -0
  130. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/util/units.py +0 -0
  131. {kicad_python-0.6.0 → kicad_python-0.7.1}/build/lib/kipy/wrapper.py +0 -0
  132. {kicad_python-0.6.0 → kicad_python-0.7.1}/build.py +0 -0
  133. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/__init__.py +0 -0
  134. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/client.py +0 -0
  135. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/errors.py +0 -0
  136. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/project.py +0 -0
  137. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/project_types.py +0 -0
  138. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/proto/__init__.py +0 -0
  139. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/proto/board/__init__.py +0 -0
  140. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/proto/board/board_pb2.pyi +0 -0
  141. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/proto/common/__init__.py +0 -0
  142. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/proto/common/commands/__init__.py +0 -0
  143. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/proto/common/commands/base_commands_pb2.pyi +0 -0
  144. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/proto/common/commands/project_commands_pb2.pyi +0 -0
  145. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/proto/common/envelope_pb2.pyi +0 -0
  146. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/proto/common/types/__init__.py +0 -0
  147. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/proto/common/types/generators_pb2.py +0 -0
  148. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/proto/common/types/generators_pb2.pyi +0 -0
  149. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/proto/common/types/jobs_pb2.pyi +0 -0
  150. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/proto/common/types/wizards_pb2.pyi +0 -0
  151. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/proto/schematic/schematic_commands_pb2.pyi +0 -0
  152. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/proto/schematic/schematic_types_pb2.pyi +0 -0
  153. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/util/__init__.py +0 -0
  154. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/util/board_layer.py +0 -0
  155. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/util/units.py +0 -0
  156. {kicad_python-0.6.0 → kicad_python-0.7.1}/kipy/wrapper.py +0 -0
@@ -1,15 +1,16 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kicad-python
3
- Version: 0.6.0
3
+ Version: 0.7.1
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 :: 4 - Beta
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"
@@ -24,9 +25,8 @@ Description-Content-Type: text/markdown
24
25
  `kicad-python` is the official Python bindings for the [KiCad](https://kicad.org) IPC API. This
25
26
  library makes it possible to develop scripts and tools that interact with a running KiCad session.
26
27
 
27
- The KiCad IPC API can be considered in "public beta" state with the release of KiCad 9 (currently
28
- planned for on or around February 1, 2025). The existing SWIG-based Python bindings for KiCad's
29
- PCB editor still exist in KiCad 9, but are in maintenance mode and will not be expanded.
28
+ The KiCad IPC API replaces the legacy SWIG-based Python bindings for KiCad's PCB editor.
29
+ The SWIG bindings still exist in KiCad 9 and 10, but are removed in KiCad 11.
30
30
 
31
31
  For more information about the IPC API, please see the
32
32
  [KiCad developer documentation](https://dev-docs.kicad.org/en/apis-and-binding/ipc-api/index.html).
@@ -98,6 +98,20 @@ plugins, copy or symlink them into the appropriate plugins path in order for KiC
98
98
 
99
99
  ## Release History
100
100
 
101
+ ### 0.7.1 (April 17, 2026)
102
+
103
+ - Fix `KiCad.run_action` (leommxj)
104
+
105
+ ### 0.7.0 (April 17, 2026)
106
+
107
+ - Add `Board.get_items_by_id` and groups support via `Board.get_groups` (requires KiCad 10) (Anthonypark, !15)
108
+ - Add support for barcodes and `Board.get_barcodes` (requires KiCad 10.0.1)
109
+ - Add support for reference images and `Board.get_reference_images` (requires KiCad 10.0.1)
110
+ - Add `Board.set_title_block_info` (requires KiCad 10.0.1)
111
+ - Add `Board.get_connected_items`, `Board.get_items_by_net`, and `Board.get_items_by_netclass` (requires KiCad 10.0.1)
112
+ - Fix several bounding box calculation bugs
113
+ - Support building with older versions of protoc
114
+
101
115
  ### 0.6.0 (March 15, 2026)
102
116
 
103
117
  - Fix missing conversion of rectangles into polygons when rotating by non-cardinal amounts (#86)
@@ -3,9 +3,8 @@
3
3
  `kicad-python` is the official Python bindings for the [KiCad](https://kicad.org) IPC API. This
4
4
  library makes it possible to develop scripts and tools that interact with a running KiCad session.
5
5
 
6
- The KiCad IPC API can be considered in "public beta" state with the release of KiCad 9 (currently
7
- planned for on or around February 1, 2025). The existing SWIG-based Python bindings for KiCad's
8
- PCB editor still exist in KiCad 9, but are in maintenance mode and will not be expanded.
6
+ The KiCad IPC API replaces the legacy SWIG-based Python bindings for KiCad's PCB editor.
7
+ The SWIG bindings still exist in KiCad 9 and 10, but are removed in KiCad 11.
9
8
 
10
9
  For more information about the IPC API, please see the
11
10
  [KiCad developer documentation](https://dev-docs.kicad.org/en/apis-and-binding/ipc-api/index.html).
@@ -77,6 +76,20 @@ plugins, copy or symlink them into the appropriate plugins path in order for KiC
77
76
 
78
77
  ## Release History
79
78
 
79
+ ### 0.7.1 (April 17, 2026)
80
+
81
+ - Fix `KiCad.run_action` (leommxj)
82
+
83
+ ### 0.7.0 (April 17, 2026)
84
+
85
+ - Add `Board.get_items_by_id` and groups support via `Board.get_groups` (requires KiCad 10) (Anthonypark, !15)
86
+ - Add support for barcodes and `Board.get_barcodes` (requires KiCad 10.0.1)
87
+ - Add support for reference images and `Board.get_reference_images` (requires KiCad 10.0.1)
88
+ - Add `Board.set_title_block_info` (requires KiCad 10.0.1)
89
+ - Add `Board.get_connected_items`, `Board.get_items_by_net`, and `Board.get_items_by_netclass` (requires KiCad 10.0.1)
90
+ - Fix several bounding box calculation bugs
91
+ - Support building with older versions of protoc
92
+
80
93
  ### 0.6.0 (March 15, 2026)
81
94
 
82
95
  - 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[Wrapper]:
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