@windypro-rourou/dsh-eda 0.1.4 → 0.1.6

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 (484) hide show
  1. package/README.md +1 -1
  2. package/lib/backend.js +49 -0
  3. package/lib/capabilities.js +6 -2
  4. package/lib/client.js +33 -0
  5. package/lib/index.js +197 -3
  6. package/package.json +10 -1
  7. package/skill/INDEX.md +10 -8
  8. package/skill/README.md +125 -0
  9. package/skill/README.zh-Hans.md +125 -0
  10. package/skill/SKILL.md +746 -746
  11. package/skill/format/index.md +152 -152
  12. package/skill/format/pcb/3d.md +166 -166
  13. package/skill/format/pcb/attr.md +63 -63
  14. package/skill/format/pcb/common.md +306 -306
  15. package/skill/format/pcb/component.md +132 -132
  16. package/skill/format/pcb/dimension.md +58 -58
  17. package/skill/format/pcb/index.md +17 -17
  18. package/skill/format/pcb/obj.md +43 -43
  19. package/skill/format/pcb/pad_via.md +151 -151
  20. package/skill/format/pcb/panel.md +64 -64
  21. package/skill/format/pcb/partition.md +43 -43
  22. package/skill/format/pcb/primitive.md +196 -196
  23. package/skill/format/pcb/rule.md +71 -71
  24. package/skill/format/pcb/shape.md +441 -441
  25. package/skill/format/pcb/text.md +62 -62
  26. package/skill/format/project/blob.md +30 -30
  27. package/skill/format/project/common.md +42 -42
  28. package/skill/format/project/group.md +62 -62
  29. package/skill/format/project/index.md +12 -12
  30. package/skill/format/project/instance.md +32 -32
  31. package/skill/format/project/meta.md +189 -189
  32. package/skill/format/project/variant.md +30 -30
  33. package/skill/format/schematic/attr.md +41 -41
  34. package/skill/format/schematic/common.md +47 -47
  35. package/skill/format/schematic/component.md +91 -91
  36. package/skill/format/schematic/index.md +14 -14
  37. package/skill/format/schematic/obj.md +41 -41
  38. package/skill/format/schematic/pin.md +59 -59
  39. package/skill/format/schematic/shape.md +231 -231
  40. package/skill/format/schematic/structure.md +53 -53
  41. package/skill/format/schematic/table.md +109 -109
  42. package/skill/format/schematic/text.md +47 -47
  43. package/skill/format/schematic/wire.md +132 -132
  44. package/skill/guide/ancillary-projects/easyeda-api-sdk.md +1 -0
  45. package/skill/guide/ancillary-projects/pro-api-types.md +5 -5
  46. package/skill/guide/ancillary-projects.md +10 -10
  47. package/skill/guide/cli.md +1510 -0
  48. package/skill/guide/error-handling.md +38 -38
  49. package/skill/guide/extension-json.md +135 -135
  50. package/skill/guide/extensions-marketplace.md +61 -61
  51. package/skill/guide/how-to-start.md +316 -301
  52. package/skill/guide/i18n.md +57 -57
  53. package/skill/guide/index.md +7 -7
  54. package/skill/guide/inline-frame.md +20 -20
  55. package/skill/guide/invoke-apis.md +81 -81
  56. package/skill/guide/stability.md +37 -37
  57. package/skill/references/_index.md +471 -398
  58. package/skill/references/_quick-reference.md +3103 -3028
  59. package/skill/references/classes/DMT_Board.md +537 -533
  60. package/skill/references/classes/DMT_EditorControl.md +1736 -1736
  61. package/skill/references/classes/DMT_Event.md +356 -356
  62. package/skill/references/classes/DMT_Folder.md +775 -775
  63. package/skill/references/classes/DMT_Panel.md +531 -531
  64. package/skill/references/classes/DMT_Pcb.md +579 -575
  65. package/skill/references/classes/DMT_Project.md +734 -573
  66. package/skill/references/classes/DMT_Schematic.md +1482 -1477
  67. package/skill/references/classes/DMT_SelectControl.md +96 -96
  68. package/skill/references/classes/DMT_Team.md +172 -172
  69. package/skill/references/classes/DMT_Workspace.md +198 -198
  70. package/skill/references/classes/EDA.md +1001 -961
  71. package/skill/references/classes/IPCB_ComplexPolygon.md +299 -299
  72. package/skill/references/classes/IPCB_Polygon.md +175 -175
  73. package/skill/references/classes/IPCB_PrimitiveArc.md +1901 -1901
  74. package/skill/references/classes/IPCB_PrimitiveAttribute.md +2993 -2993
  75. package/skill/references/classes/IPCB_PrimitiveComponent.md +2624 -2627
  76. package/skill/references/classes/IPCB_PrimitiveComponentPad.md +410 -410
  77. package/skill/references/classes/IPCB_PrimitiveDimension.md +1419 -1419
  78. package/skill/references/classes/IPCB_PrimitiveFill.md +1325 -1325
  79. package/skill/references/classes/IPCB_PrimitiveImage.md +1461 -1461
  80. package/skill/references/classes/IPCB_PrimitiveLine.md +1639 -1639
  81. package/skill/references/classes/IPCB_PrimitiveObject.md +1700 -1700
  82. package/skill/references/classes/IPCB_PrimitivePad.md +3155 -3155
  83. package/skill/references/classes/IPCB_PrimitivePolyline.md +1193 -1193
  84. package/skill/references/classes/IPCB_PrimitivePour.md +1858 -1858
  85. package/skill/references/classes/IPCB_PrimitivePoured.md +556 -556
  86. package/skill/references/classes/IPCB_PrimitiveRegion.md +1332 -1332
  87. package/skill/references/classes/IPCB_PrimitiveString.md +2315 -2315
  88. package/skill/references/classes/IPCB_PrimitiveVia.md +1588 -1588
  89. package/skill/references/classes/ISCH_PrimitiveArc.md +1676 -1676
  90. package/skill/references/classes/ISCH_PrimitiveAttribute.md +2541 -2541
  91. package/skill/references/classes/ISCH_PrimitiveBus.md +973 -973
  92. package/skill/references/classes/ISCH_PrimitiveCbbSymbolComponent.md +260 -260
  93. package/skill/references/classes/ISCH_PrimitiveCircle.md +1392 -1392
  94. package/skill/references/classes/ISCH_PrimitiveComponent.md +2910 -2913
  95. package/skill/references/classes/ISCH_PrimitiveComponentPin.md +155 -155
  96. package/skill/references/classes/ISCH_PrimitiveObject.md +960 -960
  97. package/skill/references/classes/ISCH_PrimitivePin.md +2402 -2402
  98. package/skill/references/classes/ISCH_PrimitivePolygon.md +1028 -1028
  99. package/skill/references/classes/ISCH_PrimitiveRectangle.md +1777 -1777
  100. package/skill/references/classes/ISCH_PrimitiveText.md +1771 -1771
  101. package/skill/references/classes/ISCH_PrimitiveWire.md +973 -973
  102. package/skill/references/classes/LIB_3DModel.md +782 -780
  103. package/skill/references/classes/LIB_Cbb.md +957 -957
  104. package/skill/references/classes/LIB_Classification.md +969 -965
  105. package/skill/references/classes/LIB_Device.md +1222 -1221
  106. package/skill/references/classes/LIB_Footprint.md +1298 -1153
  107. package/skill/references/classes/LIB_LibrariesList.md +361 -329
  108. package/skill/references/classes/LIB_PanelLibrary.md +855 -855
  109. package/skill/references/classes/LIB_SelectControl.md +89 -89
  110. package/skill/references/classes/LIB_SimulationModel.md +807 -821
  111. package/skill/references/classes/LIB_Symbol.md +1341 -1195
  112. package/skill/references/classes/PCB_Document.md +1770 -1754
  113. package/skill/references/classes/PCB_Drc.md +3379 -3375
  114. package/skill/references/classes/PCB_Event.md +1166 -1081
  115. package/skill/references/classes/PCB_ImageTool.md +363 -0
  116. package/skill/references/classes/PCB_Layer.md +1915 -1911
  117. package/skill/references/classes/PCB_ManufactureData.md +2968 -2968
  118. package/skill/references/classes/PCB_MathPolygon.md +916 -785
  119. package/skill/references/classes/PCB_Net.md +1128 -1128
  120. package/skill/references/classes/PCB_Primitive.md +217 -217
  121. package/skill/references/classes/PCB_PrimitiveArc.md +820 -894
  122. package/skill/references/classes/PCB_PrimitiveAttribute.md +635 -717
  123. package/skill/references/classes/PCB_PrimitiveComponent.md +1050 -1050
  124. package/skill/references/classes/PCB_PrimitiveDimension.md +789 -833
  125. package/skill/references/classes/PCB_PrimitiveFill.md +783 -861
  126. package/skill/references/classes/PCB_PrimitiveImage.md +803 -875
  127. package/skill/references/classes/PCB_PrimitiveLine.md +787 -858
  128. package/skill/references/classes/PCB_PrimitiveObject.md +796 -800
  129. package/skill/references/classes/PCB_PrimitivePad.md +947 -944
  130. package/skill/references/classes/PCB_PrimitivePolyline.md +744 -819
  131. package/skill/references/classes/PCB_PrimitivePour.md +808 -845
  132. package/skill/references/classes/PCB_PrimitivePoured.md +363 -363
  133. package/skill/references/classes/PCB_PrimitiveRegion.md +765 -799
  134. package/skill/references/classes/PCB_PrimitiveString.md +828 -910
  135. package/skill/references/classes/PCB_PrimitiveVia.md +761 -765
  136. package/skill/references/classes/PCB_RayTracerEngine.md +603 -263
  137. package/skill/references/classes/PCB_SelectControl.md +495 -495
  138. package/skill/references/classes/PCB_Tool.md +9 -0
  139. package/skill/references/classes/PNL_Document.md +83 -83
  140. package/skill/references/classes/SCH_Document.md +797 -809
  141. package/skill/references/classes/SCH_Drc.md +246 -242
  142. package/skill/references/classes/SCH_Event.md +583 -583
  143. package/skill/references/classes/SCH_ManufactureData.md +1209 -1205
  144. package/skill/references/classes/SCH_Net.md +200 -200
  145. package/skill/references/classes/SCH_Netlist.md +191 -191
  146. package/skill/references/classes/SCH_Primitive.md +337 -337
  147. package/skill/references/classes/SCH_PrimitiveArc.md +686 -692
  148. package/skill/references/classes/SCH_PrimitiveAttribute.md +579 -590
  149. package/skill/references/classes/SCH_PrimitiveBus.md +618 -624
  150. package/skill/references/classes/SCH_PrimitiveCircle.md +667 -683
  151. package/skill/references/classes/SCH_PrimitiveComponent.md +2256 -2240
  152. package/skill/references/classes/SCH_PrimitiveObject.md +666 -666
  153. package/skill/references/classes/SCH_PrimitivePin.md +737 -754
  154. package/skill/references/classes/SCH_PrimitivePolygon.md +621 -627
  155. package/skill/references/classes/SCH_PrimitiveRectangle.md +715 -731
  156. package/skill/references/classes/SCH_PrimitiveText.md +736 -746
  157. package/skill/references/classes/SCH_PrimitiveWire.md +701 -703
  158. package/skill/references/classes/SCH_SelectControl.md +520 -520
  159. package/skill/references/classes/SCH_SimulationEngine.md +133 -133
  160. package/skill/references/classes/SCH_Utils.md +121 -121
  161. package/skill/references/classes/SYS_ClientUrl.md +173 -173
  162. package/skill/references/classes/SYS_Dialog.md +825 -825
  163. package/skill/references/classes/SYS_Environment.md +640 -502
  164. package/skill/references/classes/SYS_ExternalApi.md +246 -0
  165. package/skill/references/classes/SYS_FileManager.md +1664 -1686
  166. package/skill/references/classes/SYS_FileSystem.md +1366 -1171
  167. package/skill/references/classes/SYS_FontManager.md +224 -224
  168. package/skill/references/classes/SYS_FormatConversion.md +349 -349
  169. package/skill/references/classes/SYS_HeaderMenu.md +480 -479
  170. package/skill/references/classes/SYS_Help.md +141 -0
  171. package/skill/references/classes/SYS_I18n.md +861 -861
  172. package/skill/references/classes/SYS_IFrame.md +541 -535
  173. package/skill/references/classes/SYS_LoadingAndProgressBar.md +246 -246
  174. package/skill/references/classes/SYS_Log.md +422 -424
  175. package/skill/references/classes/SYS_Math.md +1565 -1565
  176. package/skill/references/classes/SYS_Message.md +363 -363
  177. package/skill/references/classes/SYS_MessageBox.md +285 -285
  178. package/skill/references/classes/SYS_MessageBus.md +1618 -1618
  179. package/skill/references/classes/SYS_PanelControl.md +696 -696
  180. package/skill/references/classes/SYS_RightClickMenu.md +175 -175
  181. package/skill/references/classes/SYS_Setting.md +134 -85
  182. package/skill/references/classes/SYS_ShortcutKey.md +623 -623
  183. package/skill/references/classes/SYS_Storage.md +484 -484
  184. package/skill/references/classes/SYS_Timer.md +447 -447
  185. package/skill/references/classes/SYS_ToastMessage.md +194 -194
  186. package/skill/references/classes/SYS_Tool.md +317 -241
  187. package/skill/references/classes/SYS_Unit.md +594 -594
  188. package/skill/references/classes/SYS_WebSocket.md +401 -401
  189. package/skill/references/classes/SYS_Window.md +849 -850
  190. package/skill/references/enums/EDMT_EditorDocumentType.md +324 -278
  191. package/skill/references/enums/EDMT_EditorSplitScreenDirection.md +51 -47
  192. package/skill/references/enums/EDMT_EditorTabEventType.md +68 -62
  193. package/skill/references/enums/EDMT_IndicatorMarkerType.md +90 -80
  194. package/skill/references/enums/EDMT_ItemType.md +181 -157
  195. package/skill/references/enums/EDMT_ProjectCollaborationMode.md +51 -47
  196. package/skill/references/enums/EDMT_ProjectFileFormat.md +60 -0
  197. package/skill/references/enums/EDMT_ProjectReadyState.md +82 -0
  198. package/skill/references/enums/ELIB_DeviceJlcLibraryCategory.md +51 -47
  199. package/skill/references/enums/ELIB_LibraryType.md +129 -113
  200. package/skill/references/enums/ELIB_PreviewType.md +77 -69
  201. package/skill/references/enums/ELIB_SimulationModelType.md +51 -47
  202. package/skill/references/enums/ELIB_SymbolType.md +142 -124
  203. package/skill/references/enums/EPCB_AutoRoutingCornerStyle.md +51 -47
  204. package/skill/references/enums/EPCB_AutoRoutingExistingPrimitiveMode.md +51 -47
  205. package/skill/references/enums/EPCB_AutoRoutingOptimization.md +51 -47
  206. package/skill/references/enums/EPCB_DocumentCanvasUpdateCalculationActiveStatus.md +51 -47
  207. package/skill/references/enums/EPCB_DocumentRatlineCalculatingActiveStatus.md +55 -51
  208. package/skill/references/enums/EPCB_InactiveLayerDisplayMode.md +64 -58
  209. package/skill/references/enums/EPCB_LayerColorConfiguration.md +90 -80
  210. package/skill/references/enums/EPCB_LayerId.md +1169 -881
  211. package/skill/references/enums/EPCB_LayerStatus.md +64 -58
  212. package/skill/references/enums/EPCB_LayerType.md +129 -113
  213. package/skill/references/enums/EPCB_MouseEventType.md +64 -58
  214. package/skill/references/enums/EPCB_NetEventType.md +64 -58
  215. package/skill/references/enums/EPCB_PcbPlateType.md +51 -47
  216. package/skill/references/enums/EPCB_PdfOutputMethod.md +64 -58
  217. package/skill/references/enums/EPCB_PrimitiveArcInteractiveMode.md +51 -47
  218. package/skill/references/enums/EPCB_PrimitiveDimensionType.md +64 -58
  219. package/skill/references/enums/EPCB_PrimitiveEventType.md +64 -58
  220. package/skill/references/enums/EPCB_PrimitiveFillMode.md +68 -62
  221. package/skill/references/enums/EPCB_PrimitivePadHeatWeldingConnectionMethod.md +64 -58
  222. package/skill/references/enums/EPCB_PrimitivePadHoleType.md +64 -58
  223. package/skill/references/enums/EPCB_PrimitivePadShapeType.md +90 -80
  224. package/skill/references/enums/EPCB_PrimitivePadType.md +64 -58
  225. package/skill/references/enums/EPCB_PrimitivePourFillMethod.md +64 -58
  226. package/skill/references/enums/EPCB_PrimitiveRegionRuleType.md +107 -95
  227. package/skill/references/enums/EPCB_PrimitiveStringAlignMode.md +142 -124
  228. package/skill/references/enums/EPCB_PrimitiveType.md +233 -201
  229. package/skill/references/enums/EPCB_PrimitiveViaType.md +64 -58
  230. package/skill/references/enums/ESCH_DynamicSimulationEnginePullEventType.md +116 -102
  231. package/skill/references/enums/ESCH_DynamicSimulationEnginePushEventType.md +90 -80
  232. package/skill/references/enums/ESCH_ExportDocumentFileType.md +64 -58
  233. package/skill/references/enums/ESCH_MouseEventType.md +51 -47
  234. package/skill/references/enums/ESCH_PrimitiveComponentType.md +142 -124
  235. package/skill/references/enums/ESCH_PrimitiveEventType.md +77 -69
  236. package/skill/references/enums/ESCH_PrimitiveFillStyle.md +129 -113
  237. package/skill/references/enums/ESCH_PrimitiveLineType.md +77 -69
  238. package/skill/references/enums/ESCH_PrimitivePinShape.md +77 -69
  239. package/skill/references/enums/ESCH_PrimitivePinType.md +168 -146
  240. package/skill/references/enums/ESCH_PrimitiveTextAlignMode.md +142 -124
  241. package/skill/references/enums/ESCH_PrimitiveType.md +207 -179
  242. package/skill/references/enums/ESCH_SimulationNetlistType.md +38 -36
  243. package/skill/references/enums/ESCH_SpiceSimulationEnginePullEventType.md +51 -47
  244. package/skill/references/enums/ESCH_SpiceSimulationEnginePushEventType.md +77 -69
  245. package/skill/references/enums/ESYS_BottomPanelTab.md +94 -80
  246. package/skill/references/enums/ESYS_HeaderMenuEnvironment.md +181 -157
  247. package/skill/references/enums/ESYS_ImportProjectBoardOutlineSource.md +55 -51
  248. package/skill/references/enums/ESYS_ImportProjectImportOption.md +64 -58
  249. package/skill/references/enums/ESYS_ImportProjectSchematicObjectStyle.md +51 -47
  250. package/skill/references/enums/ESYS_ImportProjectViaSolderMaskExpansion.md +55 -51
  251. package/skill/references/enums/ESYS_JobState.md +95 -0
  252. package/skill/references/enums/ESYS_LeftPanelTab.md +94 -80
  253. package/skill/references/enums/ESYS_LogType.md +77 -102
  254. package/skill/references/enums/ESYS_NetlistType.md +129 -113
  255. package/skill/references/enums/ESYS_PanelPosition.md +69 -0
  256. package/skill/references/enums/ESYS_PanelTab.md +368 -0
  257. package/skill/references/enums/ESYS_RightPanelTab.md +237 -201
  258. package/skill/references/enums/ESYS_ShortcutKeyEffectiveEditorRange.md +220 -190
  259. package/skill/references/enums/ESYS_ShortcutKeyEffectiveEditorScene.md +103 -91
  260. package/skill/references/enums/ESYS_StartPageQuickStartItem.md +237 -205
  261. package/skill/references/enums/ESYS_Theme.md +51 -47
  262. package/skill/references/enums/ESYS_ToastMessageType.md +90 -80
  263. package/skill/references/enums/ESYS_Unit.md +116 -102
  264. package/skill/references/enums/ESYS_WindowEventType.md +64 -47
  265. package/skill/references/enums/ESYS_WindowOpenTarget.md +51 -47
  266. package/skill/references/enums/NetportDeviceName.md +146 -146
  267. package/skill/references/enums/SchToolBarDeviceName.md +278 -278
  268. package/skill/references/interfaces/BoardProps.md +169 -169
  269. package/skill/references/interfaces/BorderConfig.md +109 -0
  270. package/skill/references/interfaces/ButtonProps.md +196 -169
  271. package/skill/references/interfaces/CellClickInfo.md +142 -0
  272. package/skill/references/interfaces/CellCoord.md +88 -0
  273. package/skill/references/interfaces/CheckBoxProps.md +223 -196
  274. package/skill/references/interfaces/CheckChangeDetail.md +88 -0
  275. package/skill/references/interfaces/CheckboxEditConfig.md +159 -0
  276. package/skill/references/interfaces/ClipboardCellData.md +142 -0
  277. package/skill/references/interfaces/ClipboardConfig.md +115 -0
  278. package/skill/references/interfaces/ColorPickerProps.md +169 -0
  279. package/skill/references/interfaces/ColumnDef.md +605 -0
  280. package/skill/references/interfaces/ColumnEditTrigger.md +57 -0
  281. package/skill/references/interfaces/ColumnGroupDef.md +192 -0
  282. package/skill/references/interfaces/ColumnResizeConfig.md +142 -0
  283. package/skill/references/interfaces/ComponentPropsMap.md +517 -448
  284. package/skill/references/interfaces/CustomHeaderConfig.md +169 -0
  285. package/skill/references/interfaces/DialogProps.md +385 -385
  286. package/skill/references/interfaces/DragSortConfig.md +115 -0
  287. package/skill/references/interfaces/EditingConfig.md +196 -0
  288. package/skill/references/interfaces/FilteringConfig.md +250 -0
  289. package/skill/references/interfaces/FixedColumnConfig.md +88 -0
  290. package/skill/references/interfaces/FlexItemProps.md +116 -116
  291. package/skill/references/interfaces/FlexProps.md +224 -224
  292. package/skill/references/interfaces/GridItemProps.md +143 -143
  293. package/skill/references/interfaces/GridProps.md +143 -143
  294. package/skill/references/interfaces/IDMT_BoardItem.md +171 -171
  295. package/skill/references/interfaces/IDMT_BriefProjectItem.md +171 -171
  296. package/skill/references/interfaces/IDMT_EditorDocumentItem.md +169 -169
  297. package/skill/references/interfaces/IDMT_EditorSplitScreenItem.md +173 -173
  298. package/skill/references/interfaces/IDMT_EditorTabItem.md +169 -169
  299. package/skill/references/interfaces/IDMT_FolderItem.md +225 -225
  300. package/skill/references/interfaces/IDMT_IndicatorMarkerShape.md +393 -393
  301. package/skill/references/interfaces/IDMT_PanelItem.md +144 -144
  302. package/skill/references/interfaces/IDMT_PcbItem.md +171 -171
  303. package/skill/references/interfaces/IDMT_ProjectItem.md +143 -143
  304. package/skill/references/interfaces/IDMT_SchematicItem.md +225 -225
  305. package/skill/references/interfaces/IDMT_SchematicPageItem.md +198 -198
  306. package/skill/references/interfaces/IDMT_TeamItem.md +144 -144
  307. package/skill/references/interfaces/IDMT_WorkspaceItem.md +117 -117
  308. package/skill/references/interfaces/IDesignPortal.md +103 -103
  309. package/skill/references/interfaces/ILIB_3DModelItem.md +198 -198
  310. package/skill/references/interfaces/ILIB_3DModelSearchItem.md +277 -277
  311. package/skill/references/interfaces/ILIB_CbbItem.md +225 -225
  312. package/skill/references/interfaces/ILIB_CbbSearchItem.md +277 -277
  313. package/skill/references/interfaces/ILIB_ClassificationIndex.md +150 -150
  314. package/skill/references/interfaces/ILIB_ClassificationNode.md +98 -0
  315. package/skill/references/interfaces/ILIB_DeviceAssociationItem.md +210 -210
  316. package/skill/references/interfaces/ILIB_DeviceExtendPropertyItem.md +304 -304
  317. package/skill/references/interfaces/ILIB_DeviceItem.md +279 -279
  318. package/skill/references/interfaces/ILIB_DevicePropertiesForSearch.md +250 -250
  319. package/skill/references/interfaces/ILIB_DeviceSearchItem.md +521 -521
  320. package/skill/references/interfaces/ILIB_ExtendLibrary3DModelFunctions.md +64 -64
  321. package/skill/references/interfaces/ILIB_ExtendLibraryCbbFunctions.md +93 -99
  322. package/skill/references/interfaces/ILIB_ExtendLibraryClassificationIndex.md +150 -150
  323. package/skill/references/interfaces/ILIB_ExtendLibraryDeviceFunctions.md +143 -157
  324. package/skill/references/interfaces/ILIB_ExtendLibraryFootprintFunctions.md +63 -63
  325. package/skill/references/interfaces/ILIB_ExtendLibraryFunctions.md +123 -123
  326. package/skill/references/interfaces/ILIB_ExtendLibraryItem.md +97 -97
  327. package/skill/references/interfaces/ILIB_ExtendLibraryItemIndex.md +98 -98
  328. package/skill/references/interfaces/ILIB_ExtendLibrarySearchProperty.md +115 -115
  329. package/skill/references/interfaces/ILIB_ExtendLibrarySearchResult.md +169 -169
  330. package/skill/references/interfaces/ILIB_ExtendLibrarySearchResultDataLine.md +234 -234
  331. package/skill/references/interfaces/ILIB_ExtendLibrarySymbolFunctions.md +91 -105
  332. package/skill/references/interfaces/ILIB_ExtendLibraryUserIndex.md +96 -96
  333. package/skill/references/interfaces/ILIB_FootprintItem.md +256 -198
  334. package/skill/references/interfaces/ILIB_FootprintPropertiesForSearch.md +61 -61
  335. package/skill/references/interfaces/ILIB_FootprintSearchItem.md +277 -277
  336. package/skill/references/interfaces/ILIB_LibraryInfo.md +92 -92
  337. package/skill/references/interfaces/ILIB_LibraryItem.md +115 -115
  338. package/skill/references/interfaces/ILIB_PanelLibraryItem.md +198 -198
  339. package/skill/references/interfaces/ILIB_PanelLibrarySearchItem.md +277 -277
  340. package/skill/references/interfaces/ILIB_RegisterExtendLibraryProps.md +71 -0
  341. package/skill/references/interfaces/ILIB_SimulationModelItem.md +306 -306
  342. package/skill/references/interfaces/ILIB_SimulationModelSearchItem.md +304 -304
  343. package/skill/references/interfaces/ILIB_SymbolItem.md +306 -279
  344. package/skill/references/interfaces/ILIB_SymbolPropertiesForSearch.md +61 -61
  345. package/skill/references/interfaces/ILIB_SymbolSearchItem.md +304 -304
  346. package/skill/references/interfaces/IPCB_AutoLayoutResult.md +169 -169
  347. package/skill/references/interfaces/IPCB_AutoRoutingProps.md +220 -220
  348. package/skill/references/interfaces/IPCB_AutoRoutingResult.md +169 -169
  349. package/skill/references/interfaces/IPCB_BomPropertiesTableColumns.md +169 -169
  350. package/skill/references/interfaces/IPCB_DifferentialPairItem.md +115 -115
  351. package/skill/references/interfaces/IPCB_DiscretizeOptions.md +65 -65
  352. package/skill/references/interfaces/IPCB_DiscretizedPoint.md +88 -88
  353. package/skill/references/interfaces/IPCB_EqualLengthNetGroupItem.md +115 -115
  354. package/skill/references/interfaces/IPCB_LayerItem.md +277 -277
  355. package/skill/references/interfaces/IPCB_NetClassItem.md +115 -115
  356. package/skill/references/interfaces/IPCB_NetInfo.md +115 -115
  357. package/skill/references/interfaces/IPCB_PadPairGroupItem.md +88 -88
  358. package/skill/references/interfaces/IPCB_PadPairMinWireLengthItem.md +88 -88
  359. package/skill/references/interfaces/IPCB_PhysicalStackingConfiguration.md +115 -115
  360. package/skill/references/interfaces/IPCB_Primitive.md +218 -218
  361. package/skill/references/interfaces/IPCB_PrimitiveAPI.md +174 -175
  362. package/skill/references/interfaces/IPCB_PrimitivePadHeatWelding.md +151 -151
  363. package/skill/references/interfaces/IPCB_PrimitivePouredPourFill.md +142 -142
  364. package/skill/references/interfaces/IPCB_PrimitiveSolderMaskAndPasteMaskExpansion.md +154 -154
  365. package/skill/references/interfaces/IPCB_RayTracerBackgroundConfig.md +223 -0
  366. package/skill/references/interfaces/IPCB_RayTracerLightConfig.md +412 -0
  367. package/skill/references/interfaces/IPCB_RayTracerMaterialConfig.md +547 -0
  368. package/skill/references/interfaces/IPCB_RayTracerPcbMaterialConfig.md +196 -0
  369. package/skill/references/interfaces/IPCB_RayTracerRenderConfigurations.md +200 -0
  370. package/skill/references/interfaces/IPCB_RayTracerRendererConfig.md +196 -0
  371. package/skill/references/interfaces/IPCB_RayTracerSceneElement.md +115 -0
  372. package/skill/references/interfaces/IPCB_RayTracerSceneElementTransform.md +123 -0
  373. package/skill/references/interfaces/IPCB_RayTracerTexture.md +88 -0
  374. package/skill/references/interfaces/IPCB_SubstratePhysicalProperties.md +88 -88
  375. package/skill/references/interfaces/IRawNet.md +103 -103
  376. package/skill/references/interfaces/IRawPureSchematic.md +80 -80
  377. package/skill/references/interfaces/IRawSchematic.md +103 -103
  378. package/skill/references/interfaces/IRawWire.md +149 -149
  379. package/skill/references/interfaces/ISCH_DrcError.md +142 -142
  380. package/skill/references/interfaces/ISCH_DrcErrorPrimitive.md +142 -142
  381. package/skill/references/interfaces/ISCH_ExportPngResolution.md +94 -94
  382. package/skill/references/interfaces/ISCH_NetInfo.md +88 -88
  383. package/skill/references/interfaces/ISCH_Primitive.md +218 -219
  384. package/skill/references/interfaces/ISCH_PrimitiveAPI.md +174 -175
  385. package/skill/references/interfaces/ISCH_ProjectNetInfo.md +142 -142
  386. package/skill/references/interfaces/ISCH_WireInfo.md +169 -169
  387. package/skill/references/interfaces/ISYS_ComparisonResponse.md +115 -0
  388. package/skill/references/interfaces/ISYS_ExtensionExternalApiIndex.md +13 -0
  389. package/skill/references/interfaces/ISYS_ExtensionRegisteredExternalApis.md +13 -0
  390. package/skill/references/interfaces/ISYS_ExternalApiHelp.md +173 -0
  391. package/skill/references/interfaces/ISYS_ExternalApiRegistration.md +146 -0
  392. package/skill/references/interfaces/ISYS_FileSystemFileList.md +169 -169
  393. package/skill/references/interfaces/ISYS_HeaderMenuSub1MenuItem.md +205 -174
  394. package/skill/references/interfaces/ISYS_HeaderMenuSub2MenuItem.md +178 -147
  395. package/skill/references/interfaces/ISYS_HeaderMenuTopMenuItem.md +115 -115
  396. package/skill/references/interfaces/ISYS_HeaderMenus.md +408 -408
  397. package/skill/references/interfaces/ISYS_HelpAudienceEntry.md +92 -0
  398. package/skill/references/interfaces/ISYS_HelpClassSummary.md +205 -0
  399. package/skill/references/interfaces/ISYS_HelpData.md +92 -0
  400. package/skill/references/interfaces/ISYS_HelpMethodDetail.md +310 -0
  401. package/skill/references/interfaces/ISYS_JobHandle.md +65 -0
  402. package/skill/references/interfaces/ISYS_JobLogEntry.md +142 -0
  403. package/skill/references/interfaces/ISYS_JobStatus.md +176 -0
  404. package/skill/references/interfaces/ISYS_LogLine.md +115 -115
  405. package/skill/references/interfaces/ISYS_MathBBox.md +142 -142
  406. package/skill/references/interfaces/ISYS_MathPoint.md +88 -88
  407. package/skill/references/interfaces/ISYS_MathPolygonWithHoles.md +92 -92
  408. package/skill/references/interfaces/ISYS_MessageBusTask.md +115 -115
  409. package/skill/references/interfaces/ISYS_MultilingualLanguagesData.md +12 -12
  410. package/skill/references/interfaces/ISYS_RightClickMenuItem.md +174 -174
  411. package/skill/references/interfaces/ISYS_ShortcutKeyData.md +169 -169
  412. package/skill/references/interfaces/ISYS_ShortcutKeyDataWithCallFn.md +62 -62
  413. package/skill/references/interfaces/ISYS_ShortcutKeyDataWithUserDefinedShortcutKey.md +62 -62
  414. package/skill/references/interfaces/ISYS_WindowEventListenerRemovableObject.md +109 -109
  415. package/skill/references/interfaces/IconProps.md +88 -88
  416. package/skill/references/interfaces/ImageProps.md +115 -115
  417. package/skill/references/interfaces/InputEditConfig.md +182 -0
  418. package/skill/references/interfaces/InputProps.md +547 -520
  419. package/skill/references/interfaces/KeyboardConfig.md +61 -0
  420. package/skill/references/interfaces/ListChildren.md +223 -223
  421. package/skill/references/interfaces/ListProps.md +250 -223
  422. package/skill/references/interfaces/ModalProps.md +358 -358
  423. package/skill/references/interfaces/NumberEditConfig.md +234 -0
  424. package/skill/references/interfaces/RadioGroupProps.md +196 -196
  425. package/skill/references/interfaces/RadioItem.md +115 -115
  426. package/skill/references/interfaces/RichTableProps.md +1357 -0
  427. package/skill/references/interfaces/RowMetaConfig.md +142 -0
  428. package/skill/references/interfaces/ScrollerProps.md +169 -169
  429. package/skill/references/interfaces/SelectEditConfig.md +211 -0
  430. package/skill/references/interfaces/SelectListItem.md +142 -142
  431. package/skill/references/interfaces/SelectOption.md +142 -0
  432. package/skill/references/interfaces/SelectProps.md +169 -169
  433. package/skill/references/interfaces/SelectionConfig.md +358 -0
  434. package/skill/references/interfaces/SliderProps.md +142 -0
  435. package/skill/references/interfaces/SlotProps.md +88 -88
  436. package/skill/references/interfaces/SortState.md +88 -0
  437. package/skill/references/interfaces/SortingConfig.md +169 -0
  438. package/skill/references/interfaces/StyleProps.md +439 -385
  439. package/skill/references/interfaces/TextAreaProps.md +196 -196
  440. package/skill/references/interfaces/TextProps.md +169 -169
  441. package/skill/references/interfaces/TextareaEditConfig.md +182 -0
  442. package/skill/references/interfaces/ValidationRule.md +223 -0
  443. package/skill/references/interfaces/VirtualScrollConfig.md +115 -0
  444. package/skill/references/types/Align.md +9 -0
  445. package/skill/references/types/CellContentType.md +9 -0
  446. package/skill/references/types/ColumnDefOrGroup.md +12 -0
  447. package/skill/references/types/ColumnEditConfig.md +13 -0
  448. package/skill/references/types/ColumnType.md +9 -0
  449. package/skill/references/types/DataChangeType.md +9 -0
  450. package/skill/references/types/FilterMatchMode.md +9 -0
  451. package/skill/references/types/RichTableRow.md +12 -0
  452. package/skill/references/types/Serializable.md +10 -0
  453. package/skill/references/types/SerializablePrimitive.md +9 -0
  454. package/skill/references/types/SortOrder.md +9 -0
  455. package/skill/references/types/TPCB_LayerTypesOfInnerLayer.md +11 -11
  456. package/skill/references/types/TPCB_LayersInTheSelectable.md +42 -42
  457. package/skill/references/types/TPCB_LayersOfComponent.md +11 -11
  458. package/skill/references/types/TPCB_LayersOfCopper.md +15 -15
  459. package/skill/references/types/TPCB_LayersOfCustom.md +41 -41
  460. package/skill/references/types/TPCB_LayersOfDimension.md +16 -16
  461. package/skill/references/types/TPCB_LayersOfFill.md +28 -28
  462. package/skill/references/types/TPCB_LayersOfImage.md +22 -22
  463. package/skill/references/types/TPCB_LayersOfInner.md +41 -41
  464. package/skill/references/types/TPCB_LayersOfLine.md +25 -25
  465. package/skill/references/types/TPCB_LayersOfObject.md +12 -12
  466. package/skill/references/types/TPCB_LayersOfPad.md +11 -11
  467. package/skill/references/types/TPCB_LayersOfRegion.md +11 -11
  468. package/skill/references/types/TPCB_NumberOfCopperLayers.md +9 -9
  469. package/skill/references/types/TPCB_PolygonSourceArray.md +85 -83
  470. package/skill/references/types/TPCB_PrimitiveDimensionCoordinateSet.md +66 -66
  471. package/skill/references/types/TPCB_PrimitivePadHole.md +30 -30
  472. package/skill/references/types/TPCB_PrimitivePadShape.md +61 -61
  473. package/skill/references/types/TPCB_PrimitiveSpecialPadShape.md +19 -19
  474. package/skill/references/types/TSYS_ComparisonErrorCode.md +15 -0
  475. package/skill/references/types/TSYS_LanguageKeyValuePairs.md +13 -0
  476. package/skill/references/types/TSYS_MathPolygonGroup.md +15 -15
  477. package/skill/references/types/TSYS_MathPolygonInput.md +20 -20
  478. package/skill/references/types/TSYS_ShortcutKeys.md +96 -96
  479. package/skill/user-guide/using-extension.md +47 -47
  480. package/src/json-gen.test.js +430 -0
  481. package/skill/guide/ancillary-projects/pro-api-sdk.md +0 -1
  482. package/skill/references/interfaces/ISYS_PcbComparisonResponse.md +0 -115
  483. package/skill/references/types/ISYS_LanguageKeyValuePairs.md +0 -13
  484. package/skill/references/types/TSYS_PcbComparisonErrorCode.md +0 -10
