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