@windypro-rourou/dsh-eda 0.1.0 → 0.1.2
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.
- package/README.md +71 -119
- package/cordis.patch.yml +9 -7
- package/lib/board.js +80 -0
- package/lib/client.js +2 -2
- package/lib/index.js +339 -11
- package/lib/installer.js +4 -4
- package/lib/skill.js +138 -0
- package/package.json +3 -2
- package/skill/INDEX.md +193 -0
- package/skill/README.official.md +125 -0
- package/skill/README.zh-Hans.official.md +125 -0
- package/skill/SKILL.md +746 -0
- package/skill/format/index.md +152 -0
- package/skill/format/pcb/3d.md +166 -0
- package/skill/format/pcb/attr.md +63 -0
- package/skill/format/pcb/common.md +306 -0
- package/skill/format/pcb/component.md +132 -0
- package/skill/format/pcb/dimension.md +58 -0
- package/skill/format/pcb/index.md +17 -0
- package/skill/format/pcb/obj.md +43 -0
- package/skill/format/pcb/pad_via.md +151 -0
- package/skill/format/pcb/panel.md +64 -0
- package/skill/format/pcb/partition.md +43 -0
- package/skill/format/pcb/primitive.md +196 -0
- package/skill/format/pcb/rule.md +71 -0
- package/skill/format/pcb/shape.md +441 -0
- package/skill/format/pcb/text.md +62 -0
- package/skill/format/project/blob.md +30 -0
- package/skill/format/project/common.md +42 -0
- package/skill/format/project/group.md +62 -0
- package/skill/format/project/index.md +12 -0
- package/skill/format/project/instance.md +32 -0
- package/skill/format/project/meta.md +189 -0
- package/skill/format/project/variant.md +30 -0
- package/skill/format/schematic/attr.md +41 -0
- package/skill/format/schematic/common.md +47 -0
- package/skill/format/schematic/component.md +91 -0
- package/skill/format/schematic/index.md +14 -0
- package/skill/format/schematic/obj.md +41 -0
- package/skill/format/schematic/pin.md +59 -0
- package/skill/format/schematic/shape.md +231 -0
- package/skill/format/schematic/structure.md +53 -0
- package/skill/format/schematic/table.md +109 -0
- package/skill/format/schematic/text.md +47 -0
- package/skill/format/schematic/wire.md +132 -0
- package/skill/guide/ancillary-projects/pro-api-sdk.md +1 -0
- package/skill/guide/ancillary-projects/pro-api-types.md +5 -0
- package/skill/guide/ancillary-projects.md +10 -0
- package/skill/guide/error-handling.md +38 -0
- package/skill/guide/extension-json.md +135 -0
- package/skill/guide/extensions-marketplace.md +61 -0
- package/skill/guide/how-to-start.md +301 -0
- package/skill/guide/i18n.md +57 -0
- package/skill/guide/index.md +7 -0
- package/skill/guide/inline-frame.md +20 -0
- package/skill/guide/invoke-apis.md +81 -0
- package/skill/guide/stability.md +37 -0
- package/skill/references/_index.md +398 -0
- package/skill/references/_quick-reference.md +3028 -0
- package/skill/references/classes/DMT_Board.md +533 -0
- package/skill/references/classes/DMT_EditorControl.md +1736 -0
- package/skill/references/classes/DMT_Event.md +356 -0
- package/skill/references/classes/DMT_Folder.md +775 -0
- package/skill/references/classes/DMT_Panel.md +531 -0
- package/skill/references/classes/DMT_Pcb.md +575 -0
- package/skill/references/classes/DMT_Project.md +573 -0
- package/skill/references/classes/DMT_Schematic.md +1477 -0
- package/skill/references/classes/DMT_SelectControl.md +96 -0
- package/skill/references/classes/DMT_Team.md +172 -0
- package/skill/references/classes/DMT_Workspace.md +198 -0
- package/skill/references/classes/EDA.md +961 -0
- package/skill/references/classes/IPCB_ComplexPolygon.md +299 -0
- package/skill/references/classes/IPCB_Polygon.md +175 -0
- package/skill/references/classes/IPCB_PrimitiveArc.md +1901 -0
- package/skill/references/classes/IPCB_PrimitiveAttribute.md +2993 -0
- package/skill/references/classes/IPCB_PrimitiveComponent.md +2627 -0
- package/skill/references/classes/IPCB_PrimitiveComponentPad.md +410 -0
- package/skill/references/classes/IPCB_PrimitiveDimension.md +1419 -0
- package/skill/references/classes/IPCB_PrimitiveFill.md +1325 -0
- package/skill/references/classes/IPCB_PrimitiveImage.md +1461 -0
- package/skill/references/classes/IPCB_PrimitiveLine.md +1639 -0
- package/skill/references/classes/IPCB_PrimitiveObject.md +1700 -0
- package/skill/references/classes/IPCB_PrimitivePad.md +3155 -0
- package/skill/references/classes/IPCB_PrimitivePolyline.md +1193 -0
- package/skill/references/classes/IPCB_PrimitivePour.md +1858 -0
- package/skill/references/classes/IPCB_PrimitivePoured.md +556 -0
- package/skill/references/classes/IPCB_PrimitiveRegion.md +1332 -0
- package/skill/references/classes/IPCB_PrimitiveString.md +2315 -0
- package/skill/references/classes/IPCB_PrimitiveVia.md +1588 -0
- package/skill/references/classes/ISCH_PrimitiveArc.md +1676 -0
- package/skill/references/classes/ISCH_PrimitiveAttribute.md +2541 -0
- package/skill/references/classes/ISCH_PrimitiveBus.md +973 -0
- package/skill/references/classes/ISCH_PrimitiveCbbSymbolComponent.md +260 -0
- package/skill/references/classes/ISCH_PrimitiveCircle.md +1392 -0
- package/skill/references/classes/ISCH_PrimitiveComponent.md +2913 -0
- package/skill/references/classes/ISCH_PrimitiveComponentPin.md +155 -0
- package/skill/references/classes/ISCH_PrimitiveObject.md +960 -0
- package/skill/references/classes/ISCH_PrimitivePin.md +2402 -0
- package/skill/references/classes/ISCH_PrimitivePolygon.md +1028 -0
- package/skill/references/classes/ISCH_PrimitiveRectangle.md +1777 -0
- package/skill/references/classes/ISCH_PrimitiveText.md +1771 -0
- package/skill/references/classes/ISCH_PrimitiveWire.md +973 -0
- package/skill/references/classes/LIB_3DModel.md +780 -0
- package/skill/references/classes/LIB_Cbb.md +957 -0
- package/skill/references/classes/LIB_Classification.md +965 -0
- package/skill/references/classes/LIB_Device.md +1221 -0
- package/skill/references/classes/LIB_Footprint.md +1153 -0
- package/skill/references/classes/LIB_LibrariesList.md +329 -0
- package/skill/references/classes/LIB_PanelLibrary.md +855 -0
- package/skill/references/classes/LIB_SelectControl.md +89 -0
- package/skill/references/classes/LIB_SimulationModel.md +821 -0
- package/skill/references/classes/LIB_Symbol.md +1195 -0
- package/skill/references/classes/PCB_Document.md +1754 -0
- package/skill/references/classes/PCB_Drc.md +3375 -0
- package/skill/references/classes/PCB_Event.md +1081 -0
- package/skill/references/classes/PCB_Layer.md +1911 -0
- package/skill/references/classes/PCB_ManufactureData.md +2968 -0
- package/skill/references/classes/PCB_MathPolygon.md +785 -0
- package/skill/references/classes/PCB_Net.md +1128 -0
- package/skill/references/classes/PCB_Primitive.md +217 -0
- package/skill/references/classes/PCB_PrimitiveArc.md +894 -0
- package/skill/references/classes/PCB_PrimitiveAttribute.md +717 -0
- package/skill/references/classes/PCB_PrimitiveComponent.md +1050 -0
- package/skill/references/classes/PCB_PrimitiveDimension.md +833 -0
- package/skill/references/classes/PCB_PrimitiveFill.md +861 -0
- package/skill/references/classes/PCB_PrimitiveImage.md +875 -0
- package/skill/references/classes/PCB_PrimitiveLine.md +858 -0
- package/skill/references/classes/PCB_PrimitiveObject.md +800 -0
- package/skill/references/classes/PCB_PrimitivePad.md +944 -0
- package/skill/references/classes/PCB_PrimitivePolyline.md +819 -0
- package/skill/references/classes/PCB_PrimitivePour.md +845 -0
- package/skill/references/classes/PCB_PrimitivePoured.md +363 -0
- package/skill/references/classes/PCB_PrimitiveRegion.md +799 -0
- package/skill/references/classes/PCB_PrimitiveString.md +910 -0
- package/skill/references/classes/PCB_PrimitiveVia.md +765 -0
- package/skill/references/classes/PCB_RayTracerEngine.md +263 -0
- package/skill/references/classes/PCB_SelectControl.md +495 -0
- package/skill/references/classes/PNL_Document.md +83 -0
- package/skill/references/classes/SCH_Document.md +809 -0
- package/skill/references/classes/SCH_Drc.md +242 -0
- package/skill/references/classes/SCH_Event.md +583 -0
- package/skill/references/classes/SCH_ManufactureData.md +1205 -0
- package/skill/references/classes/SCH_Net.md +200 -0
- package/skill/references/classes/SCH_Netlist.md +191 -0
- package/skill/references/classes/SCH_Primitive.md +337 -0
- package/skill/references/classes/SCH_PrimitiveArc.md +692 -0
- package/skill/references/classes/SCH_PrimitiveAttribute.md +590 -0
- package/skill/references/classes/SCH_PrimitiveBus.md +624 -0
- package/skill/references/classes/SCH_PrimitiveCircle.md +683 -0
- package/skill/references/classes/SCH_PrimitiveComponent.md +2240 -0
- package/skill/references/classes/SCH_PrimitiveObject.md +666 -0
- package/skill/references/classes/SCH_PrimitivePin.md +754 -0
- package/skill/references/classes/SCH_PrimitivePolygon.md +627 -0
- package/skill/references/classes/SCH_PrimitiveRectangle.md +731 -0
- package/skill/references/classes/SCH_PrimitiveText.md +746 -0
- package/skill/references/classes/SCH_PrimitiveWire.md +703 -0
- package/skill/references/classes/SCH_SelectControl.md +520 -0
- package/skill/references/classes/SCH_SimulationEngine.md +133 -0
- package/skill/references/classes/SCH_Utils.md +121 -0
- package/skill/references/classes/SYS_ClientUrl.md +173 -0
- package/skill/references/classes/SYS_Dialog.md +825 -0
- package/skill/references/classes/SYS_Environment.md +502 -0
- package/skill/references/classes/SYS_FileManager.md +1686 -0
- package/skill/references/classes/SYS_FileSystem.md +1171 -0
- package/skill/references/classes/SYS_FontManager.md +224 -0
- package/skill/references/classes/SYS_FormatConversion.md +349 -0
- package/skill/references/classes/SYS_HeaderMenu.md +479 -0
- package/skill/references/classes/SYS_I18n.md +861 -0
- package/skill/references/classes/SYS_IFrame.md +535 -0
- package/skill/references/classes/SYS_LoadingAndProgressBar.md +246 -0
- package/skill/references/classes/SYS_Log.md +424 -0
- package/skill/references/classes/SYS_Math.md +1565 -0
- package/skill/references/classes/SYS_Message.md +363 -0
- package/skill/references/classes/SYS_MessageBox.md +285 -0
- package/skill/references/classes/SYS_MessageBus.md +1618 -0
- package/skill/references/classes/SYS_PanelControl.md +696 -0
- package/skill/references/classes/SYS_RightClickMenu.md +175 -0
- package/skill/references/classes/SYS_Setting.md +85 -0
- package/skill/references/classes/SYS_ShortcutKey.md +623 -0
- package/skill/references/classes/SYS_Storage.md +484 -0
- package/skill/references/classes/SYS_Timer.md +447 -0
- package/skill/references/classes/SYS_ToastMessage.md +194 -0
- package/skill/references/classes/SYS_Tool.md +241 -0
- package/skill/references/classes/SYS_Unit.md +594 -0
- package/skill/references/classes/SYS_WebSocket.md +401 -0
- package/skill/references/classes/SYS_Window.md +850 -0
- package/skill/references/enums/EDMT_EditorDocumentType.md +279 -0
- package/skill/references/enums/EDMT_EditorSplitScreenDirection.md +48 -0
- package/skill/references/enums/EDMT_EditorTabEventType.md +63 -0
- package/skill/references/enums/EDMT_IndicatorMarkerType.md +81 -0
- package/skill/references/enums/EDMT_ItemType.md +158 -0
- package/skill/references/enums/EDMT_ProjectCollaborationMode.md +48 -0
- package/skill/references/enums/ELIB_DeviceJlcLibraryCategory.md +48 -0
- package/skill/references/enums/ELIB_LibraryType.md +114 -0
- package/skill/references/enums/ELIB_PreviewType.md +70 -0
- package/skill/references/enums/ELIB_SimulationModelType.md +48 -0
- package/skill/references/enums/ELIB_SymbolType.md +125 -0
- package/skill/references/enums/EPCB_AutoRoutingCornerStyle.md +48 -0
- package/skill/references/enums/EPCB_AutoRoutingExistingPrimitiveMode.md +48 -0
- package/skill/references/enums/EPCB_AutoRoutingOptimization.md +48 -0
- package/skill/references/enums/EPCB_DocumentCanvasUpdateCalculationActiveStatus.md +48 -0
- package/skill/references/enums/EPCB_DocumentRatlineCalculatingActiveStatus.md +52 -0
- package/skill/references/enums/EPCB_InactiveLayerDisplayMode.md +59 -0
- package/skill/references/enums/EPCB_LayerColorConfiguration.md +81 -0
- package/skill/references/enums/EPCB_LayerId.md +882 -0
- package/skill/references/enums/EPCB_LayerStatus.md +59 -0
- package/skill/references/enums/EPCB_LayerType.md +114 -0
- package/skill/references/enums/EPCB_MouseEventType.md +59 -0
- package/skill/references/enums/EPCB_NetEventType.md +59 -0
- package/skill/references/enums/EPCB_PcbPlateType.md +48 -0
- package/skill/references/enums/EPCB_PdfOutputMethod.md +59 -0
- package/skill/references/enums/EPCB_PrimitiveArcInteractiveMode.md +48 -0
- package/skill/references/enums/EPCB_PrimitiveDimensionType.md +59 -0
- package/skill/references/enums/EPCB_PrimitiveEventType.md +59 -0
- package/skill/references/enums/EPCB_PrimitiveFillMode.md +63 -0
- package/skill/references/enums/EPCB_PrimitivePadHeatWeldingConnectionMethod.md +59 -0
- package/skill/references/enums/EPCB_PrimitivePadHoleType.md +59 -0
- package/skill/references/enums/EPCB_PrimitivePadShapeType.md +81 -0
- package/skill/references/enums/EPCB_PrimitivePadType.md +59 -0
- package/skill/references/enums/EPCB_PrimitivePourFillMethod.md +59 -0
- package/skill/references/enums/EPCB_PrimitiveRegionRuleType.md +96 -0
- package/skill/references/enums/EPCB_PrimitiveStringAlignMode.md +125 -0
- package/skill/references/enums/EPCB_PrimitiveType.md +202 -0
- package/skill/references/enums/EPCB_PrimitiveViaType.md +59 -0
- package/skill/references/enums/ESCH_DynamicSimulationEnginePullEventType.md +103 -0
- package/skill/references/enums/ESCH_DynamicSimulationEnginePushEventType.md +81 -0
- package/skill/references/enums/ESCH_ExportDocumentFileType.md +59 -0
- package/skill/references/enums/ESCH_MouseEventType.md +48 -0
- package/skill/references/enums/ESCH_PrimitiveComponentType.md +125 -0
- package/skill/references/enums/ESCH_PrimitiveEventType.md +70 -0
- package/skill/references/enums/ESCH_PrimitiveFillStyle.md +114 -0
- package/skill/references/enums/ESCH_PrimitiveLineType.md +70 -0
- package/skill/references/enums/ESCH_PrimitivePinShape.md +70 -0
- package/skill/references/enums/ESCH_PrimitivePinType.md +147 -0
- package/skill/references/enums/ESCH_PrimitiveTextAlignMode.md +125 -0
- package/skill/references/enums/ESCH_PrimitiveType.md +180 -0
- package/skill/references/enums/ESCH_SimulationNetlistType.md +37 -0
- package/skill/references/enums/ESCH_SpiceSimulationEnginePullEventType.md +48 -0
- package/skill/references/enums/ESCH_SpiceSimulationEnginePushEventType.md +70 -0
- package/skill/references/enums/ESYS_BottomPanelTab.md +81 -0
- package/skill/references/enums/ESYS_HeaderMenuEnvironment.md +158 -0
- package/skill/references/enums/ESYS_ImportProjectBoardOutlineSource.md +52 -0
- package/skill/references/enums/ESYS_ImportProjectImportOption.md +59 -0
- package/skill/references/enums/ESYS_ImportProjectSchematicObjectStyle.md +48 -0
- package/skill/references/enums/ESYS_ImportProjectViaSolderMaskExpansion.md +52 -0
- package/skill/references/enums/ESYS_LeftPanelTab.md +81 -0
- package/skill/references/enums/ESYS_LogType.md +103 -0
- package/skill/references/enums/ESYS_NetlistType.md +114 -0
- package/skill/references/enums/ESYS_RightPanelTab.md +202 -0
- package/skill/references/enums/ESYS_ShortcutKeyEffectiveEditorRange.md +191 -0
- package/skill/references/enums/ESYS_ShortcutKeyEffectiveEditorScene.md +92 -0
- package/skill/references/enums/ESYS_StartPageQuickStartItem.md +206 -0
- package/skill/references/enums/ESYS_Theme.md +48 -0
- package/skill/references/enums/ESYS_ToastMessageType.md +81 -0
- package/skill/references/enums/ESYS_Unit.md +103 -0
- package/skill/references/enums/ESYS_WindowEventType.md +48 -0
- package/skill/references/enums/ESYS_WindowOpenTarget.md +48 -0
- package/skill/references/enums/NetportDeviceName.md +147 -0
- package/skill/references/enums/SchToolBarDeviceName.md +279 -0
- package/skill/references/interfaces/BoardProps.md +169 -0
- package/skill/references/interfaces/ButtonProps.md +169 -0
- package/skill/references/interfaces/CheckBoxProps.md +196 -0
- package/skill/references/interfaces/ComponentPropsMap.md +448 -0
- package/skill/references/interfaces/DialogProps.md +385 -0
- package/skill/references/interfaces/FlexItemProps.md +116 -0
- package/skill/references/interfaces/FlexProps.md +224 -0
- package/skill/references/interfaces/GridItemProps.md +143 -0
- package/skill/references/interfaces/GridProps.md +143 -0
- package/skill/references/interfaces/IDMT_BoardItem.md +171 -0
- package/skill/references/interfaces/IDMT_BriefProjectItem.md +171 -0
- package/skill/references/interfaces/IDMT_EditorDocumentItem.md +169 -0
- package/skill/references/interfaces/IDMT_EditorSplitScreenItem.md +173 -0
- package/skill/references/interfaces/IDMT_EditorTabItem.md +169 -0
- package/skill/references/interfaces/IDMT_FolderItem.md +225 -0
- package/skill/references/interfaces/IDMT_IndicatorMarkerShape.md +393 -0
- package/skill/references/interfaces/IDMT_PanelItem.md +144 -0
- package/skill/references/interfaces/IDMT_PcbItem.md +171 -0
- package/skill/references/interfaces/IDMT_ProjectItem.md +143 -0
- package/skill/references/interfaces/IDMT_SchematicItem.md +225 -0
- package/skill/references/interfaces/IDMT_SchematicPageItem.md +198 -0
- package/skill/references/interfaces/IDMT_TeamItem.md +144 -0
- package/skill/references/interfaces/IDMT_WorkspaceItem.md +117 -0
- package/skill/references/interfaces/IDesignPortal.md +103 -0
- package/skill/references/interfaces/ILIB_3DModelItem.md +198 -0
- package/skill/references/interfaces/ILIB_3DModelSearchItem.md +277 -0
- package/skill/references/interfaces/ILIB_CbbItem.md +225 -0
- package/skill/references/interfaces/ILIB_CbbSearchItem.md +277 -0
- package/skill/references/interfaces/ILIB_ClassificationIndex.md +150 -0
- package/skill/references/interfaces/ILIB_DeviceAssociationItem.md +210 -0
- package/skill/references/interfaces/ILIB_DeviceExtendPropertyItem.md +304 -0
- package/skill/references/interfaces/ILIB_DeviceItem.md +279 -0
- package/skill/references/interfaces/ILIB_DevicePropertiesForSearch.md +250 -0
- package/skill/references/interfaces/ILIB_DeviceSearchItem.md +521 -0
- package/skill/references/interfaces/ILIB_ExtendLibrary3DModelFunctions.md +64 -0
- package/skill/references/interfaces/ILIB_ExtendLibraryCbbFunctions.md +99 -0
- package/skill/references/interfaces/ILIB_ExtendLibraryClassificationIndex.md +150 -0
- package/skill/references/interfaces/ILIB_ExtendLibraryDeviceFunctions.md +157 -0
- package/skill/references/interfaces/ILIB_ExtendLibraryFootprintFunctions.md +63 -0
- package/skill/references/interfaces/ILIB_ExtendLibraryFunctions.md +123 -0
- package/skill/references/interfaces/ILIB_ExtendLibraryItem.md +97 -0
- package/skill/references/interfaces/ILIB_ExtendLibraryItemIndex.md +98 -0
- package/skill/references/interfaces/ILIB_ExtendLibrarySearchProperty.md +115 -0
- package/skill/references/interfaces/ILIB_ExtendLibrarySearchResult.md +169 -0
- package/skill/references/interfaces/ILIB_ExtendLibrarySearchResultDataLine.md +234 -0
- package/skill/references/interfaces/ILIB_ExtendLibrarySymbolFunctions.md +105 -0
- package/skill/references/interfaces/ILIB_ExtendLibraryUserIndex.md +96 -0
- package/skill/references/interfaces/ILIB_FootprintItem.md +198 -0
- package/skill/references/interfaces/ILIB_FootprintPropertiesForSearch.md +61 -0
- package/skill/references/interfaces/ILIB_FootprintSearchItem.md +277 -0
- package/skill/references/interfaces/ILIB_LibraryInfo.md +92 -0
- package/skill/references/interfaces/ILIB_LibraryItem.md +115 -0
- package/skill/references/interfaces/ILIB_PanelLibraryItem.md +198 -0
- package/skill/references/interfaces/ILIB_PanelLibrarySearchItem.md +277 -0
- package/skill/references/interfaces/ILIB_SimulationModelItem.md +306 -0
- package/skill/references/interfaces/ILIB_SimulationModelSearchItem.md +304 -0
- package/skill/references/interfaces/ILIB_SymbolItem.md +279 -0
- package/skill/references/interfaces/ILIB_SymbolPropertiesForSearch.md +61 -0
- package/skill/references/interfaces/ILIB_SymbolSearchItem.md +304 -0
- package/skill/references/interfaces/IPCB_AutoLayoutResult.md +169 -0
- package/skill/references/interfaces/IPCB_AutoRoutingProps.md +220 -0
- package/skill/references/interfaces/IPCB_AutoRoutingResult.md +169 -0
- package/skill/references/interfaces/IPCB_BomPropertiesTableColumns.md +169 -0
- package/skill/references/interfaces/IPCB_DifferentialPairItem.md +115 -0
- package/skill/references/interfaces/IPCB_DiscretizeOptions.md +65 -0
- package/skill/references/interfaces/IPCB_DiscretizedPoint.md +88 -0
- package/skill/references/interfaces/IPCB_EqualLengthNetGroupItem.md +115 -0
- package/skill/references/interfaces/IPCB_LayerItem.md +277 -0
- package/skill/references/interfaces/IPCB_NetClassItem.md +115 -0
- package/skill/references/interfaces/IPCB_NetInfo.md +115 -0
- package/skill/references/interfaces/IPCB_PadPairGroupItem.md +88 -0
- package/skill/references/interfaces/IPCB_PadPairMinWireLengthItem.md +88 -0
- package/skill/references/interfaces/IPCB_PhysicalStackingConfiguration.md +115 -0
- package/skill/references/interfaces/IPCB_Primitive.md +218 -0
- package/skill/references/interfaces/IPCB_PrimitiveAPI.md +175 -0
- package/skill/references/interfaces/IPCB_PrimitivePadHeatWelding.md +151 -0
- package/skill/references/interfaces/IPCB_PrimitivePouredPourFill.md +142 -0
- package/skill/references/interfaces/IPCB_PrimitiveSolderMaskAndPasteMaskExpansion.md +154 -0
- package/skill/references/interfaces/IPCB_SubstratePhysicalProperties.md +88 -0
- package/skill/references/interfaces/IRawNet.md +103 -0
- package/skill/references/interfaces/IRawPureSchematic.md +80 -0
- package/skill/references/interfaces/IRawSchematic.md +103 -0
- package/skill/references/interfaces/IRawWire.md +149 -0
- package/skill/references/interfaces/ISCH_DrcError.md +142 -0
- package/skill/references/interfaces/ISCH_DrcErrorPrimitive.md +142 -0
- package/skill/references/interfaces/ISCH_ExportPngResolution.md +94 -0
- package/skill/references/interfaces/ISCH_NetInfo.md +88 -0
- package/skill/references/interfaces/ISCH_Primitive.md +219 -0
- package/skill/references/interfaces/ISCH_PrimitiveAPI.md +175 -0
- package/skill/references/interfaces/ISCH_ProjectNetInfo.md +142 -0
- package/skill/references/interfaces/ISCH_WireInfo.md +169 -0
- package/skill/references/interfaces/ISYS_FileSystemFileList.md +169 -0
- package/skill/references/interfaces/ISYS_HeaderMenuSub1MenuItem.md +174 -0
- package/skill/references/interfaces/ISYS_HeaderMenuSub2MenuItem.md +147 -0
- package/skill/references/interfaces/ISYS_HeaderMenuTopMenuItem.md +115 -0
- package/skill/references/interfaces/ISYS_HeaderMenus.md +408 -0
- package/skill/references/interfaces/ISYS_LogLine.md +115 -0
- package/skill/references/interfaces/ISYS_MathBBox.md +142 -0
- package/skill/references/interfaces/ISYS_MathPoint.md +88 -0
- package/skill/references/interfaces/ISYS_MathPolygonWithHoles.md +92 -0
- package/skill/references/interfaces/ISYS_MessageBusTask.md +115 -0
- package/skill/references/interfaces/ISYS_MultilingualLanguagesData.md +13 -0
- package/skill/references/interfaces/ISYS_PcbComparisonResponse.md +115 -0
- package/skill/references/interfaces/ISYS_RightClickMenuItem.md +174 -0
- package/skill/references/interfaces/ISYS_ShortcutKeyData.md +169 -0
- package/skill/references/interfaces/ISYS_ShortcutKeyDataWithCallFn.md +62 -0
- package/skill/references/interfaces/ISYS_ShortcutKeyDataWithUserDefinedShortcutKey.md +62 -0
- package/skill/references/interfaces/ISYS_WindowEventListenerRemovableObject.md +109 -0
- package/skill/references/interfaces/IconProps.md +88 -0
- package/skill/references/interfaces/ImageProps.md +115 -0
- package/skill/references/interfaces/InputProps.md +520 -0
- package/skill/references/interfaces/ListChildren.md +223 -0
- package/skill/references/interfaces/ListProps.md +223 -0
- package/skill/references/interfaces/ModalProps.md +358 -0
- package/skill/references/interfaces/RadioGroupProps.md +196 -0
- package/skill/references/interfaces/RadioItem.md +115 -0
- package/skill/references/interfaces/ScrollerProps.md +169 -0
- package/skill/references/interfaces/SelectListItem.md +142 -0
- package/skill/references/interfaces/SelectProps.md +169 -0
- package/skill/references/interfaces/SlotProps.md +88 -0
- package/skill/references/interfaces/StyleProps.md +385 -0
- package/skill/references/interfaces/TextAreaProps.md +196 -0
- package/skill/references/interfaces/TextProps.md +169 -0
- package/skill/references/types/ISYS_LanguageKeyValuePairs.md +13 -0
- package/skill/references/types/TPCB_LayerTypesOfInnerLayer.md +12 -0
- package/skill/references/types/TPCB_LayersInTheSelectable.md +43 -0
- package/skill/references/types/TPCB_LayersOfComponent.md +12 -0
- package/skill/references/types/TPCB_LayersOfCopper.md +16 -0
- package/skill/references/types/TPCB_LayersOfCustom.md +42 -0
- package/skill/references/types/TPCB_LayersOfDimension.md +17 -0
- package/skill/references/types/TPCB_LayersOfFill.md +29 -0
- package/skill/references/types/TPCB_LayersOfImage.md +23 -0
- package/skill/references/types/TPCB_LayersOfInner.md +42 -0
- package/skill/references/types/TPCB_LayersOfLine.md +26 -0
- package/skill/references/types/TPCB_LayersOfObject.md +13 -0
- package/skill/references/types/TPCB_LayersOfPad.md +12 -0
- package/skill/references/types/TPCB_LayersOfRegion.md +12 -0
- package/skill/references/types/TPCB_NumberOfCopperLayers.md +10 -0
- package/skill/references/types/TPCB_PolygonSourceArray.md +83 -0
- package/skill/references/types/TPCB_PrimitiveDimensionCoordinateSet.md +67 -0
- package/skill/references/types/TPCB_PrimitivePadHole.md +31 -0
- package/skill/references/types/TPCB_PrimitivePadShape.md +62 -0
- package/skill/references/types/TPCB_PrimitiveSpecialPadShape.md +20 -0
- package/skill/references/types/TSYS_MathPolygonGroup.md +16 -0
- package/skill/references/types/TSYS_MathPolygonInput.md +21 -0
- package/skill/references/types/TSYS_PcbComparisonErrorCode.md +10 -0
- package/skill/references/types/TSYS_ShortcutKeys.md +97 -0
- package/skill/user-guide/using-extension.md +47 -0
|
@@ -0,0 +1,2993 @@
|
|
|
1
|
+
# IPCB\_PrimitiveAttribute class
|
|
2
|
+
|
|
3
|
+
Property primitive
|
|
4
|
+
|
|
5
|
+
## Signature
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
class IPCB_PrimitiveAttribute implements IPCB_Primitive
|
|
9
|
+
```
|
|
10
|
+
**Implements:** [IPCB\_Primitive](../interfaces/IPCB_Primitive.md)
|
|
11
|
+
|
|
12
|
+
## Constructors
|
|
13
|
+
|
|
14
|
+
<table><thead><tr><th>
|
|
15
|
+
|
|
16
|
+
Constructor
|
|
17
|
+
|
|
18
|
+
</th><th>
|
|
19
|
+
|
|
20
|
+
Modifiers
|
|
21
|
+
|
|
22
|
+
</th><th>
|
|
23
|
+
|
|
24
|
+
Description
|
|
25
|
+
|
|
26
|
+
</th></tr></thead>
|
|
27
|
+
<tbody><tr><td>
|
|
28
|
+
|
|
29
|
+
[(constructor)(layer, x, y, key, value, keyVisible, valueVisible, fontFamily, fontSize, lineWidth, alignMode, rotation, reverse, expansion, mirror, primitiveLock, primitiveId, parentPrimitiveId)](./IPCB_PrimitiveAttribute.md)
|
|
30
|
+
|
|
31
|
+
</td><td>
|
|
32
|
+
|
|
33
|
+
</td><td>
|
|
34
|
+
|
|
35
|
+
Constructs a new instance of the `IPCB_PrimitiveAttribute` class
|
|
36
|
+
|
|
37
|
+
</td></tr>
|
|
38
|
+
</tbody></table>
|
|
39
|
+
|
|
40
|
+
## Methods
|
|
41
|
+
|
|
42
|
+
<table><thead><tr><th>
|
|
43
|
+
|
|
44
|
+
Method
|
|
45
|
+
|
|
46
|
+
</th><th>
|
|
47
|
+
|
|
48
|
+
Modifiers
|
|
49
|
+
|
|
50
|
+
</th><th>
|
|
51
|
+
|
|
52
|
+
Description
|
|
53
|
+
|
|
54
|
+
</th></tr></thead>
|
|
55
|
+
<tbody><tr><td>
|
|
56
|
+
|
|
57
|
+
[done()](./IPCB_PrimitiveAttribute.md)
|
|
58
|
+
|
|
59
|
+
</td><td>
|
|
60
|
+
|
|
61
|
+
</td><td>
|
|
62
|
+
|
|
63
|
+
**_(BETA)_** Apply the changes to the primitives to the canvas
|
|
64
|
+
|
|
65
|
+
</td></tr>
|
|
66
|
+
<tr><td>
|
|
67
|
+
|
|
68
|
+
[getState\_AlignMode()](./IPCB_PrimitiveAttribute.md)
|
|
69
|
+
|
|
70
|
+
</td><td>
|
|
71
|
+
|
|
72
|
+
</td><td>
|
|
73
|
+
|
|
74
|
+
Get the property state: alignment mode
|
|
75
|
+
|
|
76
|
+
</td></tr>
|
|
77
|
+
<tr><td>
|
|
78
|
+
|
|
79
|
+
[getState\_Expansion()](./IPCB_PrimitiveAttribute.md)
|
|
80
|
+
|
|
81
|
+
</td><td>
|
|
82
|
+
|
|
83
|
+
</td><td>
|
|
84
|
+
|
|
85
|
+
Get the property state: inverted expansion
|
|
86
|
+
|
|
87
|
+
</td></tr>
|
|
88
|
+
<tr><td>
|
|
89
|
+
|
|
90
|
+
[getState\_FontFamily()](./IPCB_PrimitiveAttribute.md)
|
|
91
|
+
|
|
92
|
+
</td><td>
|
|
93
|
+
|
|
94
|
+
</td><td>
|
|
95
|
+
|
|
96
|
+
Get the property state: font
|
|
97
|
+
|
|
98
|
+
</td></tr>
|
|
99
|
+
<tr><td>
|
|
100
|
+
|
|
101
|
+
[getState\_FontSize()](./IPCB_PrimitiveAttribute.md)
|
|
102
|
+
|
|
103
|
+
</td><td>
|
|
104
|
+
|
|
105
|
+
</td><td>
|
|
106
|
+
|
|
107
|
+
Get the property state: font size
|
|
108
|
+
|
|
109
|
+
</td></tr>
|
|
110
|
+
<tr><td>
|
|
111
|
+
|
|
112
|
+
[getState\_Key()](./IPCB_PrimitiveAttribute.md)
|
|
113
|
+
|
|
114
|
+
</td><td>
|
|
115
|
+
|
|
116
|
+
</td><td>
|
|
117
|
+
|
|
118
|
+
Get the property state: Key
|
|
119
|
+
|
|
120
|
+
</td></tr>
|
|
121
|
+
<tr><td>
|
|
122
|
+
|
|
123
|
+
[getState\_KeyVisible()](./IPCB_PrimitiveAttribute.md)
|
|
124
|
+
|
|
125
|
+
</td><td>
|
|
126
|
+
|
|
127
|
+
</td><td>
|
|
128
|
+
|
|
129
|
+
Get the property state: Key whether it is visible
|
|
130
|
+
|
|
131
|
+
</td></tr>
|
|
132
|
+
<tr><td>
|
|
133
|
+
|
|
134
|
+
[getState\_Layer()](./IPCB_PrimitiveAttribute.md)
|
|
135
|
+
|
|
136
|
+
</td><td>
|
|
137
|
+
|
|
138
|
+
</td><td>
|
|
139
|
+
|
|
140
|
+
Get the property state: Layer
|
|
141
|
+
|
|
142
|
+
</td></tr>
|
|
143
|
+
<tr><td>
|
|
144
|
+
|
|
145
|
+
[getState\_LineWidth()](./IPCB_PrimitiveAttribute.md)
|
|
146
|
+
|
|
147
|
+
</td><td>
|
|
148
|
+
|
|
149
|
+
</td><td>
|
|
150
|
+
|
|
151
|
+
Get the property state: Line width
|
|
152
|
+
|
|
153
|
+
</td></tr>
|
|
154
|
+
<tr><td>
|
|
155
|
+
|
|
156
|
+
[getState\_Mirror()](./IPCB_PrimitiveAttribute.md)
|
|
157
|
+
|
|
158
|
+
</td><td>
|
|
159
|
+
|
|
160
|
+
</td><td>
|
|
161
|
+
|
|
162
|
+
Get the property state: whether it is mirrored
|
|
163
|
+
|
|
164
|
+
</td></tr>
|
|
165
|
+
<tr><td>
|
|
166
|
+
|
|
167
|
+
[getState\_ParentPrimitiveId()](./IPCB_PrimitiveAttribute.md)
|
|
168
|
+
|
|
169
|
+
</td><td>
|
|
170
|
+
|
|
171
|
+
</td><td>
|
|
172
|
+
|
|
173
|
+
Get the property state: associated parent primitive ID
|
|
174
|
+
|
|
175
|
+
</td></tr>
|
|
176
|
+
<tr><td>
|
|
177
|
+
|
|
178
|
+
[getState\_PrimitiveId()](./IPCB_PrimitiveAttribute.md)
|
|
179
|
+
|
|
180
|
+
</td><td>
|
|
181
|
+
|
|
182
|
+
</td><td>
|
|
183
|
+
|
|
184
|
+
Get the property state: primitive ID
|
|
185
|
+
|
|
186
|
+
</td></tr>
|
|
187
|
+
<tr><td>
|
|
188
|
+
|
|
189
|
+
[getState\_PrimitiveLock()](./IPCB_PrimitiveAttribute.md)
|
|
190
|
+
|
|
191
|
+
</td><td>
|
|
192
|
+
|
|
193
|
+
</td><td>
|
|
194
|
+
|
|
195
|
+
Get the property state: whether it is locked
|
|
196
|
+
|
|
197
|
+
</td></tr>
|
|
198
|
+
<tr><td>
|
|
199
|
+
|
|
200
|
+
[getState\_PrimitiveType()](./IPCB_PrimitiveAttribute.md)
|
|
201
|
+
|
|
202
|
+
</td><td>
|
|
203
|
+
|
|
204
|
+
</td><td>
|
|
205
|
+
|
|
206
|
+
Get the property state: primitive type
|
|
207
|
+
|
|
208
|
+
</td></tr>
|
|
209
|
+
<tr><td>
|
|
210
|
+
|
|
211
|
+
[getState\_Reverse()](./IPCB_PrimitiveAttribute.md)
|
|
212
|
+
|
|
213
|
+
</td><td>
|
|
214
|
+
|
|
215
|
+
</td><td>
|
|
216
|
+
|
|
217
|
+
Get the property state: whether it is inverted
|
|
218
|
+
|
|
219
|
+
</td></tr>
|
|
220
|
+
<tr><td>
|
|
221
|
+
|
|
222
|
+
[getState\_Rotation()](./IPCB_PrimitiveAttribute.md)
|
|
223
|
+
|
|
224
|
+
</td><td>
|
|
225
|
+
|
|
226
|
+
</td><td>
|
|
227
|
+
|
|
228
|
+
Get the property state: rotation angle
|
|
229
|
+
|
|
230
|
+
</td></tr>
|
|
231
|
+
<tr><td>
|
|
232
|
+
|
|
233
|
+
[getState\_Value()](./IPCB_PrimitiveAttribute.md)
|
|
234
|
+
|
|
235
|
+
</td><td>
|
|
236
|
+
|
|
237
|
+
</td><td>
|
|
238
|
+
|
|
239
|
+
Get the property state: Value
|
|
240
|
+
|
|
241
|
+
</td></tr>
|
|
242
|
+
<tr><td>
|
|
243
|
+
|
|
244
|
+
[getState\_ValueVisible()](./IPCB_PrimitiveAttribute.md)
|
|
245
|
+
|
|
246
|
+
</td><td>
|
|
247
|
+
|
|
248
|
+
</td><td>
|
|
249
|
+
|
|
250
|
+
Get the property state: Value whether it is visible
|
|
251
|
+
|
|
252
|
+
</td></tr>
|
|
253
|
+
<tr><td>
|
|
254
|
+
|
|
255
|
+
[getState\_X()](./IPCB_PrimitiveAttribute.md)
|
|
256
|
+
|
|
257
|
+
</td><td>
|
|
258
|
+
|
|
259
|
+
</td><td>
|
|
260
|
+
|
|
261
|
+
Get the property state: X coordinate
|
|
262
|
+
|
|
263
|
+
</td></tr>
|
|
264
|
+
<tr><td>
|
|
265
|
+
|
|
266
|
+
[getState\_Y()](./IPCB_PrimitiveAttribute.md)
|
|
267
|
+
|
|
268
|
+
</td><td>
|
|
269
|
+
|
|
270
|
+
</td><td>
|
|
271
|
+
|
|
272
|
+
Get the property state: Y coordinate
|
|
273
|
+
|
|
274
|
+
</td></tr>
|
|
275
|
+
<tr><td>
|
|
276
|
+
|
|
277
|
+
[isAsync()](./IPCB_PrimitiveAttribute.md)
|
|
278
|
+
|
|
279
|
+
</td><td>
|
|
280
|
+
|
|
281
|
+
</td><td>
|
|
282
|
+
|
|
283
|
+
Query whether the primitive is an async primitive
|
|
284
|
+
|
|
285
|
+
</td></tr>
|
|
286
|
+
<tr><td>
|
|
287
|
+
|
|
288
|
+
[reset()](./IPCB_PrimitiveAttribute.md)
|
|
289
|
+
|
|
290
|
+
</td><td>
|
|
291
|
+
|
|
292
|
+
</td><td>
|
|
293
|
+
|
|
294
|
+
**_(BETA)_** Reset the async primitive to the current canvas state
|
|
295
|
+
|
|
296
|
+
</td></tr>
|
|
297
|
+
<tr><td>
|
|
298
|
+
|
|
299
|
+
[setState\_AlignMode(alignMode)](./IPCB_PrimitiveAttribute.md)
|
|
300
|
+
|
|
301
|
+
</td><td>
|
|
302
|
+
|
|
303
|
+
</td><td>
|
|
304
|
+
|
|
305
|
+
**_(BETA)_** Set the property state: alignment mode
|
|
306
|
+
|
|
307
|
+
</td></tr>
|
|
308
|
+
<tr><td>
|
|
309
|
+
|
|
310
|
+
[setState\_Expansion(expansion)](./IPCB_PrimitiveAttribute.md)
|
|
311
|
+
|
|
312
|
+
</td><td>
|
|
313
|
+
|
|
314
|
+
</td><td>
|
|
315
|
+
|
|
316
|
+
**_(BETA)_** Set the property state: inverted expansion
|
|
317
|
+
|
|
318
|
+
</td></tr>
|
|
319
|
+
<tr><td>
|
|
320
|
+
|
|
321
|
+
[setState\_FontFamily(fontFamily)](./IPCB_PrimitiveAttribute.md)
|
|
322
|
+
|
|
323
|
+
</td><td>
|
|
324
|
+
|
|
325
|
+
</td><td>
|
|
326
|
+
|
|
327
|
+
**_(BETA)_** Set the property state: font
|
|
328
|
+
|
|
329
|
+
</td></tr>
|
|
330
|
+
<tr><td>
|
|
331
|
+
|
|
332
|
+
[setState\_FontSize(fontSize)](./IPCB_PrimitiveAttribute.md)
|
|
333
|
+
|
|
334
|
+
</td><td>
|
|
335
|
+
|
|
336
|
+
</td><td>
|
|
337
|
+
|
|
338
|
+
**_(BETA)_** Set the property state: font size
|
|
339
|
+
|
|
340
|
+
</td></tr>
|
|
341
|
+
<tr><td>
|
|
342
|
+
|
|
343
|
+
[setState\_Key(key)](./IPCB_PrimitiveAttribute.md)
|
|
344
|
+
|
|
345
|
+
</td><td>
|
|
346
|
+
|
|
347
|
+
</td><td>
|
|
348
|
+
|
|
349
|
+
**_(BETA)_** Set the property state: Key
|
|
350
|
+
|
|
351
|
+
</td></tr>
|
|
352
|
+
<tr><td>
|
|
353
|
+
|
|
354
|
+
[setState\_KeyVisible(keyVisible)](./IPCB_PrimitiveAttribute.md)
|
|
355
|
+
|
|
356
|
+
</td><td>
|
|
357
|
+
|
|
358
|
+
</td><td>
|
|
359
|
+
|
|
360
|
+
**_(BETA)_** Set the property state: Key whether it is visible
|
|
361
|
+
|
|
362
|
+
</td></tr>
|
|
363
|
+
<tr><td>
|
|
364
|
+
|
|
365
|
+
[setState\_Layer(layer)](./IPCB_PrimitiveAttribute.md)
|
|
366
|
+
|
|
367
|
+
</td><td>
|
|
368
|
+
|
|
369
|
+
</td><td>
|
|
370
|
+
|
|
371
|
+
**_(BETA)_** Set the property state: Layer
|
|
372
|
+
|
|
373
|
+
</td></tr>
|
|
374
|
+
<tr><td>
|
|
375
|
+
|
|
376
|
+
[setState\_LineWidth(lineWidth)](./IPCB_PrimitiveAttribute.md)
|
|
377
|
+
|
|
378
|
+
</td><td>
|
|
379
|
+
|
|
380
|
+
</td><td>
|
|
381
|
+
|
|
382
|
+
**_(BETA)_** Set the property state: Line width
|
|
383
|
+
|
|
384
|
+
</td></tr>
|
|
385
|
+
<tr><td>
|
|
386
|
+
|
|
387
|
+
[setState\_Mirror(mirror)](./IPCB_PrimitiveAttribute.md)
|
|
388
|
+
|
|
389
|
+
</td><td>
|
|
390
|
+
|
|
391
|
+
</td><td>
|
|
392
|
+
|
|
393
|
+
**_(BETA)_** Set the property state: whether it is mirrored
|
|
394
|
+
|
|
395
|
+
</td></tr>
|
|
396
|
+
<tr><td>
|
|
397
|
+
|
|
398
|
+
[setState\_PrimitiveLock(primitiveLock)](./IPCB_PrimitiveAttribute.md)
|
|
399
|
+
|
|
400
|
+
</td><td>
|
|
401
|
+
|
|
402
|
+
</td><td>
|
|
403
|
+
|
|
404
|
+
**_(BETA)_** Set the property state: whether it is locked
|
|
405
|
+
|
|
406
|
+
</td></tr>
|
|
407
|
+
<tr><td>
|
|
408
|
+
|
|
409
|
+
[setState\_Reverse(reverse)](./IPCB_PrimitiveAttribute.md)
|
|
410
|
+
|
|
411
|
+
</td><td>
|
|
412
|
+
|
|
413
|
+
</td><td>
|
|
414
|
+
|
|
415
|
+
**_(BETA)_** Set the property state: whether it is inverted
|
|
416
|
+
|
|
417
|
+
</td></tr>
|
|
418
|
+
<tr><td>
|
|
419
|
+
|
|
420
|
+
[setState\_Rotation(rotation)](./IPCB_PrimitiveAttribute.md)
|
|
421
|
+
|
|
422
|
+
</td><td>
|
|
423
|
+
|
|
424
|
+
</td><td>
|
|
425
|
+
|
|
426
|
+
**_(BETA)_** Set the property state: rotation angle
|
|
427
|
+
|
|
428
|
+
</td></tr>
|
|
429
|
+
<tr><td>
|
|
430
|
+
|
|
431
|
+
[setState\_Value(value)](./IPCB_PrimitiveAttribute.md)
|
|
432
|
+
|
|
433
|
+
</td><td>
|
|
434
|
+
|
|
435
|
+
</td><td>
|
|
436
|
+
|
|
437
|
+
**_(BETA)_** Set the property state: Value
|
|
438
|
+
|
|
439
|
+
</td></tr>
|
|
440
|
+
<tr><td>
|
|
441
|
+
|
|
442
|
+
[setState\_ValueVisible(valueVisible)](./IPCB_PrimitiveAttribute.md)
|
|
443
|
+
|
|
444
|
+
</td><td>
|
|
445
|
+
|
|
446
|
+
</td><td>
|
|
447
|
+
|
|
448
|
+
**_(BETA)_** Set the property state: Value whether it is visible
|
|
449
|
+
|
|
450
|
+
</td></tr>
|
|
451
|
+
<tr><td>
|
|
452
|
+
|
|
453
|
+
[setState\_X(x)](./IPCB_PrimitiveAttribute.md)
|
|
454
|
+
|
|
455
|
+
</td><td>
|
|
456
|
+
|
|
457
|
+
</td><td>
|
|
458
|
+
|
|
459
|
+
**_(BETA)_** Set the property state: X coordinate
|
|
460
|
+
|
|
461
|
+
</td></tr>
|
|
462
|
+
<tr><td>
|
|
463
|
+
|
|
464
|
+
[setState\_Y(y)](./IPCB_PrimitiveAttribute.md)
|
|
465
|
+
|
|
466
|
+
</td><td>
|
|
467
|
+
|
|
468
|
+
</td><td>
|
|
469
|
+
|
|
470
|
+
**_(BETA)_** Set the property state: Y coordinate
|
|
471
|
+
|
|
472
|
+
</td></tr>
|
|
473
|
+
<tr><td>
|
|
474
|
+
|
|
475
|
+
[toAsync()](./IPCB_PrimitiveAttribute.md)
|
|
476
|
+
|
|
477
|
+
</td><td>
|
|
478
|
+
|
|
479
|
+
</td><td>
|
|
480
|
+
|
|
481
|
+
Convert Primitive to Async primitive
|
|
482
|
+
|
|
483
|
+
</td></tr>
|
|
484
|
+
<tr><td>
|
|
485
|
+
|
|
486
|
+
[toSync()](./IPCB_PrimitiveAttribute.md)
|
|
487
|
+
|
|
488
|
+
</td><td>
|
|
489
|
+
|
|
490
|
+
</td><td>
|
|
491
|
+
|
|
492
|
+
Convert Primitive to Sync primitive
|
|
493
|
+
|
|
494
|
+
</td></tr>
|
|
495
|
+
</tbody></table>
|
|
496
|
+
|
|
497
|
+
---
|
|
498
|
+
|
|
499
|
+
## 构造函数详情
|
|
500
|
+
|
|
501
|
+
### _constructor_
|
|
502
|
+
|
|
503
|
+
# IPCB\_PrimitiveAttribute.(constructor)
|
|
504
|
+
|
|
505
|
+
Constructs a new instance of the `IPCB_PrimitiveAttribute` class
|
|
506
|
+
|
|
507
|
+
## Signature
|
|
508
|
+
|
|
509
|
+
```typescript
|
|
510
|
+
function constructor(
|
|
511
|
+
layer: TPCB_LayersOfImage,
|
|
512
|
+
x: number | null,
|
|
513
|
+
y: number | null,
|
|
514
|
+
key: string,
|
|
515
|
+
value: string,
|
|
516
|
+
keyVisible: boolean,
|
|
517
|
+
valueVisible: boolean,
|
|
518
|
+
fontFamily: string,
|
|
519
|
+
fontSize: number,
|
|
520
|
+
lineWidth: number,
|
|
521
|
+
alignMode: EPCB_PrimitiveStringAlignMode,
|
|
522
|
+
rotation: number,
|
|
523
|
+
reverse: boolean,
|
|
524
|
+
expansion: number,
|
|
525
|
+
mirror: boolean,
|
|
526
|
+
primitiveLock: boolean,
|
|
527
|
+
primitiveId: string,
|
|
528
|
+
parentPrimitiveId: string,
|
|
529
|
+
);
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
## Parameters
|
|
533
|
+
|
|
534
|
+
<table><thead><tr><th>
|
|
535
|
+
|
|
536
|
+
Parameter
|
|
537
|
+
|
|
538
|
+
</th><th>
|
|
539
|
+
|
|
540
|
+
Type
|
|
541
|
+
|
|
542
|
+
</th><th>
|
|
543
|
+
|
|
544
|
+
Description
|
|
545
|
+
|
|
546
|
+
</th></tr></thead>
|
|
547
|
+
<tbody><tr><td>
|
|
548
|
+
|
|
549
|
+
layer
|
|
550
|
+
|
|
551
|
+
</td><td>
|
|
552
|
+
|
|
553
|
+
[TPCB\_LayersOfImage](../types/TPCB_LayersOfImage.md)
|
|
554
|
+
|
|
555
|
+
</td><td>
|
|
556
|
+
|
|
557
|
+
</td></tr>
|
|
558
|
+
<tr><td>
|
|
559
|
+
|
|
560
|
+
x
|
|
561
|
+
|
|
562
|
+
</td><td>
|
|
563
|
+
|
|
564
|
+
number \| null
|
|
565
|
+
|
|
566
|
+
</td><td>
|
|
567
|
+
|
|
568
|
+
</td></tr>
|
|
569
|
+
<tr><td>
|
|
570
|
+
|
|
571
|
+
y
|
|
572
|
+
|
|
573
|
+
</td><td>
|
|
574
|
+
|
|
575
|
+
number \| null
|
|
576
|
+
|
|
577
|
+
</td><td>
|
|
578
|
+
|
|
579
|
+
</td></tr>
|
|
580
|
+
<tr><td>
|
|
581
|
+
|
|
582
|
+
key
|
|
583
|
+
|
|
584
|
+
</td><td>
|
|
585
|
+
|
|
586
|
+
string
|
|
587
|
+
|
|
588
|
+
</td><td>
|
|
589
|
+
|
|
590
|
+
</td></tr>
|
|
591
|
+
<tr><td>
|
|
592
|
+
|
|
593
|
+
value
|
|
594
|
+
|
|
595
|
+
</td><td>
|
|
596
|
+
|
|
597
|
+
string
|
|
598
|
+
|
|
599
|
+
</td><td>
|
|
600
|
+
|
|
601
|
+
</td></tr>
|
|
602
|
+
<tr><td>
|
|
603
|
+
|
|
604
|
+
keyVisible
|
|
605
|
+
|
|
606
|
+
</td><td>
|
|
607
|
+
|
|
608
|
+
boolean
|
|
609
|
+
|
|
610
|
+
</td><td>
|
|
611
|
+
|
|
612
|
+
</td></tr>
|
|
613
|
+
<tr><td>
|
|
614
|
+
|
|
615
|
+
valueVisible
|
|
616
|
+
|
|
617
|
+
</td><td>
|
|
618
|
+
|
|
619
|
+
boolean
|
|
620
|
+
|
|
621
|
+
</td><td>
|
|
622
|
+
|
|
623
|
+
</td></tr>
|
|
624
|
+
<tr><td>
|
|
625
|
+
|
|
626
|
+
fontFamily
|
|
627
|
+
|
|
628
|
+
</td><td>
|
|
629
|
+
|
|
630
|
+
string
|
|
631
|
+
|
|
632
|
+
</td><td>
|
|
633
|
+
|
|
634
|
+
</td></tr>
|
|
635
|
+
<tr><td>
|
|
636
|
+
|
|
637
|
+
fontSize
|
|
638
|
+
|
|
639
|
+
</td><td>
|
|
640
|
+
|
|
641
|
+
number
|
|
642
|
+
|
|
643
|
+
</td><td>
|
|
644
|
+
|
|
645
|
+
</td></tr>
|
|
646
|
+
<tr><td>
|
|
647
|
+
|
|
648
|
+
lineWidth
|
|
649
|
+
|
|
650
|
+
</td><td>
|
|
651
|
+
|
|
652
|
+
number
|
|
653
|
+
|
|
654
|
+
</td><td>
|
|
655
|
+
|
|
656
|
+
</td></tr>
|
|
657
|
+
<tr><td>
|
|
658
|
+
|
|
659
|
+
alignMode
|
|
660
|
+
|
|
661
|
+
</td><td>
|
|
662
|
+
|
|
663
|
+
[EPCB\_PrimitiveStringAlignMode](../enums/EPCB_PrimitiveStringAlignMode.md)
|
|
664
|
+
|
|
665
|
+
</td><td>
|
|
666
|
+
|
|
667
|
+
</td></tr>
|
|
668
|
+
<tr><td>
|
|
669
|
+
|
|
670
|
+
rotation
|
|
671
|
+
|
|
672
|
+
</td><td>
|
|
673
|
+
|
|
674
|
+
number
|
|
675
|
+
|
|
676
|
+
</td><td>
|
|
677
|
+
|
|
678
|
+
</td></tr>
|
|
679
|
+
<tr><td>
|
|
680
|
+
|
|
681
|
+
reverse
|
|
682
|
+
|
|
683
|
+
</td><td>
|
|
684
|
+
|
|
685
|
+
boolean
|
|
686
|
+
|
|
687
|
+
</td><td>
|
|
688
|
+
|
|
689
|
+
</td></tr>
|
|
690
|
+
<tr><td>
|
|
691
|
+
|
|
692
|
+
expansion
|
|
693
|
+
|
|
694
|
+
</td><td>
|
|
695
|
+
|
|
696
|
+
number
|
|
697
|
+
|
|
698
|
+
</td><td>
|
|
699
|
+
|
|
700
|
+
</td></tr>
|
|
701
|
+
<tr><td>
|
|
702
|
+
|
|
703
|
+
mirror
|
|
704
|
+
|
|
705
|
+
</td><td>
|
|
706
|
+
|
|
707
|
+
boolean
|
|
708
|
+
|
|
709
|
+
</td><td>
|
|
710
|
+
|
|
711
|
+
</td></tr>
|
|
712
|
+
<tr><td>
|
|
713
|
+
|
|
714
|
+
primitiveLock
|
|
715
|
+
|
|
716
|
+
</td><td>
|
|
717
|
+
|
|
718
|
+
boolean
|
|
719
|
+
|
|
720
|
+
</td><td>
|
|
721
|
+
|
|
722
|
+
</td></tr>
|
|
723
|
+
<tr><td>
|
|
724
|
+
|
|
725
|
+
primitiveId
|
|
726
|
+
|
|
727
|
+
</td><td>
|
|
728
|
+
|
|
729
|
+
string
|
|
730
|
+
|
|
731
|
+
</td><td>
|
|
732
|
+
|
|
733
|
+
</td></tr>
|
|
734
|
+
<tr><td>
|
|
735
|
+
|
|
736
|
+
parentPrimitiveId
|
|
737
|
+
|
|
738
|
+
</td><td>
|
|
739
|
+
|
|
740
|
+
string
|
|
741
|
+
|
|
742
|
+
</td><td>
|
|
743
|
+
|
|
744
|
+
</td></tr>
|
|
745
|
+
</tbody></table>
|
|
746
|
+
|
|
747
|
+
|
|
748
|
+
---
|
|
749
|
+
|
|
750
|
+
## 方法详情
|
|
751
|
+
|
|
752
|
+
### done
|
|
753
|
+
|
|
754
|
+
# IPCB\_PrimitiveAttribute.done() method
|
|
755
|
+
|
|
756
|
+
> 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.
|
|
757
|
+
|
|
758
|
+
Apply the changes to the primitives to the canvas
|
|
759
|
+
|
|
760
|
+
## Signature
|
|
761
|
+
|
|
762
|
+
```typescript
|
|
763
|
+
function done(): Promise<IPCB_PrimitiveAttribute>;
|
|
764
|
+
```
|
|
765
|
+
|
|
766
|
+
## Returns
|
|
767
|
+
|
|
768
|
+
Promise<[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)<!-- -->>
|
|
769
|
+
|
|
770
|
+
Attribute primitive object
|
|
771
|
+
|
|
772
|
+
## Example
|
|
773
|
+
|
|
774
|
+
```javascript
|
|
775
|
+
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
|
|
776
|
+
const x = 20000 + Math.floor(Math.random() * 80000);
|
|
777
|
+
const y = 20000 + Math.floor(Math.random() * 80000);
|
|
778
|
+
|
|
779
|
+
// 2. 放置测试器件并取出 Designator(编号)属性
|
|
780
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
781
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
|
|
782
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
|
|
783
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
784
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
785
|
+
|
|
786
|
+
// 3. 记录修改前的字号和旋转角度
|
|
787
|
+
const fontSizeBefore = designator.getState_FontSize();
|
|
788
|
+
const rotationBefore = designator.getState_Rotation();
|
|
789
|
+
|
|
790
|
+
// 4. 批量修改两个属性,一次 done() 提交
|
|
791
|
+
const asyncAttr = designator.toAsync();
|
|
792
|
+
asyncAttr.setState_FontSize(60);
|
|
793
|
+
asyncAttr.setState_Rotation(90);
|
|
794
|
+
await asyncAttr.done();
|
|
795
|
+
|
|
796
|
+
// 5. 从画布重新读取,确认批量修改已生效(保留现场供观察)
|
|
797
|
+
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
|
|
798
|
+
|
|
799
|
+
console.log('fontSize:', fontSizeBefore, '→', refetched.getState_FontSize());
|
|
800
|
+
console.log('rotation:', rotationBefore, '→', refetched.getState_Rotation());
|
|
801
|
+
```
|
|
802
|
+
|
|
803
|
+
### getstate_alignmode
|
|
804
|
+
|
|
805
|
+
# IPCB\_PrimitiveAttribute.getState\_AlignMode() method
|
|
806
|
+
|
|
807
|
+
Get the property state: alignment mode
|
|
808
|
+
|
|
809
|
+
## Signature
|
|
810
|
+
|
|
811
|
+
```typescript
|
|
812
|
+
function getState_AlignMode(): EPCB_PrimitiveStringAlignMode;
|
|
813
|
+
```
|
|
814
|
+
|
|
815
|
+
## Returns
|
|
816
|
+
|
|
817
|
+
[EPCB\_PrimitiveStringAlignMode](../enums/EPCB_PrimitiveStringAlignMode.md)
|
|
818
|
+
|
|
819
|
+
Alignment mode
|
|
820
|
+
|
|
821
|
+
## Example
|
|
822
|
+
|
|
823
|
+
```javascript
|
|
824
|
+
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
|
|
825
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
826
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
|
|
827
|
+
const compId = comp.getState_PrimitiveId();
|
|
828
|
+
|
|
829
|
+
// 2. 取出器件的属性图元,定位 Designator(编号)属性
|
|
830
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
|
|
831
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
832
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
833
|
+
|
|
834
|
+
// 3. 读取文本对齐模式
|
|
835
|
+
const alignMode = designator.getState_AlignMode();
|
|
836
|
+
|
|
837
|
+
// 4. 清理测试器件(属性图元随器件一起删除)
|
|
838
|
+
await eda.pcb_PrimitiveComponent.delete([compId]);
|
|
839
|
+
|
|
840
|
+
console.log('alignMode:', alignMode);
|
|
841
|
+
```
|
|
842
|
+
|
|
843
|
+
### getstate_expansion
|
|
844
|
+
|
|
845
|
+
# IPCB\_PrimitiveAttribute.getState\_Expansion() method
|
|
846
|
+
|
|
847
|
+
Get the property state: inverted expansion
|
|
848
|
+
|
|
849
|
+
## Signature
|
|
850
|
+
|
|
851
|
+
```typescript
|
|
852
|
+
function getState_Expansion(): number;
|
|
853
|
+
```
|
|
854
|
+
|
|
855
|
+
## Returns
|
|
856
|
+
|
|
857
|
+
number
|
|
858
|
+
|
|
859
|
+
Inverted expansion
|
|
860
|
+
|
|
861
|
+
## Example
|
|
862
|
+
|
|
863
|
+
```javascript
|
|
864
|
+
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
|
|
865
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
866
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
|
|
867
|
+
const compId = comp.getState_PrimitiveId();
|
|
868
|
+
|
|
869
|
+
// 2. 取出器件的属性图元,定位 Designator(编号)属性
|
|
870
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
|
|
871
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
872
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
873
|
+
|
|
874
|
+
// 3. 读取反相扩展值
|
|
875
|
+
const expansion = designator.getState_Expansion();
|
|
876
|
+
|
|
877
|
+
// 4. 清理测试器件(属性图元随器件一起删除)
|
|
878
|
+
await eda.pcb_PrimitiveComponent.delete([compId]);
|
|
879
|
+
|
|
880
|
+
console.log('expansion:', expansion);
|
|
881
|
+
```
|
|
882
|
+
|
|
883
|
+
### getstate_fontfamily
|
|
884
|
+
|
|
885
|
+
# IPCB\_PrimitiveAttribute.getState\_FontFamily() method
|
|
886
|
+
|
|
887
|
+
Get the property state: font
|
|
888
|
+
|
|
889
|
+
## Signature
|
|
890
|
+
|
|
891
|
+
```typescript
|
|
892
|
+
function getState_FontFamily(): string;
|
|
893
|
+
```
|
|
894
|
+
|
|
895
|
+
## Returns
|
|
896
|
+
|
|
897
|
+
string
|
|
898
|
+
|
|
899
|
+
Font
|
|
900
|
+
|
|
901
|
+
## Example
|
|
902
|
+
|
|
903
|
+
```javascript
|
|
904
|
+
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
|
|
905
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
906
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
|
|
907
|
+
const compId = comp.getState_PrimitiveId();
|
|
908
|
+
|
|
909
|
+
// 2. 取出器件的属性图元,定位 Designator(编号)属性
|
|
910
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
|
|
911
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
912
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
913
|
+
|
|
914
|
+
// 3. 读取字体名
|
|
915
|
+
const fontFamily = designator.getState_FontFamily();
|
|
916
|
+
|
|
917
|
+
// 4. 清理测试器件(属性图元随器件一起删除)
|
|
918
|
+
await eda.pcb_PrimitiveComponent.delete([compId]);
|
|
919
|
+
|
|
920
|
+
console.log('fontFamily:', fontFamily);
|
|
921
|
+
```
|
|
922
|
+
|
|
923
|
+
### getstate_fontsize
|
|
924
|
+
|
|
925
|
+
# IPCB\_PrimitiveAttribute.getState\_FontSize() method
|
|
926
|
+
|
|
927
|
+
Get the property state: font size
|
|
928
|
+
|
|
929
|
+
## Signature
|
|
930
|
+
|
|
931
|
+
```typescript
|
|
932
|
+
function getState_FontSize(): number;
|
|
933
|
+
```
|
|
934
|
+
|
|
935
|
+
## Returns
|
|
936
|
+
|
|
937
|
+
number
|
|
938
|
+
|
|
939
|
+
Font size
|
|
940
|
+
|
|
941
|
+
## Example
|
|
942
|
+
|
|
943
|
+
```javascript
|
|
944
|
+
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
|
|
945
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
946
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
|
|
947
|
+
const compId = comp.getState_PrimitiveId();
|
|
948
|
+
|
|
949
|
+
// 2. 取出器件的属性图元,定位 Designator(编号)属性
|
|
950
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
|
|
951
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
952
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
953
|
+
|
|
954
|
+
// 3. 读取字号
|
|
955
|
+
const fontSize = designator.getState_FontSize();
|
|
956
|
+
|
|
957
|
+
// 4. 清理测试器件(属性图元随器件一起删除)
|
|
958
|
+
await eda.pcb_PrimitiveComponent.delete([compId]);
|
|
959
|
+
|
|
960
|
+
console.log('fontSize:', fontSize);
|
|
961
|
+
```
|
|
962
|
+
|
|
963
|
+
### getstate_key
|
|
964
|
+
|
|
965
|
+
# IPCB\_PrimitiveAttribute.getState\_Key() method
|
|
966
|
+
|
|
967
|
+
Get the property state: Key
|
|
968
|
+
|
|
969
|
+
## Signature
|
|
970
|
+
|
|
971
|
+
```typescript
|
|
972
|
+
function getState_Key(): string;
|
|
973
|
+
```
|
|
974
|
+
|
|
975
|
+
## Returns
|
|
976
|
+
|
|
977
|
+
string
|
|
978
|
+
|
|
979
|
+
Key
|
|
980
|
+
|
|
981
|
+
## Example
|
|
982
|
+
|
|
983
|
+
```javascript
|
|
984
|
+
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
|
|
985
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
986
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
|
|
987
|
+
const compId = comp.getState_PrimitiveId();
|
|
988
|
+
|
|
989
|
+
// 2. 取出器件的全部属性图元
|
|
990
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
|
|
991
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
992
|
+
|
|
993
|
+
// 3. 读取每个属性的 Key(属性名)
|
|
994
|
+
const keys = attrs.map(a => a.getState_Key());
|
|
995
|
+
|
|
996
|
+
// 4. 清理测试器件(属性图元随器件一起删除)
|
|
997
|
+
await eda.pcb_PrimitiveComponent.delete([compId]);
|
|
998
|
+
|
|
999
|
+
console.log('keys:', keys.join(', '));
|
|
1000
|
+
```
|
|
1001
|
+
|
|
1002
|
+
### getstate_keyvisible
|
|
1003
|
+
|
|
1004
|
+
# IPCB\_PrimitiveAttribute.getState\_KeyVisible() method
|
|
1005
|
+
|
|
1006
|
+
Get the property state: Key whether it is visible
|
|
1007
|
+
|
|
1008
|
+
## Signature
|
|
1009
|
+
|
|
1010
|
+
```typescript
|
|
1011
|
+
function getState_KeyVisible(): boolean;
|
|
1012
|
+
```
|
|
1013
|
+
|
|
1014
|
+
## Returns
|
|
1015
|
+
|
|
1016
|
+
boolean
|
|
1017
|
+
|
|
1018
|
+
Key whether it is visible
|
|
1019
|
+
|
|
1020
|
+
## Example
|
|
1021
|
+
|
|
1022
|
+
```javascript
|
|
1023
|
+
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
|
|
1024
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
1025
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
|
|
1026
|
+
const compId = comp.getState_PrimitiveId();
|
|
1027
|
+
|
|
1028
|
+
// 2. 取出器件的属性图元,定位 Designator(编号)属性
|
|
1029
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
|
|
1030
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
1031
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
1032
|
+
|
|
1033
|
+
// 3. 读取 Key 可见性
|
|
1034
|
+
const keyVisible = designator.getState_KeyVisible();
|
|
1035
|
+
|
|
1036
|
+
// 4. 清理测试器件(属性图元随器件一起删除)
|
|
1037
|
+
await eda.pcb_PrimitiveComponent.delete([compId]);
|
|
1038
|
+
|
|
1039
|
+
console.log('keyVisible:', keyVisible);
|
|
1040
|
+
```
|
|
1041
|
+
|
|
1042
|
+
### getstate_layer
|
|
1043
|
+
|
|
1044
|
+
# IPCB\_PrimitiveAttribute.getState\_Layer() method
|
|
1045
|
+
|
|
1046
|
+
Get the property state: Layer
|
|
1047
|
+
|
|
1048
|
+
## Signature
|
|
1049
|
+
|
|
1050
|
+
```typescript
|
|
1051
|
+
function getState_Layer(): TPCB_LayersOfImage;
|
|
1052
|
+
```
|
|
1053
|
+
|
|
1054
|
+
## Returns
|
|
1055
|
+
|
|
1056
|
+
[TPCB\_LayersOfImage](../types/TPCB_LayersOfImage.md)
|
|
1057
|
+
|
|
1058
|
+
Layer
|
|
1059
|
+
|
|
1060
|
+
## Example
|
|
1061
|
+
|
|
1062
|
+
```javascript
|
|
1063
|
+
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
|
|
1064
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
1065
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
|
|
1066
|
+
const compId = comp.getState_PrimitiveId();
|
|
1067
|
+
|
|
1068
|
+
// 2. 取出器件的属性图元,定位 Designator(编号)属性
|
|
1069
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
|
|
1070
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
1071
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
1072
|
+
|
|
1073
|
+
// 3. 读取所在层
|
|
1074
|
+
const layer = designator.getState_Layer();
|
|
1075
|
+
|
|
1076
|
+
// 4. 清理测试器件(属性图元随器件一起删除)
|
|
1077
|
+
await eda.pcb_PrimitiveComponent.delete([compId]);
|
|
1078
|
+
|
|
1079
|
+
console.log('layer:', layer);
|
|
1080
|
+
```
|
|
1081
|
+
|
|
1082
|
+
### getstate_linewidth
|
|
1083
|
+
|
|
1084
|
+
# IPCB\_PrimitiveAttribute.getState\_LineWidth() method
|
|
1085
|
+
|
|
1086
|
+
Get the property state: Line width
|
|
1087
|
+
|
|
1088
|
+
## Signature
|
|
1089
|
+
|
|
1090
|
+
```typescript
|
|
1091
|
+
function getState_LineWidth(): number;
|
|
1092
|
+
```
|
|
1093
|
+
|
|
1094
|
+
## Returns
|
|
1095
|
+
|
|
1096
|
+
number
|
|
1097
|
+
|
|
1098
|
+
Line width
|
|
1099
|
+
|
|
1100
|
+
## Example
|
|
1101
|
+
|
|
1102
|
+
```javascript
|
|
1103
|
+
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
|
|
1104
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
1105
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
|
|
1106
|
+
const compId = comp.getState_PrimitiveId();
|
|
1107
|
+
|
|
1108
|
+
// 2. 取出器件的属性图元,定位 Designator(编号)属性
|
|
1109
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
|
|
1110
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
1111
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
1112
|
+
|
|
1113
|
+
// 3. 读取线宽
|
|
1114
|
+
const lineWidth = designator.getState_LineWidth();
|
|
1115
|
+
|
|
1116
|
+
// 4. 清理测试器件(属性图元随器件一起删除)
|
|
1117
|
+
await eda.pcb_PrimitiveComponent.delete([compId]);
|
|
1118
|
+
|
|
1119
|
+
console.log('lineWidth:', lineWidth);
|
|
1120
|
+
```
|
|
1121
|
+
|
|
1122
|
+
### getstate_mirror
|
|
1123
|
+
|
|
1124
|
+
# IPCB\_PrimitiveAttribute.getState\_Mirror() method
|
|
1125
|
+
|
|
1126
|
+
Get the property state: whether it is mirrored
|
|
1127
|
+
|
|
1128
|
+
## Signature
|
|
1129
|
+
|
|
1130
|
+
```typescript
|
|
1131
|
+
function getState_Mirror(): boolean;
|
|
1132
|
+
```
|
|
1133
|
+
|
|
1134
|
+
## Returns
|
|
1135
|
+
|
|
1136
|
+
boolean
|
|
1137
|
+
|
|
1138
|
+
Whether it is mirrored
|
|
1139
|
+
|
|
1140
|
+
## Example
|
|
1141
|
+
|
|
1142
|
+
```javascript
|
|
1143
|
+
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
|
|
1144
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
1145
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
|
|
1146
|
+
const compId = comp.getState_PrimitiveId();
|
|
1147
|
+
|
|
1148
|
+
// 2. 取出器件的属性图元,定位 Designator(编号)属性
|
|
1149
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
|
|
1150
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
1151
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
1152
|
+
|
|
1153
|
+
// 3. 读取镜像状态
|
|
1154
|
+
const mirror = designator.getState_Mirror();
|
|
1155
|
+
|
|
1156
|
+
// 4. 清理测试器件(属性图元随器件一起删除)
|
|
1157
|
+
await eda.pcb_PrimitiveComponent.delete([compId]);
|
|
1158
|
+
|
|
1159
|
+
console.log('mirror:', mirror);
|
|
1160
|
+
```
|
|
1161
|
+
|
|
1162
|
+
### getstate_parentprimitiveid
|
|
1163
|
+
|
|
1164
|
+
# IPCB\_PrimitiveAttribute.getState\_ParentPrimitiveId() method
|
|
1165
|
+
|
|
1166
|
+
Get the property state: associated parent primitive ID
|
|
1167
|
+
|
|
1168
|
+
## Signature
|
|
1169
|
+
|
|
1170
|
+
```typescript
|
|
1171
|
+
function getState_ParentPrimitiveId(): string;
|
|
1172
|
+
```
|
|
1173
|
+
|
|
1174
|
+
## Returns
|
|
1175
|
+
|
|
1176
|
+
string
|
|
1177
|
+
|
|
1178
|
+
Associated parent primitive ID
|
|
1179
|
+
|
|
1180
|
+
## Example
|
|
1181
|
+
|
|
1182
|
+
```javascript
|
|
1183
|
+
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
|
|
1184
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
1185
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
|
|
1186
|
+
const compId = comp.getState_PrimitiveId();
|
|
1187
|
+
|
|
1188
|
+
// 2. 取出器件的属性图元,定位 Designator(编号)属性
|
|
1189
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
|
|
1190
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
1191
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
1192
|
+
|
|
1193
|
+
// 3. 读取父图元 ID
|
|
1194
|
+
const parentPrimitiveId = designator.getState_ParentPrimitiveId();
|
|
1195
|
+
|
|
1196
|
+
// 4. 清理测试器件(属性图元随器件一起删除)
|
|
1197
|
+
await eda.pcb_PrimitiveComponent.delete([compId]);
|
|
1198
|
+
|
|
1199
|
+
console.log('parentPrimitiveId:', parentPrimitiveId);
|
|
1200
|
+
console.log('belongs to component:', parentPrimitiveId === compId);
|
|
1201
|
+
```
|
|
1202
|
+
|
|
1203
|
+
### getstate_primitiveid
|
|
1204
|
+
|
|
1205
|
+
# IPCB\_PrimitiveAttribute.getState\_PrimitiveId() method
|
|
1206
|
+
|
|
1207
|
+
Get the property state: primitive ID
|
|
1208
|
+
|
|
1209
|
+
## Signature
|
|
1210
|
+
|
|
1211
|
+
```typescript
|
|
1212
|
+
function getState_PrimitiveId(): string;
|
|
1213
|
+
```
|
|
1214
|
+
|
|
1215
|
+
## Returns
|
|
1216
|
+
|
|
1217
|
+
string
|
|
1218
|
+
|
|
1219
|
+
Primitive ID
|
|
1220
|
+
|
|
1221
|
+
## Example
|
|
1222
|
+
|
|
1223
|
+
```javascript
|
|
1224
|
+
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
|
|
1225
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
1226
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
|
|
1227
|
+
const compId = comp.getState_PrimitiveId();
|
|
1228
|
+
|
|
1229
|
+
// 2. 取出器件的属性图元,定位 Designator(编号)属性
|
|
1230
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
|
|
1231
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
1232
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
1233
|
+
|
|
1234
|
+
// 3. 读取属性图元 ID
|
|
1235
|
+
const primitiveId = designator.getState_PrimitiveId();
|
|
1236
|
+
|
|
1237
|
+
// 4. 清理测试器件(属性图元随器件一起删除)
|
|
1238
|
+
await eda.pcb_PrimitiveComponent.delete([compId]);
|
|
1239
|
+
|
|
1240
|
+
console.log('primitiveId:', primitiveId);
|
|
1241
|
+
```
|
|
1242
|
+
|
|
1243
|
+
### getstate_primitivelock
|
|
1244
|
+
|
|
1245
|
+
# IPCB\_PrimitiveAttribute.getState\_PrimitiveLock() method
|
|
1246
|
+
|
|
1247
|
+
Get the property state: whether it is locked
|
|
1248
|
+
|
|
1249
|
+
## Signature
|
|
1250
|
+
|
|
1251
|
+
```typescript
|
|
1252
|
+
function getState_PrimitiveLock(): boolean;
|
|
1253
|
+
```
|
|
1254
|
+
|
|
1255
|
+
## Returns
|
|
1256
|
+
|
|
1257
|
+
boolean
|
|
1258
|
+
|
|
1259
|
+
Whether it is locked
|
|
1260
|
+
|
|
1261
|
+
## Example
|
|
1262
|
+
|
|
1263
|
+
```javascript
|
|
1264
|
+
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
|
|
1265
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
1266
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
|
|
1267
|
+
const compId = comp.getState_PrimitiveId();
|
|
1268
|
+
|
|
1269
|
+
// 2. 取出器件的属性图元,定位 Designator(编号)属性
|
|
1270
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
|
|
1271
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
1272
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
1273
|
+
|
|
1274
|
+
// 3. 读取锁定状态
|
|
1275
|
+
const primitiveLock = designator.getState_PrimitiveLock();
|
|
1276
|
+
|
|
1277
|
+
// 4. 清理测试器件(属性图元随器件一起删除)
|
|
1278
|
+
await eda.pcb_PrimitiveComponent.delete([compId]);
|
|
1279
|
+
|
|
1280
|
+
console.log('primitiveLock:', primitiveLock);
|
|
1281
|
+
```
|
|
1282
|
+
|
|
1283
|
+
### getstate_primitivetype
|
|
1284
|
+
|
|
1285
|
+
# IPCB\_PrimitiveAttribute.getState\_PrimitiveType() method
|
|
1286
|
+
|
|
1287
|
+
Get the property state: primitive type
|
|
1288
|
+
|
|
1289
|
+
## Signature
|
|
1290
|
+
|
|
1291
|
+
```typescript
|
|
1292
|
+
function getState_PrimitiveType(): EPCB_PrimitiveType;
|
|
1293
|
+
```
|
|
1294
|
+
|
|
1295
|
+
## Returns
|
|
1296
|
+
|
|
1297
|
+
[EPCB\_PrimitiveType](../enums/EPCB_PrimitiveType.md)
|
|
1298
|
+
|
|
1299
|
+
Primitive type
|
|
1300
|
+
|
|
1301
|
+
## Example
|
|
1302
|
+
|
|
1303
|
+
```javascript
|
|
1304
|
+
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
|
|
1305
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
1306
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
|
|
1307
|
+
const compId = comp.getState_PrimitiveId();
|
|
1308
|
+
|
|
1309
|
+
// 2. 取出器件的属性图元,定位 Designator(编号)属性
|
|
1310
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
|
|
1311
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
1312
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
1313
|
+
|
|
1314
|
+
// 3. 读取图元类型
|
|
1315
|
+
const primitiveType = designator.getState_PrimitiveType();
|
|
1316
|
+
|
|
1317
|
+
// 4. 清理测试器件(属性图元随器件一起删除)
|
|
1318
|
+
await eda.pcb_PrimitiveComponent.delete([compId]);
|
|
1319
|
+
|
|
1320
|
+
console.log('primitiveType:', primitiveType);
|
|
1321
|
+
```
|
|
1322
|
+
|
|
1323
|
+
### getstate_reverse
|
|
1324
|
+
|
|
1325
|
+
# IPCB\_PrimitiveAttribute.getState\_Reverse() method
|
|
1326
|
+
|
|
1327
|
+
Get the property state: whether it is inverted
|
|
1328
|
+
|
|
1329
|
+
## Signature
|
|
1330
|
+
|
|
1331
|
+
```typescript
|
|
1332
|
+
function getState_Reverse(): boolean;
|
|
1333
|
+
```
|
|
1334
|
+
|
|
1335
|
+
## Returns
|
|
1336
|
+
|
|
1337
|
+
boolean
|
|
1338
|
+
|
|
1339
|
+
Whether it is inverted
|
|
1340
|
+
|
|
1341
|
+
## Example
|
|
1342
|
+
|
|
1343
|
+
```javascript
|
|
1344
|
+
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
|
|
1345
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
1346
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
|
|
1347
|
+
const compId = comp.getState_PrimitiveId();
|
|
1348
|
+
|
|
1349
|
+
// 2. 取出器件的属性图元,定位 Designator(编号)属性
|
|
1350
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
|
|
1351
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
1352
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
1353
|
+
|
|
1354
|
+
// 3. 读取反相状态
|
|
1355
|
+
const reverse = designator.getState_Reverse();
|
|
1356
|
+
|
|
1357
|
+
// 4. 清理测试器件(属性图元随器件一起删除)
|
|
1358
|
+
await eda.pcb_PrimitiveComponent.delete([compId]);
|
|
1359
|
+
|
|
1360
|
+
console.log('reverse:', reverse);
|
|
1361
|
+
```
|
|
1362
|
+
|
|
1363
|
+
### getstate_rotation
|
|
1364
|
+
|
|
1365
|
+
# IPCB\_PrimitiveAttribute.getState\_Rotation() method
|
|
1366
|
+
|
|
1367
|
+
Get the property state: rotation angle
|
|
1368
|
+
|
|
1369
|
+
## Signature
|
|
1370
|
+
|
|
1371
|
+
```typescript
|
|
1372
|
+
function getState_Rotation(): number;
|
|
1373
|
+
```
|
|
1374
|
+
|
|
1375
|
+
## Returns
|
|
1376
|
+
|
|
1377
|
+
number
|
|
1378
|
+
|
|
1379
|
+
Rotation angle
|
|
1380
|
+
|
|
1381
|
+
## Example
|
|
1382
|
+
|
|
1383
|
+
```javascript
|
|
1384
|
+
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
|
|
1385
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
1386
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
|
|
1387
|
+
const compId = comp.getState_PrimitiveId();
|
|
1388
|
+
|
|
1389
|
+
// 2. 取出器件的属性图元,定位 Designator(编号)属性
|
|
1390
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
|
|
1391
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
1392
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
1393
|
+
|
|
1394
|
+
// 3. 读取旋转角度
|
|
1395
|
+
const rotation = designator.getState_Rotation();
|
|
1396
|
+
|
|
1397
|
+
// 4. 清理测试器件(属性图元随器件一起删除)
|
|
1398
|
+
await eda.pcb_PrimitiveComponent.delete([compId]);
|
|
1399
|
+
|
|
1400
|
+
console.log('rotation:', rotation);
|
|
1401
|
+
```
|
|
1402
|
+
|
|
1403
|
+
### getstate_value
|
|
1404
|
+
|
|
1405
|
+
# IPCB\_PrimitiveAttribute.getState\_Value() method
|
|
1406
|
+
|
|
1407
|
+
Get the property state: Value
|
|
1408
|
+
|
|
1409
|
+
## Signature
|
|
1410
|
+
|
|
1411
|
+
```typescript
|
|
1412
|
+
function getState_Value(): string;
|
|
1413
|
+
```
|
|
1414
|
+
|
|
1415
|
+
## Returns
|
|
1416
|
+
|
|
1417
|
+
string
|
|
1418
|
+
|
|
1419
|
+
Value
|
|
1420
|
+
|
|
1421
|
+
## Example
|
|
1422
|
+
|
|
1423
|
+
```javascript
|
|
1424
|
+
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
|
|
1425
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
1426
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
|
|
1427
|
+
const compId = comp.getState_PrimitiveId();
|
|
1428
|
+
|
|
1429
|
+
// 2. 取出器件的属性图元,定位 Designator(编号)属性
|
|
1430
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
|
|
1431
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
1432
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
1433
|
+
|
|
1434
|
+
// 3. 读取属性值
|
|
1435
|
+
const value = designator.getState_Value();
|
|
1436
|
+
|
|
1437
|
+
// 4. 清理测试器件(属性图元随器件一起删除)
|
|
1438
|
+
await eda.pcb_PrimitiveComponent.delete([compId]);
|
|
1439
|
+
|
|
1440
|
+
console.log('value:', value);
|
|
1441
|
+
```
|
|
1442
|
+
|
|
1443
|
+
### getstate_valuevisible
|
|
1444
|
+
|
|
1445
|
+
# IPCB\_PrimitiveAttribute.getState\_ValueVisible() method
|
|
1446
|
+
|
|
1447
|
+
Get the property state: Value whether it is visible
|
|
1448
|
+
|
|
1449
|
+
## Signature
|
|
1450
|
+
|
|
1451
|
+
```typescript
|
|
1452
|
+
function getState_ValueVisible(): boolean;
|
|
1453
|
+
```
|
|
1454
|
+
|
|
1455
|
+
## Returns
|
|
1456
|
+
|
|
1457
|
+
boolean
|
|
1458
|
+
|
|
1459
|
+
Value whether it is visible
|
|
1460
|
+
|
|
1461
|
+
## Example
|
|
1462
|
+
|
|
1463
|
+
```javascript
|
|
1464
|
+
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
|
|
1465
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
1466
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
|
|
1467
|
+
const compId = comp.getState_PrimitiveId();
|
|
1468
|
+
|
|
1469
|
+
// 2. 取出器件的属性图元,定位 Designator(编号)属性
|
|
1470
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
|
|
1471
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
1472
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
1473
|
+
|
|
1474
|
+
// 3. 读取 Value 可见性
|
|
1475
|
+
const valueVisible = designator.getState_ValueVisible();
|
|
1476
|
+
|
|
1477
|
+
// 4. 清理测试器件(属性图元随器件一起删除)
|
|
1478
|
+
await eda.pcb_PrimitiveComponent.delete([compId]);
|
|
1479
|
+
|
|
1480
|
+
console.log('valueVisible:', valueVisible);
|
|
1481
|
+
```
|
|
1482
|
+
|
|
1483
|
+
### getstate_x
|
|
1484
|
+
|
|
1485
|
+
# IPCB\_PrimitiveAttribute.getState\_X() method
|
|
1486
|
+
|
|
1487
|
+
Get the property state: X coordinate
|
|
1488
|
+
|
|
1489
|
+
## Signature
|
|
1490
|
+
|
|
1491
|
+
```typescript
|
|
1492
|
+
function getState_X(): number | null;
|
|
1493
|
+
```
|
|
1494
|
+
|
|
1495
|
+
## Returns
|
|
1496
|
+
|
|
1497
|
+
number \| null
|
|
1498
|
+
|
|
1499
|
+
X coordinate
|
|
1500
|
+
|
|
1501
|
+
## Example
|
|
1502
|
+
|
|
1503
|
+
```javascript
|
|
1504
|
+
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
|
|
1505
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
1506
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
|
|
1507
|
+
const compId = comp.getState_PrimitiveId();
|
|
1508
|
+
|
|
1509
|
+
// 2. 取出器件的属性图元,定位 Designator(编号)属性
|
|
1510
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
|
|
1511
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
1512
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
1513
|
+
|
|
1514
|
+
// 3. 读取锚点 X 坐标
|
|
1515
|
+
const x = designator.getState_X();
|
|
1516
|
+
|
|
1517
|
+
// 4. 清理测试器件(属性图元随器件一起删除)
|
|
1518
|
+
await eda.pcb_PrimitiveComponent.delete([compId]);
|
|
1519
|
+
|
|
1520
|
+
console.log('x:', x);
|
|
1521
|
+
```
|
|
1522
|
+
|
|
1523
|
+
### getstate_y
|
|
1524
|
+
|
|
1525
|
+
# IPCB\_PrimitiveAttribute.getState\_Y() method
|
|
1526
|
+
|
|
1527
|
+
Get the property state: Y coordinate
|
|
1528
|
+
|
|
1529
|
+
## Signature
|
|
1530
|
+
|
|
1531
|
+
```typescript
|
|
1532
|
+
function getState_Y(): number | null;
|
|
1533
|
+
```
|
|
1534
|
+
|
|
1535
|
+
## Returns
|
|
1536
|
+
|
|
1537
|
+
number \| null
|
|
1538
|
+
|
|
1539
|
+
Y coordinate
|
|
1540
|
+
|
|
1541
|
+
## Example
|
|
1542
|
+
|
|
1543
|
+
```javascript
|
|
1544
|
+
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
|
|
1545
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
1546
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
|
|
1547
|
+
const compId = comp.getState_PrimitiveId();
|
|
1548
|
+
|
|
1549
|
+
// 2. 取出器件的属性图元,定位 Designator(编号)属性
|
|
1550
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
|
|
1551
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
1552
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
1553
|
+
|
|
1554
|
+
// 3. 读取锚点 Y 坐标
|
|
1555
|
+
const y = designator.getState_Y();
|
|
1556
|
+
|
|
1557
|
+
// 4. 清理测试器件(属性图元随器件一起删除)
|
|
1558
|
+
await eda.pcb_PrimitiveComponent.delete([compId]);
|
|
1559
|
+
|
|
1560
|
+
console.log('y:', y);
|
|
1561
|
+
```
|
|
1562
|
+
|
|
1563
|
+
### isasync
|
|
1564
|
+
|
|
1565
|
+
# IPCB\_PrimitiveAttribute.isAsync() method
|
|
1566
|
+
|
|
1567
|
+
Query whether the primitive is an async primitive
|
|
1568
|
+
|
|
1569
|
+
## Signature
|
|
1570
|
+
|
|
1571
|
+
```typescript
|
|
1572
|
+
function isAsync(): boolean;
|
|
1573
|
+
```
|
|
1574
|
+
|
|
1575
|
+
## Returns
|
|
1576
|
+
|
|
1577
|
+
boolean
|
|
1578
|
+
|
|
1579
|
+
Whether Is async primitive
|
|
1580
|
+
|
|
1581
|
+
## Example
|
|
1582
|
+
|
|
1583
|
+
```javascript
|
|
1584
|
+
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
|
|
1585
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
1586
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
|
|
1587
|
+
const compId = comp.getState_PrimitiveId();
|
|
1588
|
+
|
|
1589
|
+
// 2. 取出器件的属性图元,定位 Designator(编号)属性
|
|
1590
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
|
|
1591
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
1592
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
1593
|
+
|
|
1594
|
+
// 3. 查询异步状态
|
|
1595
|
+
const isAsync = designator.isAsync();
|
|
1596
|
+
|
|
1597
|
+
// 4. 清理测试器件(属性图元随器件一起删除)
|
|
1598
|
+
await eda.pcb_PrimitiveComponent.delete([compId]);
|
|
1599
|
+
|
|
1600
|
+
console.log('isAsync:', isAsync);
|
|
1601
|
+
```
|
|
1602
|
+
|
|
1603
|
+
### reset
|
|
1604
|
+
|
|
1605
|
+
# IPCB\_PrimitiveAttribute.reset() method
|
|
1606
|
+
|
|
1607
|
+
> 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.
|
|
1608
|
+
|
|
1609
|
+
Reset the async primitive to the current canvas state
|
|
1610
|
+
|
|
1611
|
+
## Signature
|
|
1612
|
+
|
|
1613
|
+
```typescript
|
|
1614
|
+
function reset(): Promise<IPCB_PrimitiveAttribute>;
|
|
1615
|
+
```
|
|
1616
|
+
|
|
1617
|
+
## Returns
|
|
1618
|
+
|
|
1619
|
+
Promise<[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)<!-- -->>
|
|
1620
|
+
|
|
1621
|
+
Attribute primitive object
|
|
1622
|
+
|
|
1623
|
+
## Example
|
|
1624
|
+
|
|
1625
|
+
```javascript
|
|
1626
|
+
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
|
|
1627
|
+
const x = 20000 + Math.floor(Math.random() * 80000);
|
|
1628
|
+
const y = 20000 + Math.floor(Math.random() * 80000);
|
|
1629
|
+
|
|
1630
|
+
// 2. 放置测试器件并取出 Designator(编号)属性
|
|
1631
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
1632
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
|
|
1633
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
|
|
1634
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
1635
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
1636
|
+
|
|
1637
|
+
// 3. 记录画布上的原始值
|
|
1638
|
+
const original = designator.getState_Value();
|
|
1639
|
+
|
|
1640
|
+
// 4. 异步模式下改一个错误值,但不提交,直接 reset() 丢弃
|
|
1641
|
+
const asyncAttr = designator.toAsync();
|
|
1642
|
+
asyncAttr.setState_Value('SHOULD-DISCARD');
|
|
1643
|
+
await asyncAttr.reset();
|
|
1644
|
+
|
|
1645
|
+
// 5. 从画布重新读取,确认值仍是原始值(保留现场供观察)
|
|
1646
|
+
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
|
|
1647
|
+
|
|
1648
|
+
console.log('value:', original, '→', refetched.getState_Value(), '(修改已丢弃)');
|
|
1649
|
+
```
|
|
1650
|
+
|
|
1651
|
+
### setstate_alignmode
|
|
1652
|
+
|
|
1653
|
+
# IPCB\_PrimitiveAttribute.setState\_AlignMode() method
|
|
1654
|
+
|
|
1655
|
+
> 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.
|
|
1656
|
+
|
|
1657
|
+
Set the property state: alignment mode
|
|
1658
|
+
|
|
1659
|
+
## Signature
|
|
1660
|
+
|
|
1661
|
+
```typescript
|
|
1662
|
+
function setState_AlignMode(alignMode: EPCB_PrimitiveStringAlignMode): IPCB_PrimitiveAttribute;
|
|
1663
|
+
```
|
|
1664
|
+
|
|
1665
|
+
## Parameters
|
|
1666
|
+
|
|
1667
|
+
<table><thead><tr><th>
|
|
1668
|
+
|
|
1669
|
+
Parameter
|
|
1670
|
+
|
|
1671
|
+
</th><th>
|
|
1672
|
+
|
|
1673
|
+
Type
|
|
1674
|
+
|
|
1675
|
+
</th><th>
|
|
1676
|
+
|
|
1677
|
+
Description
|
|
1678
|
+
|
|
1679
|
+
</th></tr></thead>
|
|
1680
|
+
<tbody><tr><td>
|
|
1681
|
+
|
|
1682
|
+
alignMode
|
|
1683
|
+
|
|
1684
|
+
</td><td>
|
|
1685
|
+
|
|
1686
|
+
[EPCB\_PrimitiveStringAlignMode](../enums/EPCB_PrimitiveStringAlignMode.md)
|
|
1687
|
+
|
|
1688
|
+
</td><td>
|
|
1689
|
+
|
|
1690
|
+
Alignment mode
|
|
1691
|
+
|
|
1692
|
+
</td></tr>
|
|
1693
|
+
</tbody></table>
|
|
1694
|
+
|
|
1695
|
+
## Returns
|
|
1696
|
+
|
|
1697
|
+
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
|
|
1698
|
+
|
|
1699
|
+
Attribute primitive object
|
|
1700
|
+
|
|
1701
|
+
## Example
|
|
1702
|
+
|
|
1703
|
+
```javascript
|
|
1704
|
+
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
|
|
1705
|
+
const x = 20000 + Math.floor(Math.random() * 80000);
|
|
1706
|
+
const y = 20000 + Math.floor(Math.random() * 80000);
|
|
1707
|
+
|
|
1708
|
+
// 2. 放置测试器件并取出 Designator(编号)属性
|
|
1709
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
1710
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
|
|
1711
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
|
|
1712
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
1713
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
1714
|
+
|
|
1715
|
+
// 3. 读取修改前的对齐模式
|
|
1716
|
+
const before = designator.getState_AlignMode();
|
|
1717
|
+
|
|
1718
|
+
// 4. 切换异步模式改为居中对齐并提交
|
|
1719
|
+
const asyncAttr = designator.toAsync();
|
|
1720
|
+
asyncAttr.setState_AlignMode(5);
|
|
1721
|
+
await asyncAttr.done();
|
|
1722
|
+
|
|
1723
|
+
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
|
|
1724
|
+
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
|
|
1725
|
+
|
|
1726
|
+
console.log('alignMode:', before, '→', refetched.getState_AlignMode());
|
|
1727
|
+
```
|
|
1728
|
+
|
|
1729
|
+
### setstate_expansion
|
|
1730
|
+
|
|
1731
|
+
# IPCB\_PrimitiveAttribute.setState\_Expansion() method
|
|
1732
|
+
|
|
1733
|
+
> 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.
|
|
1734
|
+
|
|
1735
|
+
Set the property state: inverted expansion
|
|
1736
|
+
|
|
1737
|
+
## Signature
|
|
1738
|
+
|
|
1739
|
+
```typescript
|
|
1740
|
+
function setState_Expansion(expansion: number): IPCB_PrimitiveAttribute;
|
|
1741
|
+
```
|
|
1742
|
+
|
|
1743
|
+
## Parameters
|
|
1744
|
+
|
|
1745
|
+
<table><thead><tr><th>
|
|
1746
|
+
|
|
1747
|
+
Parameter
|
|
1748
|
+
|
|
1749
|
+
</th><th>
|
|
1750
|
+
|
|
1751
|
+
Type
|
|
1752
|
+
|
|
1753
|
+
</th><th>
|
|
1754
|
+
|
|
1755
|
+
Description
|
|
1756
|
+
|
|
1757
|
+
</th></tr></thead>
|
|
1758
|
+
<tbody><tr><td>
|
|
1759
|
+
|
|
1760
|
+
expansion
|
|
1761
|
+
|
|
1762
|
+
</td><td>
|
|
1763
|
+
|
|
1764
|
+
number
|
|
1765
|
+
|
|
1766
|
+
</td><td>
|
|
1767
|
+
|
|
1768
|
+
Inverted expansion
|
|
1769
|
+
|
|
1770
|
+
</td></tr>
|
|
1771
|
+
</tbody></table>
|
|
1772
|
+
|
|
1773
|
+
## Returns
|
|
1774
|
+
|
|
1775
|
+
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
|
|
1776
|
+
|
|
1777
|
+
Attribute primitive object
|
|
1778
|
+
|
|
1779
|
+
## Example
|
|
1780
|
+
|
|
1781
|
+
```javascript
|
|
1782
|
+
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
|
|
1783
|
+
const x = 20000 + Math.floor(Math.random() * 80000);
|
|
1784
|
+
const y = 20000 + Math.floor(Math.random() * 80000);
|
|
1785
|
+
|
|
1786
|
+
// 2. 放置测试器件并取出 Designator(编号)属性
|
|
1787
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
1788
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
|
|
1789
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
|
|
1790
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
1791
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
1792
|
+
|
|
1793
|
+
// 3. 读取修改前的反相扩展
|
|
1794
|
+
const before = designator.getState_Expansion();
|
|
1795
|
+
|
|
1796
|
+
// 4. 切换异步模式加大衬底扩展并提交
|
|
1797
|
+
const asyncAttr = designator.toAsync();
|
|
1798
|
+
asyncAttr.setState_Expansion(8);
|
|
1799
|
+
await asyncAttr.done();
|
|
1800
|
+
|
|
1801
|
+
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
|
|
1802
|
+
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
|
|
1803
|
+
|
|
1804
|
+
console.log('expansion:', before, '→', refetched.getState_Expansion());
|
|
1805
|
+
```
|
|
1806
|
+
|
|
1807
|
+
### setstate_fontfamily
|
|
1808
|
+
|
|
1809
|
+
# IPCB\_PrimitiveAttribute.setState\_FontFamily() method
|
|
1810
|
+
|
|
1811
|
+
> 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.
|
|
1812
|
+
|
|
1813
|
+
Set the property state: font
|
|
1814
|
+
|
|
1815
|
+
## Signature
|
|
1816
|
+
|
|
1817
|
+
```typescript
|
|
1818
|
+
function setState_FontFamily(fontFamily: string): IPCB_PrimitiveAttribute;
|
|
1819
|
+
```
|
|
1820
|
+
|
|
1821
|
+
## Parameters
|
|
1822
|
+
|
|
1823
|
+
<table><thead><tr><th>
|
|
1824
|
+
|
|
1825
|
+
Parameter
|
|
1826
|
+
|
|
1827
|
+
</th><th>
|
|
1828
|
+
|
|
1829
|
+
Type
|
|
1830
|
+
|
|
1831
|
+
</th><th>
|
|
1832
|
+
|
|
1833
|
+
Description
|
|
1834
|
+
|
|
1835
|
+
</th></tr></thead>
|
|
1836
|
+
<tbody><tr><td>
|
|
1837
|
+
|
|
1838
|
+
fontFamily
|
|
1839
|
+
|
|
1840
|
+
</td><td>
|
|
1841
|
+
|
|
1842
|
+
string
|
|
1843
|
+
|
|
1844
|
+
</td><td>
|
|
1845
|
+
|
|
1846
|
+
Font
|
|
1847
|
+
|
|
1848
|
+
</td></tr>
|
|
1849
|
+
</tbody></table>
|
|
1850
|
+
|
|
1851
|
+
## Returns
|
|
1852
|
+
|
|
1853
|
+
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
|
|
1854
|
+
|
|
1855
|
+
Attribute primitive object
|
|
1856
|
+
|
|
1857
|
+
## Example
|
|
1858
|
+
|
|
1859
|
+
```javascript
|
|
1860
|
+
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
|
|
1861
|
+
const x = 20000 + Math.floor(Math.random() * 80000);
|
|
1862
|
+
const y = 20000 + Math.floor(Math.random() * 80000);
|
|
1863
|
+
|
|
1864
|
+
// 2. 放置测试器件并取出 Designator(编号)属性
|
|
1865
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
1866
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
|
|
1867
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
|
|
1868
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
1869
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
1870
|
+
|
|
1871
|
+
// 3. 读取修改前的字体
|
|
1872
|
+
const before = designator.getState_FontFamily();
|
|
1873
|
+
|
|
1874
|
+
// 4. 切换异步模式换成 Arial 并提交
|
|
1875
|
+
const asyncAttr = designator.toAsync();
|
|
1876
|
+
asyncAttr.setState_FontFamily('Arial');
|
|
1877
|
+
await asyncAttr.done();
|
|
1878
|
+
|
|
1879
|
+
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
|
|
1880
|
+
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
|
|
1881
|
+
|
|
1882
|
+
console.log('fontFamily:', before, '→', refetched.getState_FontFamily());
|
|
1883
|
+
```
|
|
1884
|
+
|
|
1885
|
+
### setstate_fontsize
|
|
1886
|
+
|
|
1887
|
+
# IPCB\_PrimitiveAttribute.setState\_FontSize() method
|
|
1888
|
+
|
|
1889
|
+
> 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.
|
|
1890
|
+
|
|
1891
|
+
Set the property state: font size
|
|
1892
|
+
|
|
1893
|
+
## Signature
|
|
1894
|
+
|
|
1895
|
+
```typescript
|
|
1896
|
+
function setState_FontSize(fontSize: number): IPCB_PrimitiveAttribute;
|
|
1897
|
+
```
|
|
1898
|
+
|
|
1899
|
+
## Parameters
|
|
1900
|
+
|
|
1901
|
+
<table><thead><tr><th>
|
|
1902
|
+
|
|
1903
|
+
Parameter
|
|
1904
|
+
|
|
1905
|
+
</th><th>
|
|
1906
|
+
|
|
1907
|
+
Type
|
|
1908
|
+
|
|
1909
|
+
</th><th>
|
|
1910
|
+
|
|
1911
|
+
Description
|
|
1912
|
+
|
|
1913
|
+
</th></tr></thead>
|
|
1914
|
+
<tbody><tr><td>
|
|
1915
|
+
|
|
1916
|
+
fontSize
|
|
1917
|
+
|
|
1918
|
+
</td><td>
|
|
1919
|
+
|
|
1920
|
+
number
|
|
1921
|
+
|
|
1922
|
+
</td><td>
|
|
1923
|
+
|
|
1924
|
+
Font size
|
|
1925
|
+
|
|
1926
|
+
</td></tr>
|
|
1927
|
+
</tbody></table>
|
|
1928
|
+
|
|
1929
|
+
## Returns
|
|
1930
|
+
|
|
1931
|
+
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
|
|
1932
|
+
|
|
1933
|
+
Attribute primitive object
|
|
1934
|
+
|
|
1935
|
+
## Example
|
|
1936
|
+
|
|
1937
|
+
```javascript
|
|
1938
|
+
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
|
|
1939
|
+
const x = 20000 + Math.floor(Math.random() * 80000);
|
|
1940
|
+
const y = 20000 + Math.floor(Math.random() * 80000);
|
|
1941
|
+
|
|
1942
|
+
// 2. 放置测试器件并取出 Designator(编号)属性
|
|
1943
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
1944
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
|
|
1945
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
|
|
1946
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
1947
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
1948
|
+
|
|
1949
|
+
// 3. 读取修改前的字号
|
|
1950
|
+
const before = designator.getState_FontSize();
|
|
1951
|
+
|
|
1952
|
+
// 4. 切换异步模式加大字号并提交
|
|
1953
|
+
const asyncAttr = designator.toAsync();
|
|
1954
|
+
asyncAttr.setState_FontSize(60);
|
|
1955
|
+
await asyncAttr.done();
|
|
1956
|
+
|
|
1957
|
+
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
|
|
1958
|
+
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
|
|
1959
|
+
|
|
1960
|
+
console.log('fontSize:', before, '→', refetched.getState_FontSize());
|
|
1961
|
+
```
|
|
1962
|
+
|
|
1963
|
+
### setstate_key
|
|
1964
|
+
|
|
1965
|
+
# IPCB\_PrimitiveAttribute.setState\_Key() method
|
|
1966
|
+
|
|
1967
|
+
> 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.
|
|
1968
|
+
|
|
1969
|
+
Set the property state: Key
|
|
1970
|
+
|
|
1971
|
+
## Signature
|
|
1972
|
+
|
|
1973
|
+
```typescript
|
|
1974
|
+
function setState_Key(key: string): IPCB_PrimitiveAttribute;
|
|
1975
|
+
```
|
|
1976
|
+
|
|
1977
|
+
## Parameters
|
|
1978
|
+
|
|
1979
|
+
<table><thead><tr><th>
|
|
1980
|
+
|
|
1981
|
+
Parameter
|
|
1982
|
+
|
|
1983
|
+
</th><th>
|
|
1984
|
+
|
|
1985
|
+
Type
|
|
1986
|
+
|
|
1987
|
+
</th><th>
|
|
1988
|
+
|
|
1989
|
+
Description
|
|
1990
|
+
|
|
1991
|
+
</th></tr></thead>
|
|
1992
|
+
<tbody><tr><td>
|
|
1993
|
+
|
|
1994
|
+
key
|
|
1995
|
+
|
|
1996
|
+
</td><td>
|
|
1997
|
+
|
|
1998
|
+
string
|
|
1999
|
+
|
|
2000
|
+
</td><td>
|
|
2001
|
+
|
|
2002
|
+
Key
|
|
2003
|
+
|
|
2004
|
+
</td></tr>
|
|
2005
|
+
</tbody></table>
|
|
2006
|
+
|
|
2007
|
+
## Returns
|
|
2008
|
+
|
|
2009
|
+
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
|
|
2010
|
+
|
|
2011
|
+
Attribute primitive object
|
|
2012
|
+
|
|
2013
|
+
## Example
|
|
2014
|
+
|
|
2015
|
+
```javascript
|
|
2016
|
+
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
|
|
2017
|
+
const x = 20000 + Math.floor(Math.random() * 80000);
|
|
2018
|
+
const y = 20000 + Math.floor(Math.random() * 80000);
|
|
2019
|
+
|
|
2020
|
+
// 2. 放置测试器件并取出 Designator(编号)属性
|
|
2021
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
2022
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
|
|
2023
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
|
|
2024
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
2025
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
2026
|
+
|
|
2027
|
+
// 3. 读取修改前的属性名
|
|
2028
|
+
const before = designator.getState_Key();
|
|
2029
|
+
|
|
2030
|
+
// 4. 切换异步模式重命名属性并提交
|
|
2031
|
+
const asyncAttr = designator.toAsync();
|
|
2032
|
+
asyncAttr.setState_Key('Ref');
|
|
2033
|
+
await asyncAttr.done();
|
|
2034
|
+
|
|
2035
|
+
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
|
|
2036
|
+
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
|
|
2037
|
+
|
|
2038
|
+
console.log('key:', before, '→', refetched.getState_Key());
|
|
2039
|
+
```
|
|
2040
|
+
|
|
2041
|
+
### setstate_keyvisible
|
|
2042
|
+
|
|
2043
|
+
# IPCB\_PrimitiveAttribute.setState\_KeyVisible() method
|
|
2044
|
+
|
|
2045
|
+
> 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.
|
|
2046
|
+
|
|
2047
|
+
Set the property state: Key whether it is visible
|
|
2048
|
+
|
|
2049
|
+
## Signature
|
|
2050
|
+
|
|
2051
|
+
```typescript
|
|
2052
|
+
function setState_KeyVisible(keyVisible: boolean): IPCB_PrimitiveAttribute;
|
|
2053
|
+
```
|
|
2054
|
+
|
|
2055
|
+
## Parameters
|
|
2056
|
+
|
|
2057
|
+
<table><thead><tr><th>
|
|
2058
|
+
|
|
2059
|
+
Parameter
|
|
2060
|
+
|
|
2061
|
+
</th><th>
|
|
2062
|
+
|
|
2063
|
+
Type
|
|
2064
|
+
|
|
2065
|
+
</th><th>
|
|
2066
|
+
|
|
2067
|
+
Description
|
|
2068
|
+
|
|
2069
|
+
</th></tr></thead>
|
|
2070
|
+
<tbody><tr><td>
|
|
2071
|
+
|
|
2072
|
+
keyVisible
|
|
2073
|
+
|
|
2074
|
+
</td><td>
|
|
2075
|
+
|
|
2076
|
+
boolean
|
|
2077
|
+
|
|
2078
|
+
</td><td>
|
|
2079
|
+
|
|
2080
|
+
Key whether it is visible
|
|
2081
|
+
|
|
2082
|
+
</td></tr>
|
|
2083
|
+
</tbody></table>
|
|
2084
|
+
|
|
2085
|
+
## Returns
|
|
2086
|
+
|
|
2087
|
+
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
|
|
2088
|
+
|
|
2089
|
+
Attribute primitive object
|
|
2090
|
+
|
|
2091
|
+
## Example
|
|
2092
|
+
|
|
2093
|
+
```javascript
|
|
2094
|
+
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
|
|
2095
|
+
const x = 20000 + Math.floor(Math.random() * 80000);
|
|
2096
|
+
const y = 20000 + Math.floor(Math.random() * 80000);
|
|
2097
|
+
|
|
2098
|
+
// 2. 放置测试器件并取出 Designator(编号)属性
|
|
2099
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
2100
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
|
|
2101
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
|
|
2102
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
2103
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
2104
|
+
|
|
2105
|
+
// 3. 读取修改前的 Key 可见性
|
|
2106
|
+
const before = designator.getState_KeyVisible();
|
|
2107
|
+
|
|
2108
|
+
// 4. 切换异步模式打开 Key 显示并提交
|
|
2109
|
+
const asyncAttr = designator.toAsync();
|
|
2110
|
+
asyncAttr.setState_KeyVisible(true);
|
|
2111
|
+
await asyncAttr.done();
|
|
2112
|
+
|
|
2113
|
+
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
|
|
2114
|
+
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
|
|
2115
|
+
|
|
2116
|
+
console.log('keyVisible:', before, '→', refetched.getState_KeyVisible());
|
|
2117
|
+
```
|
|
2118
|
+
|
|
2119
|
+
### setstate_layer
|
|
2120
|
+
|
|
2121
|
+
# IPCB\_PrimitiveAttribute.setState\_Layer() method
|
|
2122
|
+
|
|
2123
|
+
> 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.
|
|
2124
|
+
|
|
2125
|
+
Set the property state: Layer
|
|
2126
|
+
|
|
2127
|
+
## Signature
|
|
2128
|
+
|
|
2129
|
+
```typescript
|
|
2130
|
+
function setState_Layer(layer: TPCB_LayersOfImage): IPCB_PrimitiveAttribute;
|
|
2131
|
+
```
|
|
2132
|
+
|
|
2133
|
+
## Parameters
|
|
2134
|
+
|
|
2135
|
+
<table><thead><tr><th>
|
|
2136
|
+
|
|
2137
|
+
Parameter
|
|
2138
|
+
|
|
2139
|
+
</th><th>
|
|
2140
|
+
|
|
2141
|
+
Type
|
|
2142
|
+
|
|
2143
|
+
</th><th>
|
|
2144
|
+
|
|
2145
|
+
Description
|
|
2146
|
+
|
|
2147
|
+
</th></tr></thead>
|
|
2148
|
+
<tbody><tr><td>
|
|
2149
|
+
|
|
2150
|
+
layer
|
|
2151
|
+
|
|
2152
|
+
</td><td>
|
|
2153
|
+
|
|
2154
|
+
[TPCB\_LayersOfImage](../types/TPCB_LayersOfImage.md)
|
|
2155
|
+
|
|
2156
|
+
</td><td>
|
|
2157
|
+
|
|
2158
|
+
Layer
|
|
2159
|
+
|
|
2160
|
+
</td></tr>
|
|
2161
|
+
</tbody></table>
|
|
2162
|
+
|
|
2163
|
+
## Returns
|
|
2164
|
+
|
|
2165
|
+
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
|
|
2166
|
+
|
|
2167
|
+
Attribute primitive object
|
|
2168
|
+
|
|
2169
|
+
## Example
|
|
2170
|
+
|
|
2171
|
+
```javascript
|
|
2172
|
+
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
|
|
2173
|
+
const x = 20000 + Math.floor(Math.random() * 80000);
|
|
2174
|
+
const y = 20000 + Math.floor(Math.random() * 80000);
|
|
2175
|
+
|
|
2176
|
+
// 2. 放置测试器件并取出 Designator(编号)属性
|
|
2177
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
2178
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
|
|
2179
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
|
|
2180
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
2181
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
2182
|
+
|
|
2183
|
+
// 3. 读取修改前的层
|
|
2184
|
+
const before = designator.getState_Layer();
|
|
2185
|
+
|
|
2186
|
+
// 4. 切换异步模式挪到底层丝印(4)并提交
|
|
2187
|
+
const asyncAttr = designator.toAsync();
|
|
2188
|
+
asyncAttr.setState_Layer(4);
|
|
2189
|
+
await asyncAttr.done();
|
|
2190
|
+
|
|
2191
|
+
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
|
|
2192
|
+
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
|
|
2193
|
+
|
|
2194
|
+
console.log('layer:', before, '→', refetched.getState_Layer());
|
|
2195
|
+
```
|
|
2196
|
+
|
|
2197
|
+
### setstate_linewidth
|
|
2198
|
+
|
|
2199
|
+
# IPCB\_PrimitiveAttribute.setState\_LineWidth() method
|
|
2200
|
+
|
|
2201
|
+
> 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.
|
|
2202
|
+
|
|
2203
|
+
Set the property state: Line width
|
|
2204
|
+
|
|
2205
|
+
## Signature
|
|
2206
|
+
|
|
2207
|
+
```typescript
|
|
2208
|
+
function setState_LineWidth(lineWidth: number): IPCB_PrimitiveAttribute;
|
|
2209
|
+
```
|
|
2210
|
+
|
|
2211
|
+
## Parameters
|
|
2212
|
+
|
|
2213
|
+
<table><thead><tr><th>
|
|
2214
|
+
|
|
2215
|
+
Parameter
|
|
2216
|
+
|
|
2217
|
+
</th><th>
|
|
2218
|
+
|
|
2219
|
+
Type
|
|
2220
|
+
|
|
2221
|
+
</th><th>
|
|
2222
|
+
|
|
2223
|
+
Description
|
|
2224
|
+
|
|
2225
|
+
</th></tr></thead>
|
|
2226
|
+
<tbody><tr><td>
|
|
2227
|
+
|
|
2228
|
+
lineWidth
|
|
2229
|
+
|
|
2230
|
+
</td><td>
|
|
2231
|
+
|
|
2232
|
+
number
|
|
2233
|
+
|
|
2234
|
+
</td><td>
|
|
2235
|
+
|
|
2236
|
+
Line width
|
|
2237
|
+
|
|
2238
|
+
</td></tr>
|
|
2239
|
+
</tbody></table>
|
|
2240
|
+
|
|
2241
|
+
## Returns
|
|
2242
|
+
|
|
2243
|
+
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
|
|
2244
|
+
|
|
2245
|
+
Attribute primitive object
|
|
2246
|
+
|
|
2247
|
+
## Example
|
|
2248
|
+
|
|
2249
|
+
```javascript
|
|
2250
|
+
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
|
|
2251
|
+
const x = 20000 + Math.floor(Math.random() * 80000);
|
|
2252
|
+
const y = 20000 + Math.floor(Math.random() * 80000);
|
|
2253
|
+
|
|
2254
|
+
// 2. 放置测试器件并取出 Designator(编号)属性
|
|
2255
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
2256
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
|
|
2257
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
|
|
2258
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
2259
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
2260
|
+
|
|
2261
|
+
// 3. 读取修改前的线宽
|
|
2262
|
+
const before = designator.getState_LineWidth();
|
|
2263
|
+
|
|
2264
|
+
// 4. 切换异步模式加粗笔画并提交
|
|
2265
|
+
const asyncAttr = designator.toAsync();
|
|
2266
|
+
asyncAttr.setState_LineWidth(10);
|
|
2267
|
+
await asyncAttr.done();
|
|
2268
|
+
|
|
2269
|
+
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
|
|
2270
|
+
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
|
|
2271
|
+
|
|
2272
|
+
console.log('lineWidth:', before, '→', refetched.getState_LineWidth());
|
|
2273
|
+
```
|
|
2274
|
+
|
|
2275
|
+
### setstate_mirror
|
|
2276
|
+
|
|
2277
|
+
# IPCB\_PrimitiveAttribute.setState\_Mirror() method
|
|
2278
|
+
|
|
2279
|
+
> 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.
|
|
2280
|
+
|
|
2281
|
+
Set the property state: whether it is mirrored
|
|
2282
|
+
|
|
2283
|
+
## Signature
|
|
2284
|
+
|
|
2285
|
+
```typescript
|
|
2286
|
+
function setState_Mirror(mirror: boolean): IPCB_PrimitiveAttribute;
|
|
2287
|
+
```
|
|
2288
|
+
|
|
2289
|
+
## Parameters
|
|
2290
|
+
|
|
2291
|
+
<table><thead><tr><th>
|
|
2292
|
+
|
|
2293
|
+
Parameter
|
|
2294
|
+
|
|
2295
|
+
</th><th>
|
|
2296
|
+
|
|
2297
|
+
Type
|
|
2298
|
+
|
|
2299
|
+
</th><th>
|
|
2300
|
+
|
|
2301
|
+
Description
|
|
2302
|
+
|
|
2303
|
+
</th></tr></thead>
|
|
2304
|
+
<tbody><tr><td>
|
|
2305
|
+
|
|
2306
|
+
mirror
|
|
2307
|
+
|
|
2308
|
+
</td><td>
|
|
2309
|
+
|
|
2310
|
+
boolean
|
|
2311
|
+
|
|
2312
|
+
</td><td>
|
|
2313
|
+
|
|
2314
|
+
Whether it is mirrored
|
|
2315
|
+
|
|
2316
|
+
</td></tr>
|
|
2317
|
+
</tbody></table>
|
|
2318
|
+
|
|
2319
|
+
## Returns
|
|
2320
|
+
|
|
2321
|
+
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
|
|
2322
|
+
|
|
2323
|
+
Attribute primitive object
|
|
2324
|
+
|
|
2325
|
+
## Example
|
|
2326
|
+
|
|
2327
|
+
```javascript
|
|
2328
|
+
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
|
|
2329
|
+
const x = 20000 + Math.floor(Math.random() * 80000);
|
|
2330
|
+
const y = 20000 + Math.floor(Math.random() * 80000);
|
|
2331
|
+
|
|
2332
|
+
// 2. 放置测试器件并取出 Designator(编号)属性
|
|
2333
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
2334
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
|
|
2335
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
|
|
2336
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
2337
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
2338
|
+
|
|
2339
|
+
// 3. 读取修改前的镜像状态
|
|
2340
|
+
const before = designator.getState_Mirror();
|
|
2341
|
+
|
|
2342
|
+
// 4. 切换异步模式打开镜像并提交
|
|
2343
|
+
const asyncAttr = designator.toAsync();
|
|
2344
|
+
asyncAttr.setState_Mirror(true);
|
|
2345
|
+
await asyncAttr.done();
|
|
2346
|
+
|
|
2347
|
+
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
|
|
2348
|
+
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
|
|
2349
|
+
|
|
2350
|
+
console.log('mirror:', before, '→', refetched.getState_Mirror());
|
|
2351
|
+
```
|
|
2352
|
+
|
|
2353
|
+
### setstate_primitivelock
|
|
2354
|
+
|
|
2355
|
+
# IPCB\_PrimitiveAttribute.setState\_PrimitiveLock() method
|
|
2356
|
+
|
|
2357
|
+
> 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.
|
|
2358
|
+
|
|
2359
|
+
Set the property state: whether it is locked
|
|
2360
|
+
|
|
2361
|
+
## Signature
|
|
2362
|
+
|
|
2363
|
+
```typescript
|
|
2364
|
+
function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitiveAttribute;
|
|
2365
|
+
```
|
|
2366
|
+
|
|
2367
|
+
## Parameters
|
|
2368
|
+
|
|
2369
|
+
<table><thead><tr><th>
|
|
2370
|
+
|
|
2371
|
+
Parameter
|
|
2372
|
+
|
|
2373
|
+
</th><th>
|
|
2374
|
+
|
|
2375
|
+
Type
|
|
2376
|
+
|
|
2377
|
+
</th><th>
|
|
2378
|
+
|
|
2379
|
+
Description
|
|
2380
|
+
|
|
2381
|
+
</th></tr></thead>
|
|
2382
|
+
<tbody><tr><td>
|
|
2383
|
+
|
|
2384
|
+
primitiveLock
|
|
2385
|
+
|
|
2386
|
+
</td><td>
|
|
2387
|
+
|
|
2388
|
+
boolean
|
|
2389
|
+
|
|
2390
|
+
</td><td>
|
|
2391
|
+
|
|
2392
|
+
Whether it is locked
|
|
2393
|
+
|
|
2394
|
+
</td></tr>
|
|
2395
|
+
</tbody></table>
|
|
2396
|
+
|
|
2397
|
+
## Returns
|
|
2398
|
+
|
|
2399
|
+
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
|
|
2400
|
+
|
|
2401
|
+
Attribute primitive object
|
|
2402
|
+
|
|
2403
|
+
## Example
|
|
2404
|
+
|
|
2405
|
+
```javascript
|
|
2406
|
+
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
|
|
2407
|
+
const x = 20000 + Math.floor(Math.random() * 80000);
|
|
2408
|
+
const y = 20000 + Math.floor(Math.random() * 80000);
|
|
2409
|
+
|
|
2410
|
+
// 2. 放置测试器件并取出 Designator(编号)属性
|
|
2411
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
2412
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
|
|
2413
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
|
|
2414
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
2415
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
2416
|
+
|
|
2417
|
+
// 3. 读取修改前的锁定状态
|
|
2418
|
+
const before = designator.getState_PrimitiveLock();
|
|
2419
|
+
|
|
2420
|
+
// 4. 切换异步模式锁定属性并提交
|
|
2421
|
+
const asyncAttr = designator.toAsync();
|
|
2422
|
+
asyncAttr.setState_PrimitiveLock(true);
|
|
2423
|
+
await asyncAttr.done();
|
|
2424
|
+
|
|
2425
|
+
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
|
|
2426
|
+
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
|
|
2427
|
+
|
|
2428
|
+
console.log('primitiveLock:', before, '→', refetched.getState_PrimitiveLock());
|
|
2429
|
+
```
|
|
2430
|
+
|
|
2431
|
+
### setstate_reverse
|
|
2432
|
+
|
|
2433
|
+
# IPCB\_PrimitiveAttribute.setState\_Reverse() method
|
|
2434
|
+
|
|
2435
|
+
> 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.
|
|
2436
|
+
|
|
2437
|
+
Set the property state: whether it is inverted
|
|
2438
|
+
|
|
2439
|
+
## Signature
|
|
2440
|
+
|
|
2441
|
+
```typescript
|
|
2442
|
+
function setState_Reverse(reverse: boolean): IPCB_PrimitiveAttribute;
|
|
2443
|
+
```
|
|
2444
|
+
|
|
2445
|
+
## Parameters
|
|
2446
|
+
|
|
2447
|
+
<table><thead><tr><th>
|
|
2448
|
+
|
|
2449
|
+
Parameter
|
|
2450
|
+
|
|
2451
|
+
</th><th>
|
|
2452
|
+
|
|
2453
|
+
Type
|
|
2454
|
+
|
|
2455
|
+
</th><th>
|
|
2456
|
+
|
|
2457
|
+
Description
|
|
2458
|
+
|
|
2459
|
+
</th></tr></thead>
|
|
2460
|
+
<tbody><tr><td>
|
|
2461
|
+
|
|
2462
|
+
reverse
|
|
2463
|
+
|
|
2464
|
+
</td><td>
|
|
2465
|
+
|
|
2466
|
+
boolean
|
|
2467
|
+
|
|
2468
|
+
</td><td>
|
|
2469
|
+
|
|
2470
|
+
Whether it is inverted
|
|
2471
|
+
|
|
2472
|
+
</td></tr>
|
|
2473
|
+
</tbody></table>
|
|
2474
|
+
|
|
2475
|
+
## Returns
|
|
2476
|
+
|
|
2477
|
+
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
|
|
2478
|
+
|
|
2479
|
+
Attribute primitive object
|
|
2480
|
+
|
|
2481
|
+
## Remarks
|
|
2482
|
+
|
|
2483
|
+
The default font does not support inversion
|
|
2484
|
+
|
|
2485
|
+
## Example
|
|
2486
|
+
|
|
2487
|
+
```javascript
|
|
2488
|
+
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
|
|
2489
|
+
const x = 20000 + Math.floor(Math.random() * 80000);
|
|
2490
|
+
const y = 20000 + Math.floor(Math.random() * 80000);
|
|
2491
|
+
|
|
2492
|
+
// 2. 放置测试器件并取出 Designator(编号)属性
|
|
2493
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
2494
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
|
|
2495
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
|
|
2496
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
2497
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
2498
|
+
|
|
2499
|
+
// 3. 读取修改前的反相状态
|
|
2500
|
+
const before = designator.getState_Reverse();
|
|
2501
|
+
|
|
2502
|
+
// 4. 切换异步模式:先换 Arial 字体(default 不支持反相),再开反相并提交
|
|
2503
|
+
const asyncAttr = designator.toAsync();
|
|
2504
|
+
asyncAttr.setState_FontFamily('Arial');
|
|
2505
|
+
asyncAttr.setState_Reverse(true);
|
|
2506
|
+
await asyncAttr.done();
|
|
2507
|
+
|
|
2508
|
+
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
|
|
2509
|
+
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
|
|
2510
|
+
|
|
2511
|
+
console.log('reverse:', before, '→', refetched.getState_Reverse());
|
|
2512
|
+
```
|
|
2513
|
+
|
|
2514
|
+
### setstate_rotation
|
|
2515
|
+
|
|
2516
|
+
# IPCB\_PrimitiveAttribute.setState\_Rotation() method
|
|
2517
|
+
|
|
2518
|
+
> 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.
|
|
2519
|
+
|
|
2520
|
+
Set the property state: rotation angle
|
|
2521
|
+
|
|
2522
|
+
## Signature
|
|
2523
|
+
|
|
2524
|
+
```typescript
|
|
2525
|
+
function setState_Rotation(rotation: number): IPCB_PrimitiveAttribute;
|
|
2526
|
+
```
|
|
2527
|
+
|
|
2528
|
+
## Parameters
|
|
2529
|
+
|
|
2530
|
+
<table><thead><tr><th>
|
|
2531
|
+
|
|
2532
|
+
Parameter
|
|
2533
|
+
|
|
2534
|
+
</th><th>
|
|
2535
|
+
|
|
2536
|
+
Type
|
|
2537
|
+
|
|
2538
|
+
</th><th>
|
|
2539
|
+
|
|
2540
|
+
Description
|
|
2541
|
+
|
|
2542
|
+
</th></tr></thead>
|
|
2543
|
+
<tbody><tr><td>
|
|
2544
|
+
|
|
2545
|
+
rotation
|
|
2546
|
+
|
|
2547
|
+
</td><td>
|
|
2548
|
+
|
|
2549
|
+
number
|
|
2550
|
+
|
|
2551
|
+
</td><td>
|
|
2552
|
+
|
|
2553
|
+
Rotation angle
|
|
2554
|
+
|
|
2555
|
+
</td></tr>
|
|
2556
|
+
</tbody></table>
|
|
2557
|
+
|
|
2558
|
+
## Returns
|
|
2559
|
+
|
|
2560
|
+
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
|
|
2561
|
+
|
|
2562
|
+
Attribute primitive object
|
|
2563
|
+
|
|
2564
|
+
## Example
|
|
2565
|
+
|
|
2566
|
+
```javascript
|
|
2567
|
+
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
|
|
2568
|
+
const x = 20000 + Math.floor(Math.random() * 80000);
|
|
2569
|
+
const y = 20000 + Math.floor(Math.random() * 80000);
|
|
2570
|
+
|
|
2571
|
+
// 2. 放置测试器件并取出 Designator(编号)属性
|
|
2572
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
2573
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
|
|
2574
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
|
|
2575
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
2576
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
2577
|
+
|
|
2578
|
+
// 3. 读取修改前的旋转角度
|
|
2579
|
+
const before = designator.getState_Rotation();
|
|
2580
|
+
|
|
2581
|
+
// 4. 切换异步模式旋转 90° 并提交
|
|
2582
|
+
const asyncAttr = designator.toAsync();
|
|
2583
|
+
asyncAttr.setState_Rotation(90);
|
|
2584
|
+
await asyncAttr.done();
|
|
2585
|
+
|
|
2586
|
+
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
|
|
2587
|
+
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
|
|
2588
|
+
|
|
2589
|
+
console.log('rotation:', before, '→', refetched.getState_Rotation());
|
|
2590
|
+
```
|
|
2591
|
+
|
|
2592
|
+
### setstate_value
|
|
2593
|
+
|
|
2594
|
+
# IPCB\_PrimitiveAttribute.setState\_Value() method
|
|
2595
|
+
|
|
2596
|
+
> 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.
|
|
2597
|
+
|
|
2598
|
+
Set the property state: Value
|
|
2599
|
+
|
|
2600
|
+
## Signature
|
|
2601
|
+
|
|
2602
|
+
```typescript
|
|
2603
|
+
function setState_Value(value: string): IPCB_PrimitiveAttribute;
|
|
2604
|
+
```
|
|
2605
|
+
|
|
2606
|
+
## Parameters
|
|
2607
|
+
|
|
2608
|
+
<table><thead><tr><th>
|
|
2609
|
+
|
|
2610
|
+
Parameter
|
|
2611
|
+
|
|
2612
|
+
</th><th>
|
|
2613
|
+
|
|
2614
|
+
Type
|
|
2615
|
+
|
|
2616
|
+
</th><th>
|
|
2617
|
+
|
|
2618
|
+
Description
|
|
2619
|
+
|
|
2620
|
+
</th></tr></thead>
|
|
2621
|
+
<tbody><tr><td>
|
|
2622
|
+
|
|
2623
|
+
value
|
|
2624
|
+
|
|
2625
|
+
</td><td>
|
|
2626
|
+
|
|
2627
|
+
string
|
|
2628
|
+
|
|
2629
|
+
</td><td>
|
|
2630
|
+
|
|
2631
|
+
Value
|
|
2632
|
+
|
|
2633
|
+
</td></tr>
|
|
2634
|
+
</tbody></table>
|
|
2635
|
+
|
|
2636
|
+
## Returns
|
|
2637
|
+
|
|
2638
|
+
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
|
|
2639
|
+
|
|
2640
|
+
Attribute primitive object
|
|
2641
|
+
|
|
2642
|
+
## Example
|
|
2643
|
+
|
|
2644
|
+
```javascript
|
|
2645
|
+
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
|
|
2646
|
+
const x = 20000 + Math.floor(Math.random() * 80000);
|
|
2647
|
+
const y = 20000 + Math.floor(Math.random() * 80000);
|
|
2648
|
+
|
|
2649
|
+
// 2. 放置测试器件并取出 Designator(编号)属性
|
|
2650
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
2651
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
|
|
2652
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
|
|
2653
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
2654
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
2655
|
+
|
|
2656
|
+
// 3. 读取修改前的属性值
|
|
2657
|
+
const before = designator.getState_Value();
|
|
2658
|
+
|
|
2659
|
+
// 4. 切换异步模式修改属性值并提交
|
|
2660
|
+
const asyncAttr = designator.toAsync();
|
|
2661
|
+
asyncAttr.setState_Value(`${before}-MOD`);
|
|
2662
|
+
await asyncAttr.done();
|
|
2663
|
+
|
|
2664
|
+
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
|
|
2665
|
+
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
|
|
2666
|
+
|
|
2667
|
+
console.log('value:', before, '→', refetched.getState_Value());
|
|
2668
|
+
```
|
|
2669
|
+
|
|
2670
|
+
### setstate_valuevisible
|
|
2671
|
+
|
|
2672
|
+
# IPCB\_PrimitiveAttribute.setState\_ValueVisible() method
|
|
2673
|
+
|
|
2674
|
+
> 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.
|
|
2675
|
+
|
|
2676
|
+
Set the property state: Value whether it is visible
|
|
2677
|
+
|
|
2678
|
+
## Signature
|
|
2679
|
+
|
|
2680
|
+
```typescript
|
|
2681
|
+
function setState_ValueVisible(valueVisible: boolean): IPCB_PrimitiveAttribute;
|
|
2682
|
+
```
|
|
2683
|
+
|
|
2684
|
+
## Parameters
|
|
2685
|
+
|
|
2686
|
+
<table><thead><tr><th>
|
|
2687
|
+
|
|
2688
|
+
Parameter
|
|
2689
|
+
|
|
2690
|
+
</th><th>
|
|
2691
|
+
|
|
2692
|
+
Type
|
|
2693
|
+
|
|
2694
|
+
</th><th>
|
|
2695
|
+
|
|
2696
|
+
Description
|
|
2697
|
+
|
|
2698
|
+
</th></tr></thead>
|
|
2699
|
+
<tbody><tr><td>
|
|
2700
|
+
|
|
2701
|
+
valueVisible
|
|
2702
|
+
|
|
2703
|
+
</td><td>
|
|
2704
|
+
|
|
2705
|
+
boolean
|
|
2706
|
+
|
|
2707
|
+
</td><td>
|
|
2708
|
+
|
|
2709
|
+
Value whether it is visible
|
|
2710
|
+
|
|
2711
|
+
</td></tr>
|
|
2712
|
+
</tbody></table>
|
|
2713
|
+
|
|
2714
|
+
## Returns
|
|
2715
|
+
|
|
2716
|
+
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
|
|
2717
|
+
|
|
2718
|
+
Attribute primitive object
|
|
2719
|
+
|
|
2720
|
+
## Example
|
|
2721
|
+
|
|
2722
|
+
```javascript
|
|
2723
|
+
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
|
|
2724
|
+
const x = 20000 + Math.floor(Math.random() * 80000);
|
|
2725
|
+
const y = 20000 + Math.floor(Math.random() * 80000);
|
|
2726
|
+
|
|
2727
|
+
// 2. 放置测试器件并取出 Designator(编号)属性
|
|
2728
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
2729
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
|
|
2730
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
|
|
2731
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
2732
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
2733
|
+
|
|
2734
|
+
// 3. 读取修改前的 Value 可见性
|
|
2735
|
+
const before = designator.getState_ValueVisible();
|
|
2736
|
+
|
|
2737
|
+
// 4. 切换异步模式隐藏编号文本并提交
|
|
2738
|
+
const asyncAttr = designator.toAsync();
|
|
2739
|
+
asyncAttr.setState_ValueVisible(false);
|
|
2740
|
+
await asyncAttr.done();
|
|
2741
|
+
|
|
2742
|
+
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
|
|
2743
|
+
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
|
|
2744
|
+
|
|
2745
|
+
console.log('valueVisible:', before, '→', refetched.getState_ValueVisible());
|
|
2746
|
+
```
|
|
2747
|
+
|
|
2748
|
+
### setstate_x
|
|
2749
|
+
|
|
2750
|
+
# IPCB\_PrimitiveAttribute.setState\_X() method
|
|
2751
|
+
|
|
2752
|
+
> 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.
|
|
2753
|
+
|
|
2754
|
+
Set the property state: X coordinate
|
|
2755
|
+
|
|
2756
|
+
## Signature
|
|
2757
|
+
|
|
2758
|
+
```typescript
|
|
2759
|
+
function setState_X(x: number): IPCB_PrimitiveAttribute;
|
|
2760
|
+
```
|
|
2761
|
+
|
|
2762
|
+
## Parameters
|
|
2763
|
+
|
|
2764
|
+
<table><thead><tr><th>
|
|
2765
|
+
|
|
2766
|
+
Parameter
|
|
2767
|
+
|
|
2768
|
+
</th><th>
|
|
2769
|
+
|
|
2770
|
+
Type
|
|
2771
|
+
|
|
2772
|
+
</th><th>
|
|
2773
|
+
|
|
2774
|
+
Description
|
|
2775
|
+
|
|
2776
|
+
</th></tr></thead>
|
|
2777
|
+
<tbody><tr><td>
|
|
2778
|
+
|
|
2779
|
+
x
|
|
2780
|
+
|
|
2781
|
+
</td><td>
|
|
2782
|
+
|
|
2783
|
+
number
|
|
2784
|
+
|
|
2785
|
+
</td><td>
|
|
2786
|
+
|
|
2787
|
+
X coordinate
|
|
2788
|
+
|
|
2789
|
+
</td></tr>
|
|
2790
|
+
</tbody></table>
|
|
2791
|
+
|
|
2792
|
+
## Returns
|
|
2793
|
+
|
|
2794
|
+
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
|
|
2795
|
+
|
|
2796
|
+
Attribute primitive object
|
|
2797
|
+
|
|
2798
|
+
## Example
|
|
2799
|
+
|
|
2800
|
+
```javascript
|
|
2801
|
+
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
|
|
2802
|
+
const x = 20000 + Math.floor(Math.random() * 80000);
|
|
2803
|
+
const y = 20000 + Math.floor(Math.random() * 80000);
|
|
2804
|
+
|
|
2805
|
+
// 2. 放置测试器件并取出 Designator(编号)属性
|
|
2806
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
2807
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
|
|
2808
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
|
|
2809
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
2810
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
2811
|
+
|
|
2812
|
+
// 3. 读取修改前的锚点 X 坐标
|
|
2813
|
+
const before = designator.getState_X();
|
|
2814
|
+
|
|
2815
|
+
// 4. 切换异步模式向右移动 300mil 并提交
|
|
2816
|
+
const asyncAttr = designator.toAsync();
|
|
2817
|
+
asyncAttr.setState_X(before + 300);
|
|
2818
|
+
await asyncAttr.done();
|
|
2819
|
+
|
|
2820
|
+
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
|
|
2821
|
+
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
|
|
2822
|
+
|
|
2823
|
+
console.log('x:', before, '→', refetched.getState_X());
|
|
2824
|
+
```
|
|
2825
|
+
|
|
2826
|
+
### setstate_y
|
|
2827
|
+
|
|
2828
|
+
# IPCB\_PrimitiveAttribute.setState\_Y() method
|
|
2829
|
+
|
|
2830
|
+
> 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.
|
|
2831
|
+
|
|
2832
|
+
Set the property state: Y coordinate
|
|
2833
|
+
|
|
2834
|
+
## Signature
|
|
2835
|
+
|
|
2836
|
+
```typescript
|
|
2837
|
+
function setState_Y(y: number): IPCB_PrimitiveAttribute;
|
|
2838
|
+
```
|
|
2839
|
+
|
|
2840
|
+
## Parameters
|
|
2841
|
+
|
|
2842
|
+
<table><thead><tr><th>
|
|
2843
|
+
|
|
2844
|
+
Parameter
|
|
2845
|
+
|
|
2846
|
+
</th><th>
|
|
2847
|
+
|
|
2848
|
+
Type
|
|
2849
|
+
|
|
2850
|
+
</th><th>
|
|
2851
|
+
|
|
2852
|
+
Description
|
|
2853
|
+
|
|
2854
|
+
</th></tr></thead>
|
|
2855
|
+
<tbody><tr><td>
|
|
2856
|
+
|
|
2857
|
+
y
|
|
2858
|
+
|
|
2859
|
+
</td><td>
|
|
2860
|
+
|
|
2861
|
+
number
|
|
2862
|
+
|
|
2863
|
+
</td><td>
|
|
2864
|
+
|
|
2865
|
+
Y coordinate
|
|
2866
|
+
|
|
2867
|
+
</td></tr>
|
|
2868
|
+
</tbody></table>
|
|
2869
|
+
|
|
2870
|
+
## Returns
|
|
2871
|
+
|
|
2872
|
+
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
|
|
2873
|
+
|
|
2874
|
+
Attribute primitive object
|
|
2875
|
+
|
|
2876
|
+
## Example
|
|
2877
|
+
|
|
2878
|
+
```javascript
|
|
2879
|
+
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
|
|
2880
|
+
const x = 20000 + Math.floor(Math.random() * 80000);
|
|
2881
|
+
const y = 20000 + Math.floor(Math.random() * 80000);
|
|
2882
|
+
|
|
2883
|
+
// 2. 放置测试器件并取出 Designator(编号)属性
|
|
2884
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
2885
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
|
|
2886
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
|
|
2887
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
2888
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
2889
|
+
|
|
2890
|
+
// 3. 读取修改前的锚点 Y 坐标
|
|
2891
|
+
const before = designator.getState_Y();
|
|
2892
|
+
|
|
2893
|
+
// 4. 切换异步模式向上移动 300mil 并提交
|
|
2894
|
+
const asyncAttr = designator.toAsync();
|
|
2895
|
+
asyncAttr.setState_Y(before + 300);
|
|
2896
|
+
await asyncAttr.done();
|
|
2897
|
+
|
|
2898
|
+
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
|
|
2899
|
+
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
|
|
2900
|
+
|
|
2901
|
+
console.log('y:', before, '→', refetched.getState_Y());
|
|
2902
|
+
```
|
|
2903
|
+
|
|
2904
|
+
### toasync
|
|
2905
|
+
|
|
2906
|
+
# IPCB\_PrimitiveAttribute.toAsync() method
|
|
2907
|
+
|
|
2908
|
+
Convert Primitive to Async primitive
|
|
2909
|
+
|
|
2910
|
+
## Signature
|
|
2911
|
+
|
|
2912
|
+
```typescript
|
|
2913
|
+
function toAsync(): IPCB_PrimitiveAttribute;
|
|
2914
|
+
```
|
|
2915
|
+
|
|
2916
|
+
## Returns
|
|
2917
|
+
|
|
2918
|
+
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
|
|
2919
|
+
|
|
2920
|
+
Attribute primitive object
|
|
2921
|
+
|
|
2922
|
+
## Example
|
|
2923
|
+
|
|
2924
|
+
```javascript
|
|
2925
|
+
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
|
|
2926
|
+
const x = 20000 + Math.floor(Math.random() * 80000);
|
|
2927
|
+
const y = 20000 + Math.floor(Math.random() * 80000);
|
|
2928
|
+
|
|
2929
|
+
// 2. 放置测试器件并取出 Designator(编号)属性
|
|
2930
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
2931
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
|
|
2932
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
|
|
2933
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
2934
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
2935
|
+
|
|
2936
|
+
// 3. 转换为异步句柄并确认其异步状态
|
|
2937
|
+
const asyncAttr = designator.toAsync();
|
|
2938
|
+
|
|
2939
|
+
// 4. 通过异步句柄修改字号并提交
|
|
2940
|
+
asyncAttr.setState_FontSize(60);
|
|
2941
|
+
await asyncAttr.done();
|
|
2942
|
+
|
|
2943
|
+
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
|
|
2944
|
+
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
|
|
2945
|
+
|
|
2946
|
+
console.log('isAsync:', asyncAttr.isAsync());
|
|
2947
|
+
console.log('fontSize:', refetched.getState_FontSize());
|
|
2948
|
+
```
|
|
2949
|
+
|
|
2950
|
+
### tosync
|
|
2951
|
+
|
|
2952
|
+
# IPCB\_PrimitiveAttribute.toSync() method
|
|
2953
|
+
|
|
2954
|
+
Convert Primitive to Sync primitive
|
|
2955
|
+
|
|
2956
|
+
## Signature
|
|
2957
|
+
|
|
2958
|
+
```typescript
|
|
2959
|
+
function toSync(): IPCB_PrimitiveAttribute;
|
|
2960
|
+
```
|
|
2961
|
+
|
|
2962
|
+
## Returns
|
|
2963
|
+
|
|
2964
|
+
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
|
|
2965
|
+
|
|
2966
|
+
Attribute primitive object
|
|
2967
|
+
|
|
2968
|
+
## Example
|
|
2969
|
+
|
|
2970
|
+
```javascript
|
|
2971
|
+
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
|
|
2972
|
+
const x = 20000 + Math.floor(Math.random() * 80000);
|
|
2973
|
+
const y = 20000 + Math.floor(Math.random() * 80000);
|
|
2974
|
+
|
|
2975
|
+
// 2. 放置测试器件并取出 Designator(编号)属性
|
|
2976
|
+
const devices = await eda.lib_Device.search('C0402');
|
|
2977
|
+
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
|
|
2978
|
+
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
|
|
2979
|
+
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
|
|
2980
|
+
const designator = attrs.find(a => a.getState_Key() === 'Designator');
|
|
2981
|
+
|
|
2982
|
+
// 3. 读取修改前的属性值
|
|
2983
|
+
const before = designator.getState_Value();
|
|
2984
|
+
|
|
2985
|
+
// 4. 转换为同步图元后直接修改,立即生效(无需 done())
|
|
2986
|
+
const syncAttr = designator.toSync();
|
|
2987
|
+
syncAttr.setState_Value(`${before}-SYNC`);
|
|
2988
|
+
|
|
2989
|
+
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
|
|
2990
|
+
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
|
|
2991
|
+
|
|
2992
|
+
console.log('value:', before, '→', refetched.getState_Value());
|
|
2993
|
+
```
|