@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,2627 +1,2624 @@
1
- # IPCB\_PrimitiveComponent class
2
-
3
- Device primitive
4
-
5
- ## Signature
6
-
7
- ```typescript
8
- class IPCB_PrimitiveComponent 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
- [done()](./IPCB_PrimitiveComponent.md)
32
-
33
- </td><td>
34
-
35
- </td><td>
36
-
37
- **_(BETA)_** Apply the changes to the primitives to the canvas
38
-
39
- </td></tr>
40
- <tr><td>
41
-
42
- [getAllPins()](./IPCB_PrimitiveComponent.md)
43
-
44
- </td><td>
45
-
46
- </td><td>
47
-
48
- **_(BETA)_** Get all pads associated with the device
49
-
50
- </td></tr>
51
- <tr><td>
52
-
53
- [getState\_AddIntoBom()](./IPCB_PrimitiveComponent.md)
54
-
55
- </td><td>
56
-
57
- </td><td>
58
-
59
- Get the property state: whether to add BOM
60
-
61
- </td></tr>
62
- <tr><td>
63
-
64
- [getState\_Component()](./IPCB_PrimitiveComponent.md)
65
-
66
- </td><td>
67
-
68
- </td><td>
69
-
70
- Get the property state: associate library device
71
-
72
- </td></tr>
73
- <tr><td>
74
-
75
- [getState\_Designator()](./IPCB_PrimitiveComponent.md)
76
-
77
- </td><td>
78
-
79
- </td><td>
80
-
81
- Get the property state: designator
82
-
83
- </td></tr>
84
- <tr><td>
85
-
86
- [getState\_Footprint()](./IPCB_PrimitiveComponent.md)
87
-
88
- </td><td>
89
-
90
- </td><td>
91
-
92
- Get the property state: associate library footprint
93
-
94
- </td></tr>
95
- <tr><td>
96
-
97
- [getState\_Layer()](./IPCB_PrimitiveComponent.md)
98
-
99
- </td><td>
100
-
101
- </td><td>
102
-
103
- Get the property state: Layer
104
-
105
- </td></tr>
106
- <tr><td>
107
-
108
- [getState\_Manufacturer()](./IPCB_PrimitiveComponent.md)
109
-
110
- </td><td>
111
-
112
- </td><td>
113
-
114
- Get the property state: manufacturer
115
-
116
- </td></tr>
117
- <tr><td>
118
-
119
- [getState\_ManufacturerId()](./IPCB_PrimitiveComponent.md)
120
-
121
- </td><td>
122
-
123
- </td><td>
124
-
125
- Get the property state: manufacturer ID
126
-
127
- </td></tr>
128
- <tr><td>
129
-
130
- [getState\_Model3D()](./IPCB_PrimitiveComponent.md)
131
-
132
- </td><td>
133
-
134
- </td><td>
135
-
136
- Get the property state: associate library 3D model
137
-
138
- </td></tr>
139
- <tr><td>
140
-
141
- [getState\_Name()](./IPCB_PrimitiveComponent.md)
142
-
143
- </td><td>
144
-
145
- </td><td>
146
-
147
- Get the property state: name
148
-
149
- </td></tr>
150
- <tr><td>
151
-
152
- [getState\_OtherProperty()](./IPCB_PrimitiveComponent.md)
153
-
154
- </td><td>
155
-
156
- </td><td>
157
-
158
- Get the property state: other parameters
159
-
160
- </td></tr>
161
- <tr><td>
162
-
163
- [getState\_Pads()](./IPCB_PrimitiveComponent.md)
164
-
165
- </td><td>
166
-
167
- </td><td>
168
-
169
- Get the property state: pad
170
-
171
- </td></tr>
172
- <tr><td>
173
-
174
- [getState\_PrimitiveId()](./IPCB_PrimitiveComponent.md)
175
-
176
- </td><td>
177
-
178
- </td><td>
179
-
180
- Get the property state: primitive ID
181
-
182
- </td></tr>
183
- <tr><td>
184
-
185
- [getState\_PrimitiveLock()](./IPCB_PrimitiveComponent.md)
186
-
187
- </td><td>
188
-
189
- </td><td>
190
-
191
- Get the property state: whether it is locked
192
-
193
- </td></tr>
194
- <tr><td>
195
-
196
- [getState\_PrimitiveType()](./IPCB_PrimitiveComponent.md)
197
-
198
- </td><td>
199
-
200
- </td><td>
201
-
202
- Get the property state: primitive type
203
-
204
- </td></tr>
205
- <tr><td>
206
-
207
- [getState\_Rotation()](./IPCB_PrimitiveComponent.md)
208
-
209
- </td><td>
210
-
211
- </td><td>
212
-
213
- Get the property state: rotation angle
214
-
215
- </td></tr>
216
- <tr><td>
217
-
218
- [getState\_Supplier()](./IPCB_PrimitiveComponent.md)
219
-
220
- </td><td>
221
-
222
- </td><td>
223
-
224
- Get the property state: supplier
225
-
226
- </td></tr>
227
- <tr><td>
228
-
229
- [getState\_SupplierId()](./IPCB_PrimitiveComponent.md)
230
-
231
- </td><td>
232
-
233
- </td><td>
234
-
235
- Get the property state: supplier ID
236
-
237
- </td></tr>
238
- <tr><td>
239
-
240
- [getState\_UniqueId()](./IPCB_PrimitiveComponent.md)
241
-
242
- </td><td>
243
-
244
- </td><td>
245
-
246
- Get the property state: unique ID
247
-
248
- </td></tr>
249
- <tr><td>
250
-
251
- [getState\_X()](./IPCB_PrimitiveComponent.md)
252
-
253
- </td><td>
254
-
255
- </td><td>
256
-
257
- Get the property state: X coordinate
258
-
259
- </td></tr>
260
- <tr><td>
261
-
262
- [getState\_Y()](./IPCB_PrimitiveComponent.md)
263
-
264
- </td><td>
265
-
266
- </td><td>
267
-
268
- Get the property state: Y coordinate
269
-
270
- </td></tr>
271
- <tr><td>
272
-
273
- [isAsync()](./IPCB_PrimitiveComponent.md)
274
-
275
- </td><td>
276
-
277
- </td><td>
278
-
279
- Query whether the primitive is an async primitive
280
-
281
- </td></tr>
282
- <tr><td>
283
-
284
- [reset()](./IPCB_PrimitiveComponent.md)
285
-
286
- </td><td>
287
-
288
- </td><td>
289
-
290
- **_(BETA)_** Reset the async primitive to the current canvas state
291
-
292
- </td></tr>
293
- <tr><td>
294
-
295
- [setAttribute(key, value, keyVisible, valueVisible)](./IPCB_PrimitiveComponent.md)
296
-
297
- </td><td>
298
-
299
- </td><td>
300
-
301
- **_(BETA)_** Set Property
302
-
303
- </td></tr>
304
- <tr><td>
305
-
306
- [setState\_AddIntoBom(addIntoBom)](./IPCB_PrimitiveComponent.md)
307
-
308
- </td><td>
309
-
310
- </td><td>
311
-
312
- **_(BETA)_** Set the property state: whether to add BOM
313
-
314
- </td></tr>
315
- <tr><td>
316
-
317
- [setState\_Designator(designator)](./IPCB_PrimitiveComponent.md)
318
-
319
- </td><td>
320
-
321
- </td><td>
322
-
323
- **_(BETA)_** Set the property state: designator
324
-
325
- </td></tr>
326
- <tr><td>
327
-
328
- [setState\_Layer(layer)](./IPCB_PrimitiveComponent.md)
329
-
330
- </td><td>
331
-
332
- </td><td>
333
-
334
- **_(BETA)_** Set the property state: Layer
335
-
336
- </td></tr>
337
- <tr><td>
338
-
339
- [setState\_Manufacturer(manufacturer)](./IPCB_PrimitiveComponent.md)
340
-
341
- </td><td>
342
-
343
- </td><td>
344
-
345
- **_(BETA)_** Set the property state: manufacturer
346
-
347
- </td></tr>
348
- <tr><td>
349
-
350
- [setState\_ManufacturerId(manufacturerId)](./IPCB_PrimitiveComponent.md)
351
-
352
- </td><td>
353
-
354
- </td><td>
355
-
356
- **_(BETA)_** Set the property state: manufacturer ID
357
-
358
- </td></tr>
359
- <tr><td>
360
-
361
- [setState\_Name(name)](./IPCB_PrimitiveComponent.md)
362
-
363
- </td><td>
364
-
365
- </td><td>
366
-
367
- **_(BETA)_** Set the property state: name
368
-
369
- </td></tr>
370
- <tr><td>
371
-
372
- [setState\_OtherProperty(otherProperty)](./IPCB_PrimitiveComponent.md)
373
-
374
- </td><td>
375
-
376
- </td><td>
377
-
378
- **_(BETA)_** Set the property state: other parameters
379
-
380
- </td></tr>
381
- <tr><td>
382
-
383
- [setState\_PrimitiveLock(primitiveLock)](./IPCB_PrimitiveComponent.md)
384
-
385
- </td><td>
386
-
387
- </td><td>
388
-
389
- **_(BETA)_** Set the property state: whether it is locked
390
-
391
- </td></tr>
392
- <tr><td>
393
-
394
- [setState\_Rotation(rotation)](./IPCB_PrimitiveComponent.md)
395
-
396
- </td><td>
397
-
398
- </td><td>
399
-
400
- **_(BETA)_** Set the property state: rotation angle
401
-
402
- </td></tr>
403
- <tr><td>
404
-
405
- [setState\_Supplier(supplier)](./IPCB_PrimitiveComponent.md)
406
-
407
- </td><td>
408
-
409
- </td><td>
410
-
411
- **_(BETA)_** Set the property state: supplier
412
-
413
- </td></tr>
414
- <tr><td>
415
-
416
- [setState\_SupplierId(supplierId)](./IPCB_PrimitiveComponent.md)
417
-
418
- </td><td>
419
-
420
- </td><td>
421
-
422
- **_(BETA)_** Set the property state: supplier ID
423
-
424
- </td></tr>
425
- <tr><td>
426
-
427
- [setState\_UniqueId(uniqueId)](./IPCB_PrimitiveComponent.md)
428
-
429
- </td><td>
430
-
431
- </td><td>
432
-
433
- **_(BETA)_** Set the property state: unique ID
434
-
435
- </td></tr>
436
- <tr><td>
437
-
438
- [setState\_X(x)](./IPCB_PrimitiveComponent.md)
439
-
440
- </td><td>
441
-
442
- </td><td>
443
-
444
- **_(BETA)_** Set the property state: X coordinate
445
-
446
- </td></tr>
447
- <tr><td>
448
-
449
- [setState\_Y(y)](./IPCB_PrimitiveComponent.md)
450
-
451
- </td><td>
452
-
453
- </td><td>
454
-
455
- **_(BETA)_** Set the property state: Y coordinate
456
-
457
- </td></tr>
458
- <tr><td>
459
-
460
- [toAsync()](./IPCB_PrimitiveComponent.md)
461
-
462
- </td><td>
463
-
464
- </td><td>
465
-
466
- Convert Primitive to Async primitive
467
-
468
- </td></tr>
469
- <tr><td>
470
-
471
- [toSync()](./IPCB_PrimitiveComponent.md)
472
-
473
- </td><td>
474
-
475
- </td><td>
476
-
477
- Convert Primitive to Sync primitive
478
-
479
- </td></tr>
480
- </tbody></table>
481
-
482
- ---
483
-
484
- ## 方法详情
485
-
486
- ### done
487
-
488
- # IPCB\_PrimitiveComponent.done() method
489
-
490
- > 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.
491
-
492
- Apply the changes to the primitives to the canvas
493
-
494
- ## Signature
495
-
496
- ```typescript
497
- function done(): Promise<IPCB_PrimitiveComponent>;
498
- ```
499
-
500
- ## Returns
501
-
502
- Promise&lt;[IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)<!-- -->&gt;
503
-
504
- Device primitive object
505
-
506
- ## Example
507
-
508
- ```javascript
509
- // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
510
- const x = 20000 + Math.floor(Math.random() * 80000);
511
- const y = 20000 + Math.floor(Math.random() * 80000);
512
-
513
- // 2. 放置测试器件
514
- const devices = await eda.lib_Device.search('C0402');
515
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
516
- const compId = comp.getState_PrimitiveId();
517
-
518
- // 3. 记录修改前的位号和旋转角度
519
- const designatorBefore = comp.getState_Designator();
520
- const rotationBefore = comp.getState_Rotation();
521
-
522
- // 4. 批量修改两个属性,一次 done() 提交
523
- const asyncComp = comp.toAsync();
524
- asyncComp.setState_Designator('C101');
525
- asyncComp.setState_Rotation(90);
526
- await asyncComp.done();
527
-
528
- // 5. 从画布重新读取,确认批量修改已生效(保留现场供观察)
529
- const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
530
-
531
- console.log('designator:', designatorBefore, '→', refetched[0].getState_Designator());
532
- console.log('rotation:', rotationBefore, '→', refetched[0].getState_Rotation());
533
- ```
534
-
535
- ### getallpins
536
-
537
- # IPCB\_PrimitiveComponent.getAllPins() method
538
-
539
- > 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.
540
-
541
- Get all pads associated with the device
542
-
543
- ## Signature
544
-
545
- ```typescript
546
- function getAllPins(): Promise<Array<IPCB_PrimitiveComponentPad>>;
547
- ```
548
-
549
- ## Returns
550
-
551
- Promise&lt;Array&lt;[IPCB\_PrimitiveComponentPad](./IPCB_PrimitiveComponentPad.md)<!-- -->&gt;&gt;
552
-
553
- Device pad primitive array
554
-
555
- ## Example
556
-
557
- ```javascript
558
- // 1. 放置一个测试器件
559
- const devices = await eda.lib_Device.search('C0402');
560
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
561
- const compId = comp.getState_PrimitiveId();
562
-
563
- // 2. 获取器件关联的所有焊盘图元
564
- const pins = await comp.getAllPins();
565
-
566
- // 3. 逐个读取焊盘的归属器件和图元 ID
567
- const pinInfos = pins.map(pin => ({
568
- parentMatch: pin.getState_ParentComponentPrimitiveId() === compId,
569
- primitiveId: pin.getState_PrimitiveId(),
570
- }));
571
-
572
- // 4. 清理测试器件
573
- await eda.pcb_PrimitiveComponent.delete([compId]);
574
-
575
- console.log('pinCount:', pins.length);
576
- console.log('allBelongToComponent:', pinInfos.every(p => p.parentMatch));
577
- console.log('firstPinPrimitiveId:', pinInfos[0].primitiveId);
578
- ```
579
-
580
- ### getstate_addintobom
581
-
582
- # IPCB\_PrimitiveComponent.getState\_AddIntoBom() method
583
-
584
- Get the property state: whether to add BOM
585
-
586
- ## Signature
587
-
588
- ```typescript
589
- function getState_AddIntoBom(): boolean;
590
- ```
591
-
592
- ## Returns
593
-
594
- boolean
595
-
596
- Whether Add to BOM
597
-
598
- ## Example
599
-
600
- ```javascript
601
- // 1. 放置一个测试器件
602
- const devices = await eda.lib_Device.search('C0402');
603
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
604
-
605
- // 2. 读取是否加入 BOM
606
- const addIntoBom = comp.getState_AddIntoBom();
607
-
608
- // 3. 清理测试器件
609
- await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
610
-
611
- console.log('addIntoBom:', addIntoBom);
612
- ```
613
-
614
- ### getstate_component
615
-
616
- # IPCB\_PrimitiveComponent.getState\_Component() method
617
-
618
- Get the property state: associate library device
619
-
620
- ## Signature
621
-
622
- ```typescript
623
- function getState_Component():
624
- { libraryUuid: string; uuid: string; name?: undefined | string } | undefined;
625
- ```
626
-
627
- ## Returns
628
-
629
- { libraryUuid: string; uuid: string; name?: undefined \| string } \| undefined
630
-
631
- Associate library device
632
-
633
- ## Example
634
-
635
- ```javascript
636
- // 1. 放置一个测试器件
637
- const devices = await eda.lib_Device.search('C0402');
638
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
639
-
640
- // 2. 读取关联的库器件信息
641
- const component = comp.getState_Component();
642
-
643
- // 3. 清理测试器件
644
- await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
645
-
646
- console.log('deviceName:', component.name);
647
- console.log('deviceUuid:', component.uuid);
648
- console.log('libraryUuid:', component.libraryUuid);
649
- ```
650
-
651
- ### getstate_designator
652
-
653
- # IPCB\_PrimitiveComponent.getState\_Designator() method
654
-
655
- Get the property state: designator
656
-
657
- ## Signature
658
-
659
- ```typescript
660
- function getState_Designator(): string | undefined;
661
- ```
662
-
663
- ## Returns
664
-
665
- string \| undefined
666
-
667
- Designator
668
-
669
- ## Example
670
-
671
- ```javascript
672
- // 1. 放置一个测试器件(位号由系统自动分配)
673
- const devices = await eda.lib_Device.search('C0402');
674
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
675
-
676
- // 2. 读取位号
677
- const designator = comp.getState_Designator();
678
-
679
- // 3. 清理测试器件
680
- await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
681
-
682
- console.log('designator:', designator);
683
- ```
684
-
685
- ### getstate_footprint
686
-
687
- # IPCB\_PrimitiveComponent.getState\_Footprint() method
688
-
689
- Get the property state: associate library footprint
690
-
691
- ## Signature
692
-
693
- ```typescript
694
- function getState_Footprint():
695
- { libraryUuid: string; uuid: string; name?: undefined | string } | undefined;
696
- ```
697
-
698
- ## Returns
699
-
700
- { libraryUuid: string; uuid: string; name?: undefined \| string } \| undefined
701
-
702
- Associate library footprint
703
-
704
- ## Example
705
-
706
- ```javascript
707
- // 1. 放置一个测试器件
708
- const devices = await eda.lib_Device.search('C0402');
709
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
710
-
711
- // 2. 读取关联的库封装信息
712
- const footprint = comp.getState_Footprint();
713
-
714
- // 3. 清理测试器件
715
- await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
716
-
717
- console.log('footprintName:', footprint.name);
718
- console.log('footprintUuid:', footprint.uuid);
719
- console.log('libraryUuid:', footprint.libraryUuid);
720
- ```
721
-
722
- ### getstate_layer
723
-
724
- # IPCB\_PrimitiveComponent.getState\_Layer() method
725
-
726
- Get the property state: Layer
727
-
728
- ## Signature
729
-
730
- ```typescript
731
- function getState_Layer(): TPCB_LayersOfComponent;
732
- ```
733
-
734
- ## Returns
735
-
736
- [TPCB\_LayersOfComponent](../types/TPCB_LayersOfComponent.md)
737
-
738
- Layer
739
-
740
- ## Example
741
-
742
- ```javascript
743
- // 1. 放置一个测试器件(默认贴在顶面)
744
- const devices = await eda.lib_Device.search('C0402');
745
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
746
-
747
- // 2. 读取所在面(1=顶面, 2=底面)
748
- const layer = comp.getState_Layer();
749
-
750
- // 3. 清理测试器件
751
- await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
752
-
753
- console.log('layer:', layer, layer === 1 ? '(顶面)' : '(底面)');
754
- ```
755
-
756
- ### getstate_manufacturer
757
-
758
- # IPCB\_PrimitiveComponent.getState\_Manufacturer() method
759
-
760
- Get the property state: manufacturer
761
-
762
- ## Signature
763
-
764
- ```typescript
765
- function getState_Manufacturer(): string | undefined;
766
- ```
767
-
768
- ## Returns
769
-
770
- string \| undefined
771
-
772
- Manufacturer
773
-
774
- ## Example
775
-
776
- ```javascript
777
- // 1. 放置一个测试器件
778
- const devices = await eda.lib_Device.search('C0402');
779
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
780
-
781
- // 2. 读取制造商
782
- const manufacturer = comp.getState_Manufacturer();
783
-
784
- // 3. 清理测试器件
785
- await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
786
-
787
- console.log('manufacturer:', manufacturer);
788
- ```
789
-
790
- ### getstate_manufacturerid
791
-
792
- # IPCB\_PrimitiveComponent.getState\_ManufacturerId() method
793
-
794
- Get the property state: manufacturer ID
795
-
796
- ## Signature
797
-
798
- ```typescript
799
- function getState_ManufacturerId(): string | undefined;
800
- ```
801
-
802
- ## Returns
803
-
804
- string \| undefined
805
-
806
- Manufacturer ID
807
-
808
- ## Example
809
-
810
- ```javascript
811
- // 1. 放置一个测试器件
812
- const devices = await eda.lib_Device.search('C0402');
813
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
814
-
815
- // 2. 读取制造商编号
816
- const manufacturerId = comp.getState_ManufacturerId();
817
-
818
- // 3. 清理测试器件
819
- await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
820
-
821
- console.log('manufacturerId:', manufacturerId);
822
- ```
823
-
824
- ### getstate_model3d
825
-
826
- # IPCB\_PrimitiveComponent.getState\_Model3D() method
827
-
828
- Get the property state: associate library 3D model
829
-
830
- ## Signature
831
-
832
- ```typescript
833
- function getState_Model3D():
834
- { libraryUuid: string; uuid: string; name?: undefined | string } | undefined;
835
- ```
836
-
837
- ## Returns
838
-
839
- { libraryUuid: string; uuid: string; name?: undefined \| string } \| undefined
840
-
841
- Associate library 3D model
842
-
843
- ## Example
844
-
845
- ```javascript
846
- // 1. 放置一个测试器件
847
- const devices = await eda.lib_Device.search('C0402');
848
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
849
-
850
- // 2. 读取关联的 3D 模型信息(未关联时返回 undefined)
851
- const model3d = comp.getState_Model3D();
852
-
853
- // 3. 清理测试器件
854
- await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
855
-
856
- console.log('model3dName:', model3d ? model3d.name : '(未关联 3D 模型)');
857
- console.log('model3dUuid:', model3d ? model3d.uuid : '(未关联 3D 模型)');
858
- ```
859
-
860
- ### getstate_name
861
-
862
- # IPCB\_PrimitiveComponent.getState\_Name() method
863
-
864
- Get the property state: name
865
-
866
- ## Signature
867
-
868
- ```typescript
869
- function getState_Name(): string | undefined;
870
- ```
871
-
872
- ## Returns
873
-
874
- string \| undefined
875
-
876
- Name
877
-
878
- ## Example
879
-
880
- ```javascript
881
- // 1. 放置一个测试器件
882
- const devices = await eda.lib_Device.search('C0402');
883
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
884
-
885
- // 2. 读取名称
886
- const name = comp.getState_Name();
887
-
888
- // 3. 清理测试器件
889
- await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
890
-
891
- console.log('name:', name);
892
- ```
893
-
894
- ### getstate_otherproperty
895
-
896
- # IPCB\_PrimitiveComponent.getState\_OtherProperty() method
897
-
898
- Get the property state: other parameters
899
-
900
- ## Signature
901
-
902
- ```typescript
903
- function getState_OtherProperty(): Record<string, string | number | boolean> | undefined;
904
- ```
905
-
906
- ## Returns
907
-
908
- Record&lt;string, string \| number \| boolean&gt; \| undefined
909
-
910
- Other parameters
911
-
912
- ## Example
913
-
914
- ```javascript
915
- // 1. 放置一个测试器件
916
- const devices = await eda.lib_Device.search('C0402');
917
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
918
-
919
- // 2. 读取其它参数字典
920
- const otherProperty = comp.getState_OtherProperty();
921
-
922
- // 3. 清理测试器件
923
- await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
924
-
925
- console.log('propertyCount:', Object.keys(otherProperty).length);
926
- console.log('value:', otherProperty.Value);
927
- console.log('description:', otherProperty.Description);
928
- ```
929
-
930
- ### getstate_pads
931
-
932
- # IPCB\_PrimitiveComponent.getState\_Pads() method
933
-
934
- Get the property state: pad
935
-
936
- ## Signature
937
-
938
- ```typescript
939
- function getState_Pads():
940
- Array<{ primitiveId: string; net: string; padNumber: string }> | undefined;
941
- ```
942
-
943
- ## Returns
944
-
945
- Array&lt;{ primitiveId: string; net: string; padNumber: string }&gt; \| undefined
946
-
947
- Pad
948
-
949
- ## Example
950
-
951
- ```javascript
952
- // 1. 放置一个测试器件
953
- const devices = await eda.lib_Device.search('C0402');
954
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
955
-
956
- // 2. 读取焊盘摘要数据
957
- const pads = comp.getState_Pads();
958
-
959
- // 3. 摘要出每个焊盘的编号与网络
960
- const padSummaries = pads.map(pad => ({ padNumber: pad.padNumber, net: pad.net }));
961
-
962
- // 4. 清理测试器件
963
- await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
964
-
965
- console.log('padCount:', pads.length);
966
- console.log('padSummaries:', JSON.stringify(padSummaries));
967
- ```
968
-
969
- ### getstate_primitiveid
970
-
971
- # IPCB\_PrimitiveComponent.getState\_PrimitiveId() method
972
-
973
- Get the property state: primitive ID
974
-
975
- ## Signature
976
-
977
- ```typescript
978
- function getState_PrimitiveId(): string;
979
- ```
980
-
981
- ## Returns
982
-
983
- string
984
-
985
- Primitive ID
986
-
987
- ## Example
988
-
989
- ```javascript
990
- // 1. 放置一个测试器件
991
- const devices = await eda.lib_Device.search('C0402');
992
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
993
-
994
- // 2. 读取图元 ID
995
- const primitiveId = comp.getState_PrimitiveId();
996
-
997
- // 3. 清理测试器件
998
- await eda.pcb_PrimitiveComponent.delete([primitiveId]);
999
-
1000
- console.log('primitiveId:', primitiveId);
1001
- ```
1002
-
1003
- ### getstate_primitivelock
1004
-
1005
- # IPCB\_PrimitiveComponent.getState\_PrimitiveLock() method
1006
-
1007
- Get the property state: whether it is locked
1008
-
1009
- ## Signature
1010
-
1011
- ```typescript
1012
- function getState_PrimitiveLock(): boolean;
1013
- ```
1014
-
1015
- ## Returns
1016
-
1017
- boolean
1018
-
1019
- Whether it is locked
1020
-
1021
- ## Example
1022
-
1023
- ```javascript
1024
- // 1. 放置一个测试器件
1025
- const devices = await eda.lib_Device.search('C0402');
1026
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
1027
-
1028
- // 2. 读取锁定状态
1029
- const primitiveLock = comp.getState_PrimitiveLock();
1030
-
1031
- // 3. 清理测试器件
1032
- await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
1033
-
1034
- console.log('primitiveLock:', primitiveLock);
1035
- ```
1036
-
1037
- ### getstate_primitivetype
1038
-
1039
- # IPCB\_PrimitiveComponent.getState\_PrimitiveType() method
1040
-
1041
- Get the property state: primitive type
1042
-
1043
- ## Signature
1044
-
1045
- ```typescript
1046
- function getState_PrimitiveType(): EPCB_PrimitiveType;
1047
- ```
1048
-
1049
- ## Returns
1050
-
1051
- [EPCB\_PrimitiveType](../enums/EPCB_PrimitiveType.md)
1052
-
1053
- Primitive type
1054
-
1055
- ## Example
1056
-
1057
- ```javascript
1058
- // 1. 放置一个测试器件
1059
- const devices = await eda.lib_Device.search('C0402');
1060
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
1061
-
1062
- // 2. 读取图元类型
1063
- const primitiveType = comp.getState_PrimitiveType();
1064
-
1065
- // 3. 清理测试器件
1066
- await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
1067
-
1068
- console.log('primitiveType:', primitiveType);
1069
- ```
1070
-
1071
- ### getstate_rotation
1072
-
1073
- # IPCB\_PrimitiveComponent.getState\_Rotation() method
1074
-
1075
- Get the property state: rotation angle
1076
-
1077
- ## Signature
1078
-
1079
- ```typescript
1080
- function getState_Rotation(): number;
1081
- ```
1082
-
1083
- ## Returns
1084
-
1085
- number
1086
-
1087
- Rotation angle
1088
-
1089
- ## Example
1090
-
1091
- ```javascript
1092
- // 1. 放置一个测试器件(默认 0 度)
1093
- const devices = await eda.lib_Device.search('C0402');
1094
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
1095
-
1096
- // 2. 读取旋转角度
1097
- const rotation = comp.getState_Rotation();
1098
-
1099
- // 3. 清理测试器件
1100
- await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
1101
-
1102
- console.log('rotation:', rotation);
1103
- ```
1104
-
1105
- ### getstate_supplier
1106
-
1107
- # IPCB\_PrimitiveComponent.getState\_Supplier() method
1108
-
1109
- Get the property state: supplier
1110
-
1111
- ## Signature
1112
-
1113
- ```typescript
1114
- function getState_Supplier(): string | undefined;
1115
- ```
1116
-
1117
- ## Returns
1118
-
1119
- string \| undefined
1120
-
1121
- Supplier
1122
-
1123
- ## Example
1124
-
1125
- ```javascript
1126
- // 1. 放置一个测试器件
1127
- const devices = await eda.lib_Device.search('C0402');
1128
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
1129
-
1130
- // 2. 读取供应商
1131
- const supplier = comp.getState_Supplier();
1132
-
1133
- // 3. 清理测试器件
1134
- await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
1135
-
1136
- console.log('supplier:', supplier);
1137
- ```
1138
-
1139
- ### getstate_supplierid
1140
-
1141
- # IPCB\_PrimitiveComponent.getState\_SupplierId() method
1142
-
1143
- Get the property state: supplier ID
1144
-
1145
- ## Signature
1146
-
1147
- ```typescript
1148
- function getState_SupplierId(): string | undefined;
1149
- ```
1150
-
1151
- ## Returns
1152
-
1153
- string \| undefined
1154
-
1155
- Supplier ID
1156
-
1157
- ## Example
1158
-
1159
- ```javascript
1160
- // 1. 放置一个测试器件
1161
- const devices = await eda.lib_Device.search('C0402');
1162
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
1163
-
1164
- // 2. 读取供应商编号
1165
- const supplierId = comp.getState_SupplierId();
1166
-
1167
- // 3. 清理测试器件
1168
- await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
1169
-
1170
- console.log('supplierId:', supplierId);
1171
- ```
1172
-
1173
- ### getstate_uniqueid
1174
-
1175
- # IPCB\_PrimitiveComponent.getState\_UniqueId() method
1176
-
1177
- Get the property state: unique ID
1178
-
1179
- ## Signature
1180
-
1181
- ```typescript
1182
- function getState_UniqueId(): string | undefined;
1183
- ```
1184
-
1185
- ## Returns
1186
-
1187
- string \| undefined
1188
-
1189
- Unique ID
1190
-
1191
- ## Example
1192
-
1193
- ```javascript
1194
- // 1. 放置一个测试器件
1195
- const devices = await eda.lib_Device.search('C0402');
1196
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
1197
-
1198
- // 2. 读取唯一 ID
1199
- const uniqueId = comp.getState_UniqueId();
1200
-
1201
- // 3. 清理测试器件
1202
- await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
1203
-
1204
- console.log('uniqueId:', JSON.stringify(uniqueId));
1205
- ```
1206
-
1207
- ### getstate_x
1208
-
1209
- # IPCB\_PrimitiveComponent.getState\_X() method
1210
-
1211
- Get the property state: X coordinate
1212
-
1213
- ## Signature
1214
-
1215
- ```typescript
1216
- function getState_X(): number;
1217
- ```
1218
-
1219
- ## Returns
1220
-
1221
- number
1222
-
1223
- X coordinate
1224
-
1225
- ## Example
1226
-
1227
- ```javascript
1228
- // 1. 放置一个测试器件
1229
- const devices = await eda.lib_Device.search('C0402');
1230
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
1231
-
1232
- // 2. 读取锚点 X 坐标
1233
- const x = comp.getState_X();
1234
-
1235
- // 3. 清理测试器件
1236
- await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
1237
-
1238
- console.log('x:', x);
1239
- ```
1240
-
1241
- ### getstate_y
1242
-
1243
- # IPCB\_PrimitiveComponent.getState\_Y() method
1244
-
1245
- Get the property state: Y coordinate
1246
-
1247
- ## Signature
1248
-
1249
- ```typescript
1250
- function getState_Y(): number;
1251
- ```
1252
-
1253
- ## Returns
1254
-
1255
- number
1256
-
1257
- Y coordinate
1258
-
1259
- ## Example
1260
-
1261
- ```javascript
1262
- // 1. 放置一个测试器件
1263
- const devices = await eda.lib_Device.search('C0402');
1264
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
1265
-
1266
- // 2. 读取锚点 Y 坐标
1267
- const y = comp.getState_Y();
1268
-
1269
- // 3. 清理测试器件
1270
- await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
1271
-
1272
- console.log('y:', y);
1273
- ```
1274
-
1275
- ### isasync
1276
-
1277
- # IPCB\_PrimitiveComponent.isAsync() method
1278
-
1279
- Query whether the primitive is an async primitive
1280
-
1281
- ## Signature
1282
-
1283
- ```typescript
1284
- function isAsync(): boolean;
1285
- ```
1286
-
1287
- ## Returns
1288
-
1289
- boolean
1290
-
1291
- Whether Is async primitive
1292
-
1293
- ## Example
1294
-
1295
- ```javascript
1296
- // 1. 放置一个测试器件
1297
- const devices = await eda.lib_Device.search('C0402');
1298
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
1299
-
1300
- // 2. 查询异步状态
1301
- const isAsync = comp.isAsync();
1302
-
1303
- // 3. 清理测试器件
1304
- await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
1305
-
1306
- console.log('isAsync:', isAsync);
1307
- ```
1308
-
1309
- ### reset
1310
-
1311
- # IPCB\_PrimitiveComponent.reset() method
1312
-
1313
- > 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.
1314
-
1315
- Reset the async primitive to the current canvas state
1316
-
1317
- ## Signature
1318
-
1319
- ```typescript
1320
- function reset(): Promise<IPCB_PrimitiveComponent>;
1321
- ```
1322
-
1323
- ## Returns
1324
-
1325
- Promise&lt;[IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)<!-- -->&gt;
1326
-
1327
- Device primitive object
1328
-
1329
- ## Example
1330
-
1331
- ```javascript
1332
- // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
1333
- const x = 20000 + Math.floor(Math.random() * 80000);
1334
- const y = 20000 + Math.floor(Math.random() * 80000);
1335
-
1336
- // 2. 放置测试器件(默认 0 度)
1337
- const devices = await eda.lib_Device.search('C0402');
1338
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
1339
- const compId = comp.getState_PrimitiveId();
1340
-
1341
- // 3. 记录画布上的原始旋转角度
1342
- const original = comp.getState_Rotation();
1343
-
1344
- // 4. 异步模式下改一个错误值,但不提交,直接 reset() 丢弃
1345
- const asyncComp = comp.toAsync();
1346
- asyncComp.setState_Rotation(270);
1347
- await asyncComp.reset();
1348
-
1349
- // 5. 从画布重新读取,确认值仍是原始值(保留现场供观察)
1350
- const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
1351
-
1352
- console.log('rotation:', original, '→', refetched[0].getState_Rotation(), '(修改已丢弃)');
1353
- ```
1354
-
1355
- ### setattribute
1356
-
1357
- # IPCB\_PrimitiveComponent.setAttribute() method
1358
-
1359
- > 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.
1360
-
1361
- Set Property
1362
-
1363
- ## Signature
1364
-
1365
- ```typescript
1366
- function setAttribute(
1367
- key: string,
1368
- value?: string | number | boolean,
1369
- keyVisible?: boolean,
1370
- valueVisible?: boolean,
1371
- ): Promise<IPCB_PrimitiveAttribute>;
1372
- ```
1373
-
1374
- ## Parameters
1375
-
1376
- <table><thead><tr><th>
1377
-
1378
- Parameter
1379
-
1380
- </th><th>
1381
-
1382
- Type
1383
-
1384
- </th><th>
1385
-
1386
- Description
1387
-
1388
- </th></tr></thead>
1389
- <tbody><tr><td>
1390
-
1391
- key
1392
-
1393
- </td><td>
1394
-
1395
- string
1396
-
1397
- </td><td>
1398
-
1399
- Attribute name. If the device does not have an attribute with this name, the attribute will be added
1400
-
1401
- </td></tr>
1402
- <tr><td>
1403
-
1404
- value
1405
-
1406
- </td><td>
1407
-
1408
- string \| number \| boolean
1409
-
1410
- </td><td>
1411
-
1412
- _(Optional)_ Property value
1413
-
1414
- </td></tr>
1415
- <tr><td>
1416
-
1417
- keyVisible
1418
-
1419
- </td><td>
1420
-
1421
- boolean
1422
-
1423
- </td><td>
1424
-
1425
- _(Optional)_ Attribute name visibility
1426
-
1427
- </td></tr>
1428
- <tr><td>
1429
-
1430
- valueVisible
1431
-
1432
- </td><td>
1433
-
1434
- boolean
1435
-
1436
- </td><td>
1437
-
1438
- _(Optional)_ Attribute value visibility
1439
-
1440
- </td></tr>
1441
- </tbody></table>
1442
-
1443
- ## Returns
1444
-
1445
- Promise&lt;[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)<!-- -->&gt;
1446
-
1447
- Attribute primitive object
1448
-
1449
- ## Example
1450
-
1451
- ```javascript
1452
- // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
1453
- const x = 20000 + Math.floor(Math.random() * 80000);
1454
- const y = 20000 + Math.floor(Math.random() * 80000);
1455
-
1456
- // 2. 放置测试器件
1457
- const devices = await eda.lib_Device.search('C0402');
1458
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
1459
- const compId = comp.getState_PrimitiveId();
1460
-
1461
- // 3. 设置自定义属性(属性名、属性值、名称可见、值可见)
1462
- await comp.setAttribute('嘉立创示例_Tolerance', '1%', true, true);
1463
-
1464
- // 4. 通过属性图元接口确认属性已写入(保留现场供观察)
1465
- const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
1466
- const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
1467
- const added = attrs.find(a => a.getState_Key() === '嘉立创示例_Tolerance');
1468
-
1469
- console.log('attrKey:', added.getState_Key());
1470
- console.log('attrValue:', added.getState_Value());
1471
- ```
1472
-
1473
- ### setstate_addintobom
1474
-
1475
- # IPCB\_PrimitiveComponent.setState\_AddIntoBom() method
1476
-
1477
- > 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.
1478
-
1479
- Set the property state: whether to add BOM
1480
-
1481
- ## Signature
1482
-
1483
- ```typescript
1484
- function setState_AddIntoBom(addIntoBom: boolean): IPCB_PrimitiveComponent;
1485
- ```
1486
-
1487
- ## Parameters
1488
-
1489
- <table><thead><tr><th>
1490
-
1491
- Parameter
1492
-
1493
- </th><th>
1494
-
1495
- Type
1496
-
1497
- </th><th>
1498
-
1499
- Description
1500
-
1501
- </th></tr></thead>
1502
- <tbody><tr><td>
1503
-
1504
- addIntoBom
1505
-
1506
- </td><td>
1507
-
1508
- boolean
1509
-
1510
- </td><td>
1511
-
1512
- Whether Add to BOM
1513
-
1514
- </td></tr>
1515
- </tbody></table>
1516
-
1517
- ## Returns
1518
-
1519
- [IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
1520
-
1521
- Device primitive object
1522
-
1523
- ## Example
1524
-
1525
- ```javascript
1526
- // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
1527
- const x = 20000 + Math.floor(Math.random() * 80000);
1528
- const y = 20000 + Math.floor(Math.random() * 80000);
1529
-
1530
- // 2. 放置测试器件
1531
- const devices = await eda.lib_Device.search('C0402');
1532
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
1533
- const compId = comp.getState_PrimitiveId();
1534
-
1535
- // 3. 读取修改前的值
1536
- const before = comp.getState_AddIntoBom();
1537
-
1538
- // 4. 异步模式改为不加入 BOM 并提交
1539
- const asyncComp = comp.toAsync();
1540
- asyncComp.setState_AddIntoBom(false);
1541
- await asyncComp.done();
1542
-
1543
- // 5. 从画布重新读取,确认修改已生效(保留现场供观察)
1544
- const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
1545
-
1546
- console.log('addIntoBom:', before, '→', refetched[0].getState_AddIntoBom());
1547
- ```
1548
-
1549
- ### setstate_designator
1550
-
1551
- # IPCB\_PrimitiveComponent.setState\_Designator() method
1552
-
1553
- > 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.
1554
-
1555
- Set the property state: designator
1556
-
1557
- ## Signature
1558
-
1559
- ```typescript
1560
- function setState_Designator(designator: string | undefined): IPCB_PrimitiveComponent;
1561
- ```
1562
-
1563
- ## Parameters
1564
-
1565
- <table><thead><tr><th>
1566
-
1567
- Parameter
1568
-
1569
- </th><th>
1570
-
1571
- Type
1572
-
1573
- </th><th>
1574
-
1575
- Description
1576
-
1577
- </th></tr></thead>
1578
- <tbody><tr><td>
1579
-
1580
- designator
1581
-
1582
- </td><td>
1583
-
1584
- string \| undefined
1585
-
1586
- </td><td>
1587
-
1588
- Designator
1589
-
1590
- </td></tr>
1591
- </tbody></table>
1592
-
1593
- ## Returns
1594
-
1595
- [IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
1596
-
1597
- Device primitive object
1598
-
1599
- ## Example
1600
-
1601
- ```javascript
1602
- // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
1603
- const x = 20000 + Math.floor(Math.random() * 80000);
1604
- const y = 20000 + Math.floor(Math.random() * 80000);
1605
-
1606
- // 2. 放置测试器件(位号由系统自动分配)
1607
- const devices = await eda.lib_Device.search('C0402');
1608
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
1609
- const compId = comp.getState_PrimitiveId();
1610
-
1611
- // 3. 读取修改前的位号
1612
- const before = comp.getState_Designator();
1613
-
1614
- // 4. 异步模式改位号并提交
1615
- const asyncComp = comp.toAsync();
1616
- asyncComp.setState_Designator('C101');
1617
- await asyncComp.done();
1618
-
1619
- // 5. 从画布重新读取,确认修改已生效(保留现场供观察)
1620
- const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
1621
-
1622
- console.log('designator:', before, '→', refetched[0].getState_Designator());
1623
- ```
1624
-
1625
- ### setstate_layer
1626
-
1627
- # IPCB\_PrimitiveComponent.setState\_Layer() method
1628
-
1629
- > 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.
1630
-
1631
- Set the property state: Layer
1632
-
1633
- ## Signature
1634
-
1635
- ```typescript
1636
- function setState_Layer(layer: TPCB_LayersOfComponent): IPCB_PrimitiveComponent;
1637
- ```
1638
-
1639
- ## Parameters
1640
-
1641
- <table><thead><tr><th>
1642
-
1643
- Parameter
1644
-
1645
- </th><th>
1646
-
1647
- Type
1648
-
1649
- </th><th>
1650
-
1651
- Description
1652
-
1653
- </th></tr></thead>
1654
- <tbody><tr><td>
1655
-
1656
- layer
1657
-
1658
- </td><td>
1659
-
1660
- [TPCB\_LayersOfComponent](../types/TPCB_LayersOfComponent.md)
1661
-
1662
- </td><td>
1663
-
1664
- Layer
1665
-
1666
- </td></tr>
1667
- </tbody></table>
1668
-
1669
- ## Returns
1670
-
1671
- [IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
1672
-
1673
- Device primitive object
1674
-
1675
- ## Example
1676
-
1677
- ```javascript
1678
- // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
1679
- const x = 20000 + Math.floor(Math.random() * 80000);
1680
- const y = 20000 + Math.floor(Math.random() * 80000);
1681
-
1682
- // 2. 放置测试器件(默认贴顶面)
1683
- const devices = await eda.lib_Device.search('C0402');
1684
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
1685
- const compId = comp.getState_PrimitiveId();
1686
-
1687
- // 3. 读取修改前的所在面
1688
- const before = comp.getState_Layer();
1689
-
1690
- // 4. 异步模式翻到底面并提交
1691
- const asyncComp = comp.toAsync();
1692
- asyncComp.setState_Layer(2);
1693
- await asyncComp.done();
1694
-
1695
- // 5. 从画布重新读取,确认修改已生效(保留现场供观察)
1696
- const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
1697
-
1698
- console.log('layer:', before, '→', refetched[0].getState_Layer());
1699
- ```
1700
-
1701
- ### setstate_manufacturer
1702
-
1703
- # IPCB\_PrimitiveComponent.setState\_Manufacturer() method
1704
-
1705
- > 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.
1706
-
1707
- Set the property state: manufacturer
1708
-
1709
- ## Signature
1710
-
1711
- ```typescript
1712
- function setState_Manufacturer(manufacturer: string | undefined): IPCB_PrimitiveComponent;
1713
- ```
1714
-
1715
- ## Parameters
1716
-
1717
- <table><thead><tr><th>
1718
-
1719
- Parameter
1720
-
1721
- </th><th>
1722
-
1723
- Type
1724
-
1725
- </th><th>
1726
-
1727
- Description
1728
-
1729
- </th></tr></thead>
1730
- <tbody><tr><td>
1731
-
1732
- manufacturer
1733
-
1734
- </td><td>
1735
-
1736
- string \| undefined
1737
-
1738
- </td><td>
1739
-
1740
- Manufacturer
1741
-
1742
- </td></tr>
1743
- </tbody></table>
1744
-
1745
- ## Returns
1746
-
1747
- [IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
1748
-
1749
- Device primitive object
1750
-
1751
- ## Example
1752
-
1753
- ```javascript
1754
- // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
1755
- const x = 20000 + Math.floor(Math.random() * 80000);
1756
- const y = 20000 + Math.floor(Math.random() * 80000);
1757
-
1758
- // 2. 放置测试器件
1759
- const devices = await eda.lib_Device.search('C0402');
1760
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
1761
- const compId = comp.getState_PrimitiveId();
1762
-
1763
- // 3. 读取修改前的制造商
1764
- const before = comp.getState_Manufacturer();
1765
-
1766
- // 4. 异步模式修改制造商并提交
1767
- const asyncComp = comp.toAsync();
1768
- asyncComp.setState_Manufacturer('嘉立创示例_MFR');
1769
- await asyncComp.done();
1770
-
1771
- // 5. 从画布重新读取,确认修改已生效(保留现场供观察)
1772
- const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
1773
-
1774
- console.log('manufacturer:', before, '→', refetched[0].getState_Manufacturer());
1775
- ```
1776
-
1777
- ### setstate_manufacturerid
1778
-
1779
- # IPCB\_PrimitiveComponent.setState\_ManufacturerId() method
1780
-
1781
- > 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.
1782
-
1783
- Set the property state: manufacturer ID
1784
-
1785
- ## Signature
1786
-
1787
- ```typescript
1788
- function setState_ManufacturerId(manufacturerId: string | undefined): IPCB_PrimitiveComponent;
1789
- ```
1790
-
1791
- ## Parameters
1792
-
1793
- <table><thead><tr><th>
1794
-
1795
- Parameter
1796
-
1797
- </th><th>
1798
-
1799
- Type
1800
-
1801
- </th><th>
1802
-
1803
- Description
1804
-
1805
- </th></tr></thead>
1806
- <tbody><tr><td>
1807
-
1808
- manufacturerId
1809
-
1810
- </td><td>
1811
-
1812
- string \| undefined
1813
-
1814
- </td><td>
1815
-
1816
- Manufacturer ID
1817
-
1818
- </td></tr>
1819
- </tbody></table>
1820
-
1821
- ## Returns
1822
-
1823
- [IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
1824
-
1825
- Device primitive object
1826
-
1827
- ## Example
1828
-
1829
- ```javascript
1830
- // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
1831
- const x = 20000 + Math.floor(Math.random() * 80000);
1832
- const y = 20000 + Math.floor(Math.random() * 80000);
1833
-
1834
- // 2. 放置测试器件
1835
- const devices = await eda.lib_Device.search('C0402');
1836
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
1837
- const compId = comp.getState_PrimitiveId();
1838
-
1839
- // 3. 读取修改前的制造商编号
1840
- const before = comp.getState_ManufacturerId();
1841
-
1842
- // 4. 异步模式修改制造商编号并提交
1843
- const asyncComp = comp.toAsync();
1844
- asyncComp.setState_ManufacturerId('MFR-DEMO-001');
1845
- await asyncComp.done();
1846
-
1847
- // 5. 从画布重新读取,确认修改已生效(保留现场供观察)
1848
- const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
1849
-
1850
- console.log('manufacturerId:', before, '→', refetched[0].getState_ManufacturerId());
1851
- ```
1852
-
1853
- ### setstate_name
1854
-
1855
- # IPCB\_PrimitiveComponent.setState\_Name() method
1856
-
1857
- > 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.
1858
-
1859
- Set the property state: name
1860
-
1861
- ## Signature
1862
-
1863
- ```typescript
1864
- function setState_Name(name: string | undefined): IPCB_PrimitiveComponent;
1865
- ```
1866
-
1867
- ## Parameters
1868
-
1869
- <table><thead><tr><th>
1870
-
1871
- Parameter
1872
-
1873
- </th><th>
1874
-
1875
- Type
1876
-
1877
- </th><th>
1878
-
1879
- Description
1880
-
1881
- </th></tr></thead>
1882
- <tbody><tr><td>
1883
-
1884
- name
1885
-
1886
- </td><td>
1887
-
1888
- string \| undefined
1889
-
1890
- </td><td>
1891
-
1892
- Name
1893
-
1894
- </td></tr>
1895
- </tbody></table>
1896
-
1897
- ## Returns
1898
-
1899
- [IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
1900
-
1901
- Device primitive object
1902
-
1903
- ## Example
1904
-
1905
- ```javascript
1906
- // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
1907
- const x = 20000 + Math.floor(Math.random() * 80000);
1908
- const y = 20000 + Math.floor(Math.random() * 80000);
1909
-
1910
- // 2. 放置测试器件
1911
- const devices = await eda.lib_Device.search('C0402');
1912
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
1913
- const compId = comp.getState_PrimitiveId();
1914
-
1915
- // 3. 读取修改前的名称(模板表达式)
1916
- const before = comp.getState_Name();
1917
-
1918
- // 4. 异步模式改为固定名称并提交
1919
- const asyncComp = comp.toAsync();
1920
- asyncComp.setState_Name('嘉立创示例_Name');
1921
- await asyncComp.done();
1922
-
1923
- // 5. 从画布重新读取,确认修改已生效(保留现场供观察)
1924
- const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
1925
-
1926
- console.log('name:', before, '→', refetched[0].getState_Name());
1927
- ```
1928
-
1929
- ### setstate_otherproperty
1930
-
1931
- # IPCB\_PrimitiveComponent.setState\_OtherProperty() method
1932
-
1933
- > 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.
1934
-
1935
- Set the property state: other parameters
1936
-
1937
- ## Signature
1938
-
1939
- ```typescript
1940
- function setState_OtherProperty(
1941
- otherProperty: Record<string, string | number | boolean>,
1942
- ): IPCB_PrimitiveComponent;
1943
- ```
1944
-
1945
- ## Parameters
1946
-
1947
- <table><thead><tr><th>
1948
-
1949
- Parameter
1950
-
1951
- </th><th>
1952
-
1953
- Type
1954
-
1955
- </th><th>
1956
-
1957
- Description
1958
-
1959
- </th></tr></thead>
1960
- <tbody><tr><td>
1961
-
1962
- otherProperty
1963
-
1964
- </td><td>
1965
-
1966
- Record&lt;string, string \| number \| boolean&gt;
1967
-
1968
- </td><td>
1969
-
1970
- Other parameters
1971
-
1972
- </td></tr>
1973
- </tbody></table>
1974
-
1975
- ## Returns
1976
-
1977
- [IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
1978
-
1979
- Device primitive object
1980
-
1981
- ## Example
1982
-
1983
- ```javascript
1984
- // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
1985
- const x = 20000 + Math.floor(Math.random() * 80000);
1986
- const y = 20000 + Math.floor(Math.random() * 80000);
1987
-
1988
- // 2. 放置测试器件
1989
- const devices = await eda.lib_Device.search('C0402');
1990
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
1991
- const compId = comp.getState_PrimitiveId();
1992
-
1993
- // 3. 读取修改前的参数数量
1994
- const beforeCount = Object.keys(comp.getState_OtherProperty() || {}).length;
1995
-
1996
- // 4. 异步模式写入新的参数字典并提交
1997
- const asyncComp = comp.toAsync();
1998
- asyncComp.setState_OtherProperty({ 嘉立创示例_Custom: 'ABC', Count: 3 });
1999
- await asyncComp.done();
2000
-
2001
- // 5. 从画布重新读取,确认参数已写入(保留现场供观察)
2002
- const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
2003
- const after = refetched[0].getState_OtherProperty();
2004
-
2005
- console.log('propertyCount:', beforeCount, '→', Object.keys(after).length);
2006
- console.log('customValue:', after['嘉立创示例_Custom']);
2007
- ```
2008
-
2009
- ### setstate_primitivelock
2010
-
2011
- # IPCB\_PrimitiveComponent.setState\_PrimitiveLock() method
2012
-
2013
- > 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.
2014
-
2015
- Set the property state: whether it is locked
2016
-
2017
- ## Signature
2018
-
2019
- ```typescript
2020
- function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitiveComponent;
2021
- ```
2022
-
2023
- ## Parameters
2024
-
2025
- <table><thead><tr><th>
2026
-
2027
- Parameter
2028
-
2029
- </th><th>
2030
-
2031
- Type
2032
-
2033
- </th><th>
2034
-
2035
- Description
2036
-
2037
- </th></tr></thead>
2038
- <tbody><tr><td>
2039
-
2040
- primitiveLock
2041
-
2042
- </td><td>
2043
-
2044
- boolean
2045
-
2046
- </td><td>
2047
-
2048
- Whether it is locked
2049
-
2050
- </td></tr>
2051
- </tbody></table>
2052
-
2053
- ## Returns
2054
-
2055
- [IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
2056
-
2057
- Device primitive object
2058
-
2059
- ## Example
2060
-
2061
- ```javascript
2062
- // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
2063
- const x = 20000 + Math.floor(Math.random() * 80000);
2064
- const y = 20000 + Math.floor(Math.random() * 80000);
2065
-
2066
- // 2. 放置测试器件
2067
- const devices = await eda.lib_Device.search('C0402');
2068
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
2069
- const compId = comp.getState_PrimitiveId();
2070
-
2071
- // 3. 读取修改前的锁定状态
2072
- const before = comp.getState_PrimitiveLock();
2073
-
2074
- // 4. 异步模式锁定器件并提交
2075
- const asyncComp = comp.toAsync();
2076
- asyncComp.setState_PrimitiveLock(true);
2077
- await asyncComp.done();
2078
-
2079
- // 5. 从画布重新读取,确认修改已生效(保留现场供观察)
2080
- const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
2081
-
2082
- console.log('primitiveLock:', before, '→', refetched[0].getState_PrimitiveLock());
2083
- ```
2084
-
2085
- ### setstate_rotation
2086
-
2087
- # IPCB\_PrimitiveComponent.setState\_Rotation() method
2088
-
2089
- > 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.
2090
-
2091
- Set the property state: rotation angle
2092
-
2093
- ## Signature
2094
-
2095
- ```typescript
2096
- function setState_Rotation(rotation: number): IPCB_PrimitiveComponent;
2097
- ```
2098
-
2099
- ## Parameters
2100
-
2101
- <table><thead><tr><th>
2102
-
2103
- Parameter
2104
-
2105
- </th><th>
2106
-
2107
- Type
2108
-
2109
- </th><th>
2110
-
2111
- Description
2112
-
2113
- </th></tr></thead>
2114
- <tbody><tr><td>
2115
-
2116
- rotation
2117
-
2118
- </td><td>
2119
-
2120
- number
2121
-
2122
- </td><td>
2123
-
2124
- Rotation angle
2125
-
2126
- </td></tr>
2127
- </tbody></table>
2128
-
2129
- ## Returns
2130
-
2131
- [IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
2132
-
2133
- Device primitive object
2134
-
2135
- ## Example
2136
-
2137
- ```javascript
2138
- // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
2139
- const x = 20000 + Math.floor(Math.random() * 80000);
2140
- const y = 20000 + Math.floor(Math.random() * 80000);
2141
-
2142
- // 2. 放置测试器件(默认 0 度)
2143
- const devices = await eda.lib_Device.search('C0402');
2144
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
2145
- const compId = comp.getState_PrimitiveId();
2146
-
2147
- // 3. 读取修改前的旋转角度
2148
- const before = comp.getState_Rotation();
2149
-
2150
- // 4. 异步模式旋转 90 度并提交
2151
- const asyncComp = comp.toAsync();
2152
- asyncComp.setState_Rotation(90);
2153
- await asyncComp.done();
2154
-
2155
- // 5. 从画布重新读取,确认修改已生效(保留现场供观察)
2156
- const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
2157
-
2158
- console.log('rotation:', before, '→', refetched[0].getState_Rotation());
2159
- ```
2160
-
2161
- ### setstate_supplier
2162
-
2163
- # IPCB\_PrimitiveComponent.setState\_Supplier() method
2164
-
2165
- > 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.
2166
-
2167
- Set the property state: supplier
2168
-
2169
- ## Signature
2170
-
2171
- ```typescript
2172
- function setState_Supplier(supplier: string | undefined): IPCB_PrimitiveComponent;
2173
- ```
2174
-
2175
- ## Parameters
2176
-
2177
- <table><thead><tr><th>
2178
-
2179
- Parameter
2180
-
2181
- </th><th>
2182
-
2183
- Type
2184
-
2185
- </th><th>
2186
-
2187
- Description
2188
-
2189
- </th></tr></thead>
2190
- <tbody><tr><td>
2191
-
2192
- supplier
2193
-
2194
- </td><td>
2195
-
2196
- string \| undefined
2197
-
2198
- </td><td>
2199
-
2200
- Supplier
2201
-
2202
- </td></tr>
2203
- </tbody></table>
2204
-
2205
- ## Returns
2206
-
2207
- [IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
2208
-
2209
- Device primitive object
2210
-
2211
- ## Example
2212
-
2213
- ```javascript
2214
- // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
2215
- const x = 20000 + Math.floor(Math.random() * 80000);
2216
- const y = 20000 + Math.floor(Math.random() * 80000);
2217
-
2218
- // 2. 放置测试器件
2219
- const devices = await eda.lib_Device.search('C0402');
2220
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
2221
- const compId = comp.getState_PrimitiveId();
2222
-
2223
- // 3. 读取修改前的供应商
2224
- const before = comp.getState_Supplier();
2225
-
2226
- // 4. 异步模式修改供应商并提交
2227
- const asyncComp = comp.toAsync();
2228
- asyncComp.setState_Supplier('嘉立创示例_SUP');
2229
- await asyncComp.done();
2230
-
2231
- // 5. 从画布重新读取,确认修改已生效(保留现场供观察)
2232
- const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
2233
-
2234
- console.log('supplier:', before, '→', refetched[0].getState_Supplier());
2235
- ```
2236
-
2237
- ### setstate_supplierid
2238
-
2239
- # IPCB\_PrimitiveComponent.setState\_SupplierId() method
2240
-
2241
- > 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.
2242
-
2243
- Set the property state: supplier ID
2244
-
2245
- ## Signature
2246
-
2247
- ```typescript
2248
- function setState_SupplierId(supplierId: string | undefined): IPCB_PrimitiveComponent;
2249
- ```
2250
-
2251
- ## Parameters
2252
-
2253
- <table><thead><tr><th>
2254
-
2255
- Parameter
2256
-
2257
- </th><th>
2258
-
2259
- Type
2260
-
2261
- </th><th>
2262
-
2263
- Description
2264
-
2265
- </th></tr></thead>
2266
- <tbody><tr><td>
2267
-
2268
- supplierId
2269
-
2270
- </td><td>
2271
-
2272
- string \| undefined
2273
-
2274
- </td><td>
2275
-
2276
- Supplier ID
2277
-
2278
- </td></tr>
2279
- </tbody></table>
2280
-
2281
- ## Returns
2282
-
2283
- [IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
2284
-
2285
- Device primitive object
2286
-
2287
- ## Example
2288
-
2289
- ```javascript
2290
- // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
2291
- const x = 20000 + Math.floor(Math.random() * 80000);
2292
- const y = 20000 + Math.floor(Math.random() * 80000);
2293
-
2294
- // 2. 放置测试器件
2295
- const devices = await eda.lib_Device.search('C0402');
2296
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
2297
- const compId = comp.getState_PrimitiveId();
2298
-
2299
- // 3. 读取修改前的供应商编号
2300
- const before = comp.getState_SupplierId();
2301
-
2302
- // 4. 异步模式修改供应商编号并提交
2303
- const asyncComp = comp.toAsync();
2304
- asyncComp.setState_SupplierId('SUP-DEMO-001');
2305
- await asyncComp.done();
2306
-
2307
- // 5. 从画布重新读取,确认修改已生效(保留现场供观察)
2308
- const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
2309
-
2310
- console.log('supplierId:', before, '→', refetched[0].getState_SupplierId());
2311
- ```
2312
-
2313
- ### setstate_uniqueid
2314
-
2315
- # IPCB\_PrimitiveComponent.setState\_UniqueId() method
2316
-
2317
- > 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.
2318
-
2319
- Set the property state: unique ID
2320
-
2321
- ## Signature
2322
-
2323
- ```typescript
2324
- function setState_UniqueId(uniqueId: string | undefined): IPCB_PrimitiveComponent;
2325
- ```
2326
-
2327
- ## Parameters
2328
-
2329
- <table><thead><tr><th>
2330
-
2331
- Parameter
2332
-
2333
- </th><th>
2334
-
2335
- Type
2336
-
2337
- </th><th>
2338
-
2339
- Description
2340
-
2341
- </th></tr></thead>
2342
- <tbody><tr><td>
2343
-
2344
- uniqueId
2345
-
2346
- </td><td>
2347
-
2348
- string \| undefined
2349
-
2350
- </td><td>
2351
-
2352
- Unique ID
2353
-
2354
- </td></tr>
2355
- </tbody></table>
2356
-
2357
- ## Returns
2358
-
2359
- [IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
2360
-
2361
- Device primitive object
2362
-
2363
- ## Example
2364
-
2365
- ```javascript
2366
- // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
2367
- const x = 20000 + Math.floor(Math.random() * 80000);
2368
- const y = 20000 + Math.floor(Math.random() * 80000);
2369
-
2370
- // 2. 放置测试器件
2371
- const devices = await eda.lib_Device.search('C0402');
2372
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
2373
- const compId = comp.getState_PrimitiveId();
2374
-
2375
- // 3. 读取修改前的唯一 ID(默认空字符串)
2376
- const before = comp.getState_UniqueId();
2377
-
2378
- // 4. 异步模式设置分组唯一 ID 并提交
2379
- const asyncComp = comp.toAsync();
2380
- asyncComp.setState_UniqueId('JLC-DEMO-001');
2381
- await asyncComp.done();
2382
-
2383
- // 5. 从画布重新读取,确认修改已生效(保留现场供观察)
2384
- const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
2385
-
2386
- console.log('uniqueId:', JSON.stringify(before), '→', JSON.stringify(refetched[0].getState_UniqueId()));
2387
- ```
2388
-
2389
- ### setstate_x
2390
-
2391
- # IPCB\_PrimitiveComponent.setState\_X() method
2392
-
2393
- > 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.
2394
-
2395
- Set the property state: X coordinate
2396
-
2397
- ## Signature
2398
-
2399
- ```typescript
2400
- function setState_X(x: number): IPCB_PrimitiveComponent;
2401
- ```
2402
-
2403
- ## Parameters
2404
-
2405
- <table><thead><tr><th>
2406
-
2407
- Parameter
2408
-
2409
- </th><th>
2410
-
2411
- Type
2412
-
2413
- </th><th>
2414
-
2415
- Description
2416
-
2417
- </th></tr></thead>
2418
- <tbody><tr><td>
2419
-
2420
- x
2421
-
2422
- </td><td>
2423
-
2424
- number
2425
-
2426
- </td><td>
2427
-
2428
- X coordinate
2429
-
2430
- </td></tr>
2431
- </tbody></table>
2432
-
2433
- ## Returns
2434
-
2435
- [IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
2436
-
2437
- Device primitive object
2438
-
2439
- ## Example
2440
-
2441
- ```javascript
2442
- // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
2443
- const x = 20000 + Math.floor(Math.random() * 80000);
2444
- const y = 20000 + Math.floor(Math.random() * 80000);
2445
-
2446
- // 2. 放置测试器件
2447
- const devices = await eda.lib_Device.search('C0402');
2448
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
2449
- const compId = comp.getState_PrimitiveId();
2450
-
2451
- // 3. 读取修改前的锚点 X 坐标
2452
- const before = comp.getState_X();
2453
-
2454
- // 4. 异步模式向右移动 300mil 并提交
2455
- const asyncComp = comp.toAsync();
2456
- asyncComp.setState_X(before + 300);
2457
- await asyncComp.done();
2458
-
2459
- // 5. 从画布重新读取,确认修改已生效(保留现场供观察)
2460
- const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
2461
-
2462
- console.log('x:', before, '→', refetched[0].getState_X());
2463
- ```
2464
-
2465
- ### setstate_y
2466
-
2467
- # IPCB\_PrimitiveComponent.setState\_Y() method
2468
-
2469
- > 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.
2470
-
2471
- Set the property state: Y coordinate
2472
-
2473
- ## Signature
2474
-
2475
- ```typescript
2476
- function setState_Y(y: number): IPCB_PrimitiveComponent;
2477
- ```
2478
-
2479
- ## Parameters
2480
-
2481
- <table><thead><tr><th>
2482
-
2483
- Parameter
2484
-
2485
- </th><th>
2486
-
2487
- Type
2488
-
2489
- </th><th>
2490
-
2491
- Description
2492
-
2493
- </th></tr></thead>
2494
- <tbody><tr><td>
2495
-
2496
- y
2497
-
2498
- </td><td>
2499
-
2500
- number
2501
-
2502
- </td><td>
2503
-
2504
- Y coordinate
2505
-
2506
- </td></tr>
2507
- </tbody></table>
2508
-
2509
- ## Returns
2510
-
2511
- [IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
2512
-
2513
- Device primitive object
2514
-
2515
- ## Example
2516
-
2517
- ```javascript
2518
- // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
2519
- const x = 20000 + Math.floor(Math.random() * 80000);
2520
- const y = 20000 + Math.floor(Math.random() * 80000);
2521
-
2522
- // 2. 放置测试器件
2523
- const devices = await eda.lib_Device.search('C0402');
2524
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
2525
- const compId = comp.getState_PrimitiveId();
2526
-
2527
- // 3. 读取修改前的锚点 Y 坐标
2528
- const before = comp.getState_Y();
2529
-
2530
- // 4. 异步模式向上移动 300mil 并提交
2531
- const asyncComp = comp.toAsync();
2532
- asyncComp.setState_Y(before + 300);
2533
- await asyncComp.done();
2534
-
2535
- // 5. 从画布重新读取,确认修改已生效(保留现场供观察)
2536
- const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
2537
-
2538
- console.log('y:', before, '→', refetched[0].getState_Y());
2539
- ```
2540
-
2541
- ### toasync
2542
-
2543
- # IPCB\_PrimitiveComponent.toAsync() method
2544
-
2545
- Convert Primitive to Async primitive
2546
-
2547
- ## Signature
2548
-
2549
- ```typescript
2550
- function toAsync(): IPCB_PrimitiveComponent;
2551
- ```
2552
-
2553
- ## Returns
2554
-
2555
- [IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
2556
-
2557
- Device primitive object
2558
-
2559
- ## Example
2560
-
2561
- ```javascript
2562
- // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
2563
- const x = 20000 + Math.floor(Math.random() * 80000);
2564
- const y = 20000 + Math.floor(Math.random() * 80000);
2565
-
2566
- // 2. 放置测试器件
2567
- const devices = await eda.lib_Device.search('C0402');
2568
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
2569
- const compId = comp.getState_PrimitiveId();
2570
-
2571
- // 3. 转换为异步图元
2572
- const asyncComp = comp.toAsync();
2573
- const isAsyncNow = asyncComp.isAsync();
2574
-
2575
- // 4. 在异步模式下修改位号并提交
2576
- asyncComp.setState_Designator('C102');
2577
- await asyncComp.done();
2578
-
2579
- // 5. 从画布重新读取,确认修改已生效(保留现场供观察)
2580
- const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
2581
-
2582
- console.log('isAsync:', isAsyncNow);
2583
- console.log('designator:', refetched[0].getState_Designator());
2584
- ```
2585
-
2586
- ### tosync
2587
-
2588
- # IPCB\_PrimitiveComponent.toSync() method
2589
-
2590
- Convert Primitive to Sync primitive
2591
-
2592
- ## Signature
2593
-
2594
- ```typescript
2595
- function toSync(): IPCB_PrimitiveComponent;
2596
- ```
2597
-
2598
- ## Returns
2599
-
2600
- [IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
2601
-
2602
- Device primitive object
2603
-
2604
- ## Example
2605
-
2606
- ```javascript
2607
- // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
2608
- const x = 20000 + Math.floor(Math.random() * 80000);
2609
- const y = 20000 + Math.floor(Math.random() * 80000);
2610
-
2611
- // 2. 放置测试器件
2612
- const devices = await eda.lib_Device.search('C0402');
2613
- const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
2614
- const compId = comp.getState_PrimitiveId();
2615
-
2616
- // 3. 读取修改前的位号
2617
- const before = comp.getState_Designator();
2618
-
2619
- // 4. 转换为同步图元后直接修改,立即生效(无需 done())
2620
- const syncComp = comp.toSync();
2621
- syncComp.setState_Designator('C103');
2622
-
2623
- // 5. 从画布重新读取,确认修改已生效(保留现场供观察)
2624
- const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
2625
-
2626
- console.log('designator:', before, '→', refetched[0].getState_Designator());
2627
- ```
1
+ # IPCB\_PrimitiveComponent class
2
+
3
+ Device primitive
4
+
5
+ ## Signature
6
+
7
+ ```typescript
8
+ class IPCB_PrimitiveComponent 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
+ [done()](./IPCB_PrimitiveComponent.md)
32
+
33
+ </td><td>
34
+
35
+ </td><td>
36
+
37
+ **_(BETA)_** Apply the changes to the primitives to the canvas
38
+
39
+ </td></tr>
40
+ <tr><td>
41
+
42
+ [getAllPins()](./IPCB_PrimitiveComponent.md)
43
+
44
+ </td><td>
45
+
46
+ </td><td>
47
+
48
+ **_(BETA)_** Get all pads associated with the device
49
+
50
+ </td></tr>
51
+ <tr><td>
52
+
53
+ [getState\_AddIntoBom()](./IPCB_PrimitiveComponent.md)
54
+
55
+ </td><td>
56
+
57
+ </td><td>
58
+
59
+ Get the property state: whether to add BOM
60
+
61
+ </td></tr>
62
+ <tr><td>
63
+
64
+ [getState\_Component()](./IPCB_PrimitiveComponent.md)
65
+
66
+ </td><td>
67
+
68
+ </td><td>
69
+
70
+ Get the property state: associate library device
71
+
72
+ </td></tr>
73
+ <tr><td>
74
+
75
+ [getState\_Designator()](./IPCB_PrimitiveComponent.md)
76
+
77
+ </td><td>
78
+
79
+ </td><td>
80
+
81
+ Get the property state: designator
82
+
83
+ </td></tr>
84
+ <tr><td>
85
+
86
+ [getState\_Footprint()](./IPCB_PrimitiveComponent.md)
87
+
88
+ </td><td>
89
+
90
+ </td><td>
91
+
92
+ Get the property state: associate library footprint
93
+
94
+ </td></tr>
95
+ <tr><td>
96
+
97
+ [getState\_Layer()](./IPCB_PrimitiveComponent.md)
98
+
99
+ </td><td>
100
+
101
+ </td><td>
102
+
103
+ Get the property state: Layer
104
+
105
+ </td></tr>
106
+ <tr><td>
107
+
108
+ [getState\_Manufacturer()](./IPCB_PrimitiveComponent.md)
109
+
110
+ </td><td>
111
+
112
+ </td><td>
113
+
114
+ Get the property state: manufacturer
115
+
116
+ </td></tr>
117
+ <tr><td>
118
+
119
+ [getState\_ManufacturerId()](./IPCB_PrimitiveComponent.md)
120
+
121
+ </td><td>
122
+
123
+ </td><td>
124
+
125
+ Get the property state: manufacturer ID
126
+
127
+ </td></tr>
128
+ <tr><td>
129
+
130
+ [getState\_Model3D()](./IPCB_PrimitiveComponent.md)
131
+
132
+ </td><td>
133
+
134
+ </td><td>
135
+
136
+ Get the property state: associate library 3D model
137
+
138
+ </td></tr>
139
+ <tr><td>
140
+
141
+ [getState\_Name()](./IPCB_PrimitiveComponent.md)
142
+
143
+ </td><td>
144
+
145
+ </td><td>
146
+
147
+ Get the property state: name
148
+
149
+ </td></tr>
150
+ <tr><td>
151
+
152
+ [getState\_OtherProperty()](./IPCB_PrimitiveComponent.md)
153
+
154
+ </td><td>
155
+
156
+ </td><td>
157
+
158
+ Get the property state: other parameters
159
+
160
+ </td></tr>
161
+ <tr><td>
162
+
163
+ [getState\_Pads()](./IPCB_PrimitiveComponent.md)
164
+
165
+ </td><td>
166
+
167
+ </td><td>
168
+
169
+ Get the property state: pad
170
+
171
+ </td></tr>
172
+ <tr><td>
173
+
174
+ [getState\_PrimitiveId()](./IPCB_PrimitiveComponent.md)
175
+
176
+ </td><td>
177
+
178
+ </td><td>
179
+
180
+ Get the property state: primitive ID
181
+
182
+ </td></tr>
183
+ <tr><td>
184
+
185
+ [getState\_PrimitiveLock()](./IPCB_PrimitiveComponent.md)
186
+
187
+ </td><td>
188
+
189
+ </td><td>
190
+
191
+ Get the property state: whether it is locked
192
+
193
+ </td></tr>
194
+ <tr><td>
195
+
196
+ [getState\_PrimitiveType()](./IPCB_PrimitiveComponent.md)
197
+
198
+ </td><td>
199
+
200
+ </td><td>
201
+
202
+ Get the property state: primitive type
203
+
204
+ </td></tr>
205
+ <tr><td>
206
+
207
+ [getState\_Rotation()](./IPCB_PrimitiveComponent.md)
208
+
209
+ </td><td>
210
+
211
+ </td><td>
212
+
213
+ Get the property state: rotation angle
214
+
215
+ </td></tr>
216
+ <tr><td>
217
+
218
+ [getState\_Supplier()](./IPCB_PrimitiveComponent.md)
219
+
220
+ </td><td>
221
+
222
+ </td><td>
223
+
224
+ Get the property state: supplier
225
+
226
+ </td></tr>
227
+ <tr><td>
228
+
229
+ [getState\_SupplierId()](./IPCB_PrimitiveComponent.md)
230
+
231
+ </td><td>
232
+
233
+ </td><td>
234
+
235
+ Get the property state: supplier ID
236
+
237
+ </td></tr>
238
+ <tr><td>
239
+
240
+ [getState\_UniqueId()](./IPCB_PrimitiveComponent.md)
241
+
242
+ </td><td>
243
+
244
+ </td><td>
245
+
246
+ Get the property state: unique ID
247
+
248
+ </td></tr>
249
+ <tr><td>
250
+
251
+ [getState\_X()](./IPCB_PrimitiveComponent.md)
252
+
253
+ </td><td>
254
+
255
+ </td><td>
256
+
257
+ Get the property state: X coordinate
258
+
259
+ </td></tr>
260
+ <tr><td>
261
+
262
+ [getState\_Y()](./IPCB_PrimitiveComponent.md)
263
+
264
+ </td><td>
265
+
266
+ </td><td>
267
+
268
+ Get the property state: Y coordinate
269
+
270
+ </td></tr>
271
+ <tr><td>
272
+
273
+ [isAsync()](./IPCB_PrimitiveComponent.md)
274
+
275
+ </td><td>
276
+
277
+ </td><td>
278
+
279
+ Query whether the primitive is an async primitive
280
+
281
+ </td></tr>
282
+ <tr><td>
283
+
284
+ [reset()](./IPCB_PrimitiveComponent.md)
285
+
286
+ </td><td>
287
+
288
+ </td><td>
289
+
290
+ **_(BETA)_** Reset the async primitive to the current canvas state
291
+
292
+ </td></tr>
293
+ <tr><td>
294
+
295
+ [setAttribute(key, value, keyVisible, valueVisible)](./IPCB_PrimitiveComponent.md)
296
+
297
+ </td><td>
298
+
299
+ </td><td>
300
+
301
+ **_(BETA)_** Set Property
302
+
303
+ </td></tr>
304
+ <tr><td>
305
+
306
+ [setState\_AddIntoBom(addIntoBom)](./IPCB_PrimitiveComponent.md)
307
+
308
+ </td><td>
309
+
310
+ </td><td>
311
+
312
+ **_(BETA)_** Set the property state: whether to add BOM
313
+
314
+ </td></tr>
315
+ <tr><td>
316
+
317
+ [setState\_Designator(designator)](./IPCB_PrimitiveComponent.md)
318
+
319
+ </td><td>
320
+
321
+ </td><td>
322
+
323
+ **_(BETA)_** Set the property state: designator
324
+
325
+ </td></tr>
326
+ <tr><td>
327
+
328
+ [setState\_Layer(layer)](./IPCB_PrimitiveComponent.md)
329
+
330
+ </td><td>
331
+
332
+ </td><td>
333
+
334
+ **_(BETA)_** Set the property state: Layer
335
+
336
+ </td></tr>
337
+ <tr><td>
338
+
339
+ [setState\_Manufacturer(manufacturer)](./IPCB_PrimitiveComponent.md)
340
+
341
+ </td><td>
342
+
343
+ </td><td>
344
+
345
+ **_(BETA)_** Set the property state: manufacturer
346
+
347
+ </td></tr>
348
+ <tr><td>
349
+
350
+ [setState\_ManufacturerId(manufacturerId)](./IPCB_PrimitiveComponent.md)
351
+
352
+ </td><td>
353
+
354
+ </td><td>
355
+
356
+ **_(BETA)_** Set the property state: manufacturer ID
357
+
358
+ </td></tr>
359
+ <tr><td>
360
+
361
+ [setState\_Name(name)](./IPCB_PrimitiveComponent.md)
362
+
363
+ </td><td>
364
+
365
+ </td><td>
366
+
367
+ **_(BETA)_** Set the property state: name
368
+
369
+ </td></tr>
370
+ <tr><td>
371
+
372
+ [setState\_OtherProperty(otherProperty)](./IPCB_PrimitiveComponent.md)
373
+
374
+ </td><td>
375
+
376
+ </td><td>
377
+
378
+ **_(BETA)_** Set the property state: other parameters
379
+
380
+ </td></tr>
381
+ <tr><td>
382
+
383
+ [setState\_PrimitiveLock(primitiveLock)](./IPCB_PrimitiveComponent.md)
384
+
385
+ </td><td>
386
+
387
+ </td><td>
388
+
389
+ **_(BETA)_** Set the property state: whether it is locked
390
+
391
+ </td></tr>
392
+ <tr><td>
393
+
394
+ [setState\_Rotation(rotation)](./IPCB_PrimitiveComponent.md)
395
+
396
+ </td><td>
397
+
398
+ </td><td>
399
+
400
+ **_(BETA)_** Set the property state: rotation angle
401
+
402
+ </td></tr>
403
+ <tr><td>
404
+
405
+ [setState\_Supplier(supplier)](./IPCB_PrimitiveComponent.md)
406
+
407
+ </td><td>
408
+
409
+ </td><td>
410
+
411
+ **_(BETA)_** Set the property state: supplier
412
+
413
+ </td></tr>
414
+ <tr><td>
415
+
416
+ [setState\_SupplierId(supplierId)](./IPCB_PrimitiveComponent.md)
417
+
418
+ </td><td>
419
+
420
+ </td><td>
421
+
422
+ **_(BETA)_** Set the property state: supplier ID
423
+
424
+ </td></tr>
425
+ <tr><td>
426
+
427
+ [setState\_UniqueId(uniqueId)](./IPCB_PrimitiveComponent.md)
428
+
429
+ </td><td>
430
+
431
+ </td><td>
432
+
433
+ **_(BETA)_** Set the property state: unique ID
434
+
435
+ </td></tr>
436
+ <tr><td>
437
+
438
+ [setState\_X(x)](./IPCB_PrimitiveComponent.md)
439
+
440
+ </td><td>
441
+
442
+ </td><td>
443
+
444
+ **_(BETA)_** Set the property state: X coordinate
445
+
446
+ </td></tr>
447
+ <tr><td>
448
+
449
+ [setState\_Y(y)](./IPCB_PrimitiveComponent.md)
450
+
451
+ </td><td>
452
+
453
+ </td><td>
454
+
455
+ **_(BETA)_** Set the property state: Y coordinate
456
+
457
+ </td></tr>
458
+ <tr><td>
459
+
460
+ [toAsync()](./IPCB_PrimitiveComponent.md)
461
+
462
+ </td><td>
463
+
464
+ </td><td>
465
+
466
+ Convert Primitive to Async primitive
467
+
468
+ </td></tr>
469
+ <tr><td>
470
+
471
+ [toSync()](./IPCB_PrimitiveComponent.md)
472
+
473
+ </td><td>
474
+
475
+ </td><td>
476
+
477
+ Convert Primitive to Sync primitive
478
+
479
+ </td></tr>
480
+ </tbody></table>
481
+
482
+ ---
483
+
484
+ ## 方法详情
485
+
486
+ ### done
487
+
488
+ # IPCB\_PrimitiveComponent.done() method
489
+
490
+ > 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.
491
+
492
+ Apply the changes to the primitives to the canvas
493
+
494
+ ## Signature
495
+
496
+ ```typescript
497
+ function done(): Promise<IPCB_PrimitiveComponent>;
498
+ ```
499
+
500
+ ## Returns
501
+
502
+ Promise&lt;[IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)<!-- -->&gt;
503
+
504
+ Device primitive object
505
+
506
+ ## Example
507
+
508
+ ```javascript
509
+ // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
510
+ const x = 20000 + Math.floor(Math.random() * 80000);
511
+ const y = 20000 + Math.floor(Math.random() * 80000);
512
+
513
+ // 2. 放置测试器件
514
+ const devices = await eda.lib_Device.search('C0402');
515
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
516
+ const compId = comp.getState_PrimitiveId();
517
+
518
+ // 3. 记录修改前的位号和旋转角度
519
+ const designatorBefore = comp.getState_Designator();
520
+ const rotationBefore = comp.getState_Rotation();
521
+
522
+ // 4. 批量修改两个属性,一次 done() 提交
523
+ const asyncComp = comp.toAsync();
524
+ asyncComp.setState_Designator('C101');
525
+ asyncComp.setState_Rotation(90);
526
+ await asyncComp.done();
527
+
528
+ // 5. 从画布重新读取,确认批量修改已生效(保留现场供观察)
529
+ const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
530
+
531
+ console.log('designator:', designatorBefore, '→', refetched[0].getState_Designator());
532
+ console.log('rotation:', rotationBefore, '→', refetched[0].getState_Rotation());
533
+ ```
534
+
535
+ ### getallpins
536
+
537
+ # IPCB\_PrimitiveComponent.getAllPins() method
538
+
539
+ > 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.
540
+
541
+ Get all pads associated with the device
542
+
543
+ ## Signature
544
+
545
+ ```typescript
546
+ function getAllPins(): Promise<Array<IPCB_PrimitiveComponentPad>>;
547
+ ```
548
+
549
+ ## Returns
550
+
551
+ Promise&lt;Array&lt;[IPCB\_PrimitiveComponentPad](./IPCB_PrimitiveComponentPad.md)<!-- -->&gt;&gt;
552
+
553
+ Device pad primitive array
554
+
555
+ ## Example
556
+
557
+ ```javascript
558
+ // 1. 放置一个测试器件
559
+ const devices = await eda.lib_Device.search('C0402');
560
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
561
+ const compId = comp.getState_PrimitiveId();
562
+
563
+ // 2. 获取器件关联的所有焊盘图元
564
+ const pins = await comp.getAllPins();
565
+
566
+ // 3. 逐个读取焊盘的归属器件和图元 ID
567
+ const pinInfos = pins.map(pin => ({
568
+ parentMatch: pin.getState_ParentComponentPrimitiveId() === compId,
569
+ primitiveId: pin.getState_PrimitiveId(),
570
+ }));
571
+
572
+ // 4. 清理测试器件
573
+ await eda.pcb_PrimitiveComponent.delete([compId]);
574
+
575
+ console.log('pinCount:', pins.length);
576
+ console.log('allBelongToComponent:', pinInfos.every(p => p.parentMatch));
577
+ console.log('firstPinPrimitiveId:', pinInfos[0].primitiveId);
578
+ ```
579
+
580
+ ### getstate_addintobom
581
+
582
+ # IPCB\_PrimitiveComponent.getState\_AddIntoBom() method
583
+
584
+ Get the property state: whether to add BOM
585
+
586
+ ## Signature
587
+
588
+ ```typescript
589
+ function getState_AddIntoBom(): boolean;
590
+ ```
591
+
592
+ ## Returns
593
+
594
+ boolean
595
+
596
+ Whether Add to BOM
597
+
598
+ ## Example
599
+
600
+ ```javascript
601
+ // 1. 放置一个测试器件
602
+ const devices = await eda.lib_Device.search('C0402');
603
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
604
+
605
+ // 2. 读取是否加入 BOM
606
+ const addIntoBom = comp.getState_AddIntoBom();
607
+
608
+ // 3. 清理测试器件
609
+ await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
610
+
611
+ console.log('addIntoBom:', addIntoBom);
612
+ ```
613
+
614
+ ### getstate_component
615
+
616
+ # IPCB\_PrimitiveComponent.getState\_Component() method
617
+
618
+ Get the property state: associate library device
619
+
620
+ ## Signature
621
+
622
+ ```typescript
623
+ function getState_Component(): { libraryUuid: string; uuid: string; name?: string } | undefined;
624
+ ```
625
+
626
+ ## Returns
627
+
628
+ { libraryUuid: string; uuid: string; name?: string } \| undefined
629
+
630
+ Associate library device
631
+
632
+ ## Example
633
+
634
+ ```javascript
635
+ // 1. 放置一个测试器件
636
+ const devices = await eda.lib_Device.search('C0402');
637
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
638
+
639
+ // 2. 读取关联的库器件信息
640
+ const component = comp.getState_Component();
641
+
642
+ // 3. 清理测试器件
643
+ await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
644
+
645
+ console.log('deviceName:', component.name);
646
+ console.log('deviceUuid:', component.uuid);
647
+ console.log('libraryUuid:', component.libraryUuid);
648
+ ```
649
+
650
+ ### getstate_designator
651
+
652
+ # IPCB\_PrimitiveComponent.getState\_Designator() method
653
+
654
+ Get the property state: designator
655
+
656
+ ## Signature
657
+
658
+ ```typescript
659
+ function getState_Designator(): string | undefined;
660
+ ```
661
+
662
+ ## Returns
663
+
664
+ string \| undefined
665
+
666
+ Designator
667
+
668
+ ## Example
669
+
670
+ ```javascript
671
+ // 1. 放置一个测试器件(位号由系统自动分配)
672
+ const devices = await eda.lib_Device.search('C0402');
673
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
674
+
675
+ // 2. 读取位号
676
+ const designator = comp.getState_Designator();
677
+
678
+ // 3. 清理测试器件
679
+ await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
680
+
681
+ console.log('designator:', designator);
682
+ ```
683
+
684
+ ### getstate_footprint
685
+
686
+ # IPCB\_PrimitiveComponent.getState\_Footprint() method
687
+
688
+ Get the property state: associate library footprint
689
+
690
+ ## Signature
691
+
692
+ ```typescript
693
+ function getState_Footprint(): { libraryUuid: string; uuid: string; name?: string } | undefined;
694
+ ```
695
+
696
+ ## Returns
697
+
698
+ { libraryUuid: string; uuid: string; name?: string } \| undefined
699
+
700
+ Associate library footprint
701
+
702
+ ## Example
703
+
704
+ ```javascript
705
+ // 1. 放置一个测试器件
706
+ const devices = await eda.lib_Device.search('C0402');
707
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
708
+
709
+ // 2. 读取关联的库封装信息
710
+ const footprint = comp.getState_Footprint();
711
+
712
+ // 3. 清理测试器件
713
+ await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
714
+
715
+ console.log('footprintName:', footprint.name);
716
+ console.log('footprintUuid:', footprint.uuid);
717
+ console.log('libraryUuid:', footprint.libraryUuid);
718
+ ```
719
+
720
+ ### getstate_layer
721
+
722
+ # IPCB\_PrimitiveComponent.getState\_Layer() method
723
+
724
+ Get the property state: Layer
725
+
726
+ ## Signature
727
+
728
+ ```typescript
729
+ function getState_Layer(): TPCB_LayersOfComponent;
730
+ ```
731
+
732
+ ## Returns
733
+
734
+ [TPCB\_LayersOfComponent](../types/TPCB_LayersOfComponent.md)
735
+
736
+ Layer
737
+
738
+ ## Example
739
+
740
+ ```javascript
741
+ // 1. 放置一个测试器件(默认贴在顶面)
742
+ const devices = await eda.lib_Device.search('C0402');
743
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
744
+
745
+ // 2. 读取所在面(1=顶面, 2=底面)
746
+ const layer = comp.getState_Layer();
747
+
748
+ // 3. 清理测试器件
749
+ await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
750
+
751
+ console.log('layer:', layer, layer === 1 ? '(顶面)' : '(底面)');
752
+ ```
753
+
754
+ ### getstate_manufacturer
755
+
756
+ # IPCB\_PrimitiveComponent.getState\_Manufacturer() method
757
+
758
+ Get the property state: manufacturer
759
+
760
+ ## Signature
761
+
762
+ ```typescript
763
+ function getState_Manufacturer(): string | undefined;
764
+ ```
765
+
766
+ ## Returns
767
+
768
+ string \| undefined
769
+
770
+ Manufacturer
771
+
772
+ ## Example
773
+
774
+ ```javascript
775
+ // 1. 放置一个测试器件
776
+ const devices = await eda.lib_Device.search('C0402');
777
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
778
+
779
+ // 2. 读取制造商
780
+ const manufacturer = comp.getState_Manufacturer();
781
+
782
+ // 3. 清理测试器件
783
+ await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
784
+
785
+ console.log('manufacturer:', manufacturer);
786
+ ```
787
+
788
+ ### getstate_manufacturerid
789
+
790
+ # IPCB\_PrimitiveComponent.getState\_ManufacturerId() method
791
+
792
+ Get the property state: manufacturer ID
793
+
794
+ ## Signature
795
+
796
+ ```typescript
797
+ function getState_ManufacturerId(): string | undefined;
798
+ ```
799
+
800
+ ## Returns
801
+
802
+ string \| undefined
803
+
804
+ Manufacturer ID
805
+
806
+ ## Example
807
+
808
+ ```javascript
809
+ // 1. 放置一个测试器件
810
+ const devices = await eda.lib_Device.search('C0402');
811
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
812
+
813
+ // 2. 读取制造商编号
814
+ const manufacturerId = comp.getState_ManufacturerId();
815
+
816
+ // 3. 清理测试器件
817
+ await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
818
+
819
+ console.log('manufacturerId:', manufacturerId);
820
+ ```
821
+
822
+ ### getstate_model3d
823
+
824
+ # IPCB\_PrimitiveComponent.getState\_Model3D() method
825
+
826
+ Get the property state: associate library 3D model
827
+
828
+ ## Signature
829
+
830
+ ```typescript
831
+ function getState_Model3D(): { libraryUuid: string; uuid: string; name?: string } | undefined;
832
+ ```
833
+
834
+ ## Returns
835
+
836
+ { libraryUuid: string; uuid: string; name?: string } \| undefined
837
+
838
+ Associate library 3D model
839
+
840
+ ## Example
841
+
842
+ ```javascript
843
+ // 1. 放置一个测试器件
844
+ const devices = await eda.lib_Device.search('C0402');
845
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
846
+
847
+ // 2. 读取关联的 3D 模型信息(未关联时返回 undefined)
848
+ const model3d = comp.getState_Model3D();
849
+
850
+ // 3. 清理测试器件
851
+ await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
852
+
853
+ console.log('model3dName:', model3d ? model3d.name : '(未关联 3D 模型)');
854
+ console.log('model3dUuid:', model3d ? model3d.uuid : '(未关联 3D 模型)');
855
+ ```
856
+
857
+ ### getstate_name
858
+
859
+ # IPCB\_PrimitiveComponent.getState\_Name() method
860
+
861
+ Get the property state: name
862
+
863
+ ## Signature
864
+
865
+ ```typescript
866
+ function getState_Name(): string | undefined;
867
+ ```
868
+
869
+ ## Returns
870
+
871
+ string \| undefined
872
+
873
+ Name
874
+
875
+ ## Example
876
+
877
+ ```javascript
878
+ // 1. 放置一个测试器件
879
+ const devices = await eda.lib_Device.search('C0402');
880
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
881
+
882
+ // 2. 读取名称
883
+ const name = comp.getState_Name();
884
+
885
+ // 3. 清理测试器件
886
+ await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
887
+
888
+ console.log('name:', name);
889
+ ```
890
+
891
+ ### getstate_otherproperty
892
+
893
+ # IPCB\_PrimitiveComponent.getState\_OtherProperty() method
894
+
895
+ Get the property state: other parameters
896
+
897
+ ## Signature
898
+
899
+ ```typescript
900
+ function getState_OtherProperty(): Record<string, string | number | boolean> | undefined;
901
+ ```
902
+
903
+ ## Returns
904
+
905
+ Record&lt;string, string \| number \| boolean&gt; \| undefined
906
+
907
+ Other parameters
908
+
909
+ ## Example
910
+
911
+ ```javascript
912
+ // 1. 放置一个测试器件
913
+ const devices = await eda.lib_Device.search('C0402');
914
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
915
+
916
+ // 2. 读取其它参数字典
917
+ const otherProperty = comp.getState_OtherProperty();
918
+
919
+ // 3. 清理测试器件
920
+ await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
921
+
922
+ console.log('propertyCount:', Object.keys(otherProperty).length);
923
+ console.log('value:', otherProperty.Value);
924
+ console.log('description:', otherProperty.Description);
925
+ ```
926
+
927
+ ### getstate_pads
928
+
929
+ # IPCB\_PrimitiveComponent.getState\_Pads() method
930
+
931
+ Get the property state: pad
932
+
933
+ ## Signature
934
+
935
+ ```typescript
936
+ function getState_Pads():
937
+ Array<{ primitiveId: string; net: string; padNumber: string }> | undefined;
938
+ ```
939
+
940
+ ## Returns
941
+
942
+ Array&lt;{ primitiveId: string; net: string; padNumber: string }&gt; \| undefined
943
+
944
+ Pad
945
+
946
+ ## Example
947
+
948
+ ```javascript
949
+ // 1. 放置一个测试器件
950
+ const devices = await eda.lib_Device.search('C0402');
951
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
952
+
953
+ // 2. 读取焊盘摘要数据
954
+ const pads = comp.getState_Pads();
955
+
956
+ // 3. 摘要出每个焊盘的编号与网络
957
+ const padSummaries = pads.map(pad => ({ padNumber: pad.padNumber, net: pad.net }));
958
+
959
+ // 4. 清理测试器件
960
+ await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
961
+
962
+ console.log('padCount:', pads.length);
963
+ console.log('padSummaries:', JSON.stringify(padSummaries));
964
+ ```
965
+
966
+ ### getstate_primitiveid
967
+
968
+ # IPCB\_PrimitiveComponent.getState\_PrimitiveId() method
969
+
970
+ Get the property state: primitive ID
971
+
972
+ ## Signature
973
+
974
+ ```typescript
975
+ function getState_PrimitiveId(): string;
976
+ ```
977
+
978
+ ## Returns
979
+
980
+ string
981
+
982
+ Primitive ID
983
+
984
+ ## Example
985
+
986
+ ```javascript
987
+ // 1. 放置一个测试器件
988
+ const devices = await eda.lib_Device.search('C0402');
989
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
990
+
991
+ // 2. 读取图元 ID
992
+ const primitiveId = comp.getState_PrimitiveId();
993
+
994
+ // 3. 清理测试器件
995
+ await eda.pcb_PrimitiveComponent.delete([primitiveId]);
996
+
997
+ console.log('primitiveId:', primitiveId);
998
+ ```
999
+
1000
+ ### getstate_primitivelock
1001
+
1002
+ # IPCB\_PrimitiveComponent.getState\_PrimitiveLock() method
1003
+
1004
+ Get the property state: whether it is locked
1005
+
1006
+ ## Signature
1007
+
1008
+ ```typescript
1009
+ function getState_PrimitiveLock(): boolean;
1010
+ ```
1011
+
1012
+ ## Returns
1013
+
1014
+ boolean
1015
+
1016
+ Whether it is locked
1017
+
1018
+ ## Example
1019
+
1020
+ ```javascript
1021
+ // 1. 放置一个测试器件
1022
+ const devices = await eda.lib_Device.search('C0402');
1023
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
1024
+
1025
+ // 2. 读取锁定状态
1026
+ const primitiveLock = comp.getState_PrimitiveLock();
1027
+
1028
+ // 3. 清理测试器件
1029
+ await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
1030
+
1031
+ console.log('primitiveLock:', primitiveLock);
1032
+ ```
1033
+
1034
+ ### getstate_primitivetype
1035
+
1036
+ # IPCB\_PrimitiveComponent.getState\_PrimitiveType() method
1037
+
1038
+ Get the property state: primitive type
1039
+
1040
+ ## Signature
1041
+
1042
+ ```typescript
1043
+ function getState_PrimitiveType(): EPCB_PrimitiveType;
1044
+ ```
1045
+
1046
+ ## Returns
1047
+
1048
+ [EPCB\_PrimitiveType](../enums/EPCB_PrimitiveType.md)
1049
+
1050
+ Primitive type
1051
+
1052
+ ## Example
1053
+
1054
+ ```javascript
1055
+ // 1. 放置一个测试器件
1056
+ const devices = await eda.lib_Device.search('C0402');
1057
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
1058
+
1059
+ // 2. 读取图元类型
1060
+ const primitiveType = comp.getState_PrimitiveType();
1061
+
1062
+ // 3. 清理测试器件
1063
+ await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
1064
+
1065
+ console.log('primitiveType:', primitiveType);
1066
+ ```
1067
+
1068
+ ### getstate_rotation
1069
+
1070
+ # IPCB\_PrimitiveComponent.getState\_Rotation() method
1071
+
1072
+ Get the property state: rotation angle
1073
+
1074
+ ## Signature
1075
+
1076
+ ```typescript
1077
+ function getState_Rotation(): number;
1078
+ ```
1079
+
1080
+ ## Returns
1081
+
1082
+ number
1083
+
1084
+ Rotation angle
1085
+
1086
+ ## Example
1087
+
1088
+ ```javascript
1089
+ // 1. 放置一个测试器件(默认 0 度)
1090
+ const devices = await eda.lib_Device.search('C0402');
1091
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
1092
+
1093
+ // 2. 读取旋转角度
1094
+ const rotation = comp.getState_Rotation();
1095
+
1096
+ // 3. 清理测试器件
1097
+ await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
1098
+
1099
+ console.log('rotation:', rotation);
1100
+ ```
1101
+
1102
+ ### getstate_supplier
1103
+
1104
+ # IPCB\_PrimitiveComponent.getState\_Supplier() method
1105
+
1106
+ Get the property state: supplier
1107
+
1108
+ ## Signature
1109
+
1110
+ ```typescript
1111
+ function getState_Supplier(): string | undefined;
1112
+ ```
1113
+
1114
+ ## Returns
1115
+
1116
+ string \| undefined
1117
+
1118
+ Supplier
1119
+
1120
+ ## Example
1121
+
1122
+ ```javascript
1123
+ // 1. 放置一个测试器件
1124
+ const devices = await eda.lib_Device.search('C0402');
1125
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
1126
+
1127
+ // 2. 读取供应商
1128
+ const supplier = comp.getState_Supplier();
1129
+
1130
+ // 3. 清理测试器件
1131
+ await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
1132
+
1133
+ console.log('supplier:', supplier);
1134
+ ```
1135
+
1136
+ ### getstate_supplierid
1137
+
1138
+ # IPCB\_PrimitiveComponent.getState\_SupplierId() method
1139
+
1140
+ Get the property state: supplier ID
1141
+
1142
+ ## Signature
1143
+
1144
+ ```typescript
1145
+ function getState_SupplierId(): string | undefined;
1146
+ ```
1147
+
1148
+ ## Returns
1149
+
1150
+ string \| undefined
1151
+
1152
+ Supplier ID
1153
+
1154
+ ## Example
1155
+
1156
+ ```javascript
1157
+ // 1. 放置一个测试器件
1158
+ const devices = await eda.lib_Device.search('C0402');
1159
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
1160
+
1161
+ // 2. 读取供应商编号
1162
+ const supplierId = comp.getState_SupplierId();
1163
+
1164
+ // 3. 清理测试器件
1165
+ await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
1166
+
1167
+ console.log('supplierId:', supplierId);
1168
+ ```
1169
+
1170
+ ### getstate_uniqueid
1171
+
1172
+ # IPCB\_PrimitiveComponent.getState\_UniqueId() method
1173
+
1174
+ Get the property state: unique ID
1175
+
1176
+ ## Signature
1177
+
1178
+ ```typescript
1179
+ function getState_UniqueId(): string | undefined;
1180
+ ```
1181
+
1182
+ ## Returns
1183
+
1184
+ string \| undefined
1185
+
1186
+ Unique ID
1187
+
1188
+ ## Example
1189
+
1190
+ ```javascript
1191
+ // 1. 放置一个测试器件
1192
+ const devices = await eda.lib_Device.search('C0402');
1193
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
1194
+
1195
+ // 2. 读取唯一 ID
1196
+ const uniqueId = comp.getState_UniqueId();
1197
+
1198
+ // 3. 清理测试器件
1199
+ await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
1200
+
1201
+ console.log('uniqueId:', JSON.stringify(uniqueId));
1202
+ ```
1203
+
1204
+ ### getstate_x
1205
+
1206
+ # IPCB\_PrimitiveComponent.getState\_X() method
1207
+
1208
+ Get the property state: X coordinate
1209
+
1210
+ ## Signature
1211
+
1212
+ ```typescript
1213
+ function getState_X(): number;
1214
+ ```
1215
+
1216
+ ## Returns
1217
+
1218
+ number
1219
+
1220
+ X coordinate
1221
+
1222
+ ## Example
1223
+
1224
+ ```javascript
1225
+ // 1. 放置一个测试器件
1226
+ const devices = await eda.lib_Device.search('C0402');
1227
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
1228
+
1229
+ // 2. 读取锚点 X 坐标
1230
+ const x = comp.getState_X();
1231
+
1232
+ // 3. 清理测试器件
1233
+ await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
1234
+
1235
+ console.log('x:', x);
1236
+ ```
1237
+
1238
+ ### getstate_y
1239
+
1240
+ # IPCB\_PrimitiveComponent.getState\_Y() method
1241
+
1242
+ Get the property state: Y coordinate
1243
+
1244
+ ## Signature
1245
+
1246
+ ```typescript
1247
+ function getState_Y(): number;
1248
+ ```
1249
+
1250
+ ## Returns
1251
+
1252
+ number
1253
+
1254
+ Y coordinate
1255
+
1256
+ ## Example
1257
+
1258
+ ```javascript
1259
+ // 1. 放置一个测试器件
1260
+ const devices = await eda.lib_Device.search('C0402');
1261
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
1262
+
1263
+ // 2. 读取锚点 Y 坐标
1264
+ const y = comp.getState_Y();
1265
+
1266
+ // 3. 清理测试器件
1267
+ await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
1268
+
1269
+ console.log('y:', y);
1270
+ ```
1271
+
1272
+ ### isasync
1273
+
1274
+ # IPCB\_PrimitiveComponent.isAsync() method
1275
+
1276
+ Query whether the primitive is an async primitive
1277
+
1278
+ ## Signature
1279
+
1280
+ ```typescript
1281
+ function isAsync(): boolean;
1282
+ ```
1283
+
1284
+ ## Returns
1285
+
1286
+ boolean
1287
+
1288
+ Whether Is async primitive
1289
+
1290
+ ## Example
1291
+
1292
+ ```javascript
1293
+ // 1. 放置一个测试器件
1294
+ const devices = await eda.lib_Device.search('C0402');
1295
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
1296
+
1297
+ // 2. 查询异步状态
1298
+ const isAsync = comp.isAsync();
1299
+
1300
+ // 3. 清理测试器件
1301
+ await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
1302
+
1303
+ console.log('isAsync:', isAsync);
1304
+ ```
1305
+
1306
+ ### reset
1307
+
1308
+ # IPCB\_PrimitiveComponent.reset() method
1309
+
1310
+ > 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.
1311
+
1312
+ Reset the async primitive to the current canvas state
1313
+
1314
+ ## Signature
1315
+
1316
+ ```typescript
1317
+ function reset(): Promise<IPCB_PrimitiveComponent>;
1318
+ ```
1319
+
1320
+ ## Returns
1321
+
1322
+ Promise&lt;[IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)<!-- -->&gt;
1323
+
1324
+ Device primitive object
1325
+
1326
+ ## Example
1327
+
1328
+ ```javascript
1329
+ // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
1330
+ const x = 20000 + Math.floor(Math.random() * 80000);
1331
+ const y = 20000 + Math.floor(Math.random() * 80000);
1332
+
1333
+ // 2. 放置测试器件(默认 0 度)
1334
+ const devices = await eda.lib_Device.search('C0402');
1335
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
1336
+ const compId = comp.getState_PrimitiveId();
1337
+
1338
+ // 3. 记录画布上的原始旋转角度
1339
+ const original = comp.getState_Rotation();
1340
+
1341
+ // 4. 异步模式下改一个错误值,但不提交,直接 reset() 丢弃
1342
+ const asyncComp = comp.toAsync();
1343
+ asyncComp.setState_Rotation(270);
1344
+ await asyncComp.reset();
1345
+
1346
+ // 5. 从画布重新读取,确认值仍是原始值(保留现场供观察)
1347
+ const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
1348
+
1349
+ console.log('rotation:', original, '→', refetched[0].getState_Rotation(), '(修改已丢弃)');
1350
+ ```
1351
+
1352
+ ### setattribute
1353
+
1354
+ # IPCB\_PrimitiveComponent.setAttribute() method
1355
+
1356
+ > 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.
1357
+
1358
+ Set Property
1359
+
1360
+ ## Signature
1361
+
1362
+ ```typescript
1363
+ function setAttribute(
1364
+ key: string,
1365
+ value?: string | number | boolean,
1366
+ keyVisible?: boolean,
1367
+ valueVisible?: boolean,
1368
+ ): Promise<IPCB_PrimitiveAttribute>;
1369
+ ```
1370
+
1371
+ ## Parameters
1372
+
1373
+ <table><thead><tr><th>
1374
+
1375
+ Parameter
1376
+
1377
+ </th><th>
1378
+
1379
+ Type
1380
+
1381
+ </th><th>
1382
+
1383
+ Description
1384
+
1385
+ </th></tr></thead>
1386
+ <tbody><tr><td>
1387
+
1388
+ key
1389
+
1390
+ </td><td>
1391
+
1392
+ string
1393
+
1394
+ </td><td>
1395
+
1396
+ Attribute name. If the device does not have an attribute with this name, the attribute will be added
1397
+
1398
+ </td></tr>
1399
+ <tr><td>
1400
+
1401
+ value
1402
+
1403
+ </td><td>
1404
+
1405
+ string \| number \| boolean
1406
+
1407
+ </td><td>
1408
+
1409
+ _(Optional)_ Property value
1410
+
1411
+ </td></tr>
1412
+ <tr><td>
1413
+
1414
+ keyVisible
1415
+
1416
+ </td><td>
1417
+
1418
+ boolean
1419
+
1420
+ </td><td>
1421
+
1422
+ _(Optional)_ Attribute name visibility
1423
+
1424
+ </td></tr>
1425
+ <tr><td>
1426
+
1427
+ valueVisible
1428
+
1429
+ </td><td>
1430
+
1431
+ boolean
1432
+
1433
+ </td><td>
1434
+
1435
+ _(Optional)_ Attribute value visibility
1436
+
1437
+ </td></tr>
1438
+ </tbody></table>
1439
+
1440
+ ## Returns
1441
+
1442
+ Promise&lt;[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)<!-- -->&gt;
1443
+
1444
+ Attribute primitive object
1445
+
1446
+ ## Example
1447
+
1448
+ ```javascript
1449
+ // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
1450
+ const x = 20000 + Math.floor(Math.random() * 80000);
1451
+ const y = 20000 + Math.floor(Math.random() * 80000);
1452
+
1453
+ // 2. 放置测试器件
1454
+ const devices = await eda.lib_Device.search('C0402');
1455
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
1456
+ const compId = comp.getState_PrimitiveId();
1457
+
1458
+ // 3. 设置自定义属性(属性名、属性值、名称可见、值可见)
1459
+ await comp.setAttribute('嘉立创示例_Tolerance', '1%', true, true);
1460
+
1461
+ // 4. 通过属性图元接口确认属性已写入(保留现场供观察)
1462
+ const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
1463
+ const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
1464
+ const added = attrs.find(a => a.getState_Key() === '嘉立创示例_Tolerance');
1465
+
1466
+ console.log('attrKey:', added.getState_Key());
1467
+ console.log('attrValue:', added.getState_Value());
1468
+ ```
1469
+
1470
+ ### setstate_addintobom
1471
+
1472
+ # IPCB\_PrimitiveComponent.setState\_AddIntoBom() method
1473
+
1474
+ > 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.
1475
+
1476
+ Set the property state: whether to add BOM
1477
+
1478
+ ## Signature
1479
+
1480
+ ```typescript
1481
+ function setState_AddIntoBom(addIntoBom: boolean): IPCB_PrimitiveComponent;
1482
+ ```
1483
+
1484
+ ## Parameters
1485
+
1486
+ <table><thead><tr><th>
1487
+
1488
+ Parameter
1489
+
1490
+ </th><th>
1491
+
1492
+ Type
1493
+
1494
+ </th><th>
1495
+
1496
+ Description
1497
+
1498
+ </th></tr></thead>
1499
+ <tbody><tr><td>
1500
+
1501
+ addIntoBom
1502
+
1503
+ </td><td>
1504
+
1505
+ boolean
1506
+
1507
+ </td><td>
1508
+
1509
+ Whether Add to BOM
1510
+
1511
+ </td></tr>
1512
+ </tbody></table>
1513
+
1514
+ ## Returns
1515
+
1516
+ [IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
1517
+
1518
+ Device primitive object
1519
+
1520
+ ## Example
1521
+
1522
+ ```javascript
1523
+ // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
1524
+ const x = 20000 + Math.floor(Math.random() * 80000);
1525
+ const y = 20000 + Math.floor(Math.random() * 80000);
1526
+
1527
+ // 2. 放置测试器件
1528
+ const devices = await eda.lib_Device.search('C0402');
1529
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
1530
+ const compId = comp.getState_PrimitiveId();
1531
+
1532
+ // 3. 读取修改前的值
1533
+ const before = comp.getState_AddIntoBom();
1534
+
1535
+ // 4. 异步模式改为不加入 BOM 并提交
1536
+ const asyncComp = comp.toAsync();
1537
+ asyncComp.setState_AddIntoBom(false);
1538
+ await asyncComp.done();
1539
+
1540
+ // 5. 从画布重新读取,确认修改已生效(保留现场供观察)
1541
+ const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
1542
+
1543
+ console.log('addIntoBom:', before, '→', refetched[0].getState_AddIntoBom());
1544
+ ```
1545
+
1546
+ ### setstate_designator
1547
+
1548
+ # IPCB\_PrimitiveComponent.setState\_Designator() method
1549
+
1550
+ > 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.
1551
+
1552
+ Set the property state: designator
1553
+
1554
+ ## Signature
1555
+
1556
+ ```typescript
1557
+ function setState_Designator(designator: string | undefined): IPCB_PrimitiveComponent;
1558
+ ```
1559
+
1560
+ ## Parameters
1561
+
1562
+ <table><thead><tr><th>
1563
+
1564
+ Parameter
1565
+
1566
+ </th><th>
1567
+
1568
+ Type
1569
+
1570
+ </th><th>
1571
+
1572
+ Description
1573
+
1574
+ </th></tr></thead>
1575
+ <tbody><tr><td>
1576
+
1577
+ designator
1578
+
1579
+ </td><td>
1580
+
1581
+ string \| undefined
1582
+
1583
+ </td><td>
1584
+
1585
+ Designator
1586
+
1587
+ </td></tr>
1588
+ </tbody></table>
1589
+
1590
+ ## Returns
1591
+
1592
+ [IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
1593
+
1594
+ Device primitive object
1595
+
1596
+ ## Example
1597
+
1598
+ ```javascript
1599
+ // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
1600
+ const x = 20000 + Math.floor(Math.random() * 80000);
1601
+ const y = 20000 + Math.floor(Math.random() * 80000);
1602
+
1603
+ // 2. 放置测试器件(位号由系统自动分配)
1604
+ const devices = await eda.lib_Device.search('C0402');
1605
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
1606
+ const compId = comp.getState_PrimitiveId();
1607
+
1608
+ // 3. 读取修改前的位号
1609
+ const before = comp.getState_Designator();
1610
+
1611
+ // 4. 异步模式改位号并提交
1612
+ const asyncComp = comp.toAsync();
1613
+ asyncComp.setState_Designator('C101');
1614
+ await asyncComp.done();
1615
+
1616
+ // 5. 从画布重新读取,确认修改已生效(保留现场供观察)
1617
+ const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
1618
+
1619
+ console.log('designator:', before, '→', refetched[0].getState_Designator());
1620
+ ```
1621
+
1622
+ ### setstate_layer
1623
+
1624
+ # IPCB\_PrimitiveComponent.setState\_Layer() method
1625
+
1626
+ > 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.
1627
+
1628
+ Set the property state: Layer
1629
+
1630
+ ## Signature
1631
+
1632
+ ```typescript
1633
+ function setState_Layer(layer: TPCB_LayersOfComponent): IPCB_PrimitiveComponent;
1634
+ ```
1635
+
1636
+ ## Parameters
1637
+
1638
+ <table><thead><tr><th>
1639
+
1640
+ Parameter
1641
+
1642
+ </th><th>
1643
+
1644
+ Type
1645
+
1646
+ </th><th>
1647
+
1648
+ Description
1649
+
1650
+ </th></tr></thead>
1651
+ <tbody><tr><td>
1652
+
1653
+ layer
1654
+
1655
+ </td><td>
1656
+
1657
+ [TPCB\_LayersOfComponent](../types/TPCB_LayersOfComponent.md)
1658
+
1659
+ </td><td>
1660
+
1661
+ Layer
1662
+
1663
+ </td></tr>
1664
+ </tbody></table>
1665
+
1666
+ ## Returns
1667
+
1668
+ [IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
1669
+
1670
+ Device primitive object
1671
+
1672
+ ## Example
1673
+
1674
+ ```javascript
1675
+ // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
1676
+ const x = 20000 + Math.floor(Math.random() * 80000);
1677
+ const y = 20000 + Math.floor(Math.random() * 80000);
1678
+
1679
+ // 2. 放置测试器件(默认贴顶面)
1680
+ const devices = await eda.lib_Device.search('C0402');
1681
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
1682
+ const compId = comp.getState_PrimitiveId();
1683
+
1684
+ // 3. 读取修改前的所在面
1685
+ const before = comp.getState_Layer();
1686
+
1687
+ // 4. 异步模式翻到底面并提交
1688
+ const asyncComp = comp.toAsync();
1689
+ asyncComp.setState_Layer(2);
1690
+ await asyncComp.done();
1691
+
1692
+ // 5. 从画布重新读取,确认修改已生效(保留现场供观察)
1693
+ const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
1694
+
1695
+ console.log('layer:', before, '→', refetched[0].getState_Layer());
1696
+ ```
1697
+
1698
+ ### setstate_manufacturer
1699
+
1700
+ # IPCB\_PrimitiveComponent.setState\_Manufacturer() method
1701
+
1702
+ > 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.
1703
+
1704
+ Set the property state: manufacturer
1705
+
1706
+ ## Signature
1707
+
1708
+ ```typescript
1709
+ function setState_Manufacturer(manufacturer: string | undefined): IPCB_PrimitiveComponent;
1710
+ ```
1711
+
1712
+ ## Parameters
1713
+
1714
+ <table><thead><tr><th>
1715
+
1716
+ Parameter
1717
+
1718
+ </th><th>
1719
+
1720
+ Type
1721
+
1722
+ </th><th>
1723
+
1724
+ Description
1725
+
1726
+ </th></tr></thead>
1727
+ <tbody><tr><td>
1728
+
1729
+ manufacturer
1730
+
1731
+ </td><td>
1732
+
1733
+ string \| undefined
1734
+
1735
+ </td><td>
1736
+
1737
+ Manufacturer
1738
+
1739
+ </td></tr>
1740
+ </tbody></table>
1741
+
1742
+ ## Returns
1743
+
1744
+ [IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
1745
+
1746
+ Device primitive object
1747
+
1748
+ ## Example
1749
+
1750
+ ```javascript
1751
+ // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
1752
+ const x = 20000 + Math.floor(Math.random() * 80000);
1753
+ const y = 20000 + Math.floor(Math.random() * 80000);
1754
+
1755
+ // 2. 放置测试器件
1756
+ const devices = await eda.lib_Device.search('C0402');
1757
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
1758
+ const compId = comp.getState_PrimitiveId();
1759
+
1760
+ // 3. 读取修改前的制造商
1761
+ const before = comp.getState_Manufacturer();
1762
+
1763
+ // 4. 异步模式修改制造商并提交
1764
+ const asyncComp = comp.toAsync();
1765
+ asyncComp.setState_Manufacturer('嘉立创示例_MFR');
1766
+ await asyncComp.done();
1767
+
1768
+ // 5. 从画布重新读取,确认修改已生效(保留现场供观察)
1769
+ const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
1770
+
1771
+ console.log('manufacturer:', before, '→', refetched[0].getState_Manufacturer());
1772
+ ```
1773
+
1774
+ ### setstate_manufacturerid
1775
+
1776
+ # IPCB\_PrimitiveComponent.setState\_ManufacturerId() method
1777
+
1778
+ > 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.
1779
+
1780
+ Set the property state: manufacturer ID
1781
+
1782
+ ## Signature
1783
+
1784
+ ```typescript
1785
+ function setState_ManufacturerId(manufacturerId: string | undefined): IPCB_PrimitiveComponent;
1786
+ ```
1787
+
1788
+ ## Parameters
1789
+
1790
+ <table><thead><tr><th>
1791
+
1792
+ Parameter
1793
+
1794
+ </th><th>
1795
+
1796
+ Type
1797
+
1798
+ </th><th>
1799
+
1800
+ Description
1801
+
1802
+ </th></tr></thead>
1803
+ <tbody><tr><td>
1804
+
1805
+ manufacturerId
1806
+
1807
+ </td><td>
1808
+
1809
+ string \| undefined
1810
+
1811
+ </td><td>
1812
+
1813
+ Manufacturer ID
1814
+
1815
+ </td></tr>
1816
+ </tbody></table>
1817
+
1818
+ ## Returns
1819
+
1820
+ [IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
1821
+
1822
+ Device primitive object
1823
+
1824
+ ## Example
1825
+
1826
+ ```javascript
1827
+ // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
1828
+ const x = 20000 + Math.floor(Math.random() * 80000);
1829
+ const y = 20000 + Math.floor(Math.random() * 80000);
1830
+
1831
+ // 2. 放置测试器件
1832
+ const devices = await eda.lib_Device.search('C0402');
1833
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
1834
+ const compId = comp.getState_PrimitiveId();
1835
+
1836
+ // 3. 读取修改前的制造商编号
1837
+ const before = comp.getState_ManufacturerId();
1838
+
1839
+ // 4. 异步模式修改制造商编号并提交
1840
+ const asyncComp = comp.toAsync();
1841
+ asyncComp.setState_ManufacturerId('MFR-DEMO-001');
1842
+ await asyncComp.done();
1843
+
1844
+ // 5. 从画布重新读取,确认修改已生效(保留现场供观察)
1845
+ const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
1846
+
1847
+ console.log('manufacturerId:', before, '→', refetched[0].getState_ManufacturerId());
1848
+ ```
1849
+
1850
+ ### setstate_name
1851
+
1852
+ # IPCB\_PrimitiveComponent.setState\_Name() method
1853
+
1854
+ > 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.
1855
+
1856
+ Set the property state: name
1857
+
1858
+ ## Signature
1859
+
1860
+ ```typescript
1861
+ function setState_Name(name: string | undefined): IPCB_PrimitiveComponent;
1862
+ ```
1863
+
1864
+ ## Parameters
1865
+
1866
+ <table><thead><tr><th>
1867
+
1868
+ Parameter
1869
+
1870
+ </th><th>
1871
+
1872
+ Type
1873
+
1874
+ </th><th>
1875
+
1876
+ Description
1877
+
1878
+ </th></tr></thead>
1879
+ <tbody><tr><td>
1880
+
1881
+ name
1882
+
1883
+ </td><td>
1884
+
1885
+ string \| undefined
1886
+
1887
+ </td><td>
1888
+
1889
+ Name
1890
+
1891
+ </td></tr>
1892
+ </tbody></table>
1893
+
1894
+ ## Returns
1895
+
1896
+ [IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
1897
+
1898
+ Device primitive object
1899
+
1900
+ ## Example
1901
+
1902
+ ```javascript
1903
+ // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
1904
+ const x = 20000 + Math.floor(Math.random() * 80000);
1905
+ const y = 20000 + Math.floor(Math.random() * 80000);
1906
+
1907
+ // 2. 放置测试器件
1908
+ const devices = await eda.lib_Device.search('C0402');
1909
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
1910
+ const compId = comp.getState_PrimitiveId();
1911
+
1912
+ // 3. 读取修改前的名称(模板表达式)
1913
+ const before = comp.getState_Name();
1914
+
1915
+ // 4. 异步模式改为固定名称并提交
1916
+ const asyncComp = comp.toAsync();
1917
+ asyncComp.setState_Name('嘉立创示例_Name');
1918
+ await asyncComp.done();
1919
+
1920
+ // 5. 从画布重新读取,确认修改已生效(保留现场供观察)
1921
+ const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
1922
+
1923
+ console.log('name:', before, '→', refetched[0].getState_Name());
1924
+ ```
1925
+
1926
+ ### setstate_otherproperty
1927
+
1928
+ # IPCB\_PrimitiveComponent.setState\_OtherProperty() method
1929
+
1930
+ > 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.
1931
+
1932
+ Set the property state: other parameters
1933
+
1934
+ ## Signature
1935
+
1936
+ ```typescript
1937
+ function setState_OtherProperty(
1938
+ otherProperty: Record<string, string | number | boolean>,
1939
+ ): IPCB_PrimitiveComponent;
1940
+ ```
1941
+
1942
+ ## Parameters
1943
+
1944
+ <table><thead><tr><th>
1945
+
1946
+ Parameter
1947
+
1948
+ </th><th>
1949
+
1950
+ Type
1951
+
1952
+ </th><th>
1953
+
1954
+ Description
1955
+
1956
+ </th></tr></thead>
1957
+ <tbody><tr><td>
1958
+
1959
+ otherProperty
1960
+
1961
+ </td><td>
1962
+
1963
+ Record&lt;string, string \| number \| boolean&gt;
1964
+
1965
+ </td><td>
1966
+
1967
+ Other parameters
1968
+
1969
+ </td></tr>
1970
+ </tbody></table>
1971
+
1972
+ ## Returns
1973
+
1974
+ [IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
1975
+
1976
+ Device primitive object
1977
+
1978
+ ## Example
1979
+
1980
+ ```javascript
1981
+ // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
1982
+ const x = 20000 + Math.floor(Math.random() * 80000);
1983
+ const y = 20000 + Math.floor(Math.random() * 80000);
1984
+
1985
+ // 2. 放置测试器件
1986
+ const devices = await eda.lib_Device.search('C0402');
1987
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
1988
+ const compId = comp.getState_PrimitiveId();
1989
+
1990
+ // 3. 读取修改前的参数数量
1991
+ const beforeCount = Object.keys(comp.getState_OtherProperty() || {}).length;
1992
+
1993
+ // 4. 异步模式写入新的参数字典并提交
1994
+ const asyncComp = comp.toAsync();
1995
+ asyncComp.setState_OtherProperty({ 嘉立创示例_Custom: 'ABC', Count: 3 });
1996
+ await asyncComp.done();
1997
+
1998
+ // 5. 从画布重新读取,确认参数已写入(保留现场供观察)
1999
+ const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
2000
+ const after = refetched[0].getState_OtherProperty();
2001
+
2002
+ console.log('propertyCount:', beforeCount, '→', Object.keys(after).length);
2003
+ console.log('customValue:', after['嘉立创示例_Custom']);
2004
+ ```
2005
+
2006
+ ### setstate_primitivelock
2007
+
2008
+ # IPCB\_PrimitiveComponent.setState\_PrimitiveLock() method
2009
+
2010
+ > 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.
2011
+
2012
+ Set the property state: whether it is locked
2013
+
2014
+ ## Signature
2015
+
2016
+ ```typescript
2017
+ function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitiveComponent;
2018
+ ```
2019
+
2020
+ ## Parameters
2021
+
2022
+ <table><thead><tr><th>
2023
+
2024
+ Parameter
2025
+
2026
+ </th><th>
2027
+
2028
+ Type
2029
+
2030
+ </th><th>
2031
+
2032
+ Description
2033
+
2034
+ </th></tr></thead>
2035
+ <tbody><tr><td>
2036
+
2037
+ primitiveLock
2038
+
2039
+ </td><td>
2040
+
2041
+ boolean
2042
+
2043
+ </td><td>
2044
+
2045
+ Whether it is locked
2046
+
2047
+ </td></tr>
2048
+ </tbody></table>
2049
+
2050
+ ## Returns
2051
+
2052
+ [IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
2053
+
2054
+ Device primitive object
2055
+
2056
+ ## Example
2057
+
2058
+ ```javascript
2059
+ // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
2060
+ const x = 20000 + Math.floor(Math.random() * 80000);
2061
+ const y = 20000 + Math.floor(Math.random() * 80000);
2062
+
2063
+ // 2. 放置测试器件
2064
+ const devices = await eda.lib_Device.search('C0402');
2065
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
2066
+ const compId = comp.getState_PrimitiveId();
2067
+
2068
+ // 3. 读取修改前的锁定状态
2069
+ const before = comp.getState_PrimitiveLock();
2070
+
2071
+ // 4. 异步模式锁定器件并提交
2072
+ const asyncComp = comp.toAsync();
2073
+ asyncComp.setState_PrimitiveLock(true);
2074
+ await asyncComp.done();
2075
+
2076
+ // 5. 从画布重新读取,确认修改已生效(保留现场供观察)
2077
+ const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
2078
+
2079
+ console.log('primitiveLock:', before, '→', refetched[0].getState_PrimitiveLock());
2080
+ ```
2081
+
2082
+ ### setstate_rotation
2083
+
2084
+ # IPCB\_PrimitiveComponent.setState\_Rotation() method
2085
+
2086
+ > 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.
2087
+
2088
+ Set the property state: rotation angle
2089
+
2090
+ ## Signature
2091
+
2092
+ ```typescript
2093
+ function setState_Rotation(rotation: number): IPCB_PrimitiveComponent;
2094
+ ```
2095
+
2096
+ ## Parameters
2097
+
2098
+ <table><thead><tr><th>
2099
+
2100
+ Parameter
2101
+
2102
+ </th><th>
2103
+
2104
+ Type
2105
+
2106
+ </th><th>
2107
+
2108
+ Description
2109
+
2110
+ </th></tr></thead>
2111
+ <tbody><tr><td>
2112
+
2113
+ rotation
2114
+
2115
+ </td><td>
2116
+
2117
+ number
2118
+
2119
+ </td><td>
2120
+
2121
+ Rotation angle
2122
+
2123
+ </td></tr>
2124
+ </tbody></table>
2125
+
2126
+ ## Returns
2127
+
2128
+ [IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
2129
+
2130
+ Device primitive object
2131
+
2132
+ ## Example
2133
+
2134
+ ```javascript
2135
+ // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
2136
+ const x = 20000 + Math.floor(Math.random() * 80000);
2137
+ const y = 20000 + Math.floor(Math.random() * 80000);
2138
+
2139
+ // 2. 放置测试器件(默认 0 度)
2140
+ const devices = await eda.lib_Device.search('C0402');
2141
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
2142
+ const compId = comp.getState_PrimitiveId();
2143
+
2144
+ // 3. 读取修改前的旋转角度
2145
+ const before = comp.getState_Rotation();
2146
+
2147
+ // 4. 异步模式旋转 90 度并提交
2148
+ const asyncComp = comp.toAsync();
2149
+ asyncComp.setState_Rotation(90);
2150
+ await asyncComp.done();
2151
+
2152
+ // 5. 从画布重新读取,确认修改已生效(保留现场供观察)
2153
+ const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
2154
+
2155
+ console.log('rotation:', before, '→', refetched[0].getState_Rotation());
2156
+ ```
2157
+
2158
+ ### setstate_supplier
2159
+
2160
+ # IPCB\_PrimitiveComponent.setState\_Supplier() method
2161
+
2162
+ > 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.
2163
+
2164
+ Set the property state: supplier
2165
+
2166
+ ## Signature
2167
+
2168
+ ```typescript
2169
+ function setState_Supplier(supplier: string | undefined): IPCB_PrimitiveComponent;
2170
+ ```
2171
+
2172
+ ## Parameters
2173
+
2174
+ <table><thead><tr><th>
2175
+
2176
+ Parameter
2177
+
2178
+ </th><th>
2179
+
2180
+ Type
2181
+
2182
+ </th><th>
2183
+
2184
+ Description
2185
+
2186
+ </th></tr></thead>
2187
+ <tbody><tr><td>
2188
+
2189
+ supplier
2190
+
2191
+ </td><td>
2192
+
2193
+ string \| undefined
2194
+
2195
+ </td><td>
2196
+
2197
+ Supplier
2198
+
2199
+ </td></tr>
2200
+ </tbody></table>
2201
+
2202
+ ## Returns
2203
+
2204
+ [IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
2205
+
2206
+ Device primitive object
2207
+
2208
+ ## Example
2209
+
2210
+ ```javascript
2211
+ // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
2212
+ const x = 20000 + Math.floor(Math.random() * 80000);
2213
+ const y = 20000 + Math.floor(Math.random() * 80000);
2214
+
2215
+ // 2. 放置测试器件
2216
+ const devices = await eda.lib_Device.search('C0402');
2217
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
2218
+ const compId = comp.getState_PrimitiveId();
2219
+
2220
+ // 3. 读取修改前的供应商
2221
+ const before = comp.getState_Supplier();
2222
+
2223
+ // 4. 异步模式修改供应商并提交
2224
+ const asyncComp = comp.toAsync();
2225
+ asyncComp.setState_Supplier('嘉立创示例_SUP');
2226
+ await asyncComp.done();
2227
+
2228
+ // 5. 从画布重新读取,确认修改已生效(保留现场供观察)
2229
+ const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
2230
+
2231
+ console.log('supplier:', before, '→', refetched[0].getState_Supplier());
2232
+ ```
2233
+
2234
+ ### setstate_supplierid
2235
+
2236
+ # IPCB\_PrimitiveComponent.setState\_SupplierId() method
2237
+
2238
+ > 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.
2239
+
2240
+ Set the property state: supplier ID
2241
+
2242
+ ## Signature
2243
+
2244
+ ```typescript
2245
+ function setState_SupplierId(supplierId: string | undefined): IPCB_PrimitiveComponent;
2246
+ ```
2247
+
2248
+ ## Parameters
2249
+
2250
+ <table><thead><tr><th>
2251
+
2252
+ Parameter
2253
+
2254
+ </th><th>
2255
+
2256
+ Type
2257
+
2258
+ </th><th>
2259
+
2260
+ Description
2261
+
2262
+ </th></tr></thead>
2263
+ <tbody><tr><td>
2264
+
2265
+ supplierId
2266
+
2267
+ </td><td>
2268
+
2269
+ string \| undefined
2270
+
2271
+ </td><td>
2272
+
2273
+ Supplier ID
2274
+
2275
+ </td></tr>
2276
+ </tbody></table>
2277
+
2278
+ ## Returns
2279
+
2280
+ [IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
2281
+
2282
+ Device primitive object
2283
+
2284
+ ## Example
2285
+
2286
+ ```javascript
2287
+ // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
2288
+ const x = 20000 + Math.floor(Math.random() * 80000);
2289
+ const y = 20000 + Math.floor(Math.random() * 80000);
2290
+
2291
+ // 2. 放置测试器件
2292
+ const devices = await eda.lib_Device.search('C0402');
2293
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
2294
+ const compId = comp.getState_PrimitiveId();
2295
+
2296
+ // 3. 读取修改前的供应商编号
2297
+ const before = comp.getState_SupplierId();
2298
+
2299
+ // 4. 异步模式修改供应商编号并提交
2300
+ const asyncComp = comp.toAsync();
2301
+ asyncComp.setState_SupplierId('SUP-DEMO-001');
2302
+ await asyncComp.done();
2303
+
2304
+ // 5. 从画布重新读取,确认修改已生效(保留现场供观察)
2305
+ const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
2306
+
2307
+ console.log('supplierId:', before, '→', refetched[0].getState_SupplierId());
2308
+ ```
2309
+
2310
+ ### setstate_uniqueid
2311
+
2312
+ # IPCB\_PrimitiveComponent.setState\_UniqueId() method
2313
+
2314
+ > 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.
2315
+
2316
+ Set the property state: unique ID
2317
+
2318
+ ## Signature
2319
+
2320
+ ```typescript
2321
+ function setState_UniqueId(uniqueId: string | undefined): IPCB_PrimitiveComponent;
2322
+ ```
2323
+
2324
+ ## Parameters
2325
+
2326
+ <table><thead><tr><th>
2327
+
2328
+ Parameter
2329
+
2330
+ </th><th>
2331
+
2332
+ Type
2333
+
2334
+ </th><th>
2335
+
2336
+ Description
2337
+
2338
+ </th></tr></thead>
2339
+ <tbody><tr><td>
2340
+
2341
+ uniqueId
2342
+
2343
+ </td><td>
2344
+
2345
+ string \| undefined
2346
+
2347
+ </td><td>
2348
+
2349
+ Unique ID
2350
+
2351
+ </td></tr>
2352
+ </tbody></table>
2353
+
2354
+ ## Returns
2355
+
2356
+ [IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
2357
+
2358
+ Device primitive object
2359
+
2360
+ ## Example
2361
+
2362
+ ```javascript
2363
+ // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
2364
+ const x = 20000 + Math.floor(Math.random() * 80000);
2365
+ const y = 20000 + Math.floor(Math.random() * 80000);
2366
+
2367
+ // 2. 放置测试器件
2368
+ const devices = await eda.lib_Device.search('C0402');
2369
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
2370
+ const compId = comp.getState_PrimitiveId();
2371
+
2372
+ // 3. 读取修改前的唯一 ID(默认空字符串)
2373
+ const before = comp.getState_UniqueId();
2374
+
2375
+ // 4. 异步模式设置分组唯一 ID 并提交
2376
+ const asyncComp = comp.toAsync();
2377
+ asyncComp.setState_UniqueId('JLC-DEMO-001');
2378
+ await asyncComp.done();
2379
+
2380
+ // 5. 从画布重新读取,确认修改已生效(保留现场供观察)
2381
+ const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
2382
+
2383
+ console.log('uniqueId:', JSON.stringify(before), '→', JSON.stringify(refetched[0].getState_UniqueId()));
2384
+ ```
2385
+
2386
+ ### setstate_x
2387
+
2388
+ # IPCB\_PrimitiveComponent.setState\_X() method
2389
+
2390
+ > 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.
2391
+
2392
+ Set the property state: X coordinate
2393
+
2394
+ ## Signature
2395
+
2396
+ ```typescript
2397
+ function setState_X(x: number): IPCB_PrimitiveComponent;
2398
+ ```
2399
+
2400
+ ## Parameters
2401
+
2402
+ <table><thead><tr><th>
2403
+
2404
+ Parameter
2405
+
2406
+ </th><th>
2407
+
2408
+ Type
2409
+
2410
+ </th><th>
2411
+
2412
+ Description
2413
+
2414
+ </th></tr></thead>
2415
+ <tbody><tr><td>
2416
+
2417
+ x
2418
+
2419
+ </td><td>
2420
+
2421
+ number
2422
+
2423
+ </td><td>
2424
+
2425
+ X coordinate
2426
+
2427
+ </td></tr>
2428
+ </tbody></table>
2429
+
2430
+ ## Returns
2431
+
2432
+ [IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
2433
+
2434
+ Device primitive object
2435
+
2436
+ ## Example
2437
+
2438
+ ```javascript
2439
+ // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
2440
+ const x = 20000 + Math.floor(Math.random() * 80000);
2441
+ const y = 20000 + Math.floor(Math.random() * 80000);
2442
+
2443
+ // 2. 放置测试器件
2444
+ const devices = await eda.lib_Device.search('C0402');
2445
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
2446
+ const compId = comp.getState_PrimitiveId();
2447
+
2448
+ // 3. 读取修改前的锚点 X 坐标
2449
+ const before = comp.getState_X();
2450
+
2451
+ // 4. 异步模式向右移动 300mil 并提交
2452
+ const asyncComp = comp.toAsync();
2453
+ asyncComp.setState_X(before + 300);
2454
+ await asyncComp.done();
2455
+
2456
+ // 5. 从画布重新读取,确认修改已生效(保留现场供观察)
2457
+ const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
2458
+
2459
+ console.log('x:', before, '→', refetched[0].getState_X());
2460
+ ```
2461
+
2462
+ ### setstate_y
2463
+
2464
+ # IPCB\_PrimitiveComponent.setState\_Y() method
2465
+
2466
+ > 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.
2467
+
2468
+ Set the property state: Y coordinate
2469
+
2470
+ ## Signature
2471
+
2472
+ ```typescript
2473
+ function setState_Y(y: number): IPCB_PrimitiveComponent;
2474
+ ```
2475
+
2476
+ ## Parameters
2477
+
2478
+ <table><thead><tr><th>
2479
+
2480
+ Parameter
2481
+
2482
+ </th><th>
2483
+
2484
+ Type
2485
+
2486
+ </th><th>
2487
+
2488
+ Description
2489
+
2490
+ </th></tr></thead>
2491
+ <tbody><tr><td>
2492
+
2493
+ y
2494
+
2495
+ </td><td>
2496
+
2497
+ number
2498
+
2499
+ </td><td>
2500
+
2501
+ Y coordinate
2502
+
2503
+ </td></tr>
2504
+ </tbody></table>
2505
+
2506
+ ## Returns
2507
+
2508
+ [IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
2509
+
2510
+ Device primitive object
2511
+
2512
+ ## Example
2513
+
2514
+ ```javascript
2515
+ // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
2516
+ const x = 20000 + Math.floor(Math.random() * 80000);
2517
+ const y = 20000 + Math.floor(Math.random() * 80000);
2518
+
2519
+ // 2. 放置测试器件
2520
+ const devices = await eda.lib_Device.search('C0402');
2521
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
2522
+ const compId = comp.getState_PrimitiveId();
2523
+
2524
+ // 3. 读取修改前的锚点 Y 坐标
2525
+ const before = comp.getState_Y();
2526
+
2527
+ // 4. 异步模式向上移动 300mil 并提交
2528
+ const asyncComp = comp.toAsync();
2529
+ asyncComp.setState_Y(before + 300);
2530
+ await asyncComp.done();
2531
+
2532
+ // 5. 从画布重新读取,确认修改已生效(保留现场供观察)
2533
+ const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
2534
+
2535
+ console.log('y:', before, '→', refetched[0].getState_Y());
2536
+ ```
2537
+
2538
+ ### toasync
2539
+
2540
+ # IPCB\_PrimitiveComponent.toAsync() method
2541
+
2542
+ Convert Primitive to Async primitive
2543
+
2544
+ ## Signature
2545
+
2546
+ ```typescript
2547
+ function toAsync(): IPCB_PrimitiveComponent;
2548
+ ```
2549
+
2550
+ ## Returns
2551
+
2552
+ [IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
2553
+
2554
+ Device primitive object
2555
+
2556
+ ## Example
2557
+
2558
+ ```javascript
2559
+ // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
2560
+ const x = 20000 + Math.floor(Math.random() * 80000);
2561
+ const y = 20000 + Math.floor(Math.random() * 80000);
2562
+
2563
+ // 2. 放置测试器件
2564
+ const devices = await eda.lib_Device.search('C0402');
2565
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
2566
+ const compId = comp.getState_PrimitiveId();
2567
+
2568
+ // 3. 转换为异步图元
2569
+ const asyncComp = comp.toAsync();
2570
+ const isAsyncNow = asyncComp.isAsync();
2571
+
2572
+ // 4. 在异步模式下修改位号并提交
2573
+ asyncComp.setState_Designator('C102');
2574
+ await asyncComp.done();
2575
+
2576
+ // 5. 从画布重新读取,确认修改已生效(保留现场供观察)
2577
+ const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
2578
+
2579
+ console.log('isAsync:', isAsyncNow);
2580
+ console.log('designator:', refetched[0].getState_Designator());
2581
+ ```
2582
+
2583
+ ### tosync
2584
+
2585
+ # IPCB\_PrimitiveComponent.toSync() method
2586
+
2587
+ Convert Primitive to Sync primitive
2588
+
2589
+ ## Signature
2590
+
2591
+ ```typescript
2592
+ function toSync(): IPCB_PrimitiveComponent;
2593
+ ```
2594
+
2595
+ ## Returns
2596
+
2597
+ [IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
2598
+
2599
+ Device primitive object
2600
+
2601
+ ## Example
2602
+
2603
+ ```javascript
2604
+ // 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
2605
+ const x = 20000 + Math.floor(Math.random() * 80000);
2606
+ const y = 20000 + Math.floor(Math.random() * 80000);
2607
+
2608
+ // 2. 放置测试器件
2609
+ const devices = await eda.lib_Device.search('C0402');
2610
+ const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
2611
+ const compId = comp.getState_PrimitiveId();
2612
+
2613
+ // 3. 读取修改前的位号
2614
+ const before = comp.getState_Designator();
2615
+
2616
+ // 4. 转换为同步图元后直接修改,立即生效(无需 done())
2617
+ const syncComp = comp.toSync();
2618
+ syncComp.setState_Designator('C103');
2619
+
2620
+ // 5. 从画布重新读取,确认修改已生效(保留现场供观察)
2621
+ const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
2622
+
2623
+ console.log('designator:', before, '→', refetched[0].getState_Designator());
2624
+ ```