@windypro-rourou/dsh-eda 0.1.4 → 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 +1 -1
- package/lib/capabilities.js +3 -2
- package/lib/client.js +33 -0
- 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,1193 +1,1193 @@
|
|
|
1
|
-
# IPCB\_PrimitivePolyline class
|
|
2
|
-
|
|
3
|
-
Polyline primitive
|
|
4
|
-
|
|
5
|
-
## Signature
|
|
6
|
-
|
|
7
|
-
```typescript
|
|
8
|
-
class IPCB_PrimitivePolyline implements IPCB_Primitive
|
|
9
|
-
```
|
|
10
|
-
**Implements:** [IPCB\_Primitive](../interfaces/IPCB_Primitive.md)
|
|
11
|
-
|
|
12
|
-
## Remarks
|
|
13
|
-
|
|
14
|
-
## Methods
|
|
15
|
-
|
|
16
|
-
<table><thead><tr><th>
|
|
17
|
-
|
|
18
|
-
Method
|
|
19
|
-
|
|
20
|
-
</th><th>
|
|
21
|
-
|
|
22
|
-
Modifiers
|
|
23
|
-
|
|
24
|
-
</th><th>
|
|
25
|
-
|
|
26
|
-
Description
|
|
27
|
-
|
|
28
|
-
</th></tr></thead>
|
|
29
|
-
<tbody><tr><td>
|
|
30
|
-
|
|
31
|
-
[convertToFill()](./IPCB_PrimitivePolyline.md)
|
|
32
|
-
|
|
33
|
-
</td><td>
|
|
34
|
-
|
|
35
|
-
</td><td>
|
|
36
|
-
|
|
37
|
-
**_(BETA)_** Convert to: fill primitive
|
|
38
|
-
|
|
39
|
-
</td></tr>
|
|
40
|
-
<tr><td>
|
|
41
|
-
|
|
42
|
-
[convertToPour()](./IPCB_PrimitivePolyline.md)
|
|
43
|
-
|
|
44
|
-
</td><td>
|
|
45
|
-
|
|
46
|
-
</td><td>
|
|
47
|
-
|
|
48
|
-
**_(BETA)_** Convert to: Copper border primitive
|
|
49
|
-
|
|
50
|
-
</td></tr>
|
|
51
|
-
<tr><td>
|
|
52
|
-
|
|
53
|
-
[convertToRegion()](./IPCB_PrimitivePolyline.md)
|
|
54
|
-
|
|
55
|
-
</td><td>
|
|
56
|
-
|
|
57
|
-
</td><td>
|
|
58
|
-
|
|
59
|
-
**_(BETA)_** Convert to: Region primitive
|
|
60
|
-
|
|
61
|
-
</td></tr>
|
|
62
|
-
<tr><td>
|
|
63
|
-
|
|
64
|
-
[done()](./IPCB_PrimitivePolyline.md)
|
|
65
|
-
|
|
66
|
-
</td><td>
|
|
67
|
-
|
|
68
|
-
</td><td>
|
|
69
|
-
|
|
70
|
-
**_(BETA)_** Apply the changes to the primitives to the canvas
|
|
71
|
-
|
|
72
|
-
</td></tr>
|
|
73
|
-
<tr><td>
|
|
74
|
-
|
|
75
|
-
[getState\_Layer()](./IPCB_PrimitivePolyline.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\_LineWidth()](./IPCB_PrimitivePolyline.md)
|
|
87
|
-
|
|
88
|
-
</td><td>
|
|
89
|
-
|
|
90
|
-
</td><td>
|
|
91
|
-
|
|
92
|
-
Get the property state: Line width
|
|
93
|
-
|
|
94
|
-
</td></tr>
|
|
95
|
-
<tr><td>
|
|
96
|
-
|
|
97
|
-
[getState\_Net()](./IPCB_PrimitivePolyline.md)
|
|
98
|
-
|
|
99
|
-
</td><td>
|
|
100
|
-
|
|
101
|
-
</td><td>
|
|
102
|
-
|
|
103
|
-
Get the property state: net name
|
|
104
|
-
|
|
105
|
-
</td></tr>
|
|
106
|
-
<tr><td>
|
|
107
|
-
|
|
108
|
-
[getState\_Polygon()](./IPCB_PrimitivePolyline.md)
|
|
109
|
-
|
|
110
|
-
</td><td>
|
|
111
|
-
|
|
112
|
-
</td><td>
|
|
113
|
-
|
|
114
|
-
Get the property state: single polygon
|
|
115
|
-
|
|
116
|
-
</td></tr>
|
|
117
|
-
<tr><td>
|
|
118
|
-
|
|
119
|
-
[getState\_PrimitiveId()](./IPCB_PrimitivePolyline.md)
|
|
120
|
-
|
|
121
|
-
</td><td>
|
|
122
|
-
|
|
123
|
-
</td><td>
|
|
124
|
-
|
|
125
|
-
Get the property state: primitive ID
|
|
126
|
-
|
|
127
|
-
</td></tr>
|
|
128
|
-
<tr><td>
|
|
129
|
-
|
|
130
|
-
[getState\_PrimitiveLock()](./IPCB_PrimitivePolyline.md)
|
|
131
|
-
|
|
132
|
-
</td><td>
|
|
133
|
-
|
|
134
|
-
</td><td>
|
|
135
|
-
|
|
136
|
-
Get the property state: whether it is locked
|
|
137
|
-
|
|
138
|
-
</td></tr>
|
|
139
|
-
<tr><td>
|
|
140
|
-
|
|
141
|
-
[getState\_PrimitiveType()](./IPCB_PrimitivePolyline.md)
|
|
142
|
-
|
|
143
|
-
</td><td>
|
|
144
|
-
|
|
145
|
-
</td><td>
|
|
146
|
-
|
|
147
|
-
Get the property state: primitive type
|
|
148
|
-
|
|
149
|
-
</td></tr>
|
|
150
|
-
<tr><td>
|
|
151
|
-
|
|
152
|
-
[isAsync()](./IPCB_PrimitivePolyline.md)
|
|
153
|
-
|
|
154
|
-
</td><td>
|
|
155
|
-
|
|
156
|
-
</td><td>
|
|
157
|
-
|
|
158
|
-
Query whether the primitive is an async primitive
|
|
159
|
-
|
|
160
|
-
</td></tr>
|
|
161
|
-
<tr><td>
|
|
162
|
-
|
|
163
|
-
[reset()](./IPCB_PrimitivePolyline.md)
|
|
164
|
-
|
|
165
|
-
</td><td>
|
|
166
|
-
|
|
167
|
-
</td><td>
|
|
168
|
-
|
|
169
|
-
**_(BETA)_** Reset the async primitive to the current canvas state
|
|
170
|
-
|
|
171
|
-
</td></tr>
|
|
172
|
-
<tr><td>
|
|
173
|
-
|
|
174
|
-
[setState\_Layer(layer)](./IPCB_PrimitivePolyline.md)
|
|
175
|
-
|
|
176
|
-
</td><td>
|
|
177
|
-
|
|
178
|
-
</td><td>
|
|
179
|
-
|
|
180
|
-
**_(BETA)_** Set the property state: Layer
|
|
181
|
-
|
|
182
|
-
</td></tr>
|
|
183
|
-
<tr><td>
|
|
184
|
-
|
|
185
|
-
[setState\_LineWidth(lineWidth)](./IPCB_PrimitivePolyline.md)
|
|
186
|
-
|
|
187
|
-
</td><td>
|
|
188
|
-
|
|
189
|
-
</td><td>
|
|
190
|
-
|
|
191
|
-
**_(BETA)_** Set the property state: Line width
|
|
192
|
-
|
|
193
|
-
</td></tr>
|
|
194
|
-
<tr><td>
|
|
195
|
-
|
|
196
|
-
[setState\_Net(net)](./IPCB_PrimitivePolyline.md)
|
|
197
|
-
|
|
198
|
-
</td><td>
|
|
199
|
-
|
|
200
|
-
</td><td>
|
|
201
|
-
|
|
202
|
-
**_(BETA)_** Set the property state: net name
|
|
203
|
-
|
|
204
|
-
</td></tr>
|
|
205
|
-
<tr><td>
|
|
206
|
-
|
|
207
|
-
[setState\_Polygon(polygon)](./IPCB_PrimitivePolyline.md)
|
|
208
|
-
|
|
209
|
-
</td><td>
|
|
210
|
-
|
|
211
|
-
</td><td>
|
|
212
|
-
|
|
213
|
-
**_(BETA)_** Set the property state: single polygon
|
|
214
|
-
|
|
215
|
-
</td></tr>
|
|
216
|
-
<tr><td>
|
|
217
|
-
|
|
218
|
-
[setState\_PrimitiveLock(primitiveLock)](./IPCB_PrimitivePolyline.md)
|
|
219
|
-
|
|
220
|
-
</td><td>
|
|
221
|
-
|
|
222
|
-
</td><td>
|
|
223
|
-
|
|
224
|
-
**_(BETA)_** Set the property state: whether it is locked
|
|
225
|
-
|
|
226
|
-
</td></tr>
|
|
227
|
-
<tr><td>
|
|
228
|
-
|
|
229
|
-
[toAsync()](./IPCB_PrimitivePolyline.md)
|
|
230
|
-
|
|
231
|
-
</td><td>
|
|
232
|
-
|
|
233
|
-
</td><td>
|
|
234
|
-
|
|
235
|
-
Convert Primitive to Async primitive
|
|
236
|
-
|
|
237
|
-
</td></tr>
|
|
238
|
-
<tr><td>
|
|
239
|
-
|
|
240
|
-
[toSync()](./IPCB_PrimitivePolyline.md)
|
|
241
|
-
|
|
242
|
-
</td><td>
|
|
243
|
-
|
|
244
|
-
</td><td>
|
|
245
|
-
|
|
246
|
-
Convert Primitive to Sync primitive
|
|
247
|
-
|
|
248
|
-
</td></tr>
|
|
249
|
-
</tbody></table>
|
|
250
|
-
|
|
251
|
-
---
|
|
252
|
-
|
|
253
|
-
## 方法详情
|
|
254
|
-
|
|
255
|
-
### converttofill
|
|
256
|
-
|
|
257
|
-
# IPCB\_PrimitivePolyline.convertToFill() method
|
|
258
|
-
|
|
259
|
-
> 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.
|
|
260
|
-
|
|
261
|
-
Convert to: fill primitive
|
|
262
|
-
|
|
263
|
-
## Signature
|
|
264
|
-
|
|
265
|
-
```typescript
|
|
266
|
-
function convertToFill(): Promise<IPCB_PrimitiveFill>;
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
## Returns
|
|
270
|
-
|
|
271
|
-
Promise<[IPCB\_PrimitiveFill](./IPCB_PrimitiveFill.md)<!-- -->>
|
|
272
|
-
|
|
273
|
-
Fill primitive object
|
|
274
|
-
|
|
275
|
-
## Example
|
|
276
|
-
|
|
277
|
-
```javascript
|
|
278
|
-
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
|
|
279
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
280
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
281
|
-
|
|
282
|
-
// 2. 创建一条矩形闭合折线
|
|
283
|
-
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
|
|
284
|
-
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
285
|
-
|
|
286
|
-
// 3. 转换为填充图元(原折线保留,保留现场供观察)
|
|
287
|
-
const fill = await polyline.convertToFill();
|
|
288
|
-
|
|
289
|
-
console.log('primitiveType:', `${polyline.getState_PrimitiveType()} → ${fill.getState_PrimitiveType()}`);
|
|
290
|
-
console.log('primitiveId:', fill.getState_PrimitiveId());
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
### converttopour
|
|
294
|
-
|
|
295
|
-
# IPCB\_PrimitivePolyline.convertToPour() method
|
|
296
|
-
|
|
297
|
-
> 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.
|
|
298
|
-
|
|
299
|
-
Convert to: Copper border primitive
|
|
300
|
-
|
|
301
|
-
## Signature
|
|
302
|
-
|
|
303
|
-
```typescript
|
|
304
|
-
function convertToPour(): Promise<IPCB_PrimitivePour>;
|
|
305
|
-
```
|
|
306
|
-
|
|
307
|
-
## Returns
|
|
308
|
-
|
|
309
|
-
Promise<[IPCB\_PrimitivePour](./IPCB_PrimitivePour.md)<!-- -->>
|
|
310
|
-
|
|
311
|
-
Copper border primitive object
|
|
312
|
-
|
|
313
|
-
## Example
|
|
314
|
-
|
|
315
|
-
```javascript
|
|
316
|
-
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
|
|
317
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
318
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
319
|
-
|
|
320
|
-
// 2. 创建一条矩形闭合折线
|
|
321
|
-
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
|
|
322
|
-
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
323
|
-
|
|
324
|
-
// 3. 转换为覆铜边框图元(原折线保留,保留现场供观察)
|
|
325
|
-
const pour = await polyline.convertToPour();
|
|
326
|
-
|
|
327
|
-
console.log('primitiveType:', `${polyline.getState_PrimitiveType()} → ${pour.getState_PrimitiveType()}`);
|
|
328
|
-
console.log('primitiveId:', pour.getState_PrimitiveId());
|
|
329
|
-
```
|
|
330
|
-
|
|
331
|
-
### converttoregion
|
|
332
|
-
|
|
333
|
-
# IPCB\_PrimitivePolyline.convertToRegion() method
|
|
334
|
-
|
|
335
|
-
> 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.
|
|
336
|
-
|
|
337
|
-
Convert to: Region primitive
|
|
338
|
-
|
|
339
|
-
## Signature
|
|
340
|
-
|
|
341
|
-
```typescript
|
|
342
|
-
function convertToRegion(): Promise<IPCB_PrimitiveRegion>;
|
|
343
|
-
```
|
|
344
|
-
|
|
345
|
-
## Returns
|
|
346
|
-
|
|
347
|
-
Promise<[IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)<!-- -->>
|
|
348
|
-
|
|
349
|
-
Region primitive object
|
|
350
|
-
|
|
351
|
-
## Example
|
|
352
|
-
|
|
353
|
-
```javascript
|
|
354
|
-
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
|
|
355
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
356
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
357
|
-
|
|
358
|
-
// 2. 创建一条矩形闭合折线
|
|
359
|
-
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
|
|
360
|
-
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
361
|
-
|
|
362
|
-
// 3. 转换为区域图元(原折线保留,保留现场供观察)
|
|
363
|
-
const region = await polyline.convertToRegion();
|
|
364
|
-
|
|
365
|
-
console.log('primitiveType:', `${polyline.getState_PrimitiveType()} → ${region.getState_PrimitiveType()}`);
|
|
366
|
-
console.log('primitiveId:', region.getState_PrimitiveId());
|
|
367
|
-
```
|
|
368
|
-
|
|
369
|
-
### done
|
|
370
|
-
|
|
371
|
-
# IPCB\_PrimitivePolyline.done() method
|
|
372
|
-
|
|
373
|
-
> 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.
|
|
374
|
-
|
|
375
|
-
Apply the changes to the primitives to the canvas
|
|
376
|
-
|
|
377
|
-
## Signature
|
|
378
|
-
|
|
379
|
-
```typescript
|
|
380
|
-
function done(): Promise<IPCB_PrimitivePolyline>;
|
|
381
|
-
```
|
|
382
|
-
|
|
383
|
-
## Returns
|
|
384
|
-
|
|
385
|
-
Promise<[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)<!-- -->>
|
|
386
|
-
|
|
387
|
-
Polyline primitive object
|
|
388
|
-
|
|
389
|
-
## Example
|
|
390
|
-
|
|
391
|
-
```javascript
|
|
392
|
-
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
|
|
393
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
394
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
395
|
-
|
|
396
|
-
// 2. 创建一条顶层铜层的折线
|
|
397
|
-
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
|
|
398
|
-
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
399
|
-
const before = polyline.getState_Layer();
|
|
400
|
-
|
|
401
|
-
// 3. 异步模式下把折线挪到底层铜层(此时画布还没变)
|
|
402
|
-
const asyncPolyline = polyline.toAsync();
|
|
403
|
-
asyncPolyline.setState_Layer(2);
|
|
404
|
-
await asyncPolyline.done();
|
|
405
|
-
|
|
406
|
-
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
|
|
407
|
-
const refetched = await eda.pcb_PrimitivePolyline.get(polyline.getState_PrimitiveId());
|
|
408
|
-
|
|
409
|
-
console.log('layer:', before, '→', refetched.getState_Layer());
|
|
410
|
-
```
|
|
411
|
-
|
|
412
|
-
### getstate_layer
|
|
413
|
-
|
|
414
|
-
# IPCB\_PrimitivePolyline.getState\_Layer() method
|
|
415
|
-
|
|
416
|
-
Get the property state: Layer
|
|
417
|
-
|
|
418
|
-
## Signature
|
|
419
|
-
|
|
420
|
-
```typescript
|
|
421
|
-
function getState_Layer(): TPCB_LayersOfLine;
|
|
422
|
-
```
|
|
423
|
-
|
|
424
|
-
## Returns
|
|
425
|
-
|
|
426
|
-
[TPCB\_LayersOfLine](../types/TPCB_LayersOfLine.md)
|
|
427
|
-
|
|
428
|
-
Layer
|
|
429
|
-
|
|
430
|
-
## Example
|
|
431
|
-
|
|
432
|
-
```javascript
|
|
433
|
-
// 1. 创建一条顶层铜层(1)的折线
|
|
434
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
435
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
436
|
-
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
|
|
437
|
-
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
438
|
-
|
|
439
|
-
// 2. 读取折线所在层
|
|
440
|
-
const layer = polyline.getState_Layer();
|
|
441
|
-
|
|
442
|
-
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
443
|
-
await eda.pcb_PrimitivePolyline.delete([polyline.getState_PrimitiveId()]);
|
|
444
|
-
|
|
445
|
-
console.log('layer:', layer);
|
|
446
|
-
```
|
|
447
|
-
|
|
448
|
-
### getstate_linewidth
|
|
449
|
-
|
|
450
|
-
# IPCB\_PrimitivePolyline.getState\_LineWidth() method
|
|
451
|
-
|
|
452
|
-
Get the property state: Line width
|
|
453
|
-
|
|
454
|
-
## Signature
|
|
455
|
-
|
|
456
|
-
```typescript
|
|
457
|
-
function getState_LineWidth(): number;
|
|
458
|
-
```
|
|
459
|
-
|
|
460
|
-
## Returns
|
|
461
|
-
|
|
462
|
-
number
|
|
463
|
-
|
|
464
|
-
Line width
|
|
465
|
-
|
|
466
|
-
## Example
|
|
467
|
-
|
|
468
|
-
```javascript
|
|
469
|
-
// 1. 创建一条 10mil 线宽的折线
|
|
470
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
471
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
472
|
-
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
|
|
473
|
-
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
474
|
-
|
|
475
|
-
// 2. 读取线宽
|
|
476
|
-
const lineWidth = polyline.getState_LineWidth();
|
|
477
|
-
|
|
478
|
-
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
479
|
-
await eda.pcb_PrimitivePolyline.delete([polyline.getState_PrimitiveId()]);
|
|
480
|
-
|
|
481
|
-
console.log('lineWidth:', lineWidth);
|
|
482
|
-
```
|
|
483
|
-
|
|
484
|
-
### getstate_net
|
|
485
|
-
|
|
486
|
-
# IPCB\_PrimitivePolyline.getState\_Net() method
|
|
487
|
-
|
|
488
|
-
Get the property state: net name
|
|
489
|
-
|
|
490
|
-
## Signature
|
|
491
|
-
|
|
492
|
-
```typescript
|
|
493
|
-
function getState_Net(): string;
|
|
494
|
-
```
|
|
495
|
-
|
|
496
|
-
## Returns
|
|
497
|
-
|
|
498
|
-
string
|
|
499
|
-
|
|
500
|
-
Net name
|
|
501
|
-
|
|
502
|
-
## Example
|
|
503
|
-
|
|
504
|
-
```javascript
|
|
505
|
-
// 1. 创建一条无网络的折线
|
|
506
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
507
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
508
|
-
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
|
|
509
|
-
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
510
|
-
|
|
511
|
-
// 2. 读取网络名称(无网络时为空字符串)
|
|
512
|
-
const net = polyline.getState_Net();
|
|
513
|
-
|
|
514
|
-
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
515
|
-
await eda.pcb_PrimitivePolyline.delete([polyline.getState_PrimitiveId()]);
|
|
516
|
-
|
|
517
|
-
console.log('net:', JSON.stringify(net));
|
|
518
|
-
```
|
|
519
|
-
|
|
520
|
-
### getstate_polygon
|
|
521
|
-
|
|
522
|
-
# IPCB\_PrimitivePolyline.getState\_Polygon() method
|
|
523
|
-
|
|
524
|
-
Get the property state: single polygon
|
|
525
|
-
|
|
526
|
-
## Signature
|
|
527
|
-
|
|
528
|
-
```typescript
|
|
529
|
-
function getState_Polygon(): IPCB_Polygon;
|
|
530
|
-
```
|
|
531
|
-
|
|
532
|
-
## Returns
|
|
533
|
-
|
|
534
|
-
[IPCB\_Polygon](./IPCB_Polygon.md)
|
|
535
|
-
|
|
536
|
-
Single polygon
|
|
537
|
-
|
|
538
|
-
## Example
|
|
539
|
-
|
|
540
|
-
```javascript
|
|
541
|
-
// 1. 创建一条已知轮廓的折线(500 → 拐弯 → 300)
|
|
542
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
543
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
544
|
-
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
|
|
545
|
-
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
546
|
-
|
|
547
|
-
// 2. 读取多边形对象,再取它的轮廓源数组
|
|
548
|
-
const currentPolygon = polyline.getState_Polygon();
|
|
549
|
-
const source = currentPolygon.getSource();
|
|
550
|
-
|
|
551
|
-
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
552
|
-
await eda.pcb_PrimitivePolyline.delete([polyline.getState_PrimitiveId()]);
|
|
553
|
-
|
|
554
|
-
console.log('polygonSource:', JSON.stringify(source));
|
|
555
|
-
```
|
|
556
|
-
|
|
557
|
-
### getstate_primitiveid
|
|
558
|
-
|
|
559
|
-
# IPCB\_PrimitivePolyline.getState\_PrimitiveId() method
|
|
560
|
-
|
|
561
|
-
Get the property state: primitive ID
|
|
562
|
-
|
|
563
|
-
## Signature
|
|
564
|
-
|
|
565
|
-
```typescript
|
|
566
|
-
function getState_PrimitiveId(): string;
|
|
567
|
-
```
|
|
568
|
-
|
|
569
|
-
## Returns
|
|
570
|
-
|
|
571
|
-
string
|
|
572
|
-
|
|
573
|
-
Primitive ID
|
|
574
|
-
|
|
575
|
-
## Example
|
|
576
|
-
|
|
577
|
-
```javascript
|
|
578
|
-
// 1. 创建一条折线
|
|
579
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
580
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
581
|
-
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
|
|
582
|
-
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
583
|
-
|
|
584
|
-
// 2. 读取图元 ID
|
|
585
|
-
const primitiveId = polyline.getState_PrimitiveId();
|
|
586
|
-
|
|
587
|
-
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
588
|
-
await eda.pcb_PrimitivePolyline.delete([polyline.getState_PrimitiveId()]);
|
|
589
|
-
|
|
590
|
-
console.log('primitiveId:', primitiveId);
|
|
591
|
-
```
|
|
592
|
-
|
|
593
|
-
### getstate_primitivelock
|
|
594
|
-
|
|
595
|
-
# IPCB\_PrimitivePolyline.getState\_PrimitiveLock() method
|
|
596
|
-
|
|
597
|
-
Get the property state: whether it is locked
|
|
598
|
-
|
|
599
|
-
## Signature
|
|
600
|
-
|
|
601
|
-
```typescript
|
|
602
|
-
function getState_PrimitiveLock(): boolean;
|
|
603
|
-
```
|
|
604
|
-
|
|
605
|
-
## Returns
|
|
606
|
-
|
|
607
|
-
boolean
|
|
608
|
-
|
|
609
|
-
Whether it is locked
|
|
610
|
-
|
|
611
|
-
## Example
|
|
612
|
-
|
|
613
|
-
```javascript
|
|
614
|
-
// 1. 创建一条未锁定的折线
|
|
615
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
616
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
617
|
-
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
|
|
618
|
-
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
619
|
-
|
|
620
|
-
// 2. 读取锁定状态
|
|
621
|
-
const primitiveLock = polyline.getState_PrimitiveLock();
|
|
622
|
-
|
|
623
|
-
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
624
|
-
await eda.pcb_PrimitivePolyline.delete([polyline.getState_PrimitiveId()]);
|
|
625
|
-
|
|
626
|
-
console.log('primitiveLock:', primitiveLock);
|
|
627
|
-
```
|
|
628
|
-
|
|
629
|
-
### getstate_primitivetype
|
|
630
|
-
|
|
631
|
-
# IPCB\_PrimitivePolyline.getState\_PrimitiveType() method
|
|
632
|
-
|
|
633
|
-
Get the property state: primitive type
|
|
634
|
-
|
|
635
|
-
## Signature
|
|
636
|
-
|
|
637
|
-
```typescript
|
|
638
|
-
function getState_PrimitiveType(): EPCB_PrimitiveType;
|
|
639
|
-
```
|
|
640
|
-
|
|
641
|
-
## Returns
|
|
642
|
-
|
|
643
|
-
[EPCB\_PrimitiveType](../enums/EPCB_PrimitiveType.md)
|
|
644
|
-
|
|
645
|
-
Primitive type
|
|
646
|
-
|
|
647
|
-
## Example
|
|
648
|
-
|
|
649
|
-
```javascript
|
|
650
|
-
// 1. 创建一条折线
|
|
651
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
652
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
653
|
-
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
|
|
654
|
-
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
655
|
-
|
|
656
|
-
// 2. 读取图元类型
|
|
657
|
-
const primitiveType = polyline.getState_PrimitiveType();
|
|
658
|
-
|
|
659
|
-
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
660
|
-
await eda.pcb_PrimitivePolyline.delete([polyline.getState_PrimitiveId()]);
|
|
661
|
-
|
|
662
|
-
console.log('primitiveType:', primitiveType);
|
|
663
|
-
```
|
|
664
|
-
|
|
665
|
-
### isasync
|
|
666
|
-
|
|
667
|
-
# IPCB\_PrimitivePolyline.isAsync() method
|
|
668
|
-
|
|
669
|
-
Query whether the primitive is an async primitive
|
|
670
|
-
|
|
671
|
-
## Signature
|
|
672
|
-
|
|
673
|
-
```typescript
|
|
674
|
-
function isAsync(): boolean;
|
|
675
|
-
```
|
|
676
|
-
|
|
677
|
-
## Returns
|
|
678
|
-
|
|
679
|
-
boolean
|
|
680
|
-
|
|
681
|
-
Whether Is async primitive
|
|
682
|
-
|
|
683
|
-
## Example
|
|
684
|
-
|
|
685
|
-
```javascript
|
|
686
|
-
// 1. 创建一条折线
|
|
687
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
688
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
689
|
-
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
|
|
690
|
-
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
691
|
-
|
|
692
|
-
// 2. 查询异步模式
|
|
693
|
-
const isAsync = polyline.isAsync();
|
|
694
|
-
|
|
695
|
-
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
696
|
-
await eda.pcb_PrimitivePolyline.delete([polyline.getState_PrimitiveId()]);
|
|
697
|
-
|
|
698
|
-
console.log('isAsync:', isAsync);
|
|
699
|
-
```
|
|
700
|
-
|
|
701
|
-
### reset
|
|
702
|
-
|
|
703
|
-
# IPCB\_PrimitivePolyline.reset() method
|
|
704
|
-
|
|
705
|
-
> 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.
|
|
706
|
-
|
|
707
|
-
Reset the async primitive to the current canvas state
|
|
708
|
-
|
|
709
|
-
## Signature
|
|
710
|
-
|
|
711
|
-
```typescript
|
|
712
|
-
function reset(): Promise<IPCB_PrimitivePolyline>;
|
|
713
|
-
```
|
|
714
|
-
|
|
715
|
-
## Returns
|
|
716
|
-
|
|
717
|
-
Promise<[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)<!-- -->>
|
|
718
|
-
|
|
719
|
-
Polyline primitive object
|
|
720
|
-
|
|
721
|
-
## Example
|
|
722
|
-
|
|
723
|
-
```javascript
|
|
724
|
-
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
|
|
725
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
726
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
727
|
-
|
|
728
|
-
// 2. 创建一条顶层铜层的折线
|
|
729
|
-
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
|
|
730
|
-
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
731
|
-
const before = polyline.getState_Layer();
|
|
732
|
-
|
|
733
|
-
// 3. 异步模式下把层改到底层(2),随后反悔
|
|
734
|
-
const asyncPolyline = polyline.toAsync();
|
|
735
|
-
asyncPolyline.setState_Layer(2);
|
|
736
|
-
|
|
737
|
-
// 4. reset 丢弃未提交的修改(保留现场供观察)
|
|
738
|
-
await asyncPolyline.reset();
|
|
739
|
-
|
|
740
|
-
// 5. 从画布重新读取,确认层没有变
|
|
741
|
-
const refetched = await eda.pcb_PrimitivePolyline.get(polyline.getState_PrimitiveId());
|
|
742
|
-
|
|
743
|
-
console.log('layer:', before, '→', refetched.getState_Layer());
|
|
744
|
-
```
|
|
745
|
-
|
|
746
|
-
### setstate_layer
|
|
747
|
-
|
|
748
|
-
# IPCB\_PrimitivePolyline.setState\_Layer() method
|
|
749
|
-
|
|
750
|
-
> 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.
|
|
751
|
-
|
|
752
|
-
Set the property state: Layer
|
|
753
|
-
|
|
754
|
-
## Signature
|
|
755
|
-
|
|
756
|
-
```typescript
|
|
757
|
-
function setState_Layer(layer: TPCB_LayersOfLine): IPCB_PrimitivePolyline;
|
|
758
|
-
```
|
|
759
|
-
|
|
760
|
-
## Parameters
|
|
761
|
-
|
|
762
|
-
<table><thead><tr><th>
|
|
763
|
-
|
|
764
|
-
Parameter
|
|
765
|
-
|
|
766
|
-
</th><th>
|
|
767
|
-
|
|
768
|
-
Type
|
|
769
|
-
|
|
770
|
-
</th><th>
|
|
771
|
-
|
|
772
|
-
Description
|
|
773
|
-
|
|
774
|
-
</th></tr></thead>
|
|
775
|
-
<tbody><tr><td>
|
|
776
|
-
|
|
777
|
-
layer
|
|
778
|
-
|
|
779
|
-
</td><td>
|
|
780
|
-
|
|
781
|
-
[TPCB\_LayersOfLine](../types/TPCB_LayersOfLine.md)
|
|
782
|
-
|
|
783
|
-
</td><td>
|
|
784
|
-
|
|
785
|
-
Layer
|
|
786
|
-
|
|
787
|
-
</td></tr>
|
|
788
|
-
</tbody></table>
|
|
789
|
-
|
|
790
|
-
## Returns
|
|
791
|
-
|
|
792
|
-
[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)
|
|
793
|
-
|
|
794
|
-
Polyline primitive object
|
|
795
|
-
|
|
796
|
-
## Example
|
|
797
|
-
|
|
798
|
-
```javascript
|
|
799
|
-
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
|
|
800
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
801
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
802
|
-
|
|
803
|
-
// 2. 创建一条顶层铜层(1)的折线
|
|
804
|
-
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
|
|
805
|
-
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
806
|
-
const before = polyline.getState_Layer();
|
|
807
|
-
|
|
808
|
-
// 3. 异步模式把折线挪到底层铜层(2)
|
|
809
|
-
const asyncPolyline = polyline.toAsync();
|
|
810
|
-
asyncPolyline.setState_Layer(2);
|
|
811
|
-
await asyncPolyline.done();
|
|
812
|
-
|
|
813
|
-
// 4. 从画布重新读取,确认层已切换(保留现场供观察)
|
|
814
|
-
const refetched = await eda.pcb_PrimitivePolyline.get(polyline.getState_PrimitiveId());
|
|
815
|
-
|
|
816
|
-
console.log('layer:', before, '→', refetched.getState_Layer());
|
|
817
|
-
```
|
|
818
|
-
|
|
819
|
-
### setstate_linewidth
|
|
820
|
-
|
|
821
|
-
# IPCB\_PrimitivePolyline.setState\_LineWidth() method
|
|
822
|
-
|
|
823
|
-
> 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.
|
|
824
|
-
|
|
825
|
-
Set the property state: Line width
|
|
826
|
-
|
|
827
|
-
## Signature
|
|
828
|
-
|
|
829
|
-
```typescript
|
|
830
|
-
function setState_LineWidth(lineWidth: number): IPCB_PrimitivePolyline;
|
|
831
|
-
```
|
|
832
|
-
|
|
833
|
-
## Parameters
|
|
834
|
-
|
|
835
|
-
<table><thead><tr><th>
|
|
836
|
-
|
|
837
|
-
Parameter
|
|
838
|
-
|
|
839
|
-
</th><th>
|
|
840
|
-
|
|
841
|
-
Type
|
|
842
|
-
|
|
843
|
-
</th><th>
|
|
844
|
-
|
|
845
|
-
Description
|
|
846
|
-
|
|
847
|
-
</th></tr></thead>
|
|
848
|
-
<tbody><tr><td>
|
|
849
|
-
|
|
850
|
-
lineWidth
|
|
851
|
-
|
|
852
|
-
</td><td>
|
|
853
|
-
|
|
854
|
-
number
|
|
855
|
-
|
|
856
|
-
</td><td>
|
|
857
|
-
|
|
858
|
-
Line width
|
|
859
|
-
|
|
860
|
-
</td></tr>
|
|
861
|
-
</tbody></table>
|
|
862
|
-
|
|
863
|
-
## Returns
|
|
864
|
-
|
|
865
|
-
[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)
|
|
866
|
-
|
|
867
|
-
Polyline primitive object
|
|
868
|
-
|
|
869
|
-
## Example
|
|
870
|
-
|
|
871
|
-
```javascript
|
|
872
|
-
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
|
|
873
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
874
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
875
|
-
|
|
876
|
-
// 2. 创建一条 10mil 线宽的折线
|
|
877
|
-
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
|
|
878
|
-
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
879
|
-
const before = polyline.getState_LineWidth();
|
|
880
|
-
|
|
881
|
-
// 3. 切换异步模式,线宽加粗到 20mil
|
|
882
|
-
const asyncPolyline = polyline.toAsync();
|
|
883
|
-
asyncPolyline.setState_LineWidth(20);
|
|
884
|
-
await asyncPolyline.done();
|
|
885
|
-
|
|
886
|
-
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
|
|
887
|
-
const refetched = await eda.pcb_PrimitivePolyline.get(polyline.getState_PrimitiveId());
|
|
888
|
-
|
|
889
|
-
console.log('lineWidth:', before, '→', refetched.getState_LineWidth());
|
|
890
|
-
```
|
|
891
|
-
|
|
892
|
-
### setstate_net
|
|
893
|
-
|
|
894
|
-
# IPCB\_PrimitivePolyline.setState\_Net() method
|
|
895
|
-
|
|
896
|
-
> 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.
|
|
897
|
-
|
|
898
|
-
Set the property state: net name
|
|
899
|
-
|
|
900
|
-
## Signature
|
|
901
|
-
|
|
902
|
-
```typescript
|
|
903
|
-
function setState_Net(net: string): IPCB_PrimitivePolyline;
|
|
904
|
-
```
|
|
905
|
-
|
|
906
|
-
## Parameters
|
|
907
|
-
|
|
908
|
-
<table><thead><tr><th>
|
|
909
|
-
|
|
910
|
-
Parameter
|
|
911
|
-
|
|
912
|
-
</th><th>
|
|
913
|
-
|
|
914
|
-
Type
|
|
915
|
-
|
|
916
|
-
</th><th>
|
|
917
|
-
|
|
918
|
-
Description
|
|
919
|
-
|
|
920
|
-
</th></tr></thead>
|
|
921
|
-
<tbody><tr><td>
|
|
922
|
-
|
|
923
|
-
net
|
|
924
|
-
|
|
925
|
-
</td><td>
|
|
926
|
-
|
|
927
|
-
string
|
|
928
|
-
|
|
929
|
-
</td><td>
|
|
930
|
-
|
|
931
|
-
Net name
|
|
932
|
-
|
|
933
|
-
</td></tr>
|
|
934
|
-
</tbody></table>
|
|
935
|
-
|
|
936
|
-
## Returns
|
|
937
|
-
|
|
938
|
-
[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)
|
|
939
|
-
|
|
940
|
-
Polyline primitive object
|
|
941
|
-
|
|
942
|
-
## Example
|
|
943
|
-
|
|
944
|
-
```javascript
|
|
945
|
-
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
|
|
946
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
947
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
948
|
-
|
|
949
|
-
// 2. 创建一条无网络的折线
|
|
950
|
-
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
|
|
951
|
-
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
952
|
-
const before = polyline.getState_Net();
|
|
953
|
-
|
|
954
|
-
// 3. 切换异步模式并指定网络('' → '嘉立创示例_NET')
|
|
955
|
-
const asyncPolyline = polyline.toAsync();
|
|
956
|
-
asyncPolyline.setState_Net('嘉立创示例_NET');
|
|
957
|
-
await asyncPolyline.done();
|
|
958
|
-
|
|
959
|
-
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
|
|
960
|
-
const refetched = await eda.pcb_PrimitivePolyline.get(polyline.getState_PrimitiveId());
|
|
961
|
-
|
|
962
|
-
console.log('net:', JSON.stringify(before), '→', JSON.stringify(refetched.getState_Net()));
|
|
963
|
-
```
|
|
964
|
-
|
|
965
|
-
### setstate_polygon
|
|
966
|
-
|
|
967
|
-
# IPCB\_PrimitivePolyline.setState\_Polygon() method
|
|
968
|
-
|
|
969
|
-
> 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.
|
|
970
|
-
|
|
971
|
-
Set the property state: single polygon
|
|
972
|
-
|
|
973
|
-
## Signature
|
|
974
|
-
|
|
975
|
-
```typescript
|
|
976
|
-
function setState_Polygon(polygon: IPCB_Polygon): IPCB_PrimitivePolyline;
|
|
977
|
-
```
|
|
978
|
-
|
|
979
|
-
## Parameters
|
|
980
|
-
|
|
981
|
-
<table><thead><tr><th>
|
|
982
|
-
|
|
983
|
-
Parameter
|
|
984
|
-
|
|
985
|
-
</th><th>
|
|
986
|
-
|
|
987
|
-
Type
|
|
988
|
-
|
|
989
|
-
</th><th>
|
|
990
|
-
|
|
991
|
-
Description
|
|
992
|
-
|
|
993
|
-
</th></tr></thead>
|
|
994
|
-
<tbody><tr><td>
|
|
995
|
-
|
|
996
|
-
polygon
|
|
997
|
-
|
|
998
|
-
</td><td>
|
|
999
|
-
|
|
1000
|
-
[IPCB\_Polygon](./IPCB_Polygon.md)
|
|
1001
|
-
|
|
1002
|
-
</td><td>
|
|
1003
|
-
|
|
1004
|
-
Single polygon
|
|
1005
|
-
|
|
1006
|
-
</td></tr>
|
|
1007
|
-
</tbody></table>
|
|
1008
|
-
|
|
1009
|
-
## Returns
|
|
1010
|
-
|
|
1011
|
-
[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)
|
|
1012
|
-
|
|
1013
|
-
Polyline primitive object
|
|
1014
|
-
|
|
1015
|
-
## Example
|
|
1016
|
-
|
|
1017
|
-
```javascript
|
|
1018
|
-
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
|
|
1019
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
1020
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
1021
|
-
|
|
1022
|
-
// 2. 创建一条 500 → 拐弯 → 300 的折线
|
|
1023
|
-
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
|
|
1024
|
-
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
1025
|
-
const before = JSON.stringify(polyline.getState_Polygon().getSource());
|
|
1026
|
-
|
|
1027
|
-
// 3. 构造新轮廓(拉长到 800 → 拐弯 → 600),异步模式提交
|
|
1028
|
-
const newPolygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 800, y, x + 800, y + 600]);
|
|
1029
|
-
const asyncPolyline = polyline.toAsync();
|
|
1030
|
-
asyncPolyline.setState_Polygon(newPolygon);
|
|
1031
|
-
await asyncPolyline.done();
|
|
1032
|
-
|
|
1033
|
-
// 4. 从画布重新读取,确认轮廓已替换(保留现场供观察)
|
|
1034
|
-
const refetched = await eda.pcb_PrimitivePolyline.get(polyline.getState_PrimitiveId());
|
|
1035
|
-
const after = JSON.stringify(refetched.getState_Polygon().getSource());
|
|
1036
|
-
|
|
1037
|
-
console.log('polygonSource:', before, '→', after);
|
|
1038
|
-
```
|
|
1039
|
-
|
|
1040
|
-
### setstate_primitivelock
|
|
1041
|
-
|
|
1042
|
-
# IPCB\_PrimitivePolyline.setState\_PrimitiveLock() method
|
|
1043
|
-
|
|
1044
|
-
> 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.
|
|
1045
|
-
|
|
1046
|
-
Set the property state: whether it is locked
|
|
1047
|
-
|
|
1048
|
-
## Signature
|
|
1049
|
-
|
|
1050
|
-
```typescript
|
|
1051
|
-
function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitivePolyline;
|
|
1052
|
-
```
|
|
1053
|
-
|
|
1054
|
-
## Parameters
|
|
1055
|
-
|
|
1056
|
-
<table><thead><tr><th>
|
|
1057
|
-
|
|
1058
|
-
Parameter
|
|
1059
|
-
|
|
1060
|
-
</th><th>
|
|
1061
|
-
|
|
1062
|
-
Type
|
|
1063
|
-
|
|
1064
|
-
</th><th>
|
|
1065
|
-
|
|
1066
|
-
Description
|
|
1067
|
-
|
|
1068
|
-
</th></tr></thead>
|
|
1069
|
-
<tbody><tr><td>
|
|
1070
|
-
|
|
1071
|
-
primitiveLock
|
|
1072
|
-
|
|
1073
|
-
</td><td>
|
|
1074
|
-
|
|
1075
|
-
boolean
|
|
1076
|
-
|
|
1077
|
-
</td><td>
|
|
1078
|
-
|
|
1079
|
-
Whether it is locked
|
|
1080
|
-
|
|
1081
|
-
</td></tr>
|
|
1082
|
-
</tbody></table>
|
|
1083
|
-
|
|
1084
|
-
## Returns
|
|
1085
|
-
|
|
1086
|
-
[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)
|
|
1087
|
-
|
|
1088
|
-
Polyline primitive object
|
|
1089
|
-
|
|
1090
|
-
## Example
|
|
1091
|
-
|
|
1092
|
-
```javascript
|
|
1093
|
-
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
|
|
1094
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
1095
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
1096
|
-
|
|
1097
|
-
// 2. 创建一条未锁定的折线
|
|
1098
|
-
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
|
|
1099
|
-
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
1100
|
-
const before = polyline.getState_PrimitiveLock();
|
|
1101
|
-
|
|
1102
|
-
// 3. 切换异步模式并锁定折线
|
|
1103
|
-
const asyncPolyline = polyline.toAsync();
|
|
1104
|
-
asyncPolyline.setState_PrimitiveLock(true);
|
|
1105
|
-
await asyncPolyline.done();
|
|
1106
|
-
|
|
1107
|
-
// 4. 从画布重新读取,确认已锁定(保留现场供观察)
|
|
1108
|
-
const refetched = await eda.pcb_PrimitivePolyline.get(polyline.getState_PrimitiveId());
|
|
1109
|
-
|
|
1110
|
-
console.log('primitiveLock:', before, '→', refetched.getState_PrimitiveLock());
|
|
1111
|
-
```
|
|
1112
|
-
|
|
1113
|
-
### toasync
|
|
1114
|
-
|
|
1115
|
-
# IPCB\_PrimitivePolyline.toAsync() method
|
|
1116
|
-
|
|
1117
|
-
Convert Primitive to Async primitive
|
|
1118
|
-
|
|
1119
|
-
## Signature
|
|
1120
|
-
|
|
1121
|
-
```typescript
|
|
1122
|
-
function toAsync(): IPCB_PrimitivePolyline;
|
|
1123
|
-
```
|
|
1124
|
-
|
|
1125
|
-
## Returns
|
|
1126
|
-
|
|
1127
|
-
[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)
|
|
1128
|
-
|
|
1129
|
-
Polyline primitive object
|
|
1130
|
-
|
|
1131
|
-
## Example
|
|
1132
|
-
|
|
1133
|
-
```javascript
|
|
1134
|
-
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
|
|
1135
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
1136
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
1137
|
-
|
|
1138
|
-
// 2. 创建一条无网络的折线
|
|
1139
|
-
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
|
|
1140
|
-
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
1141
|
-
|
|
1142
|
-
// 3. 切换异步模式后批量修改:划归网络 + 挪到底层
|
|
1143
|
-
const asyncPolyline = polyline.toAsync();
|
|
1144
|
-
asyncPolyline.setState_Net('嘉立创示例_NET');
|
|
1145
|
-
asyncPolyline.setState_Layer(2);
|
|
1146
|
-
await asyncPolyline.done();
|
|
1147
|
-
|
|
1148
|
-
// 4. 从画布重新读取,确认批量修改已生效(保留现场供观察)
|
|
1149
|
-
const refetched = await eda.pcb_PrimitivePolyline.get(polyline.getState_PrimitiveId());
|
|
1150
|
-
|
|
1151
|
-
console.log('net:', JSON.stringify(refetched.getState_Net()));
|
|
1152
|
-
console.log('layer:', refetched.getState_Layer());
|
|
1153
|
-
```
|
|
1154
|
-
|
|
1155
|
-
### tosync
|
|
1156
|
-
|
|
1157
|
-
# IPCB\_PrimitivePolyline.toSync() method
|
|
1158
|
-
|
|
1159
|
-
Convert Primitive to Sync primitive
|
|
1160
|
-
|
|
1161
|
-
## Signature
|
|
1162
|
-
|
|
1163
|
-
```typescript
|
|
1164
|
-
function toSync(): IPCB_PrimitivePolyline;
|
|
1165
|
-
```
|
|
1166
|
-
|
|
1167
|
-
## Returns
|
|
1168
|
-
|
|
1169
|
-
[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)
|
|
1170
|
-
|
|
1171
|
-
Polyline primitive object
|
|
1172
|
-
|
|
1173
|
-
## Example
|
|
1174
|
-
|
|
1175
|
-
```javascript
|
|
1176
|
-
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
|
|
1177
|
-
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
1178
|
-
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
1179
|
-
|
|
1180
|
-
// 2. 创建一条折线
|
|
1181
|
-
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
|
|
1182
|
-
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
1183
|
-
const before = polyline.isAsync();
|
|
1184
|
-
|
|
1185
|
-
// 3. 转换为同步图元(保留现场供观察)
|
|
1186
|
-
const syncPolyline = polyline.toSync();
|
|
1187
|
-
const after = syncPolyline.isAsync();
|
|
1188
|
-
|
|
1189
|
-
// 4. 同步图元直接读取属性,无需提交
|
|
1190
|
-
console.log('isAsync:', before, '→', after);
|
|
1191
|
-
console.log('primitiveType:', syncPolyline.getState_PrimitiveType());
|
|
1192
|
-
console.log('layer:', syncPolyline.getState_Layer());
|
|
1193
|
-
```
|
|
1
|
+
# IPCB\_PrimitivePolyline class
|
|
2
|
+
|
|
3
|
+
Polyline primitive
|
|
4
|
+
|
|
5
|
+
## Signature
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
class IPCB_PrimitivePolyline implements IPCB_Primitive
|
|
9
|
+
```
|
|
10
|
+
**Implements:** [IPCB\_Primitive](../interfaces/IPCB_Primitive.md)
|
|
11
|
+
|
|
12
|
+
## Remarks
|
|
13
|
+
|
|
14
|
+
## Methods
|
|
15
|
+
|
|
16
|
+
<table><thead><tr><th>
|
|
17
|
+
|
|
18
|
+
Method
|
|
19
|
+
|
|
20
|
+
</th><th>
|
|
21
|
+
|
|
22
|
+
Modifiers
|
|
23
|
+
|
|
24
|
+
</th><th>
|
|
25
|
+
|
|
26
|
+
Description
|
|
27
|
+
|
|
28
|
+
</th></tr></thead>
|
|
29
|
+
<tbody><tr><td>
|
|
30
|
+
|
|
31
|
+
[convertToFill()](./IPCB_PrimitivePolyline.md)
|
|
32
|
+
|
|
33
|
+
</td><td>
|
|
34
|
+
|
|
35
|
+
</td><td>
|
|
36
|
+
|
|
37
|
+
**_(BETA)_** Convert to: fill primitive
|
|
38
|
+
|
|
39
|
+
</td></tr>
|
|
40
|
+
<tr><td>
|
|
41
|
+
|
|
42
|
+
[convertToPour()](./IPCB_PrimitivePolyline.md)
|
|
43
|
+
|
|
44
|
+
</td><td>
|
|
45
|
+
|
|
46
|
+
</td><td>
|
|
47
|
+
|
|
48
|
+
**_(BETA)_** Convert to: Copper border primitive
|
|
49
|
+
|
|
50
|
+
</td></tr>
|
|
51
|
+
<tr><td>
|
|
52
|
+
|
|
53
|
+
[convertToRegion()](./IPCB_PrimitivePolyline.md)
|
|
54
|
+
|
|
55
|
+
</td><td>
|
|
56
|
+
|
|
57
|
+
</td><td>
|
|
58
|
+
|
|
59
|
+
**_(BETA)_** Convert to: Region primitive
|
|
60
|
+
|
|
61
|
+
</td></tr>
|
|
62
|
+
<tr><td>
|
|
63
|
+
|
|
64
|
+
[done()](./IPCB_PrimitivePolyline.md)
|
|
65
|
+
|
|
66
|
+
</td><td>
|
|
67
|
+
|
|
68
|
+
</td><td>
|
|
69
|
+
|
|
70
|
+
**_(BETA)_** Apply the changes to the primitives to the canvas
|
|
71
|
+
|
|
72
|
+
</td></tr>
|
|
73
|
+
<tr><td>
|
|
74
|
+
|
|
75
|
+
[getState\_Layer()](./IPCB_PrimitivePolyline.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\_LineWidth()](./IPCB_PrimitivePolyline.md)
|
|
87
|
+
|
|
88
|
+
</td><td>
|
|
89
|
+
|
|
90
|
+
</td><td>
|
|
91
|
+
|
|
92
|
+
Get the property state: Line width
|
|
93
|
+
|
|
94
|
+
</td></tr>
|
|
95
|
+
<tr><td>
|
|
96
|
+
|
|
97
|
+
[getState\_Net()](./IPCB_PrimitivePolyline.md)
|
|
98
|
+
|
|
99
|
+
</td><td>
|
|
100
|
+
|
|
101
|
+
</td><td>
|
|
102
|
+
|
|
103
|
+
Get the property state: net name
|
|
104
|
+
|
|
105
|
+
</td></tr>
|
|
106
|
+
<tr><td>
|
|
107
|
+
|
|
108
|
+
[getState\_Polygon()](./IPCB_PrimitivePolyline.md)
|
|
109
|
+
|
|
110
|
+
</td><td>
|
|
111
|
+
|
|
112
|
+
</td><td>
|
|
113
|
+
|
|
114
|
+
Get the property state: single polygon
|
|
115
|
+
|
|
116
|
+
</td></tr>
|
|
117
|
+
<tr><td>
|
|
118
|
+
|
|
119
|
+
[getState\_PrimitiveId()](./IPCB_PrimitivePolyline.md)
|
|
120
|
+
|
|
121
|
+
</td><td>
|
|
122
|
+
|
|
123
|
+
</td><td>
|
|
124
|
+
|
|
125
|
+
Get the property state: primitive ID
|
|
126
|
+
|
|
127
|
+
</td></tr>
|
|
128
|
+
<tr><td>
|
|
129
|
+
|
|
130
|
+
[getState\_PrimitiveLock()](./IPCB_PrimitivePolyline.md)
|
|
131
|
+
|
|
132
|
+
</td><td>
|
|
133
|
+
|
|
134
|
+
</td><td>
|
|
135
|
+
|
|
136
|
+
Get the property state: whether it is locked
|
|
137
|
+
|
|
138
|
+
</td></tr>
|
|
139
|
+
<tr><td>
|
|
140
|
+
|
|
141
|
+
[getState\_PrimitiveType()](./IPCB_PrimitivePolyline.md)
|
|
142
|
+
|
|
143
|
+
</td><td>
|
|
144
|
+
|
|
145
|
+
</td><td>
|
|
146
|
+
|
|
147
|
+
Get the property state: primitive type
|
|
148
|
+
|
|
149
|
+
</td></tr>
|
|
150
|
+
<tr><td>
|
|
151
|
+
|
|
152
|
+
[isAsync()](./IPCB_PrimitivePolyline.md)
|
|
153
|
+
|
|
154
|
+
</td><td>
|
|
155
|
+
|
|
156
|
+
</td><td>
|
|
157
|
+
|
|
158
|
+
Query whether the primitive is an async primitive
|
|
159
|
+
|
|
160
|
+
</td></tr>
|
|
161
|
+
<tr><td>
|
|
162
|
+
|
|
163
|
+
[reset()](./IPCB_PrimitivePolyline.md)
|
|
164
|
+
|
|
165
|
+
</td><td>
|
|
166
|
+
|
|
167
|
+
</td><td>
|
|
168
|
+
|
|
169
|
+
**_(BETA)_** Reset the async primitive to the current canvas state
|
|
170
|
+
|
|
171
|
+
</td></tr>
|
|
172
|
+
<tr><td>
|
|
173
|
+
|
|
174
|
+
[setState\_Layer(layer)](./IPCB_PrimitivePolyline.md)
|
|
175
|
+
|
|
176
|
+
</td><td>
|
|
177
|
+
|
|
178
|
+
</td><td>
|
|
179
|
+
|
|
180
|
+
**_(BETA)_** Set the property state: Layer
|
|
181
|
+
|
|
182
|
+
</td></tr>
|
|
183
|
+
<tr><td>
|
|
184
|
+
|
|
185
|
+
[setState\_LineWidth(lineWidth)](./IPCB_PrimitivePolyline.md)
|
|
186
|
+
|
|
187
|
+
</td><td>
|
|
188
|
+
|
|
189
|
+
</td><td>
|
|
190
|
+
|
|
191
|
+
**_(BETA)_** Set the property state: Line width
|
|
192
|
+
|
|
193
|
+
</td></tr>
|
|
194
|
+
<tr><td>
|
|
195
|
+
|
|
196
|
+
[setState\_Net(net)](./IPCB_PrimitivePolyline.md)
|
|
197
|
+
|
|
198
|
+
</td><td>
|
|
199
|
+
|
|
200
|
+
</td><td>
|
|
201
|
+
|
|
202
|
+
**_(BETA)_** Set the property state: net name
|
|
203
|
+
|
|
204
|
+
</td></tr>
|
|
205
|
+
<tr><td>
|
|
206
|
+
|
|
207
|
+
[setState\_Polygon(polygon)](./IPCB_PrimitivePolyline.md)
|
|
208
|
+
|
|
209
|
+
</td><td>
|
|
210
|
+
|
|
211
|
+
</td><td>
|
|
212
|
+
|
|
213
|
+
**_(BETA)_** Set the property state: single polygon
|
|
214
|
+
|
|
215
|
+
</td></tr>
|
|
216
|
+
<tr><td>
|
|
217
|
+
|
|
218
|
+
[setState\_PrimitiveLock(primitiveLock)](./IPCB_PrimitivePolyline.md)
|
|
219
|
+
|
|
220
|
+
</td><td>
|
|
221
|
+
|
|
222
|
+
</td><td>
|
|
223
|
+
|
|
224
|
+
**_(BETA)_** Set the property state: whether it is locked
|
|
225
|
+
|
|
226
|
+
</td></tr>
|
|
227
|
+
<tr><td>
|
|
228
|
+
|
|
229
|
+
[toAsync()](./IPCB_PrimitivePolyline.md)
|
|
230
|
+
|
|
231
|
+
</td><td>
|
|
232
|
+
|
|
233
|
+
</td><td>
|
|
234
|
+
|
|
235
|
+
Convert Primitive to Async primitive
|
|
236
|
+
|
|
237
|
+
</td></tr>
|
|
238
|
+
<tr><td>
|
|
239
|
+
|
|
240
|
+
[toSync()](./IPCB_PrimitivePolyline.md)
|
|
241
|
+
|
|
242
|
+
</td><td>
|
|
243
|
+
|
|
244
|
+
</td><td>
|
|
245
|
+
|
|
246
|
+
Convert Primitive to Sync primitive
|
|
247
|
+
|
|
248
|
+
</td></tr>
|
|
249
|
+
</tbody></table>
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## 方法详情
|
|
254
|
+
|
|
255
|
+
### converttofill
|
|
256
|
+
|
|
257
|
+
# IPCB\_PrimitivePolyline.convertToFill() method
|
|
258
|
+
|
|
259
|
+
> 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.
|
|
260
|
+
|
|
261
|
+
Convert to: fill primitive
|
|
262
|
+
|
|
263
|
+
## Signature
|
|
264
|
+
|
|
265
|
+
```typescript
|
|
266
|
+
function convertToFill(): Promise<IPCB_PrimitiveFill>;
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
## Returns
|
|
270
|
+
|
|
271
|
+
Promise<[IPCB\_PrimitiveFill](./IPCB_PrimitiveFill.md)<!-- -->>
|
|
272
|
+
|
|
273
|
+
Fill primitive object
|
|
274
|
+
|
|
275
|
+
## Example
|
|
276
|
+
|
|
277
|
+
```javascript
|
|
278
|
+
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
|
|
279
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
280
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
281
|
+
|
|
282
|
+
// 2. 创建一条矩形闭合折线
|
|
283
|
+
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
|
|
284
|
+
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
285
|
+
|
|
286
|
+
// 3. 转换为填充图元(原折线保留,保留现场供观察)
|
|
287
|
+
const fill = await polyline.convertToFill();
|
|
288
|
+
|
|
289
|
+
console.log('primitiveType:', `${polyline.getState_PrimitiveType()} → ${fill.getState_PrimitiveType()}`);
|
|
290
|
+
console.log('primitiveId:', fill.getState_PrimitiveId());
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### converttopour
|
|
294
|
+
|
|
295
|
+
# IPCB\_PrimitivePolyline.convertToPour() method
|
|
296
|
+
|
|
297
|
+
> 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.
|
|
298
|
+
|
|
299
|
+
Convert to: Copper border primitive
|
|
300
|
+
|
|
301
|
+
## Signature
|
|
302
|
+
|
|
303
|
+
```typescript
|
|
304
|
+
function convertToPour(): Promise<IPCB_PrimitivePour>;
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
## Returns
|
|
308
|
+
|
|
309
|
+
Promise<[IPCB\_PrimitivePour](./IPCB_PrimitivePour.md)<!-- -->>
|
|
310
|
+
|
|
311
|
+
Copper border primitive object
|
|
312
|
+
|
|
313
|
+
## Example
|
|
314
|
+
|
|
315
|
+
```javascript
|
|
316
|
+
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
|
|
317
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
318
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
319
|
+
|
|
320
|
+
// 2. 创建一条矩形闭合折线
|
|
321
|
+
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
|
|
322
|
+
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
323
|
+
|
|
324
|
+
// 3. 转换为覆铜边框图元(原折线保留,保留现场供观察)
|
|
325
|
+
const pour = await polyline.convertToPour();
|
|
326
|
+
|
|
327
|
+
console.log('primitiveType:', `${polyline.getState_PrimitiveType()} → ${pour.getState_PrimitiveType()}`);
|
|
328
|
+
console.log('primitiveId:', pour.getState_PrimitiveId());
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### converttoregion
|
|
332
|
+
|
|
333
|
+
# IPCB\_PrimitivePolyline.convertToRegion() method
|
|
334
|
+
|
|
335
|
+
> 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.
|
|
336
|
+
|
|
337
|
+
Convert to: Region primitive
|
|
338
|
+
|
|
339
|
+
## Signature
|
|
340
|
+
|
|
341
|
+
```typescript
|
|
342
|
+
function convertToRegion(): Promise<IPCB_PrimitiveRegion>;
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
## Returns
|
|
346
|
+
|
|
347
|
+
Promise<[IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)<!-- -->>
|
|
348
|
+
|
|
349
|
+
Region primitive object
|
|
350
|
+
|
|
351
|
+
## Example
|
|
352
|
+
|
|
353
|
+
```javascript
|
|
354
|
+
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
|
|
355
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
356
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
357
|
+
|
|
358
|
+
// 2. 创建一条矩形闭合折线
|
|
359
|
+
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
|
|
360
|
+
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
361
|
+
|
|
362
|
+
// 3. 转换为区域图元(原折线保留,保留现场供观察)
|
|
363
|
+
const region = await polyline.convertToRegion();
|
|
364
|
+
|
|
365
|
+
console.log('primitiveType:', `${polyline.getState_PrimitiveType()} → ${region.getState_PrimitiveType()}`);
|
|
366
|
+
console.log('primitiveId:', region.getState_PrimitiveId());
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
### done
|
|
370
|
+
|
|
371
|
+
# IPCB\_PrimitivePolyline.done() method
|
|
372
|
+
|
|
373
|
+
> 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.
|
|
374
|
+
|
|
375
|
+
Apply the changes to the primitives to the canvas
|
|
376
|
+
|
|
377
|
+
## Signature
|
|
378
|
+
|
|
379
|
+
```typescript
|
|
380
|
+
function done(): Promise<IPCB_PrimitivePolyline>;
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
## Returns
|
|
384
|
+
|
|
385
|
+
Promise<[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)<!-- -->>
|
|
386
|
+
|
|
387
|
+
Polyline primitive object
|
|
388
|
+
|
|
389
|
+
## Example
|
|
390
|
+
|
|
391
|
+
```javascript
|
|
392
|
+
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
|
|
393
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
394
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
395
|
+
|
|
396
|
+
// 2. 创建一条顶层铜层的折线
|
|
397
|
+
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
|
|
398
|
+
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
399
|
+
const before = polyline.getState_Layer();
|
|
400
|
+
|
|
401
|
+
// 3. 异步模式下把折线挪到底层铜层(此时画布还没变)
|
|
402
|
+
const asyncPolyline = polyline.toAsync();
|
|
403
|
+
asyncPolyline.setState_Layer(2);
|
|
404
|
+
await asyncPolyline.done();
|
|
405
|
+
|
|
406
|
+
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
|
|
407
|
+
const refetched = await eda.pcb_PrimitivePolyline.get(polyline.getState_PrimitiveId());
|
|
408
|
+
|
|
409
|
+
console.log('layer:', before, '→', refetched.getState_Layer());
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
### getstate_layer
|
|
413
|
+
|
|
414
|
+
# IPCB\_PrimitivePolyline.getState\_Layer() method
|
|
415
|
+
|
|
416
|
+
Get the property state: Layer
|
|
417
|
+
|
|
418
|
+
## Signature
|
|
419
|
+
|
|
420
|
+
```typescript
|
|
421
|
+
function getState_Layer(): TPCB_LayersOfLine;
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
## Returns
|
|
425
|
+
|
|
426
|
+
[TPCB\_LayersOfLine](../types/TPCB_LayersOfLine.md)
|
|
427
|
+
|
|
428
|
+
Layer
|
|
429
|
+
|
|
430
|
+
## Example
|
|
431
|
+
|
|
432
|
+
```javascript
|
|
433
|
+
// 1. 创建一条顶层铜层(1)的折线
|
|
434
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
435
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
436
|
+
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
|
|
437
|
+
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
438
|
+
|
|
439
|
+
// 2. 读取折线所在层
|
|
440
|
+
const layer = polyline.getState_Layer();
|
|
441
|
+
|
|
442
|
+
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
443
|
+
await eda.pcb_PrimitivePolyline.delete([polyline.getState_PrimitiveId()]);
|
|
444
|
+
|
|
445
|
+
console.log('layer:', layer);
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
### getstate_linewidth
|
|
449
|
+
|
|
450
|
+
# IPCB\_PrimitivePolyline.getState\_LineWidth() method
|
|
451
|
+
|
|
452
|
+
Get the property state: Line width
|
|
453
|
+
|
|
454
|
+
## Signature
|
|
455
|
+
|
|
456
|
+
```typescript
|
|
457
|
+
function getState_LineWidth(): number;
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
## Returns
|
|
461
|
+
|
|
462
|
+
number
|
|
463
|
+
|
|
464
|
+
Line width
|
|
465
|
+
|
|
466
|
+
## Example
|
|
467
|
+
|
|
468
|
+
```javascript
|
|
469
|
+
// 1. 创建一条 10mil 线宽的折线
|
|
470
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
471
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
472
|
+
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
|
|
473
|
+
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
474
|
+
|
|
475
|
+
// 2. 读取线宽
|
|
476
|
+
const lineWidth = polyline.getState_LineWidth();
|
|
477
|
+
|
|
478
|
+
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
479
|
+
await eda.pcb_PrimitivePolyline.delete([polyline.getState_PrimitiveId()]);
|
|
480
|
+
|
|
481
|
+
console.log('lineWidth:', lineWidth);
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
### getstate_net
|
|
485
|
+
|
|
486
|
+
# IPCB\_PrimitivePolyline.getState\_Net() method
|
|
487
|
+
|
|
488
|
+
Get the property state: net name
|
|
489
|
+
|
|
490
|
+
## Signature
|
|
491
|
+
|
|
492
|
+
```typescript
|
|
493
|
+
function getState_Net(): string;
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
## Returns
|
|
497
|
+
|
|
498
|
+
string
|
|
499
|
+
|
|
500
|
+
Net name
|
|
501
|
+
|
|
502
|
+
## Example
|
|
503
|
+
|
|
504
|
+
```javascript
|
|
505
|
+
// 1. 创建一条无网络的折线
|
|
506
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
507
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
508
|
+
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
|
|
509
|
+
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
510
|
+
|
|
511
|
+
// 2. 读取网络名称(无网络时为空字符串)
|
|
512
|
+
const net = polyline.getState_Net();
|
|
513
|
+
|
|
514
|
+
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
515
|
+
await eda.pcb_PrimitivePolyline.delete([polyline.getState_PrimitiveId()]);
|
|
516
|
+
|
|
517
|
+
console.log('net:', JSON.stringify(net));
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
### getstate_polygon
|
|
521
|
+
|
|
522
|
+
# IPCB\_PrimitivePolyline.getState\_Polygon() method
|
|
523
|
+
|
|
524
|
+
Get the property state: single polygon
|
|
525
|
+
|
|
526
|
+
## Signature
|
|
527
|
+
|
|
528
|
+
```typescript
|
|
529
|
+
function getState_Polygon(): IPCB_Polygon;
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
## Returns
|
|
533
|
+
|
|
534
|
+
[IPCB\_Polygon](./IPCB_Polygon.md)
|
|
535
|
+
|
|
536
|
+
Single polygon
|
|
537
|
+
|
|
538
|
+
## Example
|
|
539
|
+
|
|
540
|
+
```javascript
|
|
541
|
+
// 1. 创建一条已知轮廓的折线(500 → 拐弯 → 300)
|
|
542
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
543
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
544
|
+
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
|
|
545
|
+
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
546
|
+
|
|
547
|
+
// 2. 读取多边形对象,再取它的轮廓源数组
|
|
548
|
+
const currentPolygon = polyline.getState_Polygon();
|
|
549
|
+
const source = currentPolygon.getSource();
|
|
550
|
+
|
|
551
|
+
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
552
|
+
await eda.pcb_PrimitivePolyline.delete([polyline.getState_PrimitiveId()]);
|
|
553
|
+
|
|
554
|
+
console.log('polygonSource:', JSON.stringify(source));
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
### getstate_primitiveid
|
|
558
|
+
|
|
559
|
+
# IPCB\_PrimitivePolyline.getState\_PrimitiveId() method
|
|
560
|
+
|
|
561
|
+
Get the property state: primitive ID
|
|
562
|
+
|
|
563
|
+
## Signature
|
|
564
|
+
|
|
565
|
+
```typescript
|
|
566
|
+
function getState_PrimitiveId(): string;
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
## Returns
|
|
570
|
+
|
|
571
|
+
string
|
|
572
|
+
|
|
573
|
+
Primitive ID
|
|
574
|
+
|
|
575
|
+
## Example
|
|
576
|
+
|
|
577
|
+
```javascript
|
|
578
|
+
// 1. 创建一条折线
|
|
579
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
580
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
581
|
+
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
|
|
582
|
+
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
583
|
+
|
|
584
|
+
// 2. 读取图元 ID
|
|
585
|
+
const primitiveId = polyline.getState_PrimitiveId();
|
|
586
|
+
|
|
587
|
+
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
588
|
+
await eda.pcb_PrimitivePolyline.delete([polyline.getState_PrimitiveId()]);
|
|
589
|
+
|
|
590
|
+
console.log('primitiveId:', primitiveId);
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
### getstate_primitivelock
|
|
594
|
+
|
|
595
|
+
# IPCB\_PrimitivePolyline.getState\_PrimitiveLock() method
|
|
596
|
+
|
|
597
|
+
Get the property state: whether it is locked
|
|
598
|
+
|
|
599
|
+
## Signature
|
|
600
|
+
|
|
601
|
+
```typescript
|
|
602
|
+
function getState_PrimitiveLock(): boolean;
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
## Returns
|
|
606
|
+
|
|
607
|
+
boolean
|
|
608
|
+
|
|
609
|
+
Whether it is locked
|
|
610
|
+
|
|
611
|
+
## Example
|
|
612
|
+
|
|
613
|
+
```javascript
|
|
614
|
+
// 1. 创建一条未锁定的折线
|
|
615
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
616
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
617
|
+
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
|
|
618
|
+
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
619
|
+
|
|
620
|
+
// 2. 读取锁定状态
|
|
621
|
+
const primitiveLock = polyline.getState_PrimitiveLock();
|
|
622
|
+
|
|
623
|
+
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
624
|
+
await eda.pcb_PrimitivePolyline.delete([polyline.getState_PrimitiveId()]);
|
|
625
|
+
|
|
626
|
+
console.log('primitiveLock:', primitiveLock);
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
### getstate_primitivetype
|
|
630
|
+
|
|
631
|
+
# IPCB\_PrimitivePolyline.getState\_PrimitiveType() method
|
|
632
|
+
|
|
633
|
+
Get the property state: primitive type
|
|
634
|
+
|
|
635
|
+
## Signature
|
|
636
|
+
|
|
637
|
+
```typescript
|
|
638
|
+
function getState_PrimitiveType(): EPCB_PrimitiveType;
|
|
639
|
+
```
|
|
640
|
+
|
|
641
|
+
## Returns
|
|
642
|
+
|
|
643
|
+
[EPCB\_PrimitiveType](../enums/EPCB_PrimitiveType.md)
|
|
644
|
+
|
|
645
|
+
Primitive type
|
|
646
|
+
|
|
647
|
+
## Example
|
|
648
|
+
|
|
649
|
+
```javascript
|
|
650
|
+
// 1. 创建一条折线
|
|
651
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
652
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
653
|
+
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
|
|
654
|
+
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
655
|
+
|
|
656
|
+
// 2. 读取图元类型
|
|
657
|
+
const primitiveType = polyline.getState_PrimitiveType();
|
|
658
|
+
|
|
659
|
+
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
660
|
+
await eda.pcb_PrimitivePolyline.delete([polyline.getState_PrimitiveId()]);
|
|
661
|
+
|
|
662
|
+
console.log('primitiveType:', primitiveType);
|
|
663
|
+
```
|
|
664
|
+
|
|
665
|
+
### isasync
|
|
666
|
+
|
|
667
|
+
# IPCB\_PrimitivePolyline.isAsync() method
|
|
668
|
+
|
|
669
|
+
Query whether the primitive is an async primitive
|
|
670
|
+
|
|
671
|
+
## Signature
|
|
672
|
+
|
|
673
|
+
```typescript
|
|
674
|
+
function isAsync(): boolean;
|
|
675
|
+
```
|
|
676
|
+
|
|
677
|
+
## Returns
|
|
678
|
+
|
|
679
|
+
boolean
|
|
680
|
+
|
|
681
|
+
Whether Is async primitive
|
|
682
|
+
|
|
683
|
+
## Example
|
|
684
|
+
|
|
685
|
+
```javascript
|
|
686
|
+
// 1. 创建一条折线
|
|
687
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
688
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
689
|
+
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
|
|
690
|
+
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
691
|
+
|
|
692
|
+
// 2. 查询异步模式
|
|
693
|
+
const isAsync = polyline.isAsync();
|
|
694
|
+
|
|
695
|
+
// 3. 清理测试图元(查询类案例不留测试对象)
|
|
696
|
+
await eda.pcb_PrimitivePolyline.delete([polyline.getState_PrimitiveId()]);
|
|
697
|
+
|
|
698
|
+
console.log('isAsync:', isAsync);
|
|
699
|
+
```
|
|
700
|
+
|
|
701
|
+
### reset
|
|
702
|
+
|
|
703
|
+
# IPCB\_PrimitivePolyline.reset() method
|
|
704
|
+
|
|
705
|
+
> 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.
|
|
706
|
+
|
|
707
|
+
Reset the async primitive to the current canvas state
|
|
708
|
+
|
|
709
|
+
## Signature
|
|
710
|
+
|
|
711
|
+
```typescript
|
|
712
|
+
function reset(): Promise<IPCB_PrimitivePolyline>;
|
|
713
|
+
```
|
|
714
|
+
|
|
715
|
+
## Returns
|
|
716
|
+
|
|
717
|
+
Promise<[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)<!-- -->>
|
|
718
|
+
|
|
719
|
+
Polyline primitive object
|
|
720
|
+
|
|
721
|
+
## Example
|
|
722
|
+
|
|
723
|
+
```javascript
|
|
724
|
+
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
|
|
725
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
726
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
727
|
+
|
|
728
|
+
// 2. 创建一条顶层铜层的折线
|
|
729
|
+
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
|
|
730
|
+
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
731
|
+
const before = polyline.getState_Layer();
|
|
732
|
+
|
|
733
|
+
// 3. 异步模式下把层改到底层(2),随后反悔
|
|
734
|
+
const asyncPolyline = polyline.toAsync();
|
|
735
|
+
asyncPolyline.setState_Layer(2);
|
|
736
|
+
|
|
737
|
+
// 4. reset 丢弃未提交的修改(保留现场供观察)
|
|
738
|
+
await asyncPolyline.reset();
|
|
739
|
+
|
|
740
|
+
// 5. 从画布重新读取,确认层没有变
|
|
741
|
+
const refetched = await eda.pcb_PrimitivePolyline.get(polyline.getState_PrimitiveId());
|
|
742
|
+
|
|
743
|
+
console.log('layer:', before, '→', refetched.getState_Layer());
|
|
744
|
+
```
|
|
745
|
+
|
|
746
|
+
### setstate_layer
|
|
747
|
+
|
|
748
|
+
# IPCB\_PrimitivePolyline.setState\_Layer() method
|
|
749
|
+
|
|
750
|
+
> 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.
|
|
751
|
+
|
|
752
|
+
Set the property state: Layer
|
|
753
|
+
|
|
754
|
+
## Signature
|
|
755
|
+
|
|
756
|
+
```typescript
|
|
757
|
+
function setState_Layer(layer: TPCB_LayersOfLine): IPCB_PrimitivePolyline;
|
|
758
|
+
```
|
|
759
|
+
|
|
760
|
+
## Parameters
|
|
761
|
+
|
|
762
|
+
<table><thead><tr><th>
|
|
763
|
+
|
|
764
|
+
Parameter
|
|
765
|
+
|
|
766
|
+
</th><th>
|
|
767
|
+
|
|
768
|
+
Type
|
|
769
|
+
|
|
770
|
+
</th><th>
|
|
771
|
+
|
|
772
|
+
Description
|
|
773
|
+
|
|
774
|
+
</th></tr></thead>
|
|
775
|
+
<tbody><tr><td>
|
|
776
|
+
|
|
777
|
+
layer
|
|
778
|
+
|
|
779
|
+
</td><td>
|
|
780
|
+
|
|
781
|
+
[TPCB\_LayersOfLine](../types/TPCB_LayersOfLine.md)
|
|
782
|
+
|
|
783
|
+
</td><td>
|
|
784
|
+
|
|
785
|
+
Layer
|
|
786
|
+
|
|
787
|
+
</td></tr>
|
|
788
|
+
</tbody></table>
|
|
789
|
+
|
|
790
|
+
## Returns
|
|
791
|
+
|
|
792
|
+
[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)
|
|
793
|
+
|
|
794
|
+
Polyline primitive object
|
|
795
|
+
|
|
796
|
+
## Example
|
|
797
|
+
|
|
798
|
+
```javascript
|
|
799
|
+
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
|
|
800
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
801
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
802
|
+
|
|
803
|
+
// 2. 创建一条顶层铜层(1)的折线
|
|
804
|
+
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
|
|
805
|
+
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
806
|
+
const before = polyline.getState_Layer();
|
|
807
|
+
|
|
808
|
+
// 3. 异步模式把折线挪到底层铜层(2)
|
|
809
|
+
const asyncPolyline = polyline.toAsync();
|
|
810
|
+
asyncPolyline.setState_Layer(2);
|
|
811
|
+
await asyncPolyline.done();
|
|
812
|
+
|
|
813
|
+
// 4. 从画布重新读取,确认层已切换(保留现场供观察)
|
|
814
|
+
const refetched = await eda.pcb_PrimitivePolyline.get(polyline.getState_PrimitiveId());
|
|
815
|
+
|
|
816
|
+
console.log('layer:', before, '→', refetched.getState_Layer());
|
|
817
|
+
```
|
|
818
|
+
|
|
819
|
+
### setstate_linewidth
|
|
820
|
+
|
|
821
|
+
# IPCB\_PrimitivePolyline.setState\_LineWidth() method
|
|
822
|
+
|
|
823
|
+
> 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.
|
|
824
|
+
|
|
825
|
+
Set the property state: Line width
|
|
826
|
+
|
|
827
|
+
## Signature
|
|
828
|
+
|
|
829
|
+
```typescript
|
|
830
|
+
function setState_LineWidth(lineWidth: number): IPCB_PrimitivePolyline;
|
|
831
|
+
```
|
|
832
|
+
|
|
833
|
+
## Parameters
|
|
834
|
+
|
|
835
|
+
<table><thead><tr><th>
|
|
836
|
+
|
|
837
|
+
Parameter
|
|
838
|
+
|
|
839
|
+
</th><th>
|
|
840
|
+
|
|
841
|
+
Type
|
|
842
|
+
|
|
843
|
+
</th><th>
|
|
844
|
+
|
|
845
|
+
Description
|
|
846
|
+
|
|
847
|
+
</th></tr></thead>
|
|
848
|
+
<tbody><tr><td>
|
|
849
|
+
|
|
850
|
+
lineWidth
|
|
851
|
+
|
|
852
|
+
</td><td>
|
|
853
|
+
|
|
854
|
+
number
|
|
855
|
+
|
|
856
|
+
</td><td>
|
|
857
|
+
|
|
858
|
+
Line width
|
|
859
|
+
|
|
860
|
+
</td></tr>
|
|
861
|
+
</tbody></table>
|
|
862
|
+
|
|
863
|
+
## Returns
|
|
864
|
+
|
|
865
|
+
[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)
|
|
866
|
+
|
|
867
|
+
Polyline primitive object
|
|
868
|
+
|
|
869
|
+
## Example
|
|
870
|
+
|
|
871
|
+
```javascript
|
|
872
|
+
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
|
|
873
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
874
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
875
|
+
|
|
876
|
+
// 2. 创建一条 10mil 线宽的折线
|
|
877
|
+
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
|
|
878
|
+
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
879
|
+
const before = polyline.getState_LineWidth();
|
|
880
|
+
|
|
881
|
+
// 3. 切换异步模式,线宽加粗到 20mil
|
|
882
|
+
const asyncPolyline = polyline.toAsync();
|
|
883
|
+
asyncPolyline.setState_LineWidth(20);
|
|
884
|
+
await asyncPolyline.done();
|
|
885
|
+
|
|
886
|
+
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
|
|
887
|
+
const refetched = await eda.pcb_PrimitivePolyline.get(polyline.getState_PrimitiveId());
|
|
888
|
+
|
|
889
|
+
console.log('lineWidth:', before, '→', refetched.getState_LineWidth());
|
|
890
|
+
```
|
|
891
|
+
|
|
892
|
+
### setstate_net
|
|
893
|
+
|
|
894
|
+
# IPCB\_PrimitivePolyline.setState\_Net() method
|
|
895
|
+
|
|
896
|
+
> 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.
|
|
897
|
+
|
|
898
|
+
Set the property state: net name
|
|
899
|
+
|
|
900
|
+
## Signature
|
|
901
|
+
|
|
902
|
+
```typescript
|
|
903
|
+
function setState_Net(net: string): IPCB_PrimitivePolyline;
|
|
904
|
+
```
|
|
905
|
+
|
|
906
|
+
## Parameters
|
|
907
|
+
|
|
908
|
+
<table><thead><tr><th>
|
|
909
|
+
|
|
910
|
+
Parameter
|
|
911
|
+
|
|
912
|
+
</th><th>
|
|
913
|
+
|
|
914
|
+
Type
|
|
915
|
+
|
|
916
|
+
</th><th>
|
|
917
|
+
|
|
918
|
+
Description
|
|
919
|
+
|
|
920
|
+
</th></tr></thead>
|
|
921
|
+
<tbody><tr><td>
|
|
922
|
+
|
|
923
|
+
net
|
|
924
|
+
|
|
925
|
+
</td><td>
|
|
926
|
+
|
|
927
|
+
string
|
|
928
|
+
|
|
929
|
+
</td><td>
|
|
930
|
+
|
|
931
|
+
Net name
|
|
932
|
+
|
|
933
|
+
</td></tr>
|
|
934
|
+
</tbody></table>
|
|
935
|
+
|
|
936
|
+
## Returns
|
|
937
|
+
|
|
938
|
+
[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)
|
|
939
|
+
|
|
940
|
+
Polyline primitive object
|
|
941
|
+
|
|
942
|
+
## Example
|
|
943
|
+
|
|
944
|
+
```javascript
|
|
945
|
+
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
|
|
946
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
947
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
948
|
+
|
|
949
|
+
// 2. 创建一条无网络的折线
|
|
950
|
+
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
|
|
951
|
+
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
952
|
+
const before = polyline.getState_Net();
|
|
953
|
+
|
|
954
|
+
// 3. 切换异步模式并指定网络('' → '嘉立创示例_NET')
|
|
955
|
+
const asyncPolyline = polyline.toAsync();
|
|
956
|
+
asyncPolyline.setState_Net('嘉立创示例_NET');
|
|
957
|
+
await asyncPolyline.done();
|
|
958
|
+
|
|
959
|
+
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
|
|
960
|
+
const refetched = await eda.pcb_PrimitivePolyline.get(polyline.getState_PrimitiveId());
|
|
961
|
+
|
|
962
|
+
console.log('net:', JSON.stringify(before), '→', JSON.stringify(refetched.getState_Net()));
|
|
963
|
+
```
|
|
964
|
+
|
|
965
|
+
### setstate_polygon
|
|
966
|
+
|
|
967
|
+
# IPCB\_PrimitivePolyline.setState\_Polygon() method
|
|
968
|
+
|
|
969
|
+
> 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.
|
|
970
|
+
|
|
971
|
+
Set the property state: single polygon
|
|
972
|
+
|
|
973
|
+
## Signature
|
|
974
|
+
|
|
975
|
+
```typescript
|
|
976
|
+
function setState_Polygon(polygon: IPCB_Polygon): IPCB_PrimitivePolyline;
|
|
977
|
+
```
|
|
978
|
+
|
|
979
|
+
## Parameters
|
|
980
|
+
|
|
981
|
+
<table><thead><tr><th>
|
|
982
|
+
|
|
983
|
+
Parameter
|
|
984
|
+
|
|
985
|
+
</th><th>
|
|
986
|
+
|
|
987
|
+
Type
|
|
988
|
+
|
|
989
|
+
</th><th>
|
|
990
|
+
|
|
991
|
+
Description
|
|
992
|
+
|
|
993
|
+
</th></tr></thead>
|
|
994
|
+
<tbody><tr><td>
|
|
995
|
+
|
|
996
|
+
polygon
|
|
997
|
+
|
|
998
|
+
</td><td>
|
|
999
|
+
|
|
1000
|
+
[IPCB\_Polygon](./IPCB_Polygon.md)
|
|
1001
|
+
|
|
1002
|
+
</td><td>
|
|
1003
|
+
|
|
1004
|
+
Single polygon
|
|
1005
|
+
|
|
1006
|
+
</td></tr>
|
|
1007
|
+
</tbody></table>
|
|
1008
|
+
|
|
1009
|
+
## Returns
|
|
1010
|
+
|
|
1011
|
+
[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)
|
|
1012
|
+
|
|
1013
|
+
Polyline primitive object
|
|
1014
|
+
|
|
1015
|
+
## Example
|
|
1016
|
+
|
|
1017
|
+
```javascript
|
|
1018
|
+
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
|
|
1019
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
1020
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
1021
|
+
|
|
1022
|
+
// 2. 创建一条 500 → 拐弯 → 300 的折线
|
|
1023
|
+
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
|
|
1024
|
+
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
1025
|
+
const before = JSON.stringify(polyline.getState_Polygon().getSource());
|
|
1026
|
+
|
|
1027
|
+
// 3. 构造新轮廓(拉长到 800 → 拐弯 → 600),异步模式提交
|
|
1028
|
+
const newPolygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 800, y, x + 800, y + 600]);
|
|
1029
|
+
const asyncPolyline = polyline.toAsync();
|
|
1030
|
+
asyncPolyline.setState_Polygon(newPolygon);
|
|
1031
|
+
await asyncPolyline.done();
|
|
1032
|
+
|
|
1033
|
+
// 4. 从画布重新读取,确认轮廓已替换(保留现场供观察)
|
|
1034
|
+
const refetched = await eda.pcb_PrimitivePolyline.get(polyline.getState_PrimitiveId());
|
|
1035
|
+
const after = JSON.stringify(refetched.getState_Polygon().getSource());
|
|
1036
|
+
|
|
1037
|
+
console.log('polygonSource:', before, '→', after);
|
|
1038
|
+
```
|
|
1039
|
+
|
|
1040
|
+
### setstate_primitivelock
|
|
1041
|
+
|
|
1042
|
+
# IPCB\_PrimitivePolyline.setState\_PrimitiveLock() method
|
|
1043
|
+
|
|
1044
|
+
> 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.
|
|
1045
|
+
|
|
1046
|
+
Set the property state: whether it is locked
|
|
1047
|
+
|
|
1048
|
+
## Signature
|
|
1049
|
+
|
|
1050
|
+
```typescript
|
|
1051
|
+
function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitivePolyline;
|
|
1052
|
+
```
|
|
1053
|
+
|
|
1054
|
+
## Parameters
|
|
1055
|
+
|
|
1056
|
+
<table><thead><tr><th>
|
|
1057
|
+
|
|
1058
|
+
Parameter
|
|
1059
|
+
|
|
1060
|
+
</th><th>
|
|
1061
|
+
|
|
1062
|
+
Type
|
|
1063
|
+
|
|
1064
|
+
</th><th>
|
|
1065
|
+
|
|
1066
|
+
Description
|
|
1067
|
+
|
|
1068
|
+
</th></tr></thead>
|
|
1069
|
+
<tbody><tr><td>
|
|
1070
|
+
|
|
1071
|
+
primitiveLock
|
|
1072
|
+
|
|
1073
|
+
</td><td>
|
|
1074
|
+
|
|
1075
|
+
boolean
|
|
1076
|
+
|
|
1077
|
+
</td><td>
|
|
1078
|
+
|
|
1079
|
+
Whether it is locked
|
|
1080
|
+
|
|
1081
|
+
</td></tr>
|
|
1082
|
+
</tbody></table>
|
|
1083
|
+
|
|
1084
|
+
## Returns
|
|
1085
|
+
|
|
1086
|
+
[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)
|
|
1087
|
+
|
|
1088
|
+
Polyline primitive object
|
|
1089
|
+
|
|
1090
|
+
## Example
|
|
1091
|
+
|
|
1092
|
+
```javascript
|
|
1093
|
+
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
|
|
1094
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
1095
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
1096
|
+
|
|
1097
|
+
// 2. 创建一条未锁定的折线
|
|
1098
|
+
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
|
|
1099
|
+
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
1100
|
+
const before = polyline.getState_PrimitiveLock();
|
|
1101
|
+
|
|
1102
|
+
// 3. 切换异步模式并锁定折线
|
|
1103
|
+
const asyncPolyline = polyline.toAsync();
|
|
1104
|
+
asyncPolyline.setState_PrimitiveLock(true);
|
|
1105
|
+
await asyncPolyline.done();
|
|
1106
|
+
|
|
1107
|
+
// 4. 从画布重新读取,确认已锁定(保留现场供观察)
|
|
1108
|
+
const refetched = await eda.pcb_PrimitivePolyline.get(polyline.getState_PrimitiveId());
|
|
1109
|
+
|
|
1110
|
+
console.log('primitiveLock:', before, '→', refetched.getState_PrimitiveLock());
|
|
1111
|
+
```
|
|
1112
|
+
|
|
1113
|
+
### toasync
|
|
1114
|
+
|
|
1115
|
+
# IPCB\_PrimitivePolyline.toAsync() method
|
|
1116
|
+
|
|
1117
|
+
Convert Primitive to Async primitive
|
|
1118
|
+
|
|
1119
|
+
## Signature
|
|
1120
|
+
|
|
1121
|
+
```typescript
|
|
1122
|
+
function toAsync(): IPCB_PrimitivePolyline;
|
|
1123
|
+
```
|
|
1124
|
+
|
|
1125
|
+
## Returns
|
|
1126
|
+
|
|
1127
|
+
[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)
|
|
1128
|
+
|
|
1129
|
+
Polyline primitive object
|
|
1130
|
+
|
|
1131
|
+
## Example
|
|
1132
|
+
|
|
1133
|
+
```javascript
|
|
1134
|
+
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
|
|
1135
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
1136
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
1137
|
+
|
|
1138
|
+
// 2. 创建一条无网络的折线
|
|
1139
|
+
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
|
|
1140
|
+
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
1141
|
+
|
|
1142
|
+
// 3. 切换异步模式后批量修改:划归网络 + 挪到底层
|
|
1143
|
+
const asyncPolyline = polyline.toAsync();
|
|
1144
|
+
asyncPolyline.setState_Net('嘉立创示例_NET');
|
|
1145
|
+
asyncPolyline.setState_Layer(2);
|
|
1146
|
+
await asyncPolyline.done();
|
|
1147
|
+
|
|
1148
|
+
// 4. 从画布重新读取,确认批量修改已生效(保留现场供观察)
|
|
1149
|
+
const refetched = await eda.pcb_PrimitivePolyline.get(polyline.getState_PrimitiveId());
|
|
1150
|
+
|
|
1151
|
+
console.log('net:', JSON.stringify(refetched.getState_Net()));
|
|
1152
|
+
console.log('layer:', refetched.getState_Layer());
|
|
1153
|
+
```
|
|
1154
|
+
|
|
1155
|
+
### tosync
|
|
1156
|
+
|
|
1157
|
+
# IPCB\_PrimitivePolyline.toSync() method
|
|
1158
|
+
|
|
1159
|
+
Convert Primitive to Sync primitive
|
|
1160
|
+
|
|
1161
|
+
## Signature
|
|
1162
|
+
|
|
1163
|
+
```typescript
|
|
1164
|
+
function toSync(): IPCB_PrimitivePolyline;
|
|
1165
|
+
```
|
|
1166
|
+
|
|
1167
|
+
## Returns
|
|
1168
|
+
|
|
1169
|
+
[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)
|
|
1170
|
+
|
|
1171
|
+
Polyline primitive object
|
|
1172
|
+
|
|
1173
|
+
## Example
|
|
1174
|
+
|
|
1175
|
+
```javascript
|
|
1176
|
+
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
|
|
1177
|
+
const x = 2000 + Math.floor(Math.random() * 100000);
|
|
1178
|
+
const y = 2000 + Math.floor(Math.random() * 100000);
|
|
1179
|
+
|
|
1180
|
+
// 2. 创建一条折线
|
|
1181
|
+
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
|
|
1182
|
+
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
|
|
1183
|
+
const before = polyline.isAsync();
|
|
1184
|
+
|
|
1185
|
+
// 3. 转换为同步图元(保留现场供观察)
|
|
1186
|
+
const syncPolyline = polyline.toSync();
|
|
1187
|
+
const after = syncPolyline.isAsync();
|
|
1188
|
+
|
|
1189
|
+
// 4. 同步图元直接读取属性,无需提交
|
|
1190
|
+
console.log('isAsync:', before, '→', after);
|
|
1191
|
+
console.log('primitiveType:', syncPolyline.getState_PrimitiveType());
|
|
1192
|
+
console.log('layer:', syncPolyline.getState_Layer());
|
|
1193
|
+
```
|