@@ -1,1332 +1,1332 @@
1
- # IPCB\_PrimitiveRegion class
2
-
3
- Region primitive
4
-
5
- ## Signature
6
-
7
- ```typescript
8
- class IPCB_PrimitiveRegion implements IPCB_Primitive
9
- ```
10
- **Implements:** [IPCB\_Primitive](../interfaces/IPCB_Primitive.md)
11
-
12
- ## Remarks
13
-
14
- ## Methods
15
-
16
- <table><thead><tr><th>
17
-
18
- Method
19
-
20
- </th><th>
21
-
22
- Modifiers
23
-
24
- </th><th>
25
-
26
- Description
27
-
28
- </th></tr></thead>
29
- <tbody><tr><td>
30
-
31
- [convertToFill()](./IPCB_PrimitiveRegion.md)
32
-
33
- </td><td>
34
-
35
- </td><td>
36
-
37
- **_(BETA)_** Convert to: fill primitive
38
-
39
- </td></tr>
40
- <tr><td>
41
-
42
- [convertToPolyline()](./IPCB_PrimitiveRegion.md)
43
-
44
- </td><td>
45
-
46
- </td><td>
47
-
48
- **_(BETA)_** Convert to: polyline primitive
49
-
50
- </td></tr>
51
- <tr><td>
52
-
53
- [convertToPour()](./IPCB_PrimitiveRegion.md)
54
-
55
- </td><td>
56
-
57
- </td><td>
58
-
59
- **_(BETA)_** Convert to: Copper border primitive
60
-
61
- </td></tr>
62
- <tr><td>
63
-
64
- [done()](./IPCB_PrimitiveRegion.md)
65
-
66
- </td><td>
67
-
68
- </td><td>
69
-
70
- **_(BETA)_** Apply the changes to the primitives to the canvas
71
-
72
- </td></tr>
73
- <tr><td>
74
-
75
- [getState\_ComplexPolygon()](./IPCB_PrimitiveRegion.md)
76
-
77
- </td><td>
78
-
79
- </td><td>
80
-
81
- Get the property state: complex polygon
82
-
83
- </td></tr>
84
- <tr><td>
85
-
86
- [getState\_Layer()](./IPCB_PrimitiveRegion.md)
87
-
88
- </td><td>
89
-
90
- </td><td>
91
-
92
- Get the property state: Layer
93
-
94
- </td></tr>
95
- <tr><td>
96
-
97
- [getState\_LineWidth()](./IPCB_PrimitiveRegion.md)
98
-
99
- </td><td>
100
-
101
- </td><td>
102
-
103
- Get the property state: Line width
104
-
105
- </td></tr>
106
- <tr><td>
107
-
108
- [getState\_PrimitiveId()](./IPCB_PrimitiveRegion.md)
109
-
110
- </td><td>
111
-
112
- </td><td>
113
-
114
- Get the property state: primitive ID
115
-
116
- </td></tr>
117
- <tr><td>
118
-
119
- [getState\_PrimitiveLock()](./IPCB_PrimitiveRegion.md)
120
-
121
- </td><td>
122
-
123
- </td><td>
124
-
125
- Get the property state: whether it is locked
126
-
127
- </td></tr>
128
- <tr><td>
129
-
130
- [getState\_PrimitiveType()](./IPCB_PrimitiveRegion.md)
131
-
132
- </td><td>
133
-
134
- </td><td>
135
-
136
- Get the property state: primitive type
137
-
138
- </td></tr>
139
- <tr><td>
140
-
141
- [getState\_RegionName()](./IPCB_PrimitiveRegion.md)
142
-
143
- </td><td>
144
-
145
- </td><td>
146
-
147
- Get the property state: region name
148
-
149
- </td></tr>
150
- <tr><td>
151
-
152
- [getState\_RuleType()](./IPCB_PrimitiveRegion.md)
153
-
154
- </td><td>
155
-
156
- </td><td>
157
-
158
- Get the property state: region rule type
159
-
160
- </td></tr>
161
- <tr><td>
162
-
163
- [isAsync()](./IPCB_PrimitiveRegion.md)
164
-
165
- </td><td>
166
-
167
- </td><td>
168
-
169
- Query whether the primitive is an async primitive
170
-
171
- </td></tr>
172
- <tr><td>
173
-
174
- [reset()](./IPCB_PrimitiveRegion.md)
175
-
176
- </td><td>
177
-
178
- </td><td>
179
-
180
- **_(BETA)_** Reset the async primitive to the current canvas state
181
-
182
- </td></tr>
183
- <tr><td>
184
-
185
- [setState\_ComplexPolygon(complexPolygon)](./IPCB_PrimitiveRegion.md)
186
-
187
- </td><td>
188
-
189
- </td><td>
190
-
191
- **_(BETA)_** Set the property state: complex polygon
192
-
193
- </td></tr>
194
- <tr><td>
195
-
196
- [setState\_Layer(layer)](./IPCB_PrimitiveRegion.md)
197
-
198
- </td><td>
199
-
200
- </td><td>
201
-
202
- **_(BETA)_** Set the property state: Layer
203
-
204
- </td></tr>
205
- <tr><td>
206
-
207
- [setState\_LineWidth(lineWidth)](./IPCB_PrimitiveRegion.md)
208
-
209
- </td><td>
210
-
211
- </td><td>
212
-
213
- **_(BETA)_** Set the property state: Line width
214
-
215
- </td></tr>
216
- <tr><td>
217
-
218
- [setState\_PrimitiveLock(primitiveLock)](./IPCB_PrimitiveRegion.md)
219
-
220
- </td><td>
221
-
222
- </td><td>
223
-
224
- **_(BETA)_** Set the property state: whether it is locked
225
-
226
- </td></tr>
227
- <tr><td>
228
-
229
- [setState\_RegionName(regionName)](./IPCB_PrimitiveRegion.md)
230
-
231
- </td><td>
232
-
233
- </td><td>
234
-
235
- **_(BETA)_** Set the property state: region name
236
-
237
- </td></tr>
238
- <tr><td>
239
-
240
- [setState\_RuleType(ruleType)](./IPCB_PrimitiveRegion.md)
241
-
242
- </td><td>
243
-
244
- </td><td>
245
-
246
- **_(BETA)_** Set the property state: region rule type
247
-
248
- </td></tr>
249
- <tr><td>
250
-
251
- [toAsync()](./IPCB_PrimitiveRegion.md)
252
-
253
- </td><td>
254
-
255
- </td><td>
256
-
257
- Convert Primitive to Async primitive
258
-
259
- </td></tr>
260
- <tr><td>
261
-
262
- [toSync()](./IPCB_PrimitiveRegion.md)
263
-
264
- </td><td>
265
-
266
- </td><td>
267
-
268
- Convert Primitive to Sync primitive
269
-
270
- </td></tr>
271
- </tbody></table>
272
-
273
- ---
274
-
275
- ## 方法详情
276
-
277
- ### converttofill
278
-
279
- # IPCB\_PrimitiveRegion.convertToFill() method
280
-
281
- > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
282
-
283
- Convert to: fill primitive
284
-
285
- ## Signature
286
-
287
- ```typescript
288
- function convertToFill(): Promise<IPCB_PrimitiveFill>;
289
- ```
290
-
291
- ## Returns
292
-
293
- Promise&lt;[IPCB\_PrimitiveFill](./IPCB_PrimitiveFill.md)<!-- -->&gt;
294
-
295
- Fill primitive object
296
-
297
- ## Example
298
-
299
- ```javascript
300
- // 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
301
- const x = 2000 + Math.floor(Math.random() * 100000);
302
- const y = 2000 + Math.floor(Math.random() * 100000);
303
-
304
- // 2. 创建一个矩形区域
305
- const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
306
- const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
307
-
308
- // 3. 转换为填充图元(区域本身保留,填充为新图元,保留现场供观察)
309
- const fill = await region.convertToFill();
310
-
311
- console.log('primitiveType:', `Region → ${fill.getState_PrimitiveType()}`);
312
- console.log('primitiveId:', fill.getState_PrimitiveId());
313
- ```
314
-
315
- ### converttopolyline
316
-
317
- # IPCB\_PrimitiveRegion.convertToPolyline() method
318
-
319
- > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
320
-
321
- Convert to: polyline primitive
322
-
323
- ## Signature
324
-
325
- ```typescript
326
- function convertToPolyline(): Promise<IPCB_PrimitivePolyline>;
327
- ```
328
-
329
- ## Returns
330
-
331
- Promise&lt;[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)<!-- -->&gt;
332
-
333
- Polyline primitive object
334
-
335
- ## Example
336
-
337
- ```javascript
338
- // 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
339
- const x = 2000 + Math.floor(Math.random() * 100000);
340
- const y = 2000 + Math.floor(Math.random() * 100000);
341
-
342
- // 2. 创建一个矩形区域
343
- const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
344
- const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
345
-
346
- // 3. 转换为折线图元(区域本身保留,折线为新图元,保留现场供观察)
347
- const polyline = await region.convertToPolyline();
348
-
349
- console.log('primitiveType:', `Region → ${polyline.getState_PrimitiveType()}`);
350
- console.log('primitiveId:', polyline.getState_PrimitiveId());
351
- ```
352
-
353
- ### converttopour
354
-
355
- # IPCB\_PrimitiveRegion.convertToPour() method
356
-
357
- > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
358
-
359
- Convert to: Copper border primitive
360
-
361
- ## Signature
362
-
363
- ```typescript
364
- function convertToPour(): Promise<IPCB_PrimitivePour>;
365
- ```
366
-
367
- ## Returns
368
-
369
- Promise&lt;[IPCB\_PrimitivePour](./IPCB_PrimitivePour.md)<!-- -->&gt;
370
-
371
- Copper border primitive object
372
-
373
- ## Example
374
-
375
- ```javascript
376
- // 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
377
- const x = 2000 + Math.floor(Math.random() * 100000);
378
- const y = 2000 + Math.floor(Math.random() * 100000);
379
-
380
- // 2. 创建一个矩形区域
381
- const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
382
- const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
383
-
384
- // 3. 转换为覆铜边框图元(区域本身保留,覆铜边框为新图元,保留现场供观察)
385
- const pour = await region.convertToPour();
386
-
387
- console.log('primitiveType:', `Region → ${pour.getState_PrimitiveType()}`);
388
- console.log('primitiveId:', pour.getState_PrimitiveId());
389
- ```
390
-
391
- ### done
392
-
393
- # IPCB\_PrimitiveRegion.done() method
394
-
395
- > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
396
-
397
- Apply the changes to the primitives to the canvas
398
-
399
- ## Signature
400
-
401
- ```typescript
402
- function done(): Promise<IPCB_PrimitiveRegion>;
403
- ```
404
-
405
- ## Returns
406
-
407
- Promise&lt;[IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)<!-- -->&gt;
408
-
409
- Region primitive object
410
-
411
- ## Example
412
-
413
- ```javascript
414
- // 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
415
- const x = 2000 + Math.floor(Math.random() * 100000);
416
- const y = 2000 + Math.floor(Math.random() * 100000);
417
-
418
- // 2. 创建一个顶层铜层(1)的矩形区域
419
- const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
420
- const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
421
- const before = region.getState_Layer();
422
-
423
- // 3. 异步模式下把区域挪到底层铜层(此时画布还没变)
424
- const asyncRegion = region.toAsync();
425
- asyncRegion.setState_Layer(2);
426
- await asyncRegion.done();
427
-
428
- // 4. 从画布重新读取,确认修改已生效(保留现场供观察)
429
- const refetched = await eda.pcb_PrimitiveRegion.get(region.getState_PrimitiveId());
430
-
431
- console.log('layer:', before, '→', refetched.getState_Layer());
432
- ```
433
-
434
- ### getstate_complexpolygon
435
-
436
- # IPCB\_PrimitiveRegion.getState\_ComplexPolygon() method
437
-
438
- Get the property state: complex polygon
439
-
440
- ## Signature
441
-
442
- ```typescript
443
- function getState_ComplexPolygon(): IPCB_Polygon;
444
- ```
445
-
446
- ## Returns
447
-
448
- [IPCB\_Polygon](./IPCB_Polygon.md)
449
-
450
- Complex polygon
451
-
452
- ## Example
453
-
454
- ```javascript
455
- // 1. 创建一个已知轮廓的矩形区域(500 x 300 mil)
456
- const x = 2000 + Math.floor(Math.random() * 100000);
457
- const y = 2000 + Math.floor(Math.random() * 100000);
458
- const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
459
- const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
460
-
461
- // 2. 读取复杂多边形对象,再取它的轮廓源数组
462
- const complexPolygon = region.getState_ComplexPolygon();
463
- const source = complexPolygon.getSource();
464
-
465
- // 3. 清理测试图元(查询类案例不留测试对象)
466
- await eda.pcb_PrimitiveRegion.delete([region.getState_PrimitiveId()]);
467
-
468
- console.log('polygonSource:', JSON.stringify(source));
469
- ```
470
-
471
- ### getstate_layer
472
-
473
- # IPCB\_PrimitiveRegion.getState\_Layer() method
474
-
475
- Get the property state: Layer
476
-
477
- ## Signature
478
-
479
- ```typescript
480
- function getState_Layer(): TPCB_LayersOfRegion;
481
- ```
482
-
483
- ## Returns
484
-
485
- [TPCB\_LayersOfRegion](../types/TPCB_LayersOfRegion.md)
486
-
487
- Layer
488
-
489
- ## Example
490
-
491
- ```javascript
492
- // 1. 创建一个顶层铜层(1)的矩形区域
493
- const x = 2000 + Math.floor(Math.random() * 100000);
494
- const y = 2000 + Math.floor(Math.random() * 100000);
495
- const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
496
- const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
497
-
498
- // 2. 读取所在层
499
- const layer = region.getState_Layer();
500
-
501
- // 3. 清理测试图元(查询类案例不留测试对象)
502
- await eda.pcb_PrimitiveRegion.delete([region.getState_PrimitiveId()]);
503
-
504
- console.log('layer:', layer);
505
- ```
506
-
507
- ### getstate_linewidth
508
-
509
- # IPCB\_PrimitiveRegion.getState\_LineWidth() method
510
-
511
- Get the property state: Line width
512
-
513
- ## Signature
514
-
515
- ```typescript
516
- function getState_LineWidth(): number;
517
- ```
518
-
519
- ## Returns
520
-
521
- number
522
-
523
- Line width
524
-
525
- ## Example
526
-
527
- ```javascript
528
- // 1. 创建一个 10mil 线宽的矩形区域
529
- const x = 2000 + Math.floor(Math.random() * 100000);
530
- const y = 2000 + Math.floor(Math.random() * 100000);
531
- const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
532
- const region = await eda.pcb_PrimitiveRegion.create(1, polygon, undefined, undefined, 10, false);
533
-
534
- // 2. 读取线宽
535
- const lineWidth = region.getState_LineWidth();
536
-
537
- // 3. 清理测试图元(查询类案例不留测试对象)
538
- await eda.pcb_PrimitiveRegion.delete([region.getState_PrimitiveId()]);
539
-
540
- console.log('lineWidth:', lineWidth);
541
- ```
542
-
543
- ### getstate_primitiveid
544
-
545
- # IPCB\_PrimitiveRegion.getState\_PrimitiveId() method
546
-
547
- Get the property state: primitive ID
548
-
549
- ## Signature
550
-
551
- ```typescript
552
- function getState_PrimitiveId(): string;
553
- ```
554
-
555
- ## Returns
556
-
557
- string
558
-
559
- Primitive ID
560
-
561
- ## Example
562
-
563
- ```javascript
564
- // 1. 创建一个矩形区域
565
- const x = 2000 + Math.floor(Math.random() * 100000);
566
- const y = 2000 + Math.floor(Math.random() * 100000);
567
- const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
568
- const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
569
-
570
- // 2. 读取图元 ID
571
- const primitiveId = region.getState_PrimitiveId();
572
-
573
- // 3. 清理测试图元(查询类案例不留测试对象)
574
- await eda.pcb_PrimitiveRegion.delete([region.getState_PrimitiveId()]);
575
-
576
- console.log('primitiveId:', primitiveId);
577
- ```
578
-
579
- ### getstate_primitivelock
580
-
581
- # IPCB\_PrimitiveRegion.getState\_PrimitiveLock() method
582
-
583
- Get the property state: whether it is locked
584
-
585
- ## Signature
586
-
587
- ```typescript
588
- function getState_PrimitiveLock(): boolean;
589
- ```
590
-
591
- ## Returns
592
-
593
- boolean
594
-
595
- Whether it is locked
596
-
597
- ## Example
598
-
599
- ```javascript
600
- // 1. 创建一个未锁定的矩形区域
601
- const x = 2000 + Math.floor(Math.random() * 100000);
602
- const y = 2000 + Math.floor(Math.random() * 100000);
603
- const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
604
- const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
605
-
606
- // 2. 读取锁定状态
607
- const primitiveLock = region.getState_PrimitiveLock();
608
-
609
- // 3. 清理测试图元(查询类案例不留测试对象)
610
- await eda.pcb_PrimitiveRegion.delete([region.getState_PrimitiveId()]);
611
-
612
- console.log('primitiveLock:', primitiveLock);
613
- ```
614
-
615
- ### getstate_primitivetype
616
-
617
- # IPCB\_PrimitiveRegion.getState\_PrimitiveType() method
618
-
619
- Get the property state: primitive type
620
-
621
- ## Signature
622
-
623
- ```typescript
624
- function getState_PrimitiveType(): EPCB_PrimitiveType;
625
- ```
626
-
627
- ## Returns
628
-
629
- [EPCB\_PrimitiveType](../enums/EPCB_PrimitiveType.md)
630
-
631
- Primitive type
632
-
633
- ## Example
634
-
635
- ```javascript
636
- // 1. 创建一个矩形区域
637
- const x = 2000 + Math.floor(Math.random() * 100000);
638
- const y = 2000 + Math.floor(Math.random() * 100000);
639
- const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
640
- const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
641
-
642
- // 2. 读取图元类型
643
- const primitiveType = region.getState_PrimitiveType();
644
-
645
- // 3. 清理测试图元(查询类案例不留测试对象)
646
- await eda.pcb_PrimitiveRegion.delete([region.getState_PrimitiveId()]);
647
-
648
- console.log('primitiveType:', primitiveType);
649
- ```
650
-
651
- ### getstate_regionname
652
-
653
- # IPCB\_PrimitiveRegion.getState\_RegionName() method
654
-
655
- Get the property state: region name
656
-
657
- ## Signature
658
-
659
- ```typescript
660
- function getState_RegionName(): string | undefined;
661
- ```
662
-
663
- ## Returns
664
-
665
- string \| undefined
666
-
667
- Region name
668
-
669
- ## Example
670
-
671
- ```javascript
672
- // 1. 创建一个带名称的约束区域(ruleType=9 即 FOLLOW_REGION_RULE)
673
- const x = 2000 + Math.floor(Math.random() * 100000);
674
- const y = 2000 + Math.floor(Math.random() * 100000);
675
- const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
676
- const region = await eda.pcb_PrimitiveRegion.create(1, polygon, [9], '嘉立创示例_电源约束区');
677
-
678
- // 2. 读取区域名称
679
- const regionName = region.getState_RegionName();
680
-
681
- // 3. 清理测试图元(查询类案例不留测试对象)
682
- await eda.pcb_PrimitiveRegion.delete([region.getState_PrimitiveId()]);
683
-
684
- console.log('regionName:', regionName);
685
- ```
686
-
687
- ### getstate_ruletype
688
-
689
- # IPCB\_PrimitiveRegion.getState\_RuleType() method
690
-
691
- Get the property state: region rule type
692
-
693
- ## Signature
694
-
695
- ```typescript
696
- function getState_RuleType(): Array<EPCB_PrimitiveRegionRuleType>;
697
- ```
698
-
699
- ## Returns
700
-
701
- Array&lt;[EPCB\_PrimitiveRegionRuleType](../enums/EPCB_PrimitiveRegionRuleType.md)<!-- -->&gt;
702
-
703
- Region rule type
704
-
705
- ## Example
706
-
707
- ```javascript
708
- // 1. 创建一个"禁止元件"(NO_COMPONENTS=2)的规则区域
709
- const x = 2000 + Math.floor(Math.random() * 100000);
710
- const y = 2000 + Math.floor(Math.random() * 100000);
711
- const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
712
- const region = await eda.pcb_PrimitiveRegion.create(1, polygon, [2]);
713
-
714
- // 2. 读取规则类型数组(枚举值:2=禁止元件, 5=禁止导线, 6=禁止填充, 7=禁止覆铜, 8=禁止内电层, 9=约束区域)
715
- const ruleType = region.getState_RuleType();
716
-
717
- // 3. 清理测试图元(查询类案例不留测试对象)
718
- await eda.pcb_PrimitiveRegion.delete([region.getState_PrimitiveId()]);
719
-
720
- console.log('ruleType:', JSON.stringify(ruleType));
721
- ```
722
-
723
- ### isasync
724
-
725
- # IPCB\_PrimitiveRegion.isAsync() method
726
-
727
- Query whether the primitive is an async primitive
728
-
729
- ## Signature
730
-
731
- ```typescript
732
- function isAsync(): boolean;
733
- ```
734
-
735
- ## Returns
736
-
737
- boolean
738
-
739
- Whether Is async primitive
740
-
741
- ## Example
742
-
743
- ```javascript
744
- // 1. 创建一个矩形区域
745
- const x = 2000 + Math.floor(Math.random() * 100000);
746
- const y = 2000 + Math.floor(Math.random() * 100000);
747
- const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
748
- const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
749
-
750
- // 2. 查询异步模式
751
- const isAsync = region.isAsync();
752
-
753
- // 3. 清理测试图元(查询类案例不留测试对象)
754
- await eda.pcb_PrimitiveRegion.delete([region.getState_PrimitiveId()]);
755
-
756
- console.log('isAsync:', isAsync);
757
- ```
758
-
759
- ### reset
760
-
761
- # IPCB\_PrimitiveRegion.reset() method
762
-
763
- > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
764
-
765
- Reset the async primitive to the current canvas state
766
-
767
- ## Signature
768
-
769
- ```typescript
770
- function reset(): Promise<IPCB_PrimitiveRegion>;
771
- ```
772
-
773
- ## Returns
774
-
775
- Promise&lt;[IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)<!-- -->&gt;
776
-
777
- Region primitive object
778
-
779
- ## Example
780
-
781
- ```javascript
782
- // 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
783
- const x = 2000 + Math.floor(Math.random() * 100000);
784
- const y = 2000 + Math.floor(Math.random() * 100000);
785
-
786
- // 2. 创建一个顶层铜层的矩形区域
787
- const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
788
- const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
789
- const before = region.getState_Layer();
790
-
791
- // 3. 异步模式下把层改到底层(2),随后反悔
792
- const asyncRegion = region.toAsync();
793
- asyncRegion.setState_Layer(2);
794
-
795
- // 4. reset 丢弃未提交的修改(保留现场供观察)
796
- await asyncRegion.reset();
797
-
798
- // 5. 从画布重新读取,确认层没有变
799
- const refetched = await eda.pcb_PrimitiveRegion.get(region.getState_PrimitiveId());
800
-
801
- console.log('layer:', before, '→', refetched.getState_Layer());
802
- ```
803
-
804
- ### setstate_complexpolygon
805
-
806
- # IPCB\_PrimitiveRegion.setState\_ComplexPolygon() method
807
-
808
- > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
809
-
810
- Set the property state: complex polygon
811
-
812
- ## Signature
813
-
814
- ```typescript
815
- function setState_ComplexPolygon(complexPolygon: IPCB_Polygon): IPCB_PrimitiveRegion;
816
- ```
817
-
818
- ## Parameters
819
-
820
- <table><thead><tr><th>
821
-
822
- Parameter
823
-
824
- </th><th>
825
-
826
- Type
827
-
828
- </th><th>
829
-
830
- Description
831
-
832
- </th></tr></thead>
833
- <tbody><tr><td>
834
-
835
- complexPolygon
836
-
837
- </td><td>
838
-
839
- [IPCB\_Polygon](./IPCB_Polygon.md)
840
-
841
- </td><td>
842
-
843
- Complex polygon
844
-
845
- </td></tr>
846
- </tbody></table>
847
-
848
- ## Returns
849
-
850
- [IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)
851
-
852
- Region primitive object
853
-
854
- ## Example
855
-
856
- ```javascript
857
- // 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
858
- const x = 2000 + Math.floor(Math.random() * 100000);
859
- const y = 2000 + Math.floor(Math.random() * 100000);
860
-
861
- // 2. 创建一个 500 x 300 的矩形区域
862
- const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
863
- const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
864
- const before = JSON.stringify(region.getState_ComplexPolygon().getSource());
865
-
866
- // 3. 构造新轮廓(放大到 800 x 400),异步模式提交
867
- const newPolygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 800, 400, 0, 0]);
868
- const asyncRegion = region.toAsync();
869
- asyncRegion.setState_ComplexPolygon(newPolygon);
870
- await asyncRegion.done();
871
-
872
- // 4. 从画布重新读取,确认轮廓已替换(保留现场供观察)
873
- const refetched = await eda.pcb_PrimitiveRegion.get(region.getState_PrimitiveId());
874
- const after = JSON.stringify(refetched.getState_ComplexPolygon().getSource());
875
-
876
- console.log('polygonSource:', before, '→', after);
877
- ```
878
-
879
- ### setstate_layer
880
-
881
- # IPCB\_PrimitiveRegion.setState\_Layer() method
882
-
883
- > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
884
-
885
- Set the property state: Layer
886
-
887
- ## Signature
888
-
889
- ```typescript
890
- function setState_Layer(layer: TPCB_LayersOfRegion): IPCB_PrimitiveRegion;
891
- ```
892
-
893
- ## Parameters
894
-
895
- <table><thead><tr><th>
896
-
897
- Parameter
898
-
899
- </th><th>
900
-
901
- Type
902
-
903
- </th><th>
904
-
905
- Description
906
-
907
- </th></tr></thead>
908
- <tbody><tr><td>
909
-
910
- layer
911
-
912
- </td><td>
913
-
914
- [TPCB\_LayersOfRegion](../types/TPCB_LayersOfRegion.md)
915
-
916
- </td><td>
917
-
918
- Layer
919
-
920
- </td></tr>
921
- </tbody></table>
922
-
923
- ## Returns
924
-
925
- [IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)
926
-
927
- Region primitive object
928
-
929
- ## Example
930
-
931
- ```javascript
932
- // 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
933
- const x = 2000 + Math.floor(Math.random() * 100000);
934
- const y = 2000 + Math.floor(Math.random() * 100000);
935
-
936
- // 2. 创建一个顶层铜层(1)的矩形区域
937
- const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
938
- const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
939
- const before = region.getState_Layer();
940
-
941
- // 3. 异步模式把区域挪到底层铜层(2)
942
- const asyncRegion = region.toAsync();
943
- asyncRegion.setState_Layer(2);
944
- await asyncRegion.done();
945
-
946
- // 4. 从画布重新读取,确认层已切换(保留现场供观察)
947
- const refetched = await eda.pcb_PrimitiveRegion.get(region.getState_PrimitiveId());
948
-
949
- console.log('layer:', before, '→', refetched.getState_Layer());
950
- ```
951
-
952
- ### setstate_linewidth
953
-
954
- # IPCB\_PrimitiveRegion.setState\_LineWidth() method
955
-
956
- > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
957
-
958
- Set the property state: Line width
959
-
960
- ## Signature
961
-
962
- ```typescript
963
- function setState_LineWidth(lineWidth: number): IPCB_PrimitiveRegion;
964
- ```
965
-
966
- ## Parameters
967
-
968
- <table><thead><tr><th>
969
-
970
- Parameter
971
-
972
- </th><th>
973
-
974
- Type
975
-
976
- </th><th>
977
-
978
- Description
979
-
980
- </th></tr></thead>
981
- <tbody><tr><td>
982
-
983
- lineWidth
984
-
985
- </td><td>
986
-
987
- number
988
-
989
- </td><td>
990
-
991
- Line width
992
-
993
- </td></tr>
994
- </tbody></table>
995
-
996
- ## Returns
997
-
998
- [IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)
999
-
1000
- Region primitive object
1001
-
1002
- ## Example
1003
-
1004
- ```javascript
1005
- // 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
1006
- const x = 2000 + Math.floor(Math.random() * 100000);
1007
- const y = 2000 + Math.floor(Math.random() * 100000);
1008
-
1009
- // 2. 创建一个 10mil 线宽的矩形区域
1010
- const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
1011
- const region = await eda.pcb_PrimitiveRegion.create(1, polygon, undefined, undefined, 10, false);
1012
- const before = region.getState_LineWidth();
1013
-
1014
- // 3. 切换异步模式,线宽加粗到 20mil
1015
- const asyncRegion = region.toAsync();
1016
- asyncRegion.setState_LineWidth(20);
1017
- await asyncRegion.done();
1018
-
1019
- // 4. 从图元对象读回新值(保留现场供观察)
1020
- // 注:同族 Fill/Pour 的线宽修改画布侧不落,此处从图元对象读回确认
1021
- const after = region.getState_LineWidth();
1022
-
1023
- console.log('lineWidth:', before, '→', after);
1024
- ```
1025
-
1026
- ### setstate_primitivelock
1027
-
1028
- # IPCB\_PrimitiveRegion.setState\_PrimitiveLock() method
1029
-
1030
- > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
1031
-
1032
- Set the property state: whether it is locked
1033
-
1034
- ## Signature
1035
-
1036
- ```typescript
1037
- function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitiveRegion;
1038
- ```
1039
-
1040
- ## Parameters
1041
-
1042
- <table><thead><tr><th>
1043
-
1044
- Parameter
1045
-
1046
- </th><th>
1047
-
1048
- Type
1049
-
1050
- </th><th>
1051
-
1052
- Description
1053
-
1054
- </th></tr></thead>
1055
- <tbody><tr><td>
1056
-
1057
- primitiveLock
1058
-
1059
- </td><td>
1060
-
1061
- boolean
1062
-
1063
- </td><td>
1064
-
1065
- Whether it is locked
1066
-
1067
- </td></tr>
1068
- </tbody></table>
1069
-
1070
- ## Returns
1071
-
1072
- [IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)
1073
-
1074
- Region primitive object
1075
-
1076
- ## Example
1077
-
1078
- ```javascript
1079
- // 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
1080
- const x = 2000 + Math.floor(Math.random() * 100000);
1081
- const y = 2000 + Math.floor(Math.random() * 100000);
1082
-
1083
- // 2. 创建一个未锁定的矩形区域
1084
- const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
1085
- const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
1086
- const before = region.getState_PrimitiveLock();
1087
-
1088
- // 3. 切换异步模式并锁定区域
1089
- const asyncRegion = region.toAsync();
1090
- asyncRegion.setState_PrimitiveLock(true);
1091
- await asyncRegion.done();
1092
-
1093
- // 4. 从画布重新读取,确认已锁定(保留现场供观察)
1094
- const refetched = await eda.pcb_PrimitiveRegion.get(region.getState_PrimitiveId());
1095
-
1096
- console.log('primitiveLock:', before, '→', refetched.getState_PrimitiveLock());
1097
- ```
1098
-
1099
- ### setstate_regionname
1100
-
1101
- # IPCB\_PrimitiveRegion.setState\_RegionName() method
1102
-
1103
- > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
1104
-
1105
- Set the property state: region name
1106
-
1107
- ## Signature
1108
-
1109
- ```typescript
1110
- function setState_RegionName(regionName?: string): IPCB_PrimitiveRegion;
1111
- ```
1112
-
1113
- ## Parameters
1114
-
1115
- <table><thead><tr><th>
1116
-
1117
- Parameter
1118
-
1119
- </th><th>
1120
-
1121
- Type
1122
-
1123
- </th><th>
1124
-
1125
- Description
1126
-
1127
- </th></tr></thead>
1128
- <tbody><tr><td>
1129
-
1130
- regionName
1131
-
1132
- </td><td>
1133
-
1134
- string
1135
-
1136
- </td><td>
1137
-
1138
- _(Optional)_ Region name
1139
-
1140
- </td></tr>
1141
- </tbody></table>
1142
-
1143
- ## Returns
1144
-
1145
- [IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)
1146
-
1147
- Region primitive object
1148
-
1149
- ## Remarks
1150
-
1151
- Only valid when `ruleType` is [EPCB\_PrimitiveRegionRuleType.FOLLOW\_REGION\_RULE](../enums/EPCB_PrimitiveRegionRuleType.md)<!-- -->, used to match region DRC rules
1152
-
1153
- If `ruleType` is [EPCB\_PrimitiveRegionRuleType.FOLLOW\_REGION\_RULE](../enums/EPCB_PrimitiveRegionRuleType.md) but `regionName` is empty, the system will automatically assign a name
1154
-
1155
- ## Example
1156
-
1157
- ```javascript
1158
- // 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
1159
- const x = 2000 + Math.floor(Math.random() * 100000);
1160
- const y = 2000 + Math.floor(Math.random() * 100000);
1161
-
1162
- // 2. 创建一个带名称的约束区域(ruleType=9 即 FOLLOW_REGION_RULE)
1163
- const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
1164
- const region = await eda.pcb_PrimitiveRegion.create(1, polygon, [9], '嘉立创示例_旧区域名');
1165
- const before = region.getState_RegionName();
1166
-
1167
- // 3. 异步模式修改区域名称
1168
- const asyncRegion = region.toAsync();
1169
- asyncRegion.setState_RegionName('嘉立创示例_电源约束区');
1170
- await asyncRegion.done();
1171
-
1172
- // 4. 从图元对象读回新值(保留现场供观察)
1173
- // 注:当前版本名称修改画布侧不落(重新 get() 仍是旧名),修改在图元对象上生效
1174
- const after = region.getState_RegionName();
1175
-
1176
- console.log('regionName:', before, '→', after);
1177
- ```
1178
-
1179
- ### setstate_ruletype
1180
-
1181
- # IPCB\_PrimitiveRegion.setState\_RuleType() method
1182
-
1183
- > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
1184
-
1185
- Set the property state: region rule type
1186
-
1187
- ## Signature
1188
-
1189
- ```typescript
1190
- function setState_RuleType(ruleType: Array<EPCB_PrimitiveRegionRuleType>): IPCB_PrimitiveRegion;
1191
- ```
1192
-
1193
- ## Parameters
1194
-
1195
- <table><thead><tr><th>
1196
-
1197
- Parameter
1198
-
1199
- </th><th>
1200
-
1201
- Type
1202
-
1203
- </th><th>
1204
-
1205
- Description
1206
-
1207
- </th></tr></thead>
1208
- <tbody><tr><td>
1209
-
1210
- ruleType
1211
-
1212
- </td><td>
1213
-
1214
- Array&lt;[EPCB\_PrimitiveRegionRuleType](../enums/EPCB_PrimitiveRegionRuleType.md)<!-- -->&gt;
1215
-
1216
- </td><td>
1217
-
1218
- Region rule type
1219
-
1220
- </td></tr>
1221
- </tbody></table>
1222
-
1223
- ## Returns
1224
-
1225
- [IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)
1226
-
1227
- Region primitive object
1228
-
1229
- ## Example
1230
-
1231
- ```javascript
1232
- // 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
1233
- const x = 2000 + Math.floor(Math.random() * 100000);
1234
- const y = 2000 + Math.floor(Math.random() * 100000);
1235
-
1236
- // 2. 创建一个不带规则的矩形区域
1237
- const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
1238
- const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
1239
- const before = JSON.stringify(region.getState_RuleType());
1240
-
1241
- // 3. 异步模式挂上"禁止元件 + 禁止导线"两条规则(2=NO_COMPONENTS, 5=NO_WIRES)
1242
- const asyncRegion = region.toAsync();
1243
- asyncRegion.setState_RuleType([2, 5]);
1244
- await asyncRegion.done();
1245
-
1246
- // 4. 从画布重新读取,确认规则已更新(保留现场供观察)
1247
- const refetched = await eda.pcb_PrimitiveRegion.get(region.getState_PrimitiveId());
1248
-
1249
- console.log('ruleType:', before, '→', JSON.stringify(refetched.getState_RuleType()));
1250
- ```
1251
-
1252
- ### toasync
1253
-
1254
- # IPCB\_PrimitiveRegion.toAsync() method
1255
-
1256
- Convert Primitive to Async primitive
1257
-
1258
- ## Signature
1259
-
1260
- ```typescript
1261
- function toAsync(): IPCB_PrimitiveRegion;
1262
- ```
1263
-
1264
- ## Returns
1265
-
1266
- [IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)
1267
-
1268
- Region primitive object
1269
-
1270
- ## Example
1271
-
1272
- ```javascript
1273
- // 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
1274
- const x = 2000 + Math.floor(Math.random() * 100000);
1275
- const y = 2000 + Math.floor(Math.random() * 100000);
1276
-
1277
- // 2. 创建一个顶层铜层的矩形区域
1278
- const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
1279
- const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
1280
-
1281
- // 3. 切换异步模式后批量修改:挪到底层 + 挂"禁止元件"规则
1282
- const asyncRegion = region.toAsync();
1283
- asyncRegion.setState_Layer(2);
1284
- asyncRegion.setState_RuleType([2]);
1285
- await asyncRegion.done();
1286
-
1287
- // 4. 从画布重新读取,确认批量修改已生效(保留现场供观察)
1288
- const refetched = await eda.pcb_PrimitiveRegion.get(region.getState_PrimitiveId());
1289
-
1290
- console.log('layer:', refetched.getState_Layer());
1291
- console.log('ruleType:', JSON.stringify(refetched.getState_RuleType()));
1292
- ```
1293
-
1294
- ### tosync
1295
-
1296
- # IPCB\_PrimitiveRegion.toSync() method
1297
-
1298
- Convert Primitive to Sync primitive
1299
-
1300
- ## Signature
1301
-
1302
- ```typescript
1303
- function toSync(): IPCB_PrimitiveRegion;
1304
- ```
1305
-
1306
- ## Returns
1307
-
1308
- [IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)
1309
-
1310
- Region primitive object
1311
-
1312
- ## Example
1313
-
1314
- ```javascript
1315
- // 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
1316
- const x = 2000 + Math.floor(Math.random() * 100000);
1317
- const y = 2000 + Math.floor(Math.random() * 100000);
1318
-
1319
- // 2. 创建一个矩形区域
1320
- const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
1321
- const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
1322
- const before = region.isAsync();
1323
-
1324
- // 3. 转换为同步图元(保留现场供观察)
1325
- const syncRegion = region.toSync();
1326
- const after = syncRegion.isAsync();
1327
-
1328
- // 4. 同步图元直接读取属性,无需提交
1329
- console.log('isAsync:', before, '→', after);
1330
- console.log('primitiveType:', syncRegion.getState_PrimitiveType());
1331
- console.log('layer:', syncRegion.getState_Layer());
1332
- ```
1
+ # IPCB\_PrimitiveRegion class
2
+
3
+ Region primitive
4
+
5
+ ## Signature
6
+
7
+ ```typescript
8
+ class IPCB_PrimitiveRegion implements IPCB_Primitive
9
+ ```
10
+ **Implements:** [IPCB\_Primitive](../interfaces/IPCB_Primitive.md)
11
+
12
+ ## Remarks
13
+
14
+ ## Methods
15
+
16
+ <table><thead><tr><th>
17
+
18
+ Method
19
+
20
+ </th><th>
21
+
22
+ Modifiers
23
+
24
+ </th><th>
25
+
26
+ Description
27
+
28
+ </th></tr></thead>
29
+ <tbody><tr><td>
30
+
31
+ [convertToFill()](./IPCB_PrimitiveRegion.md)
32
+
33
+ </td><td>
34
+
35
+ </td><td>
36
+
37
+ **_(BETA)_** Convert to: fill primitive
38
+
39
+ </td></tr>
40
+ <tr><td>
41
+
42
+ [convertToPolyline()](./IPCB_PrimitiveRegion.md)
43
+
44
+ </td><td>
45
+
46
+ </td><td>
47
+
48
+ **_(BETA)_** Convert to: polyline primitive
49
+
50
+ </td></tr>
51
+ <tr><td>
52
+
53
+ [convertToPour()](./IPCB_PrimitiveRegion.md)
54
+
55
+ </td><td>
56
+
57
+ </td><td>
58
+
59
+ **_(BETA)_** Convert to: Copper border primitive
60
+
61
+ </td></tr>
62
+ <tr><td>
63
+
64
+ [done()](./IPCB_PrimitiveRegion.md)
65
+
66
+ </td><td>
67
+
68
+ </td><td>
69
+
70
+ **_(BETA)_** Apply the changes to the primitives to the canvas
71
+
72
+ </td></tr>
73
+ <tr><td>
74
+
75
+ [getState\_ComplexPolygon()](./IPCB_PrimitiveRegion.md)
76
+
77
+ </td><td>
78
+
79
+ </td><td>
80
+
81
+ Get the property state: complex polygon
82
+
83
+ </td></tr>
84
+ <tr><td>
85
+
86
+ [getState\_Layer()](./IPCB_PrimitiveRegion.md)
87
+
88
+ </td><td>
89
+
90
+ </td><td>
91
+
92
+ Get the property state: Layer
93
+
94
+ </td></tr>
95
+ <tr><td>
96
+
97
+ [getState\_LineWidth()](./IPCB_PrimitiveRegion.md)
98
+
99
+ </td><td>
100
+
101
+ </td><td>
102
+
103
+ Get the property state: Line width
104
+
105
+ </td></tr>
106
+ <tr><td>
107
+
108
+ [getState\_PrimitiveId()](./IPCB_PrimitiveRegion.md)
109
+
110
+ </td><td>
111
+
112
+ </td><td>
113
+
114
+ Get the property state: primitive ID
115
+
116
+ </td></tr>
117
+ <tr><td>
118
+
119
+ [getState\_PrimitiveLock()](./IPCB_PrimitiveRegion.md)
120
+
121
+ </td><td>
122
+
123
+ </td><td>
124
+
125
+ Get the property state: whether it is locked
126
+
127
+ </td></tr>
128
+ <tr><td>
129
+
130
+ [getState\_PrimitiveType()](./IPCB_PrimitiveRegion.md)
131
+
132
+ </td><td>
133
+
134
+ </td><td>
135
+
136
+ Get the property state: primitive type
137
+
138
+ </td></tr>
139
+ <tr><td>
140
+
141
+ [getState\_RegionName()](./IPCB_PrimitiveRegion.md)
142
+
143
+ </td><td>
144
+
145
+ </td><td>
146
+
147
+ Get the property state: region name
148
+
149
+ </td></tr>
150
+ <tr><td>
151
+
152
+ [getState\_RuleType()](./IPCB_PrimitiveRegion.md)
153
+
154
+ </td><td>
155
+
156
+ </td><td>
157
+
158
+ Get the property state: region rule type
159
+
160
+ </td></tr>
161
+ <tr><td>
162
+
163
+ [isAsync()](./IPCB_PrimitiveRegion.md)
164
+
165
+ </td><td>
166
+
167
+ </td><td>
168
+
169
+ Query whether the primitive is an async primitive
170
+
171
+ </td></tr>
172
+ <tr><td>
173
+
174
+ [reset()](./IPCB_PrimitiveRegion.md)
175
+
176
+ </td><td>
177
+
178
+ </td><td>
179
+
180
+ **_(BETA)_** Reset the async primitive to the current canvas state
181
+
182
+ </td></tr>
183
+ <tr><td>
184
+
185
+ [setState\_ComplexPolygon(complexPolygon)](./IPCB_PrimitiveRegion.md)
186
+
187
+ </td><td>
188
+
189
+ </td><td>
190
+
191
+ **_(BETA)_** Set the property state: complex polygon
192
+
193
+ </td></tr>
194
+ <tr><td>
195
+
196
+ [setState\_Layer(layer)](./IPCB_PrimitiveRegion.md)
197
+
198
+ </td><td>
199
+
200
+ </td><td>
201
+
202
+ **_(BETA)_** Set the property state: Layer
203
+
204
+ </td></tr>
205
+ <tr><td>
206
+
207
+ [setState\_LineWidth(lineWidth)](./IPCB_PrimitiveRegion.md)
208
+
209
+ </td><td>
210
+
211
+ </td><td>
212
+
213
+ **_(BETA)_** Set the property state: Line width
214
+
215
+ </td></tr>
216
+ <tr><td>
217
+
218
+ [setState\_PrimitiveLock(primitiveLock)](./IPCB_PrimitiveRegion.md)
219
+
220
+ </td><td>
221
+
222
+ </td><td>
223
+
224
+ **_(BETA)_** Set the property state: whether it is locked
225
+
226
+ </td></tr>
227
+ <tr><td>
228
+
229
+ [setState\_RegionName(regionName)](./IPCB_PrimitiveRegion.md)
230
+
231
+ </td><td>
232
+
233
+ </td><td>
234
+
235
+ **_(BETA)_** Set the property state: region name
236
+
237
+ </td></tr>
238
+ <tr><td>
239
+
240
+ [setState\_RuleType(ruleType)](./IPCB_PrimitiveRegion.md)
241
+
242
+ </td><td>
243
+
244
+ </td><td>
245
+
246
+ **_(BETA)_** Set the property state: region rule type
247
+
248
+ </td></tr>
249
+ <tr><td>
250
+
251
+ [toAsync()](./IPCB_PrimitiveRegion.md)
252
+
253
+ </td><td>
254
+
255
+ </td><td>
256
+
257
+ Convert Primitive to Async primitive
258
+
259
+ </td></tr>
260
+ <tr><td>
261
+
262
+ [toSync()](./IPCB_PrimitiveRegion.md)
263
+
264
+ </td><td>
265
+
266
+ </td><td>
267
+
268
+ Convert Primitive to Sync primitive
269
+
270
+ </td></tr>
271
+ </tbody></table>
272
+
273
+ ---
274
+
275
+ ## 方法详情
276
+
277
+ ### converttofill
278
+
279
+ # IPCB\_PrimitiveRegion.convertToFill() method
280
+
281
+ > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
282
+
283
+ Convert to: fill primitive
284
+
285
+ ## Signature
286
+
287
+ ```typescript
288
+ function convertToFill(): Promise<IPCB_PrimitiveFill>;
289
+ ```
290
+
291
+ ## Returns
292
+
293
+ Promise&lt;[IPCB\_PrimitiveFill](./IPCB_PrimitiveFill.md)<!-- -->&gt;
294
+
295
+ Fill primitive object
296
+
297
+ ## Example
298
+
299
+ ```javascript
300
+ // 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
301
+ const x = 2000 + Math.floor(Math.random() * 100000);
302
+ const y = 2000 + Math.floor(Math.random() * 100000);
303
+
304
+ // 2. 创建一个矩形区域
305
+ const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
306
+ const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
307
+
308
+ // 3. 转换为填充图元(区域本身保留,填充为新图元,保留现场供观察)
309
+ const fill = await region.convertToFill();
310
+
311
+ console.log('primitiveType:', `Region → ${fill.getState_PrimitiveType()}`);
312
+ console.log('primitiveId:', fill.getState_PrimitiveId());
313
+ ```
314
+
315
+ ### converttopolyline
316
+
317
+ # IPCB\_PrimitiveRegion.convertToPolyline() method
318
+
319
+ > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
320
+
321
+ Convert to: polyline primitive
322
+
323
+ ## Signature
324
+
325
+ ```typescript
326
+ function convertToPolyline(): Promise<IPCB_PrimitivePolyline>;
327
+ ```
328
+
329
+ ## Returns
330
+
331
+ Promise&lt;[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)<!-- -->&gt;
332
+
333
+ Polyline primitive object
334
+
335
+ ## Example
336
+
337
+ ```javascript
338
+ // 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
339
+ const x = 2000 + Math.floor(Math.random() * 100000);
340
+ const y = 2000 + Math.floor(Math.random() * 100000);
341
+
342
+ // 2. 创建一个矩形区域
343
+ const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
344
+ const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
345
+
346
+ // 3. 转换为折线图元(区域本身保留,折线为新图元,保留现场供观察)
347
+ const polyline = await region.convertToPolyline();
348
+
349
+ console.log('primitiveType:', `Region → ${polyline.getState_PrimitiveType()}`);
350
+ console.log('primitiveId:', polyline.getState_PrimitiveId());
351
+ ```
352
+
353
+ ### converttopour
354
+
355
+ # IPCB\_PrimitiveRegion.convertToPour() method
356
+
357
+ > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
358
+
359
+ Convert to: Copper border primitive
360
+
361
+ ## Signature
362
+
363
+ ```typescript
364
+ function convertToPour(): Promise<IPCB_PrimitivePour>;
365
+ ```
366
+
367
+ ## Returns
368
+
369
+ Promise&lt;[IPCB\_PrimitivePour](./IPCB_PrimitivePour.md)<!-- -->&gt;
370
+
371
+ Copper border primitive object
372
+
373
+ ## Example
374
+
375
+ ```javascript
376
+ // 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
377
+ const x = 2000 + Math.floor(Math.random() * 100000);
378
+ const y = 2000 + Math.floor(Math.random() * 100000);
379
+
380
+ // 2. 创建一个矩形区域
381
+ const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
382
+ const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
383
+
384
+ // 3. 转换为覆铜边框图元(区域本身保留,覆铜边框为新图元,保留现场供观察)
385
+ const pour = await region.convertToPour();
386
+
387
+ console.log('primitiveType:', `Region → ${pour.getState_PrimitiveType()}`);
388
+ console.log('primitiveId:', pour.getState_PrimitiveId());
389
+ ```
390
+
391
+ ### done
392
+
393
+ # IPCB\_PrimitiveRegion.done() method
394
+
395
+ > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
396
+
397
+ Apply the changes to the primitives to the canvas
398
+
399
+ ## Signature
400
+
401
+ ```typescript
402
+ function done(): Promise<IPCB_PrimitiveRegion>;
403
+ ```
404
+
405
+ ## Returns
406
+
407
+ Promise&lt;[IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)<!-- -->&gt;
408
+
409
+ Region primitive object
410
+
411
+ ## Example
412
+
413
+ ```javascript
414
+ // 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
415
+ const x = 2000 + Math.floor(Math.random() * 100000);
416
+ const y = 2000 + Math.floor(Math.random() * 100000);
417
+
418
+ // 2. 创建一个顶层铜层(1)的矩形区域
419
+ const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
420
+ const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
421
+ const before = region.getState_Layer();
422
+
423
+ // 3. 异步模式下把区域挪到底层铜层(此时画布还没变)
424
+ const asyncRegion = region.toAsync();
425
+ asyncRegion.setState_Layer(2);
426
+ await asyncRegion.done();
427
+
428
+ // 4. 从画布重新读取,确认修改已生效(保留现场供观察)
429
+ const refetched = await eda.pcb_PrimitiveRegion.get(region.getState_PrimitiveId());
430
+
431
+ console.log('layer:', before, '→', refetched.getState_Layer());
432
+ ```
433
+
434
+ ### getstate_complexpolygon
435
+
436
+ # IPCB\_PrimitiveRegion.getState\_ComplexPolygon() method
437
+
438
+ Get the property state: complex polygon
439
+
440
+ ## Signature
441
+
442
+ ```typescript
443
+ function getState_ComplexPolygon(): IPCB_Polygon;
444
+ ```
445
+
446
+ ## Returns
447
+
448
+ [IPCB\_Polygon](./IPCB_Polygon.md)
449
+
450
+ Complex polygon
451
+
452
+ ## Example
453
+
454
+ ```javascript
455
+ // 1. 创建一个已知轮廓的矩形区域(500 x 300 mil)
456
+ const x = 2000 + Math.floor(Math.random() * 100000);
457
+ const y = 2000 + Math.floor(Math.random() * 100000);
458
+ const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
459
+ const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
460
+
461
+ // 2. 读取复杂多边形对象,再取它的轮廓源数组
462
+ const complexPolygon = region.getState_ComplexPolygon();
463
+ const source = complexPolygon.getSource();
464
+
465
+ // 3. 清理测试图元(查询类案例不留测试对象)
466
+ await eda.pcb_PrimitiveRegion.delete([region.getState_PrimitiveId()]);
467
+
468
+ console.log('polygonSource:', JSON.stringify(source));
469
+ ```
470
+
471
+ ### getstate_layer
472
+
473
+ # IPCB\_PrimitiveRegion.getState\_Layer() method
474
+
475
+ Get the property state: Layer
476
+
477
+ ## Signature
478
+
479
+ ```typescript
480
+ function getState_Layer(): TPCB_LayersOfRegion;
481
+ ```
482
+
483
+ ## Returns
484
+
485
+ [TPCB\_LayersOfRegion](../types/TPCB_LayersOfRegion.md)
486
+
487
+ Layer
488
+
489
+ ## Example
490
+
491
+ ```javascript
492
+ // 1. 创建一个顶层铜层(1)的矩形区域
493
+ const x = 2000 + Math.floor(Math.random() * 100000);
494
+ const y = 2000 + Math.floor(Math.random() * 100000);
495
+ const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
496
+ const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
497
+
498
+ // 2. 读取所在层
499
+ const layer = region.getState_Layer();
500
+
501
+ // 3. 清理测试图元(查询类案例不留测试对象)
502
+ await eda.pcb_PrimitiveRegion.delete([region.getState_PrimitiveId()]);
503
+
504
+ console.log('layer:', layer);
505
+ ```
506
+
507
+ ### getstate_linewidth
508
+
509
+ # IPCB\_PrimitiveRegion.getState\_LineWidth() method
510
+
511
+ Get the property state: Line width
512
+
513
+ ## Signature
514
+
515
+ ```typescript
516
+ function getState_LineWidth(): number;
517
+ ```
518
+
519
+ ## Returns
520
+
521
+ number
522
+
523
+ Line width
524
+
525
+ ## Example
526
+
527
+ ```javascript
528
+ // 1. 创建一个 10mil 线宽的矩形区域
529
+ const x = 2000 + Math.floor(Math.random() * 100000);
530
+ const y = 2000 + Math.floor(Math.random() * 100000);
531
+ const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
532
+ const region = await eda.pcb_PrimitiveRegion.create(1, polygon, undefined, undefined, 10, false);
533
+
534
+ // 2. 读取线宽
535
+ const lineWidth = region.getState_LineWidth();
536
+
537
+ // 3. 清理测试图元(查询类案例不留测试对象)
538
+ await eda.pcb_PrimitiveRegion.delete([region.getState_PrimitiveId()]);
539
+
540
+ console.log('lineWidth:', lineWidth);
541
+ ```
542
+
543
+ ### getstate_primitiveid
544
+
545
+ # IPCB\_PrimitiveRegion.getState\_PrimitiveId() method
546
+
547
+ Get the property state: primitive ID
548
+
549
+ ## Signature
550
+
551
+ ```typescript
552
+ function getState_PrimitiveId(): string;
553
+ ```
554
+
555
+ ## Returns
556
+
557
+ string
558
+
559
+ Primitive ID
560
+
561
+ ## Example
562
+
563
+ ```javascript
564
+ // 1. 创建一个矩形区域
565
+ const x = 2000 + Math.floor(Math.random() * 100000);
566
+ const y = 2000 + Math.floor(Math.random() * 100000);
567
+ const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
568
+ const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
569
+
570
+ // 2. 读取图元 ID
571
+ const primitiveId = region.getState_PrimitiveId();
572
+
573
+ // 3. 清理测试图元(查询类案例不留测试对象)
574
+ await eda.pcb_PrimitiveRegion.delete([region.getState_PrimitiveId()]);
575
+
576
+ console.log('primitiveId:', primitiveId);
577
+ ```
578
+
579
+ ### getstate_primitivelock
580
+
581
+ # IPCB\_PrimitiveRegion.getState\_PrimitiveLock() method
582
+
583
+ Get the property state: whether it is locked
584
+
585
+ ## Signature
586
+
587
+ ```typescript
588
+ function getState_PrimitiveLock(): boolean;
589
+ ```
590
+
591
+ ## Returns
592
+
593
+ boolean
594
+
595
+ Whether it is locked
596
+
597
+ ## Example
598
+
599
+ ```javascript
600
+ // 1. 创建一个未锁定的矩形区域
601
+ const x = 2000 + Math.floor(Math.random() * 100000);
602
+ const y = 2000 + Math.floor(Math.random() * 100000);
603
+ const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
604
+ const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
605
+
606
+ // 2. 读取锁定状态
607
+ const primitiveLock = region.getState_PrimitiveLock();
608
+
609
+ // 3. 清理测试图元(查询类案例不留测试对象)
610
+ await eda.pcb_PrimitiveRegion.delete([region.getState_PrimitiveId()]);
611
+
612
+ console.log('primitiveLock:', primitiveLock);
613
+ ```
614
+
615
+ ### getstate_primitivetype
616
+
617
+ # IPCB\_PrimitiveRegion.getState\_PrimitiveType() method
618
+
619
+ Get the property state: primitive type
620
+
621
+ ## Signature
622
+
623
+ ```typescript
624
+ function getState_PrimitiveType(): EPCB_PrimitiveType;
625
+ ```
626
+
627
+ ## Returns
628
+
629
+ [EPCB\_PrimitiveType](../enums/EPCB_PrimitiveType.md)
630
+
631
+ Primitive type
632
+
633
+ ## Example
634
+
635
+ ```javascript
636
+ // 1. 创建一个矩形区域
637
+ const x = 2000 + Math.floor(Math.random() * 100000);
638
+ const y = 2000 + Math.floor(Math.random() * 100000);
639
+ const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
640
+ const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
641
+
642
+ // 2. 读取图元类型
643
+ const primitiveType = region.getState_PrimitiveType();
644
+
645
+ // 3. 清理测试图元(查询类案例不留测试对象)
646
+ await eda.pcb_PrimitiveRegion.delete([region.getState_PrimitiveId()]);
647
+
648
+ console.log('primitiveType:', primitiveType);
649
+ ```
650
+
651
+ ### getstate_regionname
652
+
653
+ # IPCB\_PrimitiveRegion.getState\_RegionName() method
654
+
655
+ Get the property state: region name
656
+
657
+ ## Signature
658
+
659
+ ```typescript
660
+ function getState_RegionName(): string | undefined;
661
+ ```
662
+
663
+ ## Returns
664
+
665
+ string \| undefined
666
+
667
+ Region name
668
+
669
+ ## Example
670
+
671
+ ```javascript
672
+ // 1. 创建一个带名称的约束区域(ruleType=9 即 FOLLOW_REGION_RULE)
673
+ const x = 2000 + Math.floor(Math.random() * 100000);
674
+ const y = 2000 + Math.floor(Math.random() * 100000);
675
+ const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
676
+ const region = await eda.pcb_PrimitiveRegion.create(1, polygon, [9], '嘉立创示例_电源约束区');
677
+
678
+ // 2. 读取区域名称
679
+ const regionName = region.getState_RegionName();
680
+
681
+ // 3. 清理测试图元(查询类案例不留测试对象)
682
+ await eda.pcb_PrimitiveRegion.delete([region.getState_PrimitiveId()]);
683
+
684
+ console.log('regionName:', regionName);
685
+ ```
686
+
687
+ ### getstate_ruletype
688
+
689
+ # IPCB\_PrimitiveRegion.getState\_RuleType() method
690
+
691
+ Get the property state: region rule type
692
+
693
+ ## Signature
694
+
695
+ ```typescript
696
+ function getState_RuleType(): Array<EPCB_PrimitiveRegionRuleType>;
697
+ ```
698
+
699
+ ## Returns
700
+
701
+ Array&lt;[EPCB\_PrimitiveRegionRuleType](../enums/EPCB_PrimitiveRegionRuleType.md)<!-- -->&gt;
702
+
703
+ Region rule type
704
+
705
+ ## Example
706
+
707
+ ```javascript
708
+ // 1. 创建一个"禁止元件"(NO_COMPONENTS=2)的规则区域
709
+ const x = 2000 + Math.floor(Math.random() * 100000);
710
+ const y = 2000 + Math.floor(Math.random() * 100000);
711
+ const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
712
+ const region = await eda.pcb_PrimitiveRegion.create(1, polygon, [2]);
713
+
714
+ // 2. 读取规则类型数组(枚举值:2=禁止元件, 5=禁止导线, 6=禁止填充, 7=禁止覆铜, 8=禁止内电层, 9=约束区域)
715
+ const ruleType = region.getState_RuleType();
716
+
717
+ // 3. 清理测试图元(查询类案例不留测试对象)
718
+ await eda.pcb_PrimitiveRegion.delete([region.getState_PrimitiveId()]);
719
+
720
+ console.log('ruleType:', JSON.stringify(ruleType));
721
+ ```
722
+
723
+ ### isasync
724
+
725
+ # IPCB\_PrimitiveRegion.isAsync() method
726
+
727
+ Query whether the primitive is an async primitive
728
+
729
+ ## Signature
730
+
731
+ ```typescript
732
+ function isAsync(): boolean;
733
+ ```
734
+
735
+ ## Returns
736
+
737
+ boolean
738
+
739
+ Whether Is async primitive
740
+
741
+ ## Example
742
+
743
+ ```javascript
744
+ // 1. 创建一个矩形区域
745
+ const x = 2000 + Math.floor(Math.random() * 100000);
746
+ const y = 2000 + Math.floor(Math.random() * 100000);
747
+ const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
748
+ const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
749
+
750
+ // 2. 查询异步模式
751
+ const isAsync = region.isAsync();
752
+
753
+ // 3. 清理测试图元(查询类案例不留测试对象)
754
+ await eda.pcb_PrimitiveRegion.delete([region.getState_PrimitiveId()]);
755
+
756
+ console.log('isAsync:', isAsync);
757
+ ```
758
+
759
+ ### reset
760
+
761
+ # IPCB\_PrimitiveRegion.reset() method
762
+
763
+ > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
764
+
765
+ Reset the async primitive to the current canvas state
766
+
767
+ ## Signature
768
+
769
+ ```typescript
770
+ function reset(): Promise<IPCB_PrimitiveRegion>;
771
+ ```
772
+
773
+ ## Returns
774
+
775
+ Promise&lt;[IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)<!-- -->&gt;
776
+
777
+ Region primitive object
778
+
779
+ ## Example
780
+
781
+ ```javascript
782
+ // 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
783
+ const x = 2000 + Math.floor(Math.random() * 100000);
784
+ const y = 2000 + Math.floor(Math.random() * 100000);
785
+
786
+ // 2. 创建一个顶层铜层的矩形区域
787
+ const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
788
+ const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
789
+ const before = region.getState_Layer();
790
+
791
+ // 3. 异步模式下把层改到底层(2),随后反悔
792
+ const asyncRegion = region.toAsync();
793
+ asyncRegion.setState_Layer(2);
794
+
795
+ // 4. reset 丢弃未提交的修改(保留现场供观察)
796
+ await asyncRegion.reset();
797
+
798
+ // 5. 从画布重新读取,确认层没有变
799
+ const refetched = await eda.pcb_PrimitiveRegion.get(region.getState_PrimitiveId());
800
+
801
+ console.log('layer:', before, '→', refetched.getState_Layer());
802
+ ```
803
+
804
+ ### setstate_complexpolygon
805
+
806
+ # IPCB\_PrimitiveRegion.setState\_ComplexPolygon() method
807
+
808
+ > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
809
+
810
+ Set the property state: complex polygon
811
+
812
+ ## Signature
813
+
814
+ ```typescript
815
+ function setState_ComplexPolygon(complexPolygon: IPCB_Polygon): IPCB_PrimitiveRegion;
816
+ ```
817
+
818
+ ## Parameters
819
+
820
+ <table><thead><tr><th>
821
+
822
+ Parameter
823
+
824
+ </th><th>
825
+
826
+ Type
827
+
828
+ </th><th>
829
+
830
+ Description
831
+
832
+ </th></tr></thead>
833
+ <tbody><tr><td>
834
+
835
+ complexPolygon
836
+
837
+ </td><td>
838
+
839
+ [IPCB\_Polygon](./IPCB_Polygon.md)
840
+
841
+ </td><td>
842
+
843
+ Complex polygon
844
+
845
+ </td></tr>
846
+ </tbody></table>
847
+
848
+ ## Returns
849
+
850
+ [IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)
851
+
852
+ Region primitive object
853
+
854
+ ## Example
855
+
856
+ ```javascript
857
+ // 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
858
+ const x = 2000 + Math.floor(Math.random() * 100000);
859
+ const y = 2000 + Math.floor(Math.random() * 100000);
860
+
861
+ // 2. 创建一个 500 x 300 的矩形区域
862
+ const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
863
+ const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
864
+ const before = JSON.stringify(region.getState_ComplexPolygon().getSource());
865
+
866
+ // 3. 构造新轮廓(放大到 800 x 400),异步模式提交
867
+ const newPolygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 800, 400, 0, 0]);
868
+ const asyncRegion = region.toAsync();
869
+ asyncRegion.setState_ComplexPolygon(newPolygon);
870
+ await asyncRegion.done();
871
+
872
+ // 4. 从画布重新读取,确认轮廓已替换(保留现场供观察)
873
+ const refetched = await eda.pcb_PrimitiveRegion.get(region.getState_PrimitiveId());
874
+ const after = JSON.stringify(refetched.getState_ComplexPolygon().getSource());
875
+
876
+ console.log('polygonSource:', before, '→', after);
877
+ ```
878
+
879
+ ### setstate_layer
880
+
881
+ # IPCB\_PrimitiveRegion.setState\_Layer() method
882
+
883
+ > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
884
+
885
+ Set the property state: Layer
886
+
887
+ ## Signature
888
+
889
+ ```typescript
890
+ function setState_Layer(layer: TPCB_LayersOfRegion): IPCB_PrimitiveRegion;
891
+ ```
892
+
893
+ ## Parameters
894
+
895
+ <table><thead><tr><th>
896
+
897
+ Parameter
898
+
899
+ </th><th>
900
+
901
+ Type
902
+
903
+ </th><th>
904
+
905
+ Description
906
+
907
+ </th></tr></thead>
908
+ <tbody><tr><td>
909
+
910
+ layer
911
+
912
+ </td><td>
913
+
914
+ [TPCB\_LayersOfRegion](../types/TPCB_LayersOfRegion.md)
915
+
916
+ </td><td>
917
+
918
+ Layer
919
+
920
+ </td></tr>
921
+ </tbody></table>
922
+
923
+ ## Returns
924
+
925
+ [IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)
926
+
927
+ Region primitive object
928
+
929
+ ## Example
930
+
931
+ ```javascript
932
+ // 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
933
+ const x = 2000 + Math.floor(Math.random() * 100000);
934
+ const y = 2000 + Math.floor(Math.random() * 100000);
935
+
936
+ // 2. 创建一个顶层铜层(1)的矩形区域
937
+ const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
938
+ const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
939
+ const before = region.getState_Layer();
940
+
941
+ // 3. 异步模式把区域挪到底层铜层(2)
942
+ const asyncRegion = region.toAsync();
943
+ asyncRegion.setState_Layer(2);
944
+ await asyncRegion.done();
945
+
946
+ // 4. 从画布重新读取,确认层已切换(保留现场供观察)
947
+ const refetched = await eda.pcb_PrimitiveRegion.get(region.getState_PrimitiveId());
948
+
949
+ console.log('layer:', before, '→', refetched.getState_Layer());
950
+ ```
951
+
952
+ ### setstate_linewidth
953
+
954
+ # IPCB\_PrimitiveRegion.setState\_LineWidth() method
955
+
956
+ > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
957
+
958
+ Set the property state: Line width
959
+
960
+ ## Signature
961
+
962
+ ```typescript
963
+ function setState_LineWidth(lineWidth: number): IPCB_PrimitiveRegion;
964
+ ```
965
+
966
+ ## Parameters
967
+
968
+ <table><thead><tr><th>
969
+
970
+ Parameter
971
+
972
+ </th><th>
973
+
974
+ Type
975
+
976
+ </th><th>
977
+
978
+ Description
979
+
980
+ </th></tr></thead>
981
+ <tbody><tr><td>
982
+
983
+ lineWidth
984
+
985
+ </td><td>
986
+
987
+ number
988
+
989
+ </td><td>
990
+
991
+ Line width
992
+
993
+ </td></tr>
994
+ </tbody></table>
995
+
996
+ ## Returns
997
+
998
+ [IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)
999
+
1000
+ Region primitive object
1001
+
1002
+ ## Example
1003
+
1004
+ ```javascript
1005
+ // 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
1006
+ const x = 2000 + Math.floor(Math.random() * 100000);
1007
+ const y = 2000 + Math.floor(Math.random() * 100000);
1008
+
1009
+ // 2. 创建一个 10mil 线宽的矩形区域
1010
+ const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
1011
+ const region = await eda.pcb_PrimitiveRegion.create(1, polygon, undefined, undefined, 10, false);
1012
+ const before = region.getState_LineWidth();
1013
+
1014
+ // 3. 切换异步模式,线宽加粗到 20mil
1015
+ const asyncRegion = region.toAsync();
1016
+ asyncRegion.setState_LineWidth(20);
1017
+ await asyncRegion.done();
1018
+
1019
+ // 4. 从图元对象读回新值(保留现场供观察)
1020
+ // 注:同族 Fill/Pour 的线宽修改画布侧不落,此处从图元对象读回确认
1021
+ const after = region.getState_LineWidth();
1022
+
1023
+ console.log('lineWidth:', before, '→', after);
1024
+ ```
1025
+
1026
+ ### setstate_primitivelock
1027
+
1028
+ # IPCB\_PrimitiveRegion.setState\_PrimitiveLock() method
1029
+
1030
+ > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
1031
+
1032
+ Set the property state: whether it is locked
1033
+
1034
+ ## Signature
1035
+
1036
+ ```typescript
1037
+ function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitiveRegion;
1038
+ ```
1039
+
1040
+ ## Parameters
1041
+
1042
+ <table><thead><tr><th>
1043
+
1044
+ Parameter
1045
+
1046
+ </th><th>
1047
+
1048
+ Type
1049
+
1050
+ </th><th>
1051
+
1052
+ Description
1053
+
1054
+ </th></tr></thead>
1055
+ <tbody><tr><td>
1056
+
1057
+ primitiveLock
1058
+
1059
+ </td><td>
1060
+
1061
+ boolean
1062
+
1063
+ </td><td>
1064
+
1065
+ Whether it is locked
1066
+
1067
+ </td></tr>
1068
+ </tbody></table>
1069
+
1070
+ ## Returns
1071
+
1072
+ [IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)
1073
+
1074
+ Region primitive object
1075
+
1076
+ ## Example
1077
+
1078
+ ```javascript
1079
+ // 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
1080
+ const x = 2000 + Math.floor(Math.random() * 100000);
1081
+ const y = 2000 + Math.floor(Math.random() * 100000);
1082
+
1083
+ // 2. 创建一个未锁定的矩形区域
1084
+ const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
1085
+ const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
1086
+ const before = region.getState_PrimitiveLock();
1087
+
1088
+ // 3. 切换异步模式并锁定区域
1089
+ const asyncRegion = region.toAsync();
1090
+ asyncRegion.setState_PrimitiveLock(true);
1091
+ await asyncRegion.done();
1092
+
1093
+ // 4. 从画布重新读取,确认已锁定(保留现场供观察)
1094
+ const refetched = await eda.pcb_PrimitiveRegion.get(region.getState_PrimitiveId());
1095
+
1096
+ console.log('primitiveLock:', before, '→', refetched.getState_PrimitiveLock());
1097
+ ```
1098
+
1099
+ ### setstate_regionname
1100
+
1101
+ # IPCB\_PrimitiveRegion.setState\_RegionName() method
1102
+
1103
+ > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
1104
+
1105
+ Set the property state: region name
1106
+
1107
+ ## Signature
1108
+
1109
+ ```typescript
1110
+ function setState_RegionName(regionName?: string): IPCB_PrimitiveRegion;
1111
+ ```
1112
+
1113
+ ## Parameters
1114
+
1115
+ <table><thead><tr><th>
1116
+
1117
+ Parameter
1118
+
1119
+ </th><th>
1120
+
1121
+ Type
1122
+
1123
+ </th><th>
1124
+
1125
+ Description
1126
+
1127
+ </th></tr></thead>
1128
+ <tbody><tr><td>
1129
+
1130
+ regionName
1131
+
1132
+ </td><td>
1133
+
1134
+ string
1135
+
1136
+ </td><td>
1137
+
1138
+ _(Optional)_ Region name
1139
+
1140
+ </td></tr>
1141
+ </tbody></table>
1142
+
1143
+ ## Returns
1144
+
1145
+ [IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)
1146
+
1147
+ Region primitive object
1148
+
1149
+ ## Remarks
1150
+
1151
+ Only valid when `ruleType` is [EPCB\_PrimitiveRegionRuleType.FOLLOW\_REGION\_RULE](../enums/EPCB_PrimitiveRegionRuleType.md)<!-- -->, used to match region DRC rules
1152
+
1153
+ If `ruleType` is [EPCB\_PrimitiveRegionRuleType.FOLLOW\_REGION\_RULE](../enums/EPCB_PrimitiveRegionRuleType.md) but `regionName` is empty, the system will automatically assign a name
1154
+
1155
+ ## Example
1156
+
1157
+ ```javascript
1158
+ // 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
1159
+ const x = 2000 + Math.floor(Math.random() * 100000);
1160
+ const y = 2000 + Math.floor(Math.random() * 100000);
1161
+
1162
+ // 2. 创建一个带名称的约束区域(ruleType=9 即 FOLLOW_REGION_RULE)
1163
+ const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
1164
+ const region = await eda.pcb_PrimitiveRegion.create(1, polygon, [9], '嘉立创示例_旧区域名');
1165
+ const before = region.getState_RegionName();
1166
+
1167
+ // 3. 异步模式修改区域名称
1168
+ const asyncRegion = region.toAsync();
1169
+ asyncRegion.setState_RegionName('嘉立创示例_电源约束区');
1170
+ await asyncRegion.done();
1171
+
1172
+ // 4. 从图元对象读回新值(保留现场供观察)
1173
+ // 注:当前版本名称修改画布侧不落(重新 get() 仍是旧名),修改在图元对象上生效
1174
+ const after = region.getState_RegionName();
1175
+
1176
+ console.log('regionName:', before, '→', after);
1177
+ ```
1178
+
1179
+ ### setstate_ruletype
1180
+
1181
+ # IPCB\_PrimitiveRegion.setState\_RuleType() method
1182
+
1183
+ > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
1184
+
1185
+ Set the property state: region rule type
1186
+
1187
+ ## Signature
1188
+
1189
+ ```typescript
1190
+ function setState_RuleType(ruleType: Array<EPCB_PrimitiveRegionRuleType>): IPCB_PrimitiveRegion;
1191
+ ```
1192
+
1193
+ ## Parameters
1194
+
1195
+ <table><thead><tr><th>
1196
+
1197
+ Parameter
1198
+
1199
+ </th><th>
1200
+
1201
+ Type
1202
+
1203
+ </th><th>
1204
+
1205
+ Description
1206
+
1207
+ </th></tr></thead>
1208
+ <tbody><tr><td>
1209
+
1210
+ ruleType
1211
+
1212
+ </td><td>
1213
+
1214
+ Array&lt;[EPCB\_PrimitiveRegionRuleType](../enums/EPCB_PrimitiveRegionRuleType.md)<!-- -->&gt;
1215
+
1216
+ </td><td>
1217
+
1218
+ Region rule type
1219
+
1220
+ </td></tr>
1221
+ </tbody></table>
1222
+
1223
+ ## Returns
1224
+
1225
+ [IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)
1226
+
1227
+ Region primitive object
1228
+
1229
+ ## Example
1230
+
1231
+ ```javascript
1232
+ // 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
1233
+ const x = 2000 + Math.floor(Math.random() * 100000);
1234
+ const y = 2000 + Math.floor(Math.random() * 100000);
1235
+
1236
+ // 2. 创建一个不带规则的矩形区域
1237
+ const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
1238
+ const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
1239
+ const before = JSON.stringify(region.getState_RuleType());
1240
+
1241
+ // 3. 异步模式挂上"禁止元件 + 禁止导线"两条规则(2=NO_COMPONENTS, 5=NO_WIRES)
1242
+ const asyncRegion = region.toAsync();
1243
+ asyncRegion.setState_RuleType([2, 5]);
1244
+ await asyncRegion.done();
1245
+
1246
+ // 4. 从画布重新读取,确认规则已更新(保留现场供观察)
1247
+ const refetched = await eda.pcb_PrimitiveRegion.get(region.getState_PrimitiveId());
1248
+
1249
+ console.log('ruleType:', before, '→', JSON.stringify(refetched.getState_RuleType()));
1250
+ ```
1251
+
1252
+ ### toasync
1253
+
1254
+ # IPCB\_PrimitiveRegion.toAsync() method
1255
+
1256
+ Convert Primitive to Async primitive
1257
+
1258
+ ## Signature
1259
+
1260
+ ```typescript
1261
+ function toAsync(): IPCB_PrimitiveRegion;
1262
+ ```
1263
+
1264
+ ## Returns
1265
+
1266
+ [IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)
1267
+
1268
+ Region primitive object
1269
+
1270
+ ## Example
1271
+
1272
+ ```javascript
1273
+ // 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
1274
+ const x = 2000 + Math.floor(Math.random() * 100000);
1275
+ const y = 2000 + Math.floor(Math.random() * 100000);
1276
+
1277
+ // 2. 创建一个顶层铜层的矩形区域
1278
+ const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
1279
+ const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
1280
+
1281
+ // 3. 切换异步模式后批量修改:挪到底层 + 挂"禁止元件"规则
1282
+ const asyncRegion = region.toAsync();
1283
+ asyncRegion.setState_Layer(2);
1284
+ asyncRegion.setState_RuleType([2]);
1285
+ await asyncRegion.done();
1286
+
1287
+ // 4. 从画布重新读取,确认批量修改已生效(保留现场供观察)
1288
+ const refetched = await eda.pcb_PrimitiveRegion.get(region.getState_PrimitiveId());
1289
+
1290
+ console.log('layer:', refetched.getState_Layer());
1291
+ console.log('ruleType:', JSON.stringify(refetched.getState_RuleType()));
1292
+ ```
1293
+
1294
+ ### tosync
1295
+
1296
+ # IPCB\_PrimitiveRegion.toSync() method
1297
+
1298
+ Convert Primitive to Sync primitive
1299
+
1300
+ ## Signature
1301
+
1302
+ ```typescript
1303
+ function toSync(): IPCB_PrimitiveRegion;
1304
+ ```
1305
+
1306
+ ## Returns
1307
+
1308
+ [IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)
1309
+
1310
+ Region primitive object
1311
+
1312
+ ## Example
1313
+
1314
+ ```javascript
1315
+ // 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
1316
+ const x = 2000 + Math.floor(Math.random() * 100000);
1317
+ const y = 2000 + Math.floor(Math.random() * 100000);
1318
+
1319
+ // 2. 创建一个矩形区域
1320
+ const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
1321
+ const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
1322
+ const before = region.isAsync();
1323
+
1324
+ // 3. 转换为同步图元(保留现场供观察)
1325
+ const syncRegion = region.toSync();
1326
+ const after = syncRegion.isAsync();
1327
+
1328
+ // 4. 同步图元直接读取属性,无需提交
1329
+ console.log('isAsync:', before, '→', after);
1330
+ console.log('primitiveType:', syncRegion.getState_PrimitiveType());
1331
+ console.log('layer:', syncRegion.getState_Layer());
1332
+ ```