@windypro-rourou/dsh-eda 0.1.3 → 0.1.5
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 +3 -1
- package/lib/capabilities.js +3 -2
- package/lib/client.js +576 -452
- package/lib/index.js +89 -2
- package/package.json +10 -1
- package/skill/INDEX.md +10 -8
- package/skill/README.md +125 -0
- package/skill/README.zh-Hans.md +125 -0
- package/skill/SKILL.md +746 -746
- package/skill/format/index.md +152 -152
- package/skill/format/pcb/3d.md +166 -166
- package/skill/format/pcb/attr.md +63 -63
- package/skill/format/pcb/common.md +306 -306
- package/skill/format/pcb/component.md +132 -132
- package/skill/format/pcb/dimension.md +58 -58
- package/skill/format/pcb/index.md +17 -17
- package/skill/format/pcb/obj.md +43 -43
- package/skill/format/pcb/pad_via.md +151 -151
- package/skill/format/pcb/panel.md +64 -64
- package/skill/format/pcb/partition.md +43 -43
- package/skill/format/pcb/primitive.md +196 -196
- package/skill/format/pcb/rule.md +71 -71
- package/skill/format/pcb/shape.md +441 -441
- package/skill/format/pcb/text.md +62 -62
- package/skill/format/project/blob.md +30 -30
- package/skill/format/project/common.md +42 -42
- package/skill/format/project/group.md +62 -62
- package/skill/format/project/index.md +12 -12
- package/skill/format/project/instance.md +32 -32
- package/skill/format/project/meta.md +189 -189
- package/skill/format/project/variant.md +30 -30
- package/skill/format/schematic/attr.md +41 -41
- package/skill/format/schematic/common.md +47 -47
- package/skill/format/schematic/component.md +91 -91
- package/skill/format/schematic/index.md +14 -14
- package/skill/format/schematic/obj.md +41 -41
- package/skill/format/schematic/pin.md +59 -59
- package/skill/format/schematic/shape.md +231 -231
- package/skill/format/schematic/structure.md +53 -53
- package/skill/format/schematic/table.md +109 -109
- package/skill/format/schematic/text.md +47 -47
- package/skill/format/schematic/wire.md +132 -132
- package/skill/guide/ancillary-projects/easyeda-api-sdk.md +1 -0
- package/skill/guide/ancillary-projects/pro-api-types.md +5 -5
- package/skill/guide/ancillary-projects.md +10 -10
- package/skill/guide/cli.md +1510 -0
- package/skill/guide/error-handling.md +38 -38
- package/skill/guide/extension-json.md +135 -135
- package/skill/guide/extensions-marketplace.md +61 -61
- package/skill/guide/how-to-start.md +316 -301
- package/skill/guide/i18n.md +57 -57
- package/skill/guide/index.md +7 -7
- package/skill/guide/inline-frame.md +20 -20
- package/skill/guide/invoke-apis.md +81 -81
- package/skill/guide/stability.md +37 -37
- package/skill/references/_index.md +471 -398
- package/skill/references/_quick-reference.md +3103 -3028
- package/skill/references/classes/DMT_Board.md +537 -533
- package/skill/references/classes/DMT_EditorControl.md +1736 -1736
- package/skill/references/classes/DMT_Event.md +356 -356
- package/skill/references/classes/DMT_Folder.md +775 -775
- package/skill/references/classes/DMT_Panel.md +531 -531
- package/skill/references/classes/DMT_Pcb.md +579 -575
- package/skill/references/classes/DMT_Project.md +734 -573
- package/skill/references/classes/DMT_Schematic.md +1482 -1477
- package/skill/references/classes/DMT_SelectControl.md +96 -96
- package/skill/references/classes/DMT_Team.md +172 -172
- package/skill/references/classes/DMT_Workspace.md +198 -198
- package/skill/references/classes/EDA.md +1001 -961
- package/skill/references/classes/IPCB_ComplexPolygon.md +299 -299
- package/skill/references/classes/IPCB_Polygon.md +175 -175
- package/skill/references/classes/IPCB_PrimitiveArc.md +1901 -1901
- package/skill/references/classes/IPCB_PrimitiveAttribute.md +2993 -2993
- package/skill/references/classes/IPCB_PrimitiveComponent.md +2624 -2627
- package/skill/references/classes/IPCB_PrimitiveComponentPad.md +410 -410
- package/skill/references/classes/IPCB_PrimitiveDimension.md +1419 -1419
- package/skill/references/classes/IPCB_PrimitiveFill.md +1325 -1325
- package/skill/references/classes/IPCB_PrimitiveImage.md +1461 -1461
- package/skill/references/classes/IPCB_PrimitiveLine.md +1639 -1639
- package/skill/references/classes/IPCB_PrimitiveObject.md +1700 -1700
- package/skill/references/classes/IPCB_PrimitivePad.md +3155 -3155
- package/skill/references/classes/IPCB_PrimitivePolyline.md +1193 -1193
- package/skill/references/classes/IPCB_PrimitivePour.md +1858 -1858
- package/skill/references/classes/IPCB_PrimitivePoured.md +556 -556
- package/skill/references/classes/IPCB_PrimitiveRegion.md +1332 -1332
- package/skill/references/classes/IPCB_PrimitiveString.md +2315 -2315
- package/skill/references/classes/IPCB_PrimitiveVia.md +1588 -1588
- package/skill/references/classes/ISCH_PrimitiveArc.md +1676 -1676
- package/skill/references/classes/ISCH_PrimitiveAttribute.md +2541 -2541
- package/skill/references/classes/ISCH_PrimitiveBus.md +973 -973
- package/skill/references/classes/ISCH_PrimitiveCbbSymbolComponent.md +260 -260
- package/skill/references/classes/ISCH_PrimitiveCircle.md +1392 -1392
- package/skill/references/classes/ISCH_PrimitiveComponent.md +2910 -2913
- package/skill/references/classes/ISCH_PrimitiveComponentPin.md +155 -155
- package/skill/references/classes/ISCH_PrimitiveObject.md +960 -960
- package/skill/references/classes/ISCH_PrimitivePin.md +2402 -2402
- package/skill/references/classes/ISCH_PrimitivePolygon.md +1028 -1028
- package/skill/references/classes/ISCH_PrimitiveRectangle.md +1777 -1777
- package/skill/references/classes/ISCH_PrimitiveText.md +1771 -1771
- package/skill/references/classes/ISCH_PrimitiveWire.md +973 -973
- package/skill/references/classes/LIB_3DModel.md +782 -780
- package/skill/references/classes/LIB_Cbb.md +957 -957
- package/skill/references/classes/LIB_Classification.md +969 -965
- package/skill/references/classes/LIB_Device.md +1222 -1221
- package/skill/references/classes/LIB_Footprint.md +1298 -1153
- package/skill/references/classes/LIB_LibrariesList.md +361 -329
- package/skill/references/classes/LIB_PanelLibrary.md +855 -855
- package/skill/references/classes/LIB_SelectControl.md +89 -89
- package/skill/references/classes/LIB_SimulationModel.md +807 -821
- package/skill/references/classes/LIB_Symbol.md +1341 -1195
- package/skill/references/classes/PCB_Document.md +1770 -1754
- package/skill/references/classes/PCB_Drc.md +3379 -3375
- package/skill/references/classes/PCB_Event.md +1166 -1081
- package/skill/references/classes/PCB_ImageTool.md +363 -0
- package/skill/references/classes/PCB_Layer.md +1915 -1911
- package/skill/references/classes/PCB_ManufactureData.md +2968 -2968
- package/skill/references/classes/PCB_MathPolygon.md +916 -785
- package/skill/references/classes/PCB_Net.md +1128 -1128
- package/skill/references/classes/PCB_Primitive.md +217 -217
- package/skill/references/classes/PCB_PrimitiveArc.md +820 -894
- package/skill/references/classes/PCB_PrimitiveAttribute.md +635 -717
- package/skill/references/classes/PCB_PrimitiveComponent.md +1050 -1050
- package/skill/references/classes/PCB_PrimitiveDimension.md +789 -833
- package/skill/references/classes/PCB_PrimitiveFill.md +783 -861
- package/skill/references/classes/PCB_PrimitiveImage.md +803 -875
- package/skill/references/classes/PCB_PrimitiveLine.md +787 -858
- package/skill/references/classes/PCB_PrimitiveObject.md +796 -800
- package/skill/references/classes/PCB_PrimitivePad.md +947 -944
- package/skill/references/classes/PCB_PrimitivePolyline.md +744 -819
- package/skill/references/classes/PCB_PrimitivePour.md +808 -845
- package/skill/references/classes/PCB_PrimitivePoured.md +363 -363
- package/skill/references/classes/PCB_PrimitiveRegion.md +765 -799
- package/skill/references/classes/PCB_PrimitiveString.md +828 -910
- package/skill/references/classes/PCB_PrimitiveVia.md +761 -765
- package/skill/references/classes/PCB_RayTracerEngine.md +603 -263
- package/skill/references/classes/PCB_SelectControl.md +495 -495
- package/skill/references/classes/PCB_Tool.md +9 -0
- package/skill/references/classes/PNL_Document.md +83 -83
- package/skill/references/classes/SCH_Document.md +797 -809
- package/skill/references/classes/SCH_Drc.md +246 -242
- package/skill/references/classes/SCH_Event.md +583 -583
- package/skill/references/classes/SCH_ManufactureData.md +1209 -1205
- package/skill/references/classes/SCH_Net.md +200 -200
- package/skill/references/classes/SCH_Netlist.md +191 -191
- package/skill/references/classes/SCH_Primitive.md +337 -337
- package/skill/references/classes/SCH_PrimitiveArc.md +686 -692
- package/skill/references/classes/SCH_PrimitiveAttribute.md +579 -590
- package/skill/references/classes/SCH_PrimitiveBus.md +618 -624
- package/skill/references/classes/SCH_PrimitiveCircle.md +667 -683
- package/skill/references/classes/SCH_PrimitiveComponent.md +2256 -2240
- package/skill/references/classes/SCH_PrimitiveObject.md +666 -666
- package/skill/references/classes/SCH_PrimitivePin.md +737 -754
- package/skill/references/classes/SCH_PrimitivePolygon.md +621 -627
- package/skill/references/classes/SCH_PrimitiveRectangle.md +715 -731
- package/skill/references/classes/SCH_PrimitiveText.md +736 -746
- package/skill/references/classes/SCH_PrimitiveWire.md +701 -703
- package/skill/references/classes/SCH_SelectControl.md +520 -520
- package/skill/references/classes/SCH_SimulationEngine.md +133 -133
- package/skill/references/classes/SCH_Utils.md +121 -121
- package/skill/references/classes/SYS_ClientUrl.md +173 -173
- package/skill/references/classes/SYS_Dialog.md +825 -825
- package/skill/references/classes/SYS_Environment.md +640 -502
- package/skill/references/classes/SYS_ExternalApi.md +246 -0
- package/skill/references/classes/SYS_FileManager.md +1664 -1686
- package/skill/references/classes/SYS_FileSystem.md +1366 -1171
- package/skill/references/classes/SYS_FontManager.md +224 -224
- package/skill/references/classes/SYS_FormatConversion.md +349 -349
- package/skill/references/classes/SYS_HeaderMenu.md +480 -479
- package/skill/references/classes/SYS_Help.md +141 -0
- package/skill/references/classes/SYS_I18n.md +861 -861
- package/skill/references/classes/SYS_IFrame.md +541 -535
- package/skill/references/classes/SYS_LoadingAndProgressBar.md +246 -246
- package/skill/references/classes/SYS_Log.md +422 -424
- package/skill/references/classes/SYS_Math.md +1565 -1565
- package/skill/references/classes/SYS_Message.md +363 -363
- package/skill/references/classes/SYS_MessageBox.md +285 -285
- package/skill/references/classes/SYS_MessageBus.md +1618 -1618
- package/skill/references/classes/SYS_PanelControl.md +696 -696
- package/skill/references/classes/SYS_RightClickMenu.md +175 -175
- package/skill/references/classes/SYS_Setting.md +134 -85
- package/skill/references/classes/SYS_ShortcutKey.md +623 -623
- package/skill/references/classes/SYS_Storage.md +484 -484
- package/skill/references/classes/SYS_Timer.md +447 -447
- package/skill/references/classes/SYS_ToastMessage.md +194 -194
- package/skill/references/classes/SYS_Tool.md +317 -241
- package/skill/references/classes/SYS_Unit.md +594 -594
- package/skill/references/classes/SYS_WebSocket.md +401 -401
- package/skill/references/classes/SYS_Window.md +849 -850
- package/skill/references/enums/EDMT_EditorDocumentType.md +324 -278
- package/skill/references/enums/EDMT_EditorSplitScreenDirection.md +51 -47
- package/skill/references/enums/EDMT_EditorTabEventType.md +68 -62
- package/skill/references/enums/EDMT_IndicatorMarkerType.md +90 -80
- package/skill/references/enums/EDMT_ItemType.md +181 -157
- package/skill/references/enums/EDMT_ProjectCollaborationMode.md +51 -47
- package/skill/references/enums/EDMT_ProjectFileFormat.md +60 -0
- package/skill/references/enums/EDMT_ProjectReadyState.md +82 -0
- package/skill/references/enums/ELIB_DeviceJlcLibraryCategory.md +51 -47
- package/skill/references/enums/ELIB_LibraryType.md +129 -113
- package/skill/references/enums/ELIB_PreviewType.md +77 -69
- package/skill/references/enums/ELIB_SimulationModelType.md +51 -47
- package/skill/references/enums/ELIB_SymbolType.md +142 -124
- package/skill/references/enums/EPCB_AutoRoutingCornerStyle.md +51 -47
- package/skill/references/enums/EPCB_AutoRoutingExistingPrimitiveMode.md +51 -47
- package/skill/references/enums/EPCB_AutoRoutingOptimization.md +51 -47
- package/skill/references/enums/EPCB_DocumentCanvasUpdateCalculationActiveStatus.md +51 -47
- package/skill/references/enums/EPCB_DocumentRatlineCalculatingActiveStatus.md +55 -51
- package/skill/references/enums/EPCB_InactiveLayerDisplayMode.md +64 -58
- package/skill/references/enums/EPCB_LayerColorConfiguration.md +90 -80
- package/skill/references/enums/EPCB_LayerId.md +1169 -881
- package/skill/references/enums/EPCB_LayerStatus.md +64 -58
- package/skill/references/enums/EPCB_LayerType.md +129 -113
- package/skill/references/enums/EPCB_MouseEventType.md +64 -58
- package/skill/references/enums/EPCB_NetEventType.md +64 -58
- package/skill/references/enums/EPCB_PcbPlateType.md +51 -47
- package/skill/references/enums/EPCB_PdfOutputMethod.md +64 -58
- package/skill/references/enums/EPCB_PrimitiveArcInteractiveMode.md +51 -47
- package/skill/references/enums/EPCB_PrimitiveDimensionType.md +64 -58
- package/skill/references/enums/EPCB_PrimitiveEventType.md +64 -58
- package/skill/references/enums/EPCB_PrimitiveFillMode.md +68 -62
- package/skill/references/enums/EPCB_PrimitivePadHeatWeldingConnectionMethod.md +64 -58
- package/skill/references/enums/EPCB_PrimitivePadHoleType.md +64 -58
- package/skill/references/enums/EPCB_PrimitivePadShapeType.md +90 -80
- package/skill/references/enums/EPCB_PrimitivePadType.md +64 -58
- package/skill/references/enums/EPCB_PrimitivePourFillMethod.md +64 -58
- package/skill/references/enums/EPCB_PrimitiveRegionRuleType.md +107 -95
- package/skill/references/enums/EPCB_PrimitiveStringAlignMode.md +142 -124
- package/skill/references/enums/EPCB_PrimitiveType.md +233 -201
- package/skill/references/enums/EPCB_PrimitiveViaType.md +64 -58
- package/skill/references/enums/ESCH_DynamicSimulationEnginePullEventType.md +116 -102
- package/skill/references/enums/ESCH_DynamicSimulationEnginePushEventType.md +90 -80
- package/skill/references/enums/ESCH_ExportDocumentFileType.md +64 -58
- package/skill/references/enums/ESCH_MouseEventType.md +51 -47
- package/skill/references/enums/ESCH_PrimitiveComponentType.md +142 -124
- package/skill/references/enums/ESCH_PrimitiveEventType.md +77 -69
- package/skill/references/enums/ESCH_PrimitiveFillStyle.md +129 -113
- package/skill/references/enums/ESCH_PrimitiveLineType.md +77 -69
- package/skill/references/enums/ESCH_PrimitivePinShape.md +77 -69
- package/skill/references/enums/ESCH_PrimitivePinType.md +168 -146
- package/skill/references/enums/ESCH_PrimitiveTextAlignMode.md +142 -124
- package/skill/references/enums/ESCH_PrimitiveType.md +207 -179
- package/skill/references/enums/ESCH_SimulationNetlistType.md +38 -36
- package/skill/references/enums/ESCH_SpiceSimulationEnginePullEventType.md +51 -47
- package/skill/references/enums/ESCH_SpiceSimulationEnginePushEventType.md +77 -69
- package/skill/references/enums/ESYS_BottomPanelTab.md +94 -80
- package/skill/references/enums/ESYS_HeaderMenuEnvironment.md +181 -157
- package/skill/references/enums/ESYS_ImportProjectBoardOutlineSource.md +55 -51
- package/skill/references/enums/ESYS_ImportProjectImportOption.md +64 -58
- package/skill/references/enums/ESYS_ImportProjectSchematicObjectStyle.md +51 -47
- package/skill/references/enums/ESYS_ImportProjectViaSolderMaskExpansion.md +55 -51
- package/skill/references/enums/ESYS_JobState.md +95 -0
- package/skill/references/enums/ESYS_LeftPanelTab.md +94 -80
- package/skill/references/enums/ESYS_LogType.md +77 -102
- package/skill/references/enums/ESYS_NetlistType.md +129 -113
- package/skill/references/enums/ESYS_PanelPosition.md +69 -0
- package/skill/references/enums/ESYS_PanelTab.md +368 -0
- package/skill/references/enums/ESYS_RightPanelTab.md +237 -201
- package/skill/references/enums/ESYS_ShortcutKeyEffectiveEditorRange.md +220 -190
- package/skill/references/enums/ESYS_ShortcutKeyEffectiveEditorScene.md +103 -91
- package/skill/references/enums/ESYS_StartPageQuickStartItem.md +237 -205
- package/skill/references/enums/ESYS_Theme.md +51 -47
- package/skill/references/enums/ESYS_ToastMessageType.md +90 -80
- package/skill/references/enums/ESYS_Unit.md +116 -102
- package/skill/references/enums/ESYS_WindowEventType.md +64 -47
- package/skill/references/enums/ESYS_WindowOpenTarget.md +51 -47
- package/skill/references/enums/NetportDeviceName.md +146 -146
- package/skill/references/enums/SchToolBarDeviceName.md +278 -278
- package/skill/references/interfaces/BoardProps.md +169 -169
- package/skill/references/interfaces/BorderConfig.md +109 -0
- package/skill/references/interfaces/ButtonProps.md +196 -169
- package/skill/references/interfaces/CellClickInfo.md +142 -0
- package/skill/references/interfaces/CellCoord.md +88 -0
- package/skill/references/interfaces/CheckBoxProps.md +223 -196
- package/skill/references/interfaces/CheckChangeDetail.md +88 -0
- package/skill/references/interfaces/CheckboxEditConfig.md +159 -0
- package/skill/references/interfaces/ClipboardCellData.md +142 -0
- package/skill/references/interfaces/ClipboardConfig.md +115 -0
- package/skill/references/interfaces/ColorPickerProps.md +169 -0
- package/skill/references/interfaces/ColumnDef.md +605 -0
- package/skill/references/interfaces/ColumnEditTrigger.md +57 -0
- package/skill/references/interfaces/ColumnGroupDef.md +192 -0
- package/skill/references/interfaces/ColumnResizeConfig.md +142 -0
- package/skill/references/interfaces/ComponentPropsMap.md +517 -448
- package/skill/references/interfaces/CustomHeaderConfig.md +169 -0
- package/skill/references/interfaces/DialogProps.md +385 -385
- package/skill/references/interfaces/DragSortConfig.md +115 -0
- package/skill/references/interfaces/EditingConfig.md +196 -0
- package/skill/references/interfaces/FilteringConfig.md +250 -0
- package/skill/references/interfaces/FixedColumnConfig.md +88 -0
- package/skill/references/interfaces/FlexItemProps.md +116 -116
- package/skill/references/interfaces/FlexProps.md +224 -224
- package/skill/references/interfaces/GridItemProps.md +143 -143
- package/skill/references/interfaces/GridProps.md +143 -143
- package/skill/references/interfaces/IDMT_BoardItem.md +171 -171
- package/skill/references/interfaces/IDMT_BriefProjectItem.md +171 -171
- package/skill/references/interfaces/IDMT_EditorDocumentItem.md +169 -169
- package/skill/references/interfaces/IDMT_EditorSplitScreenItem.md +173 -173
- package/skill/references/interfaces/IDMT_EditorTabItem.md +169 -169
- package/skill/references/interfaces/IDMT_FolderItem.md +225 -225
- package/skill/references/interfaces/IDMT_IndicatorMarkerShape.md +393 -393
- package/skill/references/interfaces/IDMT_PanelItem.md +144 -144
- package/skill/references/interfaces/IDMT_PcbItem.md +171 -171
- package/skill/references/interfaces/IDMT_ProjectItem.md +143 -143
- package/skill/references/interfaces/IDMT_SchematicItem.md +225 -225
- package/skill/references/interfaces/IDMT_SchematicPageItem.md +198 -198
- package/skill/references/interfaces/IDMT_TeamItem.md +144 -144
- package/skill/references/interfaces/IDMT_WorkspaceItem.md +117 -117
- package/skill/references/interfaces/IDesignPortal.md +103 -103
- package/skill/references/interfaces/ILIB_3DModelItem.md +198 -198
- package/skill/references/interfaces/ILIB_3DModelSearchItem.md +277 -277
- package/skill/references/interfaces/ILIB_CbbItem.md +225 -225
- package/skill/references/interfaces/ILIB_CbbSearchItem.md +277 -277
- package/skill/references/interfaces/ILIB_ClassificationIndex.md +150 -150
- package/skill/references/interfaces/ILIB_ClassificationNode.md +98 -0
- package/skill/references/interfaces/ILIB_DeviceAssociationItem.md +210 -210
- package/skill/references/interfaces/ILIB_DeviceExtendPropertyItem.md +304 -304
- package/skill/references/interfaces/ILIB_DeviceItem.md +279 -279
- package/skill/references/interfaces/ILIB_DevicePropertiesForSearch.md +250 -250
- package/skill/references/interfaces/ILIB_DeviceSearchItem.md +521 -521
- package/skill/references/interfaces/ILIB_ExtendLibrary3DModelFunctions.md +64 -64
- package/skill/references/interfaces/ILIB_ExtendLibraryCbbFunctions.md +93 -99
- package/skill/references/interfaces/ILIB_ExtendLibraryClassificationIndex.md +150 -150
- package/skill/references/interfaces/ILIB_ExtendLibraryDeviceFunctions.md +143 -157
- package/skill/references/interfaces/ILIB_ExtendLibraryFootprintFunctions.md +63 -63
- package/skill/references/interfaces/ILIB_ExtendLibraryFunctions.md +123 -123
- package/skill/references/interfaces/ILIB_ExtendLibraryItem.md +97 -97
- package/skill/references/interfaces/ILIB_ExtendLibraryItemIndex.md +98 -98
- package/skill/references/interfaces/ILIB_ExtendLibrarySearchProperty.md +115 -115
- package/skill/references/interfaces/ILIB_ExtendLibrarySearchResult.md +169 -169
- package/skill/references/interfaces/ILIB_ExtendLibrarySearchResultDataLine.md +234 -234
- package/skill/references/interfaces/ILIB_ExtendLibrarySymbolFunctions.md +91 -105
- package/skill/references/interfaces/ILIB_ExtendLibraryUserIndex.md +96 -96
- package/skill/references/interfaces/ILIB_FootprintItem.md +256 -198
- package/skill/references/interfaces/ILIB_FootprintPropertiesForSearch.md +61 -61
- package/skill/references/interfaces/ILIB_FootprintSearchItem.md +277 -277
- package/skill/references/interfaces/ILIB_LibraryInfo.md +92 -92
- package/skill/references/interfaces/ILIB_LibraryItem.md +115 -115
- package/skill/references/interfaces/ILIB_PanelLibraryItem.md +198 -198
- package/skill/references/interfaces/ILIB_PanelLibrarySearchItem.md +277 -277
- package/skill/references/interfaces/ILIB_RegisterExtendLibraryProps.md +71 -0
- package/skill/references/interfaces/ILIB_SimulationModelItem.md +306 -306
- package/skill/references/interfaces/ILIB_SimulationModelSearchItem.md +304 -304
- package/skill/references/interfaces/ILIB_SymbolItem.md +306 -279
- package/skill/references/interfaces/ILIB_SymbolPropertiesForSearch.md +61 -61
- package/skill/references/interfaces/ILIB_SymbolSearchItem.md +304 -304
- package/skill/references/interfaces/IPCB_AutoLayoutResult.md +169 -169
- package/skill/references/interfaces/IPCB_AutoRoutingProps.md +220 -220
- package/skill/references/interfaces/IPCB_AutoRoutingResult.md +169 -169
- package/skill/references/interfaces/IPCB_BomPropertiesTableColumns.md +169 -169
- package/skill/references/interfaces/IPCB_DifferentialPairItem.md +115 -115
- package/skill/references/interfaces/IPCB_DiscretizeOptions.md +65 -65
- package/skill/references/interfaces/IPCB_DiscretizedPoint.md +88 -88
- package/skill/references/interfaces/IPCB_EqualLengthNetGroupItem.md +115 -115
- package/skill/references/interfaces/IPCB_LayerItem.md +277 -277
- package/skill/references/interfaces/IPCB_NetClassItem.md +115 -115
- package/skill/references/interfaces/IPCB_NetInfo.md +115 -115
- package/skill/references/interfaces/IPCB_PadPairGroupItem.md +88 -88
- package/skill/references/interfaces/IPCB_PadPairMinWireLengthItem.md +88 -88
- package/skill/references/interfaces/IPCB_PhysicalStackingConfiguration.md +115 -115
- package/skill/references/interfaces/IPCB_Primitive.md +218 -218
- package/skill/references/interfaces/IPCB_PrimitiveAPI.md +174 -175
- package/skill/references/interfaces/IPCB_PrimitivePadHeatWelding.md +151 -151
- package/skill/references/interfaces/IPCB_PrimitivePouredPourFill.md +142 -142
- package/skill/references/interfaces/IPCB_PrimitiveSolderMaskAndPasteMaskExpansion.md +154 -154
- package/skill/references/interfaces/IPCB_RayTracerBackgroundConfig.md +223 -0
- package/skill/references/interfaces/IPCB_RayTracerLightConfig.md +412 -0
- package/skill/references/interfaces/IPCB_RayTracerMaterialConfig.md +547 -0
- package/skill/references/interfaces/IPCB_RayTracerPcbMaterialConfig.md +196 -0
- package/skill/references/interfaces/IPCB_RayTracerRenderConfigurations.md +200 -0
- package/skill/references/interfaces/IPCB_RayTracerRendererConfig.md +196 -0
- package/skill/references/interfaces/IPCB_RayTracerSceneElement.md +115 -0
- package/skill/references/interfaces/IPCB_RayTracerSceneElementTransform.md +123 -0
- package/skill/references/interfaces/IPCB_RayTracerTexture.md +88 -0
- package/skill/references/interfaces/IPCB_SubstratePhysicalProperties.md +88 -88
- package/skill/references/interfaces/IRawNet.md +103 -103
- package/skill/references/interfaces/IRawPureSchematic.md +80 -80
- package/skill/references/interfaces/IRawSchematic.md +103 -103
- package/skill/references/interfaces/IRawWire.md +149 -149
- package/skill/references/interfaces/ISCH_DrcError.md +142 -142
- package/skill/references/interfaces/ISCH_DrcErrorPrimitive.md +142 -142
- package/skill/references/interfaces/ISCH_ExportPngResolution.md +94 -94
- package/skill/references/interfaces/ISCH_NetInfo.md +88 -88
- package/skill/references/interfaces/ISCH_Primitive.md +218 -219
- package/skill/references/interfaces/ISCH_PrimitiveAPI.md +174 -175
- package/skill/references/interfaces/ISCH_ProjectNetInfo.md +142 -142
- package/skill/references/interfaces/ISCH_WireInfo.md +169 -169
- package/skill/references/interfaces/ISYS_ComparisonResponse.md +115 -0
- package/skill/references/interfaces/ISYS_ExtensionExternalApiIndex.md +13 -0
- package/skill/references/interfaces/ISYS_ExtensionRegisteredExternalApis.md +13 -0
- package/skill/references/interfaces/ISYS_ExternalApiHelp.md +173 -0
- package/skill/references/interfaces/ISYS_ExternalApiRegistration.md +146 -0
- package/skill/references/interfaces/ISYS_FileSystemFileList.md +169 -169
- package/skill/references/interfaces/ISYS_HeaderMenuSub1MenuItem.md +205 -174
- package/skill/references/interfaces/ISYS_HeaderMenuSub2MenuItem.md +178 -147
- package/skill/references/interfaces/ISYS_HeaderMenuTopMenuItem.md +115 -115
- package/skill/references/interfaces/ISYS_HeaderMenus.md +408 -408
- package/skill/references/interfaces/ISYS_HelpAudienceEntry.md +92 -0
- package/skill/references/interfaces/ISYS_HelpClassSummary.md +205 -0
- package/skill/references/interfaces/ISYS_HelpData.md +92 -0
- package/skill/references/interfaces/ISYS_HelpMethodDetail.md +310 -0
- package/skill/references/interfaces/ISYS_JobHandle.md +65 -0
- package/skill/references/interfaces/ISYS_JobLogEntry.md +142 -0
- package/skill/references/interfaces/ISYS_JobStatus.md +176 -0
- package/skill/references/interfaces/ISYS_LogLine.md +115 -115
- package/skill/references/interfaces/ISYS_MathBBox.md +142 -142
- package/skill/references/interfaces/ISYS_MathPoint.md +88 -88
- package/skill/references/interfaces/ISYS_MathPolygonWithHoles.md +92 -92
- package/skill/references/interfaces/ISYS_MessageBusTask.md +115 -115
- package/skill/references/interfaces/ISYS_MultilingualLanguagesData.md +12 -12
- package/skill/references/interfaces/ISYS_RightClickMenuItem.md +174 -174
- package/skill/references/interfaces/ISYS_ShortcutKeyData.md +169 -169
- package/skill/references/interfaces/ISYS_ShortcutKeyDataWithCallFn.md +62 -62
- package/skill/references/interfaces/ISYS_ShortcutKeyDataWithUserDefinedShortcutKey.md +62 -62
- package/skill/references/interfaces/ISYS_WindowEventListenerRemovableObject.md +109 -109
- package/skill/references/interfaces/IconProps.md +88 -88
- package/skill/references/interfaces/ImageProps.md +115 -115
- package/skill/references/interfaces/InputEditConfig.md +182 -0
- package/skill/references/interfaces/InputProps.md +547 -520
- package/skill/references/interfaces/KeyboardConfig.md +61 -0
- package/skill/references/interfaces/ListChildren.md +223 -223
- package/skill/references/interfaces/ListProps.md +250 -223
- package/skill/references/interfaces/ModalProps.md +358 -358
- package/skill/references/interfaces/NumberEditConfig.md +234 -0
- package/skill/references/interfaces/RadioGroupProps.md +196 -196
- package/skill/references/interfaces/RadioItem.md +115 -115
- package/skill/references/interfaces/RichTableProps.md +1357 -0
- package/skill/references/interfaces/RowMetaConfig.md +142 -0
- package/skill/references/interfaces/ScrollerProps.md +169 -169
- package/skill/references/interfaces/SelectEditConfig.md +211 -0
- package/skill/references/interfaces/SelectListItem.md +142 -142
- package/skill/references/interfaces/SelectOption.md +142 -0
- package/skill/references/interfaces/SelectProps.md +169 -169
- package/skill/references/interfaces/SelectionConfig.md +358 -0
- package/skill/references/interfaces/SliderProps.md +142 -0
- package/skill/references/interfaces/SlotProps.md +88 -88
- package/skill/references/interfaces/SortState.md +88 -0
- package/skill/references/interfaces/SortingConfig.md +169 -0
- package/skill/references/interfaces/StyleProps.md +439 -385
- package/skill/references/interfaces/TextAreaProps.md +196 -196
- package/skill/references/interfaces/TextProps.md +169 -169
- package/skill/references/interfaces/TextareaEditConfig.md +182 -0
- package/skill/references/interfaces/ValidationRule.md +223 -0
- package/skill/references/interfaces/VirtualScrollConfig.md +115 -0
- package/skill/references/types/Align.md +9 -0
- package/skill/references/types/CellContentType.md +9 -0
- package/skill/references/types/ColumnDefOrGroup.md +12 -0
- package/skill/references/types/ColumnEditConfig.md +13 -0
- package/skill/references/types/ColumnType.md +9 -0
- package/skill/references/types/DataChangeType.md +9 -0
- package/skill/references/types/FilterMatchMode.md +9 -0
- package/skill/references/types/RichTableRow.md +12 -0
- package/skill/references/types/Serializable.md +10 -0
- package/skill/references/types/SerializablePrimitive.md +9 -0
- package/skill/references/types/SortOrder.md +9 -0
- package/skill/references/types/TPCB_LayerTypesOfInnerLayer.md +11 -11
- package/skill/references/types/TPCB_LayersInTheSelectable.md +42 -42
- package/skill/references/types/TPCB_LayersOfComponent.md +11 -11
- package/skill/references/types/TPCB_LayersOfCopper.md +15 -15
- package/skill/references/types/TPCB_LayersOfCustom.md +41 -41
- package/skill/references/types/TPCB_LayersOfDimension.md +16 -16
- package/skill/references/types/TPCB_LayersOfFill.md +28 -28
- package/skill/references/types/TPCB_LayersOfImage.md +22 -22
- package/skill/references/types/TPCB_LayersOfInner.md +41 -41
- package/skill/references/types/TPCB_LayersOfLine.md +25 -25
- package/skill/references/types/TPCB_LayersOfObject.md +12 -12
- package/skill/references/types/TPCB_LayersOfPad.md +11 -11
- package/skill/references/types/TPCB_LayersOfRegion.md +11 -11
- package/skill/references/types/TPCB_NumberOfCopperLayers.md +9 -9
- package/skill/references/types/TPCB_PolygonSourceArray.md +85 -83
- package/skill/references/types/TPCB_PrimitiveDimensionCoordinateSet.md +66 -66
- package/skill/references/types/TPCB_PrimitivePadHole.md +30 -30
- package/skill/references/types/TPCB_PrimitivePadShape.md +61 -61
- package/skill/references/types/TPCB_PrimitiveSpecialPadShape.md +19 -19
- package/skill/references/types/TSYS_ComparisonErrorCode.md +15 -0
- package/skill/references/types/TSYS_LanguageKeyValuePairs.md +13 -0
- package/skill/references/types/TSYS_MathPolygonGroup.md +15 -15
- package/skill/references/types/TSYS_MathPolygonInput.md +20 -20
- package/skill/references/types/TSYS_ShortcutKeys.md +96 -96
- package/skill/user-guide/using-extension.md +47 -47
- package/src/json-gen.test.js +430 -0
- package/skill/guide/ancillary-projects/pro-api-sdk.md +0 -1
- package/skill/references/interfaces/ISYS_PcbComparisonResponse.md +0 -115
- package/skill/references/types/ISYS_LanguageKeyValuePairs.md +0 -13
- package/skill/references/types/TSYS_PcbComparisonErrorCode.md +0 -10
|
@@ -1,1700 +1,1700 @@
|
|
|
1
|
-
# IPCB\_PrimitiveObject class
|
|
2
|
-
|
|
3
|
-
Binary embedded object primitive
|
|
4
|
-
|
|
5
|
-
## Signature
|
|
6
|
-
|
|
7
|
-
```typescript
|
|
8
|
-
class IPCB_PrimitiveObject implements IPCB_Primitive
|
|
9
|
-
```
|
|
10
|
-
**Implements:** [IPCB\_Primitive](../interfaces/IPCB_Primitive.md)
|
|
11
|
-
|
|
12
|
-
## Remarks
|
|
13
|
-
|
|
14
|
-
## Methods
|
|
15
|
-
|
|
16
|
-
<table><thead><tr><th>
|
|
17
|
-
|
|
18
|
-
Method
|
|
19
|
-
|
|
20
|
-
</th><th>
|
|
21
|
-
|
|
22
|
-
Modifiers
|
|
23
|
-
|
|
24
|
-
</th><th>
|
|
25
|
-
|
|
26
|
-
Description
|
|
27
|
-
|
|
28
|
-
</th></tr></thead>
|
|
29
|
-
<tbody><tr><td>
|
|
30
|
-
|
|
31
|
-
[done()](./IPCB_PrimitiveObject.md)
|
|
32
|
-
|
|
33
|
-
</td><td>
|
|
34
|
-
|
|
35
|
-
</td><td>
|
|
36
|
-
|
|
37
|
-
**_(BETA)_** Apply the changes to the primitives to the canvas
|
|
38
|
-
|
|
39
|
-
</td></tr>
|
|
40
|
-
<tr><td>
|
|
41
|
-
|
|
42
|
-
[getState\_BinaryData()](./IPCB_PrimitiveObject.md)
|
|
43
|
-
|
|
44
|
-
</td><td>
|
|
45
|
-
|
|
46
|
-
</td><td>
|
|
47
|
-
|
|
48
|
-
Get the property state: binary data
|
|
49
|
-
|
|
50
|
-
</td></tr>
|
|
51
|
-
<tr><td>
|
|
52
|
-
|
|
53
|
-
[getState\_FileName()](./IPCB_PrimitiveObject.md)
|
|
54
|
-
|
|
55
|
-
</td><td>
|
|
56
|
-
|
|
57
|
-
</td><td>
|
|
58
|
-
|
|
59
|
-
Get the property state: file name
|
|
60
|
-
|
|
61
|
-
</td></tr>
|
|
62
|
-
<tr><td>
|
|
63
|
-
|
|
64
|
-
[getState\_Height()](./IPCB_PrimitiveObject.md)
|
|
65
|
-
|
|
66
|
-
</td><td>
|
|
67
|
-
|
|
68
|
-
</td><td>
|
|
69
|
-
|
|
70
|
-
Get the property state: height
|
|
71
|
-
|
|
72
|
-
</td></tr>
|
|
73
|
-
<tr><td>
|
|
74
|
-
|
|
75
|
-
[getState\_Layer()](./IPCB_PrimitiveObject.md)
|
|
76
|
-
|
|
77
|
-
</td><td>
|
|
78
|
-
|
|
79
|
-
</td><td>
|
|
80
|
-
|
|
81
|
-
Get the property state: Layer
|
|
82
|
-
|
|
83
|
-
</td></tr>
|
|
84
|
-
<tr><td>
|
|
85
|
-
|
|
86
|
-
[getState\_Mirror()](./IPCB_PrimitiveObject.md)
|
|
87
|
-
|
|
88
|
-
</td><td>
|
|
89
|
-
|
|
90
|
-
</td><td>
|
|
91
|
-
|
|
92
|
-
Get the property state: whether it is horizontally mirrored
|
|
93
|
-
|
|
94
|
-
</td></tr>
|
|
95
|
-
<tr><td>
|
|
96
|
-
|
|
97
|
-
[getState\_PrimitiveId()](./IPCB_PrimitiveObject.md)
|
|
98
|
-
|
|
99
|
-
</td><td>
|
|
100
|
-
|
|
101
|
-
</td><td>
|
|
102
|
-
|
|
103
|
-
Get the property state: primitive ID
|
|
104
|
-
|
|
105
|
-
</td></tr>
|
|
106
|
-
<tr><td>
|
|
107
|
-
|
|
108
|
-
[getState\_PrimitiveLock()](./IPCB_PrimitiveObject.md)
|
|
109
|
-
|
|
110
|
-
</td><td>
|
|
111
|
-
|
|
112
|
-
</td><td>
|
|
113
|
-
|
|
114
|
-
Get the property state: whether it is locked
|
|
115
|
-
|
|
116
|
-
</td></tr>
|
|
117
|
-
<tr><td>
|
|
118
|
-
|
|
119
|
-
[getState\_PrimitiveType()](./IPCB_PrimitiveObject.md)
|
|
120
|
-
|
|
121
|
-
</td><td>
|
|
122
|
-
|
|
123
|
-
</td><td>
|
|
124
|
-
|
|
125
|
-
Get the property state: primitive type
|
|
126
|
-
|
|
127
|
-
</td></tr>
|
|
128
|
-
<tr><td>
|
|
129
|
-
|
|
130
|
-
[getState\_Rotation()](./IPCB_PrimitiveObject.md)
|
|
131
|
-
|
|
132
|
-
</td><td>
|
|
133
|
-
|
|
134
|
-
</td><td>
|
|
135
|
-
|
|
136
|
-
Get the property state: rotation angle
|
|
137
|
-
|
|
138
|
-
</td></tr>
|
|
139
|
-
<tr><td>
|
|
140
|
-
|
|
141
|
-
[getState\_TopLeftX()](./IPCB_PrimitiveObject.md)
|
|
142
|
-
|
|
143
|
-
</td><td>
|
|
144
|
-
|
|
145
|
-
</td><td>
|
|
146
|
-
|
|
147
|
-
Get the property state: top-left point X
|
|
148
|
-
|
|
149
|
-
</td></tr>
|
|
150
|
-
<tr><td>
|
|
151
|
-
|
|
152
|
-
[getState\_TopLeftY()](./IPCB_PrimitiveObject.md)
|
|
153
|
-
|
|
154
|
-
</td><td>
|
|
155
|
-
|
|
156
|
-
</td><td>
|
|
157
|
-
|
|
158
|
-
Get the property state: top-left point Y
|
|
159
|
-
|
|
160
|
-
</td></tr>
|
|
161
|
-
<tr><td>
|
|
162
|
-
|
|
163
|
-
[getState\_Width()](./IPCB_PrimitiveObject.md)
|
|
164
|
-
|
|
165
|
-
</td><td>
|
|
166
|
-
|
|
167
|
-
</td><td>
|
|
168
|
-
|
|
169
|
-
Get the property state: width
|
|
170
|
-
|
|
171
|
-
</td></tr>
|
|
172
|
-
<tr><td>
|
|
173
|
-
|
|
174
|
-
[isAsync()](./IPCB_PrimitiveObject.md)
|
|
175
|
-
|
|
176
|
-
</td><td>
|
|
177
|
-
|
|
178
|
-
</td><td>
|
|
179
|
-
|
|
180
|
-
Query whether the primitive is an async primitive
|
|
181
|
-
|
|
182
|
-
</td></tr>
|
|
183
|
-
<tr><td>
|
|
184
|
-
|
|
185
|
-
[reset()](./IPCB_PrimitiveObject.md)
|
|
186
|
-
|
|
187
|
-
</td><td>
|
|
188
|
-
|
|
189
|
-
</td><td>
|
|
190
|
-
|
|
191
|
-
**_(BETA)_** Reset the async primitive to the current canvas state
|
|
192
|
-
|
|
193
|
-
</td></tr>
|
|
194
|
-
<tr><td>
|
|
195
|
-
|
|
196
|
-
[setState\_BinaryData(binaryData)](./IPCB_PrimitiveObject.md)
|
|
197
|
-
|
|
198
|
-
</td><td>
|
|
199
|
-
|
|
200
|
-
</td><td>
|
|
201
|
-
|
|
202
|
-
Set the property state: binary data
|
|
203
|
-
|
|
204
|
-
</td></tr>
|
|
205
|
-
<tr><td>
|
|
206
|
-
|
|
207
|
-
[setState\_FileName(fileName)](./IPCB_PrimitiveObject.md)
|
|
208
|
-
|
|
209
|
-
</td><td>
|
|
210
|
-
|
|
211
|
-
</td><td>
|
|
212
|
-
|
|
213
|
-
Set the property state: file name
|
|
214
|
-
|
|
215
|
-
</td></tr>
|
|
216
|
-
<tr><td>
|
|
217
|
-
|
|
218
|
-
[setState\_Height(height)](./IPCB_PrimitiveObject.md)
|
|
219
|
-
|
|
220
|
-
</td><td>
|
|
221
|
-
|
|
222
|
-
</td><td>
|
|
223
|
-
|
|
224
|
-
Set the property state: height
|
|
225
|
-
|
|
226
|
-
</td></tr>
|
|
227
|
-
<tr><td>
|
|
228
|
-
|
|
229
|
-
[setState\_Layer(layer)](./IPCB_PrimitiveObject.md)
|
|
230
|
-
|
|
231
|
-
</td><td>
|
|
232
|
-
|
|
233
|
-
</td><td>
|
|
234
|
-
|
|
235
|
-
**_(BETA)_** Set the property state: Layer
|
|
236
|
-
|
|
237
|
-
</td></tr>
|
|
238
|
-
<tr><td>
|
|
239
|
-
|
|
240
|
-
[setState\_Mirror(mirror)](./IPCB_PrimitiveObject.md)
|
|
241
|
-
|
|
242
|
-
</td><td>
|
|
243
|
-
|
|
244
|
-
</td><td>
|
|
245
|
-
|
|
246
|
-
Set the property state: whether it is horizontally mirrored
|
|
247
|
-
|
|
248
|
-
</td></tr>
|
|
249
|
-
<tr><td>
|
|
250
|
-
|
|
251
|
-
[setState\_PrimitiveLock(primitiveLock)](./IPCB_PrimitiveObject.md)
|
|
252
|
-
|
|
253
|
-
</td><td>
|
|
254
|
-
|
|
255
|
-
</td><td>
|
|
256
|
-
|
|
257
|
-
**_(BETA)_** Set the property state: whether it is locked
|
|
258
|
-
|
|
259
|
-
</td></tr>
|
|
260
|
-
<tr><td>
|
|
261
|
-
|
|
262
|
-
[setState\_Rotation(rotation)](./IPCB_PrimitiveObject.md)
|
|
263
|
-
|
|
264
|
-
</td><td>
|
|
265
|
-
|
|
266
|
-
</td><td>
|
|
267
|
-
|
|
268
|
-
Set the property state: rotation angle
|
|
269
|
-
|
|
270
|
-
</td></tr>
|
|
271
|
-
<tr><td>
|
|
272
|
-
|
|
273
|
-
[setState\_TopLeftX(topLeftX)](./IPCB_PrimitiveObject.md)
|
|
274
|
-
|
|
275
|
-
</td><td>
|
|
276
|
-
|
|
277
|
-
</td><td>
|
|
278
|
-
|
|
279
|
-
Set the property state: top-left point X
|
|
280
|
-
|
|
281
|
-
</td></tr>
|
|
282
|
-
<tr><td>
|
|
283
|
-
|
|
284
|
-
[setState\_TopLeftY(topLeftY)](./IPCB_PrimitiveObject.md)
|
|
285
|
-
|
|
286
|
-
</td><td>
|
|
287
|
-
|
|
288
|
-
</td><td>
|
|
289
|
-
|
|
290
|
-
Set the property state: top-left point Y
|
|
291
|
-
|
|
292
|
-
</td></tr>
|
|
293
|
-
<tr><td>
|
|
294
|
-
|
|
295
|
-
[setState\_Width(width)](./IPCB_PrimitiveObject.md)
|
|
296
|
-
|
|
297
|
-
</td><td>
|
|
298
|
-
|
|
299
|
-
</td><td>
|
|
300
|
-
|
|
301
|
-
Set the property state: width
|
|
302
|
-
|
|
303
|
-
</td></tr>
|
|
304
|
-
<tr><td>
|
|
305
|
-
|
|
306
|
-
[toAsync()](./IPCB_PrimitiveObject.md)
|
|
307
|
-
|
|
308
|
-
</td><td>
|
|
309
|
-
|
|
310
|
-
</td><td>
|
|
311
|
-
|
|
312
|
-
Convert Primitive to Async primitive
|
|
313
|
-
|
|
314
|
-
</td></tr>
|
|
315
|
-
<tr><td>
|
|
316
|
-
|
|
317
|
-
[toSync()](./IPCB_PrimitiveObject.md)
|
|
318
|
-
|
|
319
|
-
</td><td>
|
|
320
|
-
|
|
321
|
-
</td><td>
|
|
322
|
-
|
|
323
|
-
Convert Primitive to Sync primitive
|
|
324
|
-
|
|
325
|
-
</td></tr>
|
|
326
|
-
</tbody></table>
|
|
327
|
-
|
|
328
|
-
---
|
|
329
|
-
|
|
330
|
-
## 方法详情
|
|
331
|
-
|
|
332
|
-
### done
|
|
333
|
-
|
|
334
|
-
# IPCB\_PrimitiveObject.done() method
|
|
335
|
-
|
|
336
|
-
> 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.
|
|
337
|
-
|
|
338
|
-
Apply the changes to the primitives to the canvas
|
|
339
|
-
|
|
340
|
-
## Signature
|
|
341
|
-
|
|
342
|
-
```typescript
|
|
343
|
-
function done(): Promise<IPCB_PrimitiveObject>;
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
## Returns
|
|
347
|
-
|
|
348
|
-
Promise<[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)<!-- -->>
|
|
349
|
-
|
|
350
|
-
Binary embedded object primitive object
|
|
351
|
-
|
|
352
|
-
## Example
|
|
353
|
-
|
|
354
|
-
```javascript
|
|
355
|
-
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
|
|
356
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
357
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
358
|
-
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
359
|
-
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
360
|
-
|
|
361
|
-
// 2. 放置一个未旋转的内嵌图片
|
|
362
|
-
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
363
|
-
const before = obj.getState_Rotation();
|
|
364
|
-
|
|
365
|
-
// 3. 异步模式下旋转 90 度(此时画布还没变)
|
|
366
|
-
const asyncObj = obj.toAsync();
|
|
367
|
-
asyncObj.setState_Rotation(90);
|
|
368
|
-
await asyncObj.done();
|
|
369
|
-
|
|
370
|
-
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
|
|
371
|
-
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
|
|
372
|
-
|
|
373
|
-
console.log('rotation:', before, '→', refetched.getState_Rotation());
|
|
374
|
-
```
|
|
375
|
-
|
|
376
|
-
### getstate_binarydata
|
|
377
|
-
|
|
378
|
-
# IPCB\_PrimitiveObject.getState\_BinaryData() method
|
|
379
|
-
|
|
380
|
-
Get the property state: binary data
|
|
381
|
-
|
|
382
|
-
## Signature
|
|
383
|
-
|
|
384
|
-
```typescript
|
|
385
|
-
function getState_BinaryData(): string;
|
|
386
|
-
```
|
|
387
|
-
|
|
388
|
-
## Returns
|
|
389
|
-
|
|
390
|
-
string
|
|
391
|
-
|
|
392
|
-
Binary data
|
|
393
|
-
|
|
394
|
-
## Remarks
|
|
395
|
-
|
|
396
|
-
The `binaryData` retrieved from the canvas may be a `hashId`<!-- -->, because our backend stores binary embedded object data in object storage,
|
|
397
|
-
|
|
398
|
-
The object storage uses `hashId` as the index. Fully retrieving the data will cause additional requests and consume performance
|
|
399
|
-
|
|
400
|
-
## Example
|
|
401
|
-
|
|
402
|
-
```javascript
|
|
403
|
-
// 1. 生成本次运行专用的坐标,在顶层丝印层放置一个 400 x 300 的内嵌图片
|
|
404
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
405
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
406
|
-
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
407
|
-
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
408
|
-
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
409
|
-
|
|
410
|
-
// 2. 读取内嵌的二进制数据
|
|
411
|
-
const binaryData = obj.getState_BinaryData();
|
|
412
|
-
|
|
413
|
-
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
414
|
-
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
|
|
415
|
-
|
|
416
|
-
console.log('binaryData 长度:', binaryData.length);
|
|
417
|
-
console.log('binaryData 前缀:', binaryData.substring(0, 30));
|
|
418
|
-
```
|
|
419
|
-
|
|
420
|
-
### getstate_filename
|
|
421
|
-
|
|
422
|
-
# IPCB\_PrimitiveObject.getState\_FileName() method
|
|
423
|
-
|
|
424
|
-
Get the property state: file name
|
|
425
|
-
|
|
426
|
-
## Signature
|
|
427
|
-
|
|
428
|
-
```typescript
|
|
429
|
-
function getState_FileName(): string;
|
|
430
|
-
```
|
|
431
|
-
|
|
432
|
-
## Returns
|
|
433
|
-
|
|
434
|
-
string
|
|
435
|
-
|
|
436
|
-
File name
|
|
437
|
-
|
|
438
|
-
## Example
|
|
439
|
-
|
|
440
|
-
```javascript
|
|
441
|
-
// 1. 生成本次运行专用的坐标,在顶层丝印层放置一个内嵌图片
|
|
442
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
443
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
444
|
-
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
445
|
-
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
446
|
-
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'company-logo.png', false);
|
|
447
|
-
|
|
448
|
-
// 2. 读取图片文件名
|
|
449
|
-
const fileName = obj.getState_FileName();
|
|
450
|
-
|
|
451
|
-
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
452
|
-
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
|
|
453
|
-
|
|
454
|
-
console.log('fileName:', fileName);
|
|
455
|
-
```
|
|
456
|
-
|
|
457
|
-
### getstate_height
|
|
458
|
-
|
|
459
|
-
# IPCB\_PrimitiveObject.getState\_Height() method
|
|
460
|
-
|
|
461
|
-
Get the property state: height
|
|
462
|
-
|
|
463
|
-
## Signature
|
|
464
|
-
|
|
465
|
-
```typescript
|
|
466
|
-
function getState_Height(): number;
|
|
467
|
-
```
|
|
468
|
-
|
|
469
|
-
## Returns
|
|
470
|
-
|
|
471
|
-
number
|
|
472
|
-
|
|
473
|
-
Height
|
|
474
|
-
|
|
475
|
-
## Example
|
|
476
|
-
|
|
477
|
-
```javascript
|
|
478
|
-
// 1. 生成本次运行专用的坐标,在顶层丝印层放置一个 400 x 300 的内嵌图片
|
|
479
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
480
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
481
|
-
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
482
|
-
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
483
|
-
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
484
|
-
|
|
485
|
-
// 2. 读取图片高度
|
|
486
|
-
const height = obj.getState_Height();
|
|
487
|
-
|
|
488
|
-
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
489
|
-
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
|
|
490
|
-
|
|
491
|
-
console.log('height:', height);
|
|
492
|
-
```
|
|
493
|
-
|
|
494
|
-
### getstate_layer
|
|
495
|
-
|
|
496
|
-
# IPCB\_PrimitiveObject.getState\_Layer() method
|
|
497
|
-
|
|
498
|
-
Get the property state: Layer
|
|
499
|
-
|
|
500
|
-
## Signature
|
|
501
|
-
|
|
502
|
-
```typescript
|
|
503
|
-
function getState_Layer(): TPCB_LayersOfObject | undefined;
|
|
504
|
-
```
|
|
505
|
-
|
|
506
|
-
## Returns
|
|
507
|
-
|
|
508
|
-
[TPCB\_LayersOfObject](../types/TPCB_LayersOfObject.md) \| undefined
|
|
509
|
-
|
|
510
|
-
Layer
|
|
511
|
-
|
|
512
|
-
## Example
|
|
513
|
-
|
|
514
|
-
```javascript
|
|
515
|
-
// 1. 生成本次运行专用的坐标,在顶层丝印层放置一个内嵌图片
|
|
516
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
517
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
518
|
-
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
519
|
-
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
520
|
-
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
521
|
-
|
|
522
|
-
// 2. 读取图片所在层(3=顶层丝印)
|
|
523
|
-
const layer = obj.getState_Layer();
|
|
524
|
-
|
|
525
|
-
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
526
|
-
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
|
|
527
|
-
|
|
528
|
-
console.log('layer:', layer);
|
|
529
|
-
```
|
|
530
|
-
|
|
531
|
-
### getstate_mirror
|
|
532
|
-
|
|
533
|
-
# IPCB\_PrimitiveObject.getState\_Mirror() method
|
|
534
|
-
|
|
535
|
-
Get the property state: whether it is horizontally mirrored
|
|
536
|
-
|
|
537
|
-
## Signature
|
|
538
|
-
|
|
539
|
-
```typescript
|
|
540
|
-
function getState_Mirror(): boolean;
|
|
541
|
-
```
|
|
542
|
-
|
|
543
|
-
## Returns
|
|
544
|
-
|
|
545
|
-
boolean
|
|
546
|
-
|
|
547
|
-
Whether it is horizontally mirrored
|
|
548
|
-
|
|
549
|
-
## Example
|
|
550
|
-
|
|
551
|
-
```javascript
|
|
552
|
-
// 1. 生成本次运行专用的坐标,在顶层丝印层放置一个未镜像的内嵌图片
|
|
553
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
554
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
555
|
-
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
556
|
-
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
557
|
-
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
558
|
-
|
|
559
|
-
// 2. 查询是否水平镜像
|
|
560
|
-
const mirror = obj.getState_Mirror();
|
|
561
|
-
|
|
562
|
-
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
563
|
-
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
|
|
564
|
-
|
|
565
|
-
console.log('mirror:', mirror);
|
|
566
|
-
```
|
|
567
|
-
|
|
568
|
-
### getstate_primitiveid
|
|
569
|
-
|
|
570
|
-
# IPCB\_PrimitiveObject.getState\_PrimitiveId() method
|
|
571
|
-
|
|
572
|
-
Get the property state: primitive ID
|
|
573
|
-
|
|
574
|
-
## Signature
|
|
575
|
-
|
|
576
|
-
```typescript
|
|
577
|
-
function getState_PrimitiveId(): string;
|
|
578
|
-
```
|
|
579
|
-
|
|
580
|
-
## Returns
|
|
581
|
-
|
|
582
|
-
string
|
|
583
|
-
|
|
584
|
-
Primitive ID
|
|
585
|
-
|
|
586
|
-
## Example
|
|
587
|
-
|
|
588
|
-
```javascript
|
|
589
|
-
// 1. 生成本次运行专用的坐标,在顶层丝印层放置一个内嵌图片
|
|
590
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
591
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
592
|
-
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
593
|
-
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
594
|
-
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
595
|
-
|
|
596
|
-
// 2. 读取图元 ID
|
|
597
|
-
const primitiveId = obj.getState_PrimitiveId();
|
|
598
|
-
|
|
599
|
-
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
600
|
-
await eda.pcb_PrimitiveObject.delete([primitiveId]);
|
|
601
|
-
|
|
602
|
-
console.log('primitiveId:', primitiveId);
|
|
603
|
-
```
|
|
604
|
-
|
|
605
|
-
### getstate_primitivelock
|
|
606
|
-
|
|
607
|
-
# IPCB\_PrimitiveObject.getState\_PrimitiveLock() method
|
|
608
|
-
|
|
609
|
-
Get the property state: whether it is locked
|
|
610
|
-
|
|
611
|
-
## Signature
|
|
612
|
-
|
|
613
|
-
```typescript
|
|
614
|
-
function getState_PrimitiveLock(): boolean;
|
|
615
|
-
```
|
|
616
|
-
|
|
617
|
-
## Returns
|
|
618
|
-
|
|
619
|
-
boolean
|
|
620
|
-
|
|
621
|
-
Whether it is locked
|
|
622
|
-
|
|
623
|
-
## Example
|
|
624
|
-
|
|
625
|
-
```javascript
|
|
626
|
-
// 1. 生成本次运行专用的坐标,放置一个未锁定的内嵌图片
|
|
627
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
628
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
629
|
-
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
630
|
-
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
631
|
-
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
632
|
-
|
|
633
|
-
// 2. 查询是否锁定
|
|
634
|
-
const primitiveLock = obj.getState_PrimitiveLock();
|
|
635
|
-
|
|
636
|
-
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
637
|
-
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
|
|
638
|
-
|
|
639
|
-
console.log('primitiveLock:', primitiveLock);
|
|
640
|
-
```
|
|
641
|
-
|
|
642
|
-
### getstate_primitivetype
|
|
643
|
-
|
|
644
|
-
# IPCB\_PrimitiveObject.getState\_PrimitiveType() method
|
|
645
|
-
|
|
646
|
-
Get the property state: primitive type
|
|
647
|
-
|
|
648
|
-
## Signature
|
|
649
|
-
|
|
650
|
-
```typescript
|
|
651
|
-
function getState_PrimitiveType(): EPCB_PrimitiveType;
|
|
652
|
-
```
|
|
653
|
-
|
|
654
|
-
## Returns
|
|
655
|
-
|
|
656
|
-
[EPCB\_PrimitiveType](../enums/EPCB_PrimitiveType.md)
|
|
657
|
-
|
|
658
|
-
Primitive type
|
|
659
|
-
|
|
660
|
-
## Example
|
|
661
|
-
|
|
662
|
-
```javascript
|
|
663
|
-
// 1. 生成本次运行专用的坐标,在顶层丝印层放置一个内嵌图片
|
|
664
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
665
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
666
|
-
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
667
|
-
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
668
|
-
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
669
|
-
|
|
670
|
-
// 2. 读取图元类型(内嵌图片固定返回 'Object')
|
|
671
|
-
const primitiveType = obj.getState_PrimitiveType();
|
|
672
|
-
|
|
673
|
-
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
674
|
-
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
|
|
675
|
-
|
|
676
|
-
console.log('primitiveType:', primitiveType);
|
|
677
|
-
```
|
|
678
|
-
|
|
679
|
-
### getstate_rotation
|
|
680
|
-
|
|
681
|
-
# IPCB\_PrimitiveObject.getState\_Rotation() method
|
|
682
|
-
|
|
683
|
-
Get the property state: rotation angle
|
|
684
|
-
|
|
685
|
-
## Signature
|
|
686
|
-
|
|
687
|
-
```typescript
|
|
688
|
-
function getState_Rotation(): number;
|
|
689
|
-
```
|
|
690
|
-
|
|
691
|
-
## Returns
|
|
692
|
-
|
|
693
|
-
number
|
|
694
|
-
|
|
695
|
-
Rotation angle
|
|
696
|
-
|
|
697
|
-
## Example
|
|
698
|
-
|
|
699
|
-
```javascript
|
|
700
|
-
// 1. 生成本次运行专用的坐标,放置一个未旋转的内嵌图片
|
|
701
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
702
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
703
|
-
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
704
|
-
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
705
|
-
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
706
|
-
|
|
707
|
-
// 2. 读取旋转角度
|
|
708
|
-
const rotation = obj.getState_Rotation();
|
|
709
|
-
|
|
710
|
-
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
711
|
-
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
|
|
712
|
-
|
|
713
|
-
console.log('rotation:', rotation);
|
|
714
|
-
```
|
|
715
|
-
|
|
716
|
-
### getstate_topleftx
|
|
717
|
-
|
|
718
|
-
# IPCB\_PrimitiveObject.getState\_TopLeftX() method
|
|
719
|
-
|
|
720
|
-
Get the property state: top-left point X
|
|
721
|
-
|
|
722
|
-
## Signature
|
|
723
|
-
|
|
724
|
-
```typescript
|
|
725
|
-
function getState_TopLeftX(): number | undefined;
|
|
726
|
-
```
|
|
727
|
-
|
|
728
|
-
## Returns
|
|
729
|
-
|
|
730
|
-
number \| undefined
|
|
731
|
-
|
|
732
|
-
Top-left point X
|
|
733
|
-
|
|
734
|
-
## Example
|
|
735
|
-
|
|
736
|
-
```javascript
|
|
737
|
-
// 1. 生成本次运行专用的坐标,放置一个内嵌图片
|
|
738
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
739
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
740
|
-
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
741
|
-
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
742
|
-
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
743
|
-
|
|
744
|
-
// 2. 读取左上角 X 坐标
|
|
745
|
-
const topLeftX = obj.getState_TopLeftX();
|
|
746
|
-
|
|
747
|
-
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
748
|
-
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
|
|
749
|
-
|
|
750
|
-
console.log('topLeftX:', topLeftX);
|
|
751
|
-
```
|
|
752
|
-
|
|
753
|
-
### getstate_toplefty
|
|
754
|
-
|
|
755
|
-
# IPCB\_PrimitiveObject.getState\_TopLeftY() method
|
|
756
|
-
|
|
757
|
-
Get the property state: top-left point Y
|
|
758
|
-
|
|
759
|
-
## Signature
|
|
760
|
-
|
|
761
|
-
```typescript
|
|
762
|
-
function getState_TopLeftY(): number | undefined;
|
|
763
|
-
```
|
|
764
|
-
|
|
765
|
-
## Returns
|
|
766
|
-
|
|
767
|
-
number \| undefined
|
|
768
|
-
|
|
769
|
-
Top-left point Y
|
|
770
|
-
|
|
771
|
-
## Example
|
|
772
|
-
|
|
773
|
-
```javascript
|
|
774
|
-
// 1. 生成本次运行专用的坐标,放置一个内嵌图片
|
|
775
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
776
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
777
|
-
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
778
|
-
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
779
|
-
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
780
|
-
|
|
781
|
-
// 2. 读取左上角 Y 坐标
|
|
782
|
-
const topLeftY = obj.getState_TopLeftY();
|
|
783
|
-
|
|
784
|
-
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
785
|
-
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
|
|
786
|
-
|
|
787
|
-
console.log('topLeftY:', topLeftY);
|
|
788
|
-
```
|
|
789
|
-
|
|
790
|
-
### getstate_width
|
|
791
|
-
|
|
792
|
-
# IPCB\_PrimitiveObject.getState\_Width() method
|
|
793
|
-
|
|
794
|
-
Get the property state: width
|
|
795
|
-
|
|
796
|
-
## Signature
|
|
797
|
-
|
|
798
|
-
```typescript
|
|
799
|
-
function getState_Width(): number;
|
|
800
|
-
```
|
|
801
|
-
|
|
802
|
-
## Returns
|
|
803
|
-
|
|
804
|
-
number
|
|
805
|
-
|
|
806
|
-
Width
|
|
807
|
-
|
|
808
|
-
## Example
|
|
809
|
-
|
|
810
|
-
```javascript
|
|
811
|
-
// 1. 生成本次运行专用的坐标,在顶层丝印层放置一个 400 x 300 的内嵌图片
|
|
812
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
813
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
814
|
-
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
815
|
-
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
816
|
-
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
817
|
-
|
|
818
|
-
// 2. 读取图片宽度
|
|
819
|
-
const width = obj.getState_Width();
|
|
820
|
-
|
|
821
|
-
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
822
|
-
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
|
|
823
|
-
|
|
824
|
-
console.log('width:', width);
|
|
825
|
-
```
|
|
826
|
-
|
|
827
|
-
### isasync
|
|
828
|
-
|
|
829
|
-
# IPCB\_PrimitiveObject.isAsync() method
|
|
830
|
-
|
|
831
|
-
Query whether the primitive is an async primitive
|
|
832
|
-
|
|
833
|
-
## Signature
|
|
834
|
-
|
|
835
|
-
```typescript
|
|
836
|
-
function isAsync(): boolean;
|
|
837
|
-
```
|
|
838
|
-
|
|
839
|
-
## Returns
|
|
840
|
-
|
|
841
|
-
boolean
|
|
842
|
-
|
|
843
|
-
Whether Is async primitive
|
|
844
|
-
|
|
845
|
-
## Example
|
|
846
|
-
|
|
847
|
-
```javascript
|
|
848
|
-
// 1. 生成本次运行专用的坐标,放置一个内嵌图片
|
|
849
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
850
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
851
|
-
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
852
|
-
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
853
|
-
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
854
|
-
|
|
855
|
-
// 2. 查询异步模式
|
|
856
|
-
const isAsync = obj.isAsync();
|
|
857
|
-
|
|
858
|
-
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
859
|
-
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
|
|
860
|
-
|
|
861
|
-
console.log('isAsync:', isAsync);
|
|
862
|
-
```
|
|
863
|
-
|
|
864
|
-
### reset
|
|
865
|
-
|
|
866
|
-
# IPCB\_PrimitiveObject.reset() method
|
|
867
|
-
|
|
868
|
-
> 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.
|
|
869
|
-
|
|
870
|
-
Reset the async primitive to the current canvas state
|
|
871
|
-
|
|
872
|
-
## Signature
|
|
873
|
-
|
|
874
|
-
```typescript
|
|
875
|
-
function reset(): Promise<IPCB_PrimitiveObject>;
|
|
876
|
-
```
|
|
877
|
-
|
|
878
|
-
## Returns
|
|
879
|
-
|
|
880
|
-
Promise<[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)<!-- -->>
|
|
881
|
-
|
|
882
|
-
Binary embedded object primitive object
|
|
883
|
-
|
|
884
|
-
## Example
|
|
885
|
-
|
|
886
|
-
```javascript
|
|
887
|
-
// 1. 生成本次运行专用的坐标,放置一个未旋转的内嵌图片
|
|
888
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
889
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
890
|
-
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
891
|
-
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
892
|
-
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
893
|
-
const before = obj.getState_Rotation();
|
|
894
|
-
|
|
895
|
-
// 2. 异步模式下把图片旋转 90 度,随后反悔
|
|
896
|
-
const asyncObj = obj.toAsync();
|
|
897
|
-
asyncObj.setState_Rotation(90);
|
|
898
|
-
|
|
899
|
-
// 3. reset 丢弃未提交的修改(保留现场供观察)
|
|
900
|
-
await asyncObj.reset();
|
|
901
|
-
|
|
902
|
-
// 4. 从画布重新读取,确认旋转没有变
|
|
903
|
-
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
|
|
904
|
-
|
|
905
|
-
console.log('rotation:', before, '→', refetched.getState_Rotation());
|
|
906
|
-
```
|
|
907
|
-
|
|
908
|
-
### setstate_binarydata
|
|
909
|
-
|
|
910
|
-
# IPCB\_PrimitiveObject.setState\_BinaryData() method
|
|
911
|
-
|
|
912
|
-
Set the property state: binary data
|
|
913
|
-
|
|
914
|
-
## Signature
|
|
915
|
-
|
|
916
|
-
```typescript
|
|
917
|
-
function setState_BinaryData(binaryData: string): IPCB_PrimitiveObject;
|
|
918
|
-
```
|
|
919
|
-
|
|
920
|
-
## Parameters
|
|
921
|
-
|
|
922
|
-
<table><thead><tr><th>
|
|
923
|
-
|
|
924
|
-
Parameter
|
|
925
|
-
|
|
926
|
-
</th><th>
|
|
927
|
-
|
|
928
|
-
Type
|
|
929
|
-
|
|
930
|
-
</th><th>
|
|
931
|
-
|
|
932
|
-
Description
|
|
933
|
-
|
|
934
|
-
</th></tr></thead>
|
|
935
|
-
<tbody><tr><td>
|
|
936
|
-
|
|
937
|
-
binaryData
|
|
938
|
-
|
|
939
|
-
</td><td>
|
|
940
|
-
|
|
941
|
-
string
|
|
942
|
-
|
|
943
|
-
</td><td>
|
|
944
|
-
|
|
945
|
-
Binary data
|
|
946
|
-
|
|
947
|
-
</td></tr>
|
|
948
|
-
</tbody></table>
|
|
949
|
-
|
|
950
|
-
## Returns
|
|
951
|
-
|
|
952
|
-
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
|
|
953
|
-
|
|
954
|
-
Binary embedded object primitive object
|
|
955
|
-
|
|
956
|
-
## Remarks
|
|
957
|
-
|
|
958
|
-
The `binaryData` re-retrieved from the canvas may be a `hashId`<!-- -->, because our backend stores binary embedded object data in object storage,
|
|
959
|
-
|
|
960
|
-
The object storage uses `hashId` as the index. Fully retrieving the data will cause additional requests and consume performance
|
|
961
|
-
|
|
962
|
-
## Example
|
|
963
|
-
|
|
964
|
-
```javascript
|
|
965
|
-
// 1. 生成本次运行专用的坐标,放置一个 4x4 图片的内嵌对象
|
|
966
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
967
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
968
|
-
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
969
|
-
const oldImage = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
970
|
-
// 8x8 纯色 PNG 的 data URI,作为替换用的新图
|
|
971
|
-
const newImage = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAEklEQVR4nGOQi7rzHx9mGBkKAFPclMHPGdtKAAAAAElFTkSuQmCC';
|
|
972
|
-
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, oldImage, 400, 300, 0, false, 'demo.png', false);
|
|
973
|
-
const before = obj.getState_BinaryData().length;
|
|
974
|
-
|
|
975
|
-
// 2. 异步模式替换为新图片数据
|
|
976
|
-
const asyncObj = obj.toAsync();
|
|
977
|
-
asyncObj.setState_BinaryData(newImage);
|
|
978
|
-
await asyncObj.done();
|
|
979
|
-
|
|
980
|
-
// 3. 从画布重新读取,确认数据已更新(保留现场供观察)
|
|
981
|
-
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
|
|
982
|
-
|
|
983
|
-
console.log('binaryData 长度:', before, '→', refetched.getState_BinaryData().length);
|
|
984
|
-
```
|
|
985
|
-
|
|
986
|
-
### setstate_filename
|
|
987
|
-
|
|
988
|
-
# IPCB\_PrimitiveObject.setState\_FileName() method
|
|
989
|
-
|
|
990
|
-
Set the property state: file name
|
|
991
|
-
|
|
992
|
-
## Signature
|
|
993
|
-
|
|
994
|
-
```typescript
|
|
995
|
-
function setState_FileName(fileName: string): IPCB_PrimitiveObject;
|
|
996
|
-
```
|
|
997
|
-
|
|
998
|
-
## Parameters
|
|
999
|
-
|
|
1000
|
-
<table><thead><tr><th>
|
|
1001
|
-
|
|
1002
|
-
Parameter
|
|
1003
|
-
|
|
1004
|
-
</th><th>
|
|
1005
|
-
|
|
1006
|
-
Type
|
|
1007
|
-
|
|
1008
|
-
</th><th>
|
|
1009
|
-
|
|
1010
|
-
Description
|
|
1011
|
-
|
|
1012
|
-
</th></tr></thead>
|
|
1013
|
-
<tbody><tr><td>
|
|
1014
|
-
|
|
1015
|
-
fileName
|
|
1016
|
-
|
|
1017
|
-
</td><td>
|
|
1018
|
-
|
|
1019
|
-
string
|
|
1020
|
-
|
|
1021
|
-
</td><td>
|
|
1022
|
-
|
|
1023
|
-
File name
|
|
1024
|
-
|
|
1025
|
-
</td></tr>
|
|
1026
|
-
</tbody></table>
|
|
1027
|
-
|
|
1028
|
-
## Returns
|
|
1029
|
-
|
|
1030
|
-
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
|
|
1031
|
-
|
|
1032
|
-
Binary embedded object primitive object
|
|
1033
|
-
|
|
1034
|
-
## Example
|
|
1035
|
-
|
|
1036
|
-
```javascript
|
|
1037
|
-
// 1. 生成本次运行专用的坐标,放置一个内嵌图片
|
|
1038
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
1039
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
1040
|
-
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
1041
|
-
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
1042
|
-
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'old-name.png', false);
|
|
1043
|
-
const before = obj.getState_FileName();
|
|
1044
|
-
|
|
1045
|
-
// 2. 异步模式重命名文件
|
|
1046
|
-
const asyncObj = obj.toAsync();
|
|
1047
|
-
asyncObj.setState_FileName('company-logo.png');
|
|
1048
|
-
await asyncObj.done();
|
|
1049
|
-
|
|
1050
|
-
// 3. 从画布重新读取,确认文件名已更新(保留现场供观察)
|
|
1051
|
-
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
|
|
1052
|
-
|
|
1053
|
-
console.log('fileName:', before, '→', refetched.getState_FileName());
|
|
1054
|
-
```
|
|
1055
|
-
|
|
1056
|
-
### setstate_height
|
|
1057
|
-
|
|
1058
|
-
# IPCB\_PrimitiveObject.setState\_Height() method
|
|
1059
|
-
|
|
1060
|
-
Set the property state: height
|
|
1061
|
-
|
|
1062
|
-
## Signature
|
|
1063
|
-
|
|
1064
|
-
```typescript
|
|
1065
|
-
function setState_Height(height: number): IPCB_PrimitiveObject;
|
|
1066
|
-
```
|
|
1067
|
-
|
|
1068
|
-
## Parameters
|
|
1069
|
-
|
|
1070
|
-
<table><thead><tr><th>
|
|
1071
|
-
|
|
1072
|
-
Parameter
|
|
1073
|
-
|
|
1074
|
-
</th><th>
|
|
1075
|
-
|
|
1076
|
-
Type
|
|
1077
|
-
|
|
1078
|
-
</th><th>
|
|
1079
|
-
|
|
1080
|
-
Description
|
|
1081
|
-
|
|
1082
|
-
</th></tr></thead>
|
|
1083
|
-
<tbody><tr><td>
|
|
1084
|
-
|
|
1085
|
-
height
|
|
1086
|
-
|
|
1087
|
-
</td><td>
|
|
1088
|
-
|
|
1089
|
-
number
|
|
1090
|
-
|
|
1091
|
-
</td><td>
|
|
1092
|
-
|
|
1093
|
-
Height
|
|
1094
|
-
|
|
1095
|
-
</td></tr>
|
|
1096
|
-
</tbody></table>
|
|
1097
|
-
|
|
1098
|
-
## Returns
|
|
1099
|
-
|
|
1100
|
-
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
|
|
1101
|
-
|
|
1102
|
-
Binary embedded object primitive object
|
|
1103
|
-
|
|
1104
|
-
## Example
|
|
1105
|
-
|
|
1106
|
-
```javascript
|
|
1107
|
-
// 1. 生成本次运行专用的坐标,放置一个 400 x 300 的内嵌图片
|
|
1108
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
1109
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
1110
|
-
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
1111
|
-
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
1112
|
-
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
1113
|
-
const before = obj.getState_Height();
|
|
1114
|
-
|
|
1115
|
-
// 2. 异步模式把高度从 300 调到 450
|
|
1116
|
-
const asyncObj = obj.toAsync();
|
|
1117
|
-
asyncObj.setState_Height(450);
|
|
1118
|
-
await asyncObj.done();
|
|
1119
|
-
|
|
1120
|
-
// 3. 从画布重新读取,确认高度已更新(保留现场供观察)
|
|
1121
|
-
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
|
|
1122
|
-
|
|
1123
|
-
console.log('height:', before, '→', refetched.getState_Height());
|
|
1124
|
-
```
|
|
1125
|
-
|
|
1126
|
-
### setstate_layer
|
|
1127
|
-
|
|
1128
|
-
# IPCB\_PrimitiveObject.setState\_Layer() method
|
|
1129
|
-
|
|
1130
|
-
> 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.
|
|
1131
|
-
|
|
1132
|
-
Set the property state: Layer
|
|
1133
|
-
|
|
1134
|
-
## Signature
|
|
1135
|
-
|
|
1136
|
-
```typescript
|
|
1137
|
-
function setState_Layer(layer: TPCB_LayersOfObject): IPCB_PrimitiveObject;
|
|
1138
|
-
```
|
|
1139
|
-
|
|
1140
|
-
## Parameters
|
|
1141
|
-
|
|
1142
|
-
<table><thead><tr><th>
|
|
1143
|
-
|
|
1144
|
-
Parameter
|
|
1145
|
-
|
|
1146
|
-
</th><th>
|
|
1147
|
-
|
|
1148
|
-
Type
|
|
1149
|
-
|
|
1150
|
-
</th><th>
|
|
1151
|
-
|
|
1152
|
-
Description
|
|
1153
|
-
|
|
1154
|
-
</th></tr></thead>
|
|
1155
|
-
<tbody><tr><td>
|
|
1156
|
-
|
|
1157
|
-
layer
|
|
1158
|
-
|
|
1159
|
-
</td><td>
|
|
1160
|
-
|
|
1161
|
-
[TPCB\_LayersOfObject](../types/TPCB_LayersOfObject.md)
|
|
1162
|
-
|
|
1163
|
-
</td><td>
|
|
1164
|
-
|
|
1165
|
-
Layer
|
|
1166
|
-
|
|
1167
|
-
</td></tr>
|
|
1168
|
-
</tbody></table>
|
|
1169
|
-
|
|
1170
|
-
## Returns
|
|
1171
|
-
|
|
1172
|
-
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
|
|
1173
|
-
|
|
1174
|
-
Binary embedded object primitive object
|
|
1175
|
-
|
|
1176
|
-
## Example
|
|
1177
|
-
|
|
1178
|
-
```javascript
|
|
1179
|
-
// 1. 生成本次运行专用的坐标,在顶层丝印层放置一个内嵌图片
|
|
1180
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
1181
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
1182
|
-
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
1183
|
-
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
1184
|
-
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
1185
|
-
const before = obj.getState_Layer();
|
|
1186
|
-
|
|
1187
|
-
// 2. 异步模式把图片从顶层丝印(3)挪到底层丝印(4)
|
|
1188
|
-
const asyncObj = obj.toAsync();
|
|
1189
|
-
asyncObj.setState_Layer(4);
|
|
1190
|
-
await asyncObj.done();
|
|
1191
|
-
|
|
1192
|
-
// 3. 从画布重新读取,确认层已切换(保留现场供观察)
|
|
1193
|
-
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
|
|
1194
|
-
|
|
1195
|
-
console.log('layer:', before, '→', refetched.getState_Layer());
|
|
1196
|
-
```
|
|
1197
|
-
|
|
1198
|
-
### setstate_mirror
|
|
1199
|
-
|
|
1200
|
-
# IPCB\_PrimitiveObject.setState\_Mirror() method
|
|
1201
|
-
|
|
1202
|
-
Set the property state: whether it is horizontally mirrored
|
|
1203
|
-
|
|
1204
|
-
## Signature
|
|
1205
|
-
|
|
1206
|
-
```typescript
|
|
1207
|
-
function setState_Mirror(mirror: boolean): IPCB_PrimitiveObject;
|
|
1208
|
-
```
|
|
1209
|
-
|
|
1210
|
-
## Parameters
|
|
1211
|
-
|
|
1212
|
-
<table><thead><tr><th>
|
|
1213
|
-
|
|
1214
|
-
Parameter
|
|
1215
|
-
|
|
1216
|
-
</th><th>
|
|
1217
|
-
|
|
1218
|
-
Type
|
|
1219
|
-
|
|
1220
|
-
</th><th>
|
|
1221
|
-
|
|
1222
|
-
Description
|
|
1223
|
-
|
|
1224
|
-
</th></tr></thead>
|
|
1225
|
-
<tbody><tr><td>
|
|
1226
|
-
|
|
1227
|
-
mirror
|
|
1228
|
-
|
|
1229
|
-
</td><td>
|
|
1230
|
-
|
|
1231
|
-
boolean
|
|
1232
|
-
|
|
1233
|
-
</td><td>
|
|
1234
|
-
|
|
1235
|
-
Whether it is horizontally mirrored
|
|
1236
|
-
|
|
1237
|
-
</td></tr>
|
|
1238
|
-
</tbody></table>
|
|
1239
|
-
|
|
1240
|
-
## Returns
|
|
1241
|
-
|
|
1242
|
-
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
|
|
1243
|
-
|
|
1244
|
-
Binary embedded object primitive object
|
|
1245
|
-
|
|
1246
|
-
## Example
|
|
1247
|
-
|
|
1248
|
-
```javascript
|
|
1249
|
-
// 1. 生成本次运行专用的坐标,在底层丝印层(4)放置一个未镜像的图片
|
|
1250
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
1251
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
1252
|
-
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
1253
|
-
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
1254
|
-
const obj = await eda.pcb_PrimitiveObject.create(4, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
1255
|
-
const before = obj.getState_Mirror();
|
|
1256
|
-
|
|
1257
|
-
// 2. 异步模式打开水平镜像
|
|
1258
|
-
const asyncObj = obj.toAsync();
|
|
1259
|
-
asyncObj.setState_Mirror(true);
|
|
1260
|
-
await asyncObj.done();
|
|
1261
|
-
|
|
1262
|
-
// 3. 从画布重新读取,确认镜像已开启(保留现场供观察)
|
|
1263
|
-
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
|
|
1264
|
-
|
|
1265
|
-
console.log('mirror:', before, '→', refetched.getState_Mirror());
|
|
1266
|
-
```
|
|
1267
|
-
|
|
1268
|
-
### setstate_primitivelock
|
|
1269
|
-
|
|
1270
|
-
# IPCB\_PrimitiveObject.setState\_PrimitiveLock() method
|
|
1271
|
-
|
|
1272
|
-
> 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.
|
|
1273
|
-
|
|
1274
|
-
Set the property state: whether it is locked
|
|
1275
|
-
|
|
1276
|
-
## Signature
|
|
1277
|
-
|
|
1278
|
-
```typescript
|
|
1279
|
-
function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitiveObject;
|
|
1280
|
-
```
|
|
1281
|
-
|
|
1282
|
-
## Parameters
|
|
1283
|
-
|
|
1284
|
-
<table><thead><tr><th>
|
|
1285
|
-
|
|
1286
|
-
Parameter
|
|
1287
|
-
|
|
1288
|
-
</th><th>
|
|
1289
|
-
|
|
1290
|
-
Type
|
|
1291
|
-
|
|
1292
|
-
</th><th>
|
|
1293
|
-
|
|
1294
|
-
Description
|
|
1295
|
-
|
|
1296
|
-
</th></tr></thead>
|
|
1297
|
-
<tbody><tr><td>
|
|
1298
|
-
|
|
1299
|
-
primitiveLock
|
|
1300
|
-
|
|
1301
|
-
</td><td>
|
|
1302
|
-
|
|
1303
|
-
boolean
|
|
1304
|
-
|
|
1305
|
-
</td><td>
|
|
1306
|
-
|
|
1307
|
-
Whether it is locked
|
|
1308
|
-
|
|
1309
|
-
</td></tr>
|
|
1310
|
-
</tbody></table>
|
|
1311
|
-
|
|
1312
|
-
## Returns
|
|
1313
|
-
|
|
1314
|
-
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
|
|
1315
|
-
|
|
1316
|
-
Binary embedded object primitive object
|
|
1317
|
-
|
|
1318
|
-
## Example
|
|
1319
|
-
|
|
1320
|
-
```javascript
|
|
1321
|
-
// 1. 生成本次运行专用的坐标,放置一个未锁定的内嵌图片
|
|
1322
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
1323
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
1324
|
-
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
1325
|
-
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
1326
|
-
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
1327
|
-
const before = obj.getState_PrimitiveLock();
|
|
1328
|
-
|
|
1329
|
-
// 2. 异步模式锁定图元
|
|
1330
|
-
const asyncObj = obj.toAsync();
|
|
1331
|
-
asyncObj.setState_PrimitiveLock(true);
|
|
1332
|
-
await asyncObj.done();
|
|
1333
|
-
|
|
1334
|
-
// 3. 从画布重新读取,确认已锁定(保留现场供观察)
|
|
1335
|
-
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
|
|
1336
|
-
|
|
1337
|
-
console.log('primitiveLock:', before, '→', refetched.getState_PrimitiveLock());
|
|
1338
|
-
```
|
|
1339
|
-
|
|
1340
|
-
### setstate_rotation
|
|
1341
|
-
|
|
1342
|
-
# IPCB\_PrimitiveObject.setState\_Rotation() method
|
|
1343
|
-
|
|
1344
|
-
Set the property state: rotation angle
|
|
1345
|
-
|
|
1346
|
-
## Signature
|
|
1347
|
-
|
|
1348
|
-
```typescript
|
|
1349
|
-
function setState_Rotation(rotation: number): IPCB_PrimitiveObject;
|
|
1350
|
-
```
|
|
1351
|
-
|
|
1352
|
-
## Parameters
|
|
1353
|
-
|
|
1354
|
-
<table><thead><tr><th>
|
|
1355
|
-
|
|
1356
|
-
Parameter
|
|
1357
|
-
|
|
1358
|
-
</th><th>
|
|
1359
|
-
|
|
1360
|
-
Type
|
|
1361
|
-
|
|
1362
|
-
</th><th>
|
|
1363
|
-
|
|
1364
|
-
Description
|
|
1365
|
-
|
|
1366
|
-
</th></tr></thead>
|
|
1367
|
-
<tbody><tr><td>
|
|
1368
|
-
|
|
1369
|
-
rotation
|
|
1370
|
-
|
|
1371
|
-
</td><td>
|
|
1372
|
-
|
|
1373
|
-
number
|
|
1374
|
-
|
|
1375
|
-
</td><td>
|
|
1376
|
-
|
|
1377
|
-
Rotation angle
|
|
1378
|
-
|
|
1379
|
-
</td></tr>
|
|
1380
|
-
</tbody></table>
|
|
1381
|
-
|
|
1382
|
-
## Returns
|
|
1383
|
-
|
|
1384
|
-
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
|
|
1385
|
-
|
|
1386
|
-
Binary embedded object primitive object
|
|
1387
|
-
|
|
1388
|
-
## Example
|
|
1389
|
-
|
|
1390
|
-
```javascript
|
|
1391
|
-
// 1. 生成本次运行专用的坐标,放置一个未旋转的内嵌图片
|
|
1392
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
1393
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
1394
|
-
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
1395
|
-
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
1396
|
-
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
1397
|
-
const before = obj.getState_Rotation();
|
|
1398
|
-
|
|
1399
|
-
// 2. 异步模式旋转 90 度
|
|
1400
|
-
const asyncObj = obj.toAsync();
|
|
1401
|
-
asyncObj.setState_Rotation(90);
|
|
1402
|
-
await asyncObj.done();
|
|
1403
|
-
|
|
1404
|
-
// 3. 从画布重新读取,确认角度已更新(保留现场供观察)
|
|
1405
|
-
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
|
|
1406
|
-
|
|
1407
|
-
console.log('rotation:', before, '→', refetched.getState_Rotation());
|
|
1408
|
-
```
|
|
1409
|
-
|
|
1410
|
-
### setstate_topleftx
|
|
1411
|
-
|
|
1412
|
-
# IPCB\_PrimitiveObject.setState\_TopLeftX() method
|
|
1413
|
-
|
|
1414
|
-
Set the property state: top-left point X
|
|
1415
|
-
|
|
1416
|
-
## Signature
|
|
1417
|
-
|
|
1418
|
-
```typescript
|
|
1419
|
-
function setState_TopLeftX(topLeftX: number): IPCB_PrimitiveObject;
|
|
1420
|
-
```
|
|
1421
|
-
|
|
1422
|
-
## Parameters
|
|
1423
|
-
|
|
1424
|
-
<table><thead><tr><th>
|
|
1425
|
-
|
|
1426
|
-
Parameter
|
|
1427
|
-
|
|
1428
|
-
</th><th>
|
|
1429
|
-
|
|
1430
|
-
Type
|
|
1431
|
-
|
|
1432
|
-
</th><th>
|
|
1433
|
-
|
|
1434
|
-
Description
|
|
1435
|
-
|
|
1436
|
-
</th></tr></thead>
|
|
1437
|
-
<tbody><tr><td>
|
|
1438
|
-
|
|
1439
|
-
topLeftX
|
|
1440
|
-
|
|
1441
|
-
</td><td>
|
|
1442
|
-
|
|
1443
|
-
number
|
|
1444
|
-
|
|
1445
|
-
</td><td>
|
|
1446
|
-
|
|
1447
|
-
Top-left point X
|
|
1448
|
-
|
|
1449
|
-
</td></tr>
|
|
1450
|
-
</tbody></table>
|
|
1451
|
-
|
|
1452
|
-
## Returns
|
|
1453
|
-
|
|
1454
|
-
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
|
|
1455
|
-
|
|
1456
|
-
Binary embedded object primitive object
|
|
1457
|
-
|
|
1458
|
-
## Example
|
|
1459
|
-
|
|
1460
|
-
```javascript
|
|
1461
|
-
// 1. 生成本次运行专用的坐标,放置一个内嵌图片
|
|
1462
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
1463
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
1464
|
-
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
1465
|
-
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
1466
|
-
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
1467
|
-
const before = obj.getState_TopLeftX();
|
|
1468
|
-
|
|
1469
|
-
// 2. 异步模式水平右移 500mil
|
|
1470
|
-
const asyncObj = obj.toAsync();
|
|
1471
|
-
asyncObj.setState_TopLeftX(before + 500);
|
|
1472
|
-
await asyncObj.done();
|
|
1473
|
-
|
|
1474
|
-
// 3. 从画布重新读取,确认 X 已更新(保留现场供观察)
|
|
1475
|
-
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
|
|
1476
|
-
|
|
1477
|
-
console.log('topLeftX:', before, '→', refetched.getState_TopLeftX());
|
|
1478
|
-
```
|
|
1479
|
-
|
|
1480
|
-
### setstate_toplefty
|
|
1481
|
-
|
|
1482
|
-
# IPCB\_PrimitiveObject.setState\_TopLeftY() method
|
|
1483
|
-
|
|
1484
|
-
Set the property state: top-left point Y
|
|
1485
|
-
|
|
1486
|
-
## Signature
|
|
1487
|
-
|
|
1488
|
-
```typescript
|
|
1489
|
-
function setState_TopLeftY(topLeftY: number): IPCB_PrimitiveObject;
|
|
1490
|
-
```
|
|
1491
|
-
|
|
1492
|
-
## Parameters
|
|
1493
|
-
|
|
1494
|
-
<table><thead><tr><th>
|
|
1495
|
-
|
|
1496
|
-
Parameter
|
|
1497
|
-
|
|
1498
|
-
</th><th>
|
|
1499
|
-
|
|
1500
|
-
Type
|
|
1501
|
-
|
|
1502
|
-
</th><th>
|
|
1503
|
-
|
|
1504
|
-
Description
|
|
1505
|
-
|
|
1506
|
-
</th></tr></thead>
|
|
1507
|
-
<tbody><tr><td>
|
|
1508
|
-
|
|
1509
|
-
topLeftY
|
|
1510
|
-
|
|
1511
|
-
</td><td>
|
|
1512
|
-
|
|
1513
|
-
number
|
|
1514
|
-
|
|
1515
|
-
</td><td>
|
|
1516
|
-
|
|
1517
|
-
Top-left point Y
|
|
1518
|
-
|
|
1519
|
-
</td></tr>
|
|
1520
|
-
</tbody></table>
|
|
1521
|
-
|
|
1522
|
-
## Returns
|
|
1523
|
-
|
|
1524
|
-
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
|
|
1525
|
-
|
|
1526
|
-
Binary embedded object primitive object
|
|
1527
|
-
|
|
1528
|
-
## Example
|
|
1529
|
-
|
|
1530
|
-
```javascript
|
|
1531
|
-
// 1. 生成本次运行专用的坐标,放置一个内嵌图片
|
|
1532
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
1533
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
1534
|
-
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
1535
|
-
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
1536
|
-
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
1537
|
-
const before = obj.getState_TopLeftY();
|
|
1538
|
-
|
|
1539
|
-
// 2. 异步模式垂直上移 500mil
|
|
1540
|
-
const asyncObj = obj.toAsync();
|
|
1541
|
-
asyncObj.setState_TopLeftY(before - 500);
|
|
1542
|
-
await asyncObj.done();
|
|
1543
|
-
|
|
1544
|
-
// 3. 从画布重新读取,确认 Y 已更新(保留现场供观察)
|
|
1545
|
-
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
|
|
1546
|
-
|
|
1547
|
-
console.log('topLeftY:', before, '→', refetched.getState_TopLeftY());
|
|
1548
|
-
```
|
|
1549
|
-
|
|
1550
|
-
### setstate_width
|
|
1551
|
-
|
|
1552
|
-
# IPCB\_PrimitiveObject.setState\_Width() method
|
|
1553
|
-
|
|
1554
|
-
Set the property state: width
|
|
1555
|
-
|
|
1556
|
-
## Signature
|
|
1557
|
-
|
|
1558
|
-
```typescript
|
|
1559
|
-
function setState_Width(width: number): IPCB_PrimitiveObject;
|
|
1560
|
-
```
|
|
1561
|
-
|
|
1562
|
-
## Parameters
|
|
1563
|
-
|
|
1564
|
-
<table><thead><tr><th>
|
|
1565
|
-
|
|
1566
|
-
Parameter
|
|
1567
|
-
|
|
1568
|
-
</th><th>
|
|
1569
|
-
|
|
1570
|
-
Type
|
|
1571
|
-
|
|
1572
|
-
</th><th>
|
|
1573
|
-
|
|
1574
|
-
Description
|
|
1575
|
-
|
|
1576
|
-
</th></tr></thead>
|
|
1577
|
-
<tbody><tr><td>
|
|
1578
|
-
|
|
1579
|
-
width
|
|
1580
|
-
|
|
1581
|
-
</td><td>
|
|
1582
|
-
|
|
1583
|
-
number
|
|
1584
|
-
|
|
1585
|
-
</td><td>
|
|
1586
|
-
|
|
1587
|
-
Width
|
|
1588
|
-
|
|
1589
|
-
</td></tr>
|
|
1590
|
-
</tbody></table>
|
|
1591
|
-
|
|
1592
|
-
## Returns
|
|
1593
|
-
|
|
1594
|
-
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
|
|
1595
|
-
|
|
1596
|
-
Binary embedded object primitive object
|
|
1597
|
-
|
|
1598
|
-
## Example
|
|
1599
|
-
|
|
1600
|
-
```javascript
|
|
1601
|
-
// 1. 生成本次运行专用的坐标,放置一个 400 x 300 的内嵌图片
|
|
1602
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
1603
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
1604
|
-
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
1605
|
-
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
1606
|
-
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
1607
|
-
const before = obj.getState_Width();
|
|
1608
|
-
|
|
1609
|
-
// 2. 异步模式把宽度从 400 调到 600
|
|
1610
|
-
const asyncObj = obj.toAsync();
|
|
1611
|
-
asyncObj.setState_Width(600);
|
|
1612
|
-
await asyncObj.done();
|
|
1613
|
-
|
|
1614
|
-
// 3. 从画布重新读取,确认宽度已更新(保留现场供观察)
|
|
1615
|
-
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
|
|
1616
|
-
|
|
1617
|
-
console.log('width:', before, '→', refetched.getState_Width());
|
|
1618
|
-
```
|
|
1619
|
-
|
|
1620
|
-
### toasync
|
|
1621
|
-
|
|
1622
|
-
# IPCB\_PrimitiveObject.toAsync() method
|
|
1623
|
-
|
|
1624
|
-
Convert Primitive to Async primitive
|
|
1625
|
-
|
|
1626
|
-
## Signature
|
|
1627
|
-
|
|
1628
|
-
```typescript
|
|
1629
|
-
function toAsync(): IPCB_PrimitiveObject;
|
|
1630
|
-
```
|
|
1631
|
-
|
|
1632
|
-
## Returns
|
|
1633
|
-
|
|
1634
|
-
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
|
|
1635
|
-
|
|
1636
|
-
Binary embedded object primitive object
|
|
1637
|
-
|
|
1638
|
-
## Example
|
|
1639
|
-
|
|
1640
|
-
```javascript
|
|
1641
|
-
// 1. 生成本次运行专用的坐标,放置一个 400 x 300 的内嵌图片
|
|
1642
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
1643
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
1644
|
-
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
1645
|
-
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
1646
|
-
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
1647
|
-
|
|
1648
|
-
// 2. 切换异步模式后批量修改:放大到 600 x 450 并重命名
|
|
1649
|
-
const asyncObj = obj.toAsync();
|
|
1650
|
-
asyncObj.setState_Width(600);
|
|
1651
|
-
asyncObj.setState_Height(450);
|
|
1652
|
-
asyncObj.setState_FileName('logo-large.png');
|
|
1653
|
-
await asyncObj.done();
|
|
1654
|
-
|
|
1655
|
-
// 3. 从画布重新读取,确认批量修改已生效(保留现场供观察)
|
|
1656
|
-
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
|
|
1657
|
-
|
|
1658
|
-
console.log('width:', refetched.getState_Width());
|
|
1659
|
-
console.log('height:', refetched.getState_Height());
|
|
1660
|
-
console.log('fileName:', refetched.getState_FileName());
|
|
1661
|
-
```
|
|
1662
|
-
|
|
1663
|
-
### tosync
|
|
1664
|
-
|
|
1665
|
-
# IPCB\_PrimitiveObject.toSync() method
|
|
1666
|
-
|
|
1667
|
-
Convert Primitive to Sync primitive
|
|
1668
|
-
|
|
1669
|
-
## Signature
|
|
1670
|
-
|
|
1671
|
-
```typescript
|
|
1672
|
-
function toSync(): IPCB_PrimitiveObject;
|
|
1673
|
-
```
|
|
1674
|
-
|
|
1675
|
-
## Returns
|
|
1676
|
-
|
|
1677
|
-
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
|
|
1678
|
-
|
|
1679
|
-
Binary embedded object primitive object
|
|
1680
|
-
|
|
1681
|
-
## Example
|
|
1682
|
-
|
|
1683
|
-
```javascript
|
|
1684
|
-
// 1. 生成本次运行专用的坐标,放置一个内嵌图片
|
|
1685
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
1686
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
1687
|
-
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
1688
|
-
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
1689
|
-
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
1690
|
-
const before = obj.isAsync();
|
|
1691
|
-
|
|
1692
|
-
// 2. 转换为同步图元(保留现场供观察)
|
|
1693
|
-
const syncObj = obj.toSync();
|
|
1694
|
-
const after = syncObj.isAsync();
|
|
1695
|
-
|
|
1696
|
-
// 3. 同步图元直接读取属性,无需提交
|
|
1697
|
-
console.log('isAsync:', before, '→', after);
|
|
1698
|
-
console.log('primitiveType:', syncObj.getState_PrimitiveType());
|
|
1699
|
-
console.log('layer:', syncObj.getState_Layer());
|
|
1700
|
-
```
|
|
1
|
+
# IPCB\_PrimitiveObject class
|
|
2
|
+
|
|
3
|
+
Binary embedded object primitive
|
|
4
|
+
|
|
5
|
+
## Signature
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
class IPCB_PrimitiveObject implements IPCB_Primitive
|
|
9
|
+
```
|
|
10
|
+
**Implements:** [IPCB\_Primitive](../interfaces/IPCB_Primitive.md)
|
|
11
|
+
|
|
12
|
+
## Remarks
|
|
13
|
+
|
|
14
|
+
## Methods
|
|
15
|
+
|
|
16
|
+
<table><thead><tr><th>
|
|
17
|
+
|
|
18
|
+
Method
|
|
19
|
+
|
|
20
|
+
</th><th>
|
|
21
|
+
|
|
22
|
+
Modifiers
|
|
23
|
+
|
|
24
|
+
</th><th>
|
|
25
|
+
|
|
26
|
+
Description
|
|
27
|
+
|
|
28
|
+
</th></tr></thead>
|
|
29
|
+
<tbody><tr><td>
|
|
30
|
+
|
|
31
|
+
[done()](./IPCB_PrimitiveObject.md)
|
|
32
|
+
|
|
33
|
+
</td><td>
|
|
34
|
+
|
|
35
|
+
</td><td>
|
|
36
|
+
|
|
37
|
+
**_(BETA)_** Apply the changes to the primitives to the canvas
|
|
38
|
+
|
|
39
|
+
</td></tr>
|
|
40
|
+
<tr><td>
|
|
41
|
+
|
|
42
|
+
[getState\_BinaryData()](./IPCB_PrimitiveObject.md)
|
|
43
|
+
|
|
44
|
+
</td><td>
|
|
45
|
+
|
|
46
|
+
</td><td>
|
|
47
|
+
|
|
48
|
+
Get the property state: binary data
|
|
49
|
+
|
|
50
|
+
</td></tr>
|
|
51
|
+
<tr><td>
|
|
52
|
+
|
|
53
|
+
[getState\_FileName()](./IPCB_PrimitiveObject.md)
|
|
54
|
+
|
|
55
|
+
</td><td>
|
|
56
|
+
|
|
57
|
+
</td><td>
|
|
58
|
+
|
|
59
|
+
Get the property state: file name
|
|
60
|
+
|
|
61
|
+
</td></tr>
|
|
62
|
+
<tr><td>
|
|
63
|
+
|
|
64
|
+
[getState\_Height()](./IPCB_PrimitiveObject.md)
|
|
65
|
+
|
|
66
|
+
</td><td>
|
|
67
|
+
|
|
68
|
+
</td><td>
|
|
69
|
+
|
|
70
|
+
Get the property state: height
|
|
71
|
+
|
|
72
|
+
</td></tr>
|
|
73
|
+
<tr><td>
|
|
74
|
+
|
|
75
|
+
[getState\_Layer()](./IPCB_PrimitiveObject.md)
|
|
76
|
+
|
|
77
|
+
</td><td>
|
|
78
|
+
|
|
79
|
+
</td><td>
|
|
80
|
+
|
|
81
|
+
Get the property state: Layer
|
|
82
|
+
|
|
83
|
+
</td></tr>
|
|
84
|
+
<tr><td>
|
|
85
|
+
|
|
86
|
+
[getState\_Mirror()](./IPCB_PrimitiveObject.md)
|
|
87
|
+
|
|
88
|
+
</td><td>
|
|
89
|
+
|
|
90
|
+
</td><td>
|
|
91
|
+
|
|
92
|
+
Get the property state: whether it is horizontally mirrored
|
|
93
|
+
|
|
94
|
+
</td></tr>
|
|
95
|
+
<tr><td>
|
|
96
|
+
|
|
97
|
+
[getState\_PrimitiveId()](./IPCB_PrimitiveObject.md)
|
|
98
|
+
|
|
99
|
+
</td><td>
|
|
100
|
+
|
|
101
|
+
</td><td>
|
|
102
|
+
|
|
103
|
+
Get the property state: primitive ID
|
|
104
|
+
|
|
105
|
+
</td></tr>
|
|
106
|
+
<tr><td>
|
|
107
|
+
|
|
108
|
+
[getState\_PrimitiveLock()](./IPCB_PrimitiveObject.md)
|
|
109
|
+
|
|
110
|
+
</td><td>
|
|
111
|
+
|
|
112
|
+
</td><td>
|
|
113
|
+
|
|
114
|
+
Get the property state: whether it is locked
|
|
115
|
+
|
|
116
|
+
</td></tr>
|
|
117
|
+
<tr><td>
|
|
118
|
+
|
|
119
|
+
[getState\_PrimitiveType()](./IPCB_PrimitiveObject.md)
|
|
120
|
+
|
|
121
|
+
</td><td>
|
|
122
|
+
|
|
123
|
+
</td><td>
|
|
124
|
+
|
|
125
|
+
Get the property state: primitive type
|
|
126
|
+
|
|
127
|
+
</td></tr>
|
|
128
|
+
<tr><td>
|
|
129
|
+
|
|
130
|
+
[getState\_Rotation()](./IPCB_PrimitiveObject.md)
|
|
131
|
+
|
|
132
|
+
</td><td>
|
|
133
|
+
|
|
134
|
+
</td><td>
|
|
135
|
+
|
|
136
|
+
Get the property state: rotation angle
|
|
137
|
+
|
|
138
|
+
</td></tr>
|
|
139
|
+
<tr><td>
|
|
140
|
+
|
|
141
|
+
[getState\_TopLeftX()](./IPCB_PrimitiveObject.md)
|
|
142
|
+
|
|
143
|
+
</td><td>
|
|
144
|
+
|
|
145
|
+
</td><td>
|
|
146
|
+
|
|
147
|
+
Get the property state: top-left point X
|
|
148
|
+
|
|
149
|
+
</td></tr>
|
|
150
|
+
<tr><td>
|
|
151
|
+
|
|
152
|
+
[getState\_TopLeftY()](./IPCB_PrimitiveObject.md)
|
|
153
|
+
|
|
154
|
+
</td><td>
|
|
155
|
+
|
|
156
|
+
</td><td>
|
|
157
|
+
|
|
158
|
+
Get the property state: top-left point Y
|
|
159
|
+
|
|
160
|
+
</td></tr>
|
|
161
|
+
<tr><td>
|
|
162
|
+
|
|
163
|
+
[getState\_Width()](./IPCB_PrimitiveObject.md)
|
|
164
|
+
|
|
165
|
+
</td><td>
|
|
166
|
+
|
|
167
|
+
</td><td>
|
|
168
|
+
|
|
169
|
+
Get the property state: width
|
|
170
|
+
|
|
171
|
+
</td></tr>
|
|
172
|
+
<tr><td>
|
|
173
|
+
|
|
174
|
+
[isAsync()](./IPCB_PrimitiveObject.md)
|
|
175
|
+
|
|
176
|
+
</td><td>
|
|
177
|
+
|
|
178
|
+
</td><td>
|
|
179
|
+
|
|
180
|
+
Query whether the primitive is an async primitive
|
|
181
|
+
|
|
182
|
+
</td></tr>
|
|
183
|
+
<tr><td>
|
|
184
|
+
|
|
185
|
+
[reset()](./IPCB_PrimitiveObject.md)
|
|
186
|
+
|
|
187
|
+
</td><td>
|
|
188
|
+
|
|
189
|
+
</td><td>
|
|
190
|
+
|
|
191
|
+
**_(BETA)_** Reset the async primitive to the current canvas state
|
|
192
|
+
|
|
193
|
+
</td></tr>
|
|
194
|
+
<tr><td>
|
|
195
|
+
|
|
196
|
+
[setState\_BinaryData(binaryData)](./IPCB_PrimitiveObject.md)
|
|
197
|
+
|
|
198
|
+
</td><td>
|
|
199
|
+
|
|
200
|
+
</td><td>
|
|
201
|
+
|
|
202
|
+
Set the property state: binary data
|
|
203
|
+
|
|
204
|
+
</td></tr>
|
|
205
|
+
<tr><td>
|
|
206
|
+
|
|
207
|
+
[setState\_FileName(fileName)](./IPCB_PrimitiveObject.md)
|
|
208
|
+
|
|
209
|
+
</td><td>
|
|
210
|
+
|
|
211
|
+
</td><td>
|
|
212
|
+
|
|
213
|
+
Set the property state: file name
|
|
214
|
+
|
|
215
|
+
</td></tr>
|
|
216
|
+
<tr><td>
|
|
217
|
+
|
|
218
|
+
[setState\_Height(height)](./IPCB_PrimitiveObject.md)
|
|
219
|
+
|
|
220
|
+
</td><td>
|
|
221
|
+
|
|
222
|
+
</td><td>
|
|
223
|
+
|
|
224
|
+
Set the property state: height
|
|
225
|
+
|
|
226
|
+
</td></tr>
|
|
227
|
+
<tr><td>
|
|
228
|
+
|
|
229
|
+
[setState\_Layer(layer)](./IPCB_PrimitiveObject.md)
|
|
230
|
+
|
|
231
|
+
</td><td>
|
|
232
|
+
|
|
233
|
+
</td><td>
|
|
234
|
+
|
|
235
|
+
**_(BETA)_** Set the property state: Layer
|
|
236
|
+
|
|
237
|
+
</td></tr>
|
|
238
|
+
<tr><td>
|
|
239
|
+
|
|
240
|
+
[setState\_Mirror(mirror)](./IPCB_PrimitiveObject.md)
|
|
241
|
+
|
|
242
|
+
</td><td>
|
|
243
|
+
|
|
244
|
+
</td><td>
|
|
245
|
+
|
|
246
|
+
Set the property state: whether it is horizontally mirrored
|
|
247
|
+
|
|
248
|
+
</td></tr>
|
|
249
|
+
<tr><td>
|
|
250
|
+
|
|
251
|
+
[setState\_PrimitiveLock(primitiveLock)](./IPCB_PrimitiveObject.md)
|
|
252
|
+
|
|
253
|
+
</td><td>
|
|
254
|
+
|
|
255
|
+
</td><td>
|
|
256
|
+
|
|
257
|
+
**_(BETA)_** Set the property state: whether it is locked
|
|
258
|
+
|
|
259
|
+
</td></tr>
|
|
260
|
+
<tr><td>
|
|
261
|
+
|
|
262
|
+
[setState\_Rotation(rotation)](./IPCB_PrimitiveObject.md)
|
|
263
|
+
|
|
264
|
+
</td><td>
|
|
265
|
+
|
|
266
|
+
</td><td>
|
|
267
|
+
|
|
268
|
+
Set the property state: rotation angle
|
|
269
|
+
|
|
270
|
+
</td></tr>
|
|
271
|
+
<tr><td>
|
|
272
|
+
|
|
273
|
+
[setState\_TopLeftX(topLeftX)](./IPCB_PrimitiveObject.md)
|
|
274
|
+
|
|
275
|
+
</td><td>
|
|
276
|
+
|
|
277
|
+
</td><td>
|
|
278
|
+
|
|
279
|
+
Set the property state: top-left point X
|
|
280
|
+
|
|
281
|
+
</td></tr>
|
|
282
|
+
<tr><td>
|
|
283
|
+
|
|
284
|
+
[setState\_TopLeftY(topLeftY)](./IPCB_PrimitiveObject.md)
|
|
285
|
+
|
|
286
|
+
</td><td>
|
|
287
|
+
|
|
288
|
+
</td><td>
|
|
289
|
+
|
|
290
|
+
Set the property state: top-left point Y
|
|
291
|
+
|
|
292
|
+
</td></tr>
|
|
293
|
+
<tr><td>
|
|
294
|
+
|
|
295
|
+
[setState\_Width(width)](./IPCB_PrimitiveObject.md)
|
|
296
|
+
|
|
297
|
+
</td><td>
|
|
298
|
+
|
|
299
|
+
</td><td>
|
|
300
|
+
|
|
301
|
+
Set the property state: width
|
|
302
|
+
|
|
303
|
+
</td></tr>
|
|
304
|
+
<tr><td>
|
|
305
|
+
|
|
306
|
+
[toAsync()](./IPCB_PrimitiveObject.md)
|
|
307
|
+
|
|
308
|
+
</td><td>
|
|
309
|
+
|
|
310
|
+
</td><td>
|
|
311
|
+
|
|
312
|
+
Convert Primitive to Async primitive
|
|
313
|
+
|
|
314
|
+
</td></tr>
|
|
315
|
+
<tr><td>
|
|
316
|
+
|
|
317
|
+
[toSync()](./IPCB_PrimitiveObject.md)
|
|
318
|
+
|
|
319
|
+
</td><td>
|
|
320
|
+
|
|
321
|
+
</td><td>
|
|
322
|
+
|
|
323
|
+
Convert Primitive to Sync primitive
|
|
324
|
+
|
|
325
|
+
</td></tr>
|
|
326
|
+
</tbody></table>
|
|
327
|
+
|
|
328
|
+
---
|
|
329
|
+
|
|
330
|
+
## 方法详情
|
|
331
|
+
|
|
332
|
+
### done
|
|
333
|
+
|
|
334
|
+
# IPCB\_PrimitiveObject.done() method
|
|
335
|
+
|
|
336
|
+
> 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.
|
|
337
|
+
|
|
338
|
+
Apply the changes to the primitives to the canvas
|
|
339
|
+
|
|
340
|
+
## Signature
|
|
341
|
+
|
|
342
|
+
```typescript
|
|
343
|
+
function done(): Promise<IPCB_PrimitiveObject>;
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
## Returns
|
|
347
|
+
|
|
348
|
+
Promise<[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)<!-- -->>
|
|
349
|
+
|
|
350
|
+
Binary embedded object primitive object
|
|
351
|
+
|
|
352
|
+
## Example
|
|
353
|
+
|
|
354
|
+
```javascript
|
|
355
|
+
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
|
|
356
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
357
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
358
|
+
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
359
|
+
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
360
|
+
|
|
361
|
+
// 2. 放置一个未旋转的内嵌图片
|
|
362
|
+
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
363
|
+
const before = obj.getState_Rotation();
|
|
364
|
+
|
|
365
|
+
// 3. 异步模式下旋转 90 度(此时画布还没变)
|
|
366
|
+
const asyncObj = obj.toAsync();
|
|
367
|
+
asyncObj.setState_Rotation(90);
|
|
368
|
+
await asyncObj.done();
|
|
369
|
+
|
|
370
|
+
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
|
|
371
|
+
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
|
|
372
|
+
|
|
373
|
+
console.log('rotation:', before, '→', refetched.getState_Rotation());
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### getstate_binarydata
|
|
377
|
+
|
|
378
|
+
# IPCB\_PrimitiveObject.getState\_BinaryData() method
|
|
379
|
+
|
|
380
|
+
Get the property state: binary data
|
|
381
|
+
|
|
382
|
+
## Signature
|
|
383
|
+
|
|
384
|
+
```typescript
|
|
385
|
+
function getState_BinaryData(): string;
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
## Returns
|
|
389
|
+
|
|
390
|
+
string
|
|
391
|
+
|
|
392
|
+
Binary data
|
|
393
|
+
|
|
394
|
+
## Remarks
|
|
395
|
+
|
|
396
|
+
The `binaryData` retrieved from the canvas may be a `hashId`<!-- -->, because our backend stores binary embedded object data in object storage,
|
|
397
|
+
|
|
398
|
+
The object storage uses `hashId` as the index. Fully retrieving the data will cause additional requests and consume performance
|
|
399
|
+
|
|
400
|
+
## Example
|
|
401
|
+
|
|
402
|
+
```javascript
|
|
403
|
+
// 1. 生成本次运行专用的坐标,在顶层丝印层放置一个 400 x 300 的内嵌图片
|
|
404
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
405
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
406
|
+
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
407
|
+
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
408
|
+
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
409
|
+
|
|
410
|
+
// 2. 读取内嵌的二进制数据
|
|
411
|
+
const binaryData = obj.getState_BinaryData();
|
|
412
|
+
|
|
413
|
+
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
414
|
+
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
|
|
415
|
+
|
|
416
|
+
console.log('binaryData 长度:', binaryData.length);
|
|
417
|
+
console.log('binaryData 前缀:', binaryData.substring(0, 30));
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
### getstate_filename
|
|
421
|
+
|
|
422
|
+
# IPCB\_PrimitiveObject.getState\_FileName() method
|
|
423
|
+
|
|
424
|
+
Get the property state: file name
|
|
425
|
+
|
|
426
|
+
## Signature
|
|
427
|
+
|
|
428
|
+
```typescript
|
|
429
|
+
function getState_FileName(): string;
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
## Returns
|
|
433
|
+
|
|
434
|
+
string
|
|
435
|
+
|
|
436
|
+
File name
|
|
437
|
+
|
|
438
|
+
## Example
|
|
439
|
+
|
|
440
|
+
```javascript
|
|
441
|
+
// 1. 生成本次运行专用的坐标,在顶层丝印层放置一个内嵌图片
|
|
442
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
443
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
444
|
+
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
445
|
+
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
446
|
+
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'company-logo.png', false);
|
|
447
|
+
|
|
448
|
+
// 2. 读取图片文件名
|
|
449
|
+
const fileName = obj.getState_FileName();
|
|
450
|
+
|
|
451
|
+
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
452
|
+
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
|
|
453
|
+
|
|
454
|
+
console.log('fileName:', fileName);
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
### getstate_height
|
|
458
|
+
|
|
459
|
+
# IPCB\_PrimitiveObject.getState\_Height() method
|
|
460
|
+
|
|
461
|
+
Get the property state: height
|
|
462
|
+
|
|
463
|
+
## Signature
|
|
464
|
+
|
|
465
|
+
```typescript
|
|
466
|
+
function getState_Height(): number;
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
## Returns
|
|
470
|
+
|
|
471
|
+
number
|
|
472
|
+
|
|
473
|
+
Height
|
|
474
|
+
|
|
475
|
+
## Example
|
|
476
|
+
|
|
477
|
+
```javascript
|
|
478
|
+
// 1. 生成本次运行专用的坐标,在顶层丝印层放置一个 400 x 300 的内嵌图片
|
|
479
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
480
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
481
|
+
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
482
|
+
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
483
|
+
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
484
|
+
|
|
485
|
+
// 2. 读取图片高度
|
|
486
|
+
const height = obj.getState_Height();
|
|
487
|
+
|
|
488
|
+
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
489
|
+
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
|
|
490
|
+
|
|
491
|
+
console.log('height:', height);
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
### getstate_layer
|
|
495
|
+
|
|
496
|
+
# IPCB\_PrimitiveObject.getState\_Layer() method
|
|
497
|
+
|
|
498
|
+
Get the property state: Layer
|
|
499
|
+
|
|
500
|
+
## Signature
|
|
501
|
+
|
|
502
|
+
```typescript
|
|
503
|
+
function getState_Layer(): TPCB_LayersOfObject | undefined;
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
## Returns
|
|
507
|
+
|
|
508
|
+
[TPCB\_LayersOfObject](../types/TPCB_LayersOfObject.md) \| undefined
|
|
509
|
+
|
|
510
|
+
Layer
|
|
511
|
+
|
|
512
|
+
## Example
|
|
513
|
+
|
|
514
|
+
```javascript
|
|
515
|
+
// 1. 生成本次运行专用的坐标,在顶层丝印层放置一个内嵌图片
|
|
516
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
517
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
518
|
+
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
519
|
+
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
520
|
+
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
521
|
+
|
|
522
|
+
// 2. 读取图片所在层(3=顶层丝印)
|
|
523
|
+
const layer = obj.getState_Layer();
|
|
524
|
+
|
|
525
|
+
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
526
|
+
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
|
|
527
|
+
|
|
528
|
+
console.log('layer:', layer);
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
### getstate_mirror
|
|
532
|
+
|
|
533
|
+
# IPCB\_PrimitiveObject.getState\_Mirror() method
|
|
534
|
+
|
|
535
|
+
Get the property state: whether it is horizontally mirrored
|
|
536
|
+
|
|
537
|
+
## Signature
|
|
538
|
+
|
|
539
|
+
```typescript
|
|
540
|
+
function getState_Mirror(): boolean;
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
## Returns
|
|
544
|
+
|
|
545
|
+
boolean
|
|
546
|
+
|
|
547
|
+
Whether it is horizontally mirrored
|
|
548
|
+
|
|
549
|
+
## Example
|
|
550
|
+
|
|
551
|
+
```javascript
|
|
552
|
+
// 1. 生成本次运行专用的坐标,在顶层丝印层放置一个未镜像的内嵌图片
|
|
553
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
554
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
555
|
+
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
556
|
+
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
557
|
+
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
558
|
+
|
|
559
|
+
// 2. 查询是否水平镜像
|
|
560
|
+
const mirror = obj.getState_Mirror();
|
|
561
|
+
|
|
562
|
+
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
563
|
+
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
|
|
564
|
+
|
|
565
|
+
console.log('mirror:', mirror);
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
### getstate_primitiveid
|
|
569
|
+
|
|
570
|
+
# IPCB\_PrimitiveObject.getState\_PrimitiveId() method
|
|
571
|
+
|
|
572
|
+
Get the property state: primitive ID
|
|
573
|
+
|
|
574
|
+
## Signature
|
|
575
|
+
|
|
576
|
+
```typescript
|
|
577
|
+
function getState_PrimitiveId(): string;
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
## Returns
|
|
581
|
+
|
|
582
|
+
string
|
|
583
|
+
|
|
584
|
+
Primitive ID
|
|
585
|
+
|
|
586
|
+
## Example
|
|
587
|
+
|
|
588
|
+
```javascript
|
|
589
|
+
// 1. 生成本次运行专用的坐标,在顶层丝印层放置一个内嵌图片
|
|
590
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
591
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
592
|
+
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
593
|
+
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
594
|
+
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
595
|
+
|
|
596
|
+
// 2. 读取图元 ID
|
|
597
|
+
const primitiveId = obj.getState_PrimitiveId();
|
|
598
|
+
|
|
599
|
+
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
600
|
+
await eda.pcb_PrimitiveObject.delete([primitiveId]);
|
|
601
|
+
|
|
602
|
+
console.log('primitiveId:', primitiveId);
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
### getstate_primitivelock
|
|
606
|
+
|
|
607
|
+
# IPCB\_PrimitiveObject.getState\_PrimitiveLock() method
|
|
608
|
+
|
|
609
|
+
Get the property state: whether it is locked
|
|
610
|
+
|
|
611
|
+
## Signature
|
|
612
|
+
|
|
613
|
+
```typescript
|
|
614
|
+
function getState_PrimitiveLock(): boolean;
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
## Returns
|
|
618
|
+
|
|
619
|
+
boolean
|
|
620
|
+
|
|
621
|
+
Whether it is locked
|
|
622
|
+
|
|
623
|
+
## Example
|
|
624
|
+
|
|
625
|
+
```javascript
|
|
626
|
+
// 1. 生成本次运行专用的坐标,放置一个未锁定的内嵌图片
|
|
627
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
628
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
629
|
+
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
630
|
+
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
631
|
+
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
632
|
+
|
|
633
|
+
// 2. 查询是否锁定
|
|
634
|
+
const primitiveLock = obj.getState_PrimitiveLock();
|
|
635
|
+
|
|
636
|
+
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
637
|
+
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
|
|
638
|
+
|
|
639
|
+
console.log('primitiveLock:', primitiveLock);
|
|
640
|
+
```
|
|
641
|
+
|
|
642
|
+
### getstate_primitivetype
|
|
643
|
+
|
|
644
|
+
# IPCB\_PrimitiveObject.getState\_PrimitiveType() method
|
|
645
|
+
|
|
646
|
+
Get the property state: primitive type
|
|
647
|
+
|
|
648
|
+
## Signature
|
|
649
|
+
|
|
650
|
+
```typescript
|
|
651
|
+
function getState_PrimitiveType(): EPCB_PrimitiveType;
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
## Returns
|
|
655
|
+
|
|
656
|
+
[EPCB\_PrimitiveType](../enums/EPCB_PrimitiveType.md)
|
|
657
|
+
|
|
658
|
+
Primitive type
|
|
659
|
+
|
|
660
|
+
## Example
|
|
661
|
+
|
|
662
|
+
```javascript
|
|
663
|
+
// 1. 生成本次运行专用的坐标,在顶层丝印层放置一个内嵌图片
|
|
664
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
665
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
666
|
+
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
667
|
+
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
668
|
+
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
669
|
+
|
|
670
|
+
// 2. 读取图元类型(内嵌图片固定返回 'Object')
|
|
671
|
+
const primitiveType = obj.getState_PrimitiveType();
|
|
672
|
+
|
|
673
|
+
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
674
|
+
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
|
|
675
|
+
|
|
676
|
+
console.log('primitiveType:', primitiveType);
|
|
677
|
+
```
|
|
678
|
+
|
|
679
|
+
### getstate_rotation
|
|
680
|
+
|
|
681
|
+
# IPCB\_PrimitiveObject.getState\_Rotation() method
|
|
682
|
+
|
|
683
|
+
Get the property state: rotation angle
|
|
684
|
+
|
|
685
|
+
## Signature
|
|
686
|
+
|
|
687
|
+
```typescript
|
|
688
|
+
function getState_Rotation(): number;
|
|
689
|
+
```
|
|
690
|
+
|
|
691
|
+
## Returns
|
|
692
|
+
|
|
693
|
+
number
|
|
694
|
+
|
|
695
|
+
Rotation angle
|
|
696
|
+
|
|
697
|
+
## Example
|
|
698
|
+
|
|
699
|
+
```javascript
|
|
700
|
+
// 1. 生成本次运行专用的坐标,放置一个未旋转的内嵌图片
|
|
701
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
702
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
703
|
+
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
704
|
+
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
705
|
+
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
706
|
+
|
|
707
|
+
// 2. 读取旋转角度
|
|
708
|
+
const rotation = obj.getState_Rotation();
|
|
709
|
+
|
|
710
|
+
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
711
|
+
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
|
|
712
|
+
|
|
713
|
+
console.log('rotation:', rotation);
|
|
714
|
+
```
|
|
715
|
+
|
|
716
|
+
### getstate_topleftx
|
|
717
|
+
|
|
718
|
+
# IPCB\_PrimitiveObject.getState\_TopLeftX() method
|
|
719
|
+
|
|
720
|
+
Get the property state: top-left point X
|
|
721
|
+
|
|
722
|
+
## Signature
|
|
723
|
+
|
|
724
|
+
```typescript
|
|
725
|
+
function getState_TopLeftX(): number | undefined;
|
|
726
|
+
```
|
|
727
|
+
|
|
728
|
+
## Returns
|
|
729
|
+
|
|
730
|
+
number \| undefined
|
|
731
|
+
|
|
732
|
+
Top-left point X
|
|
733
|
+
|
|
734
|
+
## Example
|
|
735
|
+
|
|
736
|
+
```javascript
|
|
737
|
+
// 1. 生成本次运行专用的坐标,放置一个内嵌图片
|
|
738
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
739
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
740
|
+
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
741
|
+
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
742
|
+
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
743
|
+
|
|
744
|
+
// 2. 读取左上角 X 坐标
|
|
745
|
+
const topLeftX = obj.getState_TopLeftX();
|
|
746
|
+
|
|
747
|
+
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
748
|
+
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
|
|
749
|
+
|
|
750
|
+
console.log('topLeftX:', topLeftX);
|
|
751
|
+
```
|
|
752
|
+
|
|
753
|
+
### getstate_toplefty
|
|
754
|
+
|
|
755
|
+
# IPCB\_PrimitiveObject.getState\_TopLeftY() method
|
|
756
|
+
|
|
757
|
+
Get the property state: top-left point Y
|
|
758
|
+
|
|
759
|
+
## Signature
|
|
760
|
+
|
|
761
|
+
```typescript
|
|
762
|
+
function getState_TopLeftY(): number | undefined;
|
|
763
|
+
```
|
|
764
|
+
|
|
765
|
+
## Returns
|
|
766
|
+
|
|
767
|
+
number \| undefined
|
|
768
|
+
|
|
769
|
+
Top-left point Y
|
|
770
|
+
|
|
771
|
+
## Example
|
|
772
|
+
|
|
773
|
+
```javascript
|
|
774
|
+
// 1. 生成本次运行专用的坐标,放置一个内嵌图片
|
|
775
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
776
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
777
|
+
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
778
|
+
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
779
|
+
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
780
|
+
|
|
781
|
+
// 2. 读取左上角 Y 坐标
|
|
782
|
+
const topLeftY = obj.getState_TopLeftY();
|
|
783
|
+
|
|
784
|
+
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
785
|
+
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
|
|
786
|
+
|
|
787
|
+
console.log('topLeftY:', topLeftY);
|
|
788
|
+
```
|
|
789
|
+
|
|
790
|
+
### getstate_width
|
|
791
|
+
|
|
792
|
+
# IPCB\_PrimitiveObject.getState\_Width() method
|
|
793
|
+
|
|
794
|
+
Get the property state: width
|
|
795
|
+
|
|
796
|
+
## Signature
|
|
797
|
+
|
|
798
|
+
```typescript
|
|
799
|
+
function getState_Width(): number;
|
|
800
|
+
```
|
|
801
|
+
|
|
802
|
+
## Returns
|
|
803
|
+
|
|
804
|
+
number
|
|
805
|
+
|
|
806
|
+
Width
|
|
807
|
+
|
|
808
|
+
## Example
|
|
809
|
+
|
|
810
|
+
```javascript
|
|
811
|
+
// 1. 生成本次运行专用的坐标,在顶层丝印层放置一个 400 x 300 的内嵌图片
|
|
812
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
813
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
814
|
+
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
815
|
+
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
816
|
+
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
817
|
+
|
|
818
|
+
// 2. 读取图片宽度
|
|
819
|
+
const width = obj.getState_Width();
|
|
820
|
+
|
|
821
|
+
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
822
|
+
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
|
|
823
|
+
|
|
824
|
+
console.log('width:', width);
|
|
825
|
+
```
|
|
826
|
+
|
|
827
|
+
### isasync
|
|
828
|
+
|
|
829
|
+
# IPCB\_PrimitiveObject.isAsync() method
|
|
830
|
+
|
|
831
|
+
Query whether the primitive is an async primitive
|
|
832
|
+
|
|
833
|
+
## Signature
|
|
834
|
+
|
|
835
|
+
```typescript
|
|
836
|
+
function isAsync(): boolean;
|
|
837
|
+
```
|
|
838
|
+
|
|
839
|
+
## Returns
|
|
840
|
+
|
|
841
|
+
boolean
|
|
842
|
+
|
|
843
|
+
Whether Is async primitive
|
|
844
|
+
|
|
845
|
+
## Example
|
|
846
|
+
|
|
847
|
+
```javascript
|
|
848
|
+
// 1. 生成本次运行专用的坐标,放置一个内嵌图片
|
|
849
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
850
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
851
|
+
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
852
|
+
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
853
|
+
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
854
|
+
|
|
855
|
+
// 2. 查询异步模式
|
|
856
|
+
const isAsync = obj.isAsync();
|
|
857
|
+
|
|
858
|
+
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
859
|
+
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
|
|
860
|
+
|
|
861
|
+
console.log('isAsync:', isAsync);
|
|
862
|
+
```
|
|
863
|
+
|
|
864
|
+
### reset
|
|
865
|
+
|
|
866
|
+
# IPCB\_PrimitiveObject.reset() method
|
|
867
|
+
|
|
868
|
+
> 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.
|
|
869
|
+
|
|
870
|
+
Reset the async primitive to the current canvas state
|
|
871
|
+
|
|
872
|
+
## Signature
|
|
873
|
+
|
|
874
|
+
```typescript
|
|
875
|
+
function reset(): Promise<IPCB_PrimitiveObject>;
|
|
876
|
+
```
|
|
877
|
+
|
|
878
|
+
## Returns
|
|
879
|
+
|
|
880
|
+
Promise<[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)<!-- -->>
|
|
881
|
+
|
|
882
|
+
Binary embedded object primitive object
|
|
883
|
+
|
|
884
|
+
## Example
|
|
885
|
+
|
|
886
|
+
```javascript
|
|
887
|
+
// 1. 生成本次运行专用的坐标,放置一个未旋转的内嵌图片
|
|
888
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
889
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
890
|
+
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
891
|
+
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
892
|
+
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
893
|
+
const before = obj.getState_Rotation();
|
|
894
|
+
|
|
895
|
+
// 2. 异步模式下把图片旋转 90 度,随后反悔
|
|
896
|
+
const asyncObj = obj.toAsync();
|
|
897
|
+
asyncObj.setState_Rotation(90);
|
|
898
|
+
|
|
899
|
+
// 3. reset 丢弃未提交的修改(保留现场供观察)
|
|
900
|
+
await asyncObj.reset();
|
|
901
|
+
|
|
902
|
+
// 4. 从画布重新读取,确认旋转没有变
|
|
903
|
+
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
|
|
904
|
+
|
|
905
|
+
console.log('rotation:', before, '→', refetched.getState_Rotation());
|
|
906
|
+
```
|
|
907
|
+
|
|
908
|
+
### setstate_binarydata
|
|
909
|
+
|
|
910
|
+
# IPCB\_PrimitiveObject.setState\_BinaryData() method
|
|
911
|
+
|
|
912
|
+
Set the property state: binary data
|
|
913
|
+
|
|
914
|
+
## Signature
|
|
915
|
+
|
|
916
|
+
```typescript
|
|
917
|
+
function setState_BinaryData(binaryData: string): IPCB_PrimitiveObject;
|
|
918
|
+
```
|
|
919
|
+
|
|
920
|
+
## Parameters
|
|
921
|
+
|
|
922
|
+
<table><thead><tr><th>
|
|
923
|
+
|
|
924
|
+
Parameter
|
|
925
|
+
|
|
926
|
+
</th><th>
|
|
927
|
+
|
|
928
|
+
Type
|
|
929
|
+
|
|
930
|
+
</th><th>
|
|
931
|
+
|
|
932
|
+
Description
|
|
933
|
+
|
|
934
|
+
</th></tr></thead>
|
|
935
|
+
<tbody><tr><td>
|
|
936
|
+
|
|
937
|
+
binaryData
|
|
938
|
+
|
|
939
|
+
</td><td>
|
|
940
|
+
|
|
941
|
+
string
|
|
942
|
+
|
|
943
|
+
</td><td>
|
|
944
|
+
|
|
945
|
+
Binary data
|
|
946
|
+
|
|
947
|
+
</td></tr>
|
|
948
|
+
</tbody></table>
|
|
949
|
+
|
|
950
|
+
## Returns
|
|
951
|
+
|
|
952
|
+
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
|
|
953
|
+
|
|
954
|
+
Binary embedded object primitive object
|
|
955
|
+
|
|
956
|
+
## Remarks
|
|
957
|
+
|
|
958
|
+
The `binaryData` re-retrieved from the canvas may be a `hashId`<!-- -->, because our backend stores binary embedded object data in object storage,
|
|
959
|
+
|
|
960
|
+
The object storage uses `hashId` as the index. Fully retrieving the data will cause additional requests and consume performance
|
|
961
|
+
|
|
962
|
+
## Example
|
|
963
|
+
|
|
964
|
+
```javascript
|
|
965
|
+
// 1. 生成本次运行专用的坐标,放置一个 4x4 图片的内嵌对象
|
|
966
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
967
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
968
|
+
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
969
|
+
const oldImage = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
970
|
+
// 8x8 纯色 PNG 的 data URI,作为替换用的新图
|
|
971
|
+
const newImage = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAEklEQVR4nGOQi7rzHx9mGBkKAFPclMHPGdtKAAAAAElFTkSuQmCC';
|
|
972
|
+
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, oldImage, 400, 300, 0, false, 'demo.png', false);
|
|
973
|
+
const before = obj.getState_BinaryData().length;
|
|
974
|
+
|
|
975
|
+
// 2. 异步模式替换为新图片数据
|
|
976
|
+
const asyncObj = obj.toAsync();
|
|
977
|
+
asyncObj.setState_BinaryData(newImage);
|
|
978
|
+
await asyncObj.done();
|
|
979
|
+
|
|
980
|
+
// 3. 从画布重新读取,确认数据已更新(保留现场供观察)
|
|
981
|
+
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
|
|
982
|
+
|
|
983
|
+
console.log('binaryData 长度:', before, '→', refetched.getState_BinaryData().length);
|
|
984
|
+
```
|
|
985
|
+
|
|
986
|
+
### setstate_filename
|
|
987
|
+
|
|
988
|
+
# IPCB\_PrimitiveObject.setState\_FileName() method
|
|
989
|
+
|
|
990
|
+
Set the property state: file name
|
|
991
|
+
|
|
992
|
+
## Signature
|
|
993
|
+
|
|
994
|
+
```typescript
|
|
995
|
+
function setState_FileName(fileName: string): IPCB_PrimitiveObject;
|
|
996
|
+
```
|
|
997
|
+
|
|
998
|
+
## Parameters
|
|
999
|
+
|
|
1000
|
+
<table><thead><tr><th>
|
|
1001
|
+
|
|
1002
|
+
Parameter
|
|
1003
|
+
|
|
1004
|
+
</th><th>
|
|
1005
|
+
|
|
1006
|
+
Type
|
|
1007
|
+
|
|
1008
|
+
</th><th>
|
|
1009
|
+
|
|
1010
|
+
Description
|
|
1011
|
+
|
|
1012
|
+
</th></tr></thead>
|
|
1013
|
+
<tbody><tr><td>
|
|
1014
|
+
|
|
1015
|
+
fileName
|
|
1016
|
+
|
|
1017
|
+
</td><td>
|
|
1018
|
+
|
|
1019
|
+
string
|
|
1020
|
+
|
|
1021
|
+
</td><td>
|
|
1022
|
+
|
|
1023
|
+
File name
|
|
1024
|
+
|
|
1025
|
+
</td></tr>
|
|
1026
|
+
</tbody></table>
|
|
1027
|
+
|
|
1028
|
+
## Returns
|
|
1029
|
+
|
|
1030
|
+
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
|
|
1031
|
+
|
|
1032
|
+
Binary embedded object primitive object
|
|
1033
|
+
|
|
1034
|
+
## Example
|
|
1035
|
+
|
|
1036
|
+
```javascript
|
|
1037
|
+
// 1. 生成本次运行专用的坐标,放置一个内嵌图片
|
|
1038
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
1039
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
1040
|
+
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
1041
|
+
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
1042
|
+
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'old-name.png', false);
|
|
1043
|
+
const before = obj.getState_FileName();
|
|
1044
|
+
|
|
1045
|
+
// 2. 异步模式重命名文件
|
|
1046
|
+
const asyncObj = obj.toAsync();
|
|
1047
|
+
asyncObj.setState_FileName('company-logo.png');
|
|
1048
|
+
await asyncObj.done();
|
|
1049
|
+
|
|
1050
|
+
// 3. 从画布重新读取,确认文件名已更新(保留现场供观察)
|
|
1051
|
+
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
|
|
1052
|
+
|
|
1053
|
+
console.log('fileName:', before, '→', refetched.getState_FileName());
|
|
1054
|
+
```
|
|
1055
|
+
|
|
1056
|
+
### setstate_height
|
|
1057
|
+
|
|
1058
|
+
# IPCB\_PrimitiveObject.setState\_Height() method
|
|
1059
|
+
|
|
1060
|
+
Set the property state: height
|
|
1061
|
+
|
|
1062
|
+
## Signature
|
|
1063
|
+
|
|
1064
|
+
```typescript
|
|
1065
|
+
function setState_Height(height: number): IPCB_PrimitiveObject;
|
|
1066
|
+
```
|
|
1067
|
+
|
|
1068
|
+
## Parameters
|
|
1069
|
+
|
|
1070
|
+
<table><thead><tr><th>
|
|
1071
|
+
|
|
1072
|
+
Parameter
|
|
1073
|
+
|
|
1074
|
+
</th><th>
|
|
1075
|
+
|
|
1076
|
+
Type
|
|
1077
|
+
|
|
1078
|
+
</th><th>
|
|
1079
|
+
|
|
1080
|
+
Description
|
|
1081
|
+
|
|
1082
|
+
</th></tr></thead>
|
|
1083
|
+
<tbody><tr><td>
|
|
1084
|
+
|
|
1085
|
+
height
|
|
1086
|
+
|
|
1087
|
+
</td><td>
|
|
1088
|
+
|
|
1089
|
+
number
|
|
1090
|
+
|
|
1091
|
+
</td><td>
|
|
1092
|
+
|
|
1093
|
+
Height
|
|
1094
|
+
|
|
1095
|
+
</td></tr>
|
|
1096
|
+
</tbody></table>
|
|
1097
|
+
|
|
1098
|
+
## Returns
|
|
1099
|
+
|
|
1100
|
+
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
|
|
1101
|
+
|
|
1102
|
+
Binary embedded object primitive object
|
|
1103
|
+
|
|
1104
|
+
## Example
|
|
1105
|
+
|
|
1106
|
+
```javascript
|
|
1107
|
+
// 1. 生成本次运行专用的坐标,放置一个 400 x 300 的内嵌图片
|
|
1108
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
1109
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
1110
|
+
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
1111
|
+
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
1112
|
+
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
1113
|
+
const before = obj.getState_Height();
|
|
1114
|
+
|
|
1115
|
+
// 2. 异步模式把高度从 300 调到 450
|
|
1116
|
+
const asyncObj = obj.toAsync();
|
|
1117
|
+
asyncObj.setState_Height(450);
|
|
1118
|
+
await asyncObj.done();
|
|
1119
|
+
|
|
1120
|
+
// 3. 从画布重新读取,确认高度已更新(保留现场供观察)
|
|
1121
|
+
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
|
|
1122
|
+
|
|
1123
|
+
console.log('height:', before, '→', refetched.getState_Height());
|
|
1124
|
+
```
|
|
1125
|
+
|
|
1126
|
+
### setstate_layer
|
|
1127
|
+
|
|
1128
|
+
# IPCB\_PrimitiveObject.setState\_Layer() method
|
|
1129
|
+
|
|
1130
|
+
> 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.
|
|
1131
|
+
|
|
1132
|
+
Set the property state: Layer
|
|
1133
|
+
|
|
1134
|
+
## Signature
|
|
1135
|
+
|
|
1136
|
+
```typescript
|
|
1137
|
+
function setState_Layer(layer: TPCB_LayersOfObject): IPCB_PrimitiveObject;
|
|
1138
|
+
```
|
|
1139
|
+
|
|
1140
|
+
## Parameters
|
|
1141
|
+
|
|
1142
|
+
<table><thead><tr><th>
|
|
1143
|
+
|
|
1144
|
+
Parameter
|
|
1145
|
+
|
|
1146
|
+
</th><th>
|
|
1147
|
+
|
|
1148
|
+
Type
|
|
1149
|
+
|
|
1150
|
+
</th><th>
|
|
1151
|
+
|
|
1152
|
+
Description
|
|
1153
|
+
|
|
1154
|
+
</th></tr></thead>
|
|
1155
|
+
<tbody><tr><td>
|
|
1156
|
+
|
|
1157
|
+
layer
|
|
1158
|
+
|
|
1159
|
+
</td><td>
|
|
1160
|
+
|
|
1161
|
+
[TPCB\_LayersOfObject](../types/TPCB_LayersOfObject.md)
|
|
1162
|
+
|
|
1163
|
+
</td><td>
|
|
1164
|
+
|
|
1165
|
+
Layer
|
|
1166
|
+
|
|
1167
|
+
</td></tr>
|
|
1168
|
+
</tbody></table>
|
|
1169
|
+
|
|
1170
|
+
## Returns
|
|
1171
|
+
|
|
1172
|
+
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
|
|
1173
|
+
|
|
1174
|
+
Binary embedded object primitive object
|
|
1175
|
+
|
|
1176
|
+
## Example
|
|
1177
|
+
|
|
1178
|
+
```javascript
|
|
1179
|
+
// 1. 生成本次运行专用的坐标,在顶层丝印层放置一个内嵌图片
|
|
1180
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
1181
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
1182
|
+
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
1183
|
+
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
1184
|
+
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
1185
|
+
const before = obj.getState_Layer();
|
|
1186
|
+
|
|
1187
|
+
// 2. 异步模式把图片从顶层丝印(3)挪到底层丝印(4)
|
|
1188
|
+
const asyncObj = obj.toAsync();
|
|
1189
|
+
asyncObj.setState_Layer(4);
|
|
1190
|
+
await asyncObj.done();
|
|
1191
|
+
|
|
1192
|
+
// 3. 从画布重新读取,确认层已切换(保留现场供观察)
|
|
1193
|
+
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
|
|
1194
|
+
|
|
1195
|
+
console.log('layer:', before, '→', refetched.getState_Layer());
|
|
1196
|
+
```
|
|
1197
|
+
|
|
1198
|
+
### setstate_mirror
|
|
1199
|
+
|
|
1200
|
+
# IPCB\_PrimitiveObject.setState\_Mirror() method
|
|
1201
|
+
|
|
1202
|
+
Set the property state: whether it is horizontally mirrored
|
|
1203
|
+
|
|
1204
|
+
## Signature
|
|
1205
|
+
|
|
1206
|
+
```typescript
|
|
1207
|
+
function setState_Mirror(mirror: boolean): IPCB_PrimitiveObject;
|
|
1208
|
+
```
|
|
1209
|
+
|
|
1210
|
+
## Parameters
|
|
1211
|
+
|
|
1212
|
+
<table><thead><tr><th>
|
|
1213
|
+
|
|
1214
|
+
Parameter
|
|
1215
|
+
|
|
1216
|
+
</th><th>
|
|
1217
|
+
|
|
1218
|
+
Type
|
|
1219
|
+
|
|
1220
|
+
</th><th>
|
|
1221
|
+
|
|
1222
|
+
Description
|
|
1223
|
+
|
|
1224
|
+
</th></tr></thead>
|
|
1225
|
+
<tbody><tr><td>
|
|
1226
|
+
|
|
1227
|
+
mirror
|
|
1228
|
+
|
|
1229
|
+
</td><td>
|
|
1230
|
+
|
|
1231
|
+
boolean
|
|
1232
|
+
|
|
1233
|
+
</td><td>
|
|
1234
|
+
|
|
1235
|
+
Whether it is horizontally mirrored
|
|
1236
|
+
|
|
1237
|
+
</td></tr>
|
|
1238
|
+
</tbody></table>
|
|
1239
|
+
|
|
1240
|
+
## Returns
|
|
1241
|
+
|
|
1242
|
+
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
|
|
1243
|
+
|
|
1244
|
+
Binary embedded object primitive object
|
|
1245
|
+
|
|
1246
|
+
## Example
|
|
1247
|
+
|
|
1248
|
+
```javascript
|
|
1249
|
+
// 1. 生成本次运行专用的坐标,在底层丝印层(4)放置一个未镜像的图片
|
|
1250
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
1251
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
1252
|
+
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
1253
|
+
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
1254
|
+
const obj = await eda.pcb_PrimitiveObject.create(4, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
1255
|
+
const before = obj.getState_Mirror();
|
|
1256
|
+
|
|
1257
|
+
// 2. 异步模式打开水平镜像
|
|
1258
|
+
const asyncObj = obj.toAsync();
|
|
1259
|
+
asyncObj.setState_Mirror(true);
|
|
1260
|
+
await asyncObj.done();
|
|
1261
|
+
|
|
1262
|
+
// 3. 从画布重新读取,确认镜像已开启(保留现场供观察)
|
|
1263
|
+
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
|
|
1264
|
+
|
|
1265
|
+
console.log('mirror:', before, '→', refetched.getState_Mirror());
|
|
1266
|
+
```
|
|
1267
|
+
|
|
1268
|
+
### setstate_primitivelock
|
|
1269
|
+
|
|
1270
|
+
# IPCB\_PrimitiveObject.setState\_PrimitiveLock() method
|
|
1271
|
+
|
|
1272
|
+
> 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.
|
|
1273
|
+
|
|
1274
|
+
Set the property state: whether it is locked
|
|
1275
|
+
|
|
1276
|
+
## Signature
|
|
1277
|
+
|
|
1278
|
+
```typescript
|
|
1279
|
+
function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitiveObject;
|
|
1280
|
+
```
|
|
1281
|
+
|
|
1282
|
+
## Parameters
|
|
1283
|
+
|
|
1284
|
+
<table><thead><tr><th>
|
|
1285
|
+
|
|
1286
|
+
Parameter
|
|
1287
|
+
|
|
1288
|
+
</th><th>
|
|
1289
|
+
|
|
1290
|
+
Type
|
|
1291
|
+
|
|
1292
|
+
</th><th>
|
|
1293
|
+
|
|
1294
|
+
Description
|
|
1295
|
+
|
|
1296
|
+
</th></tr></thead>
|
|
1297
|
+
<tbody><tr><td>
|
|
1298
|
+
|
|
1299
|
+
primitiveLock
|
|
1300
|
+
|
|
1301
|
+
</td><td>
|
|
1302
|
+
|
|
1303
|
+
boolean
|
|
1304
|
+
|
|
1305
|
+
</td><td>
|
|
1306
|
+
|
|
1307
|
+
Whether it is locked
|
|
1308
|
+
|
|
1309
|
+
</td></tr>
|
|
1310
|
+
</tbody></table>
|
|
1311
|
+
|
|
1312
|
+
## Returns
|
|
1313
|
+
|
|
1314
|
+
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
|
|
1315
|
+
|
|
1316
|
+
Binary embedded object primitive object
|
|
1317
|
+
|
|
1318
|
+
## Example
|
|
1319
|
+
|
|
1320
|
+
```javascript
|
|
1321
|
+
// 1. 生成本次运行专用的坐标,放置一个未锁定的内嵌图片
|
|
1322
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
1323
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
1324
|
+
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
1325
|
+
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
1326
|
+
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
1327
|
+
const before = obj.getState_PrimitiveLock();
|
|
1328
|
+
|
|
1329
|
+
// 2. 异步模式锁定图元
|
|
1330
|
+
const asyncObj = obj.toAsync();
|
|
1331
|
+
asyncObj.setState_PrimitiveLock(true);
|
|
1332
|
+
await asyncObj.done();
|
|
1333
|
+
|
|
1334
|
+
// 3. 从画布重新读取,确认已锁定(保留现场供观察)
|
|
1335
|
+
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
|
|
1336
|
+
|
|
1337
|
+
console.log('primitiveLock:', before, '→', refetched.getState_PrimitiveLock());
|
|
1338
|
+
```
|
|
1339
|
+
|
|
1340
|
+
### setstate_rotation
|
|
1341
|
+
|
|
1342
|
+
# IPCB\_PrimitiveObject.setState\_Rotation() method
|
|
1343
|
+
|
|
1344
|
+
Set the property state: rotation angle
|
|
1345
|
+
|
|
1346
|
+
## Signature
|
|
1347
|
+
|
|
1348
|
+
```typescript
|
|
1349
|
+
function setState_Rotation(rotation: number): IPCB_PrimitiveObject;
|
|
1350
|
+
```
|
|
1351
|
+
|
|
1352
|
+
## Parameters
|
|
1353
|
+
|
|
1354
|
+
<table><thead><tr><th>
|
|
1355
|
+
|
|
1356
|
+
Parameter
|
|
1357
|
+
|
|
1358
|
+
</th><th>
|
|
1359
|
+
|
|
1360
|
+
Type
|
|
1361
|
+
|
|
1362
|
+
</th><th>
|
|
1363
|
+
|
|
1364
|
+
Description
|
|
1365
|
+
|
|
1366
|
+
</th></tr></thead>
|
|
1367
|
+
<tbody><tr><td>
|
|
1368
|
+
|
|
1369
|
+
rotation
|
|
1370
|
+
|
|
1371
|
+
</td><td>
|
|
1372
|
+
|
|
1373
|
+
number
|
|
1374
|
+
|
|
1375
|
+
</td><td>
|
|
1376
|
+
|
|
1377
|
+
Rotation angle
|
|
1378
|
+
|
|
1379
|
+
</td></tr>
|
|
1380
|
+
</tbody></table>
|
|
1381
|
+
|
|
1382
|
+
## Returns
|
|
1383
|
+
|
|
1384
|
+
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
|
|
1385
|
+
|
|
1386
|
+
Binary embedded object primitive object
|
|
1387
|
+
|
|
1388
|
+
## Example
|
|
1389
|
+
|
|
1390
|
+
```javascript
|
|
1391
|
+
// 1. 生成本次运行专用的坐标,放置一个未旋转的内嵌图片
|
|
1392
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
1393
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
1394
|
+
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
1395
|
+
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
1396
|
+
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
1397
|
+
const before = obj.getState_Rotation();
|
|
1398
|
+
|
|
1399
|
+
// 2. 异步模式旋转 90 度
|
|
1400
|
+
const asyncObj = obj.toAsync();
|
|
1401
|
+
asyncObj.setState_Rotation(90);
|
|
1402
|
+
await asyncObj.done();
|
|
1403
|
+
|
|
1404
|
+
// 3. 从画布重新读取,确认角度已更新(保留现场供观察)
|
|
1405
|
+
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
|
|
1406
|
+
|
|
1407
|
+
console.log('rotation:', before, '→', refetched.getState_Rotation());
|
|
1408
|
+
```
|
|
1409
|
+
|
|
1410
|
+
### setstate_topleftx
|
|
1411
|
+
|
|
1412
|
+
# IPCB\_PrimitiveObject.setState\_TopLeftX() method
|
|
1413
|
+
|
|
1414
|
+
Set the property state: top-left point X
|
|
1415
|
+
|
|
1416
|
+
## Signature
|
|
1417
|
+
|
|
1418
|
+
```typescript
|
|
1419
|
+
function setState_TopLeftX(topLeftX: number): IPCB_PrimitiveObject;
|
|
1420
|
+
```
|
|
1421
|
+
|
|
1422
|
+
## Parameters
|
|
1423
|
+
|
|
1424
|
+
<table><thead><tr><th>
|
|
1425
|
+
|
|
1426
|
+
Parameter
|
|
1427
|
+
|
|
1428
|
+
</th><th>
|
|
1429
|
+
|
|
1430
|
+
Type
|
|
1431
|
+
|
|
1432
|
+
</th><th>
|
|
1433
|
+
|
|
1434
|
+
Description
|
|
1435
|
+
|
|
1436
|
+
</th></tr></thead>
|
|
1437
|
+
<tbody><tr><td>
|
|
1438
|
+
|
|
1439
|
+
topLeftX
|
|
1440
|
+
|
|
1441
|
+
</td><td>
|
|
1442
|
+
|
|
1443
|
+
number
|
|
1444
|
+
|
|
1445
|
+
</td><td>
|
|
1446
|
+
|
|
1447
|
+
Top-left point X
|
|
1448
|
+
|
|
1449
|
+
</td></tr>
|
|
1450
|
+
</tbody></table>
|
|
1451
|
+
|
|
1452
|
+
## Returns
|
|
1453
|
+
|
|
1454
|
+
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
|
|
1455
|
+
|
|
1456
|
+
Binary embedded object primitive object
|
|
1457
|
+
|
|
1458
|
+
## Example
|
|
1459
|
+
|
|
1460
|
+
```javascript
|
|
1461
|
+
// 1. 生成本次运行专用的坐标,放置一个内嵌图片
|
|
1462
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
1463
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
1464
|
+
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
1465
|
+
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
1466
|
+
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
1467
|
+
const before = obj.getState_TopLeftX();
|
|
1468
|
+
|
|
1469
|
+
// 2. 异步模式水平右移 500mil
|
|
1470
|
+
const asyncObj = obj.toAsync();
|
|
1471
|
+
asyncObj.setState_TopLeftX(before + 500);
|
|
1472
|
+
await asyncObj.done();
|
|
1473
|
+
|
|
1474
|
+
// 3. 从画布重新读取,确认 X 已更新(保留现场供观察)
|
|
1475
|
+
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
|
|
1476
|
+
|
|
1477
|
+
console.log('topLeftX:', before, '→', refetched.getState_TopLeftX());
|
|
1478
|
+
```
|
|
1479
|
+
|
|
1480
|
+
### setstate_toplefty
|
|
1481
|
+
|
|
1482
|
+
# IPCB\_PrimitiveObject.setState\_TopLeftY() method
|
|
1483
|
+
|
|
1484
|
+
Set the property state: top-left point Y
|
|
1485
|
+
|
|
1486
|
+
## Signature
|
|
1487
|
+
|
|
1488
|
+
```typescript
|
|
1489
|
+
function setState_TopLeftY(topLeftY: number): IPCB_PrimitiveObject;
|
|
1490
|
+
```
|
|
1491
|
+
|
|
1492
|
+
## Parameters
|
|
1493
|
+
|
|
1494
|
+
<table><thead><tr><th>
|
|
1495
|
+
|
|
1496
|
+
Parameter
|
|
1497
|
+
|
|
1498
|
+
</th><th>
|
|
1499
|
+
|
|
1500
|
+
Type
|
|
1501
|
+
|
|
1502
|
+
</th><th>
|
|
1503
|
+
|
|
1504
|
+
Description
|
|
1505
|
+
|
|
1506
|
+
</th></tr></thead>
|
|
1507
|
+
<tbody><tr><td>
|
|
1508
|
+
|
|
1509
|
+
topLeftY
|
|
1510
|
+
|
|
1511
|
+
</td><td>
|
|
1512
|
+
|
|
1513
|
+
number
|
|
1514
|
+
|
|
1515
|
+
</td><td>
|
|
1516
|
+
|
|
1517
|
+
Top-left point Y
|
|
1518
|
+
|
|
1519
|
+
</td></tr>
|
|
1520
|
+
</tbody></table>
|
|
1521
|
+
|
|
1522
|
+
## Returns
|
|
1523
|
+
|
|
1524
|
+
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
|
|
1525
|
+
|
|
1526
|
+
Binary embedded object primitive object
|
|
1527
|
+
|
|
1528
|
+
## Example
|
|
1529
|
+
|
|
1530
|
+
```javascript
|
|
1531
|
+
// 1. 生成本次运行专用的坐标,放置一个内嵌图片
|
|
1532
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
1533
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
1534
|
+
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
1535
|
+
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
1536
|
+
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
1537
|
+
const before = obj.getState_TopLeftY();
|
|
1538
|
+
|
|
1539
|
+
// 2. 异步模式垂直上移 500mil
|
|
1540
|
+
const asyncObj = obj.toAsync();
|
|
1541
|
+
asyncObj.setState_TopLeftY(before - 500);
|
|
1542
|
+
await asyncObj.done();
|
|
1543
|
+
|
|
1544
|
+
// 3. 从画布重新读取,确认 Y 已更新(保留现场供观察)
|
|
1545
|
+
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
|
|
1546
|
+
|
|
1547
|
+
console.log('topLeftY:', before, '→', refetched.getState_TopLeftY());
|
|
1548
|
+
```
|
|
1549
|
+
|
|
1550
|
+
### setstate_width
|
|
1551
|
+
|
|
1552
|
+
# IPCB\_PrimitiveObject.setState\_Width() method
|
|
1553
|
+
|
|
1554
|
+
Set the property state: width
|
|
1555
|
+
|
|
1556
|
+
## Signature
|
|
1557
|
+
|
|
1558
|
+
```typescript
|
|
1559
|
+
function setState_Width(width: number): IPCB_PrimitiveObject;
|
|
1560
|
+
```
|
|
1561
|
+
|
|
1562
|
+
## Parameters
|
|
1563
|
+
|
|
1564
|
+
<table><thead><tr><th>
|
|
1565
|
+
|
|
1566
|
+
Parameter
|
|
1567
|
+
|
|
1568
|
+
</th><th>
|
|
1569
|
+
|
|
1570
|
+
Type
|
|
1571
|
+
|
|
1572
|
+
</th><th>
|
|
1573
|
+
|
|
1574
|
+
Description
|
|
1575
|
+
|
|
1576
|
+
</th></tr></thead>
|
|
1577
|
+
<tbody><tr><td>
|
|
1578
|
+
|
|
1579
|
+
width
|
|
1580
|
+
|
|
1581
|
+
</td><td>
|
|
1582
|
+
|
|
1583
|
+
number
|
|
1584
|
+
|
|
1585
|
+
</td><td>
|
|
1586
|
+
|
|
1587
|
+
Width
|
|
1588
|
+
|
|
1589
|
+
</td></tr>
|
|
1590
|
+
</tbody></table>
|
|
1591
|
+
|
|
1592
|
+
## Returns
|
|
1593
|
+
|
|
1594
|
+
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
|
|
1595
|
+
|
|
1596
|
+
Binary embedded object primitive object
|
|
1597
|
+
|
|
1598
|
+
## Example
|
|
1599
|
+
|
|
1600
|
+
```javascript
|
|
1601
|
+
// 1. 生成本次运行专用的坐标,放置一个 400 x 300 的内嵌图片
|
|
1602
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
1603
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
1604
|
+
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
1605
|
+
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
1606
|
+
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
1607
|
+
const before = obj.getState_Width();
|
|
1608
|
+
|
|
1609
|
+
// 2. 异步模式把宽度从 400 调到 600
|
|
1610
|
+
const asyncObj = obj.toAsync();
|
|
1611
|
+
asyncObj.setState_Width(600);
|
|
1612
|
+
await asyncObj.done();
|
|
1613
|
+
|
|
1614
|
+
// 3. 从画布重新读取,确认宽度已更新(保留现场供观察)
|
|
1615
|
+
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
|
|
1616
|
+
|
|
1617
|
+
console.log('width:', before, '→', refetched.getState_Width());
|
|
1618
|
+
```
|
|
1619
|
+
|
|
1620
|
+
### toasync
|
|
1621
|
+
|
|
1622
|
+
# IPCB\_PrimitiveObject.toAsync() method
|
|
1623
|
+
|
|
1624
|
+
Convert Primitive to Async primitive
|
|
1625
|
+
|
|
1626
|
+
## Signature
|
|
1627
|
+
|
|
1628
|
+
```typescript
|
|
1629
|
+
function toAsync(): IPCB_PrimitiveObject;
|
|
1630
|
+
```
|
|
1631
|
+
|
|
1632
|
+
## Returns
|
|
1633
|
+
|
|
1634
|
+
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
|
|
1635
|
+
|
|
1636
|
+
Binary embedded object primitive object
|
|
1637
|
+
|
|
1638
|
+
## Example
|
|
1639
|
+
|
|
1640
|
+
```javascript
|
|
1641
|
+
// 1. 生成本次运行专用的坐标,放置一个 400 x 300 的内嵌图片
|
|
1642
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
1643
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
1644
|
+
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
1645
|
+
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
1646
|
+
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
1647
|
+
|
|
1648
|
+
// 2. 切换异步模式后批量修改:放大到 600 x 450 并重命名
|
|
1649
|
+
const asyncObj = obj.toAsync();
|
|
1650
|
+
asyncObj.setState_Width(600);
|
|
1651
|
+
asyncObj.setState_Height(450);
|
|
1652
|
+
asyncObj.setState_FileName('logo-large.png');
|
|
1653
|
+
await asyncObj.done();
|
|
1654
|
+
|
|
1655
|
+
// 3. 从画布重新读取,确认批量修改已生效(保留现场供观察)
|
|
1656
|
+
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
|
|
1657
|
+
|
|
1658
|
+
console.log('width:', refetched.getState_Width());
|
|
1659
|
+
console.log('height:', refetched.getState_Height());
|
|
1660
|
+
console.log('fileName:', refetched.getState_FileName());
|
|
1661
|
+
```
|
|
1662
|
+
|
|
1663
|
+
### tosync
|
|
1664
|
+
|
|
1665
|
+
# IPCB\_PrimitiveObject.toSync() method
|
|
1666
|
+
|
|
1667
|
+
Convert Primitive to Sync primitive
|
|
1668
|
+
|
|
1669
|
+
## Signature
|
|
1670
|
+
|
|
1671
|
+
```typescript
|
|
1672
|
+
function toSync(): IPCB_PrimitiveObject;
|
|
1673
|
+
```
|
|
1674
|
+
|
|
1675
|
+
## Returns
|
|
1676
|
+
|
|
1677
|
+
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
|
|
1678
|
+
|
|
1679
|
+
Binary embedded object primitive object
|
|
1680
|
+
|
|
1681
|
+
## Example
|
|
1682
|
+
|
|
1683
|
+
```javascript
|
|
1684
|
+
// 1. 生成本次运行专用的坐标,放置一个内嵌图片
|
|
1685
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
1686
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
1687
|
+
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
|
|
1688
|
+
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
|
|
1689
|
+
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
|
|
1690
|
+
const before = obj.isAsync();
|
|
1691
|
+
|
|
1692
|
+
// 2. 转换为同步图元(保留现场供观察)
|
|
1693
|
+
const syncObj = obj.toSync();
|
|
1694
|
+
const after = syncObj.isAsync();
|
|
1695
|
+
|
|
1696
|
+
// 3. 同步图元直接读取属性,无需提交
|
|
1697
|
+
console.log('isAsync:', before, '→', after);
|
|
1698
|
+
console.log('primitiveType:', syncObj.getState_PrimitiveType());
|
|
1699
|
+
console.log('layer:', syncObj.getState_Layer());
|
|
1700
|
+
```
|