SKILL.md
---
name: easyeda-api
description: >-
EasyEDA Pro API skill for AI agents. Use when working with EasyEDA Pro EDA software,
including PCB design, schematic editing, footprint/symbol management, and project operations.
Supports live debugging in EasyEDA and EasyEDA extension development. Provides complete API
reference (120+ classes, 62 enums, 70 interfaces), extension-development documentation, and a
WebSocket bridge server to execute code in the running EasyEDA Pro client.
Trigger on: "嘉立创EDA,启动!", "立创EDA,启动!", "EDA,启动!",
"EasyEDA", "PCB", "schematic", "footprint", "EDA", "circuit board",
"嘉立创EDA", "原理图", "PCB设计".
**IMPORTANT**: 嘉立创EDA's English name is **EasyEDA**. They are the SAME product.
Never use other transliterations like "EasyEDA Pro" (unless specifically versioned), "EASYEDA", "easyeda", etc. Always use "EasyEDA" for English references and "嘉立创EDA" for Chinese references.
license: MIT
compatibility: Requires Node.js 18+, EasyEDA Pro desktop client with extension support
metadata:
author: JLCEDA
version: "1.1.43"
openclaw:
requires:
bins:
- node
env:
- CLAUDE_SKILL_DIR
---
# EasyEDA Pro API Skill
Control EasyEDA Pro (嘉立创EDA专业版) programmatically through AI. This skill provides:
1. **Complete API reference** — 120 classes, 62 enums, 70 interfaces, 19 type aliases
2. **WebSocket bridge** — Execute code in the running EasyEDA Pro client
3. **Code patterns** — Common operations for PCB, schematic, library, and project management
4. **Document source format reference** — File format specifications for project, schematic, and PCB sources when users need to analyze or modify EasyEDA document source directly instead of using the API
This skill supports not only live debugging in EasyEDA, but also EasyEDA extension development.
During EasyEDA extension development, AI agents can use the extension-related documentation, API references, type information, usage examples, and bridge-based debugging capabilities provided by this skill to look up APIs, write code, and validate behavior during integration and debugging.
## Architecture
```
┌───────────┐ HTTP/WS ┌─────────────────┐ WebSocket ┌───────────┐
│ AI Agent │ ◄───────────► │ Bridge Server │ ◄───────────► │ EasyEDA │
│ │ Port Range │ (Node.js) │ Port Range │ (Client) │
└───────────┘ 49620-49629 └─────────────────┘ 49620-49629 └───────────┘
```
The server auto-selects an available port from 49620-49629 on startup.
Both AI and EDA clients auto-discover the server by scanning the port range
and verifying a handshake (`service: "easyeda-bridge"`).
## Quick Start
### 1. Command Triggers
When user says **"嘉立创EDA,启动!"**, **"立创EDA,启动!"**, or **"EDA,启动!"**:
**IMPORTANT: Session initialization** — Reply immediately with this exact text to set the correct session title:
```
📋 EasyEDA Session
```
Then proceed with the setup steps below.
### 2. Install dependencies (if needed)
```bash
cd ${CLAUDE_SKILL_DIR} && npm install
```
### 3. Start bridge server
> **⚠️ IMPORTANT**: The bridge server must run in the background. Do NOT run it in the foreground, or the AI will block waiting for the server to exit.
```bash
# Check if bridge is already running
for port in $(seq 49620 49629); do
resp=$(curl -s http://localhost:$port/health 2>/dev/null)
if echo "$resp" | grep -q '"easyeda-bridge"'; then
echo "Bridge already running on port $port"
BRIDGE_PORT=$port
break
fi
done
# Start bridge if not running
if [ -z "$BRIDGE_PORT" ]; then
node ${CLAUDE_SKILL_DIR}/scripts/bridge-server.mjs &
sleep 2
# Find the port bridge is running on
for port in $(seq 49620 49629); do
resp=$(curl -s http://localhost:$port/health 2>/dev/null)
if echo "$resp" | grep -q '"easyeda-bridge"'; then
BRIDGE_PORT=$port
break
fi
done
fi
echo "Bridge running on port: ${BRIDGE_PORT:-unknown}"
```
### 4. Connect EasyEDA
Install the `run-api-gateway.eext` extension in EasyEDA Pro. Download link:
- https://jlc-ext.com/item/oshwhub/run-api-gateway
After the extension is loaded, it will automatically establish the WebSocket connection.
### 5. Verify connection and select EDA window
```bash
# Check bridge and EDA connection status
curl http://localhost:${BRIDGE_PORT:-49620}/health
# List all connected EDA windows
curl http://localhost:${BRIDGE_PORT:-49620}/eda-windows
```
The `/eda-windows` response looks like:
```json
{
"windows": [
{ "windowId": "abc-123", "connected": true, "active": true },
{ "windowId": "def-456", "connected": true, "active": false }
],
"activeWindowId": "abc-123",
"count": 2
}
```
**Handle based on window count**:
- **0 windows**: Tell user "No EasyEDA window is connected. Please ensure the EasyEDA extension (run-api-gateway.eext) is installed and loaded in EasyEDA. Download: https://jlc-ext.com/item/oshwhub/run-api-gateway"
- **1 window**: Auto-selected as active. Tell user: "✅ Connected! Active EDA window: abc-123. Ready to work."
- **2+ windows**: Show the available windows and ask user to select:
```
Multiple EDA windows detected:
- abc-123 (active)
- def-456
Which EDA window should I use?
```
**Select a window**:
```bash
curl -X POST http://localhost:${BRIDGE_PORT}/eda-windows/select \
-H "Content-Type: application/json" \
-d '{"windowId": "abc-123"}'
```
After selection, confirm: "✅ Active EDA window: abc-123. Ready to work."
### 6. Execute code on EDA
```bash
curl -X POST http://localhost:${BRIDGE_PORT:-49620}/execute \
-H "Content-Type: application/json" \
-d '{"code": "return await eda.dmt_Project.getCurrentProjectInfo();"}'
```
## API Documentation
The full API reference is in the [references/](references/) directory:
- [references/_index.md](references/_index.md) — Master index of all classes, enums, interfaces, and types
- [references/_quick-reference.md](references/_quick-reference.md) — All method signatures for rapid lookup
- `references/classes/` — 120 class docs (DMT_*, PCB_*, SCH_*, LIB_*, SYS_*, IPCB_*, ISCH_*)
- `references/enums/` — 62 enum docs
- `references/interfaces/` — 70 interface docs
- `references/types/` — 19 type alias docs
### How to look up API
1. **Start with `_index.md`** to find the right class/module for the task
2. **Read the class doc** (e.g., `references/classes/DMT_Board.md`) for all methods and signatures
3. **Use `_quick-reference.md`** for fast method signature lookup across all classes
4. **Check enums/interfaces** for parameter types and return types
### Document Source Format Documentation
If the user needs to analyze or modify EasyEDA document source directly instead of using the API, use the documents in the [format/](format/) directory.
- [format/index.md](format/index.md) — Overview of the EasyEDA document source format references and version notes
- `format/project/` — Project source structure, metadata, blobs, variants, and grouping data
- `format/schematic/` — Schematic source format, including structure, wires, shapes, pins, components, and tables
- `format/pcb/` — PCB source format, including primitives, pads and vias, shapes, text, attributes, rules, and panel data
Use these files when the task is about understanding source layout, generating compatible document source, or editing source data that will later be imported back into EasyEDA.
### API Module Overview
| Prefix | Domain | Key Classes |
|--------|--------|-------------|
| `DMT_` | Document management | Board, EditorControl, Folder, Panel, Pcb, Project, Schematic, SelectControl, Team, Workspace |
| `PCB_` | PCB & Footprint | Document, Drc, Event, Layer, Net, Primitive, PrimitiveComponent, PrimitiveLine, PrimitivePad, PrimitivePour, PrimitiveVia, SelectControl |
| `SCH_` | Schematic | Document, Event, Primitive, PrimitiveComponent, PrimitiveWire, SelectControl |
| `LIB_` | Library | 3DModel, Cbb, Classification, Device, Footprint, LibrariesList, PanelLibrary, SelectControl, Symbol |
| `SYS_` | System | Dialog, Environment, FileManager, FileSystem, FontManager, HeaderMenu, I18n, IFrame, LoadingAndProgressBar, Log, Message, MessageBox, MessageBus, PanelControl, Setting, ShortcutKey, Storage, Timer, ToastMessage, WebSocket, Window |
| `IPCB_` | PCB interfaces (图元) | PrimitiveArc, PrimitiveComponent, PrimitivePad, PrimitiveFill, PrimitivePour, PrimitiveRegion, PrimitiveVia, ... |
| `ISCH_` | Schematic interfaces (图元) | PrimitiveArc, PrimitiveComponent, PrimitiveWire, PrimitiveText, PrimitiveRectangle, ... |
| `EPCB_` / `ESCH_` | Enums | PrimitiveType, Layer, PadType, ... |
## Code Execution Context
All code runs inside EasyEDA Pro's browser runtime as:
```javascript
async function(eda) {
// Your code here — `eda` is the global EDA API object
// You MUST use `return` to send results back
// Do not add comments to the generated code, as the code is typically executed as a single line
}
```
**Critical rules:**
- The `eda` object provides access to all API modules (e.g., `eda.dmt_Board`, `eda.pcb_Primitive`).
- Always refer to the API documentation for correct usage.
- Do not add comments to the generated code, as the code is typically executed as a single line.
- Always use `return` to get results — `console.log` output is NOT captured.
- All API methods returning promises must be `await`ed.
- Code runs in browser context — no Node.js APIs (fs, path, etc.) available.
- Use `eda.sys_Message.showToastMessage(msg)` for user-visible notifications.
- When reviewing API documentation and encountering enumerations, do not guess the enumeration values. You must use the enumeration members, for example: `EPCB_LayerId.TOP` instead of `1` for the layer parameter in PCB primitive creation.
### Extension Runtime Constraints
When writing EasyEDA extensions, standard browser APIs are **forbidden** in the main process. Use EDA-provided alternatives:
| Purpose | ❌ Forbidden | ✅ Use Instead |
|---------|-------------|----------------|
| Get user input | — | `eda.sys_Dialog.showInputDialog()` |
| User selection | — | `eda.sys_Dialog.showSelectDialog()` |
| Show message | `alert()` | `eda.sys_Dialog.showInformationMessage()` |
| Confirm action | `confirm()` | `eda.sys_Dialog.showConfirmationMessage()` |
| Toast notification | DOM manipulation | `eda.sys_Message.showToastMessage()` |
| Store data | `localStorage` (main process) | `eda.sys_Storage.setExtensionUserConfig(key, value)` |
| Custom UI | Manipulate host DOM | `eda.sys_IFrame.openIFrame()` |
| Show HTML | `showInformationMessage(html)` | Must use iframe |
| Open link | `window.open()` | `eda.sys_Window.open()` |
| Browser hardware API | Use in main process | Available in iframe (`navigator.serial`, etc.) |
**Note:** `localStorage`, `window`, `document` etc. are available **inside `sys_IFrame`** but NOT in the main extension process.
### Extension ↔ IFrame Data Passing
The main extension process and `sys_IFrame` iframe are **isolated contexts**. To pass data between them:
**Option A (Recommended):** Use `eda.sys_Storage` as a bridge
```javascript
// In main extension process:
await eda.sys_Storage.setExtensionUserConfig('myKey', JSON.stringify(data));
// In iframe:
const data = JSON.parse(await eda.sys_Storage.getExtensionUserConfig('myKey'));
```
**Option B:** Both contexts can access `eda` directly — call the same API from either side
```javascript
// In iframe HTML (NOT window.parent.eda):
const info = await eda.dmt_Project.getCurrentProjectInfo();
```
## Communication Protocol
### Port Discovery
The bridge server listens on the first available port in **49620-49629**.
To find the server, scan the range and verify the service identity:
```bash
for port in $(seq 49620 49629); do
resp=$(curl -s http://127.0.0.1:$port/health 2>/dev/null)
if echo "$resp" | grep -q '"easyeda-bridge"'; then
BRIDGE_PORT=$port; break
fi
done
```
### Handshake
- **HTTP**: `GET /health` returns `{ "service": "easyeda-bridge", "edaConnected": bool, ... }`
- **WebSocket**: On connect, server sends `{ "type": "handshake", "service": "easyeda-bridge" }`
- Clients MUST verify `service === "easyeda-bridge"` before using the connection
### Message Format
JSON messages over WebSocket / HTTP:
| Field | Type | Description |
|-------|------|-------------|
| `type` | `"execute"` \| `"result"` \| `"error"` \| `"ping"` \| `"pong"` \| `"handshake"` | Message type |
| `id` | `string` | Request UUID for matching request/response |
| `code` | `string` | JavaScript code to execute (for `execute` type) |
| `result` | `any` | Execution result (for `result` type) |
| `error` | `string` | Error message (for `error` type) |
| `service` | `string` | Service identifier (for `handshake` type) |
| `timestamp` | `number` | Unix milliseconds |
## Common Patterns
### Project & Board Operations
```javascript
// Get current project info
return await eda.dmt_Project.getCurrentProjectInfo();
// List all boards in project
return await eda.dmt_Board.getAllBoardsInfo();
// Create a new board (optionally link to schematic/PCB)
return await eda.dmt_Board.createBoard();
// Switch to a document tab
await eda.dmt_EditorControl.activateDocument(tabId);
```
### Example: Open a project by name and open its first schematic page
```javascript
const targetProjectName = 'NE555 Circuit';
// 1. Enumerate projects by team/folder and find the target by name
const teams = await eda.dmt_Team.getAllTeamsInfo();
const seenProjectUuid = new Set();
let targetProjectUuid = null;
for (const team of teams || []) {
const teamProjects = await eda.dmt_Project.getAllProjectsUuid(team.uuid);
for (const projectUuid of teamProjects || []) {
if (seenProjectUuid.has(projectUuid)) continue;
seenProjectUuid.add(projectUuid);
const info = await eda.dmt_Project.getProjectInfo(projectUuid);
const name = info?.friendlyName || info?.name || '';
if (name === targetProjectName) {
targetProjectUuid = projectUuid;
break;
}
}
if (targetProjectUuid) break;
const folderUuids = await eda.dmt_Folder.getAllFoldersUuid(team.uuid);
for (const folderUuid of folderUuids || []) {
const folderProjects = await eda.dmt_Project.getAllProjectsUuid(team.uuid, folderUuid);
for (const projectUuid of folderProjects || []) {
if (seenProjectUuid.has(projectUuid)) continue;
seenProjectUuid.add(projectUuid);
const info = await eda.dmt_Project.getProjectInfo(projectUuid);
const name = info?.friendlyName || info?.name || '';
if (name === targetProjectName) {
targetProjectUuid = projectUuid;
break;
}
}
if (targetProjectUuid) break;
}
if (targetProjectUuid) break;
}
if (!targetProjectUuid) {
throw new Error(`Project not found: ${targetProjectName}`);
}
// 2. Open the project
const opened = await eda.dmt_Project.openProject(targetProjectUuid);
if (!opened) {
throw new Error(`Failed to open project: ${targetProjectName}`);
}
// 3. Get the first schematic page and open it
const schematics = await eda.dmt_Schematic.getAllSchematicsInfo();
if (!Array.isArray(schematics) || schematics.length === 0) {
throw new Error(`No schematics found in project: ${targetProjectName}`);
}
const firstSchematic = schematics[0];
const pages = await eda.dmt_Schematic.getAllSchematicPagesInfo();
const firstPage = (pages || []).find((page) => page.parentSchematicUuid === firstSchematic.uuid)
|| firstSchematic.page?.[0];
if (!firstPage) {
throw new Error(`No schematic page found in: ${firstSchematic.name}`);
}
const tabId = await eda.dmt_EditorControl.openDocument(firstPage.uuid);
return {
projectUuid: targetProjectUuid,
schematicUuid: firstSchematic.uuid,
pageUuid: firstPage.uuid,
tabId,
};
```
**Notes:**
- `dmt_Project.getAllProjectsUuid()` is **not** a global no-arg enumerator in practice. To reliably find a project by name, iterate teams first, then folders.
- `openProject(projectUuid)` may discard unsaved changes in the currently opened project. Be careful before calling it.
### PCB Primitive Operations
```javascript
// Get selected primitives
const selected = eda.pcb_SelectControl.getAllSelectedPrimitives_PrimitiveId();
// Create a line on copper layer
// Layer parameter uses EPCB_LayerId enum — see references/enums/EPCB_LayerId.md
await eda.pcb_PrimitiveLine.create(
"GND", // net (string)
EPCB_LayerId.TOP, // layer — use enum, NOT raw number
0, // startX (unit: 1mil)
0, // startY (unit: 1mil)
1000, // endX (unit: 1mil)
0, // endY (unit: 1mil)
10, // lineWidth
false // primitiveLock
);
// Modify an existing primitive (async pattern)
const prim = await eda.pcb_PrimitiveComponent.get([id]);
const asyncPrim = prim.toAsync();
asyncPrim.setState_X(newX);
asyncPrim.setState_Y(newY);
asyncPrim.done();
```
### PCB Async Primitive Pattern (IMPORTANT)
For **modifying** PCB/SCH primitives, you must use the async pattern:
```javascript
// 1. Get the primitive
const prim = await eda.pcb_PrimitiveVia.get([viaId]);
// 2. Convert to async mode
const asyncPrim = prim.toAsync();
// 3. Set new values
asyncPrim.setState_X(newX);
asyncPrim.setState_Y(newY);
asyncPrim.setState_Diameter(diameter);
// 4. Apply changes
asyncPrim.done();
```
### Schematic Operations
```javascript
// Get all pages
return await eda.dmt_Schematic.getAllSchematicDocumentsInfo();
// Create a schematic component
// component parameter requires {libraryUuid, uuid} object — NOT a plain string
await eda.sch_PrimitiveComponent.create(
{ libraryUuid: "...", uuid: "device-uuid-from-library" }, // component object
5000, // x (unit: 0.01inch = 10mil)
5000, // y (unit: 0.01inch = 10mil)
"", // subPartName
0, // rotation (degrees, plain number)
false, // mirror
true, // addIntoBom
true // addIntoPcb
);
// Get selected schematic primitives
const ids = eda.sch_SelectControl.getAllSelectedPrimitives_PrimitiveId();
```
### Library Operations
```javascript
// List all libraries in workspace
return await eda.lib_LibrariesList.getAllLibrariesList();
// Search devices
return await eda.lib_Device.search("STM32");
// Get symbol info
return await eda.lib_Symbol.get(symbolUuid);
```
### System Functions
```javascript
// Show toast message
eda.sys_Message.showToastMessage("Operation complete!");
// Show confirm dialog
const confirmed = await eda.sys_Dialog.showConfirmationMessage("Proceed?");
// File system (limited to extension sandbox)
const content = await eda.sys_FileSystem.readFileFromFileSystem(path);
await eda.sys_FileSystem.saveFileToFileSystem(path, content);
```
### DRC (Design Rule Check)
```javascript
// Run DRC check
const passed = await eda.pcb_Drc.check(true, true, false);
// passed is boolean: true if DRC passed, false if errors found
```
## Common Mistakes
### Read API Signatures Carefully (CRITICAL)
**Before calling ANY API method, you MUST read the full signature from `references/` — including parameter types, return type, and remarks.**
AI agents frequently make these errors due to skimming documentation:
**Error 1: Not `await`ing Promise-returning methods**
Almost all EDA API methods return `Promise<T>`. If you forget `await`, you get a Promise object instead of the actual result.
```javascript
// WRONG: Missing await — result is a Promise, not the project info
const project = eda.dmt_Project.getCurrentProjectInfo();
console.log(project); // Promise { <pending> }
// CORRECT: Always await async methods
const project = await eda.dmt_Project.getCurrentProjectInfo();
console.log(project); // { uuid: "...", name: "...", ... }
```
**How to know if a method needs `await`:** Check the return type in the signature. If it says `Promise<...>`, you MUST `await` it.
```typescript
// From references/classes/DMT_Project.md:
getCurrentProjectInfo(): Promise<IDMT_ProjectItem | null>
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// This is a Promise — you MUST await it
```
**Error 2: Using raw numbers instead of enum values**
Many parameters expect specific enum values. Using wrong numbers silently produces incorrect behavior.
```javascript
// WRONG: What does layer "1" mean? Which copper layer? Signal? Mask?
await eda.pcb_PrimitiveLine.create("GND", 1, 0, 0, 1000, 0, 10, false);
// CORRECT: Use the enum — EPCB_LayerId.TOP is clear and type-safe
// Check references/enums/EPCB_LayerId.md for the correct value
await eda.pcb_PrimitiveLine.create("GND", EPCB_LayerId.TOP, 0, 0, 1000, 0, 10, false);
```
**Always look up enums in `references/enums/` before using numeric constants.**
**Error 3: Assuming parameter types without checking**
Different APIs use different units, different ID formats, and different optional parameter conventions. Never assume.
```javascript
// WRONG: Assuming create() parameters match modify() parameters
// create() and modify() often have DIFFERENT parameter orders/types
// CORRECT: Always read the exact signature for the method you're calling
// Check references/classes/<ClassName>.md for each method's specific signature
```
**Summary — Before every API call:**
1. **Read the signature** — parameter types, return type, all in `references/classes/`
2. **`await` if `Promise`** — check return type for `Promise<...>`
3. **Use enums** — look up in `references/enums/` instead of guessing numbers/strings
4. **Check remarks** — the "备注" section often has critical usage notes
### Coordinate Unit (CRITICAL)
**Different domains use different coordinate units:**
| Domain | Unit | Conversion |
|--------|------|------------|
| **PCB** | 1mil | 1mm ≈ 39.37 units |
| **Schematic** | 0.01inch (10mil) | 1mm ≈ 3.937 units |
**This is the #1 mistake AI agents make.** Mixing up the units will place components incorrectly.
- PCB: 1 unit = 1mil = 0.001 inch = 0.0254 mm
- Schematic: 1 unit = 0.01inch = 10mil = 0.254 mm
If you use the wrong unit, components will be placed **10x too far** from their intended position.
```javascript
// WRONG: thinking unit is 1mil (it's actually 0.01inch = 10mil)
// Placing at x=500 thinking it's 500mil = 0.5inch — but 500 units = 5000mil = 5inch!
await eda.sch_PrimitiveComponent.create({libraryUuid: "...", uuid: "dev-uuid"}, 500, 0, "", 0, false, true, true);
// CORRECT: 50 units = 500mil = 0.5inch (in 0.01inch units)
await eda.sch_PrimitiveComponent.create({libraryUuid: "...", uuid: "dev-uuid"}, 50, 0, "", 0, false, true, true);
```
### Document State (CRITICAL)
**After creating a project, you MUST open it before operating on documents within it.**
When operating on documents, always verify:
1. **Project is opened** — Use `eda.dmt_Project.getCurrentProjectInfo()` to verify
2. **Correct document is active** — Use `eda.dmt_SelectControl.getCurrentDocumentInfo()` to check document type
3. **Document type matches API domain** — PCB APIs require active PCB document, SCH APIs require active Schematic document
```javascript
// WRONG: Assuming operation will work without checking document state
await eda.pcb_PrimitiveLine.create(...); // May fail if no PCB document is open
// CORRECT: Always verify document state first
const project = await eda.dmt_Project.getCurrentProjectInfo();
if (!project) {
// If you just created a project, you MUST open it before any operations!
return "Error: No project is currently opened. If you just created a project using dmt_Project.createProject(), you MUST call dmt_Project.openProject(projectPath) to open it first. You cannot operate on documents until a project is opened.";
}
const doc = await eda.dmt_SelectControl.getCurrentDocumentInfo();
if (doc?.documentType !== EDMT_EditorDocumentType.PCB) {
return "Error: No PCB document is currently active. Please open a PCB document first.";
}
// Now safe to perform PCB operations
await eda.pcb_PrimitiveLine.create(...);
```
**Operating on the wrong document type will return errors or null results.** For example:
- Executing `PCB_*` APIs without an active PCB document (`documentType !== EDMT_EditorDocumentType.PCB`) → error/null
- Executing `SCH_*` APIs without an active Schematic document (`documentType !== EDMT_EditorDocumentType.SCHEMATIC_PAGE`) → error/null
### IFrame Context — Always Use `eda` Directly (CRITICAL)
When writing extension code that creates an iframe via `sys_IFrame.openIFrame()`, the JavaScript code inside the iframe's HTML can access the `eda` global **directly**. Do NOT use `window.parent.eda`.
**Why this matters:**
EasyEDA injects the `eda` object into the iframe's execution context automatically. Standard browser cross-frame patterns (`window.parent`, `parentWindow`, etc.) do NOT apply here and will fail.
```javascript
// WRONG: Using window.parent to reach parent frame's eda object
// This is a common mistake made by AI agents familiar with web iframe patterns
const project = await window.parent.eda.dmt_Project.getCurrentProjectInfo();
// CORRECT: eda is available directly in the iframe context
const project = await eda.dmt_Project.getCurrentProjectInfo();
```
**This applies to ALL code inside `sys_IFrame` iframes:**
- Extension UI panels loaded via `openIFrame()`
- Any HTML file inside the extension package displayed in an iframe
**Rule:** In EasyEDA extensions, whether code runs in the main context or inside an iframe created by `sys_IFrame`, always access the API through `eda.xxx` — never through `window.parent.eda` or any other parent frame accessor.
### Multi-Window Support
When multiple EasyEDA windows are connected to the bridge, you do NOT need to check window selection on every EDA operation. Only check when:
1. **First EDA operation** — Verify which window is active and tell the user
2. **EDA disconnected error** — If bridge returns an error about EDA being disconnected, ask user to select a new window
**Multi-window operations:**
```bash
# List all connected EDA windows
curl http://localhost:49620/eda-windows
# Select a specific window
curl -X POST http://localhost:49620/eda-windows/select \
-H "Content-Type: application/json" \
-d '{"windowId": "abc-123-def"}'
# Execute on specific window
curl -X POST http://localhost:49620/execute \
-H "Content-Type: application/json" \
-d '{"code": "return await eda.dmt_Project.getCurrentProjectInfo();", "windowId": "abc-123-def"}'
```
If only one EDA window is connected, it's automatically selected as active.
## Debugging Tips & Failure Strategies
### Troubleshooting
1. **Always check health first**: Scan ports 49620-49629 for `{"service":"easyeda-bridge"}`
2. **EDA not connected?**: Ensure bridge extension is loaded in EasyEDA. Download: https://jlc-ext.com/item/oshwhub/run-api-gateway
3. **Timeout errors**: Default 30s timeout. If timeout occurs:
- Check if the correct project and document are opened (use `dmt_Project.getCurrentProjectInfo()`)
- If no project is opened, use `dmt_Project.openProject(projectPath)` to open one
- If no document is active, use `dmt_EditorControl.openDocument(docId)` to open the correct document type (PCB/Schematic)
- If the document type is wrong (e.g., running PCB APIs on Schematic), switch to the correct document first
- Complex operations may need code splitting
4. **Check return values**: Many methods return `null` on failure — always validate
5. **Layer numbers**: Use enums from `references/enums/` docs (e.g., `EPCB_LayerId`)
6. **EDA window disconnected**: If you get an error about a window being disconnected, use `GET /eda-windows` to check available windows and `POST /eda-windows/select` to switch to another window
7. **Permission errors**: All API interfaces are controlled by EDA's permission system. If a specific API consistently fails to execute (returns error or null) while other APIs work fine, and you've confirmed the call matches the documentation exactly, it may be **blocked by permissions** — not a code bug. The EDA client may restrict certain operations based on user license, project settings, or document state. Inform the user that the operation may require elevated permissions or a different EDA edition.
8. **Persistent errors?**: If you've verified the API call matches the documentation exactly, ruled out permission issues, and still encounter unexpected errors, consider reporting the issue through official EasyEDA support channels
### Failure Handling Rules
When developing extensions, follow these rules:
| Situation | Action |
|-----------|--------|
| API method does not exist in docs | **Stop immediately** — inform the user the API doesn't exist |
| Signature uncertain after reading docs | **Stop generation** — return to query step and re-read |
| Forbidden browser API detected | **Auto-replace** with `eda.sys_*` alternative |
| Menu ID conflict | Add prefix to differentiate (e.g., `my-plugin-home`, `my-plugin-sch`) |
| Permission blocked | Inform user — may require different EDA edition or license |
**Critical:** Never guess an API signature. If `references/classes/` doesn't document it, it doesn't exist for your use case.
## Workflow for AI Agent
When the user asks you to perform EDA operations:
1. **Understand the task** — What domain? (PCB/SCH/LIB/Project)
2. **Verify document state** — Check `eda.dmt_Project.getCurrentProjectInfo()` and `eda.dmt_SelectControl.getCurrentDocumentInfo()`
3. **Confirm correct document type** — PCB operations need active PCB, SCH operations need active Schematic
4. **Look up API** — Read relevant class docs from `references/`
5. **Check types** — Read enum/interface docs for parameter types
6. **Write code** — Follow the execution context rules above
7. **Execute** — Send via `POST /execute` and check the result
8. **Iterate** — If errors occur, read error messages and adjust
When unsure about an API:
- Search `_quick-reference.md` for method names
- Read the specific class doc for detailed signatures and remarks
- Check interface docs for complex parameter types
## Session Management
### Detecting Topic Changes
The Bridge server consumes system resources while running. If the user has switched to a completely different topic (not related to EasyEDA/EDA/PCB/schematic) **3 consecutive times**, proactively ask if they want to close the Bridge:
> "I notice we've moved on from EasyEDA. The Bridge server is still running in the background. Would you like me to stop it to free up resources?"
**Do NOT close the Bridge automatically** — the user may switch back to EDA work later. Only ask, and close if they confirm.
### Closing the Bridge
If the user confirms they want to stop the Bridge:
```bash
# Find and stop the bridge process
for port in $(seq 49620 49629); do
pid=$(lsof -ti :$port 2>/dev/null)
if [ -n "$pid" ]; then
kill $pid
echo "Bridge stopped (PID: $pid, Port: $port)"
break
fi
done
```
README.md
[English](#) | [简体中文](./README.zh-Hans.md)
# EasyEDA API Skill
An EasyEDA Pro API skill package for AI coding tools such as Claude Code, OpenCode, QwenCode, and any other tool that supports the [Agent Skills](https://agentskills.io/) standard.
This skill supports both online debugging of EasyEDA Pro through AI and extension development for EasyEDA Pro.
When developing EasyEDA extensions, AI can use the extension-development documentation, API references, type information, usage examples, and bridge debugging capabilities provided by this skill to help with API lookup, code generation, and integration debugging.
If you want to analyze or modify EasyEDA document source files directly instead of operating through the API, this project also provides documentation for the source file formats.
- 📚 **Structured API documentation** — Automatically builds hierarchical indexes from reference docs for fast AI lookup
- 🧾 **Document source format specifications** — Explains project, schematic, and PCB source formats for direct source analysis and modification
- 🔌 **WebSocket Bridge** — A Node.js server that bridges AI tools and the EasyEDA client
- 🤖 **SKILL.md** — A complete skill instruction file
## Quick Start
### 1. Install dependencies
```bash
npm install
```
### 2. Build API documentation
```bash
npm run build:docs
```
This reads the raw API documentation from the `reference/` directory and generates structured docs into the `docs/` directory.
### 3. Start the WebSocket Bridge server
```bash
npm run server
```
The server automatically chooses an available port in the `49620-49629` range and waits for the EasyEDA client to connect.
### 4. Connect from EasyEDA
Install the `run-api-gateway.eext` extension in EasyEDA. Download:
- https://jlcext.com/item/oshwhub-official/run-api-gateway
After the extension is loaded, it connects to the Bridge server automatically by scanning the port range and verifying the handshake.
### 5. Use from an AI coding tool
AI coding tools such as Claude Code, OpenCode, and QwenCode automatically read `SKILL.md` for instructions, then use the HTTP API to send code to EasyEDA:
```bash
# Check EasyEDA connection status (assuming the service is on port 49620)
curl http://localhost:49620/health
# Execute EasyEDA code
curl -X POST http://localhost:49620/execute \
-H "Content-Type: application/json" \
-d '{"code": "return await eda.dmt_Project.getCurrentProjectInfo();"}'
```
## One-Command Packaging
```bash
npm run pack
```
This performs the following steps:
1. Build API documentation (`docs/`)
2. Package `SKILL.md`, documentation, and the server into `dist/easyeda-api/`
3. Generate `dist/easyeda-api.zip` for upload
If the documentation has already been built, you can skip that step:
```bash
npm run pack:fast
```
### Publish to ClawHub
```bash
npx clawhub@latest publish dist/easyeda-api/
```
Or upload the zip file at https://clawhub.ai/upload
## Architecture
```
┌──────────────┐ HTTP/WS ┌────────────────┐ WebSocket ┌──────────┐
│ AI Agent │ ◄───────────► │ Bridge Server │ ◄───────────► │ EasyEDA │
│ (Skill Tool) │ Port Range │ (Node.js) │ Port Range │ (Client) │
└──────────────┘ 49620-49629 └────────────────┘ 49620-49629 └──────────┘
```
## Communication Protocol
| Message Type | Direction | Description |
|--------------|-----------|-------------|
| `execute` | AI → EDA | Execute JavaScript code |
| `result` | EDA → AI | Return execution result |
| `error` | EDA → AI | Return execution error |
| `handshake` | Server → Client | Connection verification (includes `service: "easyeda-bridge"`) |
| `ping/pong` | Bidirectional | Heartbeat |
## Directory Structure
```text
easyeda-api-skill/
SKILL.md # AgentSkills standard skill definition
AGENTS.md # Agent prompt guide
package.json # Project configuration
reference/ # Raw API reference docs (gitignored)
docs/ # Built structured docs (gitignored)
format/ # EasyEDA document source format specs (project/schematic/pcb)
guide/ # API development guides
user-guide/ # User guides
server/index.mjs # WebSocket Bridge server
scripts/
build-docs.mjs # Documentation build script
pack.mjs # Packaging script
dist/ # Packaging output (gitignored)
easyeda-api/ # Publishable skill directory
easyeda-api.zip # Zip archive for ClawHub upload
```format/pcb/obj.md
# OBJ Binary Embedded Object
Files and other data are encoded into the following primitive to be embedded in the page as images and files, which can be downloaded as attachments or displayed directly.
```json
{ "type": "OBJ", "id":"UUID", "ticket": 1 }||
{
"partitionId":null,
"groupId":0,
"locked":1,
"zIndex":5.286,
"layerId":15,
"fileName":"a.png",
"startX":200,
"startY":300,
"width":10,
"height":20,
"angle":0,
"mirror":1,
"path":"blob:1234ade2f",
}|
["OBJ", "e662", 0, 1, 5.286, 15, "a.png", 200, 300, 10, 20, 0, 1, "blob:1234ade2f"]
```
1. type binary embedded object identifier: OBJ.
2. id primitive ID, unique within the document.
3. ticket logical clock.
4. partitionId partition ID it belongs to, null means no partition. Ignored for footprints.
5. groupId group ID: 0 no group, non-zero is the group flag, same flag means same group.
6. locked whether locked.
7. zIndex Z-axis height.
8. layerId layer.
9. fileName file name.
10. startX top-left X.
11. startY top-left Y.
12. width width.
13. height height.
14. angle rotation angle, around `top-left`.
15. mirror whether the original image is horizontally mirrored. Mirroring is performed around the center of the original image's BBox.
16. path binary data.
1. General format, compatible with `Data URLs`: `data:[<mediatype>][;base64],<data>`
- e.g. `data:image/png;base64,asdfasdfwer`
2. BLOB reference format, `blob:hashid`.
format/pcb/common.md
# Common Format
This chapter details the format specification of the EasyEDA PCB file. PCB files mainly consist of the following parts:
- **Common Format**: Document header, canvas, layer, physical layer, preferences, etc.
- **Partition Format**: Partition definitions.
- **Basic Primitives**: Nets, primitive configurations, groups, silkscreen configurations, associations, attributes, etc.
- **Pads and Vias**: Pads and vias.
- **Shape Primitives**: Lines, arcs, polygon systems, polylines, fills, regions, copper pours, images, teardrops, etc.
- **Binary Objects**: Embedded objects.
- **3D Shell**: Shells, creases, entities, bosses.
- **Text System**: Text.
- **Attributes**: Attributes.
- **Dimension Tools**: Dimension annotations.
- **Footprint System**: Component instances.
- **Panelization**: Panelization parameters.
- **Design Rules**: Rule templates, rules.
## Document Header
```json
{ "type": "DOCHEAD" }||{ "docType": "PCB", "uuid": "UUID", "client": "clientID" }|
```
```json
{ "type": "DOCHEAD" }||{ "docType": "FOOTPRINT", "uuid": "UUID", "client": "clientID" }|
```
- type: "DOCHEAD", document header identifier.
- docType: document type, "PCB" PCB, "FOOTPRINT" footprint.
- uuid: document unique ID, unique within the project.
- client: terminal identifier for eventual consistency.
## CANVAS Canvas Configuration
```json
{ "type": "CANVAS", "ticket": 1 }||
{
"originX":0,
"originY":0,
"unit":"mm",
"gridXSize":10,
"gridYSize":10,
"snapXSize":1,
"snapYSize":1,
"altSnapXSize":0.1,
"altSnapYSize":0.1,
"gridType":1,
"multiGridType":0,
"multiGridRatio":5,
}|
```
1. type canvas configuration `CANVAS`.
2. ticket logical clock.
3. originX canvas origin X.
4. originY canvas origin Y.
5. unit **display** unit (does not affect the unit of data in the format).
6. gridXSize grid size X.
7. gridYSize grid size Y.
8. snapXSize snap size X.
9. snapYSize snap size Y.
10. altSnapXSize Alt snap size X.
11. altSnapYSize Alt snap size Y.
12. gridType grid type: `0` none, `1` grid, `2` dot.
13. multiGridType bold grid type: `0` none, `1` grid, `2` dot.
14. multiGridRatio bold grid ratio: number.
## LAYER Layer Configuration
- The order in which `SIGNAL`, `PLANE`, and `SUBSTRATE` appear implies their physical stacking order.
- The number of `SIGNAL`, `PLANE`, and `SUBSTRATE` layers is unlimited.
- The format does not assume a stable relationship between layer number and layer; specific implementation is decided by the tool.
```json
{ "type": "LAYER","id": 0, "ticket": 1 }||
{
"layerType":"TOP",
"layerName":"Top Layer",
"status":1,
"activeColor":"#FF0000",
"activateTransparency":0.5,
"inactiveColor":"#880000",
"inactiveTransparency":0.3,
}|
```
1. type layer `LAYER`.
2. id layer number, unique.
3. ticket logical clock.
4. layerType layer type.
5. layerName layer alias, must be unique.
6. status status: `1` used, `2` displayed, `4` locked. Can be combined by addition, e.g.
- used and displayed: 3 = 1 + 2
- used and locked but not displayed: 5 = 1 + 4
- used, displayed, and locked: 7 = 1 + 2 + 4
7. activeColor active color.
8. activateTransparency active transparency.
9. inactiveColor inactive color.
10. inactiveTransparency inactive transparency.
```json
["LAYER",2,"BOTTOM","Bottom Layer",1,"#0000ff",1,"#00007f",1]
["LAYER",3,"TOP_SILK","Top Silkscreen Layer",1,"#ffcc00",1,"#7f6600",1]
["LAYER",4,"BOT_SILK","Bottom Silkscreen Layer",1,"#66cc33",1,"#336619",1]
["LAYER",5,"TOP_SOLDER_MASK","Top Solder Mask Layer",1,"#800080",1,"#400040",1]
["LAYER",6,"BOT_SOLDER_MASK","Bottom Solder Mask Layer",1,"#aa00ff",1,"#55007f",1]
["LAYER",7,"TOP_PASTE_MASK","Top Paste Mask Layer",1,"#808080",1,"#404040",1]
["LAYER",8,"BOT_PASTE_MASK","Bottom Paste Mask Layer",1,"#800000",1,"#400000",1]
["LAYER",9,"TOP_ASSEMBLY","Top Assembly Layer",1,"#33cc99",1,"#19664c",1]
["LAYER",10,"BOT_ASSEMBLY","Bottom Assembly Layer",1,"#5555ff",1,"#2a2a7f",1]
["LAYER",11,"OUTLINE","Board Outline Layer",1,"#ff00ff",1,"#7f007f",1]
["LAYER",12,"MULTI","Multi-Layer",1,"#c0c0c0",1,"#606060",1]
["LAYER",13,"DOCUMENT","Document Layer",1,"#ffffff",1,"#7f7f7f",1]
["LAYER",14,"MECHANICAL","Mechanical Layer",1,"#f022f0",1,"#781178",1]
["LAYER",50,"SUBSTRATE","Dialectric1",3,"#999966",1,"#4c4c33",1]
["LAYER",15,"SIGNAL","Inner1",3,"#999966",1,"#4c4c33",1]
["LAYER",52,"SUBSTRATE","Dialectric3",3,"#999966",1,"#4c4c33",1]
["LAYER",51,"SUBSTRATE","Dialectric2",3,"#999966",1,"#4c4c33",1]
["LAYER",17,"SIGNAL","Inner2",3,"#008000",1,"#004000",1]
["LAYER",58,"SUBSTRATE","Dialectric9",3,"#999966",1,"#4c4c33",1]
["LAYER",16,"SIGNAL","Inner3",3,"#999966",1,"#4c4c33",1]
["LAYER",53,"SUBSTRATE","Dialectric4",3,"#999966",1,"#4c4c33",1]
["LAYER",47,"HOLE","Hole Layer",1,"#222222",1,"#111111",1]
["LAYER",48,"SHELL","3D Shell Layer",1,"#222222",1,"#111111",1]
["LAYER",49,"TOP_SHELL","Top 3D Shell Layer",1,"#222222",1,"#111111",1]
["LAYER",50,"BOT_SHELL","Bottom 3D Shell Layer",1,"#222222",1,"#111111",1]
```
## LAYER_PHYS Layer Physical Properties Configuration
```json
{ "type": "LAYER_PHYS","id": 0, "ticket": 1 }||
{
"material":"COPPER",
"thickness":1,
"permittivity":0,
"lossTangent":0,
"isKeepIsland":0,
}|
```
1. type layer physical properties `LAYER_PHYS`.
2. id layer number.
3. ticket logical clock.
4. material layer material.
5. thickness thickness.
6. permittivity permittivity.
7. lossTangent loss tangent.
8. isKeepIsland whether to keep islands on internal plane layers.
```json
{ "type": "LAYER_PHYS","id": 2, "ticket": 1 }||
{
"material":"COPPER",
"thickness":1,
"permittivity":0,
"lossTangent":0,
"isKeepIsland":0,
}|
```
```json
{ "type": "LAYER_PHYS","id": 15, "ticket": 1 }||
{
"material":"COPPER",
"thickness":1,
"permittivity":0,
"lossTangent":0,
"isKeepIsland":1,
}|
```
```json
{ "type": "LAYER_PHYS","id": 50, "ticket": 1 }||
{
"material":"COPPER",
"thickness":10,
"permittivity":4.5,
"lossTangent":0.02,
"isKeepIsland":0,
}|
```
## ACTIVE_LAYER Active Layer Configuration
```json
{ "type": "ACTIVE_LAYER", "ticket": 1 }||
{
"layerId":0,
}|
```
1. type current active layer `ACTIVE_LAYER`.
2. ticket logical clock.
3. layerId layer index.
## SILK_OPTS Silkscreen Configuration
Silkscreen configuration is currently mainly used for colored silkscreen processes.
```json
{ "type": "SILK_OPTS","id": 3, "ticket": 1 }||
{
"defaultColor":"#ffffff",
"baseColor":"#000000",
}|
```
1. type silkscreen configuration: SILK_OPTS.
2. id layer number: only top silkscreen and bottom silkscreen.
3. ticket logical clock.
4. defaultColor default color.
5. baseColor base color.
```json
{ "type": "SILK_OPTS","id": 4, "ticket": 1 }||
{
"defaultColor":"#020202",
"baseColor":"#aaaaaa",
}|
```
## PREFERENCE Preferences
```json
{ "type": "PREFERENCE", "ticket": 1 }||
{
"startTrackWidthFollowLast":0,
"lastTrackWidth":10,
"startViaSizeFollowLast":0,
"lastViaInnerDiameter":39.37,
"lastViaDiameter":78.74,
"snap":1,
"routingMode":2,
"routingCorner":"L45",
"removeLoop":1,
"rotatingObject":0,
"trackFollow":0,
"stretchTrackMinCorner":1,
"preferenceConfig":null,
"realTimeUpdateUnusedLayers":0,
"unusedPadRange":3,
"pushVia":"OPTIMIZA_OPEN",
"pathOptimization4BePushed":0,
"currentPathOptimization4BePushed":"OPTIMIZA_WEAK",
"removeCircuitsContainingVias":1,
"removeAntenna":1,
}|
```
1. type preferences `PREFERENCE`.
2. ticket logical clock.
3. startTrackWidthFollowLast whether starting track width follows last setting.
4. lastTrackWidth last track width.
5. startViaSizeFollowLast whether starting via size follows last setting.
6. lastViaInnerDiameter last via inner diameter.
7. lastViaDiameter last via outer diameter.
8. snap whether auto-snap.
9. routingMode routing mode: `0` none, `1` push, `2` hug, `3` block.
10. routingCorner routing corner mode.
- `"L45"` line 45 degrees.
- `"L90"` line 90 degrees.
- `"R45"` arc 45 degrees.
- `"R90"` arc 90 degrees.
- `"L"` free-angle line.
- `"R"` free-angle arc.
11. removeLoop whether routing automatically removes loops.
12. rotatingObject whether single-object rotation.
13. trackFollow whether tracks follow footprint movement.
14. stretchTrackMinCorner stretch track minimum corner ratio (to track width).
15. preferenceConfig layer stack preference source.
16. realTimeUpdateUnusedLayers whether to automatically remove unused pads.
17. unusedPadRange range for removing unused pads.
1. all.
2. pads only.
3. vias only.
18. pushVia push via.
19. pathOptimization4BePushed path optimization (single segment / whole segment).
20. currentPathOptimization4BePushed current track path optimization.
21. removeCircuitsContainingVias whether to remove loops containing vias.
22. removeAntenna whether to remove antennas.
## ITEM_ORDER Primitive Order Suggestion
Provides a primitive order suggestion for the PCB. The PCB can arrange primitive order according to this information. This information can only appear once.
```json
{ "type": "ITEM_ORDER", "ticket": 1 }||{ "ids":["e2", "e1"] }|
```
1. type primitive order suggestion: ITEM_ORDER.
2. ticket logical clock.
3. ids primitive IDs, two encoding forms:
1. Normal ID: form `/^[a-z]+\d+$/i`, e.g. `e1`, `e123`.
2. Footprint instance ID: form `/^[a-z]+\d+[a-z]+\d+$/i`, used for silkscreen in footprints, e.g. `e1e5`, `e12e22`.
To explain why it is called a "suggestion": if `e1` is a top-layer primitive and `e2` is a bottom-layer primitive, then
```json
{ "type": "ITEM_ORDER", "ticket": 1 }||{ "ids":["e2", "e1"] }|
```
the default is still `e1` on top, unless some special operation causes the bottom layer to be brought to the front.
format/pcb/attr.md
# ATTR Attribute
Attributes are used to describe properties that the PCB or FOOTPRINT may need to display on the drawing.
```json
{ "type": "ATTR", "id":"UUID", "ticket": 1 }||
{
"partitionId":null,
"groupId":0,
"locked":1,
"zIndex":0.072,
"parentId":"",
"layerId":1,
"positionX":200,
"positionY":150,
"key":"DESIGNATOR",
"value":"U1",
"keyVisible":0,
"valueVisible":1,
"fontFamily":"SimSun",
"fontSize":50,
"strokeWidth":10,
"bold":0,
"italic":0,
"origin":5,
"angle":15,
"reverse":1,
"reverseExpansion":0,
"mirror":1,
"width":100,
"height":200,
"path":["complex polygon"],
}|
```
1. type attribute `ATTR`.
2. id primitive ID, unique within the document.
3. ticket logical clock.
4. partitionId partition ID it belongs to, null means no partition. Ignored for footprints.
5. groupId group ID: 0 no group, non-zero is the group flag, same flag means same group.
6. locked whether locked.
7. zIndex Z-axis height.
8. parentId affiliation ID, left blank means current block-level primitive.
9. layerId layer.
10. positionX position X: fixed to `null` for attributes that have never been displayed.
11. positionY position Y: fixed to `null` for attributes that have never been displayed.
12. key Key.
13. value Value.
14. keyVisible whether to display Key.
15. valueVisible whether to display Value.
16. fontFamily font name.
17. fontSize font size.
18. strokeWidth stroke width.
19. bold whether bold.
20. italic whether italic.
21. origin alignment mode: `0` top-left, `1` top-center, `2` top-right, `3` middle-left, `4` middle-center, `5` middle-right, `6` bottom-left, `7` bottom-center, `8` bottom-right.
22. angle rotation angle.
23. reverse whether reverse expansion.
24. reverseExpansion reverse expansion size: size of the reverse expansion area, supports negative numbers.
25. mirror whether mirrored. Generally, when text appears on the bottom layer, this should also be adjusted to `1`.
26. width height, `null` if none.
27. height width, `null` if none.
28. path complex polygon array, `null` if none.
format/pcb/3d.md
# 3D Shell System
## SHELL Shell
```json
{ "type": "SHELL", "id":"UUID", "ticket": 1 }||
{
"partitionId":null,
"groupId":0,
"locked":1,
"zIndex":0.223,
"shellType":"T&B",
"shellHeight":50,
"pcbHeight":100,
"strokeWidth":10,
"path":"complex polygon",
"attrs":{},
}|
```
1. type shell `SHELL`.
2. id primitive ID, unique within the document.
3. ticket logical clock.
4. partitionId partition ID it belongs to, null means no partition. Ignored for footprints.
5. groupId group ID: 0 no group, non-zero is the group flag, same flag means same group.
6. locked whether locked.
7. zIndex Z-axis height.
8. shellType shell type.
- `T&B` top & bottom shell.
- `DRAWER` drawer.
- `CLAM` clamshell.
9. shellHeight shell height.
10. pcbHeight PCB height.
11. strokeWidth \*line width (deprecated).
12. path see complex polygon.
13. attrs custom attributes: each 3D shell type has a set of custom shell attributes.
- T&B
- Thickness: shell thickness.
- BottomHeight: bottom shell height.
- TopInnerHeight: top shell inner wall height.
- TopInnerThickness: top shell inner wall thickness.
- DRAWER
- Thickness: shell thickness.
- Direction: drawer direction.
- `1` positive X axis.
- `2` negative X axis.
- `4` positive Y axis.
- `8` negative Y axis.
## CREASE Side Reference Line (Crease)
`CREASE` primitives need to be used with `CONNECT` to associate `SHELL_ENTITY` and `BOSS` to express shell slots.
```json
{ "type": "CREASE", "id":"UUID", "ticket": 1 }||
{
"partitionId":null,
"groupId":0,
"locked":1,
"zIndex":8.275,
"layerId":49,
"startX":20,
"startY":30,
"endX":40,
"endY":50,
"angle":90,
}|
```
1. type crease `CREASE`.
2. id primitive ID, unique within the document.
3. ticket logical clock.
4. partitionId partition ID it belongs to, null means no partition. Ignored for footprints.
5. groupId group ID: 0 no group, non-zero is the group flag, same flag means same group.
6. locked whether locked.
7. zIndex Z-axis height.
8. layerId layer.
9. startX start X.
10. startY start Y.
11. endX end X.
12. endY end Y.
13. angle fold angle.
## SHELL_ENTITY Shell Entity Area
A `SHELL_ENTITY` not associated with `CREASE` via `CONNECT` performs vertical fill/cut (slotting) for the top and bottom shells.
```json
{ "type": "SHELL_ENTITY", "id":"UUID", "ticket": 1 }||
{
"partitionId":null,
"groupId":0,
"locked":1,
"zIndex":0.15,
"layerId":50,
"booleanOperation":0,
"belong":0,
"depth":10,
"strokeWidth":10,
"path":"complex polygon",
}|
```
1. type shell entity area `SHELL_ENTITY`.
2. id primitive ID, unique within the document.
3. ticket logical clock.
4. partitionId partition ID it belongs to, null means no partition. Ignored for footprints.
5. groupId group ID: 0 no group, non-zero is the group flag, same flag means same group.
6. locked whether locked.
7. zIndex Z-axis height.
8. layerId layer.
9. booleanOperation boolean operation: 0 cut, 1 fill.
10. belong affiliation: 0 auto, 1 top shell, 2 bottom shell, 4 shell border, 8 boss, 16 entity. Can be combined by addition.
- top + bottom shells: 3 = 1 + 2
- shell border + boss: 12 = 4 + 8
- boss + entity: 24 = 8 + 16
- shell border + boss + entity: 28 = 4 + 8 + 16
11. depth depth.
12. strokeWidth line width.
13. path see complex polygon.
## BOSS Boss
A `BOSS` associated with `CREASE` via `CONNECT` adds a side boss.
```json
{ "type": "BOSS", "id":"UUID", "ticket": 1 }||
{
"partitionId":null,
"groupId":0,
"locked":1,
"zIndex":0.8976,
"layerId":50,
"centerX":100,
"centerY":200,
"specification":"M2",
"depth":100,
"thickness":10,
"holeDiameter":20,
"counterBore":[100, 20],
"stiffener":[20, 40, 20, 10],
}|
```
1. type boss `BOSS`.
2. id primitive ID, unique within the document.
3. ticket logical clock.
4. partitionId partition ID it belongs to, null means no partition. Ignored for footprints.
5. groupId group ID: 0 no group, non-zero is the group flag, same flag means same group.
6. locked whether locked.
7. zIndex Z-axis height.
8. layerId layer.
9. centerX center X.
10. centerY center Y.
11. specification screw specification: `"M2"`, `"M3"`, etc., or `null` for custom.
12. depth boss height.
13. thickness boss wall thickness.
14. holeDiameter through-hole diameter.
15. counterBore counterbore parameters, `null` means no counterbore.
- screw head height.
- screw head diameter.
16. stiffener rib parameters, `null` means no rib.
- rib top width.
- rib bottom width.
- rib distance from top of boss.
- rib thickness.
README.zh-Hans.md
[English](./README.md) | [简体中文](#)
# EasyEDA API Skill
供 AI 编程工具(Claude Code、OpenCode、QwenCode 等所有支持 [Agent Skills](https://agentskills.io/) 标准的工具)使用的 EasyEDA Pro API 技能包(Skill)。
这个 SKILL 不仅支持 AI 在线调试嘉立创EDA,也支持辅助开发嘉立创EDA扩展。
在开发嘉立创EDA扩展时,AI 可以使用本 SKILL 提供的扩展开发相关文档、API 参考、类型信息、调用示例以及桥接调试能力,帮助完成接口查询、代码编写与联调验证。
如果用户准备自行分析或修改嘉立创EDA文档源码,而不是通过 API 操作,也可以使用本项目提供的文档源码格式说明。
- 📚 **结构化 API 文档** — 自动从参考文档生成分层索引,便于 AI 快速查阅
- 🧾 **文档源码格式规范** — 说明工程、原理图、PCB 文档源码格式,适合直接分析和修改源码的场景
- 🔌 **WebSocket Bridge** — Node.js 服务端,桥接 AI 和 EasyEDA 客户端
- 🤖 **SKILL.md** — 完整的技能指导文件
## 快速开始
### 1. 安装依赖
```bash
npm install
```
### 2. 构建 API 文档
```bash
npm run build:docs
```
这会从 `reference/` 目录读取原始 API 文档,生成结构化文档到 `docs/` 目录。
### 3. 启动 WebSocket Bridge 服务器
```bash
npm run server
```
服务器自动在端口范围 `49620-49629` 中选择可用端口启动,等待 EasyEDA 客户端连接。
### 4. EasyEDA 端连接
在嘉立创EDA中安装 `run-api-gateway.eext` 扩展,下载地址:
- https://jlc-ext.com/item/oshwhub/run-api-gateway
扩展加载后会自动连接到 Bridge 服务器(自动扫描端口范围,验证握手后连接)。
### 5. 使用 AI 编程工具
AI 编程工具(Claude Code、OpenCode、QwenCode 等)会自动读取 `SKILL.md` 获取技能指导,通过 HTTP API 向 EDA 发送代码:
```bash
# 检查 EDA 连接状态(端口自动发现,此处假设服务在 49620)
curl http://localhost:49620/health
# 执行 EDA 代码
curl -X POST http://localhost:49620/execute \
-H "Content-Type: application/json" \
-d '{"code": "return await eda.dmt_Project.getCurrentProjectInfo();"}'
```
## 一键打包
```bash
npm run pack
```
这会执行以下步骤:
1. 构建 API 文档(`docs/`)
2. 将 SKILL.md、文档、服务器打包到 `dist/easyeda-api/`
3. 生成 `dist/easyeda-api.zip` 用于上传
如果文档已构建好,可跳过构建步骤:
```bash
npm run pack:fast
```
### 发布到 ClawHub
```bash
npx clawhub@latest publish dist/easyeda-api/
```
或上传 zip 文件到 https://clawhub.ai/upload
## 架构
```
┌──────────────┐ HTTP/WS ┌────────────────┐ WebSocket ┌──────────┐
│ AI Agent │ ◄───────────► │ Bridge Server │ ◄───────────► │ EasyEDA │
│ (Skill Tool) │ Port Range │ (Node.js) │ Port Range │ (Client) │
└──────────────┘ 49620-49629 └────────────────┘ 49620-49629 └──────────┘
```
## 通信协议
| 消息类型 | 方向 | 说明 |
|----------|------|------|
| `execute` | AI → EDA | 执行 JS 代码 |
| `result` | EDA → AI | 返回执行结果 |
| `error` | EDA → AI | 返回执行错误 |
| `handshake` | Server → Client | 连接验证(含 `service: "easyeda-bridge"`) |
| `ping/pong` | 双向 | 心跳检测 |
## 目录结构
```
easyeda-api-skill/
SKILL.md # AgentSkills 标准技能定义
AGENTS.md # Agent 提示指南
package.json # 项目配置
reference/ # 原始 API 参考文档(gitignore)
docs/ # 构建后的结构化文档(gitignore)
format/ # 嘉立创EDA文档源码格式规范(project/schematic/pcb)
guide/ # API 开发指南(人工撰写)
user-guide/ # 用户指南(人工撰写)
server/index.mjs # WebSocket Bridge 服务器
scripts/
build-docs.mjs # 文档构建脚本
pack.mjs # 打包脚本
dist/ # 打包输出(gitignore)
easyeda-api/ # 可发布的 skill 目录
easyeda-api.zip # 用于 ClawHub 上传的 zip 文件
```
format/index.md
# EasyEDA File Format
## V2.2 File Format
V2.2 file format: [lceda-pro-file-format-v2.2_2022.12.15.zip](https://image.lceda.cn/files/lceda-pro-file-format-v2.2_2022.12.15.zip)
Hint: This is not the latest file format specification, but it contains most of the format details.
## V3 File Format
V3 uses a brand-new source format, completely different from previous formats.
Hint: EasyEDA 3.0 fully redesigned the project format, using the concept of logs for incremental storage of project changes; and switched from the array offset design style in 2.0 to a key-value style, making future format evolution easier, compatibility code development simpler, and readability improved.
V3 file format (example files included in the zip):
- [lceda-pro-file-format-v3_2025.10.21.zip](https://image.lceda.cn/files/lceda-pro-file-format-v3_2025.10.21.zip)
- [lceda-pro-file-format-v3_2025.10.21.md](https://image.lceda.cn/files/lceda-pro-file-format-v3_2025.10.21.md)
- [lceda-pro-file-format-v3_2025.10.21.pdf](https://image.lceda.cn/files/lceda-pro-file-format-v3_2025.10.21.pdf)
### Format Details Documents
- [Project Format](/en/format/project/index/)
- [Schematic Format](/en/format/schematic/index/)
- [PCB Format](/en/format/pcb/index/)
### Basic Document Format
#### Document Conventions
- All project data is stored in a log document. The first line of each change record must be the file header `DOCTYPE` to distinguish different document types. `DOCTYPE` exists as a `block-level element` in the project log.
- Each line consists of two valid JSON objects concatenated together. The first object is used by the eventual consistency framework for parsing, and the latter is the `atomic structural object`.
- Key names use camelCase, with the first letter of each word capitalized (except the first word), and no underscores or other separators between words.
- All primitives must carry a `unique ID` within the file.
- `Rotation angle` is positive in the counter-clockwise direction, and angles are always in degrees.
- Unless otherwise specified, all coordinates, lengths, and sizes use `0.01 inch` as the unit.
- All colors are expressed as `"#RRGGBB"`. To indicate no color (fully transparent), use `""`.
- All properties described as `whether XXXX` are encoded with `1` for yes and `0` for no.
- Parts not explicitly described in these conventions (such as escaping) follow [RFC 7195 The JavaScript Object Notation (JSON) Data Interchange Format](https://tools.ietf.org/html/rfc7159).
#### Type Categories
- **Common Data**: Includes basic information, creation information, modification information, etc.
- **Basic Information**: Includes metadata for project config, board, schematic, PCB, panel, symbol, footprint, device, etc.
- **BLOB True-Color Image**: True-color image data format.
- **Instance Attribute Override**: Instance attribute override format.
- **Variant**: Variant data format.
- **Component Grouping**: Component grouping data format.
#### Document Header
- All data must begin with a document header to distinguish different document types.
- When parsing line by line, encountering a document header means the following data belongs to that document until the next document header is encountered.
```json
{ "type": "DOCHEAD" }||{ "docType": "SCH_PAGE", "uuid": "UUID", "client": "clientID" }|
```
1. type: "DOCHEAD", document header identifier.
2. docType: document type.
3. uuid: document unique ID, unique within the project.
4. client: terminal identifier for eventual consistency.
###### docType Document Types
- Project config `PROJECT_CONFIG`
- Board `BOARD`
- Schematic `SCH`
- Schematic page `SCH_PAGE`
- PCB `PCB`
- Panel `PANEL`
- Symbol `SYMBOL`
- Footprint `FOOTPRINT`
- Device `DEVICE`
- True-color image `BLOB`
- Instance attributes `INSTANCE`
#### Data Format
```json
{ "type": "TYPE", "id": "UUID", "ticket": 1}||{["key": string]: any}|
```
The identifier `||` splits a record into inner and outer layers:
1. Outer layer data: used by the eventual consistency framework to ensure data consistency.
1. type: data type.
2. id: unique ID, must be unique within the specific type in the document.
3. ticket: logical clock, only used by the eventual consistency framework to ensure data uniqueness.
2. Inner layer data: primitive atomic data, a `key-value` object. Specific contents are detailed in the corresponding document for each type.
The reason for splitting into inner and outer layers is that in the eventual consistency framework, the specific primitive data does not need to be concerned; only the outer layer data is needed to ensure data uniqueness, reducing unnecessary JSON parsing and saving memory.
```json
{ "type": "META", "ticket": 1}||{"name": "name"}|
```
Some data can only retain one record within a document. The `type` field alone can indicate uniqueness, so the `id` field is omitted. The `id` field is only used to distinguish multiple records of the same type.
#### Eventual Consistency
- In Storage 3.0, adding, deleting, or modifying data adds a record to the log, so multiple records in the log may represent the same data.
- The eventual consistency framework decides which record to keep based on the `type`, `id`, and `ticket` fields.
ps: For more details, please refer to the eventual consistency design document. Here we only explain the use of relevant fields.
###### Two records with the same type and id
```json
{ "type": "TYPE", "id": "UUID", "ticket": 1}||{"data": 1}|
```
```json
{ "type": "TYPE", "id": "UUID", "ticket": 2}||{"data": 2}|
```
The eventual consistency framework compares the `ticket` field and keeps the record with the larger ticket. In the example above, the record with `data` 2 is kept.
###### Same type, same id, and same ticket
```json
{ "type": "DOCHEAD" }||{ "docType": "SCH_PAGE", "uuid": "UUID", "client": "1" }|
{ "type": "TYPE", "id": "UUID", "ticket": 1}||{"data": 1}|
```
```json
{ "type": "DOCHEAD" }||{ "docType": "SCH_PAGE", "uuid": "UUID", "client": "2" }|
{ "type": "TYPE", "id": "UUID", "ticket": 1}||{"data": 2}|
```
Then the `client` field in the document header is compared, and the record with the smaller client identifier is kept. In the example above, the record with `data` 1 is kept.
#### Deletion
##### Atomic Data Deletion
```json
{ "type": "TYPE", "id": "UUID", "ticket": 1}||""
```
Deleting data actually means setting the inner layer data to an empty string.
##### Document Deletion
```json
{ "type": "DELETE_DOC", "ticket": 1}||{"isDelete": true}|
```
1. type `DELETE_DOC` document deletion identifier.
2. isDelete whether deleted.
- Document deletion actually adds a deletion marker and does not directly delete document data from the log, to facilitate undoing document deletion and maintaining data consistency.
- All deleted data is retained in the log. If users want to remove deleted data records from the project, they should clone the project. Log snapshots will not clear related deletion records.
format/pcb/dimension.md
# DIMENSION Dimension Tool Set
```json
{ "type": "DIMENSION", "id":"UUID", "ticket": 1 }||
{
"partitionId":null,
"groupId":0,
"locked":1,
"zIndex":2.221,
"type":"RADIUS",
"layerId":3,
"unit":"mm",
"strokeWidth":0.5,
"precision":3,
"textFollow":1,
"coords": [100 200 300 400 400 400],
}|
["DIMENSION", "e101", 0, 1, 2.221, "RADIUS", 3, "mm", 0.5, 3, 1, [100 200 300 400 400 400]]
```
1. type dimension tool `DIMENSION`.
2. id primitive ID, unique within the document.
3. ticket logical clock.
4. partitionId partition ID it belongs to, null means no partition. Ignored for footprints.
5. groupId group ID: 0 no group, non-zero is the group flag, same flag means same group.
6. locked whether locked.
7. zIndex Z-axis height.
8. type dimension type: `RADIUS` radius, `LENGTH` length, `ANGLE` angle.
9. layerId layer.
10. unit unit: `mm`, `cm`, `inch`, `mil`.
11. strokeWidth line width.
12. precision precision.
13. textFollow whether text follows: `1` tool automatically decides text position, `0` always use the position of `ATTR`.
14. coords coordinate set X1 Y1 X2 Y2 X3 Y3 ... different dimension types define coordinates differently.
```json
["ATTR", "e102", 0, "e101", 1, 200, 150, "VALUE", "1234mm", 0, 1, "SimSun", 50, 10, 0, 0, 0, 2, 15, 1, 1]
```
`DIMENSION` needs to be accompanied by an attribute with Key `VALUE` to express the text part of the dimension tool. EDA should ignore unnecessary properties such as `whether to display Key` and `whether to display Value`.
### RADIUS Radius Tool
The first coordinate of the coordinate set is the endpoint touching the ARC, and the last coordinate is the default endpoint for displaying text, as shown below.

### LENGTH Length Tool
The coordinate set only needs four points, as shown below.

### ANGLE Angle Tool
The coordinate set needs 3 points, as shown below.

format/pcb/component.md
# Footprint System
PCB footprints use a Master/Instance model, describing footprints through override rules with minimal redundancy.
## COMPONENT Component Instance
Instances only contain attributes. Attributes with the same `Key` in the instance will override those in the `FOOTPRINT`.
```json
{ "type": "COMPONENT", "id":"UUID", "ticket": 1 }||
{
"partitionId":null,
"groupId":0,
"locked":1,
"zIndex":0.22,
"layerId":1,
"positionX":150,
"positionY":200,
"angle":45,
"attrs":{ "3D Model": "uuid", "3D Model Transform": "20,10,0,0,15,45,0,0,20" },
}|
```
1. type instance `COMPONENT`.
2. id primitive ID, unique within the document.
3. ticket logical clock.
4. partitionId partition ID it belongs to, null means no partition. Ignored for footprints.
5. groupId group ID: 0 no group, non-zero is the group flag, same flag means same group.
6. locked whether locked.
7. zIndex Z-axis height.
8. layerId layer (only top and bottom).
9. positionX position X.
10. positionY position Y.
11. angle rotation angle.
12. attrs custom attributes.
- Fixed `3D Model` is the uuid of the 3D model. This uuid represents a record with doctype = 16 in the components table.
- Fixed `3D Model Transform` is the 3D model transformation parameters.
```json
["ATTR", "e102", 0, "e8", 1, "Designator", "U1", 0, 1, "SimSun", 50, 10, 0, 0, 0, 1, 2, 15, 1, 1]
```
```json
["ATTR", "e103", 0, "e8", 1, "Footprint", "footprint-uuid", 0, 1, "SimSun", 50, 10, 0, 0, 0, 1, 2, 15, 1, 1]
```
```json
["ATTR", "e104", 0, "e8", 1, "Device", "device-uuid", 0, 1, "SimSun", 50, 10, 0, 0, 0, 1, 2, 15, 1, 1]
```
### Pad-Net Mapping `PAD_NET`
```json
{ "type": "PAD_NET", "id":"COMPONENT_UUID", "ticket": 1 }||
{
"padNum":"a1",
"padNet":"GND",
"padId":"e125",
}|
```
1. type pad-net mapping `PAD_NET`.
2. id parent component instance ID.
3. ticket logical clock.
4. padNum pad number.
5. padNet net name.
6. padId pad ID inside the footprint (optional).
### Reuse Block Information `REUSE_BLOCK`
```json
{ "type": "REUSE_BLOCK", "id":"COMPONENT_UUID", "ticket": 1 }||
{
"groupId":"$1e16",
"channelId":"$2e5_$4e3",
}|
```
1. type reuse block information `REUSE_BLOCK`.
2. id parent component instance ID.
3. groupId group ID.
4. channelId channel ID.
### 3D Model Transform Special Notes
```json
{ "type": "COMPONENT", "id":"UUID", "ticket": 1 }||
{
"partitionId":null,
"groupId":0,
"locked":1,
"zIndex":0.22,
"layerId":1,
"positionX":150,
"positionY":200,
"angle":45,
"attrs":{ "3D Model": "uuid", "3D Model Transform": "20,10,0,0,15,45,0,0,20" },
}|
```
In the device, `3D Model Transform` is fixed as the transformation parameters required for the 3D model to match the device when it is [on the top layer], at [coordinates 0,0], and [rotation angle 0].
The parameters are:
1. sizeX: X-axis size.
2. sizeY: Y-axis size.
3. sizeZ: Z-axis size. There is a compatibility handling here: if 0, height is automatically adapted.
4. rotZ: rotation angle around Z axis.
5. rotX: rotation angle around X axis.
6. rotY: rotation angle around Y axis.
7. offX: X-axis offset.
8. offY: Y-axis offset.
9. offZ: Z-axis offset.
The algorithm for generating the 3D model transformation matrix from the 3D model transform parameters is as follows:
```python
cx = X-axis midpoint of the 3D model
cy = Y-axis midpoint of the 3D model
bz = minimum Z value of the 3D model
wx = X-axis width of the 3D model
wy = Y-axis width of the 3D model
wz = Z-axis width of the 3D model
ORIGIN = translate(-cx, -cy, -bz)
SCALE = scale(sizeX / wx, sizeY / wy, sizeZ / wz)
ROT = rotateZXY(rotZ, rotX, rotY)
OFFSET = translate(offX, offY, offZ)
MATRIX = OFFSET X ROT X SCALE X ORIGIN
```
format/pcb/index.md
# PCB Format Document
This chapter details the format specification of the EasyEDA PCB file. PCB files mainly consist of the following parts:
- [Common Format](/en/format/pcb/common.md): document header, canvas, layers, physical layers, preferences, etc.
- [Partition Format](/en/format/pcb/partition.md): partition definitions.
- [Basic Primitives](/en/format/pcb/primitive.md): nets, primitive configurations, groups, silkscreen configurations, associations, attributes, etc.
- [Pads and Vias](/en/format/pcb/pad_via.md): pads and vias.
- [Shape Primitives](/en/format/pcb/shape.md): lines, arcs, polygon systems, polylines, fills, regions, copper pours, images, teardrops, etc.
- [Binary Objects](/en/format/pcb/obj.md): embedded objects.
- [3D Shell](/en/format/pcb/3d.md): shells, creases, entities, bosses.
- [Text System](/en/format/pcb/text.md): text.
- [Attributes](/en/format/pcb/attr.md): attributes.
- [Dimension Tools](/en/format/pcb/dimension.md): dimension annotations.
- [Footprint System](/en/format/pcb/component.md): component instances.
- [Design Rules](/en/format/pcb/rule.md): rule templates, rule definitions, rule selectors.
- [Panelization](/en/format/pcb/panel.md): panelization parameters.
format/pcb/pad_via.md
# Pads and Vias
## VIA Via
Vias are generally used to connect circuits between different layers.
For multi-layer boards, there are generally the following modes:
Through-hole: from `start layer` to `end layer`, through top and bottom.
Blind via: only one of `start layer` or `end layer` is top or bottom.
Buried via: neither `start layer` nor `end layer` is top or bottom.
```json
{ "type": "VIA", "id":"UUID", "ticket": 1 }||
{
"partitionId":null,
"groupId":0,
"locked":1,
"zIndex":3.223,
"netName":"GND",
"ruleName":"asdf",
"centerX":100,
"centerY":200,
"holeDiameter":5,
"viaDiameter":9,
"viaType":0,
"topSolderExpansion":null,
"bottomSolderExpansion":null,
"unusedInnerLayers":[17],
}|
```
1. type via `VIA`.
2. id primitive ID, unique within the document.
3. ticket logical clock.
4. partitionId partition ID it belongs to, null means no partition. Ignored for footprints.
5. groupId group ID: 0 no group, non-zero is the group flag, same flag means same group.
6. locked whether locked.
7. zIndex Z-axis height.
8. netName NET.
9. ruleName via layer type: design rule name, defines start and end layers of the via.
10. centerX coordinate X.
11. centerY coordinate Y.
12. holeDiameter hole diameter.
13. viaDiameter pad diameter.
14. viaType via type: 0 normal via, 1 stitching via.
15. topSolderExpansion top solder mask expansion: `null` means follow rule.
16. bottomSolderExpansion bottom solder mask expansion: `null` means follow rule.
17. unusedInnerLayers hidden pad layers (optional): array of layers where pads are hidden.
## PAD Pad
Pads are generally used for soldering components to the circuit board.
Pads either run through the entire board or only on the top or bottom layer, so there are only top, bottom, and multi-layer options.
```json
{ "type": "PAD", "id":"UUID", "ticket": 1 }||
{
"partitionId":null,
"groupId":0,
"locked":1,
"zIndex":6.234,
"netName":"GND",
"layerId":0,
"num":"1",
"centerX":100,
"centerY":200,
"padAngle":15,
"hole":["reference hole"],
"defaultPad":["reference pad"],
"specialPad":[[0, 1, ["reference pad"]]],
"padOffsetX":10,
"padOffsetY":-5,
"relativeAngle":30,
"plated":1,
"padType":null,
"topSolderExpansion":0.5,
"bottomSolderExpansion":0.4,
"topPasteExpansion":null,
"bottomPasteExpansion":0,
"connectMode":0,
"spokeSpace":10,
"spokeWidth":5,
"spokeAngle":45,
"unusedInnerLayers":[15, 17],
}|
```
1. type pad `PAD`.
2. id primitive ID, unique within the document.
3. ticket logical clock.
4. partitionId partition ID it belongs to, null means no partition. Ignored for footprints.
5. groupId group ID: 0 no group, non-zero is the group flag, same flag means same group.
6. locked whether locked.
7. zIndex Z-axis height.
8. netName net.
9. layerId layer (only top, bottom, multi-layer).
10. num pad number.
11. centerX pad origin X.
12. centerY pad origin Y.
13. padAngle pad rotation angle.
14. hole hole: reference hole, `null` means no hole.
15. defaultPad default pad: reference pad.
16. specialPad special pads (multiple groups, each group defined as follows).
1. start layer.
2. end layer.
3. reference pad.
17. padOffsetX hole offset X.
18. padOffsetY hole offset Y.
19. relativeAngle hole rotation relative to pad.
20. plated whether plated hole wall.
21. padType pad function: 0 normal pad, 1 test point, 2 fiducial.
22. topSolderExpansion top solder mask expansion: `null` means follow rule.
23. bottomSolderExpansion bottom solder mask expansion: `null` means follow rule.
24. topPasteExpansion top paste mask expansion: `null` means follow rule.
25. bottomPasteExpansion bottom paste mask expansion: `null` means follow rule.
26. connectMode thermal relief - connection mode: `null` means follow rule, other data same as design rules.
27. spokeSpace thermal relief - spoke spacing: `null` means follow rule, other data same as design rules.
28. spokeWidth thermal relief - spoke width: `null` means follow rule, other data same as design rules.
29. spokeAngle thermal relief - spoke angle: `null` means follow rule, other data same as design rules.
30. unusedInnerLayers hidden pad layers (optional): array of layers where pads are hidden.
### Hole
1. Slot hole
1. Slot hole `ROUND`
2. width
3. height
2. Square hole
1. Square hole `RECT`
2. width
3. height
### Pad
Hole rotation and pad rotation are independent.
1. Oblong pad
1. Oblong pad `ROUND`
2. width
3. height
2. Square pad
1. Square pad `RECT`
2. width
3. height
4. corner radius
3. Regular polygon pad
1. Regular polygon pad `NGON` (name from 3DSMAX)
2. diameter
3. number of sides (> 2)
4. Polygon pad
1. Polygon pad `POLY`
2. reference complex polygon, relative position to hole as origin
format/pcb/panel.md
# Panelization
```json
{ "type": "PANELIZE", "ticket": 1 }||
{
"on":1,
"row":2,
"column":3,
"rowSpacing":5.5,
"columnSpacing":6.1,
"onlyOutline":1,
}|
```
1. type panelization `PANELIZE`.
2. ticket logical clock.
3. on whether enabled.
4. row number of rows.
5. column number of columns.
6. rowSpacing row spacing.
7. columnSpacing column spacing.
8. onlyOutline whether to panelize outline only.
```json
{ "type": "PANELIZE_STAMP", "ticket": 1 }||
{
"direction":1,
"on":1,
"stampHoleGroupQuantity":3,
"stampHoleDiameter":8,
"stampHoleQuantityPerGroup":0,
"stampHoleSpacing":1,
}|
```
1. type stamp hole parameters: `PANELIZE_STAMP`.
2. ticket logical clock.
3. direction direction: `0` horizontal, `1` vertical.
4. on whether enabled (if not enabled, V-CUT is used).
5. stampHoleGroupQuantity number of stamp hole groups.
6. stampHoleDiameter stamp hole diameter.
7. stampHoleQuantityPerGroup number of stamp holes per group.
8. stampHoleSpacing stamp hole spacing.
```json
{ "type": "PANELIZE_SIDE", "ticket": 1 }||
{
"direction":0,
"on":1,
"sideHeight":5,
"positionHoleDiameter":3,
"markDiameter":2,
"markExpansion":1,
}|
```
1. type process edge parameters: `PANELIZE_SIDE`.
2. ticket logical clock.
3. direction direction: `0` horizontal, `1` vertical.
4. on whether enabled (if not enabled, process edge is not used).
5. sideHeight process edge height.
6. positionHoleDiameter positioning hole diameter (`0` means no positioning hole).
7. markDiameter Mark dot diameter (`0` means Mark dot disabled).
8. markExpansion Mark dot solder mask expansion.
format/pcb/rule.md
# Design Rule System
## Design Rule Template
There are two logical ways to understand the design rule template; the PCB can choose according to its needs:
1. As a base version for other design rules, other design rules are overrides of the template.
2. Mutually exclusive with other design rules; when a template exists, other design rules are only temporary and have no effect.
3. As an identifier of which template the rules originate from, without affecting the effectiveness of subsequent actual rules (current solution).
```json
{ "type": "RULE_TEMPLATE", "ticket": 1 }||{ "name": "JLCPCB Capability(High Frequency Board)"}|
```
1. type design rule template: `RULE_TEMPLATE`.
2. ticket logical clock.
3. name template name.
## Design Rule
```json
{ "type": "RULE", "id":"UUID", "ticket": 1 }||
{
"ruleType":"Safe Clearance",
"ruleName":"General",
"ruleState":1,
"ruleContext":{},
}|
```
1. type design rule: `RULE`.
2. ticket logical clock.
3. ruleType rule type: decided by EDA.
4. ruleName rule name.
5. ruleState rule state: 0 normal rule, 1 default rule, 2 disabled rule.
6. ruleContext rule content: decided by EDA.
Design rules of the same `rule type` must appear in the same order as the left tree in [Rule Manager].
## Rule Selector
```json
{ "type": "RULE_SELECTOR", "id":"UUID", "ticket": 1 }||
{
"ruleSelect":["NET", "GND"],
"ruleOrder":0,
"ruleKeyValue":{ "Safe Clearance": "General", "Other Clearance": "General" },
}|
```
1. type rule selector: `RULE_SELECTOR`.
2. ticket logical clock.
3. ruleSelect selector.
1. Net class: `["NET_CLASS", "High Speed"]`
2. Net: `["NET", "GND"]`
3. Layer: `["LAYER", 5]`
4. Region: `["REGION", "e10"]`
5. Footprint: `["FOOTPRINT", "0805"]`
6. Component: `["COMPONENT", "e100"]`
7. Copper pour: `["POUR", "e100"]`
8. Differential pair: `["DIFF_PAIR", "asdf"]`
9. Equal-length group: `["EQ_LEN_GRP", "fdsa"]`
10. Future logic support: `["AND", ["NET", "GND"], ["LAYER", 5]]`
4. ruleOrder priority: the smaller the value, the higher the priority. Recommended:
- `0` component rule
- `1` footprint rule
- `2` region rule
- `3` net-net rule
- `4` net rule
- `5` layer rule
5. ruleKeyValue rules. Key is the rule class, Value is the rule name. Only one rule can be selected under each rule class.
format/pcb/partition.md
# Partition Format
PCB introduces partition design. Partition design needs to mark partition information for many elements, so the following format is used.
## PARTITION Partition Primitive
```json
{ "type": "LAYER_PHYS","id": "UUID", "ticket": 1 }||
{
"name":"Partition 1",
"fileUuid":"SUB-PCB-UUID",
"path":"complex polygon",
}|
```
1. type partition: `PARTITION`.
2. id primitive ID.
3. ticket logical clock.
4. name partition name.
5. fileUuid child drawing UUID.
6. path partition shape.
All primitives belonging to a partition must carry the corresponding partition primitive ID.
```json
{ "type": "VIA", "id":"viaUuid", "ticket": 1 }||
{
"partitionId":"partitionId",// carries this id to indicate belonging to the corresponding partition
"groupId":0,
"locked":1,
"zIndex":3.223,
"netName":"GND",
"ruleName":"asdf",
"centerX":100,
"centerY":200,
"holeDiameter":5,
"viaDiameter":9,
"viaType":0,
"topSolderExpansion":null,
"bottomSolderExpansion":null,
"unusedInnerLayers":[17],
}|
```
format/pcb/primitive.md
# Basic Primitive Format
## NET Net Information Configuration
Net information is different from AD's design.
- AD requires it here.
- This format only fills it in when there are special `net types` and `net colors`.
The design difference stems from whether there is a dedicated net settings interface listing all nets for configuration.
```json
{ "type": "NET","id": "A", "ticket": 1 }||
{
"netType":"High Speed",
"specialColor":"#666666",
"hideRetLine":0,
"differentialName":"AASDF",
"isPositiveNet":1,
"equalLengthGroupName":"ABC",
}|
```
1. type net configuration `NET`.
2. id unique identifier, net name.
3. ticket logical clock.
4. netType net type: `null` means no type.
5. specialColor special color: `null` means no special color.
6. hideRetLine whether to hide airwires.
7. differentialName differential pair name: `null` means not a differential pair.
8. isPositiveNet whether positive net of differential pair.
9. equalLengthGroupName equal-length group name: `null` means not in an length-matching group.
```json
{ "type": "NET","id": "B", "ticket": 1 }||
{
"netType":null,
"specialColor":"#666666",
"hideRetLine":1,
"differentialName":"AASDF",
"isPositiveNet":0,
"equalLengthGroupName":"ABC",
}|
```
```json
{ "type": "NET","id": "C", "ticket": 1 }||
{
"netType":"High Speed",
"specialColor":null,
"hideRetLine":1,
"differentialName":null,
"isPositiveNet":0,
"equalLengthGroupName":null,
}|
```
## PRIMITIVE Primitive Configuration
```json
{ "type": "PRIMITIVE","id": "VIA", "ticket": 1 }||
{
"display":1,
"pick":0,
}|
```
1. type primitive configuration `PRIMITIVE`.
2. id unique identifier, primitive name.
3. ticket logical clock.
4. display whether displayed.
5. pick whether pickable.
```json
{ "type": "PRIMITIVE","id": "PAD", "ticket": 1 }||
{
"display":0,
"pick":1,
}|
```
## GROUP Group Configuration
Through group configuration, each group is given a name. If there is no name, EDA decides how to display the default group name.
```json
{ "type": "GROUP","id": "2", "ticket": 1 }||
{
"groupName":"ABCD",
}|
```
1. type group configuration `GROUP`.
2. id group number.
3. ticket logical clock.
4. groupName name.
```json
{ "type": "GROUP","id": "5", "ticket": 1 }||
{
"groupName":"Chinese Name",
}|
```
## CONNECT Primitive Association
Primitive association is used to express the internal combination logic of primitives, such as:
- Teardrops and their connections to `LINE`, `ARC`, `PAD`, `VIA`.
- Pads and their related pin 3D outline `FILL`.
- `CREASE` and `BOSS` / `SHELL_ENTITY` connections in 3D shells.
- PCB overrides for primitives inside footprints.
Only one-to-many relationships are supported.
```json
{ "type": "CONNECT","id": "e3", "ticket": 1 }||{ "relatedIds":["e15", "e18", "e100"] }|
```
1. type primitive association `CONNECT`.
2. id main primitive ID.
3. ticket logical clock.
4. relatedIds associated primitive IDs.
Many-to-many relationships can be expressed with multiple records; there is no corresponding scenario at present.
```json
{ "type": "CONNECT","id": "e4", "ticket": 1 }||{ "relatedIds":["e5", "e6"] }|
```
```json
{ "type": "CONNECT","id": "e5", "ticket": 1 }||{ "relatedIds":["e4", "e6"] }|
```
```json
{ "type": "CONNECT","id": "e6", "ticket": 1 }||{ "relatedIds":["e4", "e5"] }|
```
For PCB overrides of primitives inside footprints, use the form `/^[a-z]+\d+[a-z]+\d+$/i` to combine footprint and inner primitive IDs to reference, as follows:
```json
["DOCTYPE", "PCB", "1.0"]
["COMPONENT", "e13", 5, 1, ...]
["VIA", "e13e20", 0, "GND", "asdf", ....]
["PAD", "e13e25", 1, "GND", 0, "1", ....]
["CONNECT", "e13", ["e13e20", "e13e25"]]
```
Footprint content is as follows:
```json
["DOCTYPE", "FOOTPRINT", "1.0"]
["VIA", "e20", 0, "GND", "sss", ....]
["PAD", "e25", 1, "GND", 0, "3", ....]
```
## PROP Additional Primitive Properties
Some primitive properties are not required and are relatively generic, so `PROP` is used to assist in describing them.
```json
{ "type": "PROP", "id":"UUID", "ticket": 1 }||{ "color":"#22ee44" }|
```
1. type additional primitive properties: PROP.
2. id ID of the primitive being attached, two encoding forms:
1. Normal ID: form `/^[a-z]+\d+$/i`, e.g. `e1`, `e123`.
2. Footprint instance ID: form `/^[a-z]+\d+[a-z]+\d+$/i`, used for silkscreen in footprints, e.g. `e1e5`, `e12e22`.
3. color special color.
```json
{ "type": "PROP", "id":"e7e25", "ticket": 1 }||{ "color":"#22ee44" }|
```
To override primitives inside a footprint, use this composite ID form.
## EQLEN_GRP
```json
{ "type": "EQLEN_GRP", "id":"UUID", "ticket": 1 }||
{
"name":"equal length pad group 2",
"sort":1.97,
"pads":
[
["U1:1", "U2:3"],
["U1:2", "U1:a"]
],
}|
```
1. type equal-length group: `EQLEN_GRP`.
2. id unique ID.
3. ticket logical clock.
4. name equal-length group name, unique within the project.
5. sort sort order.
6. pads array identifying pads by `designator:pad number`.
format/pcb/text.md
# Text System
## STRING Text
When `STRING` is on a signal layer, from the DRC perspective it is:
1. Net-less.
2. A BBox with `position` at 0,0, `rotation angle` 0, and `whether mirrored` 0.
3. A rectangular area after applying `position`, `rotation angle`, and `whether mirrored` transformations.
```json
{ "type": "STRING", "id":"UUID", "ticket": 1 }||
{
"partitionId":null,
"groupId":0,
"locked":1,
"zIndex":0.2693,
"layerId":1,
"positionX":300,
"positionY":600,
"text":"any text",
"fontFamily":"SimSun",
"fontSize":50,
"strokeWidth":10,
"bold":0,
"italic":0,
"origin":5,
"angle":15,
"reverse":1,
"reverseExpansion":0,
"mirror":1,
"width":100,
"height":200,
"path":["complex polygon"],
}|
["STRING", "e100", 0, 1, 0.2693, 1, 300, 600, "any text", "SimSun", 50, 10, 0, 0, 5, 15, 1, 0, 1]
```
1. type text `STRING`.
2. id primitive ID, unique within the document.
3. ticket logical clock.
4. partitionId partition ID it belongs to, null means no partition. Ignored for footprints.
5. groupId group ID: 0 no group, non-zero is the group flag, same flag means same group.
6. locked whether locked.
7. zIndex Z-axis height.
8. layerId layer.
9. positionX position X.
10. positionY position Y.
11. text content.
12. fontFamily font name.
13. fontSize font size.
14. strokeWidth stroke width.
15. bold whether bold.
16. italic whether italic.
17. origin alignment mode: `0` top-left, `1` top-center, `2` top-right, `3` middle-left, `4` middle-center, `5` middle-right, `6` bottom-left, `7` bottom-center, `8` bottom-right.
18. angle rotation angle.
19. reverse whether reverse expansion.
20. expansion reverse expansion size: size of the reverse expansion area, supports negative numbers.
21. mirror whether mirrored. Generally, when text appears on the bottom layer, this should also be adjusted to `1`.
22. width height, `null` if none.
23. height width, `null` if none.
24. path complex polygon array, `null` if none.
format/project/common.md
# Common Data
Each document carries basic information, creation information, and modification information, which are maintained by the project manager.
### Basic Information
```json
{ "type": "META", "ticket": 1 }||data
```
1. type "META" basic information.
2. data specific data, different for each document.
### Creation Information
Same for every document.
```json
{ "type": "META_CREATE", "ticket": 1 }||
{
"creator": { "uuid":"UUID", "nickname":"nickname", "username":"username", },
"createTime": 1725593026474,
}|
```
1. type "META_CREATE" creation information.
2. creator creator.
3. createTime creation time.
### Modification Information
```json
{ "type": "META_MODIFY", "ticket": 1 }||
{
"modifier": { "uuid":"UUID", "nickname":"nickname", "username":"username", },
"createTime": 1725593026474,
}|
```
1. type "META_MODIFY" modification information.
2. modifier modifier.
3. updateTime update time.
format/project/group.md
# Component Grouping
## Document Header
```json
{ "type": "DOCHEAD" }||{ "docType": "COMPONENT_GROUP", "uuid": "UUID", "client": "clientID" }|
```
1. type: `DOCHEAD`, document header identifier.
2. docType: `COMPONENT_GROUP` component grouping.
3. uuid: unique identifier, random id.
4. client: terminal identifier for eventual consistency.
### META Basic Information
```json
{ "type": "META", "ticket": 1 }||
{
/** Name */
"title": string,
/** Parent component group uuid of the child component group */
"parent": string,
/** Component groups belonging directly to a variant do not participate in the component group tree */
"belong": string,
/** Sort order in the component group tree */
"zIndex": number,
/** Schematic */
"schematicId": string,
}|
```
### GROUP_INDEX Sorting of Component Groups in Variants
```json
{ "type": "GROUP_INDEX", "ticket": 1, "id": "variantId" }||
{
"zIndex": 1,
}|
```
1. type: `GROUP_INDEX`
2. ticket: logical clock.
3. id: variant uuid.
4. zIndex: sort order within the variant.
### GROUP_DATA Attribute Data
```json
{ "type": "GROUP_DATA", "id": "e176@uuid", "ticket": 1 }||data
```
1. type `GROUP_DATA` attribute data.
2. id combined id, separated by `@`:
1. The first is the primitive ID.
2. The second is the instance page ID.
3. data attribute override, data signature is `{ [key: string]: string }| `
```json
{ "type": "GROUP_DATA", "id": "e176@uuid1", "ticket": 1 }||{ "Designator": "U15", "ASDF": "1234" }|
{ "type": "GROUP_DATA", "id": "e177@uuid1", "ticket": 2 }||{ "NUMBER": 2 }|
{ "type": "GROUP_DATA", "id": "e176@uuid2", "ticket": 3 }||{ "Author": "abc" }|
```
format/project/blob.md
# BLOB True-Color Image
```json
{ "type": "META", "id": "BLOB-HASH-ID", "ticket": 1 }||{ "filename": "dadas", "data": "data:image/png;base64,asdfasdfwer" }|
```
1. filename file name.
2. data reserved metadata; binary data uses a specification similar to `Data URLs`, but with differences.
1. General format, fully compatible with `Data URLs`: `data:[<mediatype>][;base64],<data>`
- e.g. `data:image/png;base64,asdfasdfwer`
- e.g. `data:text/html,<html></html>`
- In general, this format should be used whenever possible, so it can be loaded directly with Web APIs without algorithm conversion.
2. Extended format, extending functionality by adding encodings such as gzip/deflate: `data:<mediatype>[pipeline],<data>`
- e.g. `data:text/html;gzip;base64,asdfasdf`
1. First base64-decode `asdfasdf`.
2. Then decompress with gzip.
3. Finally load as `text/html`.
- e.g. `data:text/css;deflate;aes128;base64,aaaaaaa`
1. First base64-decode `aaaaaaa`.
2. Then decrypt with aes128 (specific encryption/decryption logic to be determined).
3. Then decompress with deflate.
4. Finally load as `text/css`.
```json
{ "type": "META", "id": "ID", "ticket": 1 }||{ "filename": "dadas", "data": "data:application/vnd.ms-excel;base64,xxsasdfawerwerqwer" }|
```
format/pcb/shape.md
# Shape Primitives
## LINE Line
```json
{ "type": "LINE", "id":"UUID", "ticket": 1 }||
{
"partitionId":null,
"groupId":0,
"locked":1,
"zIndex":9.223,
"netName":"GND",
"layerId":1,
"startX":100,
"startY":200,
"endX":400,
"endY":300,
"width":0.7,
}|
```
1. type line `LINE`.
2. id primitive ID, unique within the document.
3. ticket logical clock.
4. partitionId partition ID it belongs to, null means no partition. Ignored for footprints.
5. groupId group ID: 0 no group, non-zero is the group flag, same flag means same group.
6. locked whether locked.
7. zIndex Z-axis height.
8. netName net.
9. layerId layer.
10. startX start X.
11. startY start Y.
12. endX end X.
13. endY end Y.
14. width line width.
## ARC/CARC Arc Line
The arc borrows Eagle's mathematical model, described based on `start` and `end`.
```json
{ "type": "ARC", "id":"UUID", "ticket": 1 }||
{
"partitionId":null,
"groupId":0,
"locked":1,
"zIndex":2.866,
"netName":"GND",
"layerId":1,
"startX":100,
"startY":200,
"endX":300,
"endY":400,
"angle":-170,
"width":10,
}|
```
1. type arc line.
- `ARC` two-point interaction mode.
- `CARC` center-arc interaction mode.
2. id primitive ID, unique within the document.
3. ticket logical clock.
4. partitionId partition ID it belongs to, null means no partition. Ignored for footprints.
5. groupId group ID: 0 no group, non-zero is the group flag, same flag means same group.
6. locked whether locked.
7. zIndex Z-axis height.
8. netName net.
9. layerId layer.
10. startX start X.
11. startY start Y.
12. endX end X.
13. endY end Y.
14. angle arc angle, positive counter-clockwise, negative clockwise.
15. width line width.
## Polygon System
SVG's path is an excellent abstraction for polygons.
However, because relative position and other features are not needed in PCB, and a more convenient parsing method can be designed conditionally, a polygon expression similar to SVG path was created.
Within the polygon system, `POLY`, `REGION`, and `POUR` support mutual conversion.
### Single Polygon Definition
A single polygon is a region described by an uninterrupted line whose start and end coincide. If start and end do not coincide, they are automatically closed.
```json
[300, 200, "L", 400, 200, "ARC", 400, 220, 15, "C", 200, 500, 400, 300, 100, 100]
```
```json
["R", 100, 200, 300, 300, 0]
```
```json
["CIRCLE", 100, 200, 5, 1]
```
#### L Line Mode
`X Y L X Y X Y ...` mode is line mode. All coordinates are connected by straight lines.
#### ARC/CARC Arc Mode
`startX startY ARC angle endX endY` mode is arc mode.
- startX/startY start coordinates.
- angle: arc angle, positive counter-clockwise, negative clockwise.
- endX/endY end coordinates.
`startX startY CARC angle endX endY` center-arc interaction mode.
#### C Cubic Bezier Mode
`X1 Y1 C X2 Y2 X3 Y3 X4 Y4 ...` mode is cubic Bezier mode. All coordinates are control points.
#### R Rectangle Mode
`R X Y width height rot isCCW round` rectangle mode is independent from other modes.
- X/Y: top-left coordinate.
- width: width.
- height: height.
- rot: rotation angle.
- isCCW: whether counter-clockwise.
- round: corner radius.
#### CIRCLE Circle Mode
`CIRCLE cx cy r isCCW` circle mode is independent from other modes.
- cx/cy: center point coordinates.
- r: radius.
- isCCW: whether counter-clockwise.
### Complex Polygon Definition
```json
[[single polygon 1: outer frame], [single polygon 2: inner hole]]
```
A complex polygon can contain multiple single polygons. The first polygon is clockwise and represents the outer frame; all subsequent polygons are counter-clockwise and represent inner holes.
## POLY Polyline
The polyline is similar to `LINE` and `ARC`, but it preserves the concept of a continuous single line drawn at one time, and can be converted with `REGION`, `FILL`, and `POUR`.
```json
{ "type": "POLY", "id":"UUID", "ticket": 1 }||
{
"partitionId":null,
"groupId":0,
"locked":1,
"zIndex":6.417,
"netName":"GND",
"layerId":1,
"width":0.5,
"path":["single polygon"],
}|
```
1. type polyline `POLY`.
2. id primitive ID, unique within the document.
3. ticket logical clock.
4. partitionId partition ID it belongs to, null means no partition. Ignored for footprints.
5. groupId group ID: 0 no group, non-zero is the group flag, same flag means same group.
6. locked whether locked.
7. zIndex Z-axis height.
8. netName net.
9. layerId layer.
10. width line width.
11. path see single polygon.
## FILL Fill
```json
{ "type": "FILL", "id":"UUID", "ticket": 1 }||
{
"partitionId":null,
"groupId":0,
"locked":1,
"zIndex": 0.794,
"netName":"GND",
"layerId":3,
"width":10,
"fillStyle":0,
"path":["complex polygon"],
}|
```
1. type fill `FILL`.
2. id primitive ID, unique within the document.
3. ticket logical clock.
4. partitionId partition ID it belongs to, null means no partition. Ignored for footprints.
5. groupId group ID: 0 no group, non-zero is the group flag, same flag means same group.
6. locked whether locked.
7. zIndex Z-axis height.
8. netName net.
9. layerId layer.
10. width line width.
11. fillStyle fill style: 0 solid fill, 1 grid fill, 2 internal plane fill.
12. path see complex polygon chapter.
1. For a polygon drawn in one go, there is only one single polygon here.
2. For polygons drawn in combination mode, there are multiple single polygons here.
## REGION Region
Keepout regions are an important future feature. In addition to assisting manual design, they can also assist automatic placement and routing by providing automation tools with constraint information on area ranges in addition to design rules.
```json
{ "type": "REGION", "id":"UUID", "ticket": 1 }||
{
"partitionId":null,
"groupId":0,
"locked":1,
"zIndex":0.901,
"layerId":3,
"width":1,
"prohibitType":[1, 2, 5],
"path":["complex polygon"],
"name":"aa constraint",
}|
```
1. type region `REGION`.
2. id primitive ID, unique within the document.
3. ticket logical clock.
4. partitionId partition ID it belongs to, null means no partition. Ignored for footprints.
5. groupId group ID: 0 no group, non-zero is the group flag, same flag means same group.
6. locked whether locked.
7. zIndex Z-axis height.
8. layerId layer.
9. width line width.
10. prohibitType prohibit types, multiple can exist simultaneously.
1. \*prohibit routing and placing fill regions (deprecated, but keep compatible when parsing)
2. prohibit components
3. prohibit vias
4. \*prohibit copper pours and internal planes (deprecated, but keep compatible when parsing)
5. prohibit routing
6. prohibit placing fill regions
7. prohibit copper pours
8. prohibit internal planes
11. path see complex polygon chapter.
1. For a polygon drawn in one go, there is only one single polygon here.
2. For polygons drawn in combination mode, there are multiple single polygons here.
12. name name (optional).
## POUR Copper Pour Border
A substantial difference from previous copper pours is that complex polygons are supported, meaning copper pour regions can contain holes. In theory, polygons converted from text paths can be used as copper pour regions.
Copper pours are filled in the order they appear in the format.
```json
{ "type": "POUR", "id":"UUID", "ticket": 1 }||
{
"partitionId":null,
"groupId":0,
"locked":1,
"zIndex":0.779,
"netName":"GND",
"layerId":1,
"width":1,
"name":"TOPGND",
"order":4,
"path":["complex polygon"],
"pourType":["pour type"],
"keepIsland":1,
}|
["POUR", "e100", 5, 1, 0.779, "GND", 1, 1, "TOPGND", 4, complex polygon, [pour type], 1]
```
1. type copper pour `POUR`.
2. id primitive ID, unique within the document.
3. ticket logical clock.
4. partitionId partition ID it belongs to, null means no partition. Ignored for footprints.
5. groupId group ID: 0 no group, non-zero is the group flag, same flag means same group.
6. locked whether locked.
7. zIndex Z-axis height.
8. netName net.
9. layerId layer.
10. width line width.
11. name copper pour name.
12. order copper pour priority.
13. path see complex polygon chapter.
14. pourType see pour types.
15. keepIsland whether to keep islands.
#### Pour Types
##### SOLID Solid Fill
```json
["SOLID", 2]
```
1. solid fill `SOLID`.
2. minimum copper pour neck width (production optimization; 0 means no production optimization).
```json
["POUR", "e100", "GND", 1, "BOTGND", 2, complex polygon, ["SOLID", 2], 1, 0]
```
```json
["POUR", "e100", "GND", 1, "BOTGND", 2, complex polygon, ["SOLID", 0], 1, 0]
```
##### LINE Line Fill
```json
["LINE", 0, 0, 10, 20]
```
1. line fill `LINE`.
2. fill mode: `0` grid, `1` horizontal, `2` vertical.
3. rotation angle.
4. line width.
5. line spacing.
```json
["POUR", "e100", "GND", 1, "", 9, complex polygon, ["LINE", 0, 0, 10, 20], 0.6, 1, 0, 0]
```
## POURED Copper Pour Result
```json
{ "type": "POURED", "id":"UUID", "ticket": 1 }||
{
"partitionId":null,
"targetId":"e100",
"strokeWidth":0,
"fill":1,
"path":["complex polygon"],
}|
```
1. type copper pour result `POURED`.
2. id primitive ID.
3. ticket logical clock.
4. partitionId partition ID it belongs to, null means no partition. Ignored for footprints.
5. targetId ID of the parent copper pour border `POUR`.
6. strokeWidth stroke width: 0 means no stroke.
7. fill whether filled.
8. path path, complex polygon.
## IMAGE Image
`IMAGE` is very similar to `REGION`, but in operation, `IMAGE` has no control points and cannot freely change its shape, only overall scaling, rotation, flipping, and translation.
When `IMAGE` is on a signal layer, from the DRC perspective it is a net-less rectangular area defined by `start`, `end`, `rotation angle`, and `whether mirrored`.
```json
{ "type": "IMAGE", "id":"UUID", "ticket": 1 }||
{
"partitionId":null,
"groupId":0,
"locked":1,
"zIndex":5.5464,
"layerId":31,
"startX":200,
"startY":200,
"width":400,
"height":400,
"angle":45,
"mirror":1,
"path":["complex polygon"],
}|
```
1. type image `IMAGE`.
2. id primitive ID, unique within the document.
3. ticket logical clock.
4. partitionId partition ID it belongs to, null means no partition. Ignored for footprints.
5. groupId group ID: 0 no group, non-zero is the group flag, same flag means same group.
6. locked whether locked.
7. zIndex Z-axis height.
8. layerId layer.
9. startX top-left X.
10. startY top-left Y.
11. width width.
12. height height.
13. angle rotation angle, around `start` point.
14. mirror whether the original image is horizontally mirrored. Mirroring is performed around the center of the original image's BBox.
15. path multiple complex polygons, see complex polygon chapter. Raw data is stored here; no adjustment is needed throughout the lifecycle.
## TEARDROP Teardrop
Teardrops cannot be selected or directly operated. When any associated primitive changes, EDA should automatically make them disappear.
```json
{ "type": "TEARDROP", "id":"UUID", "ticket": 1 }||
{
"partitionId":null,
"netName":"GND",
"layerId":3,
"path":"simple polygon",
"groupId":0,
}|
```
1. type teardrop `TEARDROP`.
2. id ID.
3. ticket logical clock.
4. partitionId partition ID it belongs to, null means no partition. Ignored for footprints.
5. netName net.
6. layerId layer.
7. path simple polygon.
8. groupId group ID: 0 no group, non-zero is the group flag, same flag means same group.
## FPC_FILL FPC Reinforcement Fill
```json
{ "type": "FPC_FILL", "id":"UUID", "ticket": 1 }||
{
"partitionId":null,
"groupId":0,
"locked":1,
"zIndex":7.7845,
"layerId":3,
"material":"3M468",
"thickness":7.874,
"path":"complex polygon",
}|
```
1. type fill `FPC_FILL`.
2. id primitive ID, unique within the document.
3. ticket logical clock.
4. partitionId partition ID it belongs to, null means no partition. Ignored for footprints.
5. groupId group ID: 0 no group, non-zero is the group flag, same flag means same group.
6. locked whether locked.
7. zIndex Z-axis height.
8. layerId layer.
9. material material.
- PI
- STEEL
- FR4
- 3M468
- 3M9077
- EMI_Shielding_Film
10. thickness thickness (note the unit is the same as other primitives).
11. path see complex polygon chapter.
format/project/index.md
# Project Log Format
This document only describes data that belongs to the project but not to the canvas. For specific canvas data, please refer to the separate documents.
## Contents
- [Common Data](/en/format/project/common.md) - Includes basic information, creation information, modification information, etc.
- [Basic Information](/en/format/project/meta.md) - Includes metadata for project config, board, schematic, PCB, panel, symbol, footprint, device, etc.
- [BLOB True-Color Image](/en/format/project/blob.md) - True-color image data format.
- [Instance Attribute Override](/en/format/project/instance.md) - Instance attribute override format.
- [Variant](/en/format/project/variant.md) - Variant data format.
- [Component Grouping](/en/format/project/group.md) - Component grouping data format.
format/project/meta.md
# Basic Information
### Project Config
Stores project configuration data, previously kept in the backend project details.
```json
{ "type": "META", "ticket": 1 }||{ "name": "name", "default_sheet": "default_sheet_uuid"}|
```
1. name project name.
2. default_sheet default sheet of the project.
### Board
```json
{ "type": "META", "ticket": 1 }||{ "title": "title", "sort": 1}|
```
1. title board name.
2. sort sort weight.
### Schematic
```json
{ "type": "META", "ticket": 1 }||{ "name": "name", "board":"", "source": "", "version": ""}|
```
1. name name.
2. board uuid of the board it belongs to, empty if none.
3. source source document uuid.
4. version version, update time of the source document.
### Schematic Page
```json
{ "type": "META", "ticket": 1 }||
{
"name": "Page Name",
"schematic": "SID",
"description": "description",
"sort": 0.5,
"source": "",
"version": "",
}|
```
1. name name.
2. schematic uuid of the schematic it belongs to.
3. description description.
4. sort sort weight.
5. source source document uuid.
6. version version, update time of the source document.
### PCB
```json
{ "type": "META", "ticket": 1 }||
{
"name": "PCB Name",
"board": "boardId",
"description": "description",
"parentId":"",
"sort": 0.5,
"source": "",
"version": "",
}|
```
1. name name.
2. board uuid of the board it belongs to, empty if none.
3. description description.
4. parentId parent PCB UUID, empty if none.
5. sort sort weight.
6. source source document uuid.
7. version version, update time of the source document.
Child PCB
```json
{ "type": "META", "ticket": 1 }||
{
"name": "Child PCB Name",
"board": "",
"description": "description",
"parentId":"UUID",
"sort": 0.2,
"source": "",
"version": "",
}|
```
### Panel
```json
{ "type": "META", "ticket": 1 }||
{
"name": "Panel Name",
"description": "description",
"sort": 0.5,
}|
```
1. name name.
2. description description.
3. sort sort weight.
### Symbol
```json
{ "type": "META", "ticket": 1 }||
{
"name": "Name",
"description": "description",
"type": 2,
"tags": "tag1",
"source": "",
"version": "",
}|
```
1. name name.
2. description description.
3. type symbol type.
4. tags classification tags.
5. source source document uuid.
6. version version, update time of the source document.
### Footprint
```json
{ "type": "META", "ticket": 1 }||
{
"name": "Name",
"description": "description",
"type": 4,
"tags": "tag1",
"source": "",
"version": "",
"pcb": "",
}|
```
1. name name.
2. description description.
3. type footprint type.
4. tags classification tags.
5. source source document uuid.
6. version version, update time of the source document.
7. pcb uuid of the pcb it belongs to, empty by default. Only special footprints have this field.
Special Footprint
```json
{ "type": "META", "ticket": 1 }||
{
"name": "Name",
"description": "description",
"type": 4,
"tags": "tag1",
"source": "",
"version": "",
"pcb": "pcbUuid",
}|
```
### Device
```json
{ "type": "META", "ticket": 1 }||
{
"name": "Name",
"description": "description",
"type": 4,
"tags": "tag1",
"source": "",
"version": "",
"attributes": {},
"images": "",
}|
```
1. name name.
2. description description.
3. tags classification tags.
4. source source document uuid.
5. version version, update time of the source document.
6. attributes device attributes Key-Value.
7. images image links.
format/project/variant.md
# Variant
## Document Header
```json
{ "type": "DOCHEAD" }||{ "docType": "VARIANT", "uuid": "UUID", "client": "clientID" }|
```
1. type: `DOCHEAD`, document header identifier.
2. docType: `VARIANT` variant data.
3. uuid: unique identifier, random id.
4. client: terminal identifier for eventual consistency.
## META Basic Information
```json
{ "type": "META", "ticket": 1 }||
{
/** Name */
"title": string,
/** Description */
"description": string,
/** Schematic */
"schematicId": string,
/** Sort order */
"zIndex": number,
/** Whether there are ungrouped items */
"notGrouped": boolean,
}|
```
format/project/instance.md
# Instance Attribute Override
## Document Header
```json
{ "type": "DOCHEAD" }||{ "docType": "INSTANCE", "uuid": "SCH-UNIQUE-ID_$5|e100_$1|e55_$6|e15_$8", "client": "clientID" }|
```
1. type: `DOCHEAD`, document header identifier.
2. docType: `INSTANCE` instance attribute override.
3. uuid: hierarchical ID, unique within the project, IDs separated by `_`.
1. The first is the top-level schematic ID.
2. The last goes only to the sheet ID.
3. All in between use the numbering combination syntax to locate `Block Symbol`, e.g. `$1|e2`, where `$1` is the sheet ID and `e2` is the `Block Symbol` ID.
4. client: terminal identifier for eventual consistency.
## Attribute Override
```json
{ "type": "INSTANCE_ATTR", "id": "e176", "ticket": 1 }||data
```
1. type `INSTANCE_ATTR` instance attribute override.
2. id primitive ID.
3. data attribute override, data signature is `{ [parentId: string]: { [key: string]: string }| }|`
```json
{ "type": "DOCHEAD" }||{ "docType": "INSTANCE", "uuid": "SCH-UNIQUE-ID_$5|e100_$1|e55_$6|e15_$8", "client": "clientID" }|
{ "type": "INSTANCE_ATTR", "id": "e176", "ticket": 1 }||{ "Designator": "U15", "ASDF": "1234" }|
{ "type": "INSTANCE_ATTR", "id": "e176e5", "ticket": 1 }||{ "NUMBER": 2 }|
{ "type": "INSTANCE_ATTR", "id": "e178", "ticket": 1 }||{ "Author": "abc" }|
```
format/schematic/common.md
# Common Format
This chapter details the format specification of the EasyEDA schematic file. Schematic files mainly consist of the following parts:
- **Common Configuration**: Document header and canvas configuration.
- **Structural Elements**: PART sub-libraries and GROUP combinations.
- **Attributes**: Primitive attribute definitions.
- **Wires**: Wires, buses, and bus entries.
- **Text**: Text elements.
- **Shapes**: Rectangles, polygons, circles, arcs, Bezier curves, ellipses.
- **Pins**: Pin definitions.
- **Components**: Schematic component instances.
- **Objects**: Binary objects (images, etc.).
- **Tables**: Tables and cells.
## Document Header
```json
{ "type": "DOCHEAD" }||{ "docType": "SCH_PAGE", "uuid": "UUID", "client": "clientID" }|
```
```json
{ "type": "DOCHEAD" }||{ "docType": "SYMBOL", "uuid": "UUID", "client": "clientID" }|
```
- type: "DOCHEAD", document header identifier.
- docType: document type, "SCH_PAGE": schematic, "SYMBOL": symbol.
- uuid: document unique ID, unique within the project.
- client: terminal identifier for eventual consistency.
## Canvas Configuration
Editor additional information, used for data analysis and other functions. Currently occupied fields:
```json
{ "type": "CANVAS", "ticket": 1 }||
{
"originX":0,
"originY":0,
}|
```
1. type: "CANVAS", canvas configuration identifier.
2. ticket logical clock.
3. originX canvas origin X.
4. originY canvas origin Y.
format/schematic/obj.md
# OBJ Binary Embedded Object
Embedded images and files on the page, which can be downloaded as attachments or displayed directly (decided by EDA, not required by the format).
```json
{ "type": "OBJ", "id": "UUID", "ticket": 1 }||
{
"partId": "",
"groupId": 0,
"locked": false,
"zIndex": 9.0876,
"fileName": "a.txt",
"startX": 200,
"startY": 300,
"width": 10,
"height": 20,
"rotation": 0,
"isMirror": false,
"content": "data:text/plain;base64,MTIzNA==",
}|
```
1. type binary embedded object identifier: OBJ.
2. id ID, unique within the file.
3. ticket logical clock.
4. partId sub-library ID, exclusive to symbol pages; ignored on schematics.
5. groupId group ID, cannot be 0, empty by default when none.
6. locked whether locked.
7. zIndex Z-axis height.
8. fileName file name.
9. startX top-left X.
10. startY top-left Y.
11. width width.
12. height height.
13. rotation rotation angle, around `top-left`.
14. isMirror whether mirrored.
15. content binary data, two modes.
1. General format, compatible with `Data URLs`: `data:[<mediatype>][;base64],<data>`
- e.g. `data:image/png;base64,asdfasdfwer`
- e.g. `data:text/html,<html></html>`
2. BLOB reference mode, `blob:hashid`.
format/schematic/component.md
# COMPONENT
- `COMPONENT` references a Symbol. Since a Symbol supports multiple Parts, it carries a `sub-library ID` to indicate which one; for a single-Part device, the default value `""` is used.
- A `COMPONENT` can bind many `ATTR`s; specific attribute behavior is defined by the tool.
### Symbol Types
| Symbol Type ID | Symbol Type | Description |
| :-------------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 2 | Part Symbol | Common device. |
| 17 | Block Symbol | Hierarchical symbol. |
| 18 | NetFlag Symbol | Global net symbol. |
| 19 | NetPort Symbol | Hierarchical net export symbol. |
| 20 | Sheet Symbol | Provides a reuse mechanism for schematic sheets. |
| 21 | NoneElec Symbol | Non-electrical symbol. NoneElec is a class of non-electrical primitives without `PIN`.<br>Can also be used as a reuse mechanism for special icons, copyright statements, etc.<br>NoneElec stands for None Electrical. |
| 22 | Short Symbol | Short Symbol is a special Symbol that must have two `PIN`s.<br>All nets connected to the `PIN`s of the same `Short Symbol` are electrically shorted.<br>For example, if net A is connected to PIN1 and net B to PIN2, A and B are the same net. |
### Component Primitive
```json
{ "type": "COMPONENT", "id": "UUID", "ticket": 1 }||
{
"partId": "e176",
"groupId": 0,
"positionX": 300,
"positionY": 200,
"rotation": 15,
"isMirror": false,
"data": {},
}|
```
1. type COMPONENT identifier: COMPONENT.
2. id ID, unique within the file.
3. ticket logical clock.
4. partId sub-library ID.
5. groupId group ID, cannot be 0, empty by default when none.
6. zIndex Z-axis height: all non-attribute child elements are distributed within Z0 ~ Z9, e.g. Z of 23.554 means child elements are auto-distributed within 23.5540 ~ 23.5549.
7. positionX position X.
8. positionY position Y.
9. rotation rotation angle, around `position`.
10. isMirror whether mirrored.
11. data pure data attributes: additional information for internal editor logic.
The Symbol referenced by a Component is transformed in the following order:
1. Rotate counter-clockwise around the origin (0,0) by the `rotation angle`.
2. If `isMirror` is `1`, mirror horizontally around the Y-axis at the origin (0,0).
3. Translate by `position`.
Or equivalently (but more cumbersome to implement):
1. Translate by `position`.
2. Rotate counter-clockwise around `position` by the `rotation angle`.
3. If `isMirror` is `1`, mirror horizontally around the Y-axis at `position`.
```json
{ "type": "ATTR", "id": "e187", "ticket": 1 }||
{ "partId": "", "groupId": 0, "locked": true, "zIndex": 0.1, "parentId": "e176", "key":"Device", "value":"device-uuid-1", "keyVisible":true, "valueVisible":true, "positionX":300, "positionY":200, "rotation":0, "color":null, "fillColor":null, "fontFamily":null, "fontSize":null, "strikeout":null, "underline":null, "italic":null, "fontWeight":null, "vAlign":0, "hAlign":2,}|
```
Device uuid, consistent with the file name corresponding to the device in project.json.
```json
{ "type": "ATTR", "id": "e188", "ticket": 1 }||
{ "partId": "", "groupId": 0, "locked": true, "zIndex": 0.1, "parentId": "e176", "key":"Symbol", "value":"symbol-uuid-1", "keyVisible":true, "valueVisible":true, "positionX":300, "positionY":200, "rotation":0, "color":null, "fillColor":null, "fontFamily":null, "fontSize":null, "strikeout":null, "underline":null, "italic":null, "fontWeight":null, "vAlign":0, "hAlign":2,}|
```
An `ATTR` inside `COMPONENT` with the same name as one in the template will override it. Overriding Symbol affects the binding between the device and the symbol.
```json
{ "type": "ATTR", "id": "e188", "ticket": 1 }||
{ "partId": "", "groupId": 0, "locked": true, "zIndex": 0.1, "parentId": "e176", "key":"Footprint", "value":"footprint-uuid-1", "keyVisible":true, "valueVisible":true, "positionX":300, "positionY":200, "rotation":0, "color":null, "fillColor":null, "fontFamily":null, "fontSize":null, "strikeout":null, "underline":null, "italic":null, "fontWeight":null, "vAlign":0, "hAlign":2,}|
```
An `ATTR` inside `COMPONENT` with the same name as one in the template will override it. Overriding Footprint affects the binding between the device and the footprint.
```json
{ "type": "ATTR", "id": "e188", "ticket": 1 }||
{ "partId": "", "groupId": 0, "locked": true, "zIndex": 0.1, "parentId": "e176", "key":"Designator", "value":"U1", "keyVisible":true, "valueVisible":true, "positionX":300, "positionY":200, "rotation":0, "color":null, "fillColor":null, "fontFamily":null, "fontSize":null, "strikeout":null, "underline":null, "italic":null, "fontWeight":null, "vAlign":0, "hAlign":2,}|
```
An `ATTR` inside `COMPONENT` with the same name as one in the template will override it.
```json
{ "type": "ATTR", "id": "e180", "ticket": 1 }||
{ "partId": "", "groupId": 0, "locked": true, "zIndex": 0.1, "parentId": "e176e5", "key":"NUMBER", "value":"1", "keyVisible":true, "valueVisible":true, "positionX":108, "positionY":804.5, "rotation":0, "color":null, "fillColor":null, "fontFamily":null, "fontSize":null, "strikeout":null, "underline":null, "italic":null, "fontWeight":null, "vAlign":0, "hAlign":2,}|
```
The key to `PIN` attribute override lies in the `parentId` of `ATTR`.
The ID has two parts, e.g. `e176e5`, where `e176` is the `COMPONENT` ID and `e5` is the `PIN` ID in the template.
format/schematic/index.md
# SCH Schematic Type Document
This chapter details the format specification of the EasyEDA schematic file. Schematic files mainly consist of the following parts:
- [Common Format](/en/format/schematic/common.md): document header and canvas configuration.
- [Structural Elements](/en/format/schematic/structure.md): PART sub-library and GROUP combination.
- [Attributes](/en/format/schematic/attr.md): primitive attribute definitions.
- [Wires](/en/format/schematic/wire.md): wires, buses, and bus entries.
- [Text](/en/format/schematic/text.md): text elements.
- [Shapes](/en/format/schematic/shape.md): rectangles, polygons, circles, arcs, Bezier curves, ellipses.
- [Pins](/en/format/schematic/pin.md): pin definitions.
- [Components](/en/format/schematic/component.md): schematic component instances.
- [Objects](/en/format/schematic/obj.md): binary objects (images, etc.).
- [Tables](/en/format/schematic/table.md): tables and cells.
format/schematic/pin.md
# PIN Number

As shown in the figure:
- The `position X/Y` of all PINs is the endpoint farthest from the black rectangle.
- PIN 1 is 0-degree rotation direction, pin style 0.
- PIN 2 is 90-degree rotation direction, pin style 1.
- PIN 3 is 180-degree rotation direction, pin style 2.
- PIN 4 is 270-degree rotation direction, pin style 3.
```json
{ "type": "PIN", "id": "UUID", "ticket": 1 }||
{
"partId": "",
"groupId": 0,
"locked": false,
"zIndex": 2.8772,
"display": true,
"electric": 0,
"positionX": 350,
"positionY": 170,
"length": 20,
"rotation": 0,
"color": "#880000",
"pinShape": 3,
}|
```
1. type primitive name: PIN.
2. id ID, unique within the file.
3. ticket logical clock.
4. partId sub-library ID, exclusive to symbol pages; ignored on schematics.
5. groupId group ID, cannot be 0, empty by default when none.
6. locked whether locked.
7. zIndex Z-axis height.
8. display whether to display.
9. electric electrical characteristic: 0 UNKNOWN, 1 INPUT, 2 OUTPUT, 3 BI.
10. positionX position X.
11. positionY position Y.
12. length pin length.
13. rotation rotation angle: 0, 90, 180, 270.
14. color pin color.
15. pinShape pin style: 1 Clock, 2 DOT; supports bitwise OR, e.g. 3 = 1 | 2.
Example: `0` no addition, `1` Clock, `2` DOT, `3` Clock & DOT.
```json
{ "type": "ATTR", "id": "e184", "ticket": 1 }||
{ "partId": "", "groupId": 0, "locked": true, "zIndex": 0.1, "parentId": "e102", "key":"NAME", "value":"VCC", "keyVisible":true, "valueVisible":true, "positionX":108, "positionY":804.5, "rotation":0, "color":null, "fillColor":null, "fontFamily":null, "fontSize":null, "strikeout":null, "underline":null, "italic":null, "fontWeight":null, "vAlign":0, "hAlign":2,}|
```
PIN must have the NAME attribute.
```json
{ "type": "ATTR", "id": "e185", "ticket": 1 }||
{ "partId": "", "groupId": 0, "locked": true, "zIndex": 0.1, "parentId": "e102", "key":"NUMBER", "value":"1", "keyVisible":true, "valueVisible":true, "positionX":108, "positionY":804.5, "rotation":0, "color":null, "fillColor":null, "fontFamily":null, "fontSize":null, "strikeout":null, "underline":null, "italic":null, "fontWeight":null, "vAlign":0, "hAlign":2,}|
```
PIN must have the NUMBER attribute.
format/schematic/shape.md
# Shape Primitives
## RECT Rectangle
A rectangle is defined by two diagonal points, and its rotation is around `point1`.
```json
{ "type": "RECT", "id": "UUID", "ticket": 1 }||
{
"partId": "",
"groupId": 0,
"locked": false,
"zIndex": 7.35,
"dotX1": 340,
"dotY1": 210,
"dotX2": 100,
"dotY2": 200,
"radiusX": 40,
"radiusY": 30,
"rotation": 90,
"strokeColor": null,
"strokeStyle": 0,
"fillColor": "",
"strokeWidth": null,
"fillStyle": 1,
}|
```
1. type primitive name: RECT.
2. id ID, unique within the file.
3. ticket logical clock.
4. partId sub-library ID, exclusive to symbol pages; ignored on schematics.
5. groupId group ID, cannot be 0, empty by default when none.
6. locked whether locked.
7. zIndex Z-axis height.
8. dotX1 point 1 X.
9. dotY1 point 1 Y.
10. dotX2 point 2 X.
11. dotY2 point 2 Y.
12. radiusX corner radius X: `0` means no rounding.
13. radiusY corner radius Y: `0` means no rounding.
14. rotation rotation angle, around `point1`.
15. strokeColor color, null for default.
16. strokeStyle style: 0 solid, 1 dashed, 2 dotted, 3 dash-dot.
17. fillColor fill color: `""` no fill; if filled, start and end points are automatically closed.
18. strokeWidth width, null for default.
19. fillStyle fill style: 0 none, 1 solid, 2 grid, 3 horizontal line, 4 vertical line, 5 diamond, 6 left slash, 7 right slash.
## POLY Polygon
```json
{ "type": "POLY", "id": "UUID", "ticket": 1 }||
{
"partId": "",
"groupId": 0,
"locked": false,
"zIndex": 7.35,
"points": [390, 260, 450, 300, 560, 280, 540, 320],
"closed": false,
"strokeColor": null,
"strokeStyle": 0,
"fillColor": "",
"strokeWidth": null,
"fillStyle": 1,
}|
```
1. type primitive name: POLY.
2. id ID, unique within the file.
3. ticket logical clock.
4. partId sub-library ID, exclusive to symbol pages; ignored on schematics.
5. groupId group ID, cannot be 0, empty by default when none.
6. locked whether locked.
7. zIndex Z-axis height.
8. points point set coordinates: X Y X Y X Y ...
9. closed whether to auto-close: if auto-closed, the end point will automatically connect to the start point.
10. strokeColor color, null for default.
11. strokeStyle style: 0 solid, 1 dashed, 2 dotted, 3 dash-dot.
12. fillColor fill color: `""` no fill; if filled, start and end points are automatically closed.
13. strokeWidth width, null for default.
14. fillStyle fill style: 0 none, 1 solid, 2 grid, 3 horizontal line, 4 vertical line, 5 diamond, 6 left slash, 7 right slash.
## CIRCLE Circle
```json
{ "type": "CIRCLE", "id": "UUID", "ticket": 1 }||
{
"partId": "",
"groupId": 0,
"locked": false,
"zIndex": 2.332,
"centerX": 430,
"centerY": 200,
"radius": 21,
"strokeColor": null,
"strokeStyle": 0,
"fillColor": "",
"strokeWidth": null,
"fillStyle": 1,
}|
```
1. type primitive name: CIRCLE.
2. id ID, unique within the file.
3. ticket logical clock.
4. partId sub-library ID, exclusive to symbol pages; ignored on schematics.
5. groupId group ID, cannot be 0, empty by default when none.
6. locked whether locked.
7. zIndex Z-axis height.
8. centerX circle center X.
9. centerY circle center Y.
10. radius radius r.
11. strokeColor color, null for default.
12. strokeStyle style: 0 solid, 1 dashed, 2 dotted, 3 dash-dot.
13. fillColor fill color: `""` no fill; if filled, start and end points are automatically closed.
14. strokeWidth width, null for default.
15. fillStyle fill style: 0 none, 1 solid, 2 grid, 3 horizontal line, 4 vertical line, 5 diamond, 6 left slash, 7 right slash.
## ARC Arc
```json
{ "type": "ARC", "id": "UUID", "ticket": 1 }||
{
"partId": "",
"groupId": 0,
"locked": false,
"zIndex": 0.8689,
"startX": -10,
"startY": 0,
"referX": 0,
"referY": 10,
"endX": 10,
"endY": 0,
"strokeColor": null,
"strokeStyle": 0,
"fillColor": "",
"strokeWidth": null,
"fillStyle": 1,
}|
```
1. type primitive name: ARC.
2. id ID, unique within the file.
3. ticket logical clock.
4. partId sub-library ID, exclusive to symbol pages; ignored on schematics.
5. groupId group ID, cannot be 0, empty by default when none.
6. locked whether locked.
7. zIndex Z-axis height.
8. startX start X.
9. startY start Y.
10. referX reference X.
11. referY reference Y.
12. endX end X.
13. endY end Y.
14. strokeColor color, null for default.
15. strokeStyle style: 0 solid, 1 dashed, 2 dotted, 3 dash-dot.
16. fillColor fill color: `""` no fill; if filled, start and end points are automatically closed.
17. strokeWidth width, null for default.
18. fillStyle fill style: 0 none, 1 solid, 2 grid, 3 horizontal line, 4 vertical line, 5 diamond, 6 left slash, 7 right slash.
## BEZIER Cubic Bezier Curve
```json
{ "type": "BEZIER", "id": "UUID", "ticket": 1 }||
{
"partId": "",
"groupId": 0,
"locked": false,
"zIndex": 2.1002,
"controls": [10, 10, 30, 20, 100, 30, 50, 70],
"strokeColor": null,
"strokeStyle": 0,
"fillColor": "",
"strokeWidth": null,
"fillStyle": 1,
}|
```
1. type primitive name: BEZIER.
2. id ID, unique within the file.
3. ticket logical clock.
4. partId sub-library ID, exclusive to symbol pages; ignored on schematics.
5. groupId group ID, cannot be 0, empty by default when none.
6. locked whether locked.
7. zIndex Z-axis height.
8. controls control points: X1 Y1 X2 Y2 X3 Y3 X4 Y4 ...
9. strokeColor color, null for default.
10. strokeStyle style: 0 solid, 1 dashed, 2 dotted, 3 dash-dot.
11. fillColor fill color: `""` no fill; if filled, start and end points are automatically closed.
12. strokeWidth width, null for default.
13. fillStyle fill style: 0 none, 1 solid, 2 grid, 3 horizontal line, 4 vertical line, 5 diamond, 6 left slash, 7 right slash.
## ELLIPSE Ellipse
```json
{ "type": "ELLIPSE", "id": "UUID", "ticket": 1 }||
{
"partId": "",
"groupId": 0,
"locked": false,
"zIndex": 6.23,
"centerX": 670,
"centerY": 325,
"radiusX": 220,
"radiusY": 20,
"rotation": 0,
"strokeColor": null,
"strokeStyle": 0,
"fillColor": "",
"strokeWidth": null,
"fillStyle": 1,
}|
```
1. type primitive name: ELLIPSE.
2. id ID, unique within the file.
3. ticket logical clock.
4. partId sub-library ID, exclusive to symbol pages; ignored on schematics.
5. groupId group ID, cannot be 0, empty by default when none.
6. locked whether locked.
7. zIndex Z-axis height.
8. centerX center cx.
9. centerY center cy.
10. radiusX horizontal radius rx.
11. radiusY vertical radius ry.
12. rotation rotation angle rot.
13. strokeColor color, null for default.
14. strokeStyle style: 0 solid, 1 dashed, 2 dotted, 3 dash-dot.
15. fillColor fill color: `""` no fill; if filled, start and end points are automatically closed.
16. strokeWidth width, null for default.
17. fillStyle fill style: 0 none, 1 solid, 2 grid, 3 horizontal line, 4 vertical line, 5 diamond, 6 left slash, 7 right slash.
format/schematic/attr.md
# ATTR Attribute
ATTR is a relatively generic primitive that means:
1. It expresses one of multiple attributes composed of a KEY-VALUE pair.
2. It can be displayed on the canvas and controls what content is displayed, as well as style and position.
When the affiliation ID is not specified, it defaults to the current block-level primitive.
```json
{ "type": "ATTR", "id": "UUID", "ticket": 1 }||
{ "partId": "", "groupId": 0, "locked": false, "zIndex": 0.1, "parentId": "UUID", "key":"string", "value":"string", "keyVisible":false, "valueVisible":false, "positionX":200, "positionY":200, "rotation":0, "color":null, "fillColor":null, "fontFamily":null, "fontSize":null, "strikeout":null, "underline":null, "italic":null, "fontWeight":null, "vAlign":0, "hAlign":2,}|
```
1. type attribute name: ATTR.
2. id unique ID.
3. ticket logical clock.
4. partId sub-library ID, exclusive to symbol pages; ignored on schematics.
5. groupId group ID, cannot be 0, empty by default when none.
6. locked whether locked.
7. zIndex Z-axis height.
8. parentId affiliation ID: the primitive it belongs to, `""` means it belongs to the current block. _Default block is the file._
9. key attribute Key.
10. value attribute Value.
11. keyVisible whether to display Key.
12. valueVisible whether to display Value.
13. positionX position X: fixed to `null` for attributes that have never been displayed.
14. positionY position Y: fixed to `null` for attributes that have never been displayed.
15. rotation rotation angle, rotated around `position`.
16. color color.
17. fillColor background color.
18. fontFamily font name.
19. fontSize font size, same unit as coordinates.
20. strikeout whether to strike out.
21. underline whether to underline.
22. italic whether italic.
23. fontWeight whether bold.
24. vAlign vertical alignment: 0 top, 1 middle, 2 bottom.
25. hAlign horizontal alignment: 0 left, 1 center, 2 right.
When the attribute Value contains the `~` character, XTools needs to implement overline text from the start to the end: text is overlined starting at odd-numbered `~` and ending at even-numbered `~`.
format/schematic/structure.md
# Structural Primitives
## PART Sub-Library
`PART` only exists on symbol pages.
Even single-Part devices must have a `PART`; the sub-library ID is left empty `""`.
```json
{ "type": "PART","id":"partId", "ticket": 1 }||{"BBOX": [-10, -20, 10, 20]}|
```
1. type sub-library primitive: PART.
2. id sub-library ID.
3. ticket logical clock.
4. Inner parameters: Key-Value
- Reserved `BBOX` is the bounding box that just encloses all primitives under the PART, defined by any two diagonal points.
**XTools core logic should not rely on this property.**
- Others are editor additional information for data analysis and other functions, optional.
All primitives on the symbol page carry the corresponding sub-library ID to indicate they belong to that sub-library.
```json
{ "type": "WIRE", "id": "UUID", "ticket": 1 }||
{
"partId": "partId", // symbol primitives carry this sub-library id
"groupId": 0,
"locked": false,
"zIndex": 0.235,
"dots": [
[310, 550, 400, 550, 400, 460],
[480, 460, 400, 460],
[400, 330, 400, 460]
],
"strokeColor": null,
"strokeStyle": 0,
"fillColor": "",
"strokeWidth": null,
"fillStyle": 1,
}|
```
## GROUP Group Control
```json
{ "type": "GROUP", "id": "UUID", "ticket": 1 }||{ "groupId": "1", "parentId": "0", "title": "Logo" }|
```
1. type group control `GROUP`.
2. id unique ID.
3. ticket logical clock.
4. groupId group ID, cannot be 0.
5. parentId parent group ID, 0 means no parent.
6. title group name, empty string `""` if no name.
format/schematic/wire.md
# Wire Primitives
## WIRE Wire
```json
{ "type": "WIRE", "id": "UUID", "ticket": 1 }||
{
"partId": "",
"groupId": 0,
"locked": false,
"zIndex": 0.235,
"dots": [
[310, 550, 400, 550, 400, 460],
[480, 460, 400, 460],
[400, 330, 400, 460]
],
"strokeColor": null,
"strokeStyle": 0,
"fillColor": "",
"strokeWidth": null,
"fillStyle": 1,
}|
```
1. type primitive name: WIRE.
2. id unique ID.
3. ticket logical clock.
4. partId sub-library ID, exclusive to symbol pages; ignored on schematics.
5. groupId group ID, cannot be 0, empty by default when none.
6. locked whether locked.
7. zIndex Z-axis height.
8. dots coordinates: divided into multiple segments, each segment is a continuous set of X1 Y1 X2 Y2 X3 Y3 ... describing a line.
9. strokeColor color, null for default.
10. strokeStyle style: 0 solid, 1 dashed, 2 dotted, 3 dash-dot.
11. fillColor fill color: `""` no fill; if filled, start and end points are automatically closed.
12. strokeWidth width, null for default.
13. fillStyle fill style: 0 none, 1 solid, 2 grid, 3 horizontal line, 4 vertical line, 5 diamond, 6 left slash, 7 right slash.
```json
{ "type": "ATTR", "id": "e200", "ticket": 1 }||
{ "partId": "", "groupId": 0, "locked": true, "zIndex": 0.1, "parentId": "e271", "key":"NET", "value":"GND", "keyVisible":true, "valueVisible":true, "positionX":108, "positionY":804.5, "rotation":0, "color":null, "fillColor":null, "fontFamily":null, "fontSize":null, "strikeout":null, "underline":null, "italic":null, "fontWeight":null, "vAlign":0, "hAlign":2,}|
```
Wires must carry the NET attribute to identify the net name.
## BUS Bus
```json
{ "type": "BUS", "id": "UUID", "ticket": 1 }||
{
"partId": "",
"groupId": 0,
"locked": false,
"zIndex": 0.235,
"dots": [
[310, 550, 400, 550, 400, 460],
[480, 460, 400, 460],
[400, 330, 400, 460]
],
"strokeColor": null,
"strokeStyle": 0,
"fillColor": "",
"strokeWidth": null,
"fillStyle": 1,
}|
```
1. type primitive name: BUS.
2. id unique ID.
3. ticket logical clock.
4. partId sub-library ID, exclusive to symbol pages; ignored on schematics.
5. groupId group ID, cannot be 0, empty by default when none.
6. locked whether locked.
7. zIndex Z-axis height.
8. dots coordinates: divided into multiple segments, each segment is a continuous set of X1 Y1 X2 Y2 X3 Y3 ... describing a line.
9. strokeColor color, null for default.
10. strokeStyle style: 0 solid, 1 dashed, 2 dotted, 3 dash-dot.
11. fillColor fill color: `""` no fill; if filled, start and end points are automatically closed.
12. strokeWidth width, null for default.
13. fillStyle fill style: 0 none, 1 solid, 2 grid, 3 horizontal line, 4 vertical line, 5 diamond, 6 left slash, 7 right slash.
```json
{ "type": "ATTR", "id": "e200", "ticket": 1 }||
{ "partId": "", "groupId": 0, "locked": true, "zIndex": 0.1, "parentId": "e271", "key":"NET", "value":"A[1:5]", "keyVisible":true, "valueVisible":true, "positionX":108, "positionY":804.5, "rotation":0, "color":null, "fillColor":null, "fontFamily":null, "fontSize":null, "strikeout":null, "underline":null, "italic":null, "fontWeight":null, "vAlign":0, "hAlign":2,}|
```
Buses must carry the NET attribute to identify the net name.
## BUSENTRY Bus Entry Marker

As shown in the figure:
- Light yellow is `BUS`.
- The green rounded rhombus and the PIN-like shape extending to the right are `BUSENTRY`.
- Blue is `Wire`.
- The endpoint is the coordinate of the endpoint where `WIRE` and `BUSENTRY` (similar to `PIN`) touch on the far right.
- Because `WIRE` and `BUS` can connect at any angle, the rotation direction must be specified to match the incoming direction of `WIRE`. In the figure, it is 180 degrees.
- `BUSENTRY` has a fixed one-grid length.
- The specific shape of `BUSENTRY` is ultimately interpreted by XTools and is not constrained by the format.
```json
{ "type": "BUSENTRY", "id": "UUID", "ticket": 1 }||
{
"partId": "",
"groupId": 0,
"locked": false,
"zIndex": 0.235,
"busGroupId": 4,
"order": 4,
"pointX": 500,
"pointY": 600,
"rotation": 90,
}|
```
1. type primitive name: BUSENTRY.
2. id ID, unique within the file.
3. ticket logical clock.
4. partId sub-library ID, exclusive to symbol pages; ignored on schematics.
5. groupId group ID, cannot be 0, empty by default when none.
6. locked whether locked.
7. zIndex Z-axis height.
8. busGroupId sequence number: sequence within the affiliated BUS, may repeat.
For example, a BUS net of A[2:3]B[7:6] can have a series of BUSENTRYs numbered 0 1 2 3 0 1 2 3 ..., where
0 always represents branch A2B7,
1 always represents branch A2B6,
2 always represents branch A3B7,
3 always represents branch A3B6.
9. pointX endpoint X.
10. pointY endpoint Y.
11. rotation rotation angle, around `endpoint`.
format/schematic/table.md
# Table Primitive
## TABLE Table
```json
{ "type": "TABLE", "id": "UUID", "ticket": 1 }||
{
"partId": "",
"groupId": 0,
"startX": 30,
"startY": 40,
"rowSizes": [32, 40, 32, 32, 25],
"colSizes": [33, 33, 44, 44, 11],
"rowLocked": [0, 0, 1, 0, 0],
"colLocked": [0, 1, 0, 0, 0],
"rotation": 0,
}|
```
1. type table: `TABLE`.
2. id ID, unique within the file.
3. ticket logical clock.
4. partId sub-library ID, exclusive to symbol pages; ignored on schematics.
5. groupId group ID, cannot be 0, empty by default when none.
6. startX top-left X.
7. startY top-left Y.
8. rowSizes row heights.
9. colSizes column widths.
10. rowLocked row lock.
11. colLocked column lock.
12. rotation rotation angle.
## TABLE_CELL Table Cell
```json
{ "type": "TABLE", "id": "UUID", "ticket": 1 }||
{
"tableId": "tableId",
"value": "abc\ndef\nghi",
"rowIndex": 2,
"columnIndex": 5,
"rowSpan": 1,
"colSpan": 3,
"topStyle": {
"strokeColor": null,
"strokeStyle": 0,
"fillColor": "",
"strokeWidth": null,
"fillStyle": 1,
},
"rightStyle": {
"strokeColor": null,
"strokeStyle": 0,
"fillColor": "",
"strokeWidth": null,
"fillStyle": 1,
},
"bottomStyle": {
"strokeColor": null,
"strokeStyle": 0,
"fillColor": "",
"strokeWidth": null,
"fillStyle": 1,
},
"leftStyle": {
"strokeColor": null,
"strokeStyle": 0,
"fillColor": "",
"strokeWidth": null,
"fillStyle": 1,
},
"leftStyle": {
"strokeColor": null,
"strokeStyle": 0,
"fillColor": "",
"strokeWidth": null,
"fillStyle": 1,
},
"fontStyle": {
"color": "#fff",
"fillColor": "#fff",
"fontFamily": "SimSun",
"fontSize": 12,
"strikeout": false,
"underline": false,
"italic": false,
"fontWeight": false,
"vAlign": 0 ,
"hAlign": 2,
},
"lineHeight": 12,
}|
```
1. type table cell: `TABLE_CELL`.
2. id ID, unique within the file.
3. ticket logical clock.
4. tableId table ID.
5. value content.
6. rowIndex row.
7. columnIndex column.
8. rowSpan width (how many columns occupied).
9. colSpan height (how many rows occupied).
10. topStyle top border line style.
11. rightStyle right border line style.
12. bottomStyle bottom border line style.
13. leftStyle left border line style.
14. fontStyle font style.
15. lineHeight line spacing.
guide/ancillary-projects/easyeda-api-sdk.md
<!--@include: @/private/easyeda-api-sdk/README.en.md{3,}-->
format/schematic/text.md
# TEXT Text
```json
{ "type": "TEXT", "id": "UUID", "ticket": 1 }||
{
"partId": "",
"groupId": 0,
"locked": false,
"zIndex": 4.12,
"positionX": 109,
"positionY": 804.5,
"rotation": 0,
"value": "any characters doukeyi@!@#$",
"color": "#fff",
"fillColor": "#fff",
"fontFamily": "SimSun",
"fontSize": 12,
"strikeout": false,
"underline": false,
"italic": false,
"fontWeight": false,
"vAlign": 0 ,
"hAlign": 2,
}|
```
1. type primitive name: TEXT.
2. id ID, unique within the file.
3. ticket logical clock.
4. partId sub-library ID, exclusive to symbol pages; ignored on schematics.
5. groupId group ID, cannot be 0, empty by default when none.
6. locked whether locked.
7. zIndex Z-axis height.
8. positionX text coordinate X.
9. positionY text coordinate Y.
10. rotation rotation angle, around text coordinate.
11. value text content: any characters.
12. color color.
13. fillColor background color.
14. fontFamily font name.
15. fontSize font size, same unit as coordinates.
16. strikeout whether to strike out.
17. underline whether to underline.
18. italic whether italic.
19. fontWeight whether bold.
20. vAlign vertical alignment: 0 top, 1 middle, 2 bottom.
21. hAlign horizontal alignment: 0 left, 1 center, 2 right.
guide/ancillary-projects.md
# Ancillary Projects
The current EasyEDA Professional Edition Extension API provides the following helper items that you can use for a more complete development experience:
| Project | Type | Badges | License | Description |
| ------------------------------------------------------------ | ----------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------ |
| [easyeda-api-sdk](./ancillary-projects/easyeda-api-sdk) | Git Repo | <a href="https://github.com/easyeda/easyeda-api-sdk" style="vertical-align: inherit;" target="_blank"><img src="https://img.shields.io/github/stars/easyeda/easyeda-api-sdk" alt="GitHub Repo Stars" class="not-medium-zoom-image" style="display: inline; vertical-align: inherit;" /></a> <a href="https://github.com/easyeda/easyeda-api-sdk/issues" style="vertical-align: inherit;" target="_blank"><img src="https://img.shields.io/github/issues/easyeda/easyeda-api-sdk" alt="GitHub Issues" class="not-medium-zoom-image" style="display: inline; vertical-align: inherit;" /></a> | <a href="https://choosealicense.com/licenses/apache-2.0/" style="vertical-align: inherit;" target="_blank"><img src="https://img.shields.io/github/license/easyeda/easyeda-api-sdk" alt="GitHub License" class="not-medium-zoom-image" style="display: inline; vertical-align: inherit;" /></a> | Extension Development SDK |
| [pro-api-types](./ancillary-projects/pro-api-types) | npm Package | <a href="https://www.npmjs.com/package/@jlceda/pro-api-types" style="vertical-align: inherit;" target="_blank"><img src="https://img.shields.io/npm/v/%40jlceda%2Fpro-api-types" alt="NPM Version" class="not-medium-zoom-image" style="display: inline; vertical-align: inherit;" /></a> | <a href="https://choosealicense.com/licenses/apache-2.0/" style="vertical-align: inherit;" target="_blank"><img src="https://img.shields.io/npm/l/%40jlceda%2Fpro-api-types" alt="NPM License" class="not-medium-zoom-image" style="display: inline; vertical-align: inherit;" /></a> | Extension API Type Definitions |
| [eext-run-api-gateway](https://jlcext.com/item/oshwhub-official/run-api-gateway) | EasyEDA Extension | <a href="https://github.com/easyeda/eext-run-api-gateway" style="vertical-align: inherit;" target="_blank"><img src="https://img.shields.io/github/stars/easyeda/eext-run-api-gateway" alt="GitHub Repo Stars" class="not-medium-zoom-image" style="display: inline; vertical-align: inherit;" /></a> <a href="https://github.com/easyeda/eext-run-api-gateway/issues" style="vertical-align: inherit;" target="_blank"><img src="https://img.shields.io/github/issues/easyeda/eext-run-api-gateway" alt="GitHub Issues" class="not-medium-zoom-image" style="display: inline; vertical-align: inherit;" /></a> | <a href="https://choosealicense.com/licenses/apache-2.0/" style="vertical-align: inherit;" target="_blank"><img src="https://img.shields.io/github/license/easyeda/eext-run-api-gateway" alt="GitHub License" class="not-medium-zoom-image" style="display: inline; vertical-align: inherit;" /></a> | EDA \<-\> AI Gateway Extension |
| [easyeda-api-skill](https://clawhub.ai/yanranxiaoxi/easyeda-api) | AI Skill | <a href="https://github.com/easyeda/easyeda-api-skill" style="vertical-align: inherit;" target="_blank"><img src="https://img.shields.io/github/stars/easyeda/easyeda-api-skill" alt="GitHub Repo Stars" class="not-medium-zoom-image" style="display: inline; vertical-align: inherit;" /></a> <a href="https://github.com/easyeda/easyeda-api-skill/issues" style="vertical-align: inherit;" target="_blank"><img src="https://img.shields.io/github/issues/easyeda/easyeda-api-skill" alt="GitHub Issues" class="not-medium-zoom-image" style="display: inline; vertical-align: inherit;" /></a> | <a href="https://github.com/aws/mit-0" style="vertical-align: inherit;" target="_blank"><img src="https://img.shields.io/github/license/easyeda/easyeda-api-skill" alt="GitHub License" class="not-medium-zoom-image" style="display: inline; vertical-align: inherit;" /></a> | Extension API AI Skill |
guide/error-handling.md
# Error Handling
## Disable Extensions and Scripting Systems Globally
When you encounter an exception caused by an extension that prevents you from removing the extension through the normal route (such as corrupted or masked data in the top menu bar, or an uninstall returning an error), you can globally disable the extension and the scripting system by adding the `safetyMode=true` parameter within the URL of the EasyEDA Professional editor:
```diff
- https://pro.easyeda.com/editor
+ https://pro.easyeda.com/editor?safetyMode=true
```
::: tip
If you wish to enter debug mode at the same time, you can add the `cll=debug` parameter again:
```diff
- https://pro.easyeda.com/editor?safetyMode=true
+ https://pro.easyeda.com/editor?safetyMode=true&cll=debug
```
:::
## Remove All Extensions Globally
::: danger
**DANGEROUS!** All your installed extensions and standalone scripts will be removed and cannot be recovered. This method should only be used if a serious error is confirmed to be caused by an extension and cannot be resolved by conventional means.
:::
::: details Thanos mode switch
```diff
- https://pro.easyeda.com/editor
+ https://pro.easyeda.com/editor?DANGEROUS_OPERATION_DeleteExtensionStorage=true
```
:::
guide/ancillary-projects/pro-api-types.md
---
next: false
---
<!--@include: @/node_modules/@jlceda/pro-api-types/README.en.md{3,}-->
guide/extension-json.md
# Extension Configuration File
In order to define the properties of an extension and the various functions that an extension can invoke, each extension should have an extension configuration file named `extension.json` in the root directory with the following default contents:
<<< @/private/easyeda-api-sdk/extension.json{json}
## name <Badge type="tip" text="string" />
Extension name. It can only contain lowercase English characters `a-z`, numbers `0-9`, and underscores `-`, and is `5-30` characters long.
## uuid <Badge type="tip" text="string" />
UUID. A unique ID for the extension that can contain only lowercase English characters `a-z`, numbers `0-9`, and is `32` characters long.
## displayName <Badge type="tip" text="string" />
Display name.
## description <Badge type="tip" text="string" />
Description.
## version <Badge type="tip" text="string" />
Version number. The format is `major.minor.patch`.
## publisher <Badge type="tip" text="string" />
Developer Information.
## engines <Badge type="tip" text="Object" /> <Badge type="warning" text="feature" />
The engine to which the extension applies.
### engines.eda <Badge type="tip" text="string" /> <Badge type="warning" text="feature" />
Extended adapted version of EasyEDA Professional (online).
## license <Badge type="tip" text="string" />
Open-source licensing terms. It is recommended to go to [Choose a License](https://choosealicense.com/) to select the appropriate open source license for your project.
## repository <Badge type="tip" text="Object" /> <Badge type="warning" text="feature" /> <Badge type="info" text="in working" />
Repository information for the source code of the extension.
### repository.type <Badge type="tip" text="string" /> <Badge type="warning" text="feature" /> <Badge type="info" text="in working" />
The type of source code repository. Optional values are `extension-store` `git` `mercurial` `svn` `ftp` `github` `gitlab` `gitlab-selfhosted` `gitee` `gitea` `bitbucket` `coding` `gnu-savannah` ` gitbucket` `gogs`.
### repository.url <Badge type="tip" text="string" /> <Badge type="warning" text="feature" /> <Badge type="info" text="in working" />
Source code repository URL.
## categories <Badge type="tip" text="string | Array<string>" />
The extension's classification. Optional values are `Schematic` `Symbol` `PCB` `Footprint` `Panel` `Library` `Project` `Other`.
## keywords <Badge type="tip" text="Array<string>" />
Keywords.
## images <Badge type="tip" text="Object" />
Images.
### images.logo <Badge type="tip" text="string" />
Logo. Size `1:1`, PNG/JPEG format. Logos can be drawn using an AI generation tool such as [AutoDraw](https://www.autodraw.com/) and a minimum size of `500×500` is recommended.
### images.banner <Badge type="tip" text="string" /> <Badge type="warning" text="feature" />
Banner. Size `64:27`, for presentation of extension's store page, JPEG format.
## homepage <Badge type="tip" text="string" />
Project homepage.
## bugs <Badge type="tip" text="string" />
Vulnerability feedback channel. Please fill in a correct URI.
## activationEvents <Badge type="tip" text="Object" /> <Badge type="warning" text="feature" /> <Badge type="info" text="in working" />
Extension's activation event.
## entry <Badge type="tip" text="string" />
Entry file. No modification is recommended, it is correctly defined within the SDK.
## dependentExtensions <Badge type="tip" text="Object" /> <Badge type="warning" text="feature" /> <Badge type="info" text="in working" />
Dependencies on other extensions. Supports the use of 32-bit UUIDs of extensions in the Extension Store (automatic pulling supported), or user-defined extension names (manual upload required).
## headerMenus <Badge type="tip" text="Object" />
The header menu registered when the extension is initialized.
The header menu is currently supported to be configured separately according to the following pages:
```json
{
"headerMenus": {
"home": [], // [!code focus:9]
"blank": [],
"sch": [],
"symbol": [],
"pcb": [],
"footprint": [],
"pcbView": [],
"panel": [],
"panelView": []
}
}
```
### headerMenus[].id <Badge type="tip" text="string" />
Menu item ID. must be unique.
### headerMenus[].title <Badge type="tip" text="string" />
Menu item title.
### headerMenus[].menuItems <Badge type="tip" text="Object" />
Menu item subitems. Up to two levels of subitems can be nested.
`menuItems` conflicts with `registerFn`, only one of them is allowed to exist in the same level.
### headerMenus[].registerFn <Badge type="tip" text="string" />
Menu associated registered method. The method here is associated with a method exported within the code of this extension, you need to export the specified method as an `ES Module` using `export` and fill in its method name here.
`registerFn` conflicts with `menuItems`, only one of them is allowed to exist in the same level.
guide/cli.md
# Command-Line Client <Badge type="tip" text="CLI" />
::: tip For AI coding assistants: the command-line client
If you are using an AI coding assistant (such as Claude Code, OpenCode, QwenCode, GitHub Copilot, etc.) to drive EasyEDA Pro, ask the AI to follow the [For AI command-line client document](https://prodocs.easyeda.com/storage/texts/api/guide/cli-for-ai.md). That document is written for AI coding assistants: it drops redundant prose and provides directly executable commands, hard constraints, and verification steps.
You can also copy the prompt below directly to your AI coding assistant:
```text
Please help me complete a design task through the EasyEDA Pro desktop client command line (easyeda-pro), as follows:
1. Strictly follow the steps in https://prodocs.easyeda.com/storage/texts/api/guide/cli-for-ai.md;
2. Before starting, confirm the endpoint connection state with easyeda-pro doctor, and confirm the project name and other details with me;
3. After each key command, check the ok field of the response and the on-disk artifacts, then report the project directory, the paths of the exported artifacts, and the session shutdown result.
```
:::
Besides the graphical interface, the EasyEDA Pro desktop client ships with a command-line client (CLI) and a local bridge service. They let you control a running editor from a script, or let an AI coding assistant drive the editor directly to complete design work.
The command-line client provides the following capabilities:
- Opening and creating projects, and managing multiple editor windows (sessions);
- Executing JavaScript inside the editor, and therefore calling any [extension API](./index);
- Querying the extension API reference and the design file format reference;
- Returning results as uniform JSON, which is convenient for scripts and AI to parse;
- Running as an [MCP](https://modelcontextprotocol.io/) server, and therefore serving directly as a tool for an AI coding assistant.
## Basic Concepts
The command-line client treats a running editor as a programmable backend. There are three layers between the client and the editor:
| Concept | Description |
| --- | --- |
| Session | One editor window corresponds to one session, created by `open`, which returns the session ID |
| Invocation | A piece of JavaScript executed inside a given session through `invoke` |
| Bridge service | The local service provided by the client process. The `easyeda-pro` command communicates with the editor through it |
Both the command-line client and the service are provided by the `easyeda-pro` executable, so the same executable is used to start the graphical interface and to run command-line operations.
## Preparation
### I. Obtaining the Client
The command-line client is built into the EasyEDA Pro desktop client (need v4.1.60 and above) and does not need a separate installation. Download and install the EasyEDA Pro client for your system from the [client download page](https://easyeda.com/page/download).
After installation, the `easyeda-pro` executable is usually located at the following path (Windows x64 shown here):
```
C:\Program Files\EasyEDA-Pro\easyeda-pro.exe
```
The installer adds that directory to the system `PATH` during installation, so you can normally use the `easyeda-pro` command directly in a terminal. If the command is reported as not found, check whether the installation directory has been added to `PATH`, or use the full path to the executable instead.
You can also get installation packages for specific versions from the [client release history](../../faq/client-version) page.
::: warning
The command-line client requires the desktop client edition of EasyEDA Pro. The browser / online edition does not support the session and bridge features described in this document.
:::
### II. Verifying the Runtime Environment
Run the following command in a terminal. The client probes the local editor endpoint and reports its state:
```shell
easyeda-pro doctor
```
```json
{
"ok": true,
"value": {
"endpoint": "EasyEDAProf126dbc1",
"connected": false,
"bridgeVersion": null,
"versionMatch": null,
"resultChannel": null
},
"logs": [],
"durationMs": 207
}
```
A `connected` value of `false` means no editor is currently running. Open any editor window and the field becomes `true`.
You can likewise query the attributes of the current runtime environment from inside a script:
```javascript
return {
isClient: eda.sys_Environment.isClient(),
isHalfOfflineMode: eda.sys_Environment.isHalfOfflineMode(),
version: eda.sys_Environment.getEditorCurrentVersion()
};
```
Here [SYS_Environment.isClient()](../reference/pro-api.sys_environment.isclient) determines whether the current environment is the desktop client, [SYS_Environment.isHalfOfflineMode()](../reference/pro-api.sys_environment.ishalfofflinemode) determines whether it is semi-offline mode, and [SYS_Environment.getEditorCurrentVersion()](../reference/pro-api.sys_environment.geteditorcurrentversion) returns the current editor version.
### III. Project Storage Directory
In semi-offline / fully-offline mode, the client data directory is located at:
```
%USERPROFILE%\Documents\EasyEDA-Pro
```
The `config.json` file in that directory records the various path settings, among which `APP_PROJECT_DIR` is the project directory list:
```json
"APP_PROJECT_DIR": [
"C:\\Users\\username\\Documents\\EasyEDA-Pro\\projects",
"C:\\Users\\username\\Documents\\EasyEDA-Pro\\example-projects"
]
```
The read/write range of the [SYS_FileSystem](../reference/pro-api.sys_filesystem) APIs is exactly those directories and their subdirectories. You can also obtain the path list inside a script through [SYS_FileSystem.getProjectsPaths()](../reference/pro-api.sys_filesystem.getprojectspaths). Writing exported artifacts into the `projects\<project name>\` directory is the least troublesome approach.
### IV. Response Structure
All command-line client commands return the same JSON structure:
```json
{
"ok": true,
"value": {},
"logs": [],
"durationMs": 12
}
```
On failure, the structure is as follows:
```json
{
"ok": false,
"error": {
"code": "EXECUTION_ERROR",
"message": "..."
}
}
```
When processing the result inside a script, only the outermost `ok` field needs to be checked.
## Command Overview
### I. Viewing Help
Run `--help` to see all commands of the command-line client:
```shell
easyeda-pro --help
```
```
EasyEDA Pro 4.1.x.abcdef01
Usage:
easyeda-pro <command> [options]
easyeda-pro [global flags]
Commands:
activate Bring the server window up and focus it
open Open a project and return its session id; .eprj3 folder projects
stay in two-way sync with the editor; without --path open a bare editor
stop Gracefully stop the server
doctor Probe the endpoint and report its identity
session/ Manage sessions
list List sessions (origin cli/user, project path, window title)
close Close a session this CLI opened
abort Force-kill a session (last resort)
invoke Invoke a registered function by extension id + name
functions List extensions known to the session
doc/ Query the editor API reference (eda / external / format)
api Query the eda namespace (static editor API)
external Query the external namespace (extension-injected API)
format Query the format namespace (design format reference)
Global flags:
--help Show help for any command: easyeda-pro <command> --help
--search <query> Fuzzy-search commands when unsure of the name
--mcp stdio|http Start MCP server
```
### II. Searching for Commands
If you are not sure of a command name, use `--search` for a fuzzy search:
```shell
easyeda-pro --search session
```
```
Matches:
session.list List sessions (each with origin cli/user, the project path and the window title)
session.close Close a session this CLI opened ...
session.abort Force-kill a session ...
open Open a project and return its session id ...
```
Search keywords are English words such as `session` `invoke` `doc` `permission` `BoardOutline`.
### III. Viewing Subcommand Help
Any command documents its usage through `--help`:
```shell
easyeda-pro open --help
```
```
open
Open a project and return its session id; .eprj3 folder projects stay in two-way sync
with the editor (disk edits reload automatically, editor saves land on disk automatically);
without --path open a bare editor (visible window; --headless for a hidden render)
Usage:
easyeda-pro open [--path <undefined>] [--headless <boolean>]
Options:
--path Project file path (.eprj/.eprj2/.eprj3/.elib); omit to open a bare editor
--headless Open without a visible window (hidden render); default opens a GUI window
```
```shell
easyeda-pro invoke --help
```
```
invoke
Invoke a registered function by extension id + name (source runs on the editor command
space; omit extUuid to run with independent script permission)
Usage:
easyeda-pro invoke --session <undefined> [--code <undefined>] [--fn <undefined>]
[--args <undefined>] [--ext-uuid <undefined>] [--timeout <undefined>]
Options:
--session Session id (string, or positive integer)
--code Source snippet (string; async function body), reads args via __CLI__.args
--fn Function name (default: run)
--args Call arguments as JSON text, exposed to the source as __CLI__.args
--ext-uuid Extension id (optional; omit to run with independent script permission)
--timeout Invocation budget in ms (integer, 1-1800000; default 60000)
```
The remaining subcommands can be inspected in the same way, for example `easyeda-pro session list --help`, `easyeda-pro doc api --help`, or `easyeda-pro --mcp --help`.
### IV. Managing Sessions
Running `open` opens a new editor window and returns its session ID:
```shell
easyeda-pro open
```
```json
{
"ok": true,
"value": {
"sessionId": "9aca2242-79bb-4e2b-9d03-754316927f96",
"renderId": 1,
"path": "",
"headless": false
},
"logs": [],
"durationMs": 1381
}
```
You can also specify a project path when opening, or use `--headless` to open with a hidden window:
```shell
# Open a specific project (.eprj3 folder projects sync in both directions automatically)
easyeda-pro open --path "C:\Users\username\Documents\EasyEDA-Pro\projects\MyBoard\MyBoard.eprj3"
```
```shell
# Hidden window (no GUI rendering)
easyeda-pro open --headless true
```
Use `session list` to see all currently existing sessions:
```shell
easyeda-pro session list
```
```json
{
"ok": true,
"value": [
{
"sessionId": "9aca…",
"renderId": 1,
"status": "alive",
"headless": false,
"origin": "cli",
"path": null,
"title": "EasyEDA Pro - V4.1.x"
},
{
"sessionId": "3c66…",
"renderId": 4,
"status": "alive",
"headless": false,
"origin": "cli",
"path": "C:\\…\\FMT_Test\\FMT_Test.eprj3",
"title": "FMT_Test | EasyEDA Pro"
}
]
}
```
Use `session close` to close a session opened by the command-line client. Adding the `--destroy` parameter closes the window along with it:
```shell
easyeda-pro session close --session 9aca2242-79bb-4e2b-9d03-754316927f96 --destroy
```
::: tip
When a session created by `open` inside a script is no longer needed, close it with `session close --destroy`, so that windows do not pile up.
:::
### V. Running as an MCP Server
The command-line client can run in MCP server mode, and therefore serve directly as a tool for an AI coding assistant:
```shell
# Local client (Claude Code / Cursor, etc.)
easyeda-pro --mcp stdio
```
```shell
# Remote / browser-based agent
easyeda-pro --mcp http --port 3030 --token <token>
```
## Executing JavaScript
The `invoke` command executes a piece of JavaScript inside a given session. This is the core capability of the command-line client: through it, the entire extension API is reachable.
### I. Basic Usage
The simplest invocation is shown below. The return value of the code is serialized to JSON and sent back:
```shell
easyeda-pro invoke --session <SESSION_ID> --code "return 1 + 1"
```
```json
{
"ok": true,
"value": 2,
"logs": [],
"durationMs": 4
}
```
### II. Using Code Files
When the code is long, writing it directly on the command line becomes hard to maintain. It is recommended to save it as a `.js` file and pass it in through a pipe:
```shell
cat > probe.js <<'EOF'
const out = {};
out.client = eda.sys_Environment.isClient();
out.version = eda.sys_Environment.getEditorCurrentVersion();
out.projectCount = (await eda.dmt_Project.getAllProjectsUuid()).length;
return out;
EOF
easyeda-pro invoke --session $S --ext-uuid eda --code "$(cat probe.js)"
```
### III. Commonly Used Options
| Option | Description |
| --- | --- |
| `--ext-uuid eda` | Runs with the identity of the editor's built-in extension, granting full external-interaction permissions (reading and writing local files, accessing system interfaces). Recommended to always attach it |
| `--timeout <ms>` | Timeout of a single invocation. Defaults to `60000`, maximum `1800000`. Increase it appropriately for time-consuming tasks such as batch operations and autorouting |
### IV. Passing Arguments
`--args` passes JSON arguments into the code, where they are accessible through `__CLI__.args`:
```shell
easyeda-pro invoke --session $S --ext-uuid eda \
--args '{"designator":"R1","x":1000,"y":800}' \
--code 'const a = __CLI__.args; return a.designator + "@" + a.x + "," + a.y;'
```
```json
{
"ok": true,
"value": "R1@1000,800",
"logs": [],
"durationMs": 6
}
```
### V. Code Conventions
The supplied code is treated as an async function body, so the following conventions apply:
- Use `return` to produce a result; the value is serialized to JSON;
- `await` can be used directly;
- It is recommended to use forward slashes in paths (`C:/Users/...`), to avoid escaping problems when passing through different terminals.
```javascript
// Recommended path style
const DIR = 'C:/Users/username/Documents/EasyEDA-Pro/projects/MyBoard/';
```
### VI. Retrieving Files
Some export APIs return `File` or `Blob` objects, for example screenshots, BOMs, STEP files, and netlists. If such content needs to be sent back through JSON, it can first be converted to a Base64 string:
```javascript
function toB64(b) {
return new Promise((res) => {
const fr = new FileReader();
fr.onload = () => res(String(fr.result).split(',')[1] || '');
fr.readAsDataURL(b);
});
}
```
The example below gets a schematic PNG file and converts it to Base64:
```javascript
const f = await eda.sch_ManufactureData.getPngFile('MySchematic', { width: 1400 });
return { name: f.name, size: f.size, b64: await toB64(f) };
```
### VII. Writing Files
A simpler approach is to write files straight into the project directory with the [SYS_FileSystem](../reference/pro-api.sys_filesystem) APIs:
```javascript
const f = await eda.pcb_ManufactureData.get3DFile('MyBoard', 'step', ['Component Model'], 'Outfit', true);
await eda.sys_FileSystem.saveFileToFileSystem(
'C:/Users/username/Documents/EasyEDA-Pro/projects/MyBoard/MyBoard.step',
f,
undefined,
true
); // the 4th argument, force = true, means overwrite
```
Frequently used file-system APIs:
| API | Description |
| --- | --- |
| [saveFileToFileSystem(uri, file, fileName?, force?)](../reference/pro-api.sys_filesystem.savefiletofilesystem) | Writes a file. If `uri` ends with `/` it is treated as a directory, otherwise as a complete file name |
| [readFileFromFileSystem(uri)](../reference/pro-api.sys_filesystem.readfilefromfilesystem) | Reads a file, returning a `File` object |
| [listFilesOfFileSystem(folderPath, recursive?)](../reference/pro-api.sys_filesystem.listfilesoffilesystem) | Lists a directory |
| [deleteFileInFileSystem(uri, force?)](../reference/pro-api.sys_filesystem.deletefileinfilesystem) | Deletes a file |
| [getProjectsPaths()](../reference/pro-api.sys_filesystem.getprojectspaths) / [getEdaPath()](../reference/pro-api.sys_filesystem.getedapath) / [getLibrariesPaths()](../reference/pro-api.sys_filesystem.getlibrariespaths) | Returns the various root directories |
## Querying API Documentation
The extension API has several hundred classes. Its documentation is organized by progressive disclosure: first list all classes, then view the methods of a class, then view the full signature of a single method.
### I. Listing All Classes
```shell
easyeda-pro doc api
```
The command returns an array of the form `{ name, comment }`. Class names are grouped by domain prefix:
| Prefix | Domain |
| --- | --- |
| `DMT_` | Document tree / project / board / schematic / PCB / editor control |
| `SCH_` | Schematic primitives (Component / Wire / Pin / Text / Drc / Netlist / ManufactureData) |
| `PCB_` | PCB primitives (Component / Pad / Line / Via / Polyline / Pour / Drc / ManufactureData / Layer / Net) |
| `LIB_` | Device library (Device / Symbol / Footprint / Classification) |
| `SYS_` | System (FileSystem / Dialog / Window / Setting / Environment / MessageBus) |
| `E*_` | Enumerations |
### II. Viewing the Methods of a Class
```shell
easyeda-pro doc api --class-name DMT_Project
```
```json
{
"ok": true,
"value": {
"title": "Document tree / Project management class",
"methods": [
{ "name": "createProject", "comment": "Create Project" },
{ "name": "openProject", "comment": "Open project" },
{ "name": "getCurrentProjectInfo", "comment": "Get detailed properties of Current project" }
],
"callPath": "dmt_Project"
}
}
```
The `callPath` field in the return value is the property name of the class on the `eda` object, so methods of the `DMT_Project` class are called as `eda.dmt_Project.createProject(...)`.
### III. Viewing the Full Signature of a Method
```shell
easyeda-pro doc api --class-name DMT_Project --method-name createProject
```
```json
{
"ok": true,
"value": {
"title": "Create Project",
"params": [
{ "name": "projectFriendlyName", "type": "string", "description": "Project friendly name", "required": true },
{ "name": "projectName", "type": "string", "description": "Project name; must be unique; only letters, digits, and hyphens are allowed", "required": false },
{ "name": "teamUuid", "type": "string" },
{ "name": "fileFormat", "type": "EDMT_ProjectFileFormat", "description": "Project file format, EPRJ3 by default; only effective in the client's semi-offline / fully-offline mode" }
],
"returns": { "type": "string | undefined", "description": "Project UUID, if it is undefined creation fails" },
"isAsync": true,
"example": "...(a directly runnable example)..."
}
}
```
Every method ships with a directly runnable example. That is the most efficient way to learn how a method is used.
### IV. Inspecting an Enumeration
```shell
easyeda-pro doc api --class-name EPCB_LayerId
```
```json
{
"ok": true,
"value": {
"name": "EPCB_LayerId",
"comment": "Layer ID",
"values": [
{ "name": "TOP", "value": 1, "description": "Top layer" },
{ "name": "BOARD_OUTLINE", "value": 11, "description": "Board Outline layer" }
]
}
}
```
### V. Querying the Design File Format
The design file format reference is queried through the `doc format` subcommand. Its usage is described in the [Generating Project Files Directly](#generating-project-files-directly) section:
```shell
easyeda-pro doc format
```
```shell
easyeda-pro doc format --class-name TMSchComponent
```
## Drawing a Schematic with the Extension API
The example below draws a voltage-divider and filter circuit from scratch through the extension API, and exports the netlist, the BOM, and a screenshot.
```text
VCC ──┬── R1(1kΩ) ──┬── MID ── R2(10kΩ) ──┬── GND
│ │ │
└── R3(1kΩ) ──┘ C1(100nF) ───┘ (C1 in parallel with R2)
```
### I. Creating a Session
```shell
easyeda-pro open
export S=9aca2242-79bb-4e2b-9d03-754316927f96
```
### II. Creating a Project
[`DMT_Project.createProject()`](../reference/pro-api.dmt_project.createproject) creates a project, and [`DMT_Project.openProject()`](../reference/pro-api.dmt_project.openproject) then opens it:
```javascript
// step1_create_proj.js
const uuid = await eda.dmt_Project.createProject(
'MyBoard', // friendly name
'my-board', // project name (letters / digits / hyphens)
undefined, // team, empty means personal
undefined, // folder, empty means root
'Tutorial sample project', // description
undefined, // collaboration mode
EDMT_ProjectFileFormat.EPRJ3 // folder project format
);
await eda.dmt_Project.openProject(uuid);
await new Promise((r) => setTimeout(r, 3000));
const p = await eda.dmt_Project.getCurrentProjectInfo();
return {
uuid: p.uuid,
board: p.data[0].name,
schematic: p.data[0].schematic.name,
page: p.data[0].schematic.page[0].uuid,
pcb: p.data[0].pcb.uuid
};
```
```shell
easyeda-pro invoke --session $S --ext-uuid eda --code "$(cat step1_create_proj.js)"
```
```json
{
"ok": true,
"value": {
"uuid": "5d3ca5e2…",
"board": "Board1",
"schematic": "Schematic1",
"page": "429e4af1f4a665c3",
"pcb": "509258b8ebfffb42"
},
"logs": [],
"durationMs": 2611
}
```
Once the project is created, the following files appear on disk:
```
projects/MyBoard/
├── MyBoard.eprj3
├── sch/Schematic1/P1.esch2
├── sch/Schematic1/Schematic1.ecfg
├── pcb/PCB1.epcb2
└── panel/Panel1.epan2
```
### III. Searching for Devices
[`LIB_LibrariesList.getSystemLibraryUuid()`](../reference/pro-api.lib_librarieslist.getsystemlibraryuuid) returns the system library UUID, and [`LIB_Device.search()`](../reference/pro-api.lib_device.search) searches for devices inside a library:
```javascript
// step2_search.js
const sysLib = await eda.lib_LibrariesList.getSystemLibraryUuid();
const items = await eda.lib_Device.search('0603WAF1001T5E');
return {
systemLibrary: sysLib,
first: {
name: items[0].name,
uuid: items[0].uuid,
lcsc: items[0].supplierId,
libraryUuid: items[0].libraryUuid
}
};
```
```json
{
"ok": true,
"value": {
"systemLibrary": "0819f05c4eef4c71ace90d822a990e87",
"first": {
"name": "0603WAF1001T5E",
"uuid": "18db11499a04403ba8c98e2f7a687fbc",
"lcsc": "C21190",
"libraryUuid": "0819f05c4eef4c71ace90d822a990e87"
}
},
"durationMs": 7282
}
```
::: tip
In semi-offline mode the system library is fully available. It contains a large number of real devices with LCSC part numbers, footprints, and 3D models, and the return value of `search()` can be fed directly into the placement APIs.
:::
The devices used in this example are:
| Device | LCSC part number | Description |
| --- | --- | --- |
| `0603WAF1001T5E` | C21190 | 1kΩ 0603 |
| `0603WAF1002T5E` | C25804 | 10kΩ 0603 |
| `CC0603KRX7R9BB104` | C14663 | 100nF 0603 |
### IV. Placing Components
First open the schematic page with [`DMT_EditorControl.openDocument()`](../reference/pro-api.dmt_editorcontrol.opendocument), then place components with [`SCH_PrimitiveComponent.create()`](../reference/pro-api.sch_primitivecomponent.create).
The recommended approach is to read a snapshot of the component properties right after `create()`, then write `designator` and `otherProperty` back together in a single [`SCH_PrimitiveComponent.modify()`](../reference/pro-api.sch_primitivecomponent.modify) call. That way the designator and all device properties are set in one pass:
```javascript
// step3_place.js
const pageUuid = '429e4af1f4a665c3'; // the page returned by the previous step
await eda.dmt_EditorControl.openDocument(pageUuid);
await new Promise((r) => setTimeout(r, 2500));
const LIB = '0819f05c4eef4c71ace90d822a990e87';
const R1K = { libraryType: '3', libraryUuid: LIB, uuid: '18db11499a04403ba8c98e2f7a687fbc' };
const R10K = { libraryType: '3', libraryUuid: LIB, uuid: 'b948db94476e4027ac8953235755ec96' };
const C100 = { libraryType: '3', libraryUuid: LIB, uuid: '96b39256cc3f4d80bd3b503deb4f3328' };
const out = [];
for (const [ref, lib, x, y] of [
['R1', R1K, 400, 610],
['R2', R10K, 400, 510],
['C1', C100, 650, 510],
['R3', R1K, 150, 610]
]) {
// 1. Place the component (coordinates are in 10mil; rotation is the API angle)
const c = await eda.sch_PrimitiveComponent.create(lib, x, y, undefined, 90, false, true, true);
const id = c.getState_PrimitiveId();
// 2. Read the property snapshot first
const pre = (await eda.sch_PrimitiveComponent.get(id)).getState_OtherProperty();
// 3. Write the designator and properties back in one call
await eda.sch_PrimitiveComponent.modify(id, { designator: ref, otherProperty: pre });
// 4. Read the absolute pin coordinates for later wiring
const pins = await eda.sch_PrimitiveComponent.getAllPinsByPrimitiveId(id);
out.push({
ref,
id,
value: pre.Value,
pins: pins.map((p) => ({ n: p.pinNumber, x: p.x, y: p.y }))
});
}
return out;
```
```json
{
"ok": true,
"value": [
{
"ref": "R1",
"id": "4dc7d7c4967a383f",
"value": "1kΩ",
"pins": [
{ "n": "2", "x": 400, "y": 590 },
{ "n": "1", "x": 400, "y": 630 }
]
},
{
"ref": "R2",
"id": "054e84ce1932ae79",
"value": "10kΩ",
"pins": [
{ "n": "2", "x": 400, "y": 490 },
{ "n": "1", "x": 400, "y": 530 }
]
},
{
"ref": "C1",
"id": "6942169cfa200a6f",
"value": "100nF",
"pins": [
{ "n": "1", "x": 650, "y": 530 },
{ "n": "2", "x": 650, "y": 490 }
]
},
{
"ref": "R3",
"id": "3acfabe56d603ec8",
"value": "1kΩ",
"pins": [
{ "n": "2", "x": 150, "y": 590 },
{ "n": "1", "x": 150, "y": 630 }
]
}
]
}
```
::: tip
Each component should be `create()`d first and then have its pin coordinates read back with [`SCH_PrimitiveComponent.getAllPinsByPrimitiveId()`](../reference/pro-api.sch_primitivecomponent.getallpinsbyprimitiveid). Do not compute them yourself; the pin coordinates are the only basis for the wiring that follows.
:::
### V. Placing Net Flags
[`SCH_PrimitiveComponent.createNetFlag()`](../reference/pro-api.sch_primitivecomponent.createnetflag) places net flags. The supported types are `Power` `Ground` `AnalogGround` `ProtectGround`:
```javascript
// step4_flags.js
const vcc = await eda.sch_PrimitiveComponent.createNetFlag('Power', 'VCC', 400, 660, 0, false);
const gnd = await eda.sch_PrimitiveComponent.createNetFlag('Ground', 'GND', 650, 410, 0, false);
return {
vcc: vcc.getState_PrimitiveId(),
gnd: gnd.getState_PrimitiveId(),
vccNet: vcc.getState_Net(),
gndNet: gnd.getState_Net()
};
```
```json
{
"ok": true,
"value": {
"vcc": "e6fc4f9698692111",
"gnd": "2535215168c2bb20",
"vccNet": "VCC",
"gndNet": "GND"
}
}
```
### VI. Drawing Wires
[`SCH_PrimitiveWire.create()`](../reference/pro-api.sch_primitivewire.create) draws wires. A wire is an orthogonal polyline; a single `create()` call can draw several segments, but consecutive segments must meet end to end and each segment must be horizontal or vertical:
```javascript
// step5_wire.js
const plan = [
['VCC->R1.1', [[400, 660, 400, 630]]],
['R1.2->R2.1', [[400, 590, 400, 530]]],
['C1.1->MID', [[650, 530, 400, 530]]],
['C1.2->GND', [[650, 490, 650, 410]]],
['R2.2->GND', [[400, 490, 400, 410, 650, 410]]],
['R3.1->VCC', [[150, 630, 150, 660, 400, 660]]],
['R3.2->GND', [[150, 590, 150, 410, 400, 410]]]
];
const made = [];
for (const [tag, line] of plan) {
const w = await eda.sch_PrimitiveWire.create(line);
made.push({ tag, net: w.getState_Net(), id: w.getState_PrimitiveId() });
}
return made;
```
```json
{
"ok": true,
"value": [
{ "tag": "VCC->R1.1", "id": "11b3075f364b1790" },
{ "tag": "R1.2->R2.1", "id": "2d6fcb2792dae43f" },
{ "tag": "C1.1->MID", "id": "2d6fcb2792dae43f" }
]
}
```
::: tip
Adjacent segments are merged by the editor into a single `WIRE` primitive group. This is normal behavior. As long as the coordinates land exactly on the pins, the connection is correct.
:::
### VII. Running a DRC Check
[`SCH_Drc.check()`](../reference/pro-api.sch_drc.check) runs the design rule check. Its parameters are:
| Parameter | Description |
| --- | --- |
| `strict` | Strict mode; currently always pass `true` |
| `userInterface` | Whether to open the bottom DRC panel; pass `false` in scripts |
| `includeVerboseError` | Pass `true` to get an array of violation details, `false` to get only a pass/fail boolean |
```javascript
// step6_drc.js
await eda.sch_Document.save();
await new Promise((r) => setTimeout(r, 8000)); // wait for the editor to refresh
const verbose = await eda.sch_Drc.check(true, false, true); // array of violation details
const passed = await eda.sch_Drc.check(true, false, false); // pass/fail boolean
return {
violationCount: verbose.length,
passed,
violations: verbose.map((v) => v.rule + '(' + v.type + '):' + v.primitives.map((p) => p.name).join('|'))
};
```
```json
{
"ok": true,
"value": {
"violationCount": 0,
"passed": true,
"violations": []
}
}
```
::: tip
Wait 8 to 10 seconds after `save()` before running the DRC check, so the editor can finish its topology computation. That yields the most accurate result.
:::
### VIII. Exporting the Netlist
[`SCH_ManufactureData.getNetlistFile()`](../reference/pro-api.sch_manufacturedata.getnetlistfile) exports a netlist file:
```javascript
// step7_netlist.js
const f = await eda.sch_ManufactureData.getNetlistFile('MyBoard_NET', 'Protel2');
const txt = await f.text();
return { name: f.name, size: f.size, nets: txt.split('\n').slice(-24).join('\n') };
```
```json
{
"ok": true,
"value": {
"name": "MyBoard_NET.net",
"size": 4206,
"nets": "(\nGND \nR2-2 0603WAF1002T5E-2 Input \nC1-2 CC0603KRX7R9BB104-2 Passive \nR3-2 0603WAF1001T5E-2 Input \n)\n(\n$1N2 \nR2-1 …\n)\n(\nVCC \nR3-1 …\nR1-1 …\n)"
}
}
```
The exported netlist matches the design intent exactly, so the connections can be asserted programmatically.
### IX. Exporting the BOM
[`SCH_ManufactureData.getBomFile()`](../reference/pro-api.sch_manufacturedata.getbomfile) exports the BOM, in `csv` or `xlsx` format:
```javascript
// step8_bom.js
const DIR = 'C:/Users/username/Documents/EasyEDA-Pro/projects/MyBoard/';
// CSV (text, can be read back and verified directly)
const csv = await eda.sch_ManufactureData.getBomFile('BOM', 'csv');
const csvText = await csv.text();
await eda.sys_FileSystem.saveFileToFileSystem(DIR + 'BOM.csv', new Blob([csvText], { type: 'text/csv' }), undefined, true);
// XLSX (binary, written straight to disk)
const xlsx = await eda.sch_ManufactureData.getBomFile('BOM', 'xlsx');
const saved = await eda.sys_FileSystem.saveFileToFileSystem(DIR + 'BOM.xlsx', xlsx, undefined, true);
return { csvText, xlsxSize: xlsx.size, saved };
```
```json
{
"ok": true,
"value": {
"csvText": "No.\tQuantity\tComment\tDesignator\tFootprint\tValue\tManufacturer Part\tManufacturer\tSupplier Part\tSupplier\n1\t1\t100nF\tC1\tC0603\t100nF\tCC0603KRX7R9BB104\tYAGEO\tC14663\tLCSC\n2\t2\t1kΩ\tR1,R3\tR0603\t1kΩ\t0603WAF1001T5E\tUNI-ROYAL\tC21190\tLCSC\n3\t1\t10kΩ\tR2\tR0603\t10kΩ\t0603WAF1002T5E\tUNI-ROYAL\tC25804\tLCSC\n",
"xlsxSize": 6893,
"saved": true
}
}
```
R1 and R3, which share the same part number, are merged into one row with a quantity of 2.
### X. Exporting a Screenshot
[`DMT_EditorControl.getCurrentRenderedAreaImage()`](../reference/pro-api.dmt_editorcontrol.getcurrentrenderedareaimage) returns an image of the currently rendered area:
```javascript
// step9_shot.js
const tabId = await eda.dmt_EditorControl.openDocument('429e4af1f4a665c3');
await eda.dmt_EditorControl.zoomToAllPrimitives();
await new Promise((r) => setTimeout(r, 2000));
const blob = await eda.dmt_EditorControl.getCurrentRenderedAreaImage(tabId);
await eda.sys_FileSystem.saveFileToFileSystem('C:/Users/username/Documents/EasyEDA-Pro/projects/MyBoard/sch.png', blob, undefined, true);
return { saved: true, size: blob.size };
```
To export the whole page instead, use [`SCH_ManufactureData.getPngFile()`](../reference/pro-api.sch_manufacturedata.getpngfile) and specify a resolution:
```javascript
const png = await eda.sch_ManufactureData.getPngFile('MySchematic', { width: 1400 });
await eda.sys_FileSystem.saveFileToFileSystem(DIR + png.name, png, undefined, true);
```
### XI. Saving Documents
Schematic and PCB documents are saved through their respective `Document` classes:
```javascript
await eda.sch_Document.save(); // schematic
await eda.pcb_Document.save(); // PCB
```
`.eprj3` is a folder project format that stays in two-way sync with the editor: once the editor saves, the `.esch2` / `.epcb2` files on disk are updated immediately; conversely, if the files on disk are modified directly, the editor re-reads them shortly afterwards.
### XII. Designing the PCB
The PCB side follows a flow similar to the schematic: draw the board outline, import changes from the schematic, auto-place, and autoroute.
```javascript
// step10_pcb.js
const pcbUuid = '509258b8ebfffb42';
// 1. Open the PCB
await eda.dmt_EditorControl.openDocument(pcbUuid);
await new Promise((r) => setTimeout(r, 2500));
// 2. Draw the board outline: EPCB_LayerId.BOARD_OUTLINE = 11
// Using a polyline primitive with explicit vertices is the least error-prone option
const poly = eda.pcb_MathPolygon.createPolygon([40, -340, 'L', 400, -340, 400, -120, 40, -120, 40, -340]);
const outline = await eda.pcb_PrimitivePolyline.create('', 11, poly, 10, false);
// 3. Import changes from the schematic (the GUI equivalent of "Design - Import Changes")
await eda.pcb_Document.importChanges();
await new Promise((r) => setTimeout(r, 5000));
// 4. Auto-place
const layout = await eda.pcb_Document.autoLayout();
// 5. Autoroute
const route = await eda.pcb_Document.autoRouting();
// 6. Zoom to the board outline and take a screenshot
await eda.pcb_Document.zoomToBoardOutline();
const tabId = '509258b8ebfffb42@<project uuid>';
const img = await eda.dmt_EditorControl.getCurrentRenderedAreaImage(tabId);
await eda.sys_FileSystem.saveFileToFileSystem(DIR + 'pcb.png', img, undefined, true);
await eda.pcb_Document.save();
return { outline: outline.getState_PrimitiveId(), layout, route, imgSize: img.size };
```
```json
{
"ok": true,
"value": {
"outline": "24275a39b9fc526f",
"layout": {
"success": true,
"totalComponentsCount": 4,
"successComponentsCount": 4,
"failedComponents": [],
"duration": 974
},
"route": {
"success": true,
"totalNetsCount": 3,
"successNetsCount": 3,
"failedNets": [],
"duration": 1405
},
"imgSize": 124914
}
}
```
[`PCB_Document.autoRouting()`](../reference/pro-api.pcb_document.autorouting) accepts parameters that specify which nets to route:
```javascript
await eda.pcb_Document.autoRouting({ RoutingNets: ['VCC'], optimization: 1 });
```
After routing, run [`PCB_Drc.check()`](../reference/pro-api.pcb_drc.check) to confirm connectivity:
```javascript
const passed = await eda.pcb_Drc.check(true, false, false); // true means everything passed
```
Many more capabilities live in classes such as `DMT_Board`, `PCB_Drc`, and `PCB_ManufactureData`: net classes, differential pairs, equal-length groups, copper pours, Gerber, coordinate files, IPC-2581, ODB++, and interactive BOM export. Browse them one by one with `doc api`.
### XIII. Practical Recommendations
1. Always attach `--ext-uuid eda` to `invoke`, so that the full permission set is granted;
2. Use forward slashes in paths uniformly, and confirm the target is inside the `APP_PROJECT_DIR` directory before writing;
3. When placing components, follow the sequence "`create()` → read the property snapshot → `modify(designator + otherProperty)`", so that the designator and properties are set in one pass;
4. Read pin coordinates with `getAllPinsByPrimitiveId()`; do not compute them yourself;
5. When there are many components, invoke in batches of 20 to 25 and leave headroom in the timeout;
6. After a change, wait 5 to 10 seconds before querying state (DRC / netlist / rendering), to get the final result;
7. Persist the key return value of each step as JSON evidence;
8. On completion, call `save()` and verify the artifacts on disk;
9. Close sessions with `session close --destroy` when they are no longer needed.
## Generating Project Files Directly
Besides operating the editor through the extension API, you can also write `.eprj3` project files directly. The two approaches can be mixed: create the project skeleton with the API, then generate content through files.
### I. Project File Structure
`.eprj3` is a folder-based project format, consisting of one directory plus a number of JSON / plain-text files. It is friendly to Git and to scripts.
```
MyBoard/
├── MyBoard.eprj3 # Project index and metadata (the only file created with the project)
├── sch/ # Schematics, one folder per schematic
│ └── <schematic name>/
│ ├── <page name>.esch2 # Page source
│ ├── <schematic name>.ecfg # Design rules and configuration of that schematic
│ └── <schematic name>.evar # Assembly variants
├── pcb/
│ └── <PCB name>.epcb2 # PCB source
└── panel/
└── <panel name>.epan2 # Panel source
```
The file name is the document name.
### II. Record Format
`.esch2`, `.epcb2`, and `.epan2` share one record format. Each file consists of multiple lines, one JSON record per line:
```
{"type":"<type>","ticket":<logical clock>,"id":"<16 lowercase hex chars>"}||{<payload>}|
```
- The shell and the payload are separated by `||`;
- The line must end with `|` plus a line feed (`LF`, not `CRLF`);
- `type` determines the meaning of the record.
Common types:
| File | Types |
| --- | --- |
| Schematic | `DOCHEAD` `META` `COMPONENT` `ATTR` `WIRE` `LINE` `TEXT` |
| PCB | `DOCHEAD` `META` `COMPONENT` `ATTR` `PAD_NET` `NET` `POLY` `LINE` `LAYER` `RULE` |
### III. Multi-Document Structure
An `.esch2` file does not correspond to a single page. It is a sequence of documents, each starting with a `DOCHEAD`:
```
DOCHEAD docType=SYMBOL uuid=<sheet symbol> ← the sheet (Drawing-Symbol_A4)
DOCHEAD docType=SYMBOL uuid=<device symbol 1> ← the 1kΩ resistor symbol
DOCHEAD docType=SYMBOL uuid=<device symbol 2>
DOCHEAD docType=FOOTPRINT uuid=<footprint 1> ← R0603
DOCHEAD docType=DEVICE uuid=<device 1> ← contains only DOCHEAD and META
...
DOCHEAD docType=BLOB uuid=BLOB
DOCHEAD docType=SCH_PAGE uuid=<page uuid> ← the actual page content
```
The device library (symbols, footprints, devices) is embedded in the same file. `.eprj3` has no separate project library; every device is an independent document inside the file.
It is recommended to keep the write order identical to the order the editor itself emits: `SYMBOL` → `FOOTPRINT` → `DEVICE` → `BLOB` → `SCH_PAGE`.
### IV. Querying the Format Reference
Use `doc format` to query the field definitions of the various design-file records:
```shell
easyeda-pro doc format
easyeda-pro doc format --class-name TMSchComponent
easyeda-pro doc format --class-name TSchAttr
easyeda-pro doc format --class-name TWire
easyeda-pro doc format --class-name TSchLine
```
```json
{
"ok": true,
"value": {
"name": "TMSchComponent",
"comment": "Component (line format of the COMPONENT primitive)",
"fields": [
{ "name": "partId", "type": "TPartId", "required": true },
{ "name": "x", "type": "number", "required": true },
{ "name": "y", "type": "number", "required": true },
{ "name": "rotation", "type": "number", "required": true },
{ "name": "isMirror", "type": "boolean", "required": true },
{
"name": "attrs",
"type": "{ DeviceName: string; Devices: string; FootprintName: string; Footprints: string; SymbolName: string; Symbols: string }",
"required": true
},
{ "name": "zIndex", "type": "null | number", "required": true }
]
}
}
```
::: tip
The field descriptions of `doc format` are quite detailed. Read them field by field before writing a file; that is more reliable than reverse-engineering from a real sample.
:::
Common type mapping:
| What you want to write | Type |
| --- | --- |
| Schematic component instance | `TMSchComponent` |
| Schematic attributes (designator / value / net name, ...) | `TSchAttr` |
| Schematic wire group / single segment | `TWire` / `TSchLine` |
| PCB component instance | `TMPcbComponent` |
| PCB attributes | `TPcbAttr` |
| PCB pad-to-net mapping | `TPadNetWire` |
| PCB trace / board outline polyline | `TPcbLine` / `TPcbPoly` + `TPcbBoard` |
| The various forms of primitive id | `TElementId` / `TSingletonElementId` / `TKeyedElementId` / `TCompositeElementId` |
| PART id | `TPartId` |
### V. Writing Page Content
The example below writes the previously described voltage-divider circuit directly into `P1.esch2`.
#### 1. Creating the Project Skeleton with the API
First create and open the project through the API, to obtain the correct directory structure and avoid writing the index file by hand:
```shell
easyeda-pro open
easyeda-pro invoke --session $S --ext-uuid eda --code "$(cat step1_create_proj.js)"
```
At this point `P1.esch2` contains the A4 sheet `SYMBOL` document, the `DEVICE` documents, the `BLOB` document, and an empty `SCH_PAGE` document.
#### 2. Collecting Library Documents
A symbol document contains a whole set of graphical definitions (`PART` `PIN` `LINE` `POLY` `ATTR`), which is not practical to write by hand. It must come from an actual editor export.
The recommended approach is: place the components once through the API and save, then read the `.esch2` file from disk and take the `SYMBOL` `FOOTPRINT` `DEVICE` document sections verbatim for reuse.
```shell
# Place components through the API and save
easyeda-pro invoke --session $S --ext-uuid eda --code "$(cat place_and_save.js)"
# The file is updated immediately after saving and can be read straight from disk
```
#### 3. Writing the SCH_PAGE Document Section
Only business records are written into the `SCH_PAGE` document section: component instances, attributes, and wires.
```python
# COMPONENT: partId points at the id of the PART row in the SYMBOL document
# the ATTR "Symbol" points at the SYMBOL document uuid, "Device" at the DEVICE document uuid
comp = {
"type": "COMPONENT", "ticket": tk, "id": cid,
"body": {
"partId": "0603WAF1001T5E.1", # id of the PART row in the symbol document
"x": 400, "y": 610,
"rotation": 270, # file angle = (360 - API angle) % 360
"isMirror": False,
"attrs": {"Footprints": "[]", "Devices": "[]", "DeviceName": None,
"FootprintName": None, "pinClass": {}, "differentialPairClass": {},
"Symbols": "[]"},
"zIndex": 4, "yAxisDirection": "up"
}
}
# ATTR: one key-value pair per record, parentId points back at the component
def attr(cid, key, value, x=None, y=None, z=0):
return {"type": "ATTR", "ticket": tk, "id": new_id(), "body": {
"x": x, "y": y, "rotation": 0, "color": None, "fontFamily": None,
"fontSize": None, "fontWeight": None, "italic": None, "underline": None,
"align": None, "value": value, "keyVisible": None, "valueVisible": None,
"key": key, "fillColor": None, "parentId": cid, "zIndex": z,
"yAxisDirection": "up"}}
attrs = [
attr(cid, "Symbol", "c828663d1111a8cf"), # -> SYMBOL document uuid
attr(cid, "Device", "e16440afb3ce936d"), # -> DEVICE document uuid
attr(cid, "Designator", "R1", x=410, y=610, z=2),
attr(cid, "Name", "={Value}", x=410, y=600, z=30),
attr(cid, "Manufacturer", "UNI-ROYAL"),
attr(cid, "Manufacturer Part", "0603WAF1001T5E"),
attr(cid, "Supplier", "LCSC"),
attr(cid, "Supplier Part", "C21190"),
attr(cid, "Value", "1kΩ"),
# remaining attributes omitted
]
# WIRE (wire group) + LINE (single segment)
wire = {"type": "WIRE", "ticket": tk, "id": wid, "body": {"zIndex": 10}}
line = {"type": "LINE", "ticket": tk, "id": new_id(), "body": {
"fillColor": None, "fillStyle": None, "strokeColor": None, "strokeStyle": None,
"strokeWidth": None, "startX": 400, "startY": 630, "endX": 400, "endY": 660,
"lineGroup": wid, "yAxisDirection": "up"}}
```
Three rules apply when writing:
1. `partId` must be the id of the `PART` row in the `SYMBOL` document it references (of the form `0603WAF1001T5E.1`);
2. `id` is a random 16-character lowercase hexadecimal string, unique within the document;
3. `ticket` is unique within the document, and a component's `ticket` must be smaller than the `ticket` of its own attributes.
#### 4. Validating Reference Integrity
Run a static validation before writing to disk:
```python
# every COMPONENT partId must exist as a PART row in some SYMBOL document
part_ids = {rec.id for doc in docs if doc.docType == 'SYMBOL'
for rec in doc.recs if rec.type == 'PART'}
doc_uuids = {d.uuid for d in docs}
for c in components:
assert c.partId in part_ids or c.partId.startswith('pid'), c
a = attrs_of(c)
assert a['Symbol'] in doc_uuids
assert a['Device'] in doc_uuids
# wires: every segment must be orthogonal and lineGroup must point at an existing WIRE
for l in lines:
assert l.startX == l.endX or l.startY == l.endY
assert l.lineGroup in wire_ids
```
#### 5. Writing and Re-verifying
After writing the file into the project directory, wait for the editor to reload, then verify:
```shell
cp build/P1.esch2 "C:\Users\username\Documents\EasyEDA-Pro\projects\MyBoard\sch\Schematic1\P1.esch2"
```
```javascript
// Verification script: object counts + DRC + screenshot
const comps = (await eda.sch_PrimitiveComponent.getAll()).map((c) => c.getState_Designator() || c.getState_ComponentType());
const wires = await eda.sch_PrimitiveWire.getAllPrimitiveId();
const drc = await eda.sch_Drc.check(true, false, false);
await eda.sch_ManufactureData.getPngFile('check', { width: 1400 }); // also export an image
return { comps, wireCount: wires.length, drcPassed: drc };
```
```json
{
"ok": true,
"value": {
"comps": ["sheet", "netflag", "netflag", "R2", "R3", "C1", "R1"],
"wireCount": 3,
"drcPassed": true
}
}
```
The write is only considered complete when the object counts match expectations, the DRC passes, and the screenshot looks correct.
::: tip
Always re-verify the object counts after writing a file by hand. If the count does not match, write the file again; the editor reloads it completely.
:::
### VI. Writing PCB Files
Compared with `.esch2`, `.epcb2` adds one layer: the pad-to-net mapping. Its structure is as follows:
```
SYMBOL × N ← device symbols (for rendering)
FOOTPRINT × N ← footprints (pads are defined here)
DEVICE × N ← devices
PCB ← the board document
├─ board template records: LAYER(60) / LAYER_PHYS / RULE / PREFERENCE / PRIMITIVE / PANELIZE / D3_ATTRIBUTE ...
└─ business records: NET / COMPONENT / ATTR / PAD_NET / POLY (board outline) / LINE (trace)
```
Business records are written like this:
```python
# NET: one record per net
{"type": "NET", "id": '["NET","VCC"]', "body": {"netType": None, "specialColor": None,
"retLine": True, "differentialName": None, "isPositiveNet": False, "equalLengthGroupName": None}}
# COMPONENT: component instance (angles follow the PCB convention)
{"type": "COMPONENT", "id": cid, "body": {
"partitionId": "", "groupId": 0, "layerId": 1, # layerId 1 = top layer
"x": 307.15, "y": -222.71, "angle": 270,
"attrs": {"Reuse Block": "", "Group ID": "", "Channel ID": "$1I5", "Unique ID": "gge1",
"DeviceName": '{"name":"0603WAF1001T5E","source":"","uuid":"<DEVICE uuid>"}'},
"locked": False, "zIndex": -1, "pinSwap": False,
"pinSwapInfo": {cid + "e7": {"pinClass": "", "differentialPairClass": ""},
cid + "e8": {"pinClass": "", "differentialPairClass": ""}},
"footprintPrimitives": True}}
# ATTR: composite id = component id + local id
{"type": "ATTR", "id": cid + "e15", "body": {"parentId": cid, "layerId": 3, "key": "Footprint",
"value": "<FOOTPRINT uuid>"}}
{"type": "ATTR", "id": cid + "e16", "body": {"parentId": cid, "layerId": 3, "key": "Designator",
"value": "R1", "x": 341.16, "y": -165.18, "angle": 270}}
# PAD_NET: pad-to-net mapping (the id is an array literal)
{"type": "PAD_NET", "id": '["PAD_NET","<cid>","2","e7"]',
"body": {"partitionId": "", "padNet": "VCC", "padLen": None, "propagationDelay": None, "attrsMap": {}}}
# POLY: board outline (layerId = 11 = BOARD_OUTLINE)
{"type": "POLY", "id": pid, "body": {"partitionId": "", "groupId": 0, "netName": "",
"layerId": 11, "width": 10, "path": [40, -340, "L", 400, -340, 400, -120, 40, -120, 40, -340],
"locked": False, "zIndex": -1, "polyType": "NORMAL"}}
# LINE: trace
{"type": "LINE", "id": lid, "body": {"partitionId": "", "groupId": 0, "netName": "VCC",
"layerId": 1, "startX": 307.15, "startY": -193.05, "endX": 339.49, "endY": -225.39,
"width": 10, "locked": False, "zIndex": -1}}
```
The relationships between the various ids are as follows:
- The `PAD_NET` id is `["PAD_NET", <component id>, <pad number>, <pad local id>]`, where the last field must match the id of the corresponding `PAD` row in the `FOOTPRINT` document;
- A `pinSwapInfo` key is `<component id><pad local id>`;
- An `ATTR` id is `<component id><local id>`, where the local id reuses the editor's naming such as `e0` `e15` `e16`;
- The board outline `POLY` uses `layerId: 11`.
Recommendations for writing PCB files:
1. Reuse board template records (`LAYER` `RULE` `PREFERENCE` `PRIMITIVE`, ...) exactly as the editor generates them; do not write them by hand;
2. Collect library documents (`SYMBOL` `FOOTPRINT` `DEVICE`) from an editor export;
3. Write business records (`NET` `COMPONENT` `ATTR` `PAD_NET` `POLY` `LINE`) by hand, and validate reference integrity;
4. After writing, verify the component count, the trace count, [`PCB_Net.getAllNetsName()`](../reference/pro-api.pcb_net.getallnetsname), the PCB DRC, and a rendered screenshot.
Besides geometric rules, [`PCB_Drc.check()`](../reference/pro-api.pcb_drc.check) also compares the schematic netlist with the PCB netlist. As long as the components and pad nets on the PCB match the schematic, the comparison passes.
### VII. Practical Recommendations
1. Create the project skeleton through the API (`createProject()` + `openProject()`) to avoid writing the index file by hand;
2. Collect library documents from an editor export, and write business records by hand;
3. Read the relevant types field by field with `doc format` before writing the file;
4. Follow the three writing rules: `partId` points at the `PART` row, `id` is random 16-character hexadecimal, `ticket` is unique within the document;
5. Terminate lines with `|` plus `LF`, and separate the shell from the payload with `||`;
6. Run static validation first (reference integrity, orthogonality, id and ticket uniqueness), then write to disk;
7. Wait 10 to 15 seconds after writing, then verify object counts, DRC, and the screenshot. If the count does not match, write the file again;
8. The two-way sync of `.eprj3` is immediate: once the editor saves, the disk files are updated at once, and they can be read back as the reference answer for a diff.
## Comparison of the Two Approaches
| | Operating through the extension API | Writing `.eprj3` files directly |
| --- | --- | --- |
| Learning curve | Low | Medium (the format reference must be read first) |
| Best suited for | Interactive operation, validation, exports, automated testing | Bulk project generation, code review, Git management, and AI generating projects directly |
| Library documents | Built into the editor, searchable directly | Must be collected from an export |
| Version control | Binary / SQLite formats are unfriendly | Plain text, easy to diff |
The two approaches can be mixed. The recommended flow:
```text
create project (API) → collect library documents (API + read disk) → generate business records (script / program) → write to disk
↓ ↓
verify (API: DRC / netlist / BOM / screenshot) ←───────────────────────────────────────────────── wait for reload
```
## Cheat Sheet
### Commands
| Purpose | Command |
| --- | --- |
| Overview | `easyeda-pro --help` |
| Fuzzy search commands | `easyeda-pro --search <keyword>` |
| Usage of a command | `easyeda-pro <command> --help` |
| Probe the endpoint | `easyeda-pro doctor` |
| Open a window | `easyeda-pro open [--path <project>] [--headless <bool>]` |
| List sessions | `easyeda-pro session list` |
| Close a session | `easyeda-pro session close --session <id> --destroy` |
| List classes | `easyeda-pro doc api` |
| List methods | `easyeda-pro doc api --class-name <class>` |
| Read a method | `easyeda-pro doc api --class-name <class> --method-name <method>` |
| Inspect an enum | `easyeda-pro doc api --class-name <EEnum>` |
| Inspect a format | `easyeda-pro doc format [--class-name <type>]` |
| Execute JS | `easyeda-pro invoke --session <id> --ext-uuid eda --code "…" [--args '<json>'] [--timeout <ms>]` |
| Run as MCP | `easyeda-pro --mcp stdio` / `--mcp http --port 3030` |
### Frequently Used APIs
| Domain | Class | Frequently used methods |
| --- | --- | --- |
| Project | [DMT_Project](../reference/pro-api.dmt_project) | `createProject` `openProject` `getCurrentProjectInfo` |
| Board / drawing | [DMT_Board](../reference/pro-api.dmt_board) [DMT_Schematic](../reference/pro-api.dmt_schematic) [DMT_Pcb](../reference/pro-api.dmt_pcb) | `createBoard` `createSchematic` `getAllBoardsInfo` |
| Editor | [DMT_EditorControl](../reference/pro-api.dmt_editorcontrol) | `openDocument` `zoomToAllPrimitives` `getCurrentRenderedAreaImage` |
| Device library | [LIB_LibrariesList](../reference/pro-api.lib_librarieslist) [LIB_Device](../reference/pro-api.lib_device) | `getSystemLibraryUuid` `search` |
| Schematic primitives | [SCH_PrimitiveComponent](../reference/pro-api.sch_primitivecomponent) | `create` `createNetFlag` `modify` `getAllPinsByPrimitiveId` |
| | [SCH_PrimitiveWire](../reference/pro-api.sch_primitivewire) | `create` `getAll` |
| Schematic checks | [SCH_Drc](../reference/pro-api.sch_drc) [SCH_Netlist](../reference/pro-api.sch_netlist) [SCH_ManufactureData](../reference/pro-api.sch_manufacturedata) | `check` `getNetlistFile` `getBomFile` `getPngFile` |
| Schematic documents | [SCH_Document](../reference/pro-api.sch_document) | `save` `getPrimitiveAtPoint` `getPrimitivesInRegion` |
| PCB primitives | [PCB_PrimitiveComponent](../reference/pro-api.pcb_primitivecomponent) [PCB_PrimitiveLine](../reference/pro-api.pcb_primitiveline) [PCB_PrimitivePolyline](../reference/pro-api.pcb_primitivepolyline) | `create` and others |
| PCB documents | [PCB_Document](../reference/pro-api.pcb_document) | `save` `importChanges` `autoLayout` `autoRouting` `zoomToBoardOutline` |
| PCB checks / exports | [PCB_Drc](../reference/pro-api.pcb_drc) [PCB_ManufactureData](../reference/pro-api.pcb_manufacturedata) [PCB_Net](../reference/pro-api.pcb_net) | `check` `getGerberFile` `get3DFile` `getAllNetsName` |
| Files | [SYS_FileSystem](../reference/pro-api.sys_filesystem) | `saveFileToFileSystem` `readFileFromFileSystem` `listFilesOfFileSystem` |
| Environment | [SYS_Environment](../reference/pro-api.sys_environment) | `isClient` `getEditorCurrentVersion` `getUserInfo` |
### Coordinate Systems and Units
| Domain | Convention |
| --- | --- |
| Schematic | Unit is 10mil; the origin is at the bottom-left corner of the sheet with Y pointing up; A4 is 1170 × 825 |
| PCB | Unit is mil; `layerId` `1` is the top layer and `11` is the board outline layer |
| Angles | The API uses counter-clockwise as positive; in schematic files `COMPONENT.rotation` is `(360 - API angle) % 360`, while on the PCB side `COMPONENT.angle` follows the API angle |
## Full Script Example
The script below chains the procedure above into a complete, runnable example:
```bash
#!/usr/bin/env bash
set -e
L="easyeda-pro"
# 1. Create a session
S=$($L open | python -c "import sys,json;print(json.load(sys.stdin)['value']['sessionId'])")
echo "session = $S"
# 2. Create a project
$L invoke --session $S --ext-uuid eda --code "$(cat step1_create_proj.js)"
# 3. Place components, net flags, and wires
$L invoke --session $S --ext-uuid eda --code "$(cat step3_place.js)"
$L invoke --session $S --ext-uuid eda --code "$(cat step4_flags.js)"
$L invoke --session $S --ext-uuid eda --code "$(cat step5_wire.js)"
# 4. Save, wait for the refresh, run the DRC
$L invoke --session $S --ext-uuid eda --code "await eda.sch_Document.save(); return true;"
sleep 10
$L invoke --session $S --ext-uuid eda --code "$(cat step6_drc.js)"
# 5. Export the netlist, the BOM, and a screenshot
$L invoke --session $S --ext-uuid eda --code "$(cat step7_netlist.js)"
$L invoke --session $S --ext-uuid eda --code "$(cat step8_bom.js)"
$L invoke --session $S --ext-uuid eda --code "$(cat step9_shot.js)"
# 6. Close the session
$L session close --session $S --destroy
```
guide/extensions-marketplace.md
# Extensions Marketplace
EasyEDA Extensions Marketplace site [https://jlcext.com](https://jlcext.com), which is a professional platform for users to download and share extensions.
If you want to learn how to develop extensions, please refer to the [how-to-start](./how-to-start), which describes in detail how to install the development environment and build your own EasyEDA Pro extension from scratch.
## Publishing Your Extension
When you have fully verified the functionality of the extension you have developed and wish to share it with other users, please visit the [EasyEDA Extensions Marketplace](https://jlcext.com/) and click the **Extension Management** button in the upper right corner:

Enter the extension management page, which supports uploading, publishing and versioning of extensions.
Click the **Extension Upload** button to upload your first extension that meets the following requirements:
1. The extension `extension.json` should contain the following attributes: `name`, `uuid`, `displayName`, `description`, `version`, and `license`;
2. select and fill in at least one or more of the required extension types (`categories`);
3. the extension must provide a custom icon and must not use the default `logo` provided in the SDK, the recommended icon size ratio is `1:1`, the format must be PNG or JPEG, the content must be clear without risk of infringement, and the file size must not exceed `5 MiB`;
4. make sure that the entry file (`entry`) of the extension exists and is valid;
5. the value of the `name` attribute must not be duplicated across extensions with different `uuid`;
6. include a detailed description of the extension's functionality and usage in the `README.md` file;
7. if necessary, keep an change log for the extension in the `CHANGELOG.md` file;
8. the extension **DOESN'T** contain private information, such as your phone numbers.

Select your compiled `.eext` file in the upload pop-up window and upload it. The first uploaded extension will automatically create a namespace into which all subsequent uploads of the extension (identified by `uuid`) will be grouped.
You can view the extension's name, description, version, install count, updated time, and other information on the namespace cover:

After the extension is uploaded, it will automatically enter the review process. After approval, it will be listed in the marketplace:

After waiting for the review to complete, the review status will change to **Passed**. If there is a case that the review is not passed, please check the reason in the message notification in time and check the non-compliant content in the extension:

After approval, other users will be able to view your extension details and download the uploaded version:

You can view the extension's detail page, where the `README.md` and `CHANGELOG.md` contents of the extension file will be displayed:

All published versions of the extension are listed in the history:

You can leave ratings and reviews of the extension in the comments section:

You can also downgrade the namespace of an extension at any time on the extension management page. This does not affect the status of uploaded versions, and you can also individually unpublish a specific version in the versioning management.
guide/i18n.md
# Multi-language Support
## Multi-language Configuration
The extension supports multi-language configuration, you can create a `<IANA Language Tags>.json` file in the `./locales/` folder, you can create a `<IANA language tag>.json` file, which will be automatically associated with the corresponding language and called when appropriate.
::: code-group
```json [zh-Hans.json]
{
"Enter": "确定",
"Cancel": "取消"
}
```
```json [en.json]
{
"Enter": "Enter",
"Cancel": "Cancel"
}
```
:::
If you need to get all the language labels supported by the current extension, you can call the [SYS_I18n.getAllSupportedLanguages()](../reference/pro-api.sys_i18n.getallsupportedlanguages) method, which will return an array of strings.
::: warning
Note that if your extension has two or more languages, it must include at least one of `en` or `zh-Hans` as a fallback language, otherwise you may encounter unexpected display errors.
:::
## Use of Multiple Languages within the Code
To use a multilingual system to display different text in different language environments, use the [SYS_I18n.text()](../reference/pro-api.sys_i18n.text) method.
[SYS_I18n.text()](../reference/pro-api.sys_i18n.text) method has a mandatory argument `tag`, which corresponds to the key name in the multilingual file, and the key value matched by that key name is the final displayed text.
You can specify the `namespace` parameter as the `uuid` of other extensions to call the multilingual configuration of other extensions.
Currently, EasyEDA Professional only supports a few languages by default, while the extension API supports a lot of additional languages, you can use the `language` parameter to adapt more languages for your extension, but you need to design your own logic and method to switch languages.
When translating a language, it is very likely that we will encounter a situation where we need to embed parameters into the text, because the syntax of each language is different and the position of the parameters in the text of the language may vary greatly, you can use a placeholder in the `${1}` format to indicate the parameters that need to be embedded and pass the parameters into the `arg` of the [SYS_I18n.text()](../reference/pro-api.sys_i18n.text) method within `arg`, so that when the specified text is displayed, the corresponding argument will be embedded in the text at the specified location.
::: tip
Language priority: current display language > system default language > the first language in the dataset that contains the text tag > text label (tag)
In addition to the above steps, you may need to know other [SYS_I18n](../reference/pro-api.sys_i18n) APIs to work more freely with multilingual content.
:::
## Translating Fields in extension.json
If you need to translate fields in `extension.json`, create a `<IANA language tag>.json` file in the `./locales/extensionJson/` folder.
Within that file, each `key` must be a `value` from `extension.json`, and each `value` in the translation file is the translated result.
guide/index.md
# What is Extension API?
EasyEDA Professional Extension API (hereinafter referred to as "Extension API") is a set of JS API interfaces built on the front-end, which is used to develop various custom functions of EasyEDA Professional Editor. In short, the Extension API uses the basic syntax of JavaScript to write source code that highly encapsulates many EasyEDA Pro features and algorithms, together with a comprehensive [SDK](./ancillary-projects/easyeda-api-sdk), [type constraints](./ancillary-projects/pro-api-types), the development of custom extensions can be completed with very little effort, effectively reducing the mental burden on developers and designers.
Next, you can go to the [How to Get Started](./how-to-start) section to learn how to install the environment from scratch and build your own EasyEDA Pro Edition extension.
If you are an extension user, see the [Getting and Using Extensions](../user-guide/using-extension) section.
guide/how-to-start.md
# How to Get Started <Badge type="tip" text="Intro" />
::: tip For AI coding assistants: initializing an extension project
If you are using an AI coding assistant (such as Claude Code, OpenCode, QwenCode, GitHub Copilot, etc.) to help initialize an extension project, ask the AI to follow the [For AI initialization document](https://prodocs.easyeda.com/storage/texts/api/guide/how-to-start-for-ai.md). That document removes GUI steps and is written for AI-driven execution, while this document is intended for human developers.
You can also copy the prompt below directly to your AI coding assistant:
```text
Please help me initialize a new EasyEDA Pro extension project as follows:
1. Strictly follow the steps in https://prodocs.easyeda.com/storage/texts/api/guide/how-to-start-for-ai.md;
2. Confirm the extension information with me first (name, displayName, description, publisher, license, and project purpose);
3. Verify the result after each key command, then report the path of the .eext artifact and the follow-up steps required to import it into EasyEDA Pro.
```
:::
In the EasyEDA Professional extension engine, all extensions are independent JavaScript scripts running under their own scope chains.
Each extension requires a UUID as the uniquely identifiable name of the extension, and this UUID exists in two cases:
1. the extension has been included and referenced from the EasyEDA Pro Extension Store, or the extension developer has requested a UUID for the extension and filled in the `uuid` field in `extension.json`, in this case, the UUID is an auto-generated 32-bit string, and you can find it on the Extension Store page for the extension;
2. if the extension is not included and does not fill in the `uuid` field, then the UUID is the `name` field defined by the extension developer in `extension.json`, please be careful about using this field as the name of the extension's interdependent references as it is always variable and may be renamed.
::: info
If you are using [easyeda-api-sdk](./ancillary-projects/easyeda-api-sdk), a new UUID will be automatically generated for you the first time you run `npm run build`.
If you wish to build the full development environment manually, you can also safely use <code id="generatedUuid"></code> as the UUID for the new extension, which is randomly generated when you visit the current page.
:::
All user extensions run locally on the client, which means you can write them in JavaScript according to the [ECMAScript Next](https://262.ecma-international.org/) specification, but note that in the main thread, there are limitations on accessing the DOM, external requests, local file system, and other browser APIs. However, it should be noted that in the main thread, calls to the DOM, external requests, local filesystem, and other browser APIs will be limited, and we will provide predefined interfaces in the extension APIs to address the need for this type of access.
::: tip
EasyEDA offers a wide range of extension examples, allowing users to view the source code and compile it for use:
Extensions source code: [https://github.com/easyeda](https://github.com/easyeda)
Extensions marketplace : [https://jlcext.com/](https://jlcext.com/)
:::
## Development Environment (Computer)
In order to facilitate the environment configuration, we provide [easyeda-api-sdk](https://gitee.com/jlceda/easyeda-api-sdk), and we recommend all developers to use this SDK for development, and this document will be based on this SDK to explain. You can get and configure the SDK environment in the following ways:
### I. Install Visual Studio Code
Visual Studio Code is the most recommended IDE for novice developers, hereafter referred to as **VSCode**, and you can download it from its [official website](https://code.visualstudio.com/#alt-downloads).
If you don't understand the difference between the versions, please download the version indicated in the figure below (Windows System Installer x64):

### II. Install Git
Git is the recommended tool for pulling SDKs, and you can download it from its [official website](https://git-scm.com/download).
On the right side of the official download page, click `Download for Windows`:

### III. Install Node.js
Node.js is the runtime software necessary to build TypeScript natively, and you can download it from its [official website](https://nodejs.org/en/download/prebuilt-installer).
The official download page is a guided interactive page, so if you don't need it, just follow the instructions below:
I want `Current` version of Node.js for `Windows` running `x64`
Then click the `Download Node.js` button to download the Node.js installer.
::: warning
If you wish to use a customized version of Node.js, make sure it is no lower than `20.5.0`, which is the minimum version required for this project.
:::
::: tip
You can check the version of Node.js you have installed by typing `node -v` in the console, if the version is lower than `20.5.0`, follow the steps above to install Node.js.
:::
### IV. Getting SDK Locally
Now you can choose either of the following two ways to get the SDK, you can choose one according to your preference:
::: details Initialize using npx command
1. Before you start, you need to first create a subfolder on your local disc where you will keep all your development materials. For example, you can create a subfolder named `easyeda-extension` under the `D:` disc.
::: warning
Please try not to include `spaces` `non-ASCII characters` in the path to avoid surprises in subsequent operations.
:::
2. Once created, open the Windows PowerShell tool (right-click on the `Windows Logo Key` and select the `Windows PowerShell (Administrator)` option).
3. Navigate within Windows PowerShell to the folder you just created, in this case the `D:\easyeda-extension` folder, and execute `cd "D:\easyeda-extension"`:

::: tip
The double quotes `""` here are half-width characters, and they cannot be omitted when the path contains `spaces`.
:::
4. Execute the following command:
```shell
npx github:easyeda/easyeda-api-sdk my-extension
```
:::
::: details Initialize using git command
1. Before you start, you need to first create a subfolder on your local disc where you will keep all your development materials. For example, you can create a subfolder named `easyeda-extension` under the `D:` disc.
::: warning
Please try not to include `spaces` `non-ASCII characters` in the path to avoid surprises in subsequent operations.
:::
2. Once created, open the Windows PowerShell tool (right-click on the `Windows Logo Key` and select the `Windows PowerShell (Administrator)` option).
3. Navigate within Windows PowerShell to the folder you just created, in this case the `D:\easyeda-extension` folder, and execute `cd "D:\easyeda-extension"`:

::: tip
The double quotes `""` here cannot be omitted when the path contains `spaces`.
:::
4. Depending on your network environment, execute one of the following commands:
```shell
git clone --depth=1 https://github.com/easyeda/easyeda-api-sdk.git my-extension
```
:::
### V. Get VS Code Extension
1. First you need to start VS Code and open the folder of the project you pulled in the previous stage inside it (e.g. `D:\easyeda-extension\my-extension`).

2. Then switch to the Extensions page (shortcut <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>X</kbd>) and search for and install the following apps in the search box at the top:
1. `Code Spell Checker` by Street Side Software
2. `ESLint` by Microsoft
3. `EditorConfig for VS Code` by EditorConfig

3. All extensions are pre-configured within the SDK and saved in their corresponding configuration files, and you don't need to do any additional configuration on them unless you understand what you're doing.
## Build the First EasyEDA Professional Extension
### I. List of Files
The SDK comes pre-configured with all the necessary components of the development environment, so you can refer to the following list of files to see what each one does:
```
├───.husky Auto Script Directory
├───.vscode VS Code Configuration File Directory
│ ├───extensions.json Recommended Extensions
│ └───settings.json Extension Configuration
├───build Extension Pack Compilation Directory
│ ├───dist Extension Pack Compilation Result Directory
│ └───packaged.ts Compile Scripts
├───config ESBuild Configuration Directory
├───dist Compilation Results Directory
├───iframe IFrame Inline Frame Directory
├───images Extension Preview Image Directory
│ ├───banner.png Extension Banner Image
│ └───logo.png Extension Logo Image
├───locales Extended Multilingual Directory
│ ├───en.json English Language Translation File
│ └───zh-Hans.json Simplified Chinese Language Translation File
├───node_modules NPM Dependency Module Directory
├───src Extension's Main Source Code Directory
├───.edaignore EDA Ignore File Configuration
├───.editorconfig Editor Base Format Configuration
├───.eslintrc.js ESLint Automatic Code Constraint Configuration
├───.gitattributes Git Attribute Configuration
├───.gitignore Git Ignores File Configuration
├───.prettierignore Prettier Ignores File Configuration
├───.prettierrc.js Prettier Auto Format Configuration
├───LICENSE Open Source License
├───README.md Project Introduction
├───extension.json EasyEDA Professional Extension Configuration
├───package.json NPM Package Configuration
├───package-lock.json NPM Package Dependency Locking Configuration
└───tsconfig.json TypeScript Compilation Configuration
```
### II. Extension Configuration
EasyEDA Professional has a custom configuration file, i.e. `extension.json` file in the root directory of the SDK, the contents of which will be fully read by EasyEDA Professional and will be shown in the display and running process of the extension package, the following is the default contents of this file:
<<< @/private/easyeda-api-sdk/extension.json{2,4-5,7,11 json}
Now, we only need to change a few of the key values:
| Property | Type | Example | Description |
| ----------- | -------- | ------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
| name | `string` | `run-api-gateway` | Extension name. It can only contain lowercase English letters `a-z`, digits `0-9`, and hyphens `-`, and must be `5-30` characters long. |
| displayName | `string` | `Run API Gateway` | Display name. It can be in Chinese. |
| description | `string` | `Provides WebSocket gateway bridging for AI coding tools` | Description. |
| publisher | `string` | `JLCEDA` | Developer information. |
| license | `string` | `Apache-2.0` | Open-source licensing terms. It is recommended to go to [Choose a License](https://choosealicense.com/) to select the appropriate open source license for your project. |
### III. Initialization Environment
Initializing the environment and starting the build are very simple single commands, in order to execute these commands you first need to start a VS Code terminal:

The terminal will appear below by default, and you can execute all the next commands from within the terminal. Now, we need to initialize the environment for the SDK project, including installing all the dependent libraries, initializing the runtime hooks, and more things that can be automated, and you'll need to execute the following commands from within the terminal:
```shell
npm install
```
::: tip
If you encounter an error like this:
```
File C:\example.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
```
You need to run the following command in PowerShell with administrator privileges:
```powershell
Set-ExecutionPolicy RemoteSigned
```
This changes the execution policy to allow script execution. It is required to run NPM via Node.js on the device, but be aware that changing the execution policy may affect the security of the system.
If you are developing within an organization, you may need to consult your IT department, because the organization may have its own security policies.
:::
### IV. Modify the Code File
In the default environment provided by the SDK, your entry code file is `/src/index.ts`.
If the file has the same suffix, we highly recommend and support writing EasyEDA Pro extensions in TypeScript by default, relying on the type system provided by TypeScript and our [pro-api-types](https://www.npmjs.com/package/@jlceda/pro-api-types) type definition file, you can easily get complete support for type inference and syntax hints.
::: info
If you still want to code in native JavaScript, you can rename `/src/index.ts` to `/src/index.js` and remove anything inside that doesn't conform to JavaScript syntax.
:::
### V. Build
After each code change, you should perform a build to get the latest extension package, and you may need to change the version number within the `extension.json` file before doing the build:
| Property | Type | Description |
| -------- | -------- | ------------------------------------------------ |
| version | `string` | Semantic version number in `major.minor.patch` format |
Then, execute the following command in the terminal to build the extension package:
```shell
npm run build
```
The extension packages you build will be generated in the `/build/dist/` directory.
::: tip
The build will read the `.edaignore` file in the root directory, which controls what will be excluded from the package at build time, and has the same syntax as `.gitignore`.
:::
## Import Extensions to EasyEDA Pro
The import operation currently has a different location:
::: details EasyEDA Pro V2
**Top Menu Bar** -\> **Settings** -\> **Extensions** -\> **Extension Manager...** -\> **Import Extensions**

Import the `.eext` file you generated in the `/build/dist/` directory during the last build.
:::
::: details EasyEDA Pro V3
**Top Menu Bar** -\> **Advanced** -\> **Extension Manager...** -\> **Import**

Import the `.eext` file you generated in the `/build/dist/` directory during the last build.
:::
<script setup>
import { onMounted } from 'vue'
onMounted(() => {
document.getElementById('generatedUuid').innerHTML = crypto.randomUUID().replaceAll('-', '');
})
</script>
guide/invoke-apis.md
# Invoking the Extension API
## Invoke Method
There are many classes under the EasyEDA Pro Extension API module, all **Classes**, **Enumerations**, **Interfaces**, **Type Aliases** are registered under the `EDA` base class by default and have been instantiated as [eda](../reference/pro-api.eda) object exists in the root scope of every extension runtime, and you can access it directly through the `eda` object.
All extension's runtime get a separate `eda` object, which is not shared with other extensions. You can output this object on the console in [Debug Mode](#entering-debug-mode) within an extension (or in [Standalone Script](#debugging-with-standalone-scripting)) using the following code:
```javascript
console.log('[DEBUG] eda:', eda);
```
Standard extension API calls require the splice **eda** + **class instance object name** + **method name / variable name**. The object names corresponding to classes instantiated in the system are in the form of the first three letters of the underscore in lowercase, for example:
| Class Name | Class Instance Object Name |
| ---------------- | -------------------------- |
| SYS_I18n | sys_I18n |
| SYS_ToastMessage | sys_ToastMessage |
The following example calls the `text` method under the `SYS_I18n` class and the `showMessage` method under the `SYS_ToastMessage` class:
```typescript {2}
// Note that the `sys` in `sys_I18n` is lowercase because we need to use the object name when calling the
eda.sys_ToastMessage.showMessage(eda.sys_I18n.text('Done'), ESYS_ToastMessageType.INFO);
const t = eda.sys_I18n.text; // Assign `eda.sys_I18n.text` method to `t`
eda.sys_ToastMessage.showMessage(t('Done'), ESYS_ToastMessageType.INFO); // This will give you exactly the same result as line 2
```
## Commissioning Methods
### Entering Debug Mode
You can add the `cll=debug` parameter within the URL of the EasyEDA Pro editor to enter debug mode:
```diff
- https://pro.easyeda.com/editor
+ https://pro.easyeda.com/editor?cll=debug
```
Then press <kbd>F12</kbd> three times in quick succession to open the developer tools. Switch to the Console tab to output debugging information.
::: tip
If you are using the desktop client, you can press <kbd>F12</kbd> three times in quick succession to open the developer tools, then enter the following in the console:
```javascript
window.location.href = 'https://client/editor?cll=debug';
```
Then you can enter debug mode.
:::
### Debugging with Standalone Scripting
When using the extension API interface, you need to compile the changes first and upload the compiled result to EasyEDA before you can see the result. If you have some logic that you want to split out for debugging, you can try using the standalone script feature.
::: details EasyEDA Pro V2
Entry: **Top Menu** -\> **Settings** -\> **Extensions** -\> **Standalone Script**

:::
::: details EasyEDA Pro V3
Entry: **Top Menu** -\> **Advanced** -\> **Run Script**

You can use Script Manager to save standalone scripts and run them quickly:

:::
Standalone scripts get a unique, throw-away `eda` object each time they run, so you don't have to worry about contaminating the runtime environment with the results of previous runs. Note, however, that some of the extension API interfaces, such as `SYS_IFrame`, cannot be called from within a standalone script because they use features from extension packages or external interactions.
The standalone script's save feature stores data in the browser's [LocalStorage](https://developer.mozilla.org/docs/Web/API/Window/localStorage) or [IndexedDB](https://developer.mozilla.org/docs/Web/API/IndexedDB_API), which is generally sustainable locally, but please note that this is always insecure, so please backup your own standalone scripts.
guide/inline-frame.md
# Inline Frame Support
In some application scenarios where extensions want to have fully customized windows that are not limited to the popups and controls provided by EasyEDA, we provide a way to build windows using inline frames.
To use inline frames, you need to save all files in the extension's `/iframe/` directory and use [SYS_IFrame.openIFrame()](../reference/pro-api.sys_iframe.openiframe) method to load the specified `html` file as the content of the inline frame.
```typescript
// This example loads the index.html file in the /iframe/ directory with a window of 500px in height and width
eda.sys_IFrame.openIFrame('/iframe/index.html', 500, 500);
```
::: tip
Files can be loaded and indexed without being stored in the `/iframe/` directory, but it is recommended that the `/iframe/` directory be used as the storage directory for inline frame files for a more intuitive organization of the files.
The URI referred to by the `htmlFileName` parameter starts at the root path of the extension package, you can use `/` or start directly with the `iframe/` folder name.
:::
The extension API will automatically read the specified `html` file and other files associated with it, but will not continue to recursively parse it, due to the limitations of our secure resource access rules.
To open multiple IFrame windows within a single extension, specify an ID for each IFrame.
package.json
{
"name": "easyeda-api",
"version": "1.1.43",
"description": "EasyEDA Pro API Skill — WebSocket bridge & API reference",
"type": "module",
"scripts": {
"server": "node scripts/bridge-server.mjs"
},
"dependencies": {
"ws": "^8.21.3"
}
}
package-lock.json
{
"name": "easyeda-api-skill",
"version": "1.1.43",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "easyeda-api-skill",
"version": "1.1.43",
"dependencies": {
"ws": "^8.21.3"
},
"devDependencies": {
"@types/ws": "^8.18.1"
}
},
"node_modules/@types/node": {
"version": "25.5.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.5.0.tgz",
"integrity": "sha512-jp2P3tQMSxWugkCUKLRPVUpGaL5MVFwF8RDuSRztfwgN1wmqJeMSbKlnEtQqU8UrhTmzEmZdu2I6v2dpp7XIxw==",
"dev": true,
"license": "MIT",
"dependencies": {
"undici-types": "~7.18.0"
}
},
"node_modules/@types/ws": {
"version": "8.18.1",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.1.tgz",
"integrity": "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/node": "*"
}
},
"node_modules/undici-types": {
"version": "7.18.2",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.18.2.tgz",
"integrity": "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==",
"dev": true,
"license": "MIT"
},
"node_modules/ws": {
"version": "8.21.3",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.21.3.tgz",
"integrity": "sha512-201TZ/kPWxoPr/OKWjquZR1SWKXcvxdH+e1xrx89b3YbmzLMFCLfnaG1HFIgWzJOEWZ7MvpK++odZufgYR50Rw==",
"license": "MIT",
"engines": {
"node": ">=10.0.0"
},
"peerDependencies": {
"bufferutil": "^4.0.1",
"utf-8-validate": ">=5.0.2"
},
"peerDependenciesMeta": {
"bufferutil": {
"optional": true
},
"utf-8-validate": {
"optional": true
}
}
}
}
}
guide/stability.md
# Interface Stabilization
Our priority in maintaining the extension API is efficient abstraction and interface stability. It's important for users that extensions don't fail to work on a regular basis, and this is especially true and important considering that EasyEDA is currently a rapidly evolving product.
On the other hand, we also want to strike the right balance between delivering new features quickly and maintaining backward compatibility, and here's how we intend to do that.
## API Version Control
Changes to the extension API will be identified as `major.minor.patch`. `major` indicates a major version, `minor` indicates a minor version, and `patch` indicates a fix.
### Major Version
::: info
The EasyEDA Professional Edition Extension API has its own release version number, which is not equivalent to the EasyEDA version number. In general, major updates to the Extension API will follow the major or minor releases of EasyEDA.
:::
Changes to existing APIs that will be made available as major releases may have a noticeable impact on extensions and require the authors of extensions that utilize those APIs to update their code.
This includes changes to the API itself (e.g., removing deprecated methods) or changes to API behavior.
Extensions are not automatically upgraded to these versions, and in order to keep existing extensions working, the EasyEDA Professional API development team is committed to extending the lifecycle of deprecated methods as long as possible.
### Minor Version
New API interfaces and bug fixes will be provided as minor releases, and these new APIs will automatically be available to extensions as soon as they are run in the latest version of EasyEDA.
If there are bugs in the API, we may, at our discretion, release bug fixes as a minor update, depending on whether we feel that certain extensions may break as a result of fixing the bugs. While any change in API behavior could theoretically make extensions work improperly, it would incur a lot of unnecessary additional overhead for extension authors and us to treat every bug fix as a major change.
### Patch
We release a fix update when we fix an urgent new issue, make a minimal change to the API, or even just change the content of the documentation.
We may change the API's TypeScript type definition in the form of a break in the fix update. In the TypeScript world, Type and Script are two different things. As such, changes to Type do not affect existing code or cause breaks in released extensions, and having types that accurately represent the latest state of the API is more important than having perfect backward compatibility because types are easy to update. Typically, type changes only involve renaming certain types.
## APIs for the Development Phase
Development-stage APIs are APIs that are only available when the extension is set to a development version, which allows extension developers to try out new APIs and provide feedback to the EasyEDA Professional Extension API development team on whether the APIs are meeting usage requirements and/or working in any unexpected ways. APIs in development will be prominently identified within the documentation.
references/classes/DMT_Board.md
# DMT\_Board class
Document tree / Board management class
## Signature
```typescript
class DMT_Board
```
## Remarks
Operations related to board management in the currently open project
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[copyBoard(sourceBoardName)](./DMT_Board.md)
</td><td>
</td><td>
Copy Board
</td></tr>
<tr><td>
[createBoard(schematicUuid, pcbUuid)](./DMT_Board.md)
</td><td>
</td><td>
**_(BETA)_** Create Board
</td></tr>
<tr><td>
[deleteBoard(boardName)](./DMT_Board.md)
</td><td>
</td><td>
Delete Board
</td></tr>
<tr><td>
[getAllBoardsInfo()](./DMT_Board.md)
</td><td>
</td><td>
Get all in the project board detailed properties of
</td></tr>
<tr><td>
[getBoardInfo(boardName)](./DMT_Board.md)
</td><td>
</td><td>
Get detailed properties of Board
</td></tr>
<tr><td>
[getCurrentBoardInfo()](./DMT_Board.md)
</td><td>
</td><td>
Get detailed properties of Current board
</td></tr>
<tr><td>
[modifyBoardName(originalBoardName, boardName)](./DMT_Board.md)
</td><td>
</td><td>
Modify Board name
</td></tr>
</tbody></table>
---
## 方法详情
### copyboard
# DMT\_Board.copyBoard() method
Copy Board
## Signature
```typescript
function copyBoard(sourceBoardName: string): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
sourceBoardName
</td><td>
string
</td><td>
Source board name
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
New board name, if it is `undefined` the copy fails
## Example
```javascript
// 1. 取第一块板子的名称作为复制源
const boards = await eda.dmt_Board.getAllBoardsInfo();
const sourceName = boards[0].name;
// 2. 复制板子,返回新板子名称
const newBoardName = await eda.dmt_Board.copyBoard(sourceName);
console.log('source:', sourceName);
console.log('copy:', newBoardName);
// 3. 删除复制的板子,保持工程整洁
const deleted = await eda.dmt_Board.deleteBoard(newBoardName);
console.log('deleted:', deleted);
```
### createboard
# DMT\_Board.createBoard() method
> 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.
Create Board
## Signature
```typescript
function createBoard(schematicUuid?: string, pcbUuid?: string): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
schematicUuid
</td><td>
string
</td><td>
_(Optional)_ Associated schematic UUID
</td></tr>
<tr><td>
pcbUuid
</td><td>
string
</td><td>
_(Optional)_ Associated PCB UUID
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
Board name, if it is `undefined` creation fails
## Example
```javascript
// 1. 无参调用,由系统自动创建一对原理图/PCB 文档并关联
const boardName = await eda.dmt_Board.createBoard();
console.log('create:', boardName);
// 2. 删除新板子(其关联文档是本例新建的,删除不影响其他板子),保持工程整洁
const deleted = await eda.dmt_Board.deleteBoard(boardName);
console.log('deleted:', deleted);
```
### deleteboard
# DMT\_Board.deleteBoard() method
Delete Board
## Signature
```typescript
function deleteBoard(boardName: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
boardName
</td><td>
string
</td><td>
Board name
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
If the specified board does not exist, the API will return `false`<!-- -->, indicating that the operation failed
## Example
```javascript
// 1. 复制一块板子作为删除目标,避免误删工程里有用的板子
const boards = await eda.dmt_Board.getAllBoardsInfo();
const tempName = await eda.dmt_Board.copyBoard(boards[0].name);
console.log('temp board:', tempName);
// 2. 删除该板子
const deleted = await eda.dmt_Board.deleteBoard(tempName);
console.log('deleted:', deleted);
```
### getallboardsinfo
# DMT\_Board.getAllBoardsInfo() method
Get all in the project board detailed properties of
## Signature
```typescript
function getAllBoardsInfo(): Promise<Array<IDMT_BoardItem>>;
```
## Returns
Promise<Array<[IDMT\_BoardItem](../interfaces/IDMT_BoardItem.md)<!-- -->>>
Array of detailed properties of all Board
## Example
```javascript
// 1. 获取工程内所有板子
const boards = await eda.dmt_Board.getAllBoardsInfo();
// 2. 输出每块板子的名称与下属文档
boards.forEach((board, i) => {
console.log(`board[${i}]:`, board.name, 'schematic:', board.schematic?.uuid, 'pcb:', board.pcb?.uuid);
});
console.log('total:', boards.length);
```
### getboardinfo
# DMT\_Board.getBoardInfo() method
Get detailed properties of Board
## Signature
```typescript
function getBoardInfo(boardName: string): Promise<IDMT_BoardItem | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
boardName
</td><td>
string
</td><td>
Board name
</td></tr>
</tbody></table>
## Returns
Promise<[IDMT\_BoardItem](../interfaces/IDMT_BoardItem.md) \| undefined>
Board detailed properties of; if it is `undefined`<!-- -->, the retrieval failed
## Example
```javascript
// 1. 先盘点所有板子,取第一块的名称作为查询目标
const boards = await eda.dmt_Board.getAllBoardsInfo();
const targetName = boards[0].name;
// 2. 按名称查询该板子的详细属性
const board = await eda.dmt_Board.getBoardInfo(targetName);
// 3. 输出板子属性
console.log('name:', board.name);
console.log('parentProjectUuid:', board.parentProjectUuid);
console.log('schematic:', board.schematic?.uuid);
console.log('pcb:', board.pcb?.uuid);
```
### getcurrentboardinfo
# DMT\_Board.getCurrentBoardInfo() method
Get detailed properties of Current board
## Signature
```typescript
function getCurrentBoardInfo(): Promise<IDMT_BoardItem | undefined>;
```
## Returns
Promise<[IDMT\_BoardItem](../interfaces/IDMT_BoardItem.md) \| undefined>
Board detailed properties of; if it is `undefined`<!-- -->, the retrieval failed
## Remarks
It will get the detailed properties of the board associated with the currently open schematic or PCB that has the last input focus
## Example
```javascript
// 1. 切换到第一块板子下属的 PCB 文档(工程里可能存在不属于任何板子的 PCB,不能直接取 getAllPcbsInfo()[0])
const boards = await eda.dmt_Board.getAllBoardsInfo();
await eda.dmt_EditorControl.openDocument(boards[0].pcb.uuid);
await new Promise(r => setTimeout(r, 500));
// 2. 获取当前焦点对应的板子
const board = await eda.dmt_Board.getCurrentBoardInfo();
// 3. 输出板子属性
console.log('name:', board.name);
console.log('schematic:', board.schematic?.uuid);
console.log('pcb:', board.pcb?.uuid);
```
### modifyboardname
# DMT\_Board.modifyBoardName() method
Modify Board name
## Signature
```typescript
function modifyBoardName(originalBoardName: string, boardName: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
originalBoardName
</td><td>
string
</td><td>
Original board name
</td></tr>
<tr><td>
boardName
</td><td>
string
</td><td>
New board name
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether Modify Successful
## Example
```javascript
// 1. 取第一块板子,记录原名称
const boards = await eda.dmt_Board.getAllBoardsInfo();
const originalName = boards[0].name;
const newName = `${originalName}_tmp`;
// 2. 改名并输出结果
const modified = await eda.dmt_Board.modifyBoardName(originalName, newName);
console.log('original:', originalName);
console.log('new:', newName);
console.log('modified:', modified);
// 3. 等待改名生效后改回原名称(改名是异步提交,紧跟的第二次改名会返回 false)
await new Promise(r => setTimeout(r, 1000));
const restored = await eda.dmt_Board.modifyBoardName(newName, originalName);
console.log('restored:', restored);
```
references/_index.md
# EasyEDA Pro API 文档索引
> 此文档由构建脚本自动生成,供 AI 编程工具使用。
> 全局变量 `eda` 是 EDA 类的实例,所有 API 通过 `eda.xxx` 调用。
## 快速导航
- [classes/](classes/) - 类文档(包含全部方法和属性)
- [enums/](enums/) - 枚举文档
- [interfaces/](interfaces/) - 接口文档(包含全部属性)
- [types/](types/) - 类型别名文档
## API 访问方式
所有 API 通过全局变量 `eda` 访问,例如:
- `eda.dmt_Board.createBoard()` — 文档树 / 板子管理
- `eda.pcb_PrimitiveLine.create()` — PCB 直线图元创建
- `eda.sys_WebSocket.register()` — WebSocket 连接注册
- `eda.sch_PrimitiveComponent.create()` — 原理图器件创建
---
# 类 (Classes)
| 类名 | 描述 | 备注 |
|------|------|------|
| [DMT_Board](classes/DMT_Board.md) | Document tree / Board management class | |
| [DMT_EditorControl](classes/DMT_EditorControl.md) | Document tree / Editor control class | |
| [DMT_Event](classes/DMT_Event.md) | Document tree / event class | |
| [DMT_Folder](classes/DMT_Folder.md) | Document tree / Folder class | |
| [DMT_Panel](classes/DMT_Panel.md) | Document tree / Panel management class | |
| [DMT_Pcb](classes/DMT_Pcb.md) | Document tree / PCB management class | |
| [DMT_Project](classes/DMT_Project.md) | Document tree / Project management class | |
| [DMT_Schematic](classes/DMT_Schematic.md) | Document tree / Schematic management class | |
| [DMT_SelectControl](classes/DMT_SelectControl.md) | Document tree / selection control class | |
| [DMT_Team](classes/DMT_Team.md) | Document tree / Team class | |
| [DMT_Workspace](classes/DMT_Workspace.md) | Document tree / Workspace class | |
| [EDA](classes/EDA.md) | EasyEDA Pro user API interface | |
| [IPCB_ComplexPolygon](classes/IPCB_ComplexPolygon.md) | Complex polygon | |
| [IPCB_Polygon](classes/IPCB_Polygon.md) | Single polygon | |
| [IPCB_PrimitiveArc](classes/IPCB_PrimitiveArc.md) | Arc line primitive | |
| [IPCB_PrimitiveAttribute](classes/IPCB_PrimitiveAttribute.md) | Property primitive | |
| [IPCB_PrimitiveComponent](classes/IPCB_PrimitiveComponent.md) | Device primitive | |
| [IPCB_PrimitiveComponentPad](classes/IPCB_PrimitiveComponentPad.md) | Device pad primitive | |
| [IPCB_PrimitiveDimension](classes/IPCB_PrimitiveDimension.md) | Dimension primitive | |
| [IPCB_PrimitiveFill](classes/IPCB_PrimitiveFill.md) | Fill primitive | |
| [IPCB_PrimitiveImage](classes/IPCB_PrimitiveImage.md) | Image primitive | |
| [IPCB_PrimitiveLine](classes/IPCB_PrimitiveLine.md) | Line primitive | |
| [IPCB_PrimitiveObject](classes/IPCB_PrimitiveObject.md) | Binary embedded object primitive | |
| [IPCB_PrimitivePad](classes/IPCB_PrimitivePad.md) | Pad primitive | |
| [IPCB_PrimitivePolyline](classes/IPCB_PrimitivePolyline.md) | Polyline primitive | |
| [IPCB_PrimitivePour](classes/IPCB_PrimitivePour.md) | Copper border primitive | |
| [IPCB_PrimitivePoured](classes/IPCB_PrimitivePoured.md) | Copper fill primitive | |
| [IPCB_PrimitiveRegion](classes/IPCB_PrimitiveRegion.md) | Region primitive | |
| [IPCB_PrimitiveString](classes/IPCB_PrimitiveString.md) | Text primitive | |
| [IPCB_PrimitiveVia](classes/IPCB_PrimitiveVia.md) | Via primitive | |
| [ISCH_PrimitiveArc](classes/ISCH_PrimitiveArc.md) | Arc primitive | |
| [ISCH_PrimitiveAttribute](classes/ISCH_PrimitiveAttribute.md) | Property primitive | |
| [ISCH_PrimitiveBus](classes/ISCH_PrimitiveBus.md) | Bus primitive | |
| [ISCH_PrimitiveCbbSymbolComponent](classes/ISCH_PrimitiveCbbSymbolComponent.md) | Reuse block symbol primitive | |
| [ISCH_PrimitiveCircle](classes/ISCH_PrimitiveCircle.md) | Circle primitive | |
| [ISCH_PrimitiveComponent](classes/ISCH_PrimitiveComponent.md) | Device primitive | |
| [ISCH_PrimitiveComponentPin](classes/ISCH_PrimitiveComponentPin.md) | Device pin primitive | |
| [ISCH_PrimitiveObject](classes/ISCH_PrimitiveObject.md) | Binary embedded object primitive | |
| [ISCH_PrimitivePin](classes/ISCH_PrimitivePin.md) | Pin primitive | |
| [ISCH_PrimitivePolygon](classes/ISCH_PrimitivePolygon.md) | Polygon (polyline) primitive | |
| [ISCH_PrimitiveRectangle](classes/ISCH_PrimitiveRectangle.md) | Rectangle primitive | |
| [ISCH_PrimitiveText](classes/ISCH_PrimitiveText.md) | Text primitive | |
| [ISCH_PrimitiveWire](classes/ISCH_PrimitiveWire.md) | Wire primitive | |
| [LIB_3DModel](classes/LIB_3DModel.md) | Comprehensive library / 3D model class | |
| [LIB_Cbb](classes/LIB_Cbb.md) | Comprehensive library / reuse block class | |
| [LIB_Classification](classes/LIB_Classification.md) | Comprehensive library / library classification index class | |
| [LIB_Device](classes/LIB_Device.md) | Comprehensive library / device class | |
| [LIB_Footprint](classes/LIB_Footprint.md) | Comprehensive library / footprint class | |
| [LIB_LibrariesList](classes/LIB_LibrariesList.md) | Comprehensive library / library list class | |
| [LIB_PanelLibrary](classes/LIB_PanelLibrary.md) | Comprehensive library / panel library class | |
| [LIB_SelectControl](classes/LIB_SelectControl.md) | Comprehensive library / selection control class | |
| [LIB_SimulationModel](classes/LIB_SimulationModel.md) | Comprehensive library / simulation model class | |
| [LIB_Symbol](classes/LIB_Symbol.md) | Comprehensive library / symbol class | |
| [PCB_Document](classes/PCB_Document.md) | PCB & footprint / document operation class | |
| [PCB_Drc](classes/PCB_Drc.md) | PCB & footprint / design rule check (DRC) class | |
| [PCB_Event](classes/PCB_Event.md) | PCB & footprint / event class | |
| [PCB_ImageTool](classes/PCB_ImageTool.md) | PCB 图片工具类 | |
| [PCB_Layer](classes/PCB_Layer.md) | PCB & footprint / layer operation class | |
| [PCB_ManufactureData](classes/PCB_ManufactureData.md) | PCB & footprint / manufacture data class | |
| [PCB_MathPolygon](classes/PCB_MathPolygon.md) | PCB & footprint / polygon math class | |
| [PCB_Net](classes/PCB_Net.md) | PCB & footprint / net class | |
| [PCB_Primitive](classes/PCB_Primitive.md) | PCB & footprint / primitive class | |
| [PCB_PrimitiveArc](classes/PCB_PrimitiveArc.md) | PCB & footprint / arc line primitive class | |
| [PCB_PrimitiveAttribute](classes/PCB_PrimitiveAttribute.md) | PCB & footprint / property primitive class | |
| [PCB_PrimitiveComponent](classes/PCB_PrimitiveComponent.md) | PCB & footprint / device primitive class | |
| [PCB_PrimitiveDimension](classes/PCB_PrimitiveDimension.md) | PCB & footprint / dimension primitive class | |
| [PCB_PrimitiveFill](classes/PCB_PrimitiveFill.md) | PCB & footprint / fill primitive class | |
| [PCB_PrimitiveImage](classes/PCB_PrimitiveImage.md) | PCB & footprint / image primitive class | |
| [PCB_PrimitiveLine](classes/PCB_PrimitiveLine.md) | PCB & footprint / line primitive class | |
| [PCB_PrimitiveObject](classes/PCB_PrimitiveObject.md) | PCB & footprint / binary embedded object primitive class | |
| [PCB_PrimitivePad](classes/PCB_PrimitivePad.md) | PCB & footprint / pad primitive class | |
| [PCB_PrimitivePolyline](classes/PCB_PrimitivePolyline.md) | PCB & footprint / polyline primitive class | |
| [PCB_PrimitivePour](classes/PCB_PrimitivePour.md) | PCB & footprint / copper border primitive class | |
| [PCB_PrimitivePoured](classes/PCB_PrimitivePoured.md) | PCB & footprint / copper fill primitive class | |
| [PCB_PrimitiveRegion](classes/PCB_PrimitiveRegion.md) | PCB & footprint / forbidden region and constrained region primitive class | |
| [PCB_PrimitiveString](classes/PCB_PrimitiveString.md) | PCB & footprint / text primitive class | |
| [PCB_PrimitiveVia](classes/PCB_PrimitiveVia.md) | PCB & footprint / via primitive class | |
| [PCB_RayTracerEngine](classes/PCB_RayTracerEngine.md) | PCB & footprint / ray tracer engine class | |
| [PCB_SelectControl](classes/PCB_SelectControl.md) | PCB & footprint / selection control class | |
| [PCB_Tool](classes/PCB_Tool.md) | PCB / 设计工具类 | |
| [PNL_Document](classes/PNL_Document.md) | Panel / document operation class | |
| [SCH_Document](classes/SCH_Document.md) | Schematic & symbol / document operation class | |
| [SCH_Drc](classes/SCH_Drc.md) | Schematic & symbol / design rule check (DRC) class | |
| [SCH_Event](classes/SCH_Event.md) | Schematic & symbol / event class | |
| [SCH_ManufactureData](classes/SCH_ManufactureData.md) | Schematic & symbol / manufacture data class | |
| [SCH_Net](classes/SCH_Net.md) | Schematic & symbol / net class | |
| [SCH_Netlist](classes/SCH_Netlist.md) | Schematic & symbol / netlist class | |
| [SCH_Primitive](classes/SCH_Primitive.md) | Schematic & symbol / primitive class | |
| [SCH_PrimitiveArc](classes/SCH_PrimitiveArc.md) | Schematic & symbol / arc primitive class | |
| [SCH_PrimitiveAttribute](classes/SCH_PrimitiveAttribute.md) | Schematic & symbol / property primitive class | |
| [SCH_PrimitiveBus](classes/SCH_PrimitiveBus.md) | Schematic & symbol / bus primitive class | |
| [SCH_PrimitiveCircle](classes/SCH_PrimitiveCircle.md) | Schematic & symbol / circle primitive class | |
| [SCH_PrimitiveComponent](classes/SCH_PrimitiveComponent.md) | Schematic & symbol / device primitive class | |
| [SCH_PrimitiveObject](classes/SCH_PrimitiveObject.md) | Schematic & symbol / binary embedded object primitive class | |
| [SCH_PrimitivePin](classes/SCH_PrimitivePin.md) | Schematic & symbol / pin primitive class | |
| [SCH_PrimitivePolygon](classes/SCH_PrimitivePolygon.md) | Schematic & symbol / polygon (polyline) primitive class | |
| [SCH_PrimitiveRectangle](classes/SCH_PrimitiveRectangle.md) | Schematic & symbol / rectangle primitive class | |
| [SCH_PrimitiveText](classes/SCH_PrimitiveText.md) | Schematic & symbol / text primitive class | |
| [SCH_PrimitiveWire](classes/SCH_PrimitiveWire.md) | Schematic & symbol / wire primitive class | |
| [SCH_SelectControl](classes/SCH_SelectControl.md) | Schematic & symbol / selection control class | |
| [SCH_SimulationEngine](classes/SCH_SimulationEngine.md) | Schematic & symbol / simulation engine class | |
| [SCH_Utils](classes/SCH_Utils.md) | Schematic & symbol / utility class | |
| [SYS_ClientUrl](classes/SYS_ClientUrl.md) | System / external request class | |
| [SYS_Dialog](classes/SYS_Dialog.md) | System / dialog class | |
| [SYS_Environment](classes/SYS_Environment.md) | System / runtime environment class | |
| [SYS_ExternalApi](classes/SYS_ExternalApi.md) | 外部接口注入管理类 | |
| [SYS_FileManager](classes/SYS_FileManager.md) | System / file manager class | |
| [SYS_FileSystem](classes/SYS_FileSystem.md) | System / file system interaction class | |
| [SYS_FontManager](classes/SYS_FontManager.md) | System / font manager class | |
| [SYS_FormatConversion](classes/SYS_FormatConversion.md) | System / format conversion (Chameleon) class | |
| [SYS_HeaderMenu](classes/SYS_HeaderMenu.md) | System / header menu class | |
| [SYS_Help](classes/SYS_Help.md) | Help 渐进式披露类 | |
| [SYS_I18n](classes/SYS_I18n.md) | System / multilingual class | |
| [SYS_IFrame](classes/SYS_IFrame.md) | System / iframe window class | |
| [SYS_LoadingAndProgressBar](classes/SYS_LoadingAndProgressBar.md) | System / loading and progress bar class | |
| [SYS_Log](classes/SYS_Log.md) | System / log class | |
| [SYS_Math](classes/SYS_Math.md) | System / math class | |
| [SYS_Message](classes/SYS_Message.md) | System / message notification class | |
| [SYS_MessageBox](classes/SYS_MessageBox.md) | System / message box class | |
| [SYS_MessageBus](classes/SYS_MessageBus.md) | System / message bus class | |
| [SYS_PanelControl](classes/SYS_PanelControl.md) | System / panel control class | |
| [SYS_RightClickMenu](classes/SYS_RightClickMenu.md) | System / right-click menu class | |
| [SYS_Setting](classes/SYS_Setting.md) | System / settings class | |
| [SYS_ShortcutKey](classes/SYS_ShortcutKey.md) | System / shortcut key class | |
| [SYS_Storage](classes/SYS_Storage.md) | System / storage class | |
| [SYS_Timer](classes/SYS_Timer.md) | System / timer class | |
| [SYS_ToastMessage](classes/SYS_ToastMessage.md) | System / toast message class | |
| [SYS_Tool](classes/SYS_Tool.md) | System / tool class | |
| [SYS_Unit](classes/SYS_Unit.md) | System / unit class | |
| [SYS_WebSocket](classes/SYS_WebSocket.md) | System / WebSocket class | |
| [SYS_Window](classes/SYS_Window.md) | System / window class | |
---
# 枚举 (Enumerations)
| 枚举名 | 描述 | 备注 |
|--------|------|------|
| [EDMT_EditorDocumentType](enums/EDMT_EditorDocumentType.md) | Editor document type | |
| [EDMT_EditorSplitScreenDirection](enums/EDMT_EditorSplitScreenDirection.md) | Editor split screen direction | |
| [EDMT_EditorTabEventType](enums/EDMT_EditorTabEventType.md) | Editor tab event type | |
| [EDMT_IndicatorMarkerType](enums/EDMT_IndicatorMarkerType.md) | Indicator marker type | |
| [EDMT_ItemType](enums/EDMT_ItemType.md) | Document tree project type | |
| [EDMT_ProjectCollaborationMode](enums/EDMT_ProjectCollaborationMode.md) | Project collaboration mode | |
| [EDMT_ProjectFileFormat](enums/EDMT_ProjectFileFormat.md) | 工程文件格式 | |
| [ELIB_DeviceJlcLibraryCategory](enums/ELIB_DeviceJlcLibraryCategory.md) | EasyEDA SMT library category | |
| [ELIB_LibraryType](enums/ELIB_LibraryType.md) | Comprehensive library library type | |
| [ELIB_PreviewType](enums/ELIB_PreviewType.md) | Preview view type | |
| [ELIB_SimulationModelType](enums/ELIB_SimulationModelType.md) | Simulation model type | |
| [ELIB_SymbolType](enums/ELIB_SymbolType.md) | Symbol type | |
| [EPCB_AutoRoutingCornerStyle](enums/EPCB_AutoRoutingCornerStyle.md) | Auto routing corner style | |
| [EPCB_AutoRoutingExistingPrimitiveMode](enums/EPCB_AutoRoutingExistingPrimitiveMode.md) | How auto routing handles existing wires/vias | |
| [EPCB_AutoRoutingOptimization](enums/EPCB_AutoRoutingOptimization.md) | Auto routing optimization priority | |
| [EPCB_DocumentCanvasUpdateCalculationActiveStatus](enums/EPCB_DocumentCanvasUpdateCalculationActiveStatus.md) | 画布更新计算功能状态 | |
| [EPCB_DocumentRatlineCalculatingActiveStatus](enums/EPCB_DocumentRatlineCalculatingActiveStatus.md) | Document ratline calculation function status | |
| [EPCB_InactiveLayerDisplayMode](enums/EPCB_InactiveLayerDisplayMode.md) | Inactive layer display mode | |
| [EPCB_LayerColorConfiguration](enums/EPCB_LayerColorConfiguration.md) | Layer color configuration | |
| [EPCB_LayerId](enums/EPCB_LayerId.md) | Layer ID | |
| [EPCB_LayerStatus](enums/EPCB_LayerStatus.md) | Layer status | |
| [EPCB_LayerType](enums/EPCB_LayerType.md) | Layer type | |
| [EPCB_MouseEventType](enums/EPCB_MouseEventType.md) | Mouse event type | |
| [EPCB_NetEventType](enums/EPCB_NetEventType.md) | Net event type | |
| [EPCB_PcbPlateType](enums/EPCB_PcbPlateType.md) | PCB plate type | |
| [EPCB_PdfOutputMethod](enums/EPCB_PdfOutputMethod.md) | PDF output method | |
| [EPCB_PrimitiveArcInteractiveMode](enums/EPCB_PrimitiveArcInteractiveMode.md) | Arc interaction mode | |
| [EPCB_PrimitiveDimensionType](enums/EPCB_PrimitiveDimensionType.md) | Dimension type | |
| [EPCB_PrimitiveEventType](enums/EPCB_PrimitiveEventType.md) | Primitive event type | |
| [EPCB_PrimitiveFillMode](enums/EPCB_PrimitiveFillMode.md) | Fill primitive fill mode | |
| [EPCB_PrimitivePadHeatWeldingConnectionMethod](enums/EPCB_PrimitivePadHeatWeldingConnectionMethod.md) | Pad heat welding connection method | |
| [EPCB_PrimitivePadHoleType](enums/EPCB_PrimitivePadHoleType.md) | Pad drilling type | |
| [EPCB_PrimitivePadShapeType](enums/EPCB_PrimitivePadShapeType.md) | Pad shape type | |
| [EPCB_PrimitivePadType](enums/EPCB_PrimitivePadType.md) | Pad type | |
| [EPCB_PrimitivePourFillMethod](enums/EPCB_PrimitivePourFillMethod.md) | Copper fill method | |
| [EPCB_PrimitiveRegionRuleType](enums/EPCB_PrimitiveRegionRuleType.md) | Region primitive region rule type | |
| [EPCB_PrimitiveStringAlignMode](enums/EPCB_PrimitiveStringAlignMode.md) | Text alignment mode | |
| [EPCB_PrimitiveType](enums/EPCB_PrimitiveType.md) | Primitive type | |
| [EPCB_PrimitiveViaType](enums/EPCB_PrimitiveViaType.md) | Via type | |
| [ESCH_DynamicSimulationEnginePullEventType](enums/ESCH_DynamicSimulationEnginePullEventType.md) | Dynamic simulation engine pull event type | |
| [ESCH_DynamicSimulationEnginePushEventType](enums/ESCH_DynamicSimulationEnginePushEventType.md) | Dynamic simulation engine push event type | |
| [ESCH_ExportDocumentFileType](enums/ESCH_ExportDocumentFileType.md) | Export document file type | |
| [ESCH_MouseEventType](enums/ESCH_MouseEventType.md) | Mouse event type | |
| [ESCH_PrimitiveComponentType](enums/ESCH_PrimitiveComponentType.md) | Device type | |
| [ESCH_PrimitiveEventType](enums/ESCH_PrimitiveEventType.md) | Primitive event type | |
| [ESCH_PrimitiveFillStyle](enums/ESCH_PrimitiveFillStyle.md) | Fill style | |
| [ESCH_PrimitiveLineType](enums/ESCH_PrimitiveLineType.md) | Line type | |
| [ESCH_PrimitivePinShape](enums/ESCH_PrimitivePinShape.md) | Pin shape | |
| [ESCH_PrimitivePinType](enums/ESCH_PrimitivePinType.md) | Pin type | |
| [ESCH_PrimitiveTextAlignMode](enums/ESCH_PrimitiveTextAlignMode.md) | Text alignment mode | |
| [ESCH_PrimitiveType](enums/ESCH_PrimitiveType.md) | Primitive type | |
| [ESCH_SimulationNetlistType](enums/ESCH_SimulationNetlistType.md) | Simulation netlist type | |
| [ESCH_SpiceSimulationEnginePullEventType](enums/ESCH_SpiceSimulationEnginePullEventType.md) | Spice simulation engine pull event type | |
| [ESCH_SpiceSimulationEnginePushEventType](enums/ESCH_SpiceSimulationEnginePushEventType.md) | Spice simulation engine push event type | |
| [ESYS_BottomPanelTab](enums/ESYS_BottomPanelTab.md) | Bottom panel tab | |
| [ESYS_HeaderMenuEnvironment](enums/ESYS_HeaderMenuEnvironment.md) | Header menu environment | |
| [ESYS_ImportProjectBoardOutlineSource](enums/ESYS_ImportProjectBoardOutlineSource.md) | Import project board outline source | |
| [ESYS_ImportProjectImportOption](enums/ESYS_ImportProjectImportOption.md) | Import project import option | |
| [ESYS_ImportProjectSchematicObjectStyle](enums/ESYS_ImportProjectSchematicObjectStyle.md) | Import project schematic primitive style | |
| [ESYS_ImportProjectViaSolderMaskExpansion](enums/ESYS_ImportProjectViaSolderMaskExpansion.md) | Import project via solder mask extension | |
| [ESYS_LeftPanelTab](enums/ESYS_LeftPanelTab.md) | Left panel tab | |
| [ESYS_LogType](enums/ESYS_LogType.md) | Log type | |
| [ESYS_NetlistType](enums/ESYS_NetlistType.md) | Netlist type | |
| [ESYS_PanelPosition](enums/ESYS_PanelPosition.md) | 面板标签页位置 | |
| [ESYS_PanelTab](enums/ESYS_PanelTab.md) | 面板标签页(不区分标签页所处面板) | |
| [ESYS_RightPanelTab](enums/ESYS_RightPanelTab.md) | Right panel tab | |
| [ESYS_ShortcutKeyEffectiveEditorRange](enums/ESYS_ShortcutKeyEffectiveEditorRange.md) | 快捷键生效页面范围 | |
| [ESYS_ShortcutKeyEffectiveEditorScene](enums/ESYS_ShortcutKeyEffectiveEditorScene.md) | Effective scene range of the shortcut key | |
| [ESYS_StartPageQuickStartItem](enums/ESYS_StartPageQuickStartItem.md) | Start page quick start item | |
| [ESYS_Theme](enums/ESYS_Theme.md) | Theme | |
| [ESYS_ToastMessageType](enums/ESYS_ToastMessageType.md) | Toast message type | |
| [ESYS_Unit](enums/ESYS_Unit.md) | Unit | |
| [ESYS_WindowEventType](enums/ESYS_WindowEventType.md) | Window event type | |
| [ESYS_WindowOpenTarget](enums/ESYS_WindowOpenTarget.md) | Open window context target | |
| [NetportDeviceName](enums/NetportDeviceName.md) | 网络端口符号对应的器件名称 | |
| [SchToolBarDeviceName](enums/SchToolBarDeviceName.md) | 悬浮框特殊符号对应的器件名称 | |
---
# 接口 (Interfaces)
| 接口名 | 描述 | 备注 |
|--------|------|------|
| [BoardProps](interfaces/BoardProps.md) | 分组面板:带标题的可折叠/分组容器 | |
| [BorderConfig](interfaces/BorderConfig.md) | 边框配置 | |
| [ButtonProps](interfaces/ButtonProps.md) | 按钮组件:可点击触发的操作按钮 | |
| [CellClickInfo](interfaces/CellClickInfo.md) | 单元格点击信息 | |
| [CellCoord](interfaces/CellCoord.md) | 单元格坐标(rowKey + colKey 定位一个单元格) | |
| [CheckboxEditConfig](interfaces/CheckboxEditConfig.md) | | |
| [CheckBoxProps](interfaces/CheckBoxProps.md) | 复选框组件:可勾选的状态控件 | |
| [CheckChangeDetail](interfaces/CheckChangeDetail.md) | 勾选变更详情 | |
| [ClipboardCellData](interfaces/ClipboardCellData.md) | 剪贴板单元格数据 | |
| [ClipboardConfig](interfaces/ClipboardConfig.md) | 剪贴板配置 | |
| [ColorPickerProps](interfaces/ColorPickerProps.md) | 颜色拾取组件:复用 Input color 类型,点击弹出内置固定色板,支持预览/应用/手输/清除/默认/关闭 | |
| [ColumnDef](interfaces/ColumnDef.md) | 列定义 | |
| [ColumnEditTrigger](interfaces/ColumnEditTrigger.md) | 编辑触发方式 | |
| [ColumnGroupDef](interfaces/ColumnGroupDef.md) | 列分组:多级表头 | |
| [ColumnResizeConfig](interfaces/ColumnResizeConfig.md) | 列宽拖拽配置 | |
| [ComponentPropsMap](interfaces/ComponentPropsMap.md) | Component name → Props type mapping, serving as the sole source of the `createComponent` generic constraint | |
| [CustomHeaderConfig](interfaces/CustomHeaderConfig.md) | 自定义表头配置(列可见性管理) | |
| [DialogProps](interfaces/DialogProps.md) | 对话框组件:带标题栏、可拖拽缩放的组合弹窗 | |
| [DragSortConfig](interfaces/DragSortConfig.md) | 拖拽排序配置 | |
| [EditingConfig](interfaces/EditingConfig.md) | 编辑配置 | |
| [FilteringConfig](interfaces/FilteringConfig.md) | 筛选配置 | |
| [FixedColumnConfig](interfaces/FixedColumnConfig.md) | 固定列配置(也可通过 ColumnDef.fixed 逐列声明) | |
| [FlexItemProps](interfaces/FlexItemProps.md) | Flex 子项:Flex 布局中的单个子元素 | |
| [FlexProps](interfaces/FlexProps.md) | 布局容器:灵活的 Flex 布局容器 | |
| [GridItemProps](interfaces/GridItemProps.md) | Grid 子项:网格中的单个子元素 | |
| [GridProps](interfaces/GridProps.md) | 布局容器:固定列数的网格布局容器 | |
| [IconProps](interfaces/IconProps.md) | 图标配置:通过 URL 或 CSS class 指定图标 | |
| [IDesignPortal](interfaces/IDesignPortal.md) | Component tree operation contract. | |
| [IDMT_BoardItem](interfaces/IDMT_BoardItem.md) | Board property | |
| [IDMT_BriefProjectItem](interfaces/IDMT_BriefProjectItem.md) | Brief project properties | |
| [IDMT_EditorDocumentItem](interfaces/IDMT_EditorDocumentItem.md) | Editor document object | |
| [IDMT_EditorSplitScreenItem](interfaces/IDMT_EditorSplitScreenItem.md) | Editor split screen property | |
| [IDMT_EditorTabItem](interfaces/IDMT_EditorTabItem.md) | Editor tab | |
| [IDMT_FolderItem](interfaces/IDMT_FolderItem.md) | Folder property | |
| [IDMT_IndicatorMarkerShape](interfaces/IDMT_IndicatorMarkerShape.md) | Indicator marker shape | |
| [IDMT_PanelItem](interfaces/IDMT_PanelItem.md) | Panel property | |
| [IDMT_PcbItem](interfaces/IDMT_PcbItem.md) | PCB property | |
| [IDMT_ProjectItem](interfaces/IDMT_ProjectItem.md) | Project property | |
| [IDMT_SchematicItem](interfaces/IDMT_SchematicItem.md) | Schematic property | |
| [IDMT_SchematicPageItem](interfaces/IDMT_SchematicPageItem.md) | Schematic sheet property | |
| [IDMT_TeamItem](interfaces/IDMT_TeamItem.md) | Team properties | |
| [IDMT_WorkspaceItem](interfaces/IDMT_WorkspaceItem.md) | Workspace properties | |
| [ILIB_3DModelItem](interfaces/ILIB_3DModelItem.md) | 3D model property | |
| [ILIB_3DModelSearchItem](interfaces/ILIB_3DModelSearchItem.md) | Searched 3D model properties | |
| [ILIB_CbbItem](interfaces/ILIB_CbbItem.md) | Reuse block property | |
| [ILIB_CbbSearchItem](interfaces/ILIB_CbbSearchItem.md) | Searched reuse block properties | |
| [ILIB_ClassificationIndex](interfaces/ILIB_ClassificationIndex.md) | Classification index | |
| [ILIB_ClassificationNode](interfaces/ILIB_ClassificationNode.md) | **_(ALPHA)_** 分类树节点(分类无 UUID,以名称为唯一标识) | |
| [ILIB_DeviceAssociationItem](interfaces/ILIB_DeviceAssociationItem.md) | Device associated symbol, footprint property | |
| [ILIB_DeviceExtendPropertyItem](interfaces/ILIB_DeviceExtendPropertyItem.md) | Device extension property | |
| [ILIB_DeviceItem](interfaces/ILIB_DeviceItem.md) | Device property | |
| [ILIB_DevicePropertiesForSearch](interfaces/ILIB_DevicePropertiesForSearch.md) | Device parameters that can be used for precise search | |
| [ILIB_DeviceSearchItem](interfaces/ILIB_DeviceSearchItem.md) | Searched device properties | |
| [ILIB_ExtendLibrary3DModelFunctions](interfaces/ILIB_ExtendLibrary3DModelFunctions.md) | External library 3D model functions | |
| [ILIB_ExtendLibraryCbbFunctions](interfaces/ILIB_ExtendLibraryCbbFunctions.md) | External library reuse block functions | |
| [ILIB_ExtendLibraryClassificationIndex](interfaces/ILIB_ExtendLibraryClassificationIndex.md) | External library classification index | |
| [ILIB_ExtendLibraryDeviceFunctions](interfaces/ILIB_ExtendLibraryDeviceFunctions.md) | External library device functions | |
| [ILIB_ExtendLibraryFootprintFunctions](interfaces/ILIB_ExtendLibraryFootprintFunctions.md) | External library footprint functions | |
| [ILIB_ExtendLibraryFunctions](interfaces/ILIB_ExtendLibraryFunctions.md) | External library functions | |
| [ILIB_ExtendLibraryItem](interfaces/ILIB_ExtendLibraryItem.md) | External library item | |
| [ILIB_ExtendLibraryItemIndex](interfaces/ILIB_ExtendLibraryItemIndex.md) | External library item index | |
| [ILIB_ExtendLibrarySearchProperty](interfaces/ILIB_ExtendLibrarySearchProperty.md) | External library search property | |
| [ILIB_ExtendLibrarySearchResult](interfaces/ILIB_ExtendLibrarySearchResult.md) | External library search result | |
| [ILIB_ExtendLibrarySearchResultDataLine](interfaces/ILIB_ExtendLibrarySearchResultDataLine.md) | External library search result data line | |
| [ILIB_ExtendLibrarySymbolFunctions](interfaces/ILIB_ExtendLibrarySymbolFunctions.md) | External library symbol functions | |
| [ILIB_ExtendLibraryUserIndex](interfaces/ILIB_ExtendLibraryUserIndex.md) | External library user index | |
| [ILIB_FootprintItem](interfaces/ILIB_FootprintItem.md) | Footprint property | |
| [ILIB_FootprintPropertiesForSearch](interfaces/ILIB_FootprintPropertiesForSearch.md) | Footprint parameters that can be used for precise search | |
| [ILIB_FootprintSearchItem](interfaces/ILIB_FootprintSearchItem.md) | Searched footprint properties | |
| [ILIB_LibraryInfo](interfaces/ILIB_LibraryInfo.md) | Library information | |
| [ILIB_LibraryItem](interfaces/ILIB_LibraryItem.md) | Library property | |
| [ILIB_PanelLibraryItem](interfaces/ILIB_PanelLibraryItem.md) | Panel library property | |
| [ILIB_PanelLibrarySearchItem](interfaces/ILIB_PanelLibrarySearchItem.md) | Searched panel library properties | |
| [ILIB_SimulationModelItem](interfaces/ILIB_SimulationModelItem.md) | Simulation model properties | |
| [ILIB_SimulationModelSearchItem](interfaces/ILIB_SimulationModelSearchItem.md) | Searched simulation model properties | |
| [ILIB_SymbolItem](interfaces/ILIB_SymbolItem.md) | Symbol property | |
| [ILIB_SymbolPropertiesForSearch](interfaces/ILIB_SymbolPropertiesForSearch.md) | Symbol parameters that can be used for precise search | |
| [ILIB_SymbolSearchItem](interfaces/ILIB_SymbolSearchItem.md) | Searched symbol properties | |
| [ImageProps](interfaces/ImageProps.md) | 图片组件:展示单张图片 | |
| [InputEditConfig](interfaces/InputEditConfig.md) | | |
| [InputProps](interfaces/InputProps.md) | 输入框组件:支持下拉、搜索、清除、前后缀等多种形态 | |
| [IPCB_AutoLayoutResult](interfaces/IPCB_AutoLayoutResult.md) | Auto layout result | |
| [IPCB_AutoRoutingProps](interfaces/IPCB_AutoRoutingProps.md) | Auto routing props | |
| [IPCB_AutoRoutingResult](interfaces/IPCB_AutoRoutingResult.md) | Auto routing result | |
| [IPCB_BomPropertiesTableColumns](interfaces/IPCB_BomPropertiesTableColumns.md) | BOM column properties and sorting rules | |
| [IPCB_DifferentialPairItem](interfaces/IPCB_DifferentialPairItem.md) | Differential pair properties | |
| [IPCB_DiscretizedPoint](interfaces/IPCB_DiscretizedPoint.md) | Discretized point | |
| [IPCB_DiscretizeOptions](interfaces/IPCB_DiscretizeOptions.md) | Discretization options | |
| [IPCB_EqualLengthNetGroupItem](interfaces/IPCB_EqualLengthNetGroupItem.md) | Equal-length net group properties | |
| [IPCB_LayerItem](interfaces/IPCB_LayerItem.md) | Layer properties | |
| [IPCB_NetClassItem](interfaces/IPCB_NetClassItem.md) | Net class property | |
| [IPCB_NetInfo](interfaces/IPCB_NetInfo.md) | Net property | |
| [IPCB_PadPairGroupItem](interfaces/IPCB_PadPairGroupItem.md) | Pad pair group properties | |
| [IPCB_PadPairMinWireLengthItem](interfaces/IPCB_PadPairMinWireLengthItem.md) | Pad pair minimum wire length properties | |
| [IPCB_PhysicalStackingConfiguration](interfaces/IPCB_PhysicalStackingConfiguration.md) | 物理叠层配置 | |
| [IPCB_Primitive](interfaces/IPCB_Primitive.md) | PCB primitive | |
| [IPCB_PrimitiveAPI](interfaces/IPCB_PrimitiveAPI.md) | PCB primitive API | |
| [IPCB_PrimitivePadHeatWelding](interfaces/IPCB_PrimitivePadHeatWelding.md) | Pad thermal relief optimization parameters | |
| [IPCB_PrimitivePouredPourFill](interfaces/IPCB_PrimitivePouredPourFill.md) | Copper fill region | |
| [IPCB_PrimitiveSolderMaskAndPasteMaskExpansion](interfaces/IPCB_PrimitiveSolderMaskAndPasteMaskExpansion.md) | Solder mask / paste mask expansion | |
| [IPCB_SubstratePhysicalProperties](interfaces/IPCB_SubstratePhysicalProperties.md) | 基板物理属性 | |
| [IRawNet](interfaces/IRawNet.md) | 原始数据 - net | |
| [IRawPureSchematic](interfaces/IRawPureSchematic.md) | 原始数据 - pureSchematic | |
| [IRawSchematic](interfaces/IRawSchematic.md) | 原始数据 - schematic | |
| [IRawWire](interfaces/IRawWire.md) | 原始数据 - wire | |
| [ISCH_DrcError](interfaces/ISCH_DrcError.md) | DRC 错误条目 | |
| [ISCH_DrcErrorPrimitive](interfaces/ISCH_DrcErrorPrimitive.md) | DRC 错误涉及的图元 | |
| [ISCH_ExportPngResolution](interfaces/ISCH_ExportPngResolution.md) | 原理图导出图片分辨率 | |
| [ISCH_NetInfo](interfaces/ISCH_NetInfo.md) | Net property | |
| [ISCH_Primitive](interfaces/ISCH_Primitive.md) | Schematic primitive | |
| [ISCH_PrimitiveAPI](interfaces/ISCH_PrimitiveAPI.md) | Schematic primitive API | |
| [ISCH_ProjectNetInfo](interfaces/ISCH_ProjectNetInfo.md) | Project net property | |
| [ISCH_WireInfo](interfaces/ISCH_WireInfo.md) | Wire property | |
| [ISYS_ComparisonResponse](interfaces/ISYS_ComparisonResponse.md) | 对比响应返回结果 | |
| [ISYS_ExtensionExternalApiIndex](interfaces/ISYS_ExtensionExternalApiIndex.md) | external API 扁平索引(按命名空间分组) | |
| [ISYS_ExtensionRegisteredExternalApis](interfaces/ISYS_ExtensionRegisteredExternalApis.md) | 扩展注入的上层接口注册表(按扩展分组) | |
| [ISYS_ExternalApiHelp](interfaces/ISYS_ExternalApiHelp.md) | 扩展注入的上层接口 Help 元数据 | |
| [ISYS_ExternalApiRegistration](interfaces/ISYS_ExternalApiRegistration.md) | 扩展注入的上层接口注册条目 | |
| [ISYS_FileSystemFileList](interfaces/ISYS_FileSystemFileList.md) | File system file path | |
| [ISYS_HeaderMenus](interfaces/ISYS_HeaderMenus.md) | Header menu item | |
| [ISYS_HeaderMenuSub1MenuItem](interfaces/ISYS_HeaderMenuSub1MenuItem.md) | Top-level secondary menu item | |
| [ISYS_HeaderMenuSub2MenuItem](interfaces/ISYS_HeaderMenuSub2MenuItem.md) | Top-level tertiary menu item | |
| [ISYS_HeaderMenuTopMenuItem](interfaces/ISYS_HeaderMenuTopMenuItem.md) | Top-level primary menu item | |
| [ISYS_HelpClassSummary](interfaces/ISYS_HelpClassSummary.md) | 由 help 查询返回的类摘要 | |
| [ISYS_HelpData](interfaces/ISYS_HelpData.md) | lc-build 生成的 API jsonSchema(d.ts 的 JSON 形态) | |
| [ISYS_HelpMethodDetail](interfaces/ISYS_HelpMethodDetail.md) | Help 查询返回的方法详情 | |
| [ISYS_LogLine](interfaces/ISYS_LogLine.md) | Log line | |
| [ISYS_MathBBox](interfaces/ISYS_MathBBox.md) | BBox (minimum bounding rectangle) | |
| [ISYS_MathPoint](interfaces/ISYS_MathPoint.md) | Discrete points | |
| [ISYS_MathPolygonWithHoles](interfaces/ISYS_MathPolygonWithHoles.md) | Polygon with holes | |
| [ISYS_MessageBusTask](interfaces/ISYS_MessageBusTask.md) | Message bus task | |
| [ISYS_MultilingualLanguagesData](interfaces/ISYS_MultilingualLanguagesData.md) | Multilingual data | |
| [ISYS_RightClickMenuItem](interfaces/ISYS_RightClickMenuItem.md) | Right-click menu item | |
| [ISYS_ShortcutKeyData](interfaces/ISYS_ShortcutKeyData.md) | 快捷键数据 | |
| [ISYS_ShortcutKeyDataWithCallFn](interfaces/ISYS_ShortcutKeyDataWithCallFn.md) | 包含 CallFn 的快捷键数据 | |
| [ISYS_ShortcutKeyDataWithUserDefinedShortcutKey](interfaces/ISYS_ShortcutKeyDataWithUserDefinedShortcutKey.md) | 包含 userDefinedShortcutKey 的快捷键数据 | |
| [ISYS_WindowEventListenerRemovableObject](interfaces/ISYS_WindowEventListenerRemovableObject.md) | Window event listener can remove object | |
| [KeyboardConfig](interfaces/KeyboardConfig.md) | 键盘导航配置 | |
| [ListChildren](interfaces/ListChildren.md) | 列表项:支持多级嵌套分组 | |
| [ListProps](interfaces/ListProps.md) | 列表组件:支持多级嵌套、图标、展开的列表 | |
| [ModalProps](interfaces/ModalProps.md) | 模态弹窗:可拖拽、可调整大小的顶层弹窗 | |
| [NumberEditConfig](interfaces/NumberEditConfig.md) | | |
| [RadioGroupProps](interfaces/RadioGroupProps.md) | 单选组组件:一组互斥的单选选项 | |
| [RadioItem](interfaces/RadioItem.md) | 单选组中的单个选项 | |
| [RichTableProps](interfaces/RichTableProps.md) | RichTable 组件属性 | |
| [RowMetaConfig](interfaces/RowMetaConfig.md) | 行元数据配置,独立于业务数据(挂在 row.rowMeta 上) | |
| [ScrollerProps](interfaces/ScrollerProps.md) | 滚动组件:虚拟滚动列表,仅渲染可见行 | |
| [SelectEditConfig](interfaces/SelectEditConfig.md) | | |
| [SelectionConfig](interfaces/SelectionConfig.md) | 选择配置 | |
| [SelectListItem](interfaces/SelectListItem.md) | 下拉选项:支持多级嵌套分组 | |
| [SelectOption](interfaces/SelectOption.md) | 下拉选项 | |
| [SelectProps](interfaces/SelectProps.md) | 下拉选择器:基于输入框的下拉选择控件 | |
| [SliderProps](interfaces/SliderProps.md) | 滑杆组件:基于浏览器原生 range 输入 | |
| [SlotProps](interfaces/SlotProps.md) | 插槽组件:为父组件提供具名内容占位 | |
| [SortingConfig](interfaces/SortingConfig.md) | 排序配置 | |
| [SortState](interfaces/SortState.md) | 排序状态 | |
| [StyleProps](interfaces/StyleProps.md) | 通用样式属性:可被布局容器等组件继承的样式集合 | |
| [TextareaEditConfig](interfaces/TextareaEditConfig.md) | | |
| [TextAreaProps](interfaces/TextAreaProps.md) | 多行文本输入组件 | |
| [TextProps](interfaces/TextProps.md) | 文本组件:静态文本展示 | |
| [ValidationRule](interfaces/ValidationRule.md) | 校验规则(声明式,纯数据,可序列化) | |
| [VirtualScrollConfig](interfaces/VirtualScrollConfig.md) | 虚拟滚动配置 | |
---
# 类型别名 (Type Aliases)
| 类型名 | 描述 | 备注 |
|--------|------|------|
| [Align](types/Align.md) | 对齐方式 | |
| [CellContentType](types/CellContentType.md) | 剪贴板单元格内容类型(决定粘贴时的解析策略) | |
| [ColumnDefOrGroup](types/ColumnDefOrGroup.md) | 列定义(支持普通列和列分组) | |
| [ColumnEditConfig](types/ColumnEditConfig.md) | 五种编辑器类型配置 | |
| [ColumnType](types/ColumnType.md) | 列数据类型,默认 'text'。决定默认排序类型(sortType)和筛选匹配模式(filterMatchMode) | |
| [DataChangeType](types/DataChangeType.md) | 数据变更类型 | |
| [FilterMatchMode](types/FilterMatchMode.md) | 筛选匹配模式 | |
| [RichTableRow](types/RichTableRow.md) | 行数据:业务数据 + 行元数据(rowMeta) | |
| [Serializable](types/Serializable.md) | | |
| [SerializablePrimitive](types/SerializablePrimitive.md) | 可序列化纯数据(可跨 BroadcastChannel 结构化克隆)。 编译期拒绝函数 / Date / React 元素等不可序列化值——slotProps 等跨广播字段必须用它。 | |
| [SortOrder](types/SortOrder.md) | 排序方向 | |
| [TPCB_LayersInTheSelectable](types/TPCB_LayersInTheSelectable.md) | Selectable layers | |
| [TPCB_LayersOfComponent](types/TPCB_LayersOfComponent.md) | Layers of the device | |
| [TPCB_LayersOfCopper](types/TPCB_LayersOfCopper.md) | Layers of copper | |
| [TPCB_LayersOfCustom](types/TPCB_LayersOfCustom.md) | Custom layers | |
| [TPCB_LayersOfDimension](types/TPCB_LayersOfDimension.md) | Layers of the dimension | |
| [TPCB_LayersOfFill](types/TPCB_LayersOfFill.md) | Layers of the fill | |
| [TPCB_LayersOfImage](types/TPCB_LayersOfImage.md) | Layers of complex polygon figures (SVG images, text) | |
| [TPCB_LayersOfInner](types/TPCB_LayersOfInner.md) | Inner layers | |
| [TPCB_LayersOfLine](types/TPCB_LayersOfLine.md) | Layers of the line | |
| [TPCB_LayersOfObject](types/TPCB_LayersOfObject.md) | Layers of binary embedded objects | |
| [TPCB_LayersOfPad](types/TPCB_LayersOfPad.md) | Layers of the pad | |
| [TPCB_LayersOfRegion](types/TPCB_LayersOfRegion.md) | Layers of the region | |
| [TPCB_LayerTypesOfInnerLayer](types/TPCB_LayerTypesOfInnerLayer.md) | Layer types allowed to be set for inner layers | |
| [TPCB_NumberOfCopperLayers](types/TPCB_NumberOfCopperLayers.md) | 铜箔层数 | |
| [TPCB_PolygonSourceArray](types/TPCB_PolygonSourceArray.md) | Single polygon source array | |
| [TPCB_PrimitiveDimensionCoordinateSet](types/TPCB_PrimitiveDimensionCoordinateSet.md) | Dimension coordinate set | |
| [TPCB_PrimitivePadHole](types/TPCB_PrimitivePadHole.md) | Pad drilling | |
| [TPCB_PrimitivePadShape](types/TPCB_PrimitivePadShape.md) | Pad shape | |
| [TPCB_PrimitiveSpecialPadShape](types/TPCB_PrimitiveSpecialPadShape.md) | Special pad shape | |
| [TSYS_ComparisonErrorCode](types/TSYS_ComparisonErrorCode.md) | 对比失败错误码 | |
| [TSYS_LanguageKeyValuePairs](types/TSYS_LanguageKeyValuePairs.md) | 语言数据键值对 | |
| [TSYS_MathPolygonGroup](types/TSYS_MathPolygonGroup.md) | Polygon group | |
| [TSYS_MathPolygonInput](types/TSYS_MathPolygonInput.md) | Polygon input type | |
| [TSYS_ShortcutKeys](types/TSYS_ShortcutKeys.md) | Shortcut key | |
references/_quick-reference.md
# EasyEDA API 快速参考
> 此文件提供所有类及其方法/属性的签名一览,便于 AI 快速查找。
> 详细参数和返回值请查看 docs/classes/<ClassName>.md
## 全局入口
```typescript
declare const eda: EDA;
```
EDA 类的属性即为各模块的入口,如 `eda.dmt_Board`, `eda.pcb_PrimitiveLine` 等。
---
## DMT_Board
Document tree / Board management class
```typescript
class DMT_Board
```
- **copyboard**: `function copyBoard(sourceBoardName: string): Promise<string | undefined>;`
- **createboard**: `function createBoard(schematicUuid?: string, pcbUuid?: string): Promise<string | undefined>;`
- **deleteboard**: `function deleteBoard(boardName: string): Promise<boolean>;`
- **getallboardsinfo**: `function getAllBoardsInfo(): Promise<Array<IDMT_BoardItem>>;`
- **getboardinfo**: `function getBoardInfo(boardName: string): Promise<IDMT_BoardItem | undefined>;`
- **getcurrentboardinfo**: `function getCurrentBoardInfo(): Promise<IDMT_BoardItem | undefined>;`
- **modifyboardname**: `function modifyBoardName(originalBoardName: string, boardName: string): Promise<boolean>;`
---
## DMT_EditorControl
Document tree / Editor control class
```typescript
class DMT_EditorControl
```
- **activatedocument**: `function activateDocument(tabId: string): Promise<boolean>;`
- **activatesplitscreen**: `function activateSplitScreen(splitScreenId: string): Promise<boolean>;`
- **closedocument**: `function closeDocument(tabId: string): Promise<boolean>;`
- **createsplitscreen**: `function createSplitScreen( splitScreenType: EDMT_EditorSplitScreenDirection, tabId: string, ): Promise<{ sourceSplitScreenId: string; newSplitScreenId: string } | undefined>;`
- **generateindicatormarkers**: `function generateIndicatorMarkers( markers: Array<IDMT_IndicatorMarkerShape>, color?: { r: number; g: number; b: number; alpha: number }, lineWidth?: number, zoom?: boolean, tabId?: string, ): Promise<boolean>;`
- **getcurrentrenderedareaimage**: `function getCurrentRenderedAreaImage(tabId?: string): Promise<Blob | undefined>;`
- **getsplitscreenidbytabid**: `function getSplitScreenIdByTabId(tabId: string): Promise<string | undefined>;`
- **getsplitscreentree**: `function getSplitScreenTree(): Promise<IDMT_EditorSplitScreenItem | undefined>;`
- **gettabsbysplitscreenid**: `function getTabsBySplitScreenId(splitScreenId: string): Promise<Array<IDMT_EditorTabItem>>;`
- **mergealldocumentfromsplitscreen**: `function mergeAllDocumentFromSplitScreen(): Promise<boolean>;`
- **movedocumenttosplitscreen**: `function moveDocumentToSplitScreen(tabId: string, splitScreenId: string): Promise<boolean>;`
- **opendocument**: `function openDocument(documentUuid: string, splitScreenId?: string): Promise<string | undefined>;`
- **openlibrarydocument**: `function openLibraryDocument( libraryUuid: string, libraryType: ELIB_LibraryType.SYMBOL | ELIB_LibraryType.FOOTPRINT, uuid: string, splitScreenId?: string, ): Promise<string | undefined>;`
- **removeindicatormarkers**: `function removeIndicatorMarkers(tabId?: string): Promise<boolean>;`
- **tilealldocumenttosplitscreen**: `function tileAllDocumentToSplitScreen(): Promise<boolean>;`
- **zoomto**: `function zoomTo( x?: number, y?: number, scaleRatio?: number, tabId?: string, ): Promise<{ left: number; right: number; top: number; bottom: number } | false>;`
- **zoomtoallprimitives**: `function zoomToAllPrimitives( tabId?: string, ): Promise<{ left: number; right: number; top: number; bottom: number } | false>;`
- **zoomtoregion**: `function zoomToRegion( left: number, right: number, top: number, bottom: number, tabId?: string, ): Promise<boolean>;`
- **zoomtoselectedprimitives**: `function zoomToSelectedPrimitives( tabId?: string, ): Promise<{ left: number; right: number; top: number; bottom: number } | false>;`
---
## DMT_Event
Document tree / event class
```typescript
class DMT_Event
```
- **addeditortabeventlistener**: `function addEditorTabEventListener( id: string, eventType: 'all' | EDMT_EditorTabEventType, callFn: ( eventType: EDMT_EditorTabEventType, props: { documentType: EDMT_EditorDocumentType; title: string; tabId: string }, ) => void | Promise<void>, onlyOnce?: boolean, ): void;`
- **iseventlisteneralreadyexist**: `function isEventListenerAlreadyExist(id: string): boolean;`
- **removeeventlistener**: `function removeEventListener(id: string): boolean;`
---
## DMT_Folder
Document tree / Folder class
```typescript
class DMT_Folder
```
- **createfolder**: `function createFolder( folderName: string, teamUuid: string, parentFolderUuid?: string, description?: string, ): Promise<string | undefined>;`
- **deletefolder**: `function deleteFolder(teamUuid: string, folderUuid: string): Promise<boolean>;`
- **getallfoldersuuid**: `function getAllFoldersUuid(teamUuid: string): Promise<Array<string>>;`
- **getfolderinfo**: `function getFolderInfo(teamUuid: string, folderUuid: string): Promise<IDMT_FolderItem | undefined>;`
- **modifyfolderdescription**: `function modifyFolderDescription( teamUuid: string, folderUuid: string, description?: string, ): Promise<boolean>;`
- **modifyfoldername**: `function modifyFolderName( teamUuid: string, folderUuid: string, folderName: string, ): Promise<boolean>;`
- **movefoldertofolder**: `function moveFolderToFolder( teamUuid: string, folderUuid: string, parentFolderUuid?: string, ): Promise<boolean>;`
---
## DMT_Panel
Document tree / Panel management class
```typescript
class DMT_Panel
```
- **copypanel**: `function copyPanel(panelUuid: string): Promise<string | undefined>;`
- **createpanel**: `function createPanel(): Promise<string | undefined>;`
- **deletepanel**: `function deletePanel(panelUuid: string): Promise<boolean>;`
- **getallpanelsinfo**: `function getAllPanelsInfo(): Promise<Array<IDMT_PanelItem>>;`
- **getcurrentpanelinfo**: `function getCurrentPanelInfo(): Promise<IDMT_PanelItem | undefined>;`
- **getpanelinfo**: `function getPanelInfo(panelUuid: string): Promise<IDMT_PanelItem | undefined>;`
- **modifypanelname**: `function modifyPanelName(panelUuid: string, panelName: string): Promise<boolean>;`
---
## DMT_Pcb
Document tree / PCB management class
```typescript
class DMT_Pcb
```
- **copypcb**: `function copyPcb(pcbUuid: string, boardName?: string): Promise<string | undefined>;`
- **createpcb**: `function createPcb(boardName?: string): Promise<string | undefined>;`
- **deletepcb**: `function deletePcb(pcbUuid: string): Promise<boolean>;`
- **getallpcbsinfo**: `function getAllPcbsInfo(): Promise<Array<IDMT_PcbItem>>;`
- **getcurrentpcbinfo**: `function getCurrentPcbInfo(): Promise<IDMT_PcbItem | undefined>;`
- **getpcbinfo**: `function getPcbInfo(pcbUuid: string): Promise<IDMT_PcbItem | undefined>;`
- **modifypcbname**: `function modifyPcbName(pcbUuid: string, pcbName: string): Promise<boolean>;`
---
## DMT_Project
Document tree / Project management class
```typescript
class DMT_Project
```
- **createproject**: `function createProject( projectFriendlyName: string, projectName?: string, teamUuid?: string, folderUuid?: string, description?: string, collaborationMode?: EDMT_ProjectCollaborationMode, fileFormat?: EDMT_ProjectFileFormat, ): Promise<string | undefined>;`
- **getallprojectsuuid**: `function getAllProjectsUuid( teamUuid?: string, folderUuid?: string, workspaceUuid?: string, ): Promise<Array<string>>;`
- **getcurrentprojectinfo**: `function getCurrentProjectInfo(): Promise<IDMT_ProjectItem | undefined>;`
- **getprojectinfo**: `function getProjectInfo(projectUuid: string): Promise<IDMT_BriefProjectItem | undefined>;`
- **moveprojecttofolder**: `function moveProjectToFolder(projectUuid: string, folderUuid?: string): Promise<boolean>;`
- **openproject**: `function openProject(projectUuid: string): Promise<boolean>;`
---
## DMT_Schematic
Document tree / Schematic management class
```typescript
class DMT_Schematic
```
- **copyschematic**: `function copySchematic(schematicUuid: string, boardName?: string): Promise<string | undefined>;`
- **copyschematicpage**: `function copySchematicPage( schematicPageUuid: string, schematicUuid?: string, ): Promise<string | undefined>;`
- **createschematic**: `function createSchematic(boardName?: string): Promise<string | undefined>;`
- **createschematicpage**: `function createSchematicPage(schematicUuid: string): Promise<string | undefined>;`
- **deleteschematic**: `function deleteSchematic(schematicUuid: string): Promise<boolean>;`
- **deleteschematicpage**: `function deleteSchematicPage(schematicPageUuid: string): Promise<boolean>;`
- **getallschematicpagesinfo**: `function getAllSchematicPagesInfo(): Promise<Array<IDMT_SchematicPageItem>>;`
- **getallschematicsinfo**: `function getAllSchematicsInfo(): Promise<Array<IDMT_SchematicItem>>;`
- **getcurrentschematicallschematicpagesinfo**: `function getCurrentSchematicAllSchematicPagesInfo(): Promise<Array<IDMT_SchematicPageItem>>;`
- **getcurrentschematicinfo**: `function getCurrentSchematicInfo(): Promise<IDMT_SchematicItem | undefined>;`
- **getcurrentschematicpageinfo**: `function getCurrentSchematicPageInfo(): Promise<IDMT_SchematicPageItem | undefined>;`
- **getschematicinfo**: `function getSchematicInfo(schematicUuid: string): Promise<IDMT_SchematicItem | undefined>;`
- **getschematicpageinfo**: `function getSchematicPageInfo( schematicPageUuid: string, ): Promise<IDMT_SchematicPageItem | undefined>;`
- **modifyschematicname**: `function modifySchematicName(schematicUuid: string, schematicName: string): Promise<boolean>;`
- **modifyschematicpagename**: `function modifySchematicPageName( schematicPageUuid: string, schematicPageName: string, ): Promise<boolean>;`
- **modifyschematicpagetitleblock**: `function modifySchematicPageTitleBlock( showTitleBlock?: boolean, titleBlockData?: Record<string, { showTitle?: boolean; showValue?: boolean; value?: any }>, ): Promise<boolean>;`
- **reorderschematicpages**: `function reorderSchematicPages( schematicUuid: string, schematicPageItemsArray: Array<IDMT_SchematicPageItem>, ): Promise<boolean>;`
---
## DMT_SelectControl
Document tree / selection control class
```typescript
class DMT_SelectControl
```
- **getcurrentdocumentinfo**: `function getCurrentDocumentInfo(): Promise<IDMT_EditorDocumentItem | undefined>;`
---
## DMT_Team
Document tree / Team class
```typescript
class DMT_Team
```
- **getallinvolvedteaminfo**: `function getAllInvolvedTeamInfo(): Promise<Array<IDMT_TeamItem>>;`
- **getallteamsinfo**: `function getAllTeamsInfo(): Promise<Array<IDMT_TeamItem>>;`
- **getcurrentteaminfo**: `function getCurrentTeamInfo(): Promise<IDMT_TeamItem | undefined>;`
---
## DMT_Workspace
Document tree / Workspace class
```typescript
class DMT_Workspace
```
- **getallworkspacesinfo**: `function getAllWorkspacesInfo(): Promise<Array<IDMT_WorkspaceItem>>;`
- **getcurrentworkspaceinfo**: `function getCurrentWorkspaceInfo(): Promise<IDMT_WorkspaceItem | undefined>;`
- **toggletoworkspace**: `function toggleToWorkspace(workspaceUuid?: string): Promise<boolean>;`
---
## EDA
EasyEDA Pro user API interface
```typescript
eda: EDA;
```
- **dmt_board**: `function dmt_Board: DMT_Board;`
- **dmt_editorcontrol**: `function dmt_EditorControl: DMT_EditorControl;`
- **dmt_event**: `function dmt_Event: DMT_Event;`
- **dmt_folder**: `function dmt_Folder: DMT_Folder;`
- **dmt_panel**: `function dmt_Panel: DMT_Panel;`
- **dmt_pcb**: `function dmt_Pcb: DMT_Pcb;`
- **dmt_project**: `function dmt_Project: DMT_Project;`
- **dmt_schematic**: `function dmt_Schematic: DMT_Schematic;`
- **dmt_selectcontrol**: `function dmt_SelectControl: DMT_SelectControl;`
- **dmt_team**: `function dmt_Team: DMT_Team;`
- **dmt_workspace**: `function dmt_Workspace: DMT_Workspace;`
- **lib_3dmodel**: `function lib_3DModel: LIB_3DModel;`
- **lib_cbb**: `function lib_Cbb: LIB_Cbb;`
- **lib_classification**: `function lib_Classification: LIB_Classification;`
- **lib_device**: `function lib_Device: LIB_Device;`
- **lib_footprint**: `function lib_Footprint: LIB_Footprint;`
- **lib_librarieslist**: `function lib_LibrariesList: LIB_LibrariesList;`
- **lib_panellibrary**: `function lib_PanelLibrary: LIB_PanelLibrary;`
- **lib_selectcontrol**: `function lib_SelectControl: LIB_SelectControl;`
- **lib_simulationmodel**: `function lib_SimulationModel: LIB_SimulationModel;`
- **lib_symbol**: `function lib_Symbol: LIB_Symbol;`
- **pcb_document**: `function pcb_Document: PCB_Document;`
- **pcb_drc**: `function pcb_Drc: PCB_Drc;`
- **pcb_event**: `function pcb_Event: PCB_Event;`
- **pcb_imagetool**: `function pcb_ImageTool: PCB_ImageTool;`
- **pcb_layer**: `function pcb_Layer: PCB_Layer;`
- **pcb_manufacturedata**: `function pcb_ManufactureData: PCB_ManufactureData;`
- **pcb_mathpolygon**: `function pcb_MathPolygon: PCB_MathPolygon;`
- **pcb_net**: `function pcb_Net: PCB_Net;`
- **pcb_primitive**: `function pcb_Primitive: PCB_Primitive;`
- **pcb_primitivearc**: `function pcb_PrimitiveArc: PCB_PrimitiveArc;`
- **pcb_primitiveattribute**: `function pcb_PrimitiveAttribute: PCB_PrimitiveAttribute;`
- **pcb_primitivecomponent**: `function pcb_PrimitiveComponent: PCB_PrimitiveComponent;`
- **pcb_primitivedimension**: `function pcb_PrimitiveDimension: PCB_PrimitiveDimension;`
- **pcb_primitivefill**: `function pcb_PrimitiveFill: PCB_PrimitiveFill;`
- **pcb_primitiveimage**: `function pcb_PrimitiveImage: PCB_PrimitiveImage;`
- **pcb_primitiveline**: `function pcb_PrimitiveLine: PCB_PrimitiveLine;`
- **pcb_primitiveobject**: `function pcb_PrimitiveObject: PCB_PrimitiveObject;`
- **pcb_primitivepad**: `function pcb_PrimitivePad: PCB_PrimitivePad;`
- **pcb_primitivepolyline**: `function pcb_PrimitivePolyline: PCB_PrimitivePolyline;`
- **pcb_primitivepour**: `function pcb_PrimitivePour: PCB_PrimitivePour;`
- **pcb_primitivepoured**: `function pcb_PrimitivePoured: PCB_PrimitivePoured;`
- **pcb_primitiveregion**: `function pcb_PrimitiveRegion: PCB_PrimitiveRegion;`
- **pcb_primitivestring**: `function pcb_PrimitiveString: PCB_PrimitiveString;`
- **pcb_primitivevia**: `function pcb_PrimitiveVia: PCB_PrimitiveVia;`
- **pcb_raytracerengine**: `function pcb_RayTracerEngine: PCB_RayTracerEngine;`
- **pcb_selectcontrol**: `function pcb_SelectControl: PCB_SelectControl;`
- **pcb_tool**: `function pcb_Tool: PCB_Tool;`
- **pnl_document**: `function pnl_Document: PNL_Document;`
- **sch_document**: `function sch_Document: SCH_Document;`
- **sch_drc**: `function sch_Drc: SCH_Drc;`
- **sch_event**: `function sch_Event: SCH_Event;`
- **sch_manufacturedata**: `function sch_ManufactureData: SCH_ManufactureData;`
- **sch_net**: `function sch_Net: SCH_Net;`
- **sch_netlist**: `function sch_Netlist: SCH_Netlist;`
- **sch_primitive**: `function sch_Primitive: SCH_Primitive;`
- **sch_primitivearc**: `function sch_PrimitiveArc: SCH_PrimitiveArc;`
- **sch_primitiveattribute**: `function sch_PrimitiveAttribute: SCH_PrimitiveAttribute;`
- **sch_primitivebus**: `function sch_PrimitiveBus: SCH_PrimitiveBus;`
- **sch_primitivecircle**: `function sch_PrimitiveCircle: SCH_PrimitiveCircle;`
- **sch_primitivecomponent**: `function sch_PrimitiveComponent: SCH_PrimitiveComponent;`
- **sch_primitiveobject**: `function sch_PrimitiveObject: SCH_PrimitiveObject;`
- **sch_primitivepin**: `function sch_PrimitivePin: SCH_PrimitivePin;`
- **sch_primitivepolygon**: `function sch_PrimitivePolygon: SCH_PrimitivePolygon;`
- **sch_primitiverectangle**: `function sch_PrimitiveRectangle: SCH_PrimitiveRectangle;`
- **sch_primitivetext**: `function sch_PrimitiveText: SCH_PrimitiveText;`
- **sch_primitivewire**: `function sch_PrimitiveWire: SCH_PrimitiveWire;`
- **sch_selectcontrol**: `function sch_SelectControl: SCH_SelectControl;`
- **sch_simulationengine**: `function sch_SimulationEngine: SCH_SimulationEngine;`
- **sch_utils**: `function sch_Utils: SCH_Utils;`
- **sys_clienturl**: `function sys_ClientUrl: SYS_ClientUrl;`
- **sys_dialog**: `function sys_Dialog: SYS_Dialog;`
- **sys_environment**: `function sys_Environment: SYS_Environment;`
- **sys_externalapi**: `function sys_ExternalApi: SYS_ExternalApi;`
- **sys_filemanager**: `function sys_FileManager: SYS_FileManager;`
- **sys_filesystem**: `function sys_FileSystem: SYS_FileSystem;`
- **sys_fontmanager**: `function sys_FontManager: SYS_FontManager;`
- **sys_formatconversion**: `function sys_FormatConversion: SYS_FormatConversion;`
- **sys_headermenu**: `function sys_HeaderMenu: SYS_HeaderMenu;`
- **sys_help**: `function sys_Help: SYS_Help;`
- **sys_i18n**: `function sys_I18n: SYS_I18n;`
- **sys_iframe**: `function sys_IFrame: SYS_IFrame;`
- **sys_loadingandprogressbar**: `function sys_LoadingAndProgressBar: SYS_LoadingAndProgressBar;`
- **sys_log**: `function sys_Log: SYS_Log;`
- **sys_math**: `function sys_Math: SYS_Math;`
- **sys_message**: `function sys_Message: SYS_Message;`
- **sys_messagebox**: `function sys_MessageBox: SYS_MessageBox;`
- **sys_messagebus**: `function sys_MessageBus: SYS_MessageBus;`
- **sys_panelcontrol**: `function sys_PanelControl: SYS_PanelControl;`
- **sys_rightclickmenu**: `function sys_RightClickMenu: SYS_RightClickMenu;`
- **sys_setting**: `function sys_Setting: SYS_Setting;`
- **sys_shortcutkey**: `function sys_ShortcutKey: SYS_ShortcutKey;`
- **sys_storage**: `function sys_Storage: SYS_Storage;`
- **sys_timer**: `function sys_Timer: SYS_Timer;`
- **sys_toastmessage**: `function sys_ToastMessage: SYS_ToastMessage;`
- **sys_tool**: `function sys_Tool: SYS_Tool;`
- **sys_unit**: `function sys_Unit: SYS_Unit;`
- **sys_websocket**: `function sys_WebSocket: SYS_WebSocket;`
- **sys_window**: `function sys_Window: SYS_Window;`
---
## IPCB_ComplexPolygon
Complex polygon
```typescript
class IPCB_ComplexPolygon
```
- **addsource**: `function addSource( complexPolygon: | TPCB_PolygonSourceArray | Array<TPCB_PolygonSourceArray> | IPCB_Polygon | Array<IPCB_Polygon>, ): IPCB_ComplexPolygon;`
- **getcenter**: `function getCenter(): Promise<{ x: number; y: number }>;`
- **getsource**: `function getSource(): TPCB_PolygonSourceArray | Array<TPCB_PolygonSourceArray>;`
- **getsourcestrictcomplex**: `function getSourceStrictComplex(): Array<TPCB_PolygonSourceArray>;`
- **topolygon**: `function toPolygon(): Array<IPCB_Polygon>;`
---
## IPCB_Polygon
Single polygon
```typescript
class IPCB_Polygon
```
- **discretize**: `function discretize(options?: IPCB_DiscretizeOptions): Promise<Array<IPCB_DiscretizedPoint> | null>;`
- **getcenter**: `function getCenter(): Promise<{ x: number; y: number }>;`
- **getsource**: `function getSource(): TPCB_PolygonSourceArray;`
---
## IPCB_PrimitiveArc
Arc line primitive
```typescript
class IPCB_PrimitiveArc implements IPCB_Primitive
```
- **done**: `function done(): Promise<IPCB_PrimitiveArc>;`
- **getadjacentprimitives**: `function getAdjacentPrimitives(): Promise< Array<IPCB_PrimitiveLine | IPCB_PrimitiveVia | IPCB_PrimitiveArc> >;`
- **getentiretrack**: `function getEntireTrack(includeVias: false): Promise<Array<IPCB_PrimitiveLine | IPCB_PrimitiveArc>>;`
- **getentiretrack_1**: `function getEntireTrack( includeVias: true, ): Promise<Array<IPCB_PrimitiveLine | IPCB_PrimitiveArc | IPCB_PrimitiveVia>>;`
- **getstate_arcangle**: `function getState_ArcAngle(): number;`
- **getstate_endx**: `function getState_EndX(): number;`
- **getstate_endy**: `function getState_EndY(): number;`
- **getstate_interactivemode**: `function getState_InteractiveMode(): EPCB_PrimitiveArcInteractiveMode;`
- **getstate_layer**: `function getState_Layer(): TPCB_LayersOfLine;`
- **getstate_linewidth**: `function getState_LineWidth(): number;`
- **getstate_net**: `function getState_Net(): string;`
- **getstate_primitiveid**: `function getState_PrimitiveId(): string;`
- **getstate_primitivelock**: `function getState_PrimitiveLock(): boolean;`
- **getstate_primitivetype**: `function getState_PrimitiveType(): EPCB_PrimitiveType;`
- **getstate_startx**: `function getState_StartX(): number;`
- **getstate_starty**: `function getState_StartY(): number;`
- **isasync**: `function isAsync(): boolean;`
- **reset**: `function reset(): Promise<IPCB_PrimitiveArc>;`
- **setstate_arcangle**: `function setState_ArcAngle(arcAngle: number): IPCB_PrimitiveArc;`
- **setstate_endx**: `function setState_EndX(endX: number): IPCB_PrimitiveArc;`
- **setstate_endy**: `function setState_EndY(endY: number): IPCB_PrimitiveArc;`
- **setstate_interactivemode**: `function setState_InteractiveMode( interactiveMode: EPCB_PrimitiveArcInteractiveMode, ): IPCB_PrimitiveArc;`
- **setstate_layer**: `function setState_Layer(layer: TPCB_LayersOfLine): IPCB_PrimitiveArc;`
- **setstate_linewidth**: `function setState_LineWidth(lineWidth: number): IPCB_PrimitiveArc;`
- **setstate_net**: `function setState_Net(net: string): IPCB_PrimitiveArc;`
- **setstate_primitivelock**: `function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitiveArc;`
- **setstate_startx**: `function setState_StartX(startX: number): IPCB_PrimitiveArc;`
- **setstate_starty**: `function setState_StartY(startY: number): IPCB_PrimitiveArc;`
- **toasync**: `function toAsync(): IPCB_PrimitiveArc;`
- **tosync**: `function toSync(): IPCB_PrimitiveArc;`
---
## IPCB_PrimitiveAttribute
Property primitive
```typescript
class IPCB_PrimitiveAttribute implements IPCB_Primitive
```
- **_constructor_**: `function constructor( layer: TPCB_LayersOfImage, x: number | null, y: number | null, key: string, value: string, keyVisible: boolean, valueVisible: boolean, fontFamily: string, fontSize: number, lineWidth: number, alignMode: EPCB_PrimitiveStringAlignMode, rotation: number, reverse: boolean, expansion: number, mirror: boolean, primitiveLock: boolean, primitiveId: string, parentPrimitiveId: string, );`
- **done**: `function done(): Promise<IPCB_PrimitiveAttribute>;`
- **getstate_alignmode**: `function getState_AlignMode(): EPCB_PrimitiveStringAlignMode;`
- **getstate_expansion**: `function getState_Expansion(): number;`
- **getstate_fontfamily**: `function getState_FontFamily(): string;`
- **getstate_fontsize**: `function getState_FontSize(): number;`
- **getstate_key**: `function getState_Key(): string;`
- **getstate_keyvisible**: `function getState_KeyVisible(): boolean;`
- **getstate_layer**: `function getState_Layer(): TPCB_LayersOfImage;`
- **getstate_linewidth**: `function getState_LineWidth(): number;`
- **getstate_mirror**: `function getState_Mirror(): boolean;`
- **getstate_parentprimitiveid**: `function getState_ParentPrimitiveId(): string;`
- **getstate_primitiveid**: `function getState_PrimitiveId(): string;`
- **getstate_primitivelock**: `function getState_PrimitiveLock(): boolean;`
- **getstate_primitivetype**: `function getState_PrimitiveType(): EPCB_PrimitiveType;`
- **getstate_reverse**: `function getState_Reverse(): boolean;`
- **getstate_rotation**: `function getState_Rotation(): number;`
- **getstate_value**: `function getState_Value(): string;`
- **getstate_valuevisible**: `function getState_ValueVisible(): boolean;`
- **getstate_x**: `function getState_X(): number | null;`
- **getstate_y**: `function getState_Y(): number | null;`
- **isasync**: `function isAsync(): boolean;`
- **reset**: `function reset(): Promise<IPCB_PrimitiveAttribute>;`
- **setstate_alignmode**: `function setState_AlignMode(alignMode: EPCB_PrimitiveStringAlignMode): IPCB_PrimitiveAttribute;`
- **setstate_expansion**: `function setState_Expansion(expansion: number): IPCB_PrimitiveAttribute;`
- **setstate_fontfamily**: `function setState_FontFamily(fontFamily: string): IPCB_PrimitiveAttribute;`
- **setstate_fontsize**: `function setState_FontSize(fontSize: number): IPCB_PrimitiveAttribute;`
- **setstate_key**: `function setState_Key(key: string): IPCB_PrimitiveAttribute;`
- **setstate_keyvisible**: `function setState_KeyVisible(keyVisible: boolean): IPCB_PrimitiveAttribute;`
- **setstate_layer**: `function setState_Layer(layer: TPCB_LayersOfImage): IPCB_PrimitiveAttribute;`
- **setstate_linewidth**: `function setState_LineWidth(lineWidth: number): IPCB_PrimitiveAttribute;`
- **setstate_mirror**: `function setState_Mirror(mirror: boolean): IPCB_PrimitiveAttribute;`
- **setstate_primitivelock**: `function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitiveAttribute;`
- **setstate_reverse**: `function setState_Reverse(reverse: boolean): IPCB_PrimitiveAttribute;`
- **setstate_rotation**: `function setState_Rotation(rotation: number): IPCB_PrimitiveAttribute;`
- **setstate_value**: `function setState_Value(value: string): IPCB_PrimitiveAttribute;`
- **setstate_valuevisible**: `function setState_ValueVisible(valueVisible: boolean): IPCB_PrimitiveAttribute;`
- **setstate_x**: `function setState_X(x: number): IPCB_PrimitiveAttribute;`
- **setstate_y**: `function setState_Y(y: number): IPCB_PrimitiveAttribute;`
- **toasync**: `function toAsync(): IPCB_PrimitiveAttribute;`
- **tosync**: `function toSync(): IPCB_PrimitiveAttribute;`
---
## IPCB_PrimitiveComponent
Device primitive
```typescript
class IPCB_PrimitiveComponent implements IPCB_Primitive
```
- **done**: `function done(): Promise<IPCB_PrimitiveComponent>;`
- **getallpins**: `function getAllPins(): Promise<Array<IPCB_PrimitiveComponentPad>>;`
- **getstate_addintobom**: `function getState_AddIntoBom(): boolean;`
- **getstate_component**: `function getState_Component(): { libraryUuid: string; uuid: string; name?: string } | undefined;`
- **getstate_designator**: `function getState_Designator(): string | undefined;`
- **getstate_footprint**: `function getState_Footprint(): { libraryUuid: string; uuid: string; name?: string } | undefined;`
- **getstate_layer**: `function getState_Layer(): TPCB_LayersOfComponent;`
- **getstate_manufacturer**: `function getState_Manufacturer(): string | undefined;`
- **getstate_manufacturerid**: `function getState_ManufacturerId(): string | undefined;`
- **getstate_model3d**: `function getState_Model3D(): { libraryUuid: string; uuid: string; name?: string } | undefined;`
- **getstate_name**: `function getState_Name(): string | undefined;`
- **getstate_otherproperty**: `function getState_OtherProperty(): Record<string, string | number | boolean> | undefined;`
- **getstate_pads**: `function getState_Pads(): Array<{ primitiveId: string; net: string; padNumber: string }> | undefined;`
- **getstate_primitiveid**: `function getState_PrimitiveId(): string;`
- **getstate_primitivelock**: `function getState_PrimitiveLock(): boolean;`
- **getstate_primitivetype**: `function getState_PrimitiveType(): EPCB_PrimitiveType;`
- **getstate_rotation**: `function getState_Rotation(): number;`
- **getstate_supplier**: `function getState_Supplier(): string | undefined;`
- **getstate_supplierid**: `function getState_SupplierId(): string | undefined;`
- **getstate_uniqueid**: `function getState_UniqueId(): string | undefined;`
- **getstate_x**: `function getState_X(): number;`
- **getstate_y**: `function getState_Y(): number;`
- **isasync**: `function isAsync(): boolean;`
- **reset**: `function reset(): Promise<IPCB_PrimitiveComponent>;`
- **setattribute**: `function setAttribute( key: string, value?: string | number | boolean, keyVisible?: boolean, valueVisible?: boolean, ): Promise<IPCB_PrimitiveAttribute>;`
- **setstate_addintobom**: `function setState_AddIntoBom(addIntoBom: boolean): IPCB_PrimitiveComponent;`
- **setstate_designator**: `function setState_Designator(designator: string | undefined): IPCB_PrimitiveComponent;`
- **setstate_layer**: `function setState_Layer(layer: TPCB_LayersOfComponent): IPCB_PrimitiveComponent;`
- **setstate_manufacturer**: `function setState_Manufacturer(manufacturer: string | undefined): IPCB_PrimitiveComponent;`
- **setstate_manufacturerid**: `function setState_ManufacturerId(manufacturerId: string | undefined): IPCB_PrimitiveComponent;`
- **setstate_name**: `function setState_Name(name: string | undefined): IPCB_PrimitiveComponent;`
- **setstate_otherproperty**: `function setState_OtherProperty( otherProperty: Record<string, string | number | boolean>, ): IPCB_PrimitiveComponent;`
- **setstate_primitivelock**: `function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitiveComponent;`
- **setstate_rotation**: `function setState_Rotation(rotation: number): IPCB_PrimitiveComponent;`
- **setstate_supplier**: `function setState_Supplier(supplier: string | undefined): IPCB_PrimitiveComponent;`
- **setstate_supplierid**: `function setState_SupplierId(supplierId: string | undefined): IPCB_PrimitiveComponent;`
- **setstate_uniqueid**: `function setState_UniqueId(uniqueId: string | undefined): IPCB_PrimitiveComponent;`
- **setstate_x**: `function setState_X(x: number): IPCB_PrimitiveComponent;`
- **setstate_y**: `function setState_Y(y: number): IPCB_PrimitiveComponent;`
- **toasync**: `function toAsync(): IPCB_PrimitiveComponent;`
- **tosync**: `function toSync(): IPCB_PrimitiveComponent;`
---
## IPCB_PrimitiveComponentPad
Device pad primitive
```typescript
class IPCB_PrimitiveComponentPad extends IPCB_PrimitivePad
```
- **done**: `function done(): Promise<IPCB_PrimitiveComponentPad>;`
- **getconnectedprimitives**: `function getConnectedPrimitives( onlyCentreConnection: true, ): Promise<Array<IPCB_PrimitiveLine | IPCB_PrimitiveArc | IPCB_PrimitiveVia>>;`
- **getconnectedprimitives_1**: `function getConnectedPrimitives( onlyCentreConnection: false, ): Promise< Array< | IPCB_PrimitiveLine | IPCB_PrimitiveArc | IPCB_PrimitiveVia | IPCB_PrimitivePolyline | IPCB_PrimitiveFill > >;`
- **getstate_parentcomponentprimitiveid**: `function getState_ParentComponentPrimitiveId(): string;`
- **primitivetype**: `function readonly primitiveType: EPCB_PrimitiveType.COMPONENT_PAD;`
- **setstate_parentcomponentprimitiveid**: `function setState_ParentComponentPrimitiveId(): IPCB_PrimitiveComponentPad;`
---
## IPCB_PrimitiveDimension
Dimension primitive
```typescript
class IPCB_PrimitiveDimension implements IPCB_Primitive
```
- **done**: `function done(): Promise<IPCB_PrimitiveDimension>;`
- **getstate_coordinateset**: `function getState_CoordinateSet(): TPCB_PrimitiveDimensionCoordinateSet;`
- **getstate_dimensiontype**: `function getState_DimensionType(): EPCB_PrimitiveDimensionType;`
- **getstate_layer**: `function getState_Layer(): TPCB_LayersOfDimension;`
- **getstate_linewidth**: `function getState_LineWidth(): number;`
- **getstate_precision**: `function getState_Precision(): number;`
- **getstate_primitiveid**: `function getState_PrimitiveId(): string;`
- **getstate_primitivelock**: `function getState_PrimitiveLock(): boolean;`
- **getstate_primitivetype**: `function getState_PrimitiveType(): EPCB_PrimitiveType;`
- **getstate_textfollow**: `function getState_TextFollow(): 0 | 1;`
- **getstate_unit**: `function getState_Unit(): ESYS_Unit.MILLIMETER | ESYS_Unit.CENTIMETER | ESYS_Unit.INCH | ESYS_Unit.MIL;`
- **isasync**: `function isAsync(): boolean;`
- **reset**: `function reset(): Promise<IPCB_PrimitiveDimension>;`
- **setstate_coordinateset**: `function setState_CoordinateSet( coordinateSet: TPCB_PrimitiveDimensionCoordinateSet, ): IPCB_PrimitiveDimension;`
- **setstate_dimensiontype**: `function setState_DimensionType( dimensionType: EPCB_PrimitiveDimensionType, ): IPCB_PrimitiveDimension;`
- **setstate_layer**: `function setState_Layer(layer: TPCB_LayersOfDimension): IPCB_PrimitiveDimension;`
- **setstate_linewidth**: `function setState_LineWidth(lineWidth: number): IPCB_PrimitiveDimension;`
- **setstate_precision**: `function setState_Precision(precision: number): IPCB_PrimitiveDimension;`
- **setstate_primitivelock**: `function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitiveDimension;`
- **setstate_unit**: `function setState_Unit( unit: ESYS_Unit.MILLIMETER | ESYS_Unit.CENTIMETER | ESYS_Unit.INCH | ESYS_Unit.MIL, ): IPCB_PrimitiveDimension;`
- **toasync**: `function toAsync(): IPCB_PrimitiveDimension;`
- **tosync**: `function toSync(): IPCB_PrimitiveDimension;`
---
## IPCB_PrimitiveFill
Fill primitive
```typescript
class IPCB_PrimitiveFill implements IPCB_Primitive
```
- **converttopolyline**: `function convertToPolyline(): Promise<IPCB_PrimitivePolyline>;`
- **converttopour**: `function convertToPour(): Promise<IPCB_PrimitivePour>;`
- **converttoregion**: `function convertToRegion(): Promise<IPCB_PrimitiveRegion>;`
- **done**: `function done(): Promise<IPCB_PrimitiveFill>;`
- **getstate_complexpolygon**: `function getState_ComplexPolygon(): IPCB_Polygon;`
- **getstate_fillmode**: `function getState_FillMode(): EPCB_PrimitiveFillMode | undefined;`
- **getstate_layer**: `function getState_Layer(): TPCB_LayersOfFill;`
- **getstate_linewidth**: `function getState_LineWidth(): number;`
- **getstate_net**: `function getState_Net(): string | undefined;`
- **getstate_primitiveid**: `function getState_PrimitiveId(): string;`
- **getstate_primitivelock**: `function getState_PrimitiveLock(): boolean;`
- **getstate_primitivetype**: `function getState_PrimitiveType(): EPCB_PrimitiveType;`
- **isasync**: `function isAsync(): boolean;`
- **reset**: `function reset(): Promise<IPCB_PrimitiveFill>;`
- **setstate_complexpolygon**: `function setState_ComplexPolygon(complexPolygon: IPCB_Polygon): IPCB_PrimitiveFill;`
- **setstate_fillmode**: `function setState_FillMode(fillMode: EPCB_PrimitiveFillMode): IPCB_PrimitiveFill;`
- **setstate_layer**: `function setState_Layer(layer: TPCB_LayersOfFill): IPCB_PrimitiveFill;`
- **setstate_linewidth**: `function setState_LineWidth(lineWidth: number): IPCB_PrimitiveFill;`
- **setstate_net**: `function setState_Net(net: string): IPCB_PrimitiveFill;`
- **setstate_primitivelock**: `function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitiveFill;`
- **toasync**: `function toAsync(): IPCB_PrimitiveFill;`
- **tosync**: `function toSync(): IPCB_PrimitiveFill;`
---
## IPCB_PrimitiveImage
Image primitive
```typescript
class IPCB_PrimitiveImage implements IPCB_Primitive
```
- **done**: `function done(): Promise<IPCB_PrimitiveImage>;`
- **getstate_complexpolygon**: `function getState_ComplexPolygon(): TPCB_PolygonSourceArray | Array<TPCB_PolygonSourceArray>;`
- **getstate_height**: `function getState_Height(): number;`
- **getstate_horizonmirror**: `function getState_HorizonMirror(): boolean;`
- **getstate_layer**: `function getState_Layer(): TPCB_LayersOfImage;`
- **getstate_primitiveid**: `function getState_PrimitiveId(): string;`
- **getstate_primitivelock**: `function getState_PrimitiveLock(): boolean;`
- **getstate_primitivetype**: `function getState_PrimitiveType(): EPCB_PrimitiveType;`
- **getstate_rotation**: `function getState_Rotation(): number;`
- **getstate_width**: `function getState_Width(): number;`
- **getstate_x**: `function getState_X(): number;`
- **getstate_y**: `function getState_Y(): number;`
- **isasync**: `function isAsync(): boolean;`
- **reset**: `function reset(): Promise<IPCB_PrimitiveImage>;`
- **setstate_height**: `function setState_Height(height: number): IPCB_PrimitiveImage;`
- **setstate_horizonmirror**: `function setState_HorizonMirror(horizonMirror: boolean): IPCB_PrimitiveImage;`
- **setstate_layer**: `function setState_Layer(layer: TPCB_LayersOfImage): IPCB_PrimitiveImage;`
- **setstate_primitivelock**: `function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitiveImage;`
- **setstate_rotation**: `function setState_Rotation(rotation: number): IPCB_PrimitiveImage;`
- **setstate_width**: `function setState_Width(width: number): IPCB_PrimitiveImage;`
- **setstate_x**: `function setState_X(x: number): IPCB_PrimitiveImage;`
- **setstate_y**: `function setState_Y(y: number): IPCB_PrimitiveImage;`
- **toasync**: `function toAsync(): IPCB_PrimitiveImage;`
- **tosync**: `function toSync(): IPCB_PrimitiveImage;`
---
## IPCB_PrimitiveLine
Line primitive
```typescript
class IPCB_PrimitiveLine implements IPCB_Primitive
```
- **done**: `function done(): Promise<IPCB_PrimitiveLine>;`
- **getadjacentprimitives**: `function getAdjacentPrimitives(): Promise< Array<IPCB_PrimitiveLine | IPCB_PrimitiveVia | IPCB_PrimitiveArc> >;`
- **getentiretrack**: `function getEntireTrack(includeVias: false): Promise<Array<IPCB_PrimitiveLine | IPCB_PrimitiveArc>>;`
- **getentiretrack_1**: `function getEntireTrack( includeVias: true, ): Promise<Array<IPCB_PrimitiveLine | IPCB_PrimitiveArc | IPCB_PrimitiveVia>>;`
- **getstate_endx**: `function getState_EndX(): number;`
- **getstate_endy**: `function getState_EndY(): number;`
- **getstate_layer**: `function getState_Layer(): TPCB_LayersOfLine;`
- **getstate_linewidth**: `function getState_LineWidth(): number;`
- **getstate_net**: `function getState_Net(): string;`
- **getstate_primitiveid**: `function getState_PrimitiveId(): string;`
- **getstate_primitivelock**: `function getState_PrimitiveLock(): boolean;`
- **getstate_primitivetype**: `function getState_PrimitiveType(): EPCB_PrimitiveType;`
- **getstate_startx**: `function getState_StartX(): number;`
- **getstate_starty**: `function getState_StartY(): number;`
- **isasync**: `function isAsync(): boolean;`
- **reset**: `function reset(): Promise<IPCB_PrimitiveLine>;`
- **setstate_endx**: `function setState_EndX(endX: number): IPCB_PrimitiveLine;`
- **setstate_endy**: `function setState_EndY(endY: number): IPCB_PrimitiveLine;`
- **setstate_layer**: `function setState_Layer(layer: TPCB_LayersOfLine): IPCB_PrimitiveLine;`
- **setstate_linewidth**: `function setState_LineWidth(lineWidth: number): IPCB_PrimitiveLine;`
- **setstate_net**: `function setState_Net(net: string): IPCB_PrimitiveLine;`
- **setstate_primitivelock**: `function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitiveLine;`
- **setstate_startx**: `function setState_StartX(startX: number): IPCB_PrimitiveLine;`
- **setstate_starty**: `function setState_StartY(startY: number): IPCB_PrimitiveLine;`
- **toasync**: `function toAsync(): IPCB_PrimitiveLine;`
- **tosync**: `function toSync(): IPCB_PrimitiveLine;`
---
## IPCB_PrimitiveObject
Binary embedded object primitive
```typescript
class IPCB_PrimitiveObject implements IPCB_Primitive
```
- **done**: `function done(): Promise<IPCB_PrimitiveObject>;`
- **getstate_binarydata**: `function getState_BinaryData(): string;`
- **getstate_filename**: `function getState_FileName(): string;`
- **getstate_height**: `function getState_Height(): number;`
- **getstate_layer**: `function getState_Layer(): TPCB_LayersOfObject | undefined;`
- **getstate_mirror**: `function getState_Mirror(): boolean;`
- **getstate_primitiveid**: `function getState_PrimitiveId(): string;`
- **getstate_primitivelock**: `function getState_PrimitiveLock(): boolean;`
- **getstate_primitivetype**: `function getState_PrimitiveType(): EPCB_PrimitiveType;`
- **getstate_rotation**: `function getState_Rotation(): number;`
- **getstate_topleftx**: `function getState_TopLeftX(): number | undefined;`
- **getstate_toplefty**: `function getState_TopLeftY(): number | undefined;`
- **getstate_width**: `function getState_Width(): number;`
- **isasync**: `function isAsync(): boolean;`
- **reset**: `function reset(): Promise<IPCB_PrimitiveObject>;`
- **setstate_binarydata**: `function setState_BinaryData(binaryData: string): IPCB_PrimitiveObject;`
- **setstate_filename**: `function setState_FileName(fileName: string): IPCB_PrimitiveObject;`
- **setstate_height**: `function setState_Height(height: number): IPCB_PrimitiveObject;`
- **setstate_layer**: `function setState_Layer(layer: TPCB_LayersOfObject): IPCB_PrimitiveObject;`
- **setstate_mirror**: `function setState_Mirror(mirror: boolean): IPCB_PrimitiveObject;`
- **setstate_primitivelock**: `function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitiveObject;`
- **setstate_rotation**: `function setState_Rotation(rotation: number): IPCB_PrimitiveObject;`
- **setstate_topleftx**: `function setState_TopLeftX(topLeftX: number): IPCB_PrimitiveObject;`
- **setstate_toplefty**: `function setState_TopLeftY(topLeftY: number): IPCB_PrimitiveObject;`
- **setstate_width**: `function setState_Width(width: number): IPCB_PrimitiveObject;`
- **toasync**: `function toAsync(): IPCB_PrimitiveObject;`
- **tosync**: `function toSync(): IPCB_PrimitiveObject;`
---
## IPCB_PrimitivePad
Pad primitive
```typescript
class IPCB_PrimitivePad implements IPCB_Primitive
```
- **async**: `function async: boolean;`
- **create**: `function create(): Promise<IPCB_PrimitivePad>;`
- **done**: `function done(): Promise<IPCB_PrimitivePad>;`
- **getstate_heatwelding**: `function getState_HeatWelding(): IPCB_PrimitivePadHeatWelding | null;`
- **getstate_hole**: `function getState_Hole(): TPCB_PrimitivePadHole | null;`
- **getstate_holeoffsetx**: `function getState_HoleOffsetX(): number;`
- **getstate_holeoffsety**: `function getState_HoleOffsetY(): number;`
- **getstate_holerotation**: `function getState_HoleRotation(): number;`
- **getstate_layer**: `function getState_Layer(): TPCB_LayersOfPad;`
- **getstate_metallization**: `function getState_Metallization(): boolean;`
- **getstate_net**: `function getState_Net(): string | undefined;`
- **getstate_pad**: `function getState_Pad(): TPCB_PrimitivePadShape | undefined;`
- **getstate_padnumber**: `function getState_PadNumber(): string;`
- **getstate_padtype**: `function getState_PadType(): EPCB_PrimitivePadType;`
- **getstate_primitiveid**: `function getState_PrimitiveId(): string;`
- **getstate_primitivelock**: `function getState_PrimitiveLock(): boolean;`
- **getstate_primitivetype**: `function getState_PrimitiveType(): EPCB_PrimitiveType;`
- **getstate_rotation**: `function getState_Rotation(): number;`
- **getstate_soldermaskandpastemaskexpansion**: `function getState_SolderMaskAndPasteMaskExpansion(): IPCB_PrimitiveSolderMaskAndPasteMaskExpansion | null;`
- **getstate_specialpad**: `function getState_SpecialPad(): TPCB_PrimitiveSpecialPadShape | undefined;`
- **getstate_x**: `function getState_X(): number;`
- **getstate_y**: `function getState_Y(): number;`
- **heatwelding**: `function heatWelding: IPCB_PrimitivePadHeatWelding | null;`
- **hole**: `function hole: TPCB_PrimitivePadHole | null;`
- **holeoffsetx**: `function holeOffsetX: number;`
- **holeoffsety**: `function holeOffsetY: number;`
- **holerotation**: `function holeRotation: number;`
- **isasync**: `function isAsync(): boolean;`
- **layer**: `function layer: TPCB_LayersOfPad;`
- **metallization**: `function metallization: boolean;`
- **net**: `function net?: string;`
- **pad**: `function pad?: TPCB_PrimitivePadShape;`
- **padnumber**: `function padNumber: string;`
- **padtype**: `function padType: EPCB_PrimitivePadType;`
- **primitiveid**: `function primitiveId?: string;`
- **primitivelock**: `function primitiveLock: boolean;`
- **primitivetype**: `function readonly primitiveType: EPCB_PrimitiveType;`
- **reset**: `function reset(): Promise<IPCB_PrimitivePad>;`
- **rotation**: `function rotation: number;`
- **setstate_heatwelding**: `function setState_HeatWelding(heatWelding: IPCB_PrimitivePadHeatWelding | null): IPCB_PrimitivePad;`
- **setstate_hole**: `function setState_Hole(hole: TPCB_PrimitivePadHole): IPCB_PrimitivePad;`
- **setstate_holeoffsetx**: `function setState_HoleOffsetX(holeOffsetX: number): IPCB_PrimitivePad;`
- **setstate_holeoffsety**: `function setState_HoleOffsetY(holeOffsetY: number): IPCB_PrimitivePad;`
- **setstate_holerotation**: `function setState_HoleRotation(holeRotation: number): IPCB_PrimitivePad;`
- **setstate_layer**: `function setState_Layer(layer: TPCB_LayersOfPad): IPCB_PrimitivePad;`
- **setstate_metallization**: `function setState_Metallization(metallization: boolean): IPCB_PrimitivePad;`
- **setstate_net**: `function setState_Net(net?: string): IPCB_PrimitivePad;`
- **setstate_pad**: `function setState_Pad(pad: TPCB_PrimitivePadShape): IPCB_PrimitivePad;`
- **setstate_padnumber**: `function setState_PadNumber(padNumber: string): IPCB_PrimitivePad;`
- **setstate_primitivelock**: `function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitivePad;`
- **setstate_rotation**: `function setState_Rotation(rotation: number): IPCB_PrimitivePad;`
- **setstate_soldermaskandpastemaskexpansion**: `function setState_SolderMaskAndPasteMaskExpansion( solderMaskAndPasteMaskExpansion: IPCB_PrimitiveSolderMaskAndPasteMaskExpansion | null, ): IPCB_PrimitivePad;`
- **setstate_specialpad**: `function setState_SpecialPad(specialPad: TPCB_PrimitiveSpecialPadShape): IPCB_PrimitivePad;`
- **setstate_x**: `function setState_X(x: number): IPCB_PrimitivePad;`
- **setstate_y**: `function setState_Y(y: number): IPCB_PrimitivePad;`
- **soldermaskandpastemaskexpansion**: `function solderMaskAndPasteMaskExpansion: IPCB_PrimitiveSolderMaskAndPasteMaskExpansion | null;`
- **specialpad**: `function specialPad?: TPCB_PrimitiveSpecialPadShape;`
- **toasync**: `function toAsync(): IPCB_PrimitivePad;`
- **tosync**: `function toSync(): IPCB_PrimitivePad;`
- **x**: `function x: number;`
- **y**: `function y: number;`
---
## IPCB_PrimitivePolyline
Polyline primitive
```typescript
class IPCB_PrimitivePolyline implements IPCB_Primitive
```
- **converttofill**: `function convertToFill(): Promise<IPCB_PrimitiveFill>;`
- **converttopour**: `function convertToPour(): Promise<IPCB_PrimitivePour>;`
- **converttoregion**: `function convertToRegion(): Promise<IPCB_PrimitiveRegion>;`
- **done**: `function done(): Promise<IPCB_PrimitivePolyline>;`
- **getstate_layer**: `function getState_Layer(): TPCB_LayersOfLine;`
- **getstate_linewidth**: `function getState_LineWidth(): number;`
- **getstate_net**: `function getState_Net(): string;`
- **getstate_polygon**: `function getState_Polygon(): IPCB_Polygon;`
- **getstate_primitiveid**: `function getState_PrimitiveId(): string;`
- **getstate_primitivelock**: `function getState_PrimitiveLock(): boolean;`
- **getstate_primitivetype**: `function getState_PrimitiveType(): EPCB_PrimitiveType;`
- **isasync**: `function isAsync(): boolean;`
- **reset**: `function reset(): Promise<IPCB_PrimitivePolyline>;`
- **setstate_layer**: `function setState_Layer(layer: TPCB_LayersOfLine): IPCB_PrimitivePolyline;`
- **setstate_linewidth**: `function setState_LineWidth(lineWidth: number): IPCB_PrimitivePolyline;`
- **setstate_net**: `function setState_Net(net: string): IPCB_PrimitivePolyline;`
- **setstate_polygon**: `function setState_Polygon(polygon: IPCB_Polygon): IPCB_PrimitivePolyline;`
- **setstate_primitivelock**: `function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitivePolyline;`
- **toasync**: `function toAsync(): IPCB_PrimitivePolyline;`
- **tosync**: `function toSync(): IPCB_PrimitivePolyline;`
---
## IPCB_PrimitivePour
Copper border primitive
```typescript
class IPCB_PrimitivePour implements IPCB_Primitive
```
- **converttofill**: `function convertToFill(): Promise<IPCB_PrimitiveFill>;`
- **converttopolyline**: `function convertToPolyline(): Promise<IPCB_PrimitivePolyline>;`
- **converttoregion**: `function convertToRegion(): Promise<IPCB_PrimitiveRegion>;`
- **done**: `function done(): Promise<IPCB_PrimitivePour>;`
- **getcopperregion**: `function getCopperRegion(): Promise<IPCB_PrimitivePoured | undefined>;`
- **getstate_complexpolygon**: `function getState_ComplexPolygon(): IPCB_Polygon;`
- **getstate_layer**: `function getState_Layer(): TPCB_LayersOfCopper;`
- **getstate_linewidth**: `function getState_LineWidth(): number;`
- **getstate_net**: `function getState_Net(): string;`
- **getstate_pourfillmethod**: `function getState_PourFillMethod(): any;`
- **getstate_pourname**: `function getState_PourName(): string;`
- **getstate_pourpriority**: `function getState_PourPriority(): number;`
- **getstate_preservesilos**: `function getState_PreserveSilos(): boolean;`
- **getstate_primitiveid**: `function getState_PrimitiveId(): string;`
- **getstate_primitivelock**: `function getState_PrimitiveLock(): boolean;`
- **getstate_primitivetype**: `function getState_PrimitiveType(): EPCB_PrimitiveType;`
- **isasync**: `function isAsync(): boolean;`
- **rebuildcopperregion**: `function rebuildCopperRegion(): Promise<IPCB_PrimitivePoured | undefined>;`
- **reset**: `function reset(): Promise<IPCB_PrimitivePour>;`
- **setstate_complexpolygon**: `function setState_ComplexPolygon(complexPolygon: IPCB_Polygon): IPCB_PrimitivePour;`
- **setstate_layer**: `function setState_Layer(layer: TPCB_LayersOfCopper): IPCB_PrimitivePour;`
- **setstate_linewidth**: `function setState_LineWidth(lineWidth: number): IPCB_PrimitivePour;`
- **setstate_net**: `function setState_Net(net: string): IPCB_PrimitivePour;`
- **setstate_pourfillmethod**: `function setState_PourFillMethod(pourFillMethod: EPCB_PrimitivePourFillMethod): IPCB_PrimitivePour;`
- **setstate_pourname**: `function setState_PourName(pourName: string): IPCB_PrimitivePour;`
- **setstate_pourpriority**: `function setState_PourPriority(pourPriority: number): IPCB_PrimitivePour;`
- **setstate_preservesilos**: `function setState_PreserveSilos(preserveSilos: boolean): IPCB_PrimitivePour;`
- **setstate_primitivelock**: `function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitivePour;`
- **toasync**: `function toAsync(): IPCB_PrimitivePour;`
- **tosync**: `function toSync(): IPCB_PrimitivePour;`
---
## IPCB_PrimitivePoured
Copper fill primitive
```typescript
class IPCB_PrimitivePoured implements IPCB_Primitive
```
- **addsoldermaskfill**: `function addSolderMaskFill( pourFillId: IPCB_PrimitivePouredPourFill['id'], ): Promise<IPCB_PrimitiveFill | undefined>;`
- **converttofill**: `function convertToFill( pourFillId: IPCB_PrimitivePouredPourFill['id'], ): Promise<IPCB_PrimitiveFill | undefined>;`
- **deletepourfills**: `function deletePourFills( pourFillIds: IPCB_PrimitivePouredPourFill['id'] | Array<IPCB_PrimitivePouredPourFill['id']>, ): Promise<boolean>;`
- **getstate_pourfills**: `function getState_PourFills(): Array<IPCB_PrimitivePouredPourFill>;`
- **getstate_pourprimitiveid**: `function getState_PourPrimitiveId(): string;`
- **getstate_primitiveid**: `function getState_PrimitiveId(): string;`
- **getstate_primitivetype**: `function getState_PrimitiveType(): EPCB_PrimitiveType;`
- **reset**: `function reset(): Promise<IPCB_PrimitivePoured>;`
---
## IPCB_PrimitiveRegion
Region primitive
```typescript
class IPCB_PrimitiveRegion implements IPCB_Primitive
```
- **converttofill**: `function convertToFill(): Promise<IPCB_PrimitiveFill>;`
- **converttopolyline**: `function convertToPolyline(): Promise<IPCB_PrimitivePolyline>;`
- **converttopour**: `function convertToPour(): Promise<IPCB_PrimitivePour>;`
- **done**: `function done(): Promise<IPCB_PrimitiveRegion>;`
- **getstate_complexpolygon**: `function getState_ComplexPolygon(): IPCB_Polygon;`
- **getstate_layer**: `function getState_Layer(): TPCB_LayersOfRegion;`
- **getstate_linewidth**: `function getState_LineWidth(): number;`
- **getstate_primitiveid**: `function getState_PrimitiveId(): string;`
- **getstate_primitivelock**: `function getState_PrimitiveLock(): boolean;`
- **getstate_primitivetype**: `function getState_PrimitiveType(): EPCB_PrimitiveType;`
- **getstate_regionname**: `function getState_RegionName(): string | undefined;`
- **getstate_ruletype**: `function getState_RuleType(): Array<EPCB_PrimitiveRegionRuleType>;`
- **isasync**: `function isAsync(): boolean;`
- **reset**: `function reset(): Promise<IPCB_PrimitiveRegion>;`
- **setstate_complexpolygon**: `function setState_ComplexPolygon(complexPolygon: IPCB_Polygon): IPCB_PrimitiveRegion;`
- **setstate_layer**: `function setState_Layer(layer: TPCB_LayersOfRegion): IPCB_PrimitiveRegion;`
- **setstate_linewidth**: `function setState_LineWidth(lineWidth: number): IPCB_PrimitiveRegion;`
- **setstate_primitivelock**: `function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitiveRegion;`
- **setstate_regionname**: `function setState_RegionName(regionName?: string): IPCB_PrimitiveRegion;`
- **setstate_ruletype**: `function setState_RuleType(ruleType: Array<EPCB_PrimitiveRegionRuleType>): IPCB_PrimitiveRegion;`
- **toasync**: `function toAsync(): IPCB_PrimitiveRegion;`
- **tosync**: `function toSync(): IPCB_PrimitiveRegion;`
---
## IPCB_PrimitiveString
Text primitive
```typescript
class IPCB_PrimitiveString implements IPCB_Primitive
```
- **_constructor_**: `function constructor( layer: TPCB_LayersOfImage, x: number, y: number, text: string, fontFamily?: string, fontSize?: number, lineWidth?: number, alignMode?: EPCB_PrimitiveStringAlignMode, rotation?: number, reverse?: boolean, expansion?: number, mirror?: boolean, primitiveLock?: boolean, primitiveId?: string, );`
- **done**: `function done(): Promise<IPCB_PrimitiveString>;`
- **getstate_alignmode**: `function getState_AlignMode(): EPCB_PrimitiveStringAlignMode;`
- **getstate_expansion**: `function getState_Expansion(): number;`
- **getstate_fontfamily**: `function getState_FontFamily(): string;`
- **getstate_fontsize**: `function getState_FontSize(): number;`
- **getstate_layer**: `function getState_Layer(): TPCB_LayersOfImage;`
- **getstate_linewidth**: `function getState_LineWidth(): number;`
- **getstate_mirror**: `function getState_Mirror(): boolean;`
- **getstate_primitiveid**: `function getState_PrimitiveId(): string;`
- **getstate_primitivelock**: `function getState_PrimitiveLock(): boolean;`
- **getstate_primitivetype**: `function getState_PrimitiveType(): EPCB_PrimitiveType;`
- **getstate_reverse**: `function getState_Reverse(): boolean;`
- **getstate_rotation**: `function getState_Rotation(): number;`
- **getstate_text**: `function getState_Text(): string;`
- **getstate_x**: `function getState_X(): number;`
- **getstate_y**: `function getState_Y(): number;`
- **isasync**: `function isAsync(): boolean;`
- **reset**: `function reset(): Promise<IPCB_PrimitiveString>;`
- **setstate_alignmode**: `function setState_AlignMode(alignMode: EPCB_PrimitiveStringAlignMode): IPCB_PrimitiveString;`
- **setstate_expansion**: `function setState_Expansion(expansion: number): IPCB_PrimitiveString;`
- **setstate_fontfamily**: `function setState_FontFamily(fontFamily: string): IPCB_PrimitiveString;`
- **setstate_fontsize**: `function setState_FontSize(fontSize: number): IPCB_PrimitiveString;`
- **setstate_layer**: `function setState_Layer(layer: TPCB_LayersOfImage): IPCB_PrimitiveString;`
- **setstate_linewidth**: `function setState_LineWidth(lineWidth: number): IPCB_PrimitiveString;`
- **setstate_mirror**: `function setState_Mirror(mirror: boolean): IPCB_PrimitiveString;`
- **setstate_primitivelock**: `function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitiveString;`
- **setstate_reverse**: `function setState_Reverse(reverse: boolean): IPCB_PrimitiveString;`
- **setstate_rotation**: `function setState_Rotation(rotation: number): IPCB_PrimitiveString;`
- **setstate_text**: `function setState_Text(text: string): IPCB_PrimitiveString;`
- **setstate_x**: `function setState_X(x: number): IPCB_PrimitiveString;`
- **setstate_y**: `function setState_Y(y: number): IPCB_PrimitiveString;`
- **toasync**: `function toAsync(): IPCB_PrimitiveString;`
- **tosync**: `function toSync(): IPCB_PrimitiveString;`
---
## IPCB_PrimitiveVia
Via primitive
```typescript
class IPCB_PrimitiveVia implements IPCB_Primitive
```
- **done**: `function done(): Promise<IPCB_PrimitiveVia>;`
- **getadjacentprimitives**: `function getAdjacentPrimitives(): Promise<Array<IPCB_PrimitiveLine | IPCB_PrimitiveArc>>;`
- **getstate_designruleblindvianame**: `function getState_DesignRuleBlindViaName(): string | null;`
- **getstate_diameter**: `function getState_Diameter(): number;`
- **getstate_holediameter**: `function getState_HoleDiameter(): number;`
- **getstate_net**: `function getState_Net(): string;`
- **getstate_primitiveid**: `function getState_PrimitiveId(): string;`
- **getstate_primitivelock**: `function getState_PrimitiveLock(): boolean;`
- **getstate_primitivetype**: `function getState_PrimitiveType(): EPCB_PrimitiveType;`
- **getstate_soldermaskexpansion**: `function getState_SolderMaskExpansion(): IPCB_PrimitiveSolderMaskAndPasteMaskExpansion | null;`
- **getstate_viatype**: `function getState_ViaType(): EPCB_PrimitiveViaType;`
- **getstate_x**: `function getState_X(): number;`
- **getstate_y**: `function getState_Y(): number;`
- **isasync**: `function isAsync(): boolean;`
- **reset**: `function reset(): Promise<IPCB_PrimitiveVia>;`
- **setstate_designruleblindvianame**: `function setState_DesignRuleBlindViaName(designRuleBlindViaName: string | null): IPCB_PrimitiveVia;`
- **setstate_diameter**: `function setState_Diameter(diameter: number): IPCB_PrimitiveVia;`
- **setstate_holediameter**: `function setState_HoleDiameter(holeDiameter: number): IPCB_PrimitiveVia;`
- **setstate_net**: `function setState_Net(net: string): IPCB_PrimitiveVia;`
- **setstate_primitivelock**: `function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitiveVia;`
- **setstate_soldermaskexpansion**: `function setState_SolderMaskExpansion( solderMaskExpansion: IPCB_PrimitiveSolderMaskAndPasteMaskExpansion | null, ): IPCB_PrimitiveVia;`
- **setstate_viatype**: `function setState_ViaType(viaType: EPCB_PrimitiveViaType): IPCB_PrimitiveVia;`
- **setstate_x**: `function setState_X(x: number): IPCB_PrimitiveVia;`
- **setstate_y**: `function setState_Y(y: number): IPCB_PrimitiveVia;`
- **toasync**: `function toAsync(): IPCB_PrimitiveVia;`
- **tosync**: `function toSync(): IPCB_PrimitiveVia;`
---
## ISCH_PrimitiveArc
Arc primitive
```typescript
class ISCH_PrimitiveArc implements ISCH_Primitive
```
- **done**: `function done(): Promise<ISCH_PrimitiveArc>;`
- **getstate_color**: `function getState_Color(): string | null;`
- **getstate_endx**: `function getState_EndX(): number;`
- **getstate_endy**: `function getState_EndY(): number;`
- **getstate_fillcolor**: `function getState_FillColor(): string | null;`
- **getstate_linetype**: `function getState_LineType(): ESCH_PrimitiveLineType | null;`
- **getstate_linewidth**: `function getState_LineWidth(): number | null;`
- **getstate_primitiveid**: `function getState_PrimitiveId(): string;`
- **getstate_primitivetype**: `function getState_PrimitiveType(): ESCH_PrimitiveType;`
- **getstate_referencex**: `function getState_ReferenceX(): number;`
- **getstate_referencey**: `function getState_ReferenceY(): number;`
- **getstate_startx**: `function getState_StartX(): number;`
- **getstate_starty**: `function getState_StartY(): number;`
- **isasync**: `function isAsync(): boolean;`
- **reset**: `function reset(): Promise<ISCH_PrimitiveArc>;`
- **setstate_color**: `function setState_Color(color: string | null): ISCH_PrimitiveArc;`
- **setstate_endx**: `function setState_EndX(endX: number): ISCH_PrimitiveArc;`
- **setstate_endy**: `function setState_EndY(endY: number): ISCH_PrimitiveArc;`
- **setstate_fillcolor**: `function setState_FillColor(fillColor: string | null): ISCH_PrimitiveArc;`
- **setstate_linetype**: `function setState_LineType(lineType: ESCH_PrimitiveLineType | null): ISCH_PrimitiveArc;`
- **setstate_linewidth**: `function setState_LineWidth(lineWidth: number | null): ISCH_PrimitiveArc;`
- **setstate_referencex**: `function setState_ReferenceX(referenceX: number): ISCH_PrimitiveArc;`
- **setstate_referencey**: `function setState_ReferenceY(referenceY: number): ISCH_PrimitiveArc;`
- **setstate_startx**: `function setState_StartX(startX: number): ISCH_PrimitiveArc;`
- **setstate_starty**: `function setState_StartY(startY: number): ISCH_PrimitiveArc;`
- **toasync**: `function toAsync(): ISCH_PrimitiveArc;`
- **tosync**: `function toSync(): ISCH_PrimitiveArc;`
---
## ISCH_PrimitiveAttribute
Property primitive
```typescript
class ISCH_PrimitiveAttribute implements ISCH_Primitive
```
- **done**: `function done(): Promise<ISCH_PrimitiveAttribute>;`
- **getstate_alignmode**: `function getState_AlignMode(): ESCH_PrimitiveTextAlignMode | null;`
- **getstate_bold**: `function getState_Bold(): boolean | null;`
- **getstate_color**: `function getState_Color(): string | null;`
- **getstate_fillcolor**: `function getState_FillColor(): string | null;`
- **getstate_fontname**: `function getState_FontName(): string | null;`
- **getstate_fontsize**: `function getState_FontSize(): number | null;`
- **getstate_italic**: `function getState_Italic(): boolean | null;`
- **getstate_key**: `function getState_Key(): string;`
- **getstate_keyvisible**: `function getState_KeyVisible(): boolean | null;`
- **getstate_parentprimitiveid**: `function getState_ParentPrimitiveId(): string;`
- **getstate_primitiveid**: `function getState_PrimitiveId(): string;`
- **getstate_primitivetype**: `function getState_PrimitiveType(): ESCH_PrimitiveType;`
- **getstate_rotation**: `function getState_Rotation(): number | null;`
- **getstate_underline**: `function getState_UnderLine(): boolean | null;`
- **getstate_value**: `function getState_Value(): string;`
- **getstate_valuevisible**: `function getState_ValueVisible(): boolean | null;`
- **getstate_x**: `function getState_X(): number | null;`
- **getstate_y**: `function getState_Y(): number | null;`
- **isasync**: `function isAsync(): boolean;`
- **reset**: `function reset(): Promise<ISCH_PrimitiveAttribute>;`
- **setstate_alignmode**: `function setState_AlignMode(alignMode: ESCH_PrimitiveTextAlignMode | null): ISCH_PrimitiveAttribute;`
- **setstate_bold**: `function setState_Bold(bold: boolean | null): ISCH_PrimitiveAttribute;`
- **setstate_color**: `function setState_Color(color: string | null): ISCH_PrimitiveAttribute;`
- **setstate_fillcolor**: `function setState_FillColor(fillColor: string | null): ISCH_PrimitiveAttribute;`
- **setstate_fontname**: `function setState_FontName(fontName: string | null): ISCH_PrimitiveAttribute;`
- **setstate_fontsize**: `function setState_FontSize(fontSize: number | null): ISCH_PrimitiveAttribute;`
- **setstate_italic**: `function setState_Italic(italic: boolean | null): ISCH_PrimitiveAttribute;`
- **setstate_key**: `function setState_Key(key: string): ISCH_PrimitiveAttribute;`
- **setstate_keyvisible**: `function setState_KeyVisible(keyVisible: boolean | null): ISCH_PrimitiveAttribute;`
- **setstate_rotation**: `function setState_Rotation(rotation: number | null): ISCH_PrimitiveAttribute;`
- **setstate_underline**: `function setState_UnderLine(underLine: boolean | null): ISCH_PrimitiveAttribute;`
- **setstate_value**: `function setState_Value(value: string): ISCH_PrimitiveAttribute;`
- **setstate_valuevisible**: `function setState_ValueVisible(valueVisible: boolean | null): ISCH_PrimitiveAttribute;`
- **setstate_x**: `function setState_X(x: number | null): ISCH_PrimitiveAttribute;`
- **setstate_y**: `function setState_Y(y: number | null): ISCH_PrimitiveAttribute;`
- **toasync**: `function toAsync(): ISCH_PrimitiveAttribute;`
- **tosync**: `function toSync(): ISCH_PrimitiveAttribute;`
---
## ISCH_PrimitiveBus
Bus primitive
```typescript
class ISCH_PrimitiveBus implements ISCH_Primitive
```
- **done**: `function done(): Promise<ISCH_PrimitiveBus>;`
- **getstate_busname**: `function getState_BusName(): string;`
- **getstate_color**: `function getState_Color(): string | null;`
- **getstate_line**: `function getState_Line(): Array<number> | Array<Array<number>>;`
- **getstate_linetype**: `function getState_LineType(): ESCH_PrimitiveLineType | null;`
- **getstate_linewidth**: `function getState_LineWidth(): number | null;`
- **getstate_primitiveid**: `function getState_PrimitiveId(): string;`
- **getstate_primitivetype**: `function getState_PrimitiveType(): ESCH_PrimitiveType;`
- **isasync**: `function isAsync(): boolean;`
- **setstate_busname**: `function setState_BusName(busName: string): ISCH_PrimitiveBus;`
- **setstate_color**: `function setState_Color(color: string | null): ISCH_PrimitiveBus;`
- **setstate_line**: `function setState_Line(line: Array<number> | Array<Array<number>>): ISCH_PrimitiveBus;`
- **setstate_linetype**: `function setState_LineType(lineType: ESCH_PrimitiveLineType | null): ISCH_PrimitiveBus;`
- **setstate_linewidth**: `function setState_LineWidth(lineWidth: number | null): ISCH_PrimitiveBus;`
- **toasync**: `function toAsync(): ISCH_PrimitiveBus;`
- **tosync**: `function toSync(): ISCH_PrimitiveBus;`
---
## ISCH_PrimitiveCbbSymbolComponent
Reuse block symbol primitive
```typescript
class ISCH_PrimitiveCbbSymbolComponent extends ISCH_PrimitiveComponent
```
- **done**: `function done(): Promise<ISCH_PrimitiveCbbSymbolComponent>;`
- **getstate_cbb**: `function getState_Cbb(): { libraryUuid: string; uuid: string };`
- **getstate_cbbsymbol**: `function getState_CbbSymbol(): { libraryUuid: string; cbbUuid: string; uuid?: string; name?: string; };`
- **reset**: `function reset(): Promise<ISCH_PrimitiveCbbSymbolComponent>;`
---
## ISCH_PrimitiveCircle
Circle primitive
```typescript
class ISCH_PrimitiveCircle implements ISCH_Primitive
```
- **done**: `function done(): Promise<ISCH_PrimitiveCircle>;`
- **getstate_centerx**: `function getState_CenterX(): number;`
- **getstate_centery**: `function getState_CenterY(): number;`
- **getstate_color**: `function getState_Color(): string | null;`
- **getstate_fillcolor**: `function getState_FillColor(): string | null;`
- **getstate_fillstyle**: `function getState_FillStyle(): ESCH_PrimitiveFillStyle | null;`
- **getstate_linetype**: `function getState_LineType(): ESCH_PrimitiveLineType | null;`
- **getstate_linewidth**: `function getState_LineWidth(): number | null;`
- **getstate_primitiveid**: `function getState_PrimitiveId(): string;`
- **getstate_primitivetype**: `function getState_PrimitiveType(): ESCH_PrimitiveType;`
- **getstate_radius**: `function getState_Radius(): number;`
- **isasync**: `function isAsync(): boolean;`
- **reset**: `function reset(): Promise<ISCH_PrimitiveCircle>;`
- **setstate_centerx**: `function setState_CenterX(centerX: number): ISCH_PrimitiveCircle;`
- **setstate_centery**: `function setState_CenterY(centerY: number): ISCH_PrimitiveCircle;`
- **setstate_color**: `function setState_Color(color: string | null): ISCH_PrimitiveCircle;`
- **setstate_fillcolor**: `function setState_FillColor(fillColor: string | null): ISCH_PrimitiveCircle;`
- **setstate_fillstyle**: `function setState_FillStyle(fillStyle: ESCH_PrimitiveFillStyle | null): ISCH_PrimitiveCircle;`
- **setstate_linetype**: `function setState_LineType(lineType: ESCH_PrimitiveLineType | null): ISCH_PrimitiveCircle;`
- **setstate_linewidth**: `function setState_LineWidth(lineWidth: number | null): ISCH_PrimitiveCircle;`
- **setstate_radius**: `function setState_Radius(radius: number): ISCH_PrimitiveCircle;`
- **toasync**: `function toAsync(): ISCH_PrimitiveCircle;`
- **tosync**: `function toSync(): ISCH_PrimitiveCircle;`
---
## ISCH_PrimitiveComponent
Device primitive
```typescript
class ISCH_PrimitiveComponent implements ISCH_Primitive
```
- **async**: `function async: boolean;`
- **designator**: `function designator?: string;`
- **done**: `function done(): Promise<ISCH_PrimitiveComponent>;`
- **getallpins**: `function getAllPins(): Promise<Array<ISCH_PrimitiveComponentPin> | undefined>;`
- **getstate_addintobom**: `function getState_AddIntoBom(): boolean | undefined;`
- **getstate_addintopcb**: `function getState_AddIntoPcb(): boolean | undefined;`
- **getstate_component**: `function getState_Component(): { libraryUuid: string; uuid: string; name?: string } | undefined;`
- **getstate_componenttype**: `function getState_ComponentType(): ESCH_PrimitiveComponentType;`
- **getstate_designator**: `function getState_Designator(): string | undefined;`
- **getstate_footprint**: `function getState_Footprint(): { libraryUuid: string; uuid: string; name?: string } | undefined;`
- **getstate_manufacturer**: `function getState_Manufacturer(): string | undefined;`
- **getstate_manufacturerid**: `function getState_ManufacturerId(): string | undefined;`
- **getstate_mirror**: `function getState_Mirror(): boolean;`
- **getstate_name**: `function getState_Name(): string | undefined;`
- **getstate_net**: `function getState_Net(): string | undefined;`
- **getstate_otherproperty**: `function getState_OtherProperty(): Record<string, string | number | boolean> | undefined;`
- **getstate_primitiveid**: `function getState_PrimitiveId(): string;`
- **getstate_primitivetype**: `function getState_PrimitiveType(): ESCH_PrimitiveType;`
- **getstate_rotation**: `function getState_Rotation(): number;`
- **getstate_subpartname**: `function getState_SubPartName(): string | undefined;`
- **getstate_supplier**: `function getState_Supplier(): string | undefined;`
- **getstate_supplierid**: `function getState_SupplierId(): string | undefined;`
- **getstate_symbol**: `function getState_Symbol(): { libraryUuid: string; uuid: string; name?: string } | undefined;`
- **getstate_uniqueid**: `function getState_UniqueId(): string | undefined;`
- **getstate_x**: `function getState_X(): number;`
- **getstate_y**: `function getState_Y(): number;`
- **isasync**: `function isAsync(): boolean;`
- **mirror**: `function mirror: boolean;`
- **name**: `function name?: string;`
- **otherproperty**: `function otherProperty?: Record<string, string | number | boolean>;`
- **primitiveid**: `function primitiveId?: string;`
- **reset**: `function reset(): Promise<ISCH_PrimitiveComponent>;`
- **rotation**: `function rotation: number;`
- **setstate_addintobom**: `function setState_AddIntoBom(addIntoBom: boolean | undefined): ISCH_PrimitiveComponent;`
- **setstate_addintopcb**: `function setState_AddIntoPcb(addIntoPcb: boolean | undefined): ISCH_PrimitiveComponent;`
- **setstate_designator**: `function setState_Designator(designator: string | undefined): ISCH_PrimitiveComponent;`
- **setstate_manufacturer**: `function setState_Manufacturer(manufacturer: string | undefined): ISCH_PrimitiveComponent;`
- **setstate_manufacturerid**: `function setState_ManufacturerId(manufacturerId: string | undefined): ISCH_PrimitiveComponent;`
- **setstate_mirror**: `function setState_Mirror(mirror: boolean): ISCH_PrimitiveComponent;`
- **setstate_name**: `function setState_Name(name: string | undefined): ISCH_PrimitiveComponent;`
- **setstate_net**: `function setState_Net(net: string | undefined): ISCH_PrimitiveComponent;`
- **setstate_otherproperty**: `function setState_OtherProperty( otherProperty: Record<string, string | number | boolean>, ): ISCH_PrimitiveComponent;`
- **setstate_rotation**: `function setState_Rotation(rotation: number): ISCH_PrimitiveComponent;`
- **setstate_supplier**: `function setState_Supplier(supplier: string | undefined): ISCH_PrimitiveComponent;`
- **setstate_supplierid**: `function setState_SupplierId(supplierId: string | undefined): ISCH_PrimitiveComponent;`
- **setstate_uniqueid**: `function setState_UniqueId(uniqueId: string | undefined): ISCH_PrimitiveComponent;`
- **setstate_x**: `function setState_X(x: number): ISCH_PrimitiveComponent;`
- **setstate_y**: `function setState_Y(y: number): ISCH_PrimitiveComponent;`
- **toasync**: `function toAsync(): ISCH_PrimitiveComponent;`
- **tosync**: `function toSync(): ISCH_PrimitiveComponent;`
- **x**: `function x: number;`
- **y**: `function y: number;`
---
## ISCH_PrimitiveComponentPin
Device pin primitive
```typescript
class ISCH_PrimitiveComponentPin extends ISCH_PrimitivePin
```
- **done**: `function done(): Promise<ISCH_PrimitiveComponentPin>;`
- **primitivetype**: `function readonly primitiveType: ESCH_PrimitiveType.COMPONENT_PIN;`
---
## ISCH_PrimitiveObject
Binary embedded object primitive
```typescript
class ISCH_PrimitiveObject implements ISCH_Primitive
```
- **done**: `function done(): Promise<ISCH_PrimitiveObject>;`
- **getstate_content**: `function getState_Content(): File | string;`
- **getstate_filename**: `function getState_FileName(): string;`
- **getstate_height**: `function getState_Height(): number;`
- **getstate_mirror**: `function getState_Mirror(): boolean;`
- **getstate_primitiveid**: `function getState_PrimitiveId(): string;`
- **getstate_primitivetype**: `function getState_PrimitiveType(): ESCH_PrimitiveType;`
- **getstate_rotation**: `function getState_Rotation(): number;`
- **getstate_startx**: `function getState_StartX(): number;`
- **getstate_starty**: `function getState_StartY(): number;`
- **getstate_width**: `function getState_Width(): number;`
- **isasync**: `function isAsync(): boolean;`
- **reset**: `function reset(): Promise<ISCH_PrimitiveObject>;`
- **setstate_content**: `function setState_Content(content: File | string): ISCH_PrimitiveObject;`
- **setstate_filename**: `function setState_FileName(fileName: string): ISCH_PrimitiveObject;`
- **setstate_height**: `function setState_Height(height: number): ISCH_PrimitiveObject;`
- **setstate_mirror**: `function setState_Mirror(mirror: boolean): ISCH_PrimitiveObject;`
- **setstate_rotation**: `function setState_Rotation(rotation: number): ISCH_PrimitiveObject;`
- **setstate_startx**: `function setState_StartX(startX: number): ISCH_PrimitiveObject;`
- **setstate_starty**: `function setState_StartY(startY: number): ISCH_PrimitiveObject;`
- **setstate_width**: `function setState_Width(width: number): ISCH_PrimitiveObject;`
- **toasync**: `function toAsync(): ISCH_PrimitiveObject;`
- **tosync**: `function toSync(): ISCH_PrimitiveObject;`
---
## ISCH_PrimitivePin
Pin primitive
```typescript
class ISCH_PrimitivePin implements ISCH_Primitive
```
- **async**: `function async: boolean;`
- **done**: `function done(): Promise<ISCH_PrimitivePin>;`
- **getstate_noconnected**: `function getState_NoConnected(): boolean | undefined;`
- **getstate_otherproperty**: `function getState_OtherProperty(): Record<string, string | number | boolean> | undefined;`
- **getstate_pincolor**: `function getState_PinColor(): string | null;`
- **getstate_pinlength**: `function getState_PinLength(): number;`
- **getstate_pinname**: `function getState_PinName(): string;`
- **getstate_pinnumber**: `function getState_PinNumber(): string;`
- **getstate_pinshape**: `function getState_PinShape(): ESCH_PrimitivePinShape;`
- **getstate_pintype**: `function getState_pinType(): ESCH_PrimitivePinType;`
- **getstate_primitiveid**: `function getState_PrimitiveId(): string;`
- **getstate_primitivetype**: `function getState_PrimitiveType(): ESCH_PrimitiveType;`
- **getstate_rotation**: `function getState_Rotation(): number;`
- **getstate_x**: `function getState_X(): number;`
- **getstate_y**: `function getState_Y(): number;`
- **isasync**: `function isAsync(): boolean;`
- **noconnected**: `function noConnected?: boolean;`
- **otherproperty**: `function otherProperty?: Record<string, string | number | boolean>;`
- **pincolor**: `function pinColor: string | null;`
- **pinlength**: `function pinLength: number;`
- **pinname**: `function pinName: string;`
- **pinnumber**: `function pinNumber: string;`
- **pinshape**: `function pinShape: ESCH_PrimitivePinShape;`
- **pintype**: `function pinType: ESCH_PrimitivePinType;`
- **primitiveid**: `function primitiveId?: string;`
- **primitivetype**: `function readonly primitiveType: ESCH_PrimitiveType;`
- **reset**: `function reset(): Promise<ISCH_PrimitivePin>;`
- **rotation**: `function rotation: number;`
- **setstate_noconnected**: `function setState_NoConnected(noConnected: boolean): ISCH_PrimitivePin;`
- **setstate_otherproperty**: `function setState_OtherProperty( otherProperty: Record<string, string | number | boolean>, ): ISCH_PrimitivePin;`
- **setstate_pincolor**: `function setState_PinColor(pinColor: string | null): ISCH_PrimitivePin;`
- **setstate_pinlength**: `function setState_PinLength(pinLength: number): ISCH_PrimitivePin;`
- **setstate_pinname**: `function setState_PinName(pinName: string): ISCH_PrimitivePin;`
- **setstate_pinnumber**: `function setState_PinNumber(pinNumber: string): ISCH_PrimitivePin;`
- **setstate_pinshape**: `function setState_PinShape(pinShape: ESCH_PrimitivePinShape): ISCH_PrimitivePin;`
- **setstate_pintype**: `function setState_PinType(pinType: ESCH_PrimitivePinType): ISCH_PrimitivePin;`
- **setstate_rotation**: `function setState_Rotation(rotation: number): ISCH_PrimitivePin;`
- **setstate_x**: `function setState_X(x: number): ISCH_PrimitivePin;`
- **setstate_y**: `function setState_Y(y: number): ISCH_PrimitivePin;`
- **toasync**: `function toAsync(): ISCH_PrimitivePin;`
- **tosync**: `function toSync(): ISCH_PrimitivePin;`
- **x**: `function x: number;`
- **y**: `function y: number;`
---
## ISCH_PrimitivePolygon
Polygon (polyline) primitive
```typescript
class ISCH_PrimitivePolygon implements ISCH_Primitive
```
- **done**: `function done(): Promise<ISCH_PrimitivePolygon>;`
- **getstate_color**: `function getState_Color(): string | null;`
- **getstate_fillcolor**: `function getState_FillColor(): string | null;`
- **getstate_line**: `function getState_Line(): Array<number>;`
- **getstate_linetype**: `function getState_LineType(): ESCH_PrimitiveLineType | null;`
- **getstate_linewidth**: `function getState_LineWidth(): number | null;`
- **getstate_primitiveid**: `function getState_PrimitiveId(): string;`
- **getstate_primitivetype**: `function getState_PrimitiveType(): ESCH_PrimitiveType;`
- **isasync**: `function isAsync(): boolean;`
- **reset**: `function reset(): Promise<ISCH_PrimitivePolygon>;`
- **setstate_color**: `function setState_Color(color: string | null): ISCH_PrimitivePolygon;`
- **setstate_fillcolor**: `function setState_FillColor(fillColor: string | null): ISCH_PrimitivePolygon;`
- **setstate_line**: `function setState_Line(line: Array<number>): ISCH_PrimitivePolygon;`
- **setstate_linetype**: `function setState_LineType(lineType: ESCH_PrimitiveLineType | null): ISCH_PrimitivePolygon;`
- **setstate_linewidth**: `function setState_LineWidth(lineWidth: number | null): ISCH_PrimitivePolygon;`
- **toasync**: `function toAsync(): ISCH_PrimitivePolygon;`
- **tosync**: `function toSync(): ISCH_PrimitivePolygon;`
---
## ISCH_PrimitiveRectangle
Rectangle primitive
```typescript
class ISCH_PrimitiveRectangle implements ISCH_Primitive
```
- **done**: `function done(): Promise<ISCH_PrimitiveRectangle>;`
- **getstate_color**: `function getState_Color(): string | null;`
- **getstate_cornerradius**: `function getState_CornerRadius(): number;`
- **getstate_fillcolor**: `function getState_FillColor(): string | null;`
- **getstate_fillstyle**: `function getState_FillStyle(): ESCH_PrimitiveFillStyle | null;`
- **getstate_height**: `function getState_Height(): number;`
- **getstate_linetype**: `function getState_LineType(): ESCH_PrimitiveLineType | null;`
- **getstate_linewidth**: `function getState_LineWidth(): number | null;`
- **getstate_primitiveid**: `function getState_PrimitiveId(): string;`
- **getstate_primitivetype**: `function getState_PrimitiveType(): ESCH_PrimitiveType;`
- **getstate_rotation**: `function getState_Rotation(): number;`
- **getstate_topleftx**: `function getState_TopLeftX(): number;`
- **getstate_toplefty**: `function getState_TopLeftY(): number;`
- **getstate_width**: `function getState_Width(): number;`
- **isasync**: `function isAsync(): boolean;`
- **reset**: `function reset(): Promise<ISCH_PrimitiveRectangle>;`
- **setstate_color**: `function setState_Color(color: string | null): ISCH_PrimitiveRectangle;`
- **setstate_cornerradius**: `function setState_CornerRadius(cornerRadius: number): ISCH_PrimitiveRectangle;`
- **setstate_fillcolor**: `function setState_FillColor(fillColor: string | null): ISCH_PrimitiveRectangle;`
- **setstate_fillstyle**: `function setState_FillStyle(fillStyle: ESCH_PrimitiveFillStyle | null): ISCH_PrimitiveRectangle;`
- **setstate_height**: `function setState_Height(height: number): ISCH_PrimitiveRectangle;`
- **setstate_linetype**: `function setState_LineType(lineType: ESCH_PrimitiveLineType | null): ISCH_PrimitiveRectangle;`
- **setstate_linewidth**: `function setState_LineWidth(lineWidth: number | null): ISCH_PrimitiveRectangle;`
- **setstate_rotation**: `function setState_Rotation(rotation: number): ISCH_PrimitiveRectangle;`
- **setstate_topleftx**: `function setState_TopLeftX(topLeftX: number): ISCH_PrimitiveRectangle;`
- **setstate_toplefty**: `function setState_TopLeftY(topLeftY: number): ISCH_PrimitiveRectangle;`
- **setstate_width**: `function setState_Width(width: number): ISCH_PrimitiveRectangle;`
- **toasync**: `function toAsync(): ISCH_PrimitiveRectangle;`
- **tosync**: `function toSync(): ISCH_PrimitiveRectangle;`
---
## ISCH_PrimitiveText
Text primitive
```typescript
class ISCH_PrimitiveText implements ISCH_Primitive
```
- **done**: `function done(): Promise<ISCH_PrimitiveText>;`
- **getstate_alignmode**: `function getState_AlignMode(): ESCH_PrimitiveTextAlignMode;`
- **getstate_bold**: `function getState_Bold(): boolean;`
- **getstate_content**: `function getState_Content(): string;`
- **getstate_fontname**: `function getState_FontName(): string | null;`
- **getstate_fontsize**: `function getState_FontSize(): number | null;`
- **getstate_italic**: `function getState_Italic(): boolean;`
- **getstate_primitiveid**: `function getState_PrimitiveId(): string;`
- **getstate_primitivetype**: `function getState_PrimitiveType(): ESCH_PrimitiveType;`
- **getstate_rotation**: `function getState_Rotation(): number;`
- **getstate_textcolor**: `function getState_TextColor(): string | null;`
- **getstate_underline**: `function getState_UnderLine(): boolean;`
- **getstate_x**: `function getState_X(): number;`
- **getstate_y**: `function getState_Y(): number;`
- **isasync**: `function isAsync(): boolean;`
- **reset**: `function reset(): Promise<ISCH_PrimitiveText>;`
- **setstate_alignmode**: `function setState_AlignMode(alignMode: ESCH_PrimitiveTextAlignMode): ISCH_PrimitiveText;`
- **setstate_bold**: `function setState_Bold(bold: boolean): ISCH_PrimitiveText;`
- **setstate_content**: `function setState_Content(content: string): ISCH_PrimitiveText;`
- **setstate_fontname**: `function setState_FontName(fontName: string | null): ISCH_PrimitiveText;`
- **setstate_fontsize**: `function setState_FontSize(fontSize: number | null): ISCH_PrimitiveText;`
- **setstate_italic**: `function setState_Italic(italic: boolean): ISCH_PrimitiveText;`
- **setstate_rotation**: `function setState_Rotation(rotation: number): ISCH_PrimitiveText;`
- **setstate_textcolor**: `function setState_TextColor(textColor: string | null): ISCH_PrimitiveText;`
- **setstate_underline**: `function setState_UnderLine(underLine: boolean): ISCH_PrimitiveText;`
- **setstate_x**: `function setState_X(x: number): ISCH_PrimitiveText;`
- **setstate_y**: `function setState_Y(y: number): ISCH_PrimitiveText;`
- **toasync**: `function toAsync(): ISCH_PrimitiveText;`
- **tosync**: `function toSync(): ISCH_PrimitiveText;`
---
## ISCH_PrimitiveWire
Wire primitive
```typescript
class ISCH_PrimitiveWire implements ISCH_Primitive
```
- **done**: `function done(): Promise<ISCH_PrimitiveWire>;`
- **getstate_color**: `function getState_Color(): string | null;`
- **getstate_line**: `function getState_Line(): Array<number> | Array<Array<number>>;`
- **getstate_linetype**: `function getState_LineType(): ESCH_PrimitiveLineType | null;`
- **getstate_linewidth**: `function getState_LineWidth(): number | null;`
- **getstate_net**: `function getState_Net(): string;`
- **getstate_primitiveid**: `function getState_PrimitiveId(): string;`
- **getstate_primitivetype**: `function getState_PrimitiveType(): ESCH_PrimitiveType;`
- **isasync**: `function isAsync(): boolean;`
- **setstate_color**: `function setState_Color(color: string | null): ISCH_PrimitiveWire;`
- **setstate_line**: `function setState_Line(line: Array<number> | Array<Array<number>>): ISCH_PrimitiveWire;`
- **setstate_linetype**: `function setState_LineType(lineType: ESCH_PrimitiveLineType | null): ISCH_PrimitiveWire;`
- **setstate_linewidth**: `function setState_LineWidth(lineWidth: number | null): ISCH_PrimitiveWire;`
- **setstate_net**: `function setState_Net(net: string): ISCH_PrimitiveWire;`
- **toasync**: `function toAsync(): ISCH_PrimitiveWire;`
- **tosync**: `function toSync(): ISCH_PrimitiveWire;`
---
## LIB_3DModel
Comprehensive library / 3D model class
```typescript
class LIB_3DModel
```
- **copy**: `function copy( modelUuid: string, libraryUuid: string, targetLibraryUuid: string, targetClassification?: ILIB_ClassificationIndex | Array<string>, newModelName?: string, ): Promise<string | undefined>;`
- **create**: `function create( libraryUuid: string, modelFile: Blob, classification?: ILIB_ClassificationIndex | Array<string>, unit?: | ESYS_Unit.MILLIMETER | ESYS_Unit.CENTIMETER | ESYS_Unit.METER | ESYS_Unit.MIL | ESYS_Unit.INCH, ): Promise<Array<string> | undefined>;`
- **delete**: `function delete(modelUuid: string, libraryUuid: string): Promise<boolean | undefined>;`
- **get**: `function get(modelUuid: string, libraryUuid?: string): Promise<ILIB_3DModelItem | undefined>;`
- **modify**: `function modify( modelUuid: string, libraryUuid: string, modelName?: string, classification?: ILIB_ClassificationIndex | Array<string> | null, description?: string | null, ): Promise<boolean>;`
- **search**: `function search( key: string, libraryUuid?: string, classification?: ILIB_ClassificationIndex | Array<string>, itemsOfPage?: number, page?: number, ): Promise<Array<ILIB_3DModelSearchItem>>;`
---
## LIB_Cbb
Comprehensive library / reuse block class
```typescript
class LIB_Cbb
```
- **copy**: `function copy( cbbUuid: string, libraryUuid: string, targetLibraryUuid: string, targetClassification?: ILIB_ClassificationIndex | Array<string>, newCbbName?: string, ): Promise<string | undefined>;`
- **create**: `function create( libraryUuid: string, cbbName: string, classification?: ILIB_ClassificationIndex | Array<string>, description?: string, ): Promise<string | undefined>;`
- **delete**: `function delete(cbbUuid: string, libraryUuid: string): Promise<boolean | undefined>;`
- **get**: `function get(cbbUuid: string, libraryUuid?: string): Promise<ILIB_CbbItem | undefined>;`
- **modify**: `function modify( cbbUuid: string, libraryUuid: string, cbbName?: string, classification?: ILIB_ClassificationIndex | Array<string> | null, description?: string | null, ): Promise<boolean>;`
- **openprojectineditor**: `function openProjectInEditor(cbbUuid: string, libraryUuid: string): Promise<boolean>;`
- **opensymbolineditor**: `function openSymbolInEditor( cbbUuid: string, libraryUuid: string, splitScreenId?: string, ): Promise<string | undefined>;`
- **search**: `function search( key: string, libraryUuid?: string, classification?: ILIB_ClassificationIndex | Array<string>, itemsOfPage?: number, page?: number, ): Promise<Array<ILIB_CbbSearchItem>>;`
---
## LIB_Classification
Comprehensive library / library classification index class
```typescript
class LIB_Classification
```
- **createprimary**: `function createPrimary( libraryUuid: string, libraryType: ELIB_LibraryType, primaryClassificationName: string, ): Promise<ILIB_ClassificationIndex | undefined>;`
- **createsecondary**: `function createSecondary( libraryUuid: string, libraryType: ELIB_LibraryType, primaryClassificationUuid: string, secondaryClassificationName: string, ): Promise<ILIB_ClassificationIndex | undefined>;`
- **deletebyindex**: `function deleteByIndex(classificationIndex: ILIB_ClassificationIndex): Promise<boolean>;`
- **deletebyuuid**: `function deleteByUuid(libraryUuid: string, classificationUuid: string): Promise<boolean>;`
- **getallclassificationtree**: `function getAllClassificationTree( libraryUuid: string, libraryType: ELIB_LibraryType, ): Promise< Array<{ name: string; uuid: string; children?: Array<{ name: string; uuid: string }> | undefined; }> >;`
- **getindexbyname**: `function getIndexByName( libraryUuid: string, libraryType: ELIB_LibraryType, primaryClassificationName: string, secondaryClassificationName?: string, ): Promise<ILIB_ClassificationIndex | undefined>;`
- **getnamebyindex**: `function getNameByIndex( classificationIndex: ILIB_ClassificationIndex, ): Promise< | { primaryClassificationName: string; secondaryClassificationName?: string | undefined } | undefined >;`
- **getnamebyuuid**: `function getNameByUuid( libraryUuid: string, libraryType: ELIB_LibraryType, primaryClassificationUuid: string, secondaryClassificationUuid?: string, ): Promise< | { primaryClassificationName: string; secondaryClassificationName?: string | undefined } | undefined >;`
---
## LIB_Device
Comprehensive library / device class
```typescript
class LIB_Device
```
- **copy**: `function copy( deviceUuid: string, libraryUuid: string, targetLibraryUuid: string, targetClassification?: ILIB_ClassificationIndex | Array<string>, newDeviceName?: string, ): Promise<string | undefined>;`
- **create**: *(签名过长,请查看详细文档)*
- **delete**: `function delete(deviceUuid: string, libraryUuid: string): Promise<boolean | undefined>;`
- **get**: `function get(deviceUuid: string, libraryUuid?: string): Promise<ILIB_DeviceItem | undefined>;`
- **getbylcscids**: `function getByLcscIds<T extends boolean>( lcscIds: string, libraryUuid?: string, allowMultiMatch?: T, ): Promise<T extends true ? ILIB_DeviceSearchItem | undefined : Array<ILIB_DeviceSearchItem>>;`
- **getbylcscids_1**: `function getByLcscIds( lcscIds: Array<string>, libraryUuid?: string, allowMultiMatch?: boolean, ): Promise<Array<ILIB_DeviceSearchItem>>;`
- **modify**: *(签名过长,请查看详细文档)*
- **search**: `function search( key: string, libraryUuid?: string, classification?: ILIB_ClassificationIndex | Array<string>, symbolType?: ELIB_SymbolType, itemsOfPage?: number, page?: number, ): Promise<Array<ILIB_DeviceSearchItem>>;`
- **searchbyproperties**: `function searchByProperties( properties: ILIB_DevicePropertiesForSearch, libraryUuid?: string, classification?: Array<string>, symbolType?: ELIB_SymbolType, itemsOfPage?: number, page?: number, ): Promise<Array<ILIB_DeviceSearchItem>>;`
---
## LIB_Footprint
Comprehensive library / footprint class
```typescript
class LIB_Footprint
```
- **copy**: `function copy( footprintUuid: string, libraryUuid: string, targetLibraryUuid: string, targetClassification?: ILIB_ClassificationIndex | Array<string>, newFootprintName?: string, ): Promise<string | undefined>;`
- **create**: `function create( libraryUuid: string, footprintName: string, classification?: ILIB_ClassificationIndex | Array<string>, description?: string, otherProperty?: Record<string, boolean | number | string | undefined>, model3D?: { name: string; uuid: string; libraryUuid: string }, ): Promise<string | undefined>;`
- **delete**: `function delete(footprintUuid: string, libraryUuid: string): Promise<boolean | undefined>;`
- **get**: `function get(footprintUuid: string, libraryUuid?: string): Promise<ILIB_FootprintItem | undefined>;`
- **getdocumentsource**: `function getDocumentSource( footprintUuid: string, libraryUuid?: string, ): Promise<string | undefined>;`
- **getrenderimage**: `function getRenderImage(source: { footprintUuid: string; libraryUuid: string; }): Promise<Blob | undefined>;`
- **modify**: `function modify( footprintUuid: string, libraryUuid: string, footprintName?: string, classification?: ILIB_ClassificationIndex | Array<string> | null, description?: string | null, otherProperty?: Record<string, boolean | number | string | undefined | null>, model3D?: { name: string; uuid: string; libraryUuid: string }, ): Promise<boolean>;`
- **openineditor**: `function openInEditor( footprintUuid: string, libraryUuid: string, splitScreenId?: string, ): Promise<string | undefined>;`
- **search**: `function search( key: string, libraryUuid?: string, classification?: ILIB_ClassificationIndex | Array<string>, itemsOfPage?: number, page?: number, ): Promise<Array<ILIB_FootprintSearchItem>>;`
- **searchbyproperties**: `function searchByProperties( properties: ILIB_FootprintPropertiesForSearch, libraryUuid?: string, ): Promise<Array<ILIB_FootprintSearchItem>>;`
- **updatedocumentsource**: `function updateDocumentSource( footprintUuid: string, libraryUuid: string, documentSource: string, ): Promise<boolean | undefined>;`
---
## LIB_LibrariesList
Comprehensive library / library list class
```typescript
class LIB_LibrariesList
```
- **getalllibrarieslist**: `function getAllLibrariesList(): Promise<Array<ILIB_LibraryInfo>>;`
- **getfavoritelibraryuuid**: `function getFavoriteLibraryUuid(): Promise<string | undefined>;`
- **getpersonallibraryuuid**: `function getPersonalLibraryUuid(): Promise<string | undefined>;`
- **getprojectlibraryuuid**: `function getProjectLibraryUuid(): Promise<string | undefined>;`
- **getsystemlibraryuuid**: `function getSystemLibraryUuid(): Promise<string | undefined>;`
- **registerextendlibrary**: `function registerExtendLibrary( title: string, libraryFunctions: { device?: ILIB_ExtendLibraryDeviceFunctions; symbol?: ILIB_ExtendLibrarySymbolFunctions; footprint?: ILIB_ExtendLibraryFootprintFunctions; cbb?: ILIB_ExtendLibraryCbbFunctions; model3d?: ILIB_ExtendLibrary3DModelFunctions; }, ): Promise<string | undefined>;`
---
## LIB_PanelLibrary
Comprehensive library / panel library class
```typescript
class LIB_PanelLibrary
```
- **copy**: `function copy( panelLibraryUuid: string, libraryUuid: string, targetLibraryUuid: string, targetClassification?: ILIB_ClassificationIndex | Array<string>, newPanelLibraryName?: string, ): Promise<string | undefined>;`
- **create**: `function create( libraryUuid: string, panelLibraryName: string, classification?: ILIB_ClassificationIndex | Array<string>, description?: string, ): Promise<string | undefined>;`
- **delete**: `function delete(panelLibraryUuid: string, libraryUuid: string): Promise<boolean | undefined>;`
- **get**: `function get( panelLibraryUuid: string, libraryUuid?: string, ): Promise<ILIB_PanelLibraryItem | undefined>;`
- **modify**: `function modify( panelLibraryUuid: string, libraryUuid: string, panelLibraryName?: string, classification?: ILIB_ClassificationIndex | Array<string> | null, description?: string | null, ): Promise<boolean>;`
- **openineditor**: `function openInEditor( panelLibraryUuid: string, libraryUuid: string, splitScreenId?: string, ): Promise<string | undefined>;`
- **search**: `function search( key: string, libraryUuid?: string, classification?: ILIB_ClassificationIndex | Array<string>, itemsOfPage?: number, page?: number, ): Promise<Array<ILIB_PanelLibrarySearchItem>>;`
---
## LIB_SelectControl
Comprehensive library / selection control class
```typescript
class LIB_SelectControl
```
- **getselectedlibraryrowinfo**: `function getSelectedLibraryRowInfo(): Promise<ILIB_LibraryItem | undefined>;`
---
## LIB_SimulationModel
Comprehensive library / simulation model class
```typescript
class LIB_SimulationModel
```
- **copy**: `function copy( simulationModelUuid: string, libraryUuid: string, targetLibraryUuid: string, targetClassification?: Array<string>, newSimulationModelName?: string, ): Promise<string | undefined>;`
- **create**: `function create( libraryUuid: string, model: { modelType: 'Ngspice' } & ( | { modelFile: Blob; modelName?: string; modelCategory?: string; modelPin?: string } | { modelData: string; modelName?: string; modelCategory?: string; modelPin?: string } ), classification?: Array<string>, description?: string, ): Promise<string | undefined>;`
- **delete**: `function delete(simulationModelUuid: string, libraryUuid: string): Promise<boolean | undefined>;`
- **get**: `function get( simulationModelUuid: string, libraryUuid?: string, ): Promise<ILIB_SimulationModelItem | undefined>;`
- **modify**: `function modify( simulationModelUuid: string, libraryUuid: string, modelProps?: { modelName?: string; modelCategory?: string; modelPin?: string }, classification?: Array<string> | null, description?: string | null, ): Promise<boolean>;`
- **search**: `function search( key: string, libraryUuid?: string, classification?: Array<string>, simulationModelType?: ELIB_SimulationModelType, itemsOfPage?: number, page?: number, ): Promise<Array<ILIB_SimulationModelSearchItem>>;`
---
## LIB_Symbol
Comprehensive library / symbol class
```typescript
class LIB_Symbol
```
- **copy**: `function copy( symbolUuid: string, libraryUuid: string, targetLibraryUuid: string, targetClassification?: ILIB_ClassificationIndex | Array<string>, newSymbolName?: string, ): Promise<string | undefined>;`
- **create**: `function create( libraryUuid: string, symbolName: string, classification?: ILIB_ClassificationIndex | Array<string>, symbolType?: ELIB_SymbolType, description?: string, otherProperty?: Record<string, boolean | number | string | undefined>, ): Promise<string | undefined>;`
- **delete**: `function delete(symbolUuid: string, libraryUuid: string): Promise<boolean | undefined>;`
- **get**: `function get(symbolUuid: string, libraryUuid?: string): Promise<ILIB_SymbolItem | undefined>;`
- **getdocumentsource**: `function getDocumentSource(symbolUuid: string, libraryUuid?: string): Promise<string | undefined>;`
- **getrenderimage**: `function getRenderImage(source: { symbolUuid: string; libraryUuid: string; subPartName?: string; }): Promise<Blob | undefined>;`
- **modify**: `function modify( symbolUuid: string, libraryUuid: string, symbolName?: string, classification?: ILIB_ClassificationIndex | Array<string> | null, description?: string | null, otherProperty?: Record<string, boolean | number | string | undefined | null>, ): Promise<boolean>;`
- **openineditor**: `function openInEditor( symbolUuid: string, libraryUuid: string, splitScreenId?: string, ): Promise<string | undefined>;`
- **search**: `function search( key: string, libraryUuid?: string, classification?: ILIB_ClassificationIndex | Array<string>, symbolType?: ELIB_SymbolType, itemsOfPage?: number, page?: number, ): Promise<Array<ILIB_SymbolSearchItem>>;`
- **searchbyproperties**: `function searchByProperties( properties: ILIB_SymbolPropertiesForSearch, libraryUuid?: string, ): Promise<Array<ILIB_SymbolSearchItem>>;`
- **updatedocumentsource**: `function updateDocumentSource( symbolUuid: string, libraryUuid: string, documentSource: string, ): Promise<boolean | undefined>;`
---
## PCB_Document
PCB & footprint / document operation class
```typescript
class PCB_Document
```
- **autolayout**: `function autoLayout(): Promise<IPCB_AutoLayoutResult>;`
- **autorouting**: `function autoRouting(props?: IPCB_AutoRoutingProps): Promise<IPCB_AutoRoutingResult>;`
- **clearrouting**: `function clearRouting(type?: 'all' | 'net' | 'connection'): Promise<boolean>;`
- **convertcanvasorigintodataorigin**: `function convertCanvasOriginToDataOrigin(x: number, y: number): Promise<{ x: number; y: number }>;`
- **convertdataorigintocanvasorigin**: `function convertDataOriginToCanvasOrigin(x: number, y: number): Promise<{ x: number; y: number }>;`
- **getcalculatingratlinestatus**: `function getCalculatingRatlineStatus(): Promise< EPCB_DocumentRatlineCalculatingActiveStatus | undefined >;`
- **getcanvasorigin**: `function getCanvasOrigin(): Promise<{ offsetX: number; offsetY: number }>;`
- **getcanvasupdatecalculationstatus**: `function getCanvasUpdateCalculationStatus(): Promise< EPCB_DocumentCanvasUpdateCalculationActiveStatus | undefined >;`
- **getcurrentfilterconfiguration**: `function getCurrentFilterConfiguration(): Promise<Record<string, any> | undefined>;`
- **getprimitiveatpoint**: `function getPrimitiveAtPoint(x: number, y: number): Promise<IPCB_Primitive | undefined>;`
- **getprimitivesinregion**: `function getPrimitivesInRegion( left: number, right: number, top: number, bottom: number, leftToRight?: boolean, ): Promise<Array<IPCB_Primitive>>;`
- **importautolayoutjsonfile**: `function importAutoLayoutJsonFile(autoLayoutFile: File): Promise<boolean>;`
- **importautoroutejsonfile**: `function importAutoRouteJsonFile(autoRouteFile: File): Promise<boolean>;`
- **importautoroutesesfile**: `function importAutoRouteSesFile(autoRouteFile: File): Promise<boolean>;`
- **importchanges**: `function importChanges(uuid?: string): Promise<boolean>;`
- **navigatetocoordinates**: `function navigateToCoordinates(x: number, y: number): Promise<boolean>;`
- **navigatetoregion**: `function navigateToRegion( left: number, right: number, top: number, bottom: number, ): Promise<boolean>;`
- **save**: `function save(): Promise<boolean>;`
- **setcanvasorigin**: `function setCanvasOrigin(offsetX: number, offsetY: number): Promise<boolean>;`
- **startcalculatingratline**: `function startCalculatingRatline(): Promise<boolean>;`
- **startcanvasupdatecalculation**: `function startCanvasUpdateCalculation(): Promise<boolean>;`
- **stopcalculatingratline**: `function stopCalculatingRatline(): Promise<boolean>;`
- **stopcanvasupdatecalculation**: `function stopCanvasUpdateCalculation(): Promise<boolean>;`
- **triggercanvasupdatecalculation**: `function triggerCanvasUpdateCalculation(): Promise<boolean>;`
- **zoomtoboardoutline**: `function zoomToBoardOutline(): Promise<boolean>;`
---
## PCB_Drc
PCB & footprint / design rule check (DRC) class
```typescript
class PCB_Drc
```
- **addnettoequallengthnetgroup**: `function addNetToEqualLengthNetGroup( equalLengthNetGroupName: string, net: string | Array<string>, ): Promise<boolean>;`
- **addnettonetclass**: `function addNetToNetClass(netClassName: string, net: string | Array<string>): Promise<boolean>;`
- **addpadpairtopadpairgroup**: `function addPadPairToPadPairGroup( padPairGroupName: string, padPair: [string, string] | Array<[string, string]>, ): Promise<boolean>;`
- **check**: `function check( strict: boolean, userInterface: boolean, includeVerboseError: false, ): Promise<boolean>;`
- **check_1**: `function check( strict: boolean, userInterface: boolean, includeVerboseError: true, ): Promise<Array<any>>;`
- **createdifferentialpair**: `function createDifferentialPair( differentialPairName: string, positiveNet: string, negativeNet: string, ): Promise<boolean>;`
- **createequallengthnetgroup**: `function createEqualLengthNetGroup( equalLengthNetGroupName: string, nets: Array<string>, color: IPCB_EqualLengthNetGroupItem['color'], ): Promise<boolean>;`
- **createnetclass**: `function createNetClass( netClassName: string, nets: Array<string>, color: IPCB_EqualLengthNetGroupItem['color'], ): Promise<boolean>;`
- **createpadpairgroup**: `function createPadPairGroup( padPairGroupName: string, padPairs: Array<[string, string]>, ): Promise<boolean>;`
- **deletedifferentialpair**: `function deleteDifferentialPair(differentialPairName: string): Promise<boolean>;`
- **deleteequallengthnetgroup**: `function deleteEqualLengthNetGroup(equalLengthNetGroupName: string): Promise<boolean>;`
- **deletenetclass**: `function deleteNetClass(netClassName: string): Promise<boolean>;`
- **deletepadpairgroup**: `function deletePadPairGroup(padPairGroupName: string): Promise<boolean>;`
- **deleteruleconfiguration**: `function deleteRuleConfiguration(configurationName: string): Promise<boolean>;`
- **getalldifferentialpairs**: `function getAllDifferentialPairs(): Promise<Array<IPCB_DifferentialPairItem> | Record<string, any>>;`
- **getallequallengthnetgroups**: `function getAllEqualLengthNetGroups(): Promise<Array<IPCB_EqualLengthNetGroupItem>>;`
- **getallnetclasses**: `function getAllNetClasses(): Promise<Array<IPCB_NetClassItem>>;`
- **getallpadpairgroups**: `function getAllPadPairGroups(): Promise<Array<IPCB_PadPairGroupItem>>;`
- **getallruleconfigurations**: `function getAllRuleConfigurations(includeSystem?: boolean): Promise<Array<Record<string, any>>>;`
- **getcurrentruleconfiguration**: `function getCurrentRuleConfiguration(): Promise<Record<string, any> | undefined>;`
- **getcurrentruleconfigurationname**: `function getCurrentRuleConfigurationName(): Promise<string | undefined>;`
- **getdefaultruleconfigurationname**: `function getDefaultRuleConfigurationName(): Promise<string | undefined>;`
- **getnetbynetrules**: `function getNetByNetRules(): Promise<Record<string, any>>;`
- **getnetrules**: `function getNetRules(): Promise<Array<Record<string, any>>>;`
- **getpadpairgroupminwirelength**: `function getPadPairGroupMinWireLength( padPairGroupName: string, ): Promise<Array<IPCB_PadPairMinWireLengthItem>>;`
- **getrealtimedrcstatus**: `function getRealTimeDrcStatus(): Promise<boolean>;`
- **getregionrules**: `function getRegionRules(): Promise<Array<Record<string, any>>>;`
- **getruleconfiguration**: `function getRuleConfiguration(configurationName: string): Promise<Record<string, any> | undefined>;`
- **modifydifferentialpairname**: `function modifyDifferentialPairName( originalDifferentialPairName: string, differentialPairName: string, ): Promise<boolean>;`
- **modifydifferentialpairnegativenet**: `function modifyDifferentialPairNegativeNet( differentialPairName: string, negativeNet: string, ): Promise<boolean>;`
- **modifydifferentialpairpositivenet**: `function modifyDifferentialPairPositiveNet( differentialPairName: string, positiveNet: string, ): Promise<boolean>;`
- **modifyequallengthnetgroupname**: `function modifyEqualLengthNetGroupName( originalEqualLengthNetGroupName: string, equalLengthNetGroupName: string, ): Promise<boolean>;`
- **modifynetclassname**: `function modifyNetClassName(originalNetClassName: string, netClassName: string): Promise<boolean>;`
- **modifypadpairgroupname**: `function modifyPadPairGroupName( originalPadPairGroupName: string, padPairGroupName: string, ): Promise<boolean>;`
- **overwritecurrentruleconfiguration**: `function overwriteCurrentRuleConfiguration( ruleConfiguration: Record<string, any>, ): Promise<boolean>;`
- **overwritenetbynetrules**: `function overwriteNetByNetRules(netByNetRules: Record<string, any>): Promise<boolean>;`
- **overwritenetrules**: `function overwriteNetRules(netRules: Array<Record<string, any>>): Promise<boolean>;`
- **overwriteregionrules**: `function overwriteRegionRules(regionRules: Array<Record<string, any>>): Promise<boolean>;`
- **removenetfromequallengthnetgroup**: `function removeNetFromEqualLengthNetGroup( equalLengthNetGroupName: string, net: string | Array<string>, ): Promise<boolean>;`
- **removenetfromnetclass**: `function removeNetFromNetClass(netClassName: string, net: string | Array<string>): Promise<boolean>;`
- **removepadpairfrompadpairgroup**: `function removePadPairFromPadPairGroup( padPairGroupName: string, padPair: [string, string] | Array<[string, string]>, ): Promise<boolean>;`
- **renameruleconfiguration**: `function renameRuleConfiguration( originalConfigurationName: string, configurationName: string, ): Promise<boolean>;`
- **saveruleconfiguration**: `function saveRuleConfiguration( ruleConfiguration: Record<string, any>, configurationName: string, allowOverwrite?: boolean, ): Promise<boolean>;`
- **setasdefaultruleconfiguration**: `function setAsDefaultRuleConfiguration(configurationName: string): Promise<boolean>;`
- **startrealtimedrc**: `function startRealTimeDrc(): Promise<boolean>;`
- **stoprealtimedrc**: `function stopRealTimeDrc(): Promise<boolean>;`
---
## PCB_Event
PCB & footprint / event class
```typescript
class PCB_Event
```
- **addcrossprobeselecteventlistener**: `function addCrossProbeSelectEventListener( id: string, callFn: (props: any) => void | Promise<void>, ): void;`
- **addimageeventlistener**: `function addImageEventListener( id: string, callFn: (message: { file?: File; source: 'toolbar' | 'paste' }) => void | Promise<void>, ): boolean;`
- **addmouseeventlistener**: `function addMouseEventListener( id: string, eventType: 'all' | EPCB_MouseEventType, callFn: ( eventType: EPCB_MouseEventType, props: [ { primitiveId: string; primitiveType: EPCB_PrimitiveType; net?: string; designator?: string; parentComponentPrimitiveId?: string; parentComponentDesignator?: string; }, ], ) => void | Promise<void>, onlyOnce?: boolean, ): void;`
- **addneteventlistener**: `function addNetEventListener( id: string, eventType: 'all' | EPCB_NetEventType, callFn: (eventType: EPCB_NetEventType, props: [{ net: string }]) => void | Promise<void>, onlyOnce?: boolean, ): void;`
- **addprimitiveeventlistener**: `function addPrimitiveEventListener( id: string, eventType: 'all' | EPCB_PrimitiveEventType, callFn: ( eventType: EPCB_PrimitiveEventType, props: [ { primitiveId: string; primitiveType: EPCB_PrimitiveType; net?: string; designator?: string; parentComponentPrimitiveId?: string; parentComponentDesignator?: string; }, ], ) => void | Promise<void>, onlyOnce?: boolean, ): void;`
- **addraytracerengine3dviewcamerachangeeventlistener**: `function addRayTracerEngine3DViewCameraChangeEventListener( id: string, callFn: (props: { position: { x: number; y: number; z: number }; rotation: { x: number; y: number; z: number }; focalLength: number; }) => void | Promise<void>, onlyOnce?: boolean, ): void;`
- **addraytracerengine3dviewclickmaterialeventlistener**: `function addRayTracerEngine3DViewClickMaterialEventListener( id: string, callFn: (props: { materialId: number; material: any }) => void | Promise<void>, onlyOnce?: boolean, ): void;`
- **addrealtimedrcresulteventlistener**: `function addRealTimeDrcResultEventListener( id: string, eventType: 'all', callFn: (eventType: undefined, props: [{ drcResult: any }]) => void | Promise<void>, ): void;`
- **iseventlisteneralreadyexist**: `function isEventListenerAlreadyExist(id: string): boolean;`
- **removeeventlistener**: `function removeEventListener(id: string): boolean;`
---
## PCB_ImageTool
PCB 图片工具类
```typescript
class PCB_ImageTool
```
- **processimage**: `function processImage( file: File, options?: { maxBytes?: number; acceptableBytes?: number }, ): Promise<{ file: File; dataURL: string; width: number; height: number; actualFormat: string; msg: string; }>;`
- **runinsertimagecommand**: `function runInsertImageCommand(): Promise<boolean>;`
- **startplacetruecolorpicture**: `function startPlaceTrueColorPicture(options: { imageBlob: Blob; width: number; height: number; unit?: 'mm' | 'mil'; fileName: string; }): Promise<boolean>;`
- **startplacevectorimage**: `function startPlaceVectorImage(options: { path: string; width: number; height: number; unit?: 'mm' | 'mil'; }): Promise<boolean>;`
---
## PCB_Layer
PCB & footprint / layer operation class
```typescript
class PCB_Layer
```
- **addcustomlayer**: `function addCustomLayer(): Promise<TPCB_LayersOfCustom | undefined>;`
- **deletephysicalstackingconfiguration**: `function deletePhysicalStackingConfiguration( configurationName: string, physicalProps?: IPCB_SubstratePhysicalProperties, ): Promise<boolean>;`
- **getalllayers**: `function getAllLayers(): Promise<Array<IPCB_LayerItem>>;`
- **getallphysicalstackingconfigurations**: `function getAllPhysicalStackingConfigurations( physicalProps?: IPCB_SubstratePhysicalProperties, ): Promise<Array<IPCB_PhysicalStackingConfiguration>>;`
- **getcurrentlayer**: `function getCurrentLayer(): Promise<IPCB_LayerItem | undefined>;`
- **getcurrentphysicalstackingconfiguration**: `function getCurrentPhysicalStackingConfiguration(): Promise< IPCB_PhysicalStackingConfiguration | undefined >;`
- **getcurrentphysicalstackingconfigurationname**: `function getCurrentPhysicalStackingConfigurationName(): Promise<string | undefined>;`
- **getdefaultphysicalstackingconfigurationname**: `function getDefaultPhysicalStackingConfigurationName( physicalProps?: IPCB_SubstratePhysicalProperties, ): Promise<string | undefined>;`
- **getphysicalstackingconfiguration**: `function getPhysicalStackingConfiguration( configurationName: string, physicalProps?: IPCB_SubstratePhysicalProperties, ): Promise<IPCB_PhysicalStackingConfiguration | undefined>;`
- **locklayer**: `function lockLayer( layer?: TPCB_LayersInTheSelectable | Array<TPCB_LayersInTheSelectable>, ): Promise<boolean>;`
- **modifylayer**: `function modifyLayer( layer: TPCB_LayersInTheSelectable, property: { name?: string; type?: TPCB_LayerTypesOfInnerLayer; color?: string; transparency?: number; }, ): Promise<boolean>;`
- **overwritecurrentphysicalstackingconfiguration**: `function overwriteCurrentPhysicalStackingConfiguration( physicalStackingConfiguration: IPCB_PhysicalStackingConfiguration, ): Promise<boolean>;`
- **removelayer**: `function removeLayer(layer: TPCB_LayersOfCustom): Promise<boolean>;`
- **renamephysicalstackingconfiguration**: `function renamePhysicalStackingConfiguration( originalConfigurationName: string, configurationName: string, physicalProps?: IPCB_SubstratePhysicalProperties, ): Promise<boolean>;`
- **savephysicalstackingconfiguration**: `function savePhysicalStackingConfiguration( physicalStackingConfiguration: IPCB_PhysicalStackingConfiguration, configurationName: string, physicalProps?: IPCB_SubstratePhysicalProperties, allowOverwrite?: boolean, ): Promise<boolean>;`
- **selectlayer**: `function selectLayer(layer: TPCB_LayersInTheSelectable): Promise<boolean>;`
- **setasdefaultphysicalstackingconfiguration**: `function setAsDefaultPhysicalStackingConfiguration( configurationName: string, physicalProps?: IPCB_SubstratePhysicalProperties, ): Promise<boolean>;`
- **setinactivelayerdisplaymode**: `function setInactiveLayerDisplayMode(displayMode?: EPCB_InactiveLayerDisplayMode): Promise<boolean>;`
- **setinactivelayertransparency**: `function setInactiveLayerTransparency(transparency: number): Promise<boolean>;`
- **setlayercolorconfiguration**: `function setLayerColorConfiguration( colorConfiguration: EPCB_LayerColorConfiguration, ): Promise<boolean>;`
- **setlayerinvisible**: `function setLayerInvisible( layer?: TPCB_LayersInTheSelectable | Array<TPCB_LayersInTheSelectable>, setOtherLayerVisible?: boolean, ): Promise<boolean>;`
- **setlayervisible**: `function setLayerVisible( layer?: TPCB_LayersInTheSelectable | Array<TPCB_LayersInTheSelectable>, setOtherLayerInvisible?: boolean, ): Promise<boolean>;`
- **setpcbtype**: `function setPcbType(pcbType: EPCB_PcbPlateType): Promise<boolean>;`
- **setthenumberofcopperlayers**: `function setTheNumberOfCopperLayers(numberOfLayers: TPCB_NumberOfCopperLayers): Promise<boolean>;`
- **unlocklayer**: `function unlockLayer( layer?: TPCB_LayersInTheSelectable | Array<TPCB_LayersInTheSelectable>, ): Promise<boolean>;`
---
## PCB_ManufactureData
PCB & footprint / manufacture data class
```typescript
class PCB_ManufactureData
```
- **deletebomtemplate**: `function deleteBomTemplate(template: string): Promise<boolean>;`
- **get3dfile**: `function get3DFile( fileName?: string, fileType?: 'step' | 'obj', element?: Array<'Component Model' | 'Via' | 'Silkscreen' | 'Wire In Signal Layer'>, modelMode?: 'Outfit' | 'Parts', autoGenerateModels?: boolean, ): Promise<File | undefined>;`
- **get3dshellfile**: `function get3DShellFile( fileName?: string, fileType?: 'stl' | 'step' | 'obj', ): Promise<File | undefined>;`
- **getaltiumdesignerfile**: `function getAltiumDesignerFile(fileName?: string): Promise<File | undefined>;`
- **getautolayoutjsonfile**: `function getAutoLayoutJsonFile(fileName?: string): Promise<File | undefined>;`
- **getautoroutejsonfile**: `function getAutoRouteJsonFile(fileName?: string): Promise<File | undefined>;`
- **getautoroutejsonfileforjrouter**: `function getAutoRouteJsonFileForJRouter(fileName?: string): Promise<File | undefined>;`
- **getbomfile**: `function getBomFile( fileName?: string, fileType?: 'xlsx' | 'csv', template?: string, filterOptions?: Array<{ property: string; includeValue: boolean | string }>, statistics?: Array<string>, property?: Array<string>, columns?: Array<IPCB_BomPropertiesTableColumns>, ): Promise<File | undefined>;`
- **getbomtemplatefile**: `function getBomTemplateFile(template: string): Promise<File | undefined>;`
- **getbomtemplates**: `function getBomTemplates(): Promise<Array<string>>;`
- **getdsnfile**: `function getDsnFile(fileName?: string): Promise<File | undefined>;`
- **getdxffile**: `function getDxfFile( fileName?: string, layers?: Array<{ layerId: EPCB_LayerId; mirror: boolean }>, objects?: Array<string>, ): Promise<File | undefined>;`
- **getflyingprobetestfile**: `function getFlyingProbeTestFile(fileName?: string): Promise<File | undefined>;`
- **getgerberfile**: *(签名过长,请查看详细文档)*
- **getidxfile**: `function getIdxFile(fileName?: string): Promise<File | undefined>;`
- **getipc2581cfile**: `function getIpc2581CFile( fileName?: string, fileType?: 'xml' | 'cvg' | '2581', unit?: ESYS_Unit.INCH | ESYS_Unit.MILLIMETER, oemNumber?: 'Device' | 'Manufacturer Part' | 'Supplier Part' | 'Comment', ): Promise<File | undefined>;`
- **getipcd356afile**: `function getIpcD356AFile(fileName?: string): Promise<File | undefined>;`
- **getmanufacturedata**: `function getManufactureData(): Promise<File | undefined>;`
- **getnetlistfile**: `function getNetlistFile( fileName?: string, netlistType?: ESYS_NetlistType, ): Promise<File | undefined>;`
- **getopendatabasedoubleplusfile**: `function getOpenDatabaseDoublePlusFile( fileName?: string, unit?: ESYS_Unit.INCH | ESYS_Unit.MILLIMETER, otherData?: { metallizedDrilledHoles?: boolean; nonMetallizedDrilledHoles?: boolean; drillTable?: boolean; flyingProbeTestFile?: boolean; }, layers?: Array<{ layerId: EPCB_LayerId; mirror: boolean }>, objects?: Array<{ objectName: string }>, ): Promise<File | undefined>;`
- **getpadsfile**: `function getPadsFile(fileName?: string): Promise<File | undefined>;`
- **getpcbinfofile**: `function getPcbInfoFile(fileName?: string): Promise<File | undefined>;`
- **getpdffile**: *(签名过长,请查看详细文档)*
- **getpickandplacefile**: `function getPickAndPlaceFile( fileName?: string, fileType?: 'xlsx' | 'csv', unit?: ESYS_Unit.MILLIMETER | ESYS_Unit.MIL, ): Promise<File | undefined>;`
- **gettestpointfile**: `function getTestPointFile(fileName?: string, fileType?: 'xlsx' | 'csv'): Promise<File | undefined>;`
- **place3dshellorder**: `function place3DShellOrder(interactive?: boolean, ignoreWarning?: boolean): Promise<boolean>;`
- **placecomponentsorder**: `function placeComponentsOrder(interactive?: boolean, ignoreWarning?: boolean): Promise<boolean>;`
- **placepcborder**: `function placePcbOrder(interactive?: boolean, ignoreWarning?: boolean): Promise<boolean>;`
- **placesmtcomponentsorder**: `function placeSmtComponentsOrder(interactive?: boolean, ignoreWarning?: boolean): Promise<boolean>;`
- **uploadbomtemplatefile**: `function uploadBomTemplateFile(templateFile: File, template?: string): Promise<string | undefined>;`
---
## PCB_MathPolygon
PCB & footprint / polygon math class
```typescript
class PCB_MathPolygon
```
- **calculatebboxheight**: `function calculateBBoxHeight( complexPolygon: TPCB_PolygonSourceArray | Array<TPCB_PolygonSourceArray>, ): number;`
- **calculateheight**: `function calculateHeight( complexPolygon: | TPCB_PolygonSourceArray | Array<TPCB_PolygonSourceArray> | IPCB_Polygon | IPCB_ComplexPolygon, ): number;`
- **calculatewidth**: `function calculateWidth( complexPolygon: | TPCB_PolygonSourceArray | Array<TPCB_PolygonSourceArray> | IPCB_Polygon | IPCB_ComplexPolygon, ): number;`
- **convertimagetocomplexpolygon**: `function convertImageToComplexPolygon( imageBlob: Blob, imageWidth: number, imageHeight: number, tolerance?: number, simplification?: number, smoothing?: number, despeckling?: number, whiteAsBackgroundColor?: boolean, inversion?: boolean, ): Promise<IPCB_ComplexPolygon | undefined>;`
- **createcomplexpolygon**: `function createComplexPolygon( complexPolygon: | TPCB_PolygonSourceArray | Array<TPCB_PolygonSourceArray> | IPCB_Polygon | Array<IPCB_Polygon>, ): IPCB_ComplexPolygon | undefined;`
- **createpolygon**: `function createPolygon(polygon: TPCB_PolygonSourceArray): IPCB_Polygon | undefined;`
- **discretize**: `function discretize( polygon: IPCB_Polygon | TPCB_PolygonSourceArray, options?: IPCB_DiscretizeOptions, ): Promise<Array<IPCB_DiscretizedPoint> | null>;`
- **disposetrace**: `function disposeTrace(): Promise<void>;`
- **splitpolygon**: `function splitPolygon(...complexPolygons: Array<IPCB_ComplexPolygon>): Array<IPCB_Polygon>;`
- **traceimage**: `function traceImage(options: { imageBlob?: Blob; imageWidth?: number; imageHeight?: number; quality?: 'low' | 'high'; tolerance?: number; simplify?: number; smoothness?: number; despeckle?: number; whiteAsTransparent?: boolean; antiphase?: boolean; }): Promise< | { path: string; sourcePreviewUrl: string; previewUrl: string; width: number; height: number } | undefined >;`
---
## PCB_Net
PCB & footprint / net class
```typescript
class PCB_Net
```
- **getallnetname**: `function getAllNetName(): Promise<Array<string>>;`
- **getallnets**: `function getAllNets(): Promise<Array<IPCB_NetInfo>>;`
- **getallnetsname**: `function getAllNetsName(): Promise<Array<string>>;`
- **getallprimitivesbynet**: `function getAllPrimitivesByNet( net: string, primitiveTypes?: Array<EPCB_PrimitiveType>, ): Promise<Array<IPCB_Primitive>>;`
- **getnet**: `function getNet(net: string): Promise<IPCB_NetInfo | undefined>;`
- **getnetcolor**: `function getNetColor(net: string): Promise<IPCB_NetInfo['color'] | undefined>;`
- **getnetlength**: `function getNetLength(net: string): Promise<number | undefined>;`
- **getnetlist**: `function getNetlist(type?: ESYS_NetlistType): Promise<string>;`
- **highlightnet**: `function highlightNet(net: string): Promise<boolean>;`
- **selectnet**: `function selectNet(net: string): Promise<boolean>;`
- **setnetcolor**: `function setNetColor(net: string, color: IPCB_NetInfo['color']): Promise<boolean>;`
- **setnetlist**: `function setNetlist(type: ESYS_NetlistType | undefined, netlist: string): Promise<boolean>;`
- **unhighlightallnets**: `function unhighlightAllNets(): Promise<boolean>;`
- **unhighlightnet**: `function unhighlightNet(net: string): Promise<boolean>;`
- **unselectallnets**: `function unselectAllNets(): Promise<boolean>;`
- **unselectnet**: `function unselectNet(net: string): Promise<boolean>;`
---
## PCB_Primitive
PCB & footprint / primitive class
```typescript
class PCB_Primitive
```
- **getprimitiveboardline**: `function getPrimitiveBoardLine( primitiveId: string, layers?: Array<EPCB_LayerId>, ): Promise<IPCB_ComplexPolygon | undefined>;`
- **getprimitivesbbox**: `function getPrimitivesBBox( primitiveIds: Array<string | IPCB_Primitive>, ): Promise<{ minX: number; minY: number; maxX: number; maxY: number } | undefined>;`
---
## PCB_PrimitiveArc
PCB & footprint / arc line primitive class
```typescript
class PCB_PrimitiveArc implements IPCB_PrimitiveAPI
```
- **create**: `function create( net: string, layer: TPCB_LayersOfLine, startX: number, startY: number, endX: number, endY: number, arcAngle: number, lineWidth?: number, interactiveMode?: EPCB_PrimitiveArcInteractiveMode, primitiveLock?: boolean, ): Promise<IPCB_PrimitiveArc | undefined>;`
- **delete**: `function delete(primitiveIds: string | IPCB_PrimitiveArc | Array<string> | Array<IPCB_PrimitiveArc>): Promise<boolean>;`
- **get**: `function get(primitiveIds: string): Promise<IPCB_PrimitiveArc | undefined>;`
- **get_1**: `function get(primitiveIds: Array<string>): Promise<Array<IPCB_PrimitiveArc>>;`
- **getall**: `function getAll( net?: string, layer?: TPCB_LayersOfLine, primitiveLock?: boolean, ): Promise<Array<IPCB_PrimitiveArc>>;`
- **getallprimitiveid**: `function getAllPrimitiveId( net?: string, layer?: TPCB_LayersOfLine, primitiveLock?: boolean, ): Promise<Array<string>>;`
- **modify**: `function modify( primitiveId: string | IPCB_PrimitiveArc, property: { net?: string; layer?: TPCB_LayersOfLine; startX?: number; startY?: number; endX?: number; endY?: number; arcAngle?: number; lineWidth?: number; interactiveMode?: EPCB_PrimitiveArcInteractiveMode; primitiveLock?: boolean; }, ): Promise<IPCB_PrimitiveArc | undefined>;`
---
## PCB_PrimitiveAttribute
PCB & footprint / property primitive class
```typescript
class PCB_PrimitiveAttribute implements IPCB_PrimitiveAPI
```
- **delete**: `function delete(primitiveIds: string | IPCB_PrimitiveAttribute | Array<string> | Array<IPCB_PrimitiveAttribute>): Promise<boolean>;`
- **get**: `function get(primitiveIds: string): Promise<IPCB_PrimitiveAttribute | undefined>;`
- **get_1**: `function get(primitiveIds: Array<string>): Promise<Array<IPCB_PrimitiveAttribute>>;`
- **getall**: `function getAll( parentPrimitiveId?: string, layer?: TPCB_LayersOfImage, primitiveLock?: boolean, ): Promise<Array<IPCB_PrimitiveAttribute>>;`
- **getallprimitiveid**: `function getAllPrimitiveId( parentPrimitiveId?: string, layer?: TPCB_LayersOfImage, primitiveLock?: boolean, ): Promise<Array<string>>;`
- **modify**: `function modify( primitiveId: string | IPCB_PrimitiveAttribute, property: { layer?: TPCB_LayersOfImage; x?: number; y?: number; key?: string; value?: string; keyVisible?: boolean; valueVisible?: boolean; fontFamily?: string; fontSize?: number; lineWidth?: number; alignMode?: EPCB_PrimitiveStringAlignMode; rotation?: number; reverse?: boolean; expansion?: number; mirror?: boolean; primitiveLock?: boolean; }, ): Promise<IPCB_PrimitiveAttribute | undefined>;`
---
## PCB_PrimitiveComponent
PCB & footprint / device primitive class
```typescript
class PCB_PrimitiveComponent implements IPCB_PrimitiveAPI
```
- **create**: `function create( component: | { libraryUuid: string; uuid: string } | ILIB_DeviceItem | ILIB_DeviceSearchItem | { libraryType: ELIB_LibraryType.FOOTPRINT; libraryUuid: string; uuid: string } | ILIB_FootprintItem | ILIB_FootprintSearchItem, layer: TPCB_LayersOfComponent, x: number, y: number, rotation?: number, primitiveLock?: boolean, ): Promise<IPCB_PrimitiveComponent | undefined>;`
- **delete**: `function delete(primitiveIds: string | IPCB_PrimitiveComponent | Array<string> | Array<IPCB_PrimitiveComponent>): Promise<boolean>;`
- **get**: `function get(primitiveIds: string): Promise<IPCB_PrimitiveComponent | undefined>;`
- **get_1**: `function get(primitiveIds: Array<string>): Promise<Array<IPCB_PrimitiveComponent>>;`
- **getall**: `function getAll( layer?: TPCB_LayersOfComponent, primitiveLock?: boolean, ): Promise<Array<IPCB_PrimitiveComponent>>;`
- **getallpinsbyprimitiveid**: `function getAllPinsByPrimitiveId( primitiveId: string, ): Promise<Array<IPCB_PrimitiveComponentPad> | undefined>;`
- **getallprimitiveid**: `function getAllPrimitiveId( layer?: TPCB_LayersOfComponent, primitiveLock?: boolean, ): Promise<Array<string>>;`
- **getallpropertynames**: `function getAllPropertyNames(): Promise<Array<string>>;`
- **modify**: *(签名过长,请查看详细文档)*
- **placecomponentwithmouse**: `function placeComponentWithMouse( component: { libraryUuid: string; uuid: string } | ILIB_DeviceItem | ILIB_DeviceSearchItem, ): Promise<boolean>;`
- **placefootprintwithmouse**: `function placeFootprintWithMouse( footprint: { libraryUuid: string; uuid: string } | ILIB_FootprintItem | ILIB_FootprintSearchItem, properties?: Record<string, boolean | number | string | undefined>, ): Promise<boolean>;`
---
## PCB_PrimitiveDimension
PCB & footprint / dimension primitive class
```typescript
class PCB_PrimitiveDimension implements IPCB_PrimitiveAPI
```
- **create**: `function create( dimensionType: EPCB_PrimitiveDimensionType, coordinateSet: TPCB_PrimitiveDimensionCoordinateSet, layer?: TPCB_LayersOfDimension, unit?: ESYS_Unit.MILLIMETER | ESYS_Unit.CENTIMETER | ESYS_Unit.INCH | ESYS_Unit.MIL, lineWidth?: number, precision?: number, primitiveLock?: boolean, ): Promise<IPCB_PrimitiveDimension | undefined>;`
- **delete**: `function delete(primitiveIds: string | IPCB_PrimitiveDimension | Array<string> | Array<IPCB_PrimitiveDimension>): Promise<boolean>;`
- **get**: `function get(primitiveIds: string): Promise<IPCB_PrimitiveDimension | undefined>;`
- **get_1**: `function get(primitiveIds: Array<string>): Promise<Array<IPCB_PrimitiveDimension>>;`
- **getall**: `function getAll( layer?: TPCB_LayersOfDimension, primitiveLock?: boolean, ): Promise<Array<IPCB_PrimitiveDimension>>;`
- **getallprimitiveid**: `function getAllPrimitiveId( layer?: TPCB_LayersOfDimension, primitiveLock?: boolean, ): Promise<Array<string>>;`
- **modify**: `function modify( primitiveId: string | IPCB_PrimitiveDimension, property: { dimensionType?: EPCB_PrimitiveDimensionType; coordinateSet?: TPCB_PrimitiveDimensionCoordinateSet; layer?: TPCB_LayersOfDimension; unit?: ESYS_Unit.MILLIMETER | ESYS_Unit.CENTIMETER | ESYS_Unit.INCH | ESYS_Unit.MIL; lineWidth?: number; precision?: number; primitiveLock?: boolean; }, ): Promise<IPCB_PrimitiveDimension | undefined>;`
---
## PCB_PrimitiveFill
PCB & footprint / fill primitive class
```typescript
class PCB_PrimitiveFill implements IPCB_PrimitiveAPI
```
- **create**: `function create( layer: TPCB_LayersOfFill, complexPolygon: IPCB_Polygon, net?: string, fillMode?: EPCB_PrimitiveFillMode, lineWidth?: number, primitiveLock?: boolean, ): Promise<IPCB_PrimitiveFill | undefined>;`
- **delete**: `function delete(primitiveIds: string | IPCB_PrimitiveFill | Array<string> | Array<IPCB_PrimitiveFill>): Promise<boolean>;`
- **get**: `function get(primitiveIds: string): Promise<IPCB_PrimitiveFill | undefined>;`
- **get_1**: `function get(primitiveIds: Array<string>): Promise<Array<IPCB_PrimitiveFill>>;`
- **getall**: `function getAll( layer?: TPCB_LayersOfFill, net?: string, primitiveLock?: boolean, ): Promise<Array<IPCB_PrimitiveFill>>;`
- **getallprimitiveid**: `function getAllPrimitiveId( layer?: TPCB_LayersOfFill, net?: string, primitiveLock?: boolean, ): Promise<Array<string>>;`
- **modify**: `function modify( primitiveId: string | IPCB_PrimitiveFill, property: { layer?: TPCB_LayersOfFill; complexPolygon?: IPCB_Polygon; net?: string; fillMode?: EPCB_PrimitiveFillMode; lineWidth?: number; primitiveLock?: boolean; }, ): Promise<IPCB_PrimitiveFill | undefined>;`
---
## PCB_PrimitiveImage
PCB & footprint / image primitive class
```typescript
class PCB_PrimitiveImage implements IPCB_PrimitiveAPI
```
- **create**: `function create( x: number, y: number, complexPolygon: | TPCB_PolygonSourceArray | Array<TPCB_PolygonSourceArray> | IPCB_Polygon | IPCB_ComplexPolygon, layer: TPCB_LayersOfImage, width?: number, height?: number, rotation?: number, horizonMirror?: boolean, primitiveLock?: boolean, ): Promise<IPCB_PrimitiveImage | undefined>;`
- **delete**: `function delete(primitiveIds: string | IPCB_PrimitiveImage | Array<string> | Array<IPCB_PrimitiveImage>): Promise<boolean>;`
- **get**: `function get(primitiveIds: string): Promise<IPCB_PrimitiveImage | undefined>;`
- **get_1**: `function get(primitiveIds: Array<string>): Promise<Array<IPCB_PrimitiveImage>>;`
- **getall**: `function getAll( layer?: TPCB_LayersOfImage, primitiveLock?: boolean, ): Promise<Array<IPCB_PrimitiveImage>>;`
- **getallprimitiveid**: `function getAllPrimitiveId( layer?: TPCB_LayersOfImage, primitiveLock?: boolean, ): Promise<Array<string>>;`
- **modify**: `function modify( primitiveId: string | IPCB_PrimitiveImage, property: { x?: number; y?: number; layer?: TPCB_LayersOfImage; width?: number; height?: number; rotation?: number; horizonMirror?: boolean; primitiveLock?: boolean; }, ): Promise<IPCB_PrimitiveImage | undefined>;`
---
## PCB_PrimitiveLine
PCB & footprint / line primitive class
```typescript
class PCB_PrimitiveLine implements IPCB_PrimitiveAPI
```
- **create**: `function create( net: string, layer: TPCB_LayersOfLine, startX: number, startY: number, endX: number, endY: number, lineWidth?: number, primitiveLock?: boolean, ): Promise<IPCB_PrimitiveLine | undefined>;`
- **delete**: `function delete(primitiveIds: string | IPCB_PrimitiveLine | Array<string> | Array<IPCB_PrimitiveLine>): Promise<boolean>;`
- **get**: `function get(primitiveIds: string): Promise<IPCB_PrimitiveLine | undefined>;`
- **get_1**: `function get(primitiveIds: Array<string>): Promise<Array<IPCB_PrimitiveLine>>;`
- **getall**: `function getAll( net?: string, layer?: TPCB_LayersOfLine, primitiveLock?: boolean, ): Promise<Array<IPCB_PrimitiveLine>>;`
- **getallprimitiveid**: `function getAllPrimitiveId( net?: string, layer?: TPCB_LayersOfLine, primitiveLock?: boolean, ): Promise<Array<string>>;`
- **modify**: `function modify( primitiveId: string | IPCB_PrimitiveLine, property: { net?: string; layer?: TPCB_LayersOfLine; startX?: number; startY?: number; endX?: number; endY?: number; lineWidth?: number; primitiveLock?: boolean; }, ): Promise<IPCB_PrimitiveLine | undefined>;`
---
## PCB_PrimitiveObject
PCB & footprint / binary embedded object primitive class
```typescript
class PCB_PrimitiveObject implements IPCB_PrimitiveAPI
```
- **create**: `function create( layer: TPCB_LayersOfObject, topLeftX: number, topLeftY: number, binaryData: string, width: number, height: number, rotation?: number, mirror?: boolean, fileName?: string, primitiveLock?: boolean, ): Promise<IPCB_PrimitiveObject | undefined>;`
- **delete**: `function delete(primitiveIds: string | IPCB_PrimitiveObject | Array<string> | Array<IPCB_PrimitiveObject>): Promise<boolean>;`
- **get**: `function get(primitiveIds: string): Promise<IPCB_PrimitiveObject | undefined>;`
- **get_1**: `function get(primitiveIds: Array<string>): Promise<Array<IPCB_PrimitiveObject>>;`
- **getall**: `function getAll( layer?: TPCB_LayersOfObject, primitiveLock?: boolean, ): Promise<Array<IPCB_PrimitiveObject>>;`
- **getallprimitiveid**: `function getAllPrimitiveId( layer?: TPCB_LayersOfObject, primitiveLock?: boolean, ): Promise<Array<string>>;`
- **modify**: `function modify( primitiveId: string | IPCB_PrimitiveObject, property: { layer?: TPCB_LayersOfObject; topLeftX?: number; topLeftY?: number; binaryData?: string; width?: number; height?: number; rotation?: number; mirror?: boolean; fileName?: string; primitiveLock?: boolean; }, ): Promise<IPCB_PrimitiveObject | undefined>;`
---
## PCB_PrimitivePad
PCB & footprint / pad primitive class
```typescript
class PCB_PrimitivePad implements IPCB_PrimitiveAPI
```
- **create**: *(签名过长,请查看详细文档)*
- **delete**: `function delete(primitiveIds: string | IPCB_PrimitivePad | Array<string> | Array<IPCB_PrimitivePad>): Promise<boolean>;`
- **get**: `function get(primitiveIds: string): Promise<IPCB_PrimitivePad | undefined>;`
- **get_1**: `function get(primitiveIds: Array<string>): Promise<Array<IPCB_PrimitivePad>>;`
- **getall**: `function getAll( layer?: TPCB_LayersOfPad, net?: string, primitiveLock?: boolean, padType?: EPCB_PrimitivePadType, ): Promise<Array<IPCB_PrimitivePad>>;`
- **getallprimitiveid**: `function getAllPrimitiveId( layer?: TPCB_LayersOfPad, net?: string, primitiveLock?: boolean, padType?: EPCB_PrimitivePadType, ): Promise<Array<string>>;`
- **modify**: *(签名过长,请查看详细文档)*
---
## PCB_PrimitivePolyline
PCB & footprint / polyline primitive class
```typescript
class PCB_PrimitivePolyline implements IPCB_PrimitiveAPI
```
- **create**: `function create( net: string, layer: TPCB_LayersOfLine, polygon: IPCB_Polygon, lineWidth?: number, primitiveLock?: boolean, ): Promise<IPCB_PrimitivePolyline | undefined>;`
- **delete**: `function delete(primitiveIds: string | IPCB_PrimitivePolyline | Array<string> | Array<IPCB_PrimitivePolyline>): Promise<boolean>;`
- **get**: `function get(primitiveIds: string): Promise<IPCB_PrimitivePolyline | undefined>;`
- **get_1**: `function get(primitiveIds: Array<string>): Promise<Array<IPCB_PrimitivePolyline>>;`
- **getall**: `function getAll( net?: string, layer?: TPCB_LayersOfLine, primitiveLock?: boolean, ): Promise<Array<IPCB_PrimitivePolyline>>;`
- **getallprimitiveid**: `function getAllPrimitiveId( net?: string, layer?: TPCB_LayersOfLine, primitiveLock?: boolean, ): Promise<Array<string>>;`
- **modify**: `function modify( primitiveId: string | IPCB_PrimitivePolyline, property: { net?: string; layer?: TPCB_LayersOfLine; polygon?: IPCB_Polygon; lineWidth?: number; primitiveLock?: boolean; }, ): Promise<IPCB_PrimitivePolyline | undefined>;`
---
## PCB_PrimitivePour
PCB & footprint / copper border primitive class
```typescript
class PCB_PrimitivePour implements IPCB_PrimitiveAPI
```
- **create**: `function create( net: string, layer: TPCB_LayersOfCopper, complexPolygon: IPCB_Polygon, pourFillMethod?: EPCB_PrimitivePourFillMethod, preserveSilos?: boolean, pourName?: string, pourPriority?: number, lineWidth?: number, primitiveLock?: boolean, ): Promise<IPCB_PrimitivePour | undefined>;`
- **delete**: `function delete(primitiveIds: string | IPCB_PrimitivePour | Array<string> | Array<IPCB_PrimitivePour>): Promise<boolean>;`
- **get**: `function get(primitiveIds: string): Promise<IPCB_PrimitivePour | undefined>;`
- **get_1**: `function get(primitiveIds: Array<string>): Promise<Array<IPCB_PrimitivePour>>;`
- **getall**: `function getAll( net?: string, layer?: TPCB_LayersOfCopper, primitiveLock?: boolean, ): Promise<Array<IPCB_PrimitivePour>>;`
- **getallprimitiveid**: `function getAllPrimitiveId( net?: string, layer?: TPCB_LayersOfCopper, primitiveLock?: boolean, ): Promise<Array<string>>;`
- **modify**: `function modify( primitiveId: string | IPCB_PrimitivePour, property: { net?: string; layer?: TPCB_LayersOfCopper; complexPolygon?: IPCB_Polygon; pourFillMethod?: EPCB_PrimitivePourFillMethod; preserveSilos?: boolean; pourName?: string; pourPriority?: number; lineWidth?: number; primitiveLock?: boolean; }, ): Promise<IPCB_PrimitivePour | undefined>;`
---
## PCB_PrimitivePoured
PCB & footprint / copper fill primitive class
```typescript
class PCB_PrimitivePoured implements IPCB_PrimitiveAPI
```
- **delete**: `function delete(primitiveIds: string | IPCB_PrimitivePoured | Array<string> | Array<IPCB_PrimitivePoured>): Promise<boolean>;`
- **get**: `function get(primitiveIds: string): Promise<IPCB_PrimitivePoured | undefined>;`
- **get_1**: `function get(primitiveIds: Array<string>): Promise<Array<IPCB_PrimitivePoured>>;`
- **getall**: `function getAll(): Promise<Array<IPCB_PrimitivePoured>>;`
- **getallprimitiveid**: `function getAllPrimitiveId(): Promise<Array<string>>;`
---
## PCB_PrimitiveRegion
PCB & footprint / forbidden region and constrained region primitive class
```typescript
class PCB_PrimitiveRegion implements IPCB_PrimitiveAPI
```
- **create**: `function create( layer: TPCB_LayersOfRegion, complexPolygon: IPCB_Polygon, ruleType?: Array<EPCB_PrimitiveRegionRuleType>, regionName?: string, lineWidth?: number, primitiveLock?: boolean, ): Promise<IPCB_PrimitiveRegion | undefined>;`
- **delete**: `function delete(primitiveIds: string | IPCB_PrimitiveRegion | Array<string> | Array<IPCB_PrimitiveRegion>): Promise<boolean>;`
- **get**: `function get(primitiveIds: string): Promise<IPCB_PrimitiveRegion | undefined>;`
- **get_1**: `function get(primitiveIds: Array<string>): Promise<Array<IPCB_PrimitiveRegion>>;`
- **getall**: `function getAll( layer?: TPCB_LayersOfRegion, ruleType?: Array<EPCB_PrimitiveRegionRuleType>, primitiveLock?: boolean, ): Promise<Array<IPCB_PrimitiveRegion>>;`
- **getallprimitiveid**: `function getAllPrimitiveId( layer?: TPCB_LayersOfRegion, ruleType?: Array<EPCB_PrimitiveRegionRuleType>, primitiveLock?: boolean, ): Promise<Array<string>>;`
- **modify**: `function modify( primitiveId: string | IPCB_PrimitiveRegion, property: { layer?: TPCB_LayersOfRegion; complexPolygon?: IPCB_Polygon; ruleType?: Array<EPCB_PrimitiveRegionRuleType>; regionName?: string; lineWidth?: number; primitiveLock?: boolean; }, ): Promise<IPCB_PrimitiveRegion | undefined>;`
---
## PCB_PrimitiveString
PCB & footprint / text primitive class
```typescript
class PCB_PrimitiveString implements IPCB_PrimitiveAPI
```
- **create**: `function create( layer: TPCB_LayersOfImage, x: number, y: number, text: string, fontFamily: string, fontSize: number, lineWidth: number, alignMode: EPCB_PrimitiveStringAlignMode, rotation: number, reverse: boolean, expansion: number, mirror: boolean, primitiveLock: boolean, ): Promise<IPCB_PrimitiveString | undefined>;`
- **delete**: `function delete(primitiveIds: string | IPCB_PrimitiveString | Array<string> | Array<IPCB_PrimitiveString>): Promise<boolean>;`
- **get**: `function get(primitiveIds: string): Promise<IPCB_PrimitiveString | undefined>;`
- **get_1**: `function get(primitiveIds: Array<string>): Promise<Array<IPCB_PrimitiveString>>;`
- **getall**: `function getAll( layer?: TPCB_LayersOfImage, primitiveLock?: boolean, ): Promise<Array<IPCB_PrimitiveString>>;`
- **getallprimitiveid**: `function getAllPrimitiveId( layer?: TPCB_LayersOfImage, primitiveLock?: boolean, ): Promise<Array<string>>;`
- **modify**: `function modify( primitiveId: string | IPCB_PrimitiveString, property: { layer?: TPCB_LayersOfImage; x?: number; y?: number; text?: string; fontFamily?: string; fontSize?: number; lineWidth?: number; alignMode?: EPCB_PrimitiveStringAlignMode; rotation?: number; reverse?: boolean; expansion?: number; mirror?: boolean; primitiveLock?: boolean; }, ): Promise<IPCB_PrimitiveString | undefined>;`
---
## PCB_PrimitiveVia
PCB & footprint / via primitive class
```typescript
class PCB_PrimitiveVia implements IPCB_PrimitiveAPI
```
- **create**: `function create( net: string, x: number, y: number, holeDiameter: number, diameter: number, viaType?: EPCB_PrimitiveViaType, designRuleBlindViaName?: string | null, solderMaskExpansion?: IPCB_PrimitiveSolderMaskAndPasteMaskExpansion | null, primitiveLock?: boolean, ): Promise<IPCB_PrimitiveVia | undefined>;`
- **delete**: `function delete(primitiveIds: string | IPCB_PrimitiveVia | Array<string> | Array<IPCB_PrimitiveVia>): Promise<boolean>;`
- **get**: `function get(primitiveIds: string): Promise<IPCB_PrimitiveVia | undefined>;`
- **get_1**: `function get(primitiveIds: Array<string>): Promise<Array<IPCB_PrimitiveVia>>;`
- **getall**: `function getAll(net?: string, primitiveLock?: boolean): Promise<Array<IPCB_PrimitiveVia>>;`
- **getallprimitiveid**: `function getAllPrimitiveId(net?: string, primitiveLock?: boolean): Promise<Array<string>>;`
- **modify**: `function modify( primitiveId: string | IPCB_PrimitiveVia, property: { net?: string; x?: number; y?: number; holeDiameter?: number; diameter?: number; viaType?: EPCB_PrimitiveViaType; designRuleBlindViaName?: string | null; solderMaskExpansion?: IPCB_PrimitiveSolderMaskAndPasteMaskExpansion | null; primitiveLock?: boolean; }, ): Promise<IPCB_PrimitiveVia | undefined>;`
---
## PCB_RayTracerEngine
PCB & footprint / ray tracer engine class
```typescript
class PCB_RayTracerEngine
```
- **dispose**: `function dispose(): Promise<void>;`
- **getlightconfigurations**: `function getLightConfigurations(lightName: string): Promise<any>;`
- **getrenderconfigurations**: `function getRenderConfigurations(): Promise<any>;`
- **init**: `function init(): Promise<void>;`
- **setrenderconfigurations**: `function setRenderConfigurations(configurations: any): Promise<void>;`
---
## PCB_SelectControl
PCB & footprint / selection control class
```typescript
class PCB_SelectControl
```
- **clearselected**: `function clearSelected(): Promise<boolean>;`
- **docrossprobeselect**: `function doCrossProbeSelect( components?: Array<string>, pins?: Array<string>, nets?: Array<string>, highlight?: boolean, select?: boolean, ): Promise<boolean>;`
- **doselectprimitives**: `function doSelectPrimitives(primitiveIds: string | Array<string>): Promise<boolean>;`
- **getallselectedprimitives**: `function getAllSelectedPrimitives(): Promise<Array<IPCB_Primitive>>;`
- **getallselectedprimitives_primitiveid**: `function getAllSelectedPrimitives_PrimitiveId(): Promise<Array<string>>;`
- **getcurrentmouseposition**: `function getCurrentMousePosition(): Promise<{ x: number; y: number } | undefined>;`
- **getselectedprimitives**: `function getSelectedPrimitives(): Promise<Array<object>>;`
---
## PCB_Tool
PCB / 设计工具类
```typescript
class PCB_Tool
```
---
## PNL_Document
Panel / document operation class
```typescript
class PNL_Document
```
- **save**: `function save(): Promise<boolean>;`
---
## SCH_Document
Schematic & symbol / document operation class
```typescript
class SCH_Document
```
- **autolayout**: `function autoLayout(props?: { uuids?: Array<string>; netlist?: { component: Record< string, { pinInfoMap: Record< string, { name: string; number: string; net: string; props: { 'Pin Number': string } } >; } >; }; designatorDeviceTypeMap?: Record< string, | 'resistor' | 'capacitor' | 'inductive' | 'diode' | 'triode' | 'oscillator' | 'chip' | 'otherDevice' >; }): Promise<any>;`
- **autorouting**: `function autoRouting(props?: { uuids?: Array<string>; netlist?: { component: Record< string, { pinInfoMap: Record< string, { name: string; number: string; net: string; props: { 'Pin Number': string } } >; } >; }; designatorDeviceTypeMap?: Record< string, | 'resistor' | 'capacitor' | 'inductive' | 'diode' | 'triode' | 'oscillator' | 'chip' | 'otherDevice' >; }): Promise<any>;`
- **getcurrentfilterconfiguration**: `function getCurrentFilterConfiguration(): Promise<Record<string, boolean> | undefined>;`
- **getprimitiveatpoint**: `function getPrimitiveAtPoint(x: number, y: number): Promise<ISCH_Primitive | undefined>;`
- **getprimitivesinregion**: `function getPrimitivesInRegion( left: number, right: number, top: number, bottom: number, ): Promise<Array<ISCH_Primitive>>;`
- **importchanges**: `function importChanges(): Promise<boolean>;`
- **navigatetocoordinates**: `function navigateToCoordinates(x: number, y: number): Promise<boolean>;`
- **navigatetoregion**: `function navigateToRegion( left: number, right: number, top: number, bottom: number, ): Promise<boolean>;`
- **save**: `function save(): Promise<boolean>;`
---
## SCH_Drc
Schematic & symbol / design rule check (DRC) class
```typescript
class SCH_Drc
```
- **check**: `function check( strict: boolean, userInterface: boolean, includeVerboseError: false, ): Promise<boolean>;`
- **check_1**: `function check( strict: boolean, userInterface: boolean, includeVerboseError: true, ): Promise<Array<ISCH_DrcError>>;`
---
## SCH_Event
Schematic & symbol / event class
```typescript
class SCH_Event
```
- **addmouseeventlistener**: `function addMouseEventListener( id: string, eventType: 'all' | ESCH_MouseEventType, callFn: (eventType: ESCH_MouseEventType) => void | Promise<void>, onlyOnce?: boolean, ): void;`
- **addprimitiveeventlistener**: `function addPrimitiveEventListener( id: string, eventType: 'all' | ESCH_PrimitiveEventType, callFn: ( eventType: ESCH_PrimitiveEventType, props: { primitiveIds: Array<string> }, ) => void | Promise<void>, onlyOnce?: boolean, ): void;`
- **addsimulationenginepulleventlistener**: `function addSimulationEnginePullEventListener( id: string, eventType: 'all', callFn: ( eventType: ESCH_DynamicSimulationEnginePullEventType | ESCH_SpiceSimulationEnginePullEventType, props: Record<string, any>, ) => void | Promise<void>, ): void;`
- **iseventlisteneralreadyexist**: `function isEventListenerAlreadyExist(id: string): boolean;`
- **removeeventlistener**: `function removeEventListener(id: string): boolean;`
---
## SCH_ManufactureData
Schematic & symbol / manufacture data class
```typescript
class SCH_ManufactureData
```
- **deletebomtemplate**: `function deleteBomTemplate(template: string): Promise<boolean>;`
- **getassemblyvariantsconfigs**: `function getAssemblyVariantsConfigs(): Promise<Array<{ text: string; value: string }>>;`
- **getbomfile**: `function getBomFile( fileName?: string, fileType?: 'xlsx' | 'csv', template?: string, filterOptions?: Array<{ property: string; includeValue: boolean | string }>, statistics?: Array<string>, property?: Array<string>, columns?: Array<IPCB_BomPropertiesTableColumns>, assemblyVariantsConfig?: { text: string; value: string }, ): Promise<File | undefined>;`
- **getbomtemplatefile**: `function getBomTemplateFile(template: string): Promise<File | undefined>;`
- **getbomtemplates**: `function getBomTemplates(): Promise<Array<string>>;`
- **getexportdocumentfile**: *(签名过长,请查看详细文档)*
- **getnetlistfile**: `function getNetlistFile( fileName?: string, netlistType?: ESYS_NetlistType, ): Promise<File | undefined>;`
- **getpngfile**: `function getPngFile( fileName?: string, resolution?: ISCH_ExportPngResolution, ): Promise<File | undefined>;`
- **getsimulationnetlistfile**: `function getSimulationNetlistFile( fileName?: string, netlistType?: ESCH_SimulationNetlistType, ): Promise<File | undefined>;`
- **getsvgfile**: `function getSvgFile(fileName?: string): Promise<File | undefined>;`
- **placecomponentsorder**: `function placeComponentsOrder(interactive?: boolean, ignoreWarning?: boolean): Promise<boolean>;`
- **placesmtcomponentsorder**: `function placeSmtComponentsOrder(interactive?: boolean, ignoreWarning?: boolean): Promise<boolean>;`
- **uploadbomtemplatefile**: `function uploadBomTemplateFile(templateFile: File, template?: string): Promise<string | undefined>;`
---
## SCH_Net
Schematic & symbol / net class
```typescript
class SCH_Net
```
- **getallnets**: `function getAllNets(): Promise<Array<ISCH_NetInfo>>;`
- **getallnetsname**: `function getAllNetsName(): Promise<Array<string>>;`
- **getcurrentprojectallnets**: `function getCurrentProjectAllNets(): Promise<Array<ISCH_ProjectNetInfo>>;`
- **getnet**: `function getNet(net: string): Promise<ISCH_NetInfo | undefined>;`
---
## SCH_Netlist
Schematic & symbol / netlist class
```typescript
class SCH_Netlist
```
- **getnetlist**: `function getNetlist(type?: ESYS_NetlistType): Promise<string>;`
- **setnetlist**: `function setNetlist(type: ESYS_NetlistType | undefined, netlist: string): Promise<void>;`
---
## SCH_Primitive
Schematic & symbol / primitive class
```typescript
class SCH_Primitive
```
- **getprimitivebyprimitiveid**: `function getPrimitiveByPrimitiveId(id: string): Promise<ISCH_Primitive | undefined>;`
- **getprimitivesbbox**: `function getPrimitivesBBox( primitiveIds: Array<string | ISCH_Primitive>, ): Promise<{ minX: number; minY: number; maxX: number; maxY: number } | undefined>;`
- **getprimitivesbyprimitiveid**: `function getPrimitivesByPrimitiveId(ids: Array<string>): Promise<Array<ISCH_Primitive>>;`
- **getprimitivetypebyprimitiveid**: `function getPrimitiveTypeByPrimitiveId(id: string): Promise<ESCH_PrimitiveType | undefined>;`
---
## SCH_PrimitiveArc
Schematic & symbol / arc primitive class
```typescript
class SCH_PrimitiveArc implements ISCH_PrimitiveAPI
```
- **create**: `function create( startX: number, startY: number, referenceX: number, referenceY: number, endX: number, endY: number, color?: string | null, fillColor?: string | null, lineWidth?: number | null, lineType?: ESCH_PrimitiveLineType | null, ): Promise<ISCH_PrimitiveArc | undefined>;`
- **delete**: `function delete(primitiveIds: string | ISCH_PrimitiveArc | Array<string> | Array<ISCH_PrimitiveArc>): Promise<boolean>;`
- **get**: `function get(primitiveIds: string): Promise<ISCH_PrimitiveArc | undefined>;`
- **get_1**: `function get(primitiveIds: Array<string>): Promise<Array<ISCH_PrimitiveArc>>;`
- **getall**: `function getAll(): Promise<Array<ISCH_PrimitiveArc>>;`
- **getallprimitiveid**: `function getAllPrimitiveId(): Promise<Array<string>>;`
- **modify**: `function modify( primitiveId: string | ISCH_PrimitiveArc, property: { startX?: number; startY?: number; referenceX?: number; referenceY?: number; endX?: number; endY?: number; color?: string | null; fillColor?: string | null; lineWidth?: number | null; lineType?: ESCH_PrimitiveLineType | null; }, ): Promise<ISCH_PrimitiveArc | undefined>;`
---
## SCH_PrimitiveAttribute
Schematic & symbol / property primitive class
```typescript
class SCH_PrimitiveAttribute implements ISCH_PrimitiveAPI
```
- **createnetlabel**: `function createNetLabel( x: number, y: number, net: string, ): Promise<ISCH_PrimitiveAttribute | undefined>;`
- **get**: `function get(primitiveIds: string): Promise<ISCH_PrimitiveAttribute | undefined>;`
- **get_1**: `function get(primitiveIds: Array<string>): Promise<Array<ISCH_PrimitiveAttribute>>;`
- **getall**: `function getAll(parentPrimitiveId?: string): Promise<Array<ISCH_PrimitiveAttribute>>;`
- **getallprimitiveid**: `function getAllPrimitiveId(parentPrimitiveId?: string): Promise<Array<string>>;`
- **modify**: *(签名过长,请查看详细文档)*
---
## SCH_PrimitiveBus
Schematic & symbol / bus primitive class
```typescript
class SCH_PrimitiveBus implements ISCH_PrimitiveAPI
```
- **create**: `function create( busName: string, line: Array<number> | Array<Array<number>>, color?: string | null, lineWidth?: number | null, lineType?: ESCH_PrimitiveLineType | null, ): Promise<ISCH_PrimitiveBus | undefined>;`
- **delete**: `function delete(primitiveIds: string | ISCH_PrimitiveBus | Array<string> | Array<ISCH_PrimitiveBus>): Promise<boolean>;`
- **get**: `function get(primitiveIds: string): Promise<ISCH_PrimitiveBus | undefined>;`
- **get_1**: `function get(primitiveIds: Array<string>): Promise<Array<ISCH_PrimitiveBus>>;`
- **getall**: `function getAll(): Promise<Array<ISCH_PrimitiveBus>>;`
- **getallprimitiveid**: `function getAllPrimitiveId(): Promise<Array<string>>;`
- **modify**: `function modify( primitiveId: string | ISCH_PrimitiveBus, property: { busName?: string; line?: Array<number> | Array<Array<number>>; color?: string | null; lineWidth?: number | null; lineType?: ESCH_PrimitiveLineType | null; }, ): Promise<ISCH_PrimitiveBus | undefined>;`
---
## SCH_PrimitiveCircle
Schematic & symbol / circle primitive class
```typescript
class SCH_PrimitiveCircle implements ISCH_PrimitiveAPI
```
- **create**: `function create( centerX: number, centerY: number, radius: number, color?: string | null, fillColor?: string | null, lineWidth?: number | null, lineType?: ESCH_PrimitiveLineType | null, fillStyle?: ESCH_PrimitiveFillStyle | null, ): Promise<ISCH_PrimitiveCircle | undefined>;`
- **delete**: `function delete(primitiveIds: string | ISCH_PrimitiveCircle | Array<string> | Array<ISCH_PrimitiveCircle>): Promise<boolean>;`
- **get**: `function get(primitiveIds: string): Promise<ISCH_PrimitiveCircle | undefined>;`
- **get_1**: `function get(primitiveIds: Array<string>): Promise<Array<ISCH_PrimitiveCircle>>;`
- **getall**: `function getAll(): Promise<Array<ISCH_PrimitiveCircle>>;`
- **getallprimitiveid**: `function getAllPrimitiveId(): Promise<Array<string>>;`
- **modify**: `function modify( primitiveId: string | ISCH_PrimitiveCircle, property: { centerX?: number; centerY?: number; radius?: number; color?: string | null; fillColor?: string | null; lineWidth?: number | null; lineType?: ESCH_PrimitiveLineType | null; fillStyle?: ESCH_PrimitiveFillStyle | null; }, ): Promise<ISCH_PrimitiveCircle | undefined>;`
---
## SCH_PrimitiveComponent
Schematic & symbol / device primitive class
```typescript
class SCH_PrimitiveComponent implements ISCH_PrimitiveAPI
```
- **create**: `function create( component: | { libraryType?: ELIB_LibraryType.DEVICE; libraryUuid: string; uuid: string } | ILIB_DeviceItem | ILIB_DeviceSearchItem | { libraryType: ELIB_LibraryType.SYMBOL; libraryUuid: string; uuid: string } | ILIB_SymbolItem | ILIB_SymbolSearchItem, x: number, y: number, subPartName?: string, rotation?: number, mirror?: boolean, addIntoBom?: boolean, addIntoPcb?: boolean, ): Promise<ISCH_PrimitiveComponent | undefined>;`
- **createcbbsymbol**: `function createCbbSymbol( cbbSymbol: { libraryUuid: string; cbbUuid: string; uuid?: string }, x: number, y: number, rotation?: number, mirror?: boolean, ): Promise<ISCH_PrimitiveCbbSymbolComponent | undefined>;`
- **createnetflag**: `function createNetFlag( identification: 'Power' | 'Ground' | 'AnalogGround' | 'ProtectGround', net: string, x: number, y: number, rotation?: number, mirror?: boolean, ): Promise<ISCH_PrimitiveComponent | undefined>;`
- **createnetport**: `function createNetPort( direction: 'IN' | 'OUT' | 'BI', net: string, x: number, y: number, rotation?: number, mirror?: boolean, ): Promise<ISCH_PrimitiveComponent | undefined>;`
- **createshortcircuitflag**: `function createShortCircuitFlag( x: number, y: number, rotation?: number, mirror?: boolean, ): Promise<ISCH_PrimitiveComponent | undefined>;`
- **delete**: `function delete(primitiveIds: string | ISCH_PrimitiveComponent | Array<string> | Array<ISCH_PrimitiveComponent>): Promise<boolean>;`
- **get**: `function get(primitiveIds: string): Promise<ISCH_PrimitiveComponent | undefined>;`
- **get_1**: `function get(primitiveIds: Array<string>): Promise<Array<ISCH_PrimitiveComponent>>;`
- **getall**: `function getAll( componentType?: ESCH_PrimitiveComponentType, allSchematicPages?: boolean, ): Promise<Array<ISCH_PrimitiveComponent>>;`
- **getallpinsbyprimitiveid**: `function getAllPinsByPrimitiveId( primitiveId: string, ): Promise<Array<ISCH_PrimitiveComponentPin> | undefined>;`
- **getallprimitiveid**: `function getAllPrimitiveId( componentType?: ESCH_PrimitiveComponentType, allSchematicPages?: boolean, ): Promise<Array<string>>;`
- **getallpropertynames**: `function getAllPropertyNames(): Promise<Array<string>>;`
- **modify**: *(签名过长,请查看详细文档)*
- **placecbbschematicpage**: `function placeCbbSchematicPage( cbbSchematicPage: { libraryUuid: string; cbbUuid: string; uuid: string }, x: number, y: number, props?: { reimportWhenNameRepeated?: boolean }, ): Promise<boolean>;`
- **placecomponentwithmouse**: `function placeComponentWithMouse( component: { libraryUuid: string; uuid: string } | ILIB_DeviceItem | ILIB_DeviceSearchItem, subPartName?: string, ): Promise<boolean>;`
- **placesymbolwithmouse**: `function placeSymbolWithMouse( symbol: { libraryUuid: string; uuid: string } | ILIB_SymbolItem | ILIB_SymbolSearchItem, subPartName?: string, properties?: Record<string, boolean | number | string | undefined>, ): Promise<boolean>;`
- **setnetflagcomponentuuid_analogground**: `function setNetFlagComponentUuid_AnalogGround( component: { libraryUuid: string; uuid: string } | ILIB_DeviceItem | ILIB_DeviceSearchItem, ): Promise<boolean>;`
- **setnetflagcomponentuuid_ground**: `function setNetFlagComponentUuid_Ground( component: { libraryUuid: string; uuid: string } | ILIB_DeviceItem | ILIB_DeviceSearchItem, ): Promise<boolean>;`
- **setnetflagcomponentuuid_power**: `function setNetFlagComponentUuid_Power( component: { libraryUuid: string; uuid: string } | ILIB_DeviceItem | ILIB_DeviceSearchItem, ): Promise<boolean>;`
- **setnetflagcomponentuuid_protectground**: `function setNetFlagComponentUuid_ProtectGround( component: { libraryUuid: string; uuid: string } | ILIB_DeviceItem | ILIB_DeviceSearchItem, ): Promise<boolean>;`
- **setnetportcomponentuuid_bi**: `function setNetPortComponentUuid_BI( component: { libraryUuid: string; uuid: string } | ILIB_DeviceItem | ILIB_DeviceSearchItem, ): Promise<boolean>;`
- **setnetportcomponentuuid_in**: `function setNetPortComponentUuid_IN( component: { libraryUuid: string; uuid: string } | ILIB_DeviceItem | ILIB_DeviceSearchItem, ): Promise<boolean>;`
- **setnetportcomponentuuid_out**: `function setNetPortComponentUuid_OUT( component: { libraryUuid: string; uuid: string } | ILIB_DeviceItem | ILIB_DeviceSearchItem, ): Promise<boolean>;`
---
## SCH_PrimitiveObject
Schematic & symbol / binary embedded object primitive class
```typescript
class SCH_PrimitiveObject implements ISCH_PrimitiveAPI
```
- **create**: `function create( content: File | string, startX: number, startY: number, width?: number, height?: number, rotation?: number, mirror?: boolean, fileName?: string, ): Promise<ISCH_PrimitiveObject | undefined>;`
- **delete**: `function delete(primitiveIds: string | ISCH_PrimitiveObject | Array<string> | Array<ISCH_PrimitiveObject>): Promise<boolean>;`
- **get**: `function get(primitiveIds: string): Promise<ISCH_PrimitiveObject | undefined>;`
- **get_1**: `function get(primitiveIds: Array<string>): Promise<Array<ISCH_PrimitiveObject>>;`
- **getall**: `function getAll(): Promise<Array<ISCH_PrimitiveObject>>;`
- **getallprimitiveid**: `function getAllPrimitiveId(): Promise<Array<string>>;`
- **modify**: `function modify( primitiveId: string | ISCH_PrimitiveObject, property: { content?: File | string; startX?: number; startY?: number; width?: number; height?: number; rotation?: number; mirror?: boolean; fileName?: string; }, ): Promise<ISCH_PrimitiveObject | undefined>;`
---
## SCH_PrimitivePin
Schematic & symbol / pin primitive class
```typescript
class SCH_PrimitivePin implements ISCH_PrimitiveAPI
```
- **create**: `function create( x: number, y: number, pinNumber: string, pinName?: string, rotation?: number, pinLength?: number, pinColor?: string | null, pinShape?: ESCH_PrimitivePinShape, pinType?: ESCH_PrimitivePinType, ): Promise<ISCH_PrimitivePin | undefined>;`
- **delete**: `function delete(primitiveIds: string | ISCH_PrimitivePin | Array<string> | Array<ISCH_PrimitivePin>): Promise<boolean>;`
- **get**: `function get( primitiveIds: string, ): Promise<ISCH_PrimitivePin | ISCH_PrimitiveComponentPin | undefined>;`
- **get_1**: `function get( primitiveIds: Array<string>, ): Promise<Array<ISCH_PrimitivePin | ISCH_PrimitiveComponentPin>>;`
- **getall**: `function getAll(): Promise<Array<ISCH_PrimitivePin>>;`
- **getallprimitiveid**: `function getAllPrimitiveId(): Promise<Array<string>>;`
- **modify**: `function modify( primitiveId: string | ISCH_PrimitivePin | ISCH_PrimitiveComponentPin, property: { x?: number; y?: number; pinNumber?: string; pinName?: string; rotation?: number; pinLength?: number; pinColor?: string | null; pinShape?: ESCH_PrimitivePinShape; pinType?: ESCH_PrimitivePinType; noConnected?: boolean; otherProperty?: Record<string, string | number | boolean>; }, ): Promise<ISCH_PrimitivePin | ISCH_PrimitiveComponentPin | undefined>;`
---
## SCH_PrimitivePolygon
Schematic & symbol / polygon (polyline) primitive class
```typescript
class SCH_PrimitivePolygon implements ISCH_PrimitiveAPI
```
- **create**: `function create( line: Array<number>, color?: string | null, fillColor?: string | null, lineWidth?: number | null, lineType?: ESCH_PrimitiveLineType | null, ): Promise<ISCH_PrimitivePolygon | undefined>;`
- **delete**: `function delete(primitiveIds: string | ISCH_PrimitivePolygon | Array<string> | Array<ISCH_PrimitivePolygon>): Promise<boolean>;`
- **get**: `function get(primitiveIds: string): Promise<ISCH_PrimitivePolygon | undefined>;`
- **get_1**: `function get(primitiveIds: Array<string>): Promise<Array<ISCH_PrimitivePolygon>>;`
- **getall**: `function getAll(): Promise<Array<ISCH_PrimitivePolygon>>;`
- **getallprimitiveid**: `function getAllPrimitiveId(): Promise<Array<string>>;`
- **modify**: `function modify( primitiveId: string | ISCH_PrimitivePolygon, property: { line?: Array<number>; color?: string | null; fillColor?: string | null; lineWidth?: number | null; lineType?: ESCH_PrimitiveLineType | null; }, ): Promise<ISCH_PrimitivePolygon | undefined>;`
---
## SCH_PrimitiveRectangle
Schematic & symbol / rectangle primitive class
```typescript
class SCH_PrimitiveRectangle implements ISCH_PrimitiveAPI
```
- **create**: `function create( topLeftX: number, topLeftY: number, width: number, height: number, cornerRadius?: number, rotation?: number, color?: string | null, fillColor?: string | null, lineWidth?: number | null, lineType?: ESCH_PrimitiveLineType | null, fillStyle?: ESCH_PrimitiveFillStyle | null, ): Promise<ISCH_PrimitiveRectangle | undefined>;`
- **delete**: `function delete(primitiveIds: string | ISCH_PrimitiveRectangle | Array<string> | Array<ISCH_PrimitiveRectangle>): Promise<boolean>;`
- **get**: `function get(primitiveIds: string): Promise<ISCH_PrimitiveRectangle | undefined>;`
- **get_1**: `function get(primitiveIds: Array<string>): Promise<Array<ISCH_PrimitiveRectangle>>;`
- **getall**: `function getAll(): Promise<Array<ISCH_PrimitiveRectangle>>;`
- **getallprimitiveid**: `function getAllPrimitiveId(): Promise<Array<string>>;`
- **modify**: `function modify( primitiveId: string | ISCH_PrimitiveRectangle, property: { topLeftX?: number; topLeftY?: number; width?: number; height?: number; cornerRadius?: number; rotation?: number; color?: string | null; fillColor?: string | null; lineWidth?: number | null; lineType?: ESCH_PrimitiveLineType | null; fillStyle?: ESCH_PrimitiveFillStyle | null; }, ): Promise<ISCH_PrimitiveRectangle | undefined>;`
---
## SCH_PrimitiveText
Schematic & symbol / text primitive class
```typescript
class SCH_PrimitiveText implements ISCH_PrimitiveAPI
```
- **create**: `function create( x: number, y: number, content: string, rotation?: number, textColor?: string | null, fontName?: string | null, fontSize?: number | null, bold?: boolean, italic?: boolean, underLine?: boolean, alignMode?: ESCH_PrimitiveTextAlignMode, ): Promise<ISCH_PrimitiveText | undefined>;`
- **delete**: `function delete(primitiveIds: string | ISCH_PrimitiveText | Array<string> | Array<ISCH_PrimitiveText>): Promise<boolean>;`
- **get**: `function get(primitiveIds: string): Promise<ISCH_PrimitiveText | undefined>;`
- **get_1**: `function get(primitiveIds: Array<string>): Promise<Array<ISCH_PrimitiveText>>;`
- **getall**: `function getAll(): Promise<Array<ISCH_PrimitiveText>>;`
- **getallprimitiveid**: `function getAllPrimitiveId(): Promise<Array<string>>;`
- **modify**: `function modify( primitiveId: string | ISCH_PrimitiveText, property: { x?: number; y?: number; content?: string; rotation?: number; textColor?: string | null; fontName?: string | null; fontSize?: number | null; bold?: boolean; italic?: boolean; underLine?: boolean; alignMode?: ESCH_PrimitiveTextAlignMode; }, ): Promise<ISCH_PrimitiveText | undefined>;`
---
## SCH_PrimitiveWire
Schematic & symbol / wire primitive class
```typescript
class SCH_PrimitiveWire implements ISCH_PrimitiveAPI
```
- **create**: `function create( line: Array<number> | Array<Array<number>>, net?: string, color?: string | null, lineWidth?: number | null, lineType?: ESCH_PrimitiveLineType | null, ): Promise<ISCH_PrimitiveWire | undefined>;`
- **delete**: `function delete(primitiveIds: string | ISCH_PrimitiveWire | Array<string> | Array<ISCH_PrimitiveWire>): Promise<boolean>;`
- **get**: `function get(primitiveIds: string): Promise<ISCH_PrimitiveWire | undefined>;`
- **get_1**: `function get(primitiveIds: Array<string>): Promise<Array<ISCH_PrimitiveWire>>;`
- **getall**: `function getAll(net?: string | Array<string>): Promise<Array<ISCH_PrimitiveWire>>;`
- **getallprimitiveid**: `function getAllPrimitiveId(net?: string | Array<string>): Promise<Array<string>>;`
- **modify**: `function modify( primitiveId: string | ISCH_PrimitiveWire, property: { line?: Array<number> | Array<Array<number>>; net?: string; color?: string | null; lineWidth?: number | null; lineType?: ESCH_PrimitiveLineType | null; }, ): Promise<ISCH_PrimitiveWire | undefined>;`
---
## SCH_SelectControl
Schematic & symbol / selection control class
```typescript
class SCH_SelectControl
```
- **clearselected**: `function clearSelected(): boolean;`
- **docrossprobeselect**: `function doCrossProbeSelect( components?: Array<string>, pins?: Array<string>, nets?: Array<string>, highlight?: boolean, select?: boolean, ): boolean;`
- **doselectprimitives**: `function doSelectPrimitives(primitiveIds: string | Array<string>): Promise<boolean>;`
- **getallselectedprimitives**: `function getAllSelectedPrimitives(): Promise<Array<ISCH_Primitive>>;`
- **getallselectedprimitives_primitiveid**: `function getAllSelectedPrimitives_PrimitiveId(): Promise<Array<string>>;`
- **getcurrentmouseposition**: `function getCurrentMousePosition(): Promise<{ x: number; y: number } | undefined>;`
- **getselectedprimitives**: `function getSelectedPrimitives(): Promise<Array<object>>;`
- **getselectedprimitives_primitiveid**: `function getSelectedPrimitives_PrimitiveId(): Promise<Array<string>>;`
---
## SCH_SimulationEngine
Schematic & symbol / simulation engine class
```typescript
class SCH_SimulationEngine
```
- **pushdata**: `function pushData( eventType: ESCH_DynamicSimulationEnginePushEventType | ESCH_SpiceSimulationEnginePushEventType, props: Record<string, any>, ): void;`
---
## SCH_Utils
Schematic & symbol / utility class
```typescript
class SCH_Utils
```
- **splitlines**: `function splitLines( lines: Array<number | Array<number>>, ): Array<Array<number | Array<number>>> | undefined;`
---
## SYS_ClientUrl
System / external request class
```typescript
class SYS_ClientUrl
```
- **request**: `function request( url: string, method?: 'GET' | 'POST' | 'HEAD' | 'PUT' | 'DELETE' | 'PATCH', data?: string | Blob | FormData | URLSearchParams, options?: { headers?: { [header: string]: any }; integrity?: string }, succeedCallFn?: (data: Response) => void | Promise<void>, ): Promise<Response>;`
---
## SYS_Dialog
System / dialog class
```typescript
class SYS_Dialog
```
- **createdesignportal**: `function createDesignPortal(): IDesignPortal;`
- **showconfirmationmessage**: `function showConfirmationMessage( content: string, title?: string, mainButtonTitle?: string, buttonTitle?: string, callbackFn?: (mainButtonClicked: boolean) => void, ): void;`
- **showinformationmessage**: `function showInformationMessage(content: string, title?: string, buttonTitle?: string): void;`
- **showinputdialog**: *(签名过长,请查看详细文档)*
- **showselectdialog**: `function showSelectDialog( options: Array<string> | Array<{ value: string; displayContent: string }>, beforeContent?: string, afterContent?: string, title?: string, defaultOption?: string, multiple?: false, callbackFn?: (value: string) => void | Promise<void>, ): void;`
- **showselectdialog_1**: `function showSelectDialog( options: Array<string> | Array<{ value: string; displayContent: string }>, beforeContent?: string, afterContent?: string, title?: string, defaultOption?: Array<string>, multiple?: true, callbackFn?: (value: Array<string>) => void | Promise<void>, ): void;`
---
## SYS_Environment
System / runtime environment class
```typescript
class SYS_Environment
```
- **geteditorcomplieddate**: `function getEditorCompliedDate(): string;`
- **geteditorcurrentversion**: `function getEditorCurrentVersion(onlySemantic?: boolean): string;`
- **getuserinfo**: `function getUserInfo(): { username?: string; nickname?: string; avatar?: string; uuid?: string; customerCode?: string; };`
- **isclient**: `function isClient(): boolean;`
- **iseasyedaproedition**: `function isEasyEDAProEdition(): boolean;`
- **iseditorcurrentversiongreaterthanorequal**: `function isEditorCurrentVersionGreaterThanOrEqual(version: string): boolean;`
- **iseditorcurrentversionlessthanorequal**: `function isEditorCurrentVersionLessThanOrEqual(version: string): boolean;`
- **ishalfofflinemode**: `function isHalfOfflineMode(): boolean;`
- **isjlcedaproedition**: `function isJLCEDAProEdition(): boolean;`
- **isofflinemode**: `function isOfflineMode(): boolean;`
- **isonlinemode**: `function isOnlineMode(): boolean;`
- **isproprivateedition**: `function isProPrivateEdition(): boolean;`
- **isweb**: `function isWeb(): boolean;`
---
## SYS_ExternalApi
外部接口注入管理类
```typescript
class SYS_ExternalApi
```
- **register**: `function register( namespace: string, apiName: string, callFn: (...args: any[]) => any | Promise<any>, help?: ISYS_ExternalApiHelp, ): void;`
- **unregister**: `function unregister(namespace: string, apiName: string): boolean;`
---
## SYS_FileManager
System / file manager class
```typescript
class SYS_FileManager
```
- **extractlibinfo**: `function extractLibInfo(data: File | Array<File>): Promise<any>;`
- **extractprojectinfo**: `function extractProjectInfo(data: File): Promise<any>;`
- **getcbbfilebycbbuuid**: `function getCbbFileByCbbUuid( cbbUuid: string, libraryUuid?: string, props?: { fileName?: string; password?: string; fileType?: 'epro' | 'epro2'; templateSchematicUuid?: string; templatePcbUuid?: string; }, ): Promise<File | undefined>;`
- **getdevicefilebydeviceuuid**: `function getDeviceFileByDeviceUuid( deviceUuid: string | Array<string>, libraryUuid?: string, fileType?: 'elibz' | 'elibz2', ): Promise<File | undefined>;`
- **getdocumentfile**: `function getDocumentFile( fileName?: string, password?: string, fileType?: 'epro' | 'epro2', ): Promise<File | undefined>;`
- **getdocumentfootprintsources**: `function getDocumentFootprintSources(): Promise< Array<{ footprintUuid: string; documentSource: string }> >;`
- **getdocumentsource**: `function getDocumentSource(): Promise<string | undefined>;`
- **getfootprintfilebyfootprintuuid**: `function getFootprintFileByFootprintUuid( footprintUuid: string | Array<string>, libraryUuid?: string, fileType?: 'elibz' | 'elibz2', ): Promise<File | undefined>;`
- **getpanellibraryfilebypanellibraryuuid**: `function getPanelLibraryFileByPanelLibraryUuid( panelLibraryUuid: string | Array<string>, libraryUuid?: string, fileType?: 'elibz' | 'elibz2', ): Promise<File | undefined>;`
- **getprojectfile**: `function getProjectFile( fileName?: string, password?: string, fileType?: 'epro' | 'epro2', ): Promise<File | undefined>;`
- **getprojectfilebyprojectuuid**: `function getProjectFileByProjectUuid( projectUuid: string, fileName?: string, password?: string, fileType?: 'epro' | 'epro2', ): Promise<File | undefined>;`
- **getschematicfile**: `function getSchematicFile( fileName?: string, password?: string, fileType?: 'epro' | 'epro2', ): Promise<File | undefined>;`
- **getsymbolfilebysymboluuid**: `function getSymbolFileBySymbolUuid( symbolUuid: string | Array<string>, libraryUuid?: string, fileType?: 'elibz' | 'elibz2', ): Promise<File | undefined>;`
- **importprojectbyprojectfile**: *(签名过长,请查看详细文档)*
- **importprojectbyprojectfile_1**: *(签名过长,请查看详细文档)*
- **setdocumentsource**: `function setDocumentSource(source: string): Promise<boolean>;`
---
## SYS_FileSystem
System / file system interaction class
```typescript
class SYS_FileSystem
```
- **createdirectoryinfilesystem**: `function createDirectoryInFileSystem(folderPath: string): Promise<boolean>;`
- **createobjecturl**: `function createObjectURL(blob: Blob | File): string;`
- **deletefileinfilesystem**: `function deleteFileInFileSystem(uri: string, force?: boolean): Promise<boolean>;`
- **existspathinfilesystem**: `function existsPathInFileSystem(uri: string): Promise<boolean>;`
- **getdocumentspath**: `function getDocumentsPath(): Promise<string>;`
- **getedapath**: `function getEdaPath(): Promise<string>;`
- **getextensionfile**: `function getExtensionFile(uri: string): Promise<File | undefined>;`
- **getlibrariespaths**: `function getLibrariesPaths(): Promise<Array<string>>;`
- **getprojectspaths**: `function getProjectsPaths(): Promise<Array<string>>;`
- **listfilesoffilesystem**: `function listFilesOfFileSystem( folderPath: string, recursive?: boolean, ): Promise<Array<ISYS_FileSystemFileList>>;`
- **openreadfiledialog**: `function openReadFileDialog( filenameExtensions?: string | Array<string>, multiFiles?: true, ): Promise<Array<File> | undefined>;`
- **openreadfiledialog_1**: `function openReadFileDialog( filenameExtensions?: string | Array<string>, multiFiles?: false, ): Promise<File | undefined>;`
- **openreadfilepathdialog**: `function openReadFilePathDialog( filenameExtensions?: string | Array<string>, multiFiles?: true, ): Promise<Array<string>>;`
- **openreadfilepathdialog_1**: `function openReadFilePathDialog( filenameExtensions?: string | Array<string>, multiFiles?: false, ): Promise<string | undefined>;`
- **openreadfolderdialog**: `function openReadFolderDialog(): Promise<Array<{ relativePath: string; file: File }>>;`
- **openreadfolderpathdialog**: `function openReadFolderPathDialog(): Promise<string | undefined>;`
- **readfilefromfilesystem**: `function readFileFromFileSystem(uri: string): Promise<File | undefined>;`
- **revokeobjecturl**: `function revokeObjectURL(url: string): void;`
- **savefile**: `function saveFile(fileData: File | Blob, fileName?: string): Promise<void>;`
- **savefiletofilesystem**: `function saveFileToFileSystem( uri: string, fileData: File | Blob, fileName?: string, force?: boolean, ): Promise<boolean>;`
---
## SYS_FontManager
System / font manager class
```typescript
class SYS_FontManager
```
- **addfont**: `function addFont(fontName: string): Promise<boolean>;`
- **deletefont**: `function deleteFont(fontName: string): Promise<boolean>;`
- **getfontslist**: `function getFontsList(): Promise<Array<string>>;`
---
## SYS_FormatConversion
System / format conversion (Chameleon) class
```typescript
class SYS_FormatConversion
```
- **convertaltiumdesignerlibrariestoeasyedamultifiles**: `function convertAltiumDesignerLibrariesToEasyEDAMultiFiles( file: File | Array<File>, ): Promise<Array<File>>;`
- **convertaltiumdesignerlibrariestoeasyedasinglefile**: `function convertAltiumDesignerLibrariesToEasyEDASingleFile( file: File | Array<File>, ): Promise<File | undefined>;`
- **convertdisalibrariestoeasyedamultifiles**: `function convertDisaLibrariesToEasyEDAMultiFiles(file: File | Array<File>): Promise<Array<File>>;`
- **convertdisalibrariestoeasyedasinglefile**: `function convertDisaLibrariesToEasyEDASingleFile( file: File | Array<File>, ): Promise<File | undefined>;`
---
## SYS_HeaderMenu
System / header menu class
```typescript
class SYS_HeaderMenu
```
- **insertheadermenus**: `function insertHeaderMenus(headerMenus: ISYS_HeaderMenus): Promise<void>;`
- **insertsystemheadermenuitem**: `function insertSystemHeaderMenuItem( env: ESYS_HeaderMenuEnvironment, id: Array<string>, props: { title: string; registerFn?: string; icon?: string; shortcutKey?: TSYS_ShortcutKeys; menuItems?: Array<ISYS_HeaderMenuSub1MenuItem | ISYS_HeaderMenuSub2MenuItem | null>; insertDividerBefore?: boolean; insertDividerAfter?: boolean; insertBefore?: string; crossDividerWhenInsert?: boolean; }, ): Promise<string | undefined>;`
- **removeheadermenus**: `function removeHeaderMenus(): void;`
- **removesystemheadermenuitem**: `function removeSystemHeaderMenuItem( id: Array<string>, props?: { removeTheBeforeDivider?: boolean; removeTheAfterDivider?: boolean; }, ): Promise<boolean>;`
- **replaceheadermenus**: `function replaceHeaderMenus(headerMenus: ISYS_HeaderMenus): Promise<void>;`
---
## SYS_Help
Help 渐进式披露类
```typescript
class SYS_Help
```
- **help**: `function help( namespace?: string, className?: string, methodName?: string, ): Promise<ISYS_HelpData | Record<string, any> | ISYS_HelpClassSummary | ISYS_HelpMethodDetail>;`
---
## SYS_I18n
System / multilingual class
```typescript
class SYS_I18n
```
- **addlanguagechangedeventlistener**: `function addLanguageChangedEventListener( id: string, callFn: (newLanguage: string, lastLanguage: string) => void | Promise<void>, onlyOnce: boolean, ): void;`
- **getallsupportedlanguages**: `function getAllSupportedLanguages(): Array<string>;`
- **getcurrentlanguage**: `function getCurrentLanguage(): Promise<string>;`
- **importmultilingual**: `function importMultilingual(language: string, source: TSYS_LanguageKeyValuePairs): boolean;`
- **importmultilinguallanguage**: `function importMultilingualLanguage( namespace: string, language: string, source: TSYS_LanguageKeyValuePairs, ): boolean;`
- **importmultilingualnamespace**: `function importMultilingualNamespace( namespace: string, source: ISYS_MultilingualLanguagesData, ): boolean;`
- **iseventlisteneralreadyexist**: `function isEventListenerAlreadyExist(id: string): boolean;`
- **islanguagesupported**: `function isLanguageSupported(language: string): boolean;`
- **removeeventlistener**: `function removeEventListener(id: string): boolean;`
- **text**: `function text(tag: string, namespace?: string, language?: string, ...args: Array<any>): string;`
---
## SYS_IFrame
System / iframe window class
```typescript
class SYS_IFrame
```
- **closeiframe**: `function closeIFrame(id?: string): Promise<boolean>;`
- **hideiframe**: `function hideIFrame(id?: string): Promise<boolean>;`
- **isiframealreadyexist**: `function isIFrameAlreadyExist(id: string): Promise<boolean>;`
- **openiframe**: `function openIFrame( htmlFileName: string, width?: number, height?: number, id?: string, props?: { maximizeButton?: boolean; minimizeButton?: boolean; minimizeStyle?: 'collapsed' | 'constricted'; buttonCallbackFn?: (button: 'close' | 'minimize' | 'maximize') => void | Promise<void>; onBeforeCloseCallFn?: () => boolean | undefined | Promise<boolean | undefined>; grayscaleMask?: boolean; title?: string; x?: number; y?: number; }, ): Promise<boolean>;`
- **showiframe**: `function showIFrame(id?: string): Promise<boolean>;`
---
## SYS_LoadingAndProgressBar
System / loading and progress bar class
```typescript
class SYS_LoadingAndProgressBar
```
- **destroyloading**: `function destroyLoading(): void;`
- **destroyprogressbar**: `function destroyProgressBar(): void;`
- **showloading**: `function showLoading(): void;`
- **showprogressbar**: `function showProgressBar(progress?: number, title?: string): void;`
---
## SYS_Log
System / log class
```typescript
class SYS_Log
```
- **add**: `function add(message: string, type?: ESYS_LogType): void;`
- **clear**: `function clear(): void;`
- **export**: `function export(types?: ESYS_LogType | Array<ESYS_LogType>): void;`
- **find**: `function find( message: | string | Array< | string | { text: string; attr?: { id?: string; path?: string; sheet?: string; pcbid?: string; type?: string; }; } >, types?: ESYS_LogType | Array<ESYS_LogType>, ): Promise<Array<ISYS_LogLine>>;`
- **sort**: `function sort(types?: ESYS_LogType | Array<ESYS_LogType>): Promise<Array<ISYS_LogLine>>;`
---
## SYS_Math
System / math class
```typescript
class SYS_Math
```
- **bboxintersects**: `function bboxIntersects(bbox1: ISYS_MathBBox, bbox2: ISYS_MathBBox): boolean;`
- **calculatearea**: `function calculateArea(polygon: TSYS_MathPolygonInput): number;`
- **calculateperimeter**: `function calculatePerimeter(polygon: TSYS_MathPolygonInput): number;`
- **contains**: `function contains(polygon1: TSYS_MathPolygonInput, polygon2: TSYS_MathPolygonInput): boolean;`
- **containspoint**: `function containsPoint(polygon: TSYS_MathPolygonInput, point: ISYS_MathPoint): boolean;`
- **distancetopoint**: `function distanceToPoint(polygon: TSYS_MathPolygonInput, point: ISYS_MathPoint): number;`
- **getbbox**: `function getBBox(polygon: TSYS_MathPolygonInput): ISYS_MathBBox;`
- **getcentroid**: `function getCentroid(polygon: TSYS_MathPolygonInput): ISYS_MathPoint;`
- **intersection**: `function intersection( polygon1: TSYS_MathPolygonInput, polygon2: TSYS_MathPolygonInput, ): TSYS_MathPolygonGroup;`
- **intersects**: `function intersects(polygon1: TSYS_MathPolygonInput, polygon2: TSYS_MathPolygonInput): boolean;`
- **rotate**: `function rotate( polygon: TSYS_MathPolygonInput, angle: number, centerX?: number, centerY?: number, ): Array<ISYS_MathPoint>;`
- **scale**: `function scale( polygon: TSYS_MathPolygonInput, scaleX: number, scaleY?: number, centerX?: number, centerY?: number, ): Array<ISYS_MathPoint>;`
- **subtract**: `function subtract( polygon1: TSYS_MathPolygonInput, polygon2: TSYS_MathPolygonInput, ): TSYS_MathPolygonGroup;`
- **translate**: `function translate(polygon: TSYS_MathPolygonInput, dx: number, dy: number): Array<ISYS_MathPoint>;`
- **union**: `function union( polygon1: TSYS_MathPolygonInput, polygon2: TSYS_MathPolygonInput, ): TSYS_MathPolygonGroup;`
- **xor**: `function xor( polygon1: TSYS_MathPolygonInput, polygon2: TSYS_MathPolygonInput, ): TSYS_MathPolygonGroup;`
---
## SYS_Message
System / message notification class
```typescript
class SYS_Message
```
- **removefollowmousetip**: `function removeFollowMouseTip(tip?: string): Promise<void>;`
- **showfollowmousetip**: `function showFollowMouseTip(tip: string, msTimeout?: number): Promise<void>;`
- **showtoastmessage**: `function showToastMessage( message: string, messageType?: ESYS_ToastMessageType, timer?: number, bottomPanel?: ESYS_BottomPanelTab, buttonTitle?: string, buttonCallbackFn?: string, ): void;`
---
## SYS_MessageBox
System / message box class
```typescript
class SYS_MessageBox
```
- **showconfirmationmessage**: `function showConfirmationMessage( content: string, title?: string, mainButtonTitle?: string, buttonTitle?: string, callbackFn?: (mainButtonClicked: boolean) => void, ): void;`
- **showinformationmessage**: `function showInformationMessage(content: string, title?: string, buttonTitle?: string): void;`
---
## SYS_MessageBus
System / message bus class
```typescript
class SYS_MessageBus
```
- **createprivatemessagebus**: `function createPrivateMessageBus(): void;`
- **publish**: `function publish(topic: string, message: any): void;`
- **publishpublic**: `function publishPublic(topic: string, message: any): void;`
- **pull**: `function pull(topic: string, callbackFn: (message: any) => void): ISYS_MessageBusTask;`
- **pullasync**: `function pullAsync(topic: string): Promise<any>;`
- **pullasyncpublic**: `function pullAsyncPublic(topic: string): Promise<any>;`
- **pullpublic**: `function pullPublic(topic: string, callbackFn: (message: any) => void): ISYS_MessageBusTask;`
- **push**: `function push(topic: string, message: any): void;`
- **pushpublic**: `function pushPublic(topic: string, message: any): void;`
- **removeprivatemessagebus**: `function removePrivateMessageBus(): void;`
- **rpccall**: `function rpcCall(topic: string, message?: any, timeout?: number): Promise<any>;`
- **rpccallpublic**: `function rpcCallPublic(topic: string, message?: any, timeout?: number): Promise<any>;`
- **rpcservice**: `function rpcService(topic: string, callbackFn: (...args: Array<any>) => any | Promise<any>): void;`
- **rpcservicepublic**: `function rpcServicePublic( topic: string, callbackFn: (...args: Array<any>) => any | Promise<any>, ): void;`
- **subscribe**: `function subscribe(topic: string, callbackFn: (message: any) => void): ISYS_MessageBusTask;`
- **subscribeonce**: `function subscribeOnce(topic: string, callbackFn: (message: any) => void): ISYS_MessageBusTask;`
- **subscribeoncepublic**: `function subscribeOncePublic( topic: string, callbackFn: (message: any) => void, ): ISYS_MessageBusTask;`
- **subscribepublic**: `function subscribePublic(topic: string, callbackFn: (message: any) => void): ISYS_MessageBusTask;`
---
## SYS_PanelControl
System / panel control class
```typescript
class SYS_PanelControl
```
- **closebottompanel**: `function closeBottomPanel(): void;`
- **closeleftpanel**: `function closeLeftPanel(): void;`
- **closerightpanel**: `function closeRightPanel(): void;`
- **isbottompanellocked**: `function isBottomPanelLocked(): Promise<boolean>;`
- **isleftpanellocked**: `function isLeftPanelLocked(): Promise<boolean>;`
- **isrightpanellocked**: `function isRightPanelLocked(): Promise<boolean>;`
- **openbottompanel**: `function openBottomPanel(tab?: ESYS_BottomPanelTab): void;`
- **openleftpanel**: `function openLeftPanel(tab?: ESYS_LeftPanelTab): void;`
- **openrightpanel**: `function openRightPanel(tab?: ESYS_RightPanelTab): void;`
- **togglebottompanellockstate**: `function toggleBottomPanelLockState(state?: boolean): void;`
- **toggleleftpanellockstate**: `function toggleLeftPanelLockState(state?: boolean): void;`
- **togglerightpanellockstate**: `function toggleRightPanelLockState(state?: boolean): void;`
---
## SYS_RightClickMenu
System / right-click menu class
```typescript
class SYS_RightClickMenu
```
- **changemenu**: `function changeMenu( menuId: string, menuItems: Array<ISYS_RightClickMenuItem | null>, ): Promise<void>;`
---
## SYS_Setting
System / settings class
```typescript
class SYS_Setting
```
- **getjlccolorsilkenabled**: `function getJLCColorSilkEnabled(): Promise<boolean>;`
- **restoredefault**: `function restoreDefault(): Promise<boolean>;`
---
## SYS_ShortcutKey
System / shortcut key class
```typescript
class SYS_ShortcutKey
```
- **get**: `function get(id: string): ISYS_ShortcutKeyDataWithUserDefinedShortcutKey | undefined;`
- **getall**: `function getAll(): Record<string, ISYS_ShortcutKeyDataWithUserDefinedShortcutKey>;`
- **getshortcutkeys**: `function getShortcutKeys( includeSystem?: boolean, ): Promise< Array<{ shortcutKey: TSYS_ShortcutKeys; title: string; documentType: Array<ESYS_ShortcutKeyEffectiveEditorRange>; scene: Array<ESYS_ShortcutKeyEffectiveEditorScene>; }> >;`
- **register**: `function register(id: string, props: ISYS_ShortcutKeyDataWithCallFn): boolean;`
- **registershortcutkey**: `function registerShortcutKey( shortcutKey: TSYS_ShortcutKeys, title: string, callbackFn: (shortcutKey: TSYS_ShortcutKeys) => void | Promise<void>, documentType?: Array<ESYS_ShortcutKeyEffectiveEditorRange>, scene?: Array<ESYS_ShortcutKeyEffectiveEditorScene>, ): Promise<boolean>;`
- **unregister**: `function unregister(id: string): boolean;`
- **unregistershortcutkey**: `function unregisterShortcutKey(shortcutKey: TSYS_ShortcutKeys): Promise<boolean>;`
---
## SYS_Storage
System / storage class
```typescript
class SYS_Storage
```
- **clearextensionalluserconfigs**: `function clearExtensionAllUserConfigs(): Promise<boolean>;`
- **deleteextensionuserconfig**: `function deleteExtensionUserConfig(key: string): Promise<boolean>;`
- **getextensionalluserconfigs**: `function getExtensionAllUserConfigs(): Record<string, any>;`
- **getextensionuserconfig**: `function getExtensionUserConfig(key: string): any | undefined;`
- **setextensionalluserconfigs**: `function setExtensionAllUserConfigs(configs: Record<string, any>): Promise<boolean>;`
- **setextensionuserconfig**: `function setExtensionUserConfig(key: string, value: any): Promise<boolean>;`
---
## SYS_Timer
System / timer class
```typescript
class SYS_Timer
```
- **clearintervaltimer**: `function clearIntervalTimer(id: string): boolean;`
- **cleartimeouttimer**: `function clearTimeoutTimer(id: string): boolean;`
- **setintervaltimer**: `function setIntervalTimer( id: string, timeout: number, callFn: (...args: any) => void, ...args: any ): boolean;`
- **settimeouttimer**: `function setTimeoutTimer( id: string, timeout: number, callFn: (...args: any) => void, ...args: any ): boolean;`
---
## SYS_ToastMessage
System / toast message class
```typescript
class SYS_ToastMessage
```
- **showmessage**: `function showMessage( message: string, messageType?: ESYS_ToastMessageType, timer?: number, bottomPanel?: ESYS_BottomPanelTab, buttonTitle?: string, buttonCallbackFn?: string, ): void;`
---
## SYS_Tool
System / tool class
```typescript
class SYS_Tool
```
- **netlistcomparison**: `function netlistComparison( netlist1: string | { projectUuid: string; documentUuid: string } | File, netlist2: string | { projectUuid: string; documentUuid: string } | File, ): Promise< Array<{ type: 'Net' | 'Component'; object: string; netlist1Name: Array<string>; netlist2Name: Array<string>; }> >;`
- **pcbcomparison**: `function pcbComparison( pcb1: string | { projectUuid: string; pcbUuid: string } | File, pcb2: string | { projectUuid: string; pcbUuid: string } | File, options?: { valUnit?: ESYS_Unit.MIL | ESYS_Unit.MILLIMETER | ESYS_Unit.INCH | ESYS_Unit.CENTIMETER; deviation?: number; comparisonSize?: number; }, ): Promise<ISYS_ComparisonResponse>;`
- **schematiccomparison**: `function schematicComparison( schematicUuid1: string, schematicUuid2: string, ): Promise<ISYS_ComparisonResponse>;`
---
## SYS_Unit
System / unit class
```typescript
class SYS_Unit
```
- **getfrontenddataunit**: `function getFrontendDataUnit(): Promise<ESYS_Unit | undefined>;`
- **inchtomil**: `function inchToMil(inch: number, numberOfDecimals?: number): number;`
- **inchtomm**: `function inchToMm(inch: number, numberOfDecimals?: number): number;`
- **miltoinch**: `function milToInch(mil: number, numberOfDecimals?: number): number;`
- **miltomm**: `function milToMm(mil: number, numberOfDecimals?: number): number;`
- **mmtoinch**: `function mmToInch(mm: number, numberOfDecimals?: number): number;`
- **mmtomil**: `function mmToMil(mm: number, numberOfDecimals?: number): number;`
---
## SYS_WebSocket
System / WebSocket class
```typescript
class SYS_WebSocket
```
- **close**: `function close(id: string, code?: number, reason?: string, extensionUuid?: string): void;`
- **register**: `function register( id: string, serviceUri: string, receiveMessageCallFn?: (event: MessageEvent<any>) => void | Promise<void>, connectedCallFn?: () => void | Promise<void>, protocols?: string | Array<string>, ): void;`
- **send**: `function send(id: string, data: string | Blob | BufferSource, extensionUuid?: string): void;`
---
## SYS_Window
System / window class
```typescript
class SYS_Window
```
- **addeventlistener**: `function addEventListener( type: ESYS_WindowEventType, listener: (ev: any) => any, options?: { capture?: boolean; once?: boolean; passive?: boolean; signal?: AbortSignal }, ): ISYS_WindowEventListenerRemovableObject | undefined;`
- **getcurrenttheme**: `function getCurrentTheme(): Promise<ESYS_Theme>;`
- **geturlanchor**: `function getUrlAnchor(): string;`
- **geturlparam**: `function getUrlParam(key: string): string | null;`
- **getviewportsize**: `function getViewportSize(): { width: number; height: number };`
- **hidestartpagequickstartitems**: `function hideStartPageQuickStartItems(items: Array<ESYS_StartPageQuickStartItem>): Promise<boolean>;`
- **hidestartpagesupportfloatbaritems**: `function hideStartPageSupportFloatBarItems(): Promise<boolean>;`
- **open**: `function open(url: string, target?: ESYS_WindowOpenTarget): void;`
- **openui**: `function openUI(uiName: string, args?: Record<string, any>): Promise<void>;`
- **removeeventlistener**: `function removeEventListener(removableObject: ISYS_WindowEventListenerRemovableObject): void;`
- **urlpushstate**: `function urlPushState(url: string): void;`
- **urlreplacestate**: `function urlReplaceState(url: string): void;`
---
references/classes/DMT_Event.md
# DMT\_Event class
Document tree / event class
## Signature
```typescript
class DMT_Event
```
## Remarks
Register an event callback
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[addEditorTabEventListener(id, eventType, callFn, onlyOnce)](./DMT_Event.md)
</td><td>
</td><td>
**_(BETA)_** Add an editor tab event listener
</td></tr>
<tr><td>
[isEventListenerAlreadyExist(id)](./DMT_Event.md)
</td><td>
</td><td>
Query whether the event listener exists
</td></tr>
<tr><td>
[removeEventListener(id)](./DMT_Event.md)
</td><td>
</td><td>
Remove Event listener
</td></tr>
</tbody></table>
---
## 方法详情
### addeditortabeventlistener
# DMT\_Event.addEditorTabEventListener() method
> 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.
Add an editor tab event listener
## Signature
```typescript
function addEditorTabEventListener(
id: string,
eventType: 'all' | EDMT_EditorTabEventType,
callFn: (
eventType: EDMT_EditorTabEventType,
props: { documentType: EDMT_EditorDocumentType; title: string; tabId: string },
) => void | Promise<void>,
onlyOnce?: boolean,
): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
Event ID, used to prevent duplicate event registration
</td></tr>
<tr><td>
eventType
</td><td>
'all' \| [EDMT\_EditorTabEventType](../enums/EDMT_EditorTabEventType.md)
</td><td>
Event type
</td></tr>
<tr><td>
callFn
</td><td>
(eventType: [EDMT\_EditorTabEventType](../enums/EDMT_EditorTabEventType.md)<!-- -->, props: { documentType: [EDMT\_EditorDocumentType](../enums/EDMT_EditorDocumentType.md)<!-- -->; title: string; tabId: string }) => void \| Promise<void>
</td><td>
The callback function triggered when the event fires
</td></tr>
<tr><td>
onlyOnce
</td><td>
boolean
</td><td>
_(Optional)_ Whether to listen only once
</td></tr>
</tbody></table>
## Returns
void
## Remarks
Note: This API is only valid for extensions. Calling it in a standalone script environment will always `throw Error`
When the [tab event type](../enums/EDMT_EditorTabEventType.md) is [close](../enums/EDMT_EditorTabEventType.md) or [open](../enums/EDMT_EditorTabEventType.md)<!-- -->, the [switch](../enums/EDMT_EditorTabEventType.md) event will also be triggered
## Example
```javascript
const listenerId = '嘉立创示例_tab_add';
// 1. 打开一个原理图页,保证编辑器里存在可切换的标签页
const pages = await eda.dmt_Schematic.getAllSchematicPagesInfo();
await eda.dmt_EditorControl.openDocument(pages[0].uuid);
// 2. 注册 toggle 事件监听(回调里拿到事件类型与标签页属性)
let fired = null;
eda.dmt_Event.addEditorTabEventListener(
listenerId,
'toggle',
(eventType, props) => {
fired = { eventType, title: props?.title, tabId: props?.tabId };
}
);
// 3. 回读确认注册成功(同 id 再注册也会被防重机制忽略)
const registered = eda.dmt_Event.isEventListenerAlreadyExist(listenerId);
console.log('registered:', registered);
// 4. 切换一次标签页触发 toggle 事件,观察回调被调用
if (pages[1]) {
await eda.dmt_EditorControl.openDocument(pages[1].uuid);
await eda.dmt_EditorControl.openDocument(pages[0].uuid);
}
else {
await eda.dmt_EditorControl.openDocument(pages[0].uuid);
}
await new Promise(r => setTimeout(r, 500));
console.log('fired:', fired ? JSON.stringify(fired) : 'null');
// 5. 清理监听,避免会话内残留
const removed = eda.dmt_Event.removeEventListener(listenerId);
console.log('removed:', removed);
```
### iseventlisteneralreadyexist
# DMT\_Event.isEventListenerAlreadyExist() method
Query whether the event listener exists
## Signature
```typescript
function isEventListenerAlreadyExist(id: string): boolean;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
Event ID
</td></tr>
</tbody></table>
## Returns
boolean
Whether the event listener exists
## Example
```javascript
const listenerId = '嘉立创示例_tab_exist';
// 1. 注册前查询:应为 false
const before = eda.dmt_Event.isEventListenerAlreadyExist(listenerId);
console.log('before:', before);
// 2. 注册一个监听使 id 生效
eda.dmt_Event.addEditorTabEventListener(
listenerId,
'toggle',
() => {}
);
// 3. 注册后查询:应为 true
const after = eda.dmt_Event.isEventListenerAlreadyExist(listenerId);
console.log('after:', after);
// 4. 移除后查询:应回到 false
eda.dmt_Event.removeEventListener(listenerId);
const afterRemove = eda.dmt_Event.isEventListenerAlreadyExist(listenerId);
console.log('afterRemove:', afterRemove);
```
### removeeventlistener
# DMT\_Event.removeEventListener() method
Remove Event listener
## Signature
```typescript
function removeEventListener(id: string): boolean;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
Event ID
</td></tr>
</tbody></table>
## Returns
boolean
Whether Remove Specify event listener
## Example
```javascript
const listenerId = '嘉立创示例_tab_remove';
// 1. 先注册一个监听作为移除目标
eda.dmt_Event.addEditorTabEventListener(
listenerId,
'toggle',
() => {}
);
const registered = eda.dmt_Event.isEventListenerAlreadyExist(listenerId);
console.log('registered:', registered);
// 2. 移除该监听
const removed = eda.dmt_Event.removeEventListener(listenerId);
console.log('removed:', removed);
// 3. 回读确认已不存在
const existAfter = eda.dmt_Event.isEventListenerAlreadyExist(listenerId);
console.log('existAfter:', existAfter);
// 4. 重复移除同一 id:返回 false(本就未注册)
const removedAgain = eda.dmt_Event.removeEventListener(listenerId);
console.log('removedAgain:', removedAgain);
```
references/classes/DMT_EditorControl.md
# DMT\_EditorControl class
Document tree / Editor control class
## Signature
```typescript
class DMT_EditorControl
```
## Remarks
Here the editor control is based on the sheets under the currently open engineering design. Any other `documentUuid` will be considered a non-existent document page
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[activateDocument(tabId)](./DMT_EditorControl.md)
</td><td>
</td><td>
Activate a document
</td></tr>
<tr><td>
[activateSplitScreen(splitScreenId)](./DMT_EditorControl.md)
</td><td>
</td><td>
Activate a split screen
</td></tr>
<tr><td>
[closeDocument(tabId)](./DMT_EditorControl.md)
</td><td>
</td><td>
Close document
</td></tr>
<tr><td>
[createSplitScreen(splitScreenType, tabId)](./DMT_EditorControl.md)
</td><td>
</td><td>
Create Split screen
</td></tr>
<tr><td>
[generateIndicatorMarkers(markers, color, lineWidth, zoom, tabId)](./DMT_EditorControl.md)
</td><td>
</td><td>
**_(BETA)_** Generate indicator markers
</td></tr>
<tr><td>
[getCurrentRenderedAreaImage(tabId)](./DMT_EditorControl.md)
</td><td>
</td><td>
**_(BETA)_** Get the canvas rendering region image
</td></tr>
<tr><td>
[getSplitScreenIdByTabId(tabId)](./DMT_EditorControl.md)
</td><td>
</td><td>
Use tab ID get split screen ID
</td></tr>
<tr><td>
[getSplitScreenTree()](./DMT_EditorControl.md)
</td><td>
</td><td>
Get the editor split screen property tree
</td></tr>
<tr><td>
[getTabsBySplitScreenId(splitScreenId)](./DMT_EditorControl.md)
</td><td>
</td><td>
Get all tabs under the specified split screen ID
</td></tr>
<tr><td>
[mergeAllDocumentFromSplitScreen()](./DMT_EditorControl.md)
</td><td>
</td><td>
Merge all split screens
</td></tr>
<tr><td>
[moveDocumentToSplitScreen(tabId, splitScreenId)](./DMT_EditorControl.md)
</td><td>
</td><td>
Move a document to the specified split screen
</td></tr>
<tr><td>
[openDocument(documentUuid, splitScreenId)](./DMT_EditorControl.md)
</td><td>
</td><td>
Open document
</td></tr>
<tr><td>
[openLibraryDocument(libraryUuid, libraryType, uuid, splitScreenId)](./DMT_EditorControl.md)
</td><td>
</td><td>
**_(BETA)_** Open library symbol, footprint document
</td></tr>
<tr><td>
[removeIndicatorMarkers(tabId)](./DMT_EditorControl.md)
</td><td>
</td><td>
**_(BETA)_** Remove indicator markers
</td></tr>
<tr><td>
[tileAllDocumentToSplitScreen()](./DMT_EditorControl.md)
</td><td>
</td><td>
Tile all documents
</td></tr>
<tr><td>
[zoomTo(x, y, scaleRatio, tabId)](./DMT_EditorControl.md)
</td><td>
</td><td>
**_(BETA)_** Zoom to coordinates
</td></tr>
<tr><td>
[zoomToAllPrimitives(tabId)](./DMT_EditorControl.md)
</td><td>
</td><td>
**_(BETA)_** Zoom to all primitives (fit all)
</td></tr>
<tr><td>
[zoomToRegion(left, right, top, bottom, tabId)](./DMT_EditorControl.md)
</td><td>
</td><td>
**_(BETA)_** Zoom to region
</td></tr>
<tr><td>
[zoomToSelectedPrimitives(tabId)](./DMT_EditorControl.md)
</td><td>
</td><td>
**_(BETA)_** Zoom to the selected primitives (fit selection)
</td></tr>
</tbody></table>
---
## 方法详情
### activatedocument
# DMT\_EditorControl.activateDocument() method
Activate a document
## Signature
```typescript
function activateDocument(tabId: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
tabId
</td><td>
string
</td><td>
Tab ID
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
Switch to the tab of the specified document and place the input focus in it
## Example
```javascript
// 1. 先后打开原理图页与 PCB,此时焦点在最后打开的 PCB 上
const pages = await eda.dmt_Schematic.getAllSchematicPagesInfo();
const pcbs = await eda.dmt_Pcb.getAllPcbsInfo();
const tabSch = await eda.dmt_EditorControl.openDocument(pages[0].uuid);
await eda.dmt_EditorControl.openDocument(pcbs[0].uuid);
// 2. 激活原理图标签页(真实切换回原理图画布)
const activated = await eda.dmt_EditorControl.activateDocument(tabSch);
console.log('activated:', activated);
```
### activatesplitscreen
# DMT\_EditorControl.activateSplitScreen() method
Activate a split screen
## Signature
```typescript
function activateSplitScreen(splitScreenId: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
splitScreenId
</td><td>
string
</td><td>
Split screen ID
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
Give input focus
## Example
```javascript
// 1. 归一化布局后打开两个文档,并拆出一个新分屏
await eda.dmt_EditorControl.mergeAllDocumentFromSplitScreen();
const pages = await eda.dmt_Schematic.getAllSchematicPagesInfo();
const pcbs = await eda.dmt_Pcb.getAllPcbsInfo();
await eda.dmt_EditorControl.openDocument(pages[0].uuid);
const tabPcb = await eda.dmt_EditorControl.openDocument(pcbs[0].uuid);
const split = await eda.dmt_EditorControl.createSplitScreen('vertical', tabPcb);
// 2. 激活新分屏(输入焦点移到该分屏)
const activated = await eda.dmt_EditorControl.activateSplitScreen(split.newSplitScreenId);
console.log('activated:', activated);
// 3. 合并所有分屏,恢复单屏布局
const merged = await eda.dmt_EditorControl.mergeAllDocumentFromSplitScreen();
console.log('merged:', merged);
```
### closedocument
# DMT\_EditorControl.closeDocument() method
Close document
## Signature
```typescript
function closeDocument(tabId: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
tabId
</td><td>
string
</td><td>
Tab ID. Here [IDMT\_SchematicPageItem.uuid](../interfaces/IDMT_SchematicPageItem.md)<!-- -->, [IDMT\_PcbItem.uuid](../interfaces/IDMT_PcbItem.md)<!-- -->, and [IDMT\_PanelItem.uuid](../interfaces/IDMT_PanelItem.md) are supported as input
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
If the document has not been saved, executing this operation will directly lose all unsaved data. After completing modification operations, first execute [SCH\_Document.save()](./SCH_Document.md)<!-- -->, [PCB\_Document.save()](./PCB_Document.md)<!-- -->, and [PNL\_Document.save()](./PNL_Document.md) to save the data
## Example
```javascript
// 1. 创建临时原理图并给它加一页(新建的原理图没有页面,需显式创建)
const schematicUuid = await eda.dmt_Schematic.createSchematic('嘉立创示例_关闭文档');
const pageUuid = await eda.dmt_Schematic.createSchematicPage(schematicUuid);
// 2. 打开该页面作为关闭目标
const tabId = await eda.dmt_EditorControl.openDocument(pageUuid);
console.log('opened tab:', tabId);
// 3. 关闭该标签页(空白文档,无未保存内容)
const closed = await eda.dmt_EditorControl.closeDocument(tabId);
console.log('closed:', closed);
// 4. 删除临时原理图,保持工程整洁
const deleted = await eda.dmt_Schematic.deleteSchematic(schematicUuid);
console.log('deleted:', deleted);
```
### createsplitscreen
# DMT\_EditorControl.createSplitScreen() method
Create Split screen
## Signature
```typescript
function createSplitScreen(
splitScreenType: EDMT_EditorSplitScreenDirection,
tabId: string,
): Promise<{ sourceSplitScreenId: string; newSplitScreenId: string } | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
splitScreenType
</td><td>
[EDMT\_EditorSplitScreenDirection](../enums/EDMT_EditorSplitScreenDirection.md)
</td><td>
Split screen type, `horizontal` horizontal, `vertical` vertical
</td></tr>
<tr><td>
tabId
</td><td>
string
</td><td>
Tab ID. This tab will be moved into the new split screen
</td></tr>
</tbody></table>
## Returns
Promise<{ sourceSplitScreenId: string; newSplitScreenId: string } \| undefined>
Split screen ID. `sourceSplitScreenId` represents the source split screen, and `newSplitScreenId` represents the new split screen
## Remarks
Please make sure the split screen corresponding to [tabId](./DMT_EditorControl.md) has more than two tabs; otherwise the split screen will not be executed and `undefined` will be returned
## Example
```javascript
// 1. 归一化布局:先合并既有分屏,保证两个标签页落在同一分屏
await eda.dmt_EditorControl.mergeAllDocumentFromSplitScreen();
// 2. 打开两个文档,让当前分屏持有两个标签页
const pages = await eda.dmt_Schematic.getAllSchematicPagesInfo();
const pcbs = await eda.dmt_Pcb.getAllPcbsInfo();
await eda.dmt_EditorControl.openDocument(pages[0].uuid);
const tabPcb = await eda.dmt_EditorControl.openDocument(pcbs[0].uuid);
// 3. 把 PCB 标签页拆到一个新的水平分屏
const split = await eda.dmt_EditorControl.createSplitScreen('horizontal', tabPcb);
console.log('source split:', split?.sourceSplitScreenId);
console.log('new split:', split?.newSplitScreenId);
// 4. 回读新分屏的标签页,确认 PCB 已在其中
const tabs = await eda.dmt_EditorControl.getTabsBySplitScreenId(split.newSplitScreenId);
console.log('tabs in new split:', tabs.map(t => t.title));
// 5. 合并所有分屏,恢复单屏布局
const merged = await eda.dmt_EditorControl.mergeAllDocumentFromSplitScreen();
console.log('merged:', merged);
```
### generateindicatormarkers
# DMT\_EditorControl.generateIndicatorMarkers() method
> 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.
Generate indicator markers
## Signature
```typescript
function generateIndicatorMarkers(
markers: Array<IDMT_IndicatorMarkerShape>,
color?: { r: number; g: number; b: number; alpha: number },
lineWidth?: number,
zoom?: boolean,
tabId?: string,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
markers
</td><td>
Array<[IDMT\_IndicatorMarkerShape](../interfaces/IDMT_IndicatorMarkerShape.md)<!-- -->>
</td><td>
Array of indicator marker shape objects
</td></tr>
<tr><td>
color
</td><td>
\{ r: number; g: number; b: number; alpha: number \}
</td><td>
_(Optional)_ Indicator marker color
</td></tr>
<tr><td>
lineWidth
</td><td>
number
</td><td>
_(Optional)_ Line width
</td></tr>
<tr><td>
zoom
</td><td>
boolean
</td><td>
_(Optional)_ Whether to locate and zoom
</td></tr>
<tr><td>
tabId
</td><td>
string
</td><td>
_(Optional)_ Tab ID. If not passed in, the canvas with the last input focus will be used
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the indicator markers were generated successfully, `false` indicates that the canvas does not support this operation or `tabId` does not exist
## Remarks
In the indicator marker shape data, the coordinate unit span of the schematic and symbol canvases is 0.01inch, and that of the PCB and footprint canvases is mil
## Example
```javascript
// 1. 打开一个原理图页,确定标记作用的画布
const pages = await eda.dmt_Schematic.getAllSchematicPagesInfo();
const tabId = await eda.dmt_EditorControl.openDocument(pages[0].uuid);
// 2. 生成一组标记:点 + 圆 + 矩形(原理图画布坐标单位 0.01inch)
const generated = await eda.dmt_EditorControl.generateIndicatorMarkers(
[
{ type: 'point', x: 100, y: 100 },
{ type: 'circle', x: 250, y: 150, r: 50 },
{ type: 'rectangle', left: 350, right: 550, top: 100, bottom: 250 },
],
{ r: 255, g: 60, b: 60, alpha: 1 }, // 标记颜色
2, // 线宽
false, // 不自动缩放定位到标记
tabId,
);
console.log('generated:', generated);
// 3. 用完即清,保持画布干净
const removed = await eda.dmt_EditorControl.removeIndicatorMarkers(tabId);
console.log('removed:', removed);
```
### getcurrentrenderedareaimage
# DMT\_EditorControl.getCurrentRenderedAreaImage() method
> 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.
Get the canvas rendering region image
## Signature
```typescript
function getCurrentRenderedAreaImage(tabId?: string): Promise<Blob | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
tabId
</td><td>
string
</td><td>
_(Optional)_ Tab ID. If not passed in, the canvas with the last input focus will be obtained
</td></tr>
</tbody></table>
## Returns
Promise<Blob \| undefined>
- Blob-format image data of the canvas rendering region
## Example
```javascript
// 1. 打开一个原理图页,确定截图的画布
const pages = await eda.dmt_Schematic.getAllSchematicPagesInfo();
const tabId = await eda.dmt_EditorControl.openDocument(pages[0].uuid);
// 2. 获取该画布当前渲染区域的图像
const image = await eda.dmt_EditorControl.getCurrentRenderedAreaImage(tabId);
// 3. 读取 Blob 的基本信息(字节数与 MIME 类型)
console.log('isBlob:', image instanceof Blob);
console.log('size:', image.size);
console.log('mimeType:', image.type);
```
### getsplitscreenidbytabid
# DMT\_EditorControl.getSplitScreenIdByTabId() method
Use tab ID get split screen ID
## Signature
```typescript
function getSplitScreenIdByTabId(tabId: string): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
tabId
</td><td>
string
</td><td>
Tab ID
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
Split screen ID
## Example
```javascript
// 1. 打开一个原理图页,拿到它的标签页 ID
const pages = await eda.dmt_Schematic.getAllSchematicPagesInfo();
const tabId = await eda.dmt_EditorControl.openDocument(pages[0].uuid);
// 2. 查询该标签页所在的分屏
const splitScreenId = await eda.dmt_EditorControl.getSplitScreenIdByTabId(tabId);
console.log('tabId:', tabId);
console.log('splitScreenId:', splitScreenId);
```
### getsplitscreentree
# DMT\_EditorControl.getSplitScreenTree() method
Get the editor split screen property tree
## Signature
```typescript
function getSplitScreenTree(): Promise<IDMT_EditorSplitScreenItem | undefined>;
```
## Returns
Promise<[IDMT\_EditorSplitScreenItem](../interfaces/IDMT_EditorSplitScreenItem.md) \| undefined>
The editor split screen property tree. If it is `undefined`<!-- -->, the data retrieval failed
## Example
```javascript
// 1. 打开一个原理图页,保证分屏树里有标签页可读
const pages = await eda.dmt_Schematic.getAllSchematicPagesInfo();
await eda.dmt_EditorControl.openDocument(pages[0].uuid);
// 2. 读取分屏树
const tree = await eda.dmt_EditorControl.getSplitScreenTree();
// 3. 递归遍历,收集所有分屏 ID 与标签页标题
const splitIds = [];
const tabTitles = [];
(function walk(node) {
splitIds.push(node.id);
if (node.tabs)
tabTitles.push(...node.tabs.map(t => t.title));
(node.children || []).forEach(walk);
})(tree);
console.log('split count:', splitIds.length);
console.log('tab titles:', tabTitles);
```
### gettabsbysplitscreenid
# DMT\_EditorControl.getTabsBySplitScreenId() method
Get all tabs under the specified split screen ID
## Signature
```typescript
function getTabsBySplitScreenId(splitScreenId: string): Promise<Array<IDMT_EditorTabItem>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
splitScreenId
</td><td>
string
</td><td>
Split screen ID
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IDMT\_EditorTabItem](../interfaces/IDMT_EditorTabItem.md)<!-- -->>>
Tab list
## Remarks
If there are no direct tabs under the specified split screen (that is, it still has [children](../interfaces/IDMT_EditorSplitScreenItem.md) under it), an empty array will be returned
## Example
```javascript
// 1. 打开一个原理图页并读取分屏树,定位一个直接持有标签页的分屏
const pages = await eda.dmt_Schematic.getAllSchematicPagesInfo();
await eda.dmt_EditorControl.openDocument(pages[0].uuid);
const tree = await eda.dmt_EditorControl.getSplitScreenTree();
let leaf = null;
(function find(node) {
if (node.tabs?.length) { leaf = node; return; }
(node.children || []).forEach(find);
})(tree);
// 2. 查询该分屏下的所有标签页
const tabs = await eda.dmt_EditorControl.getTabsBySplitScreenId(leaf.id);
console.log('splitScreenId:', leaf.id);
console.log('tab count:', tabs.length);
console.log('titles:', tabs.map(t => t.title));
```
### mergealldocumentfromsplitscreen
# DMT\_EditorControl.mergeAllDocumentFromSplitScreen() method
Merge all split screens
## Signature
```typescript
function mergeAllDocumentFromSplitScreen(): Promise<boolean>;
```
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
Only available when child split screens exist. It will cancel all child split screens and merge all document tabs into the initial split screen
## Example
```javascript
// 1. 制造"存在子分屏"的前提:归一化布局后打开两个文档并拆出一个分屏
await eda.dmt_EditorControl.mergeAllDocumentFromSplitScreen();
const pages = await eda.dmt_Schematic.getAllSchematicPagesInfo();
const pcbs = await eda.dmt_Pcb.getAllPcbsInfo();
await eda.dmt_EditorControl.openDocument(pages[0].uuid);
const tabPcb = await eda.dmt_EditorControl.openDocument(pcbs[0].uuid);
await eda.dmt_EditorControl.createSplitScreen('vertical', tabPcb);
// 2. 合并所有分屏,标签页全部回到初始分屏
const merged = await eda.dmt_EditorControl.mergeAllDocumentFromSplitScreen();
console.log('merged:', merged);
// 3. 回读分屏树,确认已无子分屏
const tree = await eda.dmt_EditorControl.getSplitScreenTree();
console.log('child splits left:', tree.children?.length ?? 0);
```
### movedocumenttosplitscreen
# DMT\_EditorControl.moveDocumentToSplitScreen() method
Move a document to the specified split screen
## Signature
```typescript
function moveDocumentToSplitScreen(tabId: string, splitScreenId: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
tabId
</td><td>
string
</td><td>
Tab ID
</td></tr>
<tr><td>
splitScreenId
</td><td>
string
</td><td>
[Split screen ID](../interfaces/IDMT_EditorSplitScreenItem.md)
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
After moving the document, the editor split screen property tree may change
## Example
```javascript
// 1. 归一化布局后打开两个文档,把 PCB 拆到新分屏
await eda.dmt_EditorControl.mergeAllDocumentFromSplitScreen();
const pages = await eda.dmt_Schematic.getAllSchematicPagesInfo();
const pcbs = await eda.dmt_Pcb.getAllPcbsInfo();
await eda.dmt_EditorControl.openDocument(pages[0].uuid);
const tabPcb = await eda.dmt_EditorControl.openDocument(pcbs[0].uuid);
const split = await eda.dmt_EditorControl.createSplitScreen('vertical', tabPcb);
// 2. 把 PCB 标签页移回源分屏
const moved = await eda.dmt_EditorControl.moveDocumentToSplitScreen(tabPcb, split.sourceSplitScreenId);
console.log('moved:', moved);
// 3. 回读源分屏标签页,确认两个标签页又同处一个分屏
const tabs = await eda.dmt_EditorControl.getTabsBySplitScreenId(split.sourceSplitScreenId);
console.log('source split tabs:', tabs.map(t => t.title));
// 4. 清理:合并残余分屏,恢复单屏布局
const mergedBack = await eda.dmt_EditorControl.mergeAllDocumentFromSplitScreen();
console.log('mergedBack:', mergedBack);
```
### opendocument
# DMT\_EditorControl.openDocument() method
Open document
## Signature
```typescript
function openDocument(documentUuid: string, splitScreenId?: string): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
documentUuid
</td><td>
string
</td><td>
Document UUID. Here [IDMT\_SchematicItem.uuid](../interfaces/IDMT_SchematicItem.md)<!-- -->, [IDMT\_SchematicPageItem.uuid](../interfaces/IDMT_SchematicPageItem.md)<!-- -->, [IDMT\_PcbItem.uuid](../interfaces/IDMT_PcbItem.md)<!-- -->, and [IDMT\_PanelItem.uuid](../interfaces/IDMT_PanelItem.md) are supported as input
</td></tr>
<tr><td>
splitScreenId
</td><td>
string
</td><td>
_(Optional)_ Split screen ID, which is the [IDMT\_EditorSplitScreenItem.id](../interfaces/IDMT_EditorSplitScreenItem.md) obtained by the [DMT\_EditorControl.getSplitScreenTree()](./DMT_EditorControl.md) method
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
Tab ID, if it is `undefined`<!-- -->, then open document failed
## Example
```javascript
// 1. 取工程里第一个原理图页作为打开目标
const pages = await eda.dmt_Schematic.getAllSchematicPagesInfo();
console.log('target:', pages[0].name);
// 2. 打开该页面,返回标签页 ID
const tabId = await eda.dmt_EditorControl.openDocument(pages[0].uuid);
console.log('tabId:', tabId);
```
### openlibrarydocument
# DMT\_EditorControl.openLibraryDocument() method
> 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.
Open library symbol, footprint document
## Signature
```typescript
function openLibraryDocument(
libraryUuid: string,
libraryType: ELIB_LibraryType.SYMBOL | ELIB_LibraryType.FOOTPRINT,
uuid: string,
splitScreenId?: string,
): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
libraryType
</td><td>
[ELIB\_LibraryType.SYMBOL](../enums/ELIB_LibraryType.md) \| [ELIB\_LibraryType.FOOTPRINT](../enums/ELIB_LibraryType.md)
</td><td>
Library type, support symbol and footprint
</td></tr>
<tr><td>
uuid
</td><td>
string
</td><td>
Symbol, footprint UUID
</td></tr>
<tr><td>
splitScreenId
</td><td>
string
</td><td>
_(Optional)_ Split screen ID, which is the [IDMT\_EditorSplitScreenItem.id](../interfaces/IDMT_EditorSplitScreenItem.md) obtained by the [DMT\_EditorControl.getSplitScreenTree()](./DMT_EditorControl.md) method
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
Tab ID, if it is `undefined`<!-- -->, then open document failed
## Example
```javascript
// 1. 搜索库符号,拿到其所在库 UUID 与符号 UUID
const results = await eda.lib_Symbol.search('0603');
console.log('symbol:', results[0].name);
// 2. 打开该符号的编辑画布,返回标签页 ID('2' = ELIB_LibraryType.SYMBOL)
const tabId = await eda.dmt_EditorControl.openLibraryDocument(results[0].libraryUuid, '2', results[0].uuid);
console.log('tabId:', tabId);
// 3. 看完关闭标签页
const closed = await eda.dmt_EditorControl.closeDocument(tabId);
console.log('closed:', closed);
```
### removeindicatormarkers
# DMT\_EditorControl.removeIndicatorMarkers() method
> 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.
Remove indicator markers
## Signature
```typescript
function removeIndicatorMarkers(tabId?: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
tabId
</td><td>
string
</td><td>
_(Optional)_ Tab ID. If not passed in, the canvas with the last input focus will be used
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the indicator markers were removed successfully, `false` indicates that the canvas does not support this operation or `tabId` does not exist
## Remarks
This API will remove all generated indicator markers
## Example
```javascript
// 1. 打开一个原理图页,并先生成一个指示标记作为清理对象
const pages = await eda.dmt_Schematic.getAllSchematicPagesInfo();
const tabId = await eda.dmt_EditorControl.openDocument(pages[0].uuid);
const generated = await eda.dmt_EditorControl.generateIndicatorMarkers(
[{ type: 'circle', x: 150, y: 150, r: 60 }],
{ r: 0, g: 128, b: 255, alpha: 1 },
2,
false,
tabId,
);
console.log('generated:', generated);
// 2. 移除该画布上全部指示标记
const removed = await eda.dmt_EditorControl.removeIndicatorMarkers(tabId);
console.log('removed:', removed);
```
### tilealldocumenttosplitscreen
# DMT\_EditorControl.tileAllDocumentToSplitScreen() method
Tile all documents
## Signature
```typescript
function tileAllDocumentToSplitScreen(): Promise<boolean>;
```
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
Only available when no child split screens exist. It will automatically create split screens for all opened document tabs
## Example
```javascript
// 1. 归一化布局:先合并既有子分屏,满足"无子分屏"前提
await eda.dmt_EditorControl.mergeAllDocumentFromSplitScreen();
// 2. 打开两个文档,给平铺提供素材
const pages = await eda.dmt_Schematic.getAllSchematicPagesInfo();
const pcbs = await eda.dmt_Pcb.getAllPcbsInfo();
await eda.dmt_EditorControl.openDocument(pages[0].uuid);
await eda.dmt_EditorControl.openDocument(pcbs[0].uuid);
// 3. 平铺:每个标签页各占一个分屏
const tiled = await eda.dmt_EditorControl.tileAllDocumentToSplitScreen();
console.log('tiled:', tiled);
// 4. 合并所有分屏,恢复单屏布局
const merged = await eda.dmt_EditorControl.mergeAllDocumentFromSplitScreen();
console.log('merged:', merged);
```
### zoomto
# DMT\_EditorControl.zoomTo() method
> 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.
Zoom to coordinates
## Signature
```typescript
function zoomTo(
x?: number,
y?: number,
scaleRatio?: number,
tabId?: string,
): Promise<{ left: number; right: number; top: number; bottom: number } | false>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
x
</td><td>
number
</td><td>
_(Optional)_ Center X coordinate. If not passed in, the current X coordinate will not be changed
</td></tr>
<tr><td>
y
</td><td>
number
</td><td>
_(Optional)_ Center Y coordinate. If not passed in, the current Y coordinate will not be changed
</td></tr>
<tr><td>
scaleRatio
</td><td>
number
</td><td>
_(Optional)_ Zoom ratio. If not passed in, the current zoom ratio will not be changed. The unit span is `1/100`<!-- -->. If `200` is passed in, it means a zoom ratio of `200%`
</td></tr>
<tr><td>
tabId
</td><td>
string
</td><td>
_(Optional)_ Tab ID. If not passed in, the canvas with the last input focus will be used
</td></tr>
</tbody></table>
## Returns
Promise<{ left: number; right: number; top: number; bottom: number } \| false>
Region data after zooming. `false` indicates that the canvas does not support the zoom operation or the `tabId` does not exist
## Remarks
In the schematic and symbol canvases, the coordinate unit span is 0.01inch; in the PCB and footprint canvases, it is mil
## Example
```javascript
// 1. 打开一个原理图页,确定缩放的画布
const pages = await eda.dmt_Schematic.getAllSchematicPagesInfo();
const tabId = await eda.dmt_EditorControl.openDocument(pages[0].uuid);
// 2. 视口中心移到 (100, 100),缩放比 200%(单位跨度 1/100)
const bounds = await eda.dmt_EditorControl.zoomTo(100, 100, 200, tabId);
console.log('bounds:', bounds);
```
### zoomtoallprimitives
# DMT\_EditorControl.zoomToAllPrimitives() method
> 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.
Zoom to all primitives (fit all)
## Signature
```typescript
function zoomToAllPrimitives(
tabId?: string,
): Promise<{ left: number; right: number; top: number; bottom: number } | false>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
tabId
</td><td>
string
</td><td>
_(Optional)_ Tab ID. If not passed in, the canvas with the last input focus will be used
</td></tr>
</tbody></table>
## Returns
Promise<{ left: number; right: number; top: number; bottom: number } \| false>
Region data after zooming. `false` indicates that the canvas does not support the zoom operation or the `tabId` does not exist
## Remarks
In the returned data, the coordinate unit span of the schematic and symbol canvases is 0.01inch, and that of the PCB and footprint canvases is mil
## Example
```javascript
// 1. 打开一个原理图页,确定缩放的画布
const pages = await eda.dmt_Schematic.getAllSchematicPagesInfo();
const tabId = await eda.dmt_EditorControl.openDocument(pages[0].uuid);
// 2. 适应全部图元,返回缩放后的可视区域边界
const bounds = await eda.dmt_EditorControl.zoomToAllPrimitives(tabId);
console.log('bounds:', bounds);
```
### zoomtoregion
# DMT\_EditorControl.zoomToRegion() method
> 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.
Zoom to region
## Signature
```typescript
function zoomToRegion(
left: number,
right: number,
top: number,
bottom: number,
tabId?: string,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
left
</td><td>
number
</td><td>
First X coordinate of the rectangle
</td></tr>
<tr><td>
right
</td><td>
number
</td><td>
Second X coordinate of the rectangle
</td></tr>
<tr><td>
top
</td><td>
number
</td><td>
First Y coordinate of the rectangle
</td></tr>
<tr><td>
bottom
</td><td>
number
</td><td>
Second Y coordinate of the rectangle
</td></tr>
<tr><td>
tabId
</td><td>
string
</td><td>
_(Optional)_ Tab ID. If not passed in, the canvas with the last input focus will be used
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
In the schematic and symbol canvases, the coordinate unit span is 0.01inch; in the PCB and footprint canvases, it is mil
## Example
```javascript
// 1. 打开一个原理图页,确定缩放的画布
const pages = await eda.dmt_Schematic.getAllSchematicPagesInfo();
const tabId = await eda.dmt_EditorControl.openDocument(pages[0].uuid);
// 2. 缩放到 (0,0)-(400,300) 的矩形区域
const zoomed = await eda.dmt_EditorControl.zoomToRegion(0, 400, 0, 300, tabId);
console.log('zoomed:', zoomed);
```
### zoomtoselectedprimitives
# DMT\_EditorControl.zoomToSelectedPrimitives() method
> 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.
Zoom to the selected primitives (fit selection)
## Signature
```typescript
function zoomToSelectedPrimitives(
tabId?: string,
): Promise<{ left: number; right: number; top: number; bottom: number } | false>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
tabId
</td><td>
string
</td><td>
_(Optional)_ Tab ID. If not passed in, the canvas with the last input focus will be used
</td></tr>
</tbody></table>
## Returns
Promise<{ left: number; right: number; top: number; bottom: number } \| false>
Region data after zooming. `false` indicates that the canvas does not support the zoom operation or the `tabId` does not exist
## Remarks
In the returned data, the coordinate unit span of the schematic and symbol canvases is 0.01inch, and that of the PCB and footprint canvases is mil
## Example
```javascript
// 1. 打开原理图页,创建一个文本图元作为选中目标
const pages = await eda.dmt_Schematic.getAllSchematicPagesInfo();
const tabId = await eda.dmt_EditorControl.openDocument(pages[0].uuid);
const text = await eda.sch_PrimitiveText.create(100, 80, '嘉立创示例_缩放目标');
// 2. 以图元 ID 建立选中状态
const selected = await eda.sch_SelectControl.doSelectPrimitives([text.getState_PrimitiveId()]);
console.log('selected:', selected);
// 3. 缩放到选中的图元,返回可视区域边界
const bounds = await eda.dmt_EditorControl.zoomToSelectedPrimitives(tabId);
console.log('bounds:', bounds);
// 4. 清理:取消选中并删除测试图元
await eda.sch_SelectControl.clearSelected();
await eda.sch_PrimitiveText.delete([text.getState_PrimitiveId()]);
console.log('cleaned');
```
references/classes/DMT_Project.md
# DMT\_Project class
Document tree / Project management class
## Signature
```typescript
class DMT_Project
```
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[createProject(projectFriendlyName, projectName, teamUuid, folderUuid, description, collaborationMode, fileFormat)](./DMT_Project.md)
</td><td>
</td><td>
**_(BETA)_** Create Project
</td></tr>
<tr><td>
[getAllProjectsUuid(teamUuid, folderUuid, workspaceUuid)](./DMT_Project.md)
</td><td>
</td><td>
Get the UUIDs of all projects
</td></tr>
<tr><td>
[getCurrentProjectInfo()](./DMT_Project.md)
</td><td>
</td><td>
Get detailed properties of Current project
</td></tr>
<tr><td>
[getProjectInfo(projectUuid)](./DMT_Project.md)
</td><td>
</td><td>
Get Project property
</td></tr>
<tr><td>
[moveProjectToFolder(projectUuid, folderUuid)](./DMT_Project.md)
</td><td>
</td><td>
Move a project to a folder
</td></tr>
<tr><td>
[openProject(projectUuid)](./DMT_Project.md)
</td><td>
</td><td>
Open project
</td></tr>
</tbody></table>
---
## 方法详情
### createproject
# DMT\_Project.createProject() method
> 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.
Create Project
## Signature
```typescript
function createProject(
projectFriendlyName: string,
projectName?: string,
teamUuid?: string,
folderUuid?: string,
description?: string,
collaborationMode?: EDMT_ProjectCollaborationMode,
fileFormat?: EDMT_ProjectFileFormat,
): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
projectFriendlyName
</td><td>
string
</td><td>
Project friendly name
</td></tr>
<tr><td>
projectName
</td><td>
string
</td><td>
_(Optional)_ Project name, which cannot be duplicated. Only letters `a-zA-Z`<!-- -->, digits `0-9`<!-- -->, and hyphens `-` are supported. If not specified, it is automatically generated based on the project friendly name
</td></tr>
<tr><td>
teamUuid
</td><td>
string
</td><td>
_(Optional)_ Team UUID. If not specified, it defaults to personal. In an environment where personal projects do not exist, a team UUID must be specified
</td></tr>
<tr><td>
folderUuid
</td><td>
string
</td><td>
_(Optional)_ Folder UUID. If not specified, it is the root folder
</td></tr>
<tr><td>
description
</td><td>
string
</td><td>
_(Optional)_ Project description
</td></tr>
<tr><td>
collaborationMode
</td><td>
[EDMT\_ProjectCollaborationMode](../enums/EDMT_ProjectCollaborationMode.md)
</td><td>
_(Optional)_ Project collaboration mode. If the team permission does not require the project to set a collaboration mode, this parameter will be ignored
</td></tr>
<tr><td>
fileFormat
</td><td>
[EDMT\_ProjectFileFormat](../enums/EDMT_ProjectFileFormat.md)
</td><td>
_(Optional)_ 工程文件格式,缺省为 `EPRJ3`<!-- -->;仅在客户端半离线 / 全离线模式生效,在线环境将忽略该参数
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
Project UUID, if it is `undefined` creation fails
## Example
```javascript
// 1. 创建测试工程(友好名带时间戳避免重名,名称与团队留空走默认)
const projectUuid = await eda.dmt_Project.createProject(
`嘉立创示例_工程 ${Date.now()}`,
undefined,
undefined,
undefined,
'嘉立创示例:工程创建演示',
);
// 2. 等待工作区同步后回读,确认工程已落地
await new Promise(r => setTimeout(r, 1500));
const brief = await eda.dmt_Project.getProjectInfo(projectUuid);
const folderLabel = !brief?.folderUuid ? '(根目录)' : brief.folderUuid;
console.log('projectUuid:', projectUuid);
console.log('friendlyName:', brief?.friendlyName);
console.log('folderUuid:', folderLabel);
```
### getallprojectsuuid
# DMT\_Project.getAllProjectsUuid() method
Get the UUIDs of all projects
## Signature
```typescript
function getAllProjectsUuid(
teamUuid?: string,
folderUuid?: string,
workspaceUuid?: string,
): Promise<Array<string>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
teamUuid
</td><td>
string
</td><td>
_(Optional)_ Team UUID
</td></tr>
<tr><td>
folderUuid
</td><td>
string
</td><td>
_(Optional)_ Folder UUID. If not specified, it defaults to the root folder of the team
</td></tr>
<tr><td>
workspaceUuid
</td><td>
string
</td><td>
_(Optional)_ Workspace UUID
</td></tr>
</tbody></table>
## Returns
Promise<Array<string>>
Project UUID array
## Remarks
If `teamUuid` is specified, all projects under the specified team are obtained;
If `folderUuid` is specified, all projects under the specified folder are obtained;
`teamUuid`<!-- -->, `folderUuid` only one of them may be specified, if both are specified, only `folderUuid`<!-- -->;
If `workspaceUuid` is specified, all projects under the specified team/folder are obtained in the specified Workspace
## Example
```javascript
// 1. 取当前工程所属团队
const projectInfo = await eda.dmt_Project.getCurrentProjectInfo();
const teamUuid = projectInfo.teamUuid;
// 2. 获取该团队下所有工程的 UUID
const projectUuids = await eda.dmt_Project.getAllProjectsUuid(teamUuid);
console.log('projectCount:', projectUuids.length);
console.log('projectUuids:', projectUuids.join(', '));
```
### getcurrentprojectinfo
# DMT\_Project.getCurrentProjectInfo() method
Get detailed properties of Current project
## Signature
```typescript
function getCurrentProjectInfo(): Promise<IDMT_ProjectItem | undefined>;
```
## Returns
Promise<[IDMT\_ProjectItem](../interfaces/IDMT_ProjectItem.md) \| undefined>
Project property; if it is `undefined`<!-- -->, the retrieval failed
## Remarks
It will get the detailed properties of the project associated with the currently open schematic, PCB, or panel that has the last input focus
### getprojectinfo
# DMT\_Project.getProjectInfo() method
Get Project property
## Signature
```typescript
function getProjectInfo(projectUuid: string): Promise<IDMT_BriefProjectItem | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
projectUuid
</td><td>
string
</td><td>
Project UUID
</td></tr>
</tbody></table>
## Returns
Promise<[IDMT\_BriefProjectItem](../interfaces/IDMT_BriefProjectItem.md) \| undefined>
Brief project properties. If it is `undefined`<!-- -->, the retrieval failed
## Remarks
This API can only read brief project properties. For the detailed project tree, use the [getCurrentProjectInfo](./DMT_Project.md) API
### moveprojecttofolder
# DMT\_Project.moveProjectToFolder() method
Move a project to a folder
## Signature
```typescript
function moveProjectToFolder(projectUuid: string, folderUuid?: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
projectUuid
</td><td>
string
</td><td>
Project UUID
</td></tr>
<tr><td>
folderUuid
</td><td>
string
</td><td>
_(Optional)_ Folder UUID, which can only be a folder under the team or personal space where the current project is located. If it is `undefined`<!-- -->, it is moved to the root folder of the current team
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the move is successful
## Example
```javascript
// 1. 记录当前工程的位置,作为移动后恢复的锚点
const info = await eda.dmt_Project.getCurrentProjectInfo();
const projectUuid = info.uuid;
const teamUuid = info.teamUuid;
const originalFolderUuid = info.folderUuid; // 可能为 undefined(团队根目录)
// 2. 创建目标文件夹,等待 1.5s 让工作区同步
const targetFolderUuid = await eda.dmt_Folder.createFolder('嘉立创示例_目标文件夹', teamUuid);
await new Promise(r => setTimeout(r, 1500));
// 3. 把当前工程移到目标文件夹下
const moved = await eda.dmt_Project.moveProjectToFolder(projectUuid, targetFolderUuid);
await new Promise(r => setTimeout(r, 1000));
// 4. 回读验证工程已落到目标文件夹
const after = await eda.dmt_Project.getCurrentProjectInfo();
const folderChanged = after?.folderUuid === targetFolderUuid;
// 5. 恢复:移回原位置(原为根目录时传 undefined)
const restored = await eda.dmt_Project.moveProjectToFolder(projectUuid, originalFolderUuid);
await new Promise(r => setTimeout(r, 1000));
console.log('moved:', moved);
console.log('folderChanged:', folderChanged);
console.log('restored:', restored);
```
### openproject
# DMT\_Project.openProject() method
Open project
## Signature
```typescript
function openProject(projectUuid: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
projectUuid
</td><td>
string
</td><td>
Project UUID
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether Successful open project
## Remarks
This operation will open the specified project in the EDA front end. If another project was previously opened with unsaved changes, executing this operation will directly lose all unsaved data
## Example
```javascript
// 1. 取当前工程 UUID(打开自身,避免切换到其它工程)
const info = await eda.dmt_Project.getCurrentProjectInfo();
const projectUuid = info.uuid;
// 2. 打开该工程
const opened = await eda.dmt_Project.openProject(projectUuid);
console.log('opened:', opened);
```
references/classes/DMT_Panel.md
# DMT\_Panel class
Document tree / Panel management class
## Signature
```typescript
class DMT_Panel
```
## Remarks
Operations related to panel management in the currently open project
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[copyPanel(panelUuid)](./DMT_Panel.md)
</td><td>
</td><td>
Copy Panel
</td></tr>
<tr><td>
[createPanel()](./DMT_Panel.md)
</td><td>
</td><td>
**_(BETA)_** Create Panel
</td></tr>
<tr><td>
[deletePanel(panelUuid)](./DMT_Panel.md)
</td><td>
</td><td>
Delete Panel
</td></tr>
<tr><td>
[getAllPanelsInfo()](./DMT_Panel.md)
</td><td>
</td><td>
Get all in the project panel detailed properties of
</td></tr>
<tr><td>
[getCurrentPanelInfo()](./DMT_Panel.md)
</td><td>
</td><td>
Get detailed properties of Current panel
</td></tr>
<tr><td>
[getPanelInfo(panelUuid)](./DMT_Panel.md)
</td><td>
</td><td>
Get detailed properties of Panel
</td></tr>
<tr><td>
[modifyPanelName(panelUuid, panelName)](./DMT_Panel.md)
</td><td>
</td><td>
Modify Panel name
</td></tr>
</tbody></table>
---
## 方法详情
### copypanel
# DMT\_Panel.copyPanel() method
Copy Panel
## Signature
```typescript
function copyPanel(panelUuid: string): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
panelUuid
</td><td>
string
</td><td>
Source panel UUID
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
New panel UUID. If it is `undefined`<!-- -->, the copy failed
## Example
```javascript
// 1. 创建一个专用源面板并等 1.5s 同步(复制前源面板必须已在工作区落地)
const sourceUuid = await eda.dmt_Panel.createPanel();
await new Promise(r => setTimeout(r, 1500));
// 2. 复制源面板,返回副本 UUID
const copiedUuid = await eda.dmt_Panel.copyPanel(sourceUuid);
await new Promise(r => setTimeout(r, 1500));
// 3. 回读副本,确认名称与所属工程
const copyInfo = await eda.dmt_Panel.getPanelInfo(copiedUuid);
console.log('copiedUuid:', copiedUuid);
console.log('copyName:', copyInfo?.name);
// 4. 清理本例创建的两个面板(先删副本再删源),保持工程整洁
const deletedCopy = await eda.dmt_Panel.deletePanel(copiedUuid);
console.log('deleted:', deletedCopy);
const deletedSource = await eda.dmt_Panel.deletePanel(sourceUuid);
console.log('deleted:', deletedSource);
```
### createpanel
# DMT\_Panel.createPanel() method
> 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.
Create Panel
## Signature
```typescript
function createPanel(): Promise<string | undefined>;
```
## Returns
Promise<string \| undefined>
Panel UUID, if it is `undefined` creation fails
## Example
```javascript
// 1. 创建面板,返回新面板 UUID
const panelUuid = await eda.dmt_Panel.createPanel();
console.log('panelUuid:', panelUuid);
// 2. 等 1.5s 让面板在工作区落地,回读确认
await new Promise(r => setTimeout(r, 1500));
const panelInfo = await eda.dmt_Panel.getPanelInfo(panelUuid);
console.log('name:', panelInfo?.name);
// 3. 删除本例创建的面板,保持工程整洁
const deleted = await eda.dmt_Panel.deletePanel(panelUuid);
console.log('deleted:', deleted);
```
### deletepanel
# DMT\_Panel.deletePanel() method
Delete Panel
## Signature
```typescript
function deletePanel(panelUuid: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
panelUuid
</td><td>
string
</td><td>
Panel UUID
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 创建专用测试面板(避免误删工程里的现有面板),等 1.5s 同步
const panelUuid = await eda.dmt_Panel.createPanel();
await new Promise(r => setTimeout(r, 1500));
// 2. 删除该面板
const deleted = await eda.dmt_Panel.deletePanel(panelUuid);
console.log('deleted:', deleted);
// 3. 回读确认已删除(返回 undefined 说明面板已不存在)
const info = await eda.dmt_Panel.getPanelInfo(panelUuid);
console.log('info after delete:', info === undefined ? '已不存在' : info.name);
```
### getallpanelsinfo
# DMT\_Panel.getAllPanelsInfo() method
Get all in the project panel detailed properties of
## Signature
```typescript
function getAllPanelsInfo(): Promise<Array<IDMT_PanelItem>>;
```
## Returns
Promise<Array<[IDMT\_PanelItem](../interfaces/IDMT_PanelItem.md)<!-- -->>>
Array of detailed properties of all panels
## Example
```javascript
// 1. 创建一个测试面板并等 1.5s 同步,保证列表里有新近创建的对象
const panelUuid = await eda.dmt_Panel.createPanel();
await new Promise(r => setTimeout(r, 1500));
// 2. 获取所有面板的详细属性
const panels = await eda.dmt_Panel.getAllPanelsInfo();
// 3. 输出每个面板的名称与 UUID,确认测试面板在列
panels.forEach((p, i) => {
console.log(`panel[${i}]:`, p.name, p.uuid);
});
console.log('total:', panels.length);
console.log('test panel included:', panels.some(p => p.uuid === panelUuid));
// 4. 清理测试面板(查询类案例不留测试对象)
await eda.dmt_Panel.deletePanel(panelUuid);
```
### getcurrentpanelinfo
# DMT\_Panel.getCurrentPanelInfo() method
Get detailed properties of Current panel
## Signature
```typescript
function getCurrentPanelInfo(): Promise<IDMT_PanelItem | undefined>;
```
## Returns
Promise<[IDMT\_PanelItem](../interfaces/IDMT_PanelItem.md) \| undefined>
Panel detailed properties of; if it is `undefined`<!-- -->, the retrieval failed
## Remarks
It will get the detailed properties of the currently open panel that has the last input focus
## Example
```javascript
// 1. 创建测试面板并打开它,让焦点落到面板文档上(原理图/PCB 焦点下返回 undefined)
const panelUuid = await eda.dmt_Panel.createPanel();
await new Promise(r => setTimeout(r, 1500));
await eda.dmt_EditorControl.openDocument(panelUuid);
await new Promise(r => setTimeout(r, 1000));
// 2. 获取当前焦点面板的详细属性
const panel = await eda.dmt_Panel.getCurrentPanelInfo();
// 3. 输出面板的名称、UUID 与所属工程
console.log('name:', panel?.name);
console.log('panelUuid:', panel?.uuid);
console.log('parentProjectUuid:', panel?.parentProjectUuid);
// 4. 清理测试面板(面板处于打开状态也可以直接删除)
await eda.dmt_Panel.deletePanel(panelUuid);
```
### getpanelinfo
# DMT\_Panel.getPanelInfo() method
Get detailed properties of Panel
## Signature
```typescript
function getPanelInfo(panelUuid: string): Promise<IDMT_PanelItem | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
panelUuid
</td><td>
string
</td><td>
Panel UUID
</td></tr>
</tbody></table>
## Returns
Promise<[IDMT\_PanelItem](../interfaces/IDMT_PanelItem.md) \| undefined>
Panel detailed properties of; if it is `undefined`<!-- -->, the retrieval failed
## Example
```javascript
// 1. 创建测试面板并等 1.5s 同步
const panelUuid = await eda.dmt_Panel.createPanel();
await new Promise(r => setTimeout(r, 1500));
// 2. 按 UUID 查询面板详细属性
const panelInfo = await eda.dmt_Panel.getPanelInfo(panelUuid);
// 3. 输出属性
console.log('name:', panelInfo?.name);
console.log('itemType:', panelInfo?.itemType);
console.log('parentProjectUuid:', panelInfo?.parentProjectUuid);
// 4. 清理测试面板(查询类案例不留测试对象)
await eda.dmt_Panel.deletePanel(panelUuid);
```
### modifypanelname
# DMT\_Panel.modifyPanelName() method
Modify Panel name
## Signature
```typescript
function modifyPanelName(panelUuid: string, panelName: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
panelUuid
</td><td>
string
</td><td>
Panel UUID
</td></tr>
<tr><td>
panelName
</td><td>
string
</td><td>
Panel name
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether Modify Successful
## Example
```javascript
// 1. 改名目标优先用当前面板(它必然已打开),其次用列表里的现有面板,都没有时创建一个
let target = await eda.dmt_Panel.getCurrentPanelInfo();
if (!target) {
const panels = await eda.dmt_Panel.getAllPanelsInfo();
target = panels[0];
}
let createdHere = false;
if (!target) {
createdHere = true;
const uuid = await eda.dmt_Panel.createPanel();
await new Promise(r => setTimeout(r, 1500));
target = await eda.dmt_Panel.getPanelInfo(uuid);
}
// 2. 打开目标面板(改名只对已打开的面板生效)
await eda.dmt_EditorControl.openDocument(target.uuid);
await new Promise(r => setTimeout(r, 1000));
// 3. 修改面板名称
const newName = '嘉立创示例_面板新名称';
const renamed = await eda.dmt_Panel.modifyPanelName(target.uuid, newName);
console.log('renamed:', renamed);
// 4. 等 1s 让改名同步,回读验证(英文名可能被归一化为小写,按不区分大小写比较)
await new Promise(r => setTimeout(r, 1000));
const info = await eda.dmt_Panel.getPanelInfo(target.uuid);
console.log('renamedTo:', info?.name);
console.log('renameVerified:', (info?.name ?? '').toLowerCase() === newName.toLowerCase());
// 5. 本例创建的测试面板验证后删除清理;现有面板保留改名现场,人工验收后可改回原名
if (createdHere) {
await eda.dmt_Panel.deletePanel(target.uuid);
}
```
references/classes/DMT_Folder.md
# DMT\_Folder class
Document tree / Folder class
## Signature
```typescript
class DMT_Folder
```
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[createFolder(folderName, teamUuid, parentFolderUuid, description)](./DMT_Folder.md)
</td><td>
</td><td>
**_(BETA)_** Create Folder
</td></tr>
<tr><td>
[deleteFolder(teamUuid, folderUuid)](./DMT_Folder.md)
</td><td>
</td><td>
Delete Folder
</td></tr>
<tr><td>
[getAllFoldersUuid(teamUuid)](./DMT_Folder.md)
</td><td>
</td><td>
Get the UUIDs of all folders
</td></tr>
<tr><td>
[getFolderInfo(teamUuid, folderUuid)](./DMT_Folder.md)
</td><td>
</td><td>
Get Folder detailed properties
</td></tr>
<tr><td>
[modifyFolderDescription(teamUuid, folderUuid, description)](./DMT_Folder.md)
</td><td>
</td><td>
**_(BETA)_** Modify Folder description
</td></tr>
<tr><td>
[modifyFolderName(teamUuid, folderUuid, folderName)](./DMT_Folder.md)
</td><td>
</td><td>
Modify Folder name
</td></tr>
<tr><td>
[moveFolderToFolder(teamUuid, folderUuid, parentFolderUuid)](./DMT_Folder.md)
</td><td>
</td><td>
Move folder
</td></tr>
</tbody></table>
---
## 方法详情
### createfolder
# DMT\_Folder.createFolder() method
> 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.
Create Folder
## Signature
```typescript
function createFolder(
folderName: string,
teamUuid: string,
parentFolderUuid?: string,
description?: string,
): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
folderName
</td><td>
string
</td><td>
Folder name
</td></tr>
<tr><td>
teamUuid
</td><td>
string
</td><td>
Team UUID
</td></tr>
<tr><td>
parentFolderUuid
</td><td>
string
</td><td>
_(Optional)_ Parent folder UUID. If not specified, it is the root folder
</td></tr>
<tr><td>
description
</td><td>
string
</td><td>
_(Optional)_ Folder description
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
Folder UUID, if it is `undefined` creation fails
## Example
```javascript
// 1. 取当前工程所属团队,作为文件夹的归属
const projectInfo = await eda.dmt_Project.getCurrentProjectInfo();
const teamUuid = projectInfo.teamUuid;
// 2. 在团队根目录下创建测试文件夹
const folderUuid = await eda.dmt_Folder.createFolder('嘉立创示例_文件夹', teamUuid);
// 3. 等待工作区同步后回读,确认文件夹已落地
await new Promise(r => setTimeout(r, 1500));
const folderInfo = await eda.dmt_Folder.getFolderInfo(teamUuid, folderUuid);
console.log('folderUuid:', folderUuid);
console.log('name:', folderInfo?.name);
console.log('parentFolderUuid:', folderInfo?.parentFolderUuid === teamUuid ? '(团队根目录)' : folderInfo?.parentFolderUuid);
```
### deletefolder
# DMT\_Folder.deleteFolder() method
Delete Folder
## Signature
```typescript
function deleteFolder(teamUuid: string, folderUuid: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
teamUuid
</td><td>
string
</td><td>
Team UUID
</td></tr>
<tr><td>
folderUuid
</td><td>
string
</td><td>
Folder UUID
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 取当前工程所属团队
const projectInfo = await eda.dmt_Project.getCurrentProjectInfo();
const teamUuid = projectInfo.teamUuid;
// 2. 创建专用测试文件夹(避免动到用户现有目录)
const folderUuid = await eda.dmt_Folder.createFolder('嘉立创示例_待删除', teamUuid);
await new Promise(r => setTimeout(r, 1500));
// 3. 删除该文件夹
const deleted = await eda.dmt_Folder.deleteFolder(teamUuid, folderUuid);
// 4. 回读确认已删除(返回 undefined 说明文件夹已不存在)
await new Promise(r => setTimeout(r, 1000));
const folderInfo = await eda.dmt_Folder.getFolderInfo(teamUuid, folderUuid);
console.log('deleted:', deleted);
console.log('folderInfo after delete:', folderInfo === undefined ? '已不存在' : '仍存在');
```
### getallfoldersuuid
# DMT\_Folder.getAllFoldersUuid() method
Get the UUIDs of all folders
## Signature
```typescript
function getAllFoldersUuid(teamUuid: string): Promise<Array<string>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
teamUuid
</td><td>
string
</td><td>
Team UUID
</td></tr>
</tbody></table>
## Returns
Promise<Array<string>>
Folder UUID array
## Remarks
This API ignores hierarchy information. It will return the UUIDs of folders at all levels and place them in a one-dimensional array
## Example
```javascript
// 1. 取当前工程所属团队
const projectInfo = await eda.dmt_Project.getCurrentProjectInfo();
const teamUuid = projectInfo.teamUuid;
// 2. 创建一个测试文件夹,保证列表里有新近创建的对象
const folderUuid = await eda.dmt_Folder.createFolder('嘉立创示例_盘点', teamUuid);
await new Promise(r => setTimeout(r, 1500));
// 3. 获取所有文件夹 UUID,确认测试文件夹在列
const allUuids = await eda.dmt_Folder.getAllFoldersUuid(teamUuid);
console.log('folderUuid:', folderUuid);
console.log('total folders:', allUuids.length);
console.log('test folder included:', allUuids.includes(folderUuid));
// 4. 清理测试文件夹(查询类案例不留测试对象)
await eda.dmt_Folder.deleteFolder(teamUuid, folderUuid);
```
### getfolderinfo
# DMT\_Folder.getFolderInfo() method
Get Folder detailed properties
## Signature
```typescript
function getFolderInfo(teamUuid: string, folderUuid: string): Promise<IDMT_FolderItem | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
teamUuid
</td><td>
string
</td><td>
Team UUID
</td></tr>
<tr><td>
folderUuid
</td><td>
string
</td><td>
Folder UUID
</td></tr>
</tbody></table>
## Returns
Promise<[IDMT\_FolderItem](../interfaces/IDMT_FolderItem.md) \| undefined>
Folder property; if it is `undefined`<!-- -->, the retrieval failed
## Remarks
When [parentFolderUuid](../interfaces/IDMT_FolderItem.md) equals [teamUuid](../interfaces/IDMT_FolderItem.md)<!-- -->, it means the current folder is a first-level folder under the specified team
## Example
```javascript
// 1. 取当前工程所属团队
const projectInfo = await eda.dmt_Project.getCurrentProjectInfo();
const teamUuid = projectInfo.teamUuid;
// 2. 创建带描述的测试文件夹,等 1.5s 让工作区同步
const folderUuid = await eda.dmt_Folder.createFolder('嘉立创示例_查询', teamUuid, undefined, '嘉立创示例:初始描述');
await new Promise(r => setTimeout(r, 1500));
// 3. 查询文件夹详细属性
const folderInfo = await eda.dmt_Folder.getFolderInfo(teamUuid, folderUuid);
console.log('folderUuid:', folderUuid);
console.log('folderInfo:', JSON.stringify({
name: folderInfo?.name,
description: folderInfo?.description,
parentFolderUuid: folderInfo?.parentFolderUuid,
teamUuid: folderInfo?.teamUuid,
}));
// 4. 清理测试文件夹(查询类案例不留测试对象)
await eda.dmt_Folder.deleteFolder(teamUuid, folderUuid);
```
### modifyfolderdescription
# DMT\_Folder.modifyFolderDescription() method
> 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.
Modify Folder description
## Signature
```typescript
function modifyFolderDescription(
teamUuid: string,
folderUuid: string,
description?: string,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
teamUuid
</td><td>
string
</td><td>
Team UUID
</td></tr>
<tr><td>
folderUuid
</td><td>
string
</td><td>
Folder UUID
</td></tr>
<tr><td>
description
</td><td>
string
</td><td>
_(Optional)_ Folder description. If it is `undefined`<!-- -->, the existing project description is cleared
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether Modify Successful
## Remarks
Modifying the folder description requires interaction with the workspace system. The modification is delayed and takes effect only after a short wait
## Example
```javascript
// 1. 取当前工程所属团队
const projectInfo = await eda.dmt_Project.getCurrentProjectInfo();
const teamUuid = projectInfo.teamUuid;
// 2. 创建带初始描述的测试文件夹,等 1.5s 让工作区同步
const folderUuid = await eda.dmt_Folder.createFolder('嘉立创示例_改描述', teamUuid, undefined, '嘉立创示例:旧描述');
await new Promise(r => setTimeout(r, 1500));
// 3. 修改文件夹描述
const modified = await eda.dmt_Folder.modifyFolderDescription(teamUuid, folderUuid, '嘉立创示例:更新后的描述');
// 4. 等 1s 让工作区同步,再回读验证
await new Promise(r => setTimeout(r, 1000));
const folderInfo = await eda.dmt_Folder.getFolderInfo(teamUuid, folderUuid);
console.log('modified:', modified);
console.log('description:', folderInfo?.description);
```
### modifyfoldername
# DMT\_Folder.modifyFolderName() method
Modify Folder name
## Signature
```typescript
function modifyFolderName(
teamUuid: string,
folderUuid: string,
folderName: string,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
teamUuid
</td><td>
string
</td><td>
Team UUID
</td></tr>
<tr><td>
folderUuid
</td><td>
string
</td><td>
Folder UUID
</td></tr>
<tr><td>
folderName
</td><td>
string
</td><td>
Folder name
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether Modify Successful
## Example
```javascript
// 1. 取当前工程所属团队
const projectInfo = await eda.dmt_Project.getCurrentProjectInfo();
const teamUuid = projectInfo.teamUuid;
// 2. 创建测试文件夹并等待工作区同步
const folderUuid = await eda.dmt_Folder.createFolder('嘉立创示例_旧名称', teamUuid);
await new Promise(r => setTimeout(r, 1500));
// 3. 修改文件夹名称
const renamed = await eda.dmt_Folder.modifyFolderName(teamUuid, folderUuid, '嘉立创示例_新名称');
// 4. 等 1s 后回读,验证名称已更新
await new Promise(r => setTimeout(r, 1000));
const folderInfo = await eda.dmt_Folder.getFolderInfo(teamUuid, folderUuid);
console.log('renamed:', renamed);
console.log('name:', folderInfo?.name);
```
### movefoldertofolder
# DMT\_Folder.moveFolderToFolder() method
Move folder
## Signature
```typescript
function moveFolderToFolder(
teamUuid: string,
folderUuid: string,
parentFolderUuid?: string,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
teamUuid
</td><td>
string
</td><td>
Team UUID
</td></tr>
<tr><td>
folderUuid
</td><td>
string
</td><td>
Folder UUID
</td></tr>
<tr><td>
parentFolderUuid
</td><td>
string
</td><td>
_(Optional)_ Parent folder UUID. If not specified, it defaults to the root folder
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the move is successful
## Example
```javascript
// 1. 取当前工程所属团队
const projectInfo = await eda.dmt_Project.getCurrentProjectInfo();
const teamUuid = projectInfo.teamUuid;
// 2. 创建父、子两个测试文件夹,等 1.5s 让工作区同步
const parentUuid = await eda.dmt_Folder.createFolder('嘉立创示例_父目录', teamUuid);
const childUuid = await eda.dmt_Folder.createFolder('嘉立创示例_子目录', teamUuid);
await new Promise(r => setTimeout(r, 1500));
// 3. 把子目录移动到父目录下
const moved = await eda.dmt_Folder.moveFolderToFolder(teamUuid, childUuid, parentUuid);
// 4. 等 1s 后回读,验证子目录的父级已变为父目录
await new Promise(r => setTimeout(r, 1000));
const childInfo = await eda.dmt_Folder.getFolderInfo(teamUuid, childUuid);
console.log('moved:', moved);
console.log('child parentFolderUuid:', childInfo?.parentFolderUuid, '(expect:', `${parentUuid})`);
```
references/classes/DMT_SelectControl.md
# DMT\_SelectControl class
Document tree / selection control class
## Signature
```typescript
class DMT_SelectControl
```
## Remarks
Query and control of the selection focus in the document tree
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[getCurrentDocumentInfo()](./DMT_SelectControl.md)
</td><td>
</td><td>
**_(BETA)_** Get the properties of the current document
</td></tr>
</tbody></table>
---
## 方法详情
### getcurrentdocumentinfo
# DMT\_SelectControl.getCurrentDocumentInfo() method
> 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.
Get the properties of the current document
## Signature
```typescript
function getCurrentDocumentInfo(): Promise<IDMT_EditorDocumentItem | undefined>;
```
## Returns
Promise<[IDMT\_EditorDocumentItem](../interfaces/IDMT_EditorDocumentItem.md) \| undefined>
An object composed of the document type, UUID, the UUID of the project it belongs to, and the UUID of the library it belongs to. If it is `undefined`<!-- -->, the retrieval failed
## Remarks
It will get the document type, UUID, and the UUID of the project or library it belongs to for the currently open document that has the last input focus
## Example
```javascript
// 1. 创建专用测试原理图(自带图页 p1),打开该页让焦点落到测试文档上
const schematicUuid = await eda.dmt_Schematic.createSchematic();
await new Promise(r => setTimeout(r, 1500));
const info = await eda.dmt_Schematic.getSchematicInfo(schematicUuid);
const pageUuid = info.page[0].uuid;
await eda.dmt_EditorControl.openDocument(pageUuid);
await new Promise(r => setTimeout(r, 1000));
// 2. 获取当前焦点文档的属性(documentType: 1=原理图, 3=PCB)
const doc = await eda.dmt_SelectControl.getCurrentDocumentInfo();
// 3. 输出文档类型、UUID、标签页与所属工程,确认正是刚打开的测试图页
console.log('documentType:', doc?.documentType);
console.log('documentUuid:', doc?.uuid);
console.log('tabId:', doc?.tabId);
console.log('parentProjectUuid:', doc?.parentProjectUuid);
console.log('isFocusedPage:', doc?.uuid === pageUuid);
// 4. 清理测试原理图(处于打开状态也可以直接删除)
await new Promise(r => setTimeout(r, 1000));
const deleted = await eda.dmt_Schematic.deleteSchematic(schematicUuid);
console.log('deleted:', deleted);
```
references/classes/DMT_Team.md
# DMT\_Team class
Document tree / Team class
## Signature
```typescript
class DMT_Team
```
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[getAllInvolvedTeamInfo()](./DMT_Team.md)
</td><td>
</td><td>
Get the detailed properties of all involved teams
</td></tr>
<tr><td>
[getAllTeamsInfo()](./DMT_Team.md)
</td><td>
</td><td>
Get the detailed properties of all direct teams
</td></tr>
<tr><td>
[getCurrentTeamInfo()](./DMT_Team.md)
</td><td>
</td><td>
Get the detailed properties of the current team
</td></tr>
</tbody></table>
---
## 方法详情
### getallinvolvedteaminfo
# DMT\_Team.getAllInvolvedTeamInfo() method
Get the detailed properties of all involved teams
## Signature
```typescript
function getAllInvolvedTeamInfo(): Promise<Array<IDMT_TeamItem>>;
```
## Returns
Promise<Array<[IDMT\_TeamItem](../interfaces/IDMT_TeamItem.md)<!-- -->>>
Detailed properties of all involved teams
## Example
```javascript
// 1. 尝试获取所有参与的团队(当前版本会触发内部缺陷)
let teams;
try {
teams = await eda.dmt_Team.getAllInvolvedTeamInfo();
}
catch (e) {
console.log('说明:当前版本触发内部缺陷,改用 getAllTeamsInfo 替代:', e.message);
// 2. 替代方案:获取所有直接团队
teams = await eda.dmt_Team.getAllTeamsInfo();
}
// 3. 输出团队数量与每个团队的属性
console.log('团队数量:', teams.length);
teams.forEach((team, i) => {
console.log(`团队${i + 1}:`, team.name, 'uuid:', team.uuid);
});
```
### getallteamsinfo
# DMT\_Team.getAllTeamsInfo() method
Get the detailed properties of all direct teams
## Signature
```typescript
function getAllTeamsInfo(): Promise<Array<IDMT_TeamItem>>;
```
## Returns
Promise<Array<[IDMT\_TeamItem](../interfaces/IDMT_TeamItem.md)<!-- -->>>
Detailed properties of all teams
## Remarks
A personal space is essentially a team named \*\*Personal\*\*
## Example
```javascript
// 1. 获取所有直接团队
const teams = await eda.dmt_Team.getAllTeamsInfo();
// 2. 输出团队数量与每个团队的属性(name/uuid/identity/itemType)
console.log('团队数量:', teams.length);
teams.forEach((team, i) => {
console.log(`团队${i + 1}:`, team.name, 'uuid:', team.uuid, '身份 ID:', team.identity);
});
```
### getcurrentteaminfo
# DMT\_Team.getCurrentTeamInfo() method
Get the detailed properties of the current team
## Signature
```typescript
function getCurrentTeamInfo(): Promise<IDMT_TeamItem | undefined>;
```
## Returns
Promise<[IDMT\_TeamItem](../interfaces/IDMT_TeamItem.md) \| undefined>
Detailed properties of the team. If it is `undefined`<!-- -->, the retrieval failed
## Remarks
It will get the detailed properties of the team that the project belongs to, associated with the currently open schematic, PCB, or panel that has the last input focus
## Example
```javascript
// 1. 获取当前团队属性
const team = await eda.dmt_Team.getCurrentTeamInfo();
// 2. 输出当前团队属性(uuid 常用作后续 DMT_Folder/Project API 的 teamUuid 参数)
console.log('当前团队名称:', team?.name);
console.log('当前团队 uuid:', team?.uuid);
console.log('当前团队身份 ID:', team?.identity);
```
references/classes/DMT_Pcb.md
# DMT\_Pcb class
Document tree / PCB management class
## Signature
```typescript
class DMT_Pcb
```
## Remarks
Operations related to PCB management in the currently open project
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[copyPcb(pcbUuid, boardName)](./DMT_Pcb.md)
</td><td>
</td><td>
Copy PCB
</td></tr>
<tr><td>
[createPcb(boardName)](./DMT_Pcb.md)
</td><td>
</td><td>
Create PCB
</td></tr>
<tr><td>
[deletePcb(pcbUuid)](./DMT_Pcb.md)
</td><td>
</td><td>
Delete PCB
</td></tr>
<tr><td>
[getAllPcbsInfo()](./DMT_Pcb.md)
</td><td>
</td><td>
Get all in the project PCB detailed properties of
</td></tr>
<tr><td>
[getCurrentPcbInfo()](./DMT_Pcb.md)
</td><td>
</td><td>
Get detailed properties of Current PCB
</td></tr>
<tr><td>
[getPcbInfo(pcbUuid)](./DMT_Pcb.md)
</td><td>
</td><td>
Get detailed properties of PCB
</td></tr>
<tr><td>
[modifyPcbName(pcbUuid, pcbName)](./DMT_Pcb.md)
</td><td>
</td><td>
Modify PCB name
</td></tr>
</tbody></table>
---
## 方法详情
### copypcb
# DMT\_Pcb.copyPcb() method
Copy PCB
## Signature
```typescript
function copyPcb(pcbUuid: string, boardName?: string): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
pcbUuid
</td><td>
string
</td><td>
Source PCB UUID
</td></tr>
<tr><td>
boardName
</td><td>
string
</td><td>
_(Optional)_ Name of the board the new PCB belongs to. If not specified, it is a free PCB
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
New PCB UUID. If it is `undefined`<!-- -->, the copy failed
## Remarks
Even if the PCB here is already associated with a reuse block (a reuse block symbol with the same name exists in the project library), no new reuse block symbol will be created. This operation logic is consistent with the current editor front end
## Example
```javascript
// 1. 创建一个专用源 PCB 并等 1.5s 同步(复制前源 PCB 必须已在工作区落地)
const sourceUuid = await eda.dmt_Pcb.createPcb();
await new Promise(r => setTimeout(r, 1500));
// 2. 复制源 PCB,返回副本 UUID
const copiedUuid = await eda.dmt_Pcb.copyPcb(sourceUuid);
await new Promise(r => setTimeout(r, 1500));
// 3. 回读副本,确认名称与归属
const copyInfo = await eda.dmt_Pcb.getPcbInfo(copiedUuid);
console.log('copiedUuid:', copiedUuid);
console.log('copyName:', copyInfo?.name);
console.log('copyParentBoardName:', copyInfo?.parentBoardName);
// 4. 清理本例创建的两块 PCB(先删副本再删源),保持工程整洁
const deletedCopy = await eda.dmt_Pcb.deletePcb(copiedUuid);
console.log('deleted:', deletedCopy);
const deletedSource = await eda.dmt_Pcb.deletePcb(sourceUuid);
console.log('deleted:', deletedSource);
```
### createpcb
# DMT\_Pcb.createPcb() method
Create PCB
## Signature
```typescript
function createPcb(boardName?: string): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
boardName
</td><td>
string
</td><td>
_(Optional)_ Name of the board it belongs to. If not specified, it is a free PCB
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
PCB UUID, if it is `undefined` creation fails
## Example
```javascript
// 1. 创建 PCB(不指定 boardName,得到游离 PCB),返回新 PCB UUID
const pcbUuid = await eda.dmt_Pcb.createPcb();
console.log('pcbUuid:', pcbUuid);
// 2. 等 1.5s 让 PCB 在工作区落地,回读确认
await new Promise(r => setTimeout(r, 1500));
const pcbInfo = await eda.dmt_Pcb.getPcbInfo(pcbUuid);
console.log('name:', pcbInfo?.name);
console.log('parentBoardName:', pcbInfo?.parentBoardName);
// 3. 删除本例创建的 PCB,保持工程整洁
const deleted = await eda.dmt_Pcb.deletePcb(pcbUuid);
console.log('deleted:', deleted);
```
### deletepcb
# DMT\_Pcb.deletePcb() method
Delete PCB
## Signature
```typescript
function deletePcb(pcbUuid: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
pcbUuid
</td><td>
string
</td><td>
PCB UUID
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
If the PCB is already associated with a reuse block (a reuse block symbol with the same name exists in the project library), deleting the PCB will also delete the associated schematic and reuse block symbol. If the reuse block symbol cannot be deleted, it will be skipped
## Example
```javascript
// 1. 创建专用测试 PCB(避免误删工程里的现有 PCB),等 1.5s 同步
const pcbUuid = await eda.dmt_Pcb.createPcb();
await new Promise(r => setTimeout(r, 1500));
// 2. 删除该 PCB
const deleted = await eda.dmt_Pcb.deletePcb(pcbUuid);
console.log('deleted:', deleted);
// 3. 回读确认已删除(返回 undefined 说明 PCB 已不存在)
const info = await eda.dmt_Pcb.getPcbInfo(pcbUuid);
console.log('info after delete:', info === undefined ? '已不存在' : info.name);
```
### getallpcbsinfo
# DMT\_Pcb.getAllPcbsInfo() method
Get all in the project PCB detailed properties of
## Signature
```typescript
function getAllPcbsInfo(): Promise<Array<IDMT_PcbItem>>;
```
## Returns
Promise<Array<[IDMT\_PcbItem](../interfaces/IDMT_PcbItem.md)<!-- -->>>
Array of detailed properties of all PCBs
## Example
```javascript
// 1. 创建一个测试 PCB 并等 1.5s 同步,保证列表里有新近创建的对象
const pcbUuid = await eda.dmt_Pcb.createPcb();
await new Promise(r => setTimeout(r, 1500));
// 2. 获取所有 PCB 的详细属性
const pcbs = await eda.dmt_Pcb.getAllPcbsInfo();
// 3. 输出每块 PCB 的名称与 UUID,确认测试 PCB 在列
pcbs.forEach((p, i) => {
console.log(`pcb[${i}]:`, p.name, p.uuid);
});
console.log('total:', pcbs.length);
console.log('test pcb included:', pcbs.some(p => p.uuid === pcbUuid));
// 4. 清理测试 PCB(查询类案例不留测试对象)
await eda.dmt_Pcb.deletePcb(pcbUuid);
```
### getcurrentpcbinfo
# DMT\_Pcb.getCurrentPcbInfo() method
Get detailed properties of Current PCB
## Signature
```typescript
function getCurrentPcbInfo(): Promise<IDMT_PcbItem | undefined>;
```
## Returns
Promise<[IDMT\_PcbItem](../interfaces/IDMT_PcbItem.md) \| undefined>
PCB detailed properties of; if it is `undefined`<!-- -->, the retrieval failed
## Remarks
It will get the detailed properties of the currently open PCB that has the last input focus
## Example
```javascript
// 1. 创建测试 PCB 并打开它,让焦点落到 PCB 文档上(原理图焦点下返回 undefined)
const pcbUuid = await eda.dmt_Pcb.createPcb();
await new Promise(r => setTimeout(r, 1500));
await eda.dmt_EditorControl.openDocument(pcbUuid);
await new Promise(r => setTimeout(r, 1000));
// 2. 获取当前焦点 PCB 的详细属性
const pcb = await eda.dmt_Pcb.getCurrentPcbInfo();
// 3. 输出 PCB 的名称、UUID 与所属工程
console.log('name:', pcb?.name);
console.log('pcbUuid:', pcb?.uuid);
console.log('parentProjectUuid:', pcb?.parentProjectUuid);
// 4. 清理测试 PCB(PCB 处于打开状态也可以直接删除)
await eda.dmt_Pcb.deletePcb(pcbUuid);
```
### getpcbinfo
# DMT\_Pcb.getPcbInfo() method
Get detailed properties of PCB
## Signature
```typescript
function getPcbInfo(pcbUuid: string): Promise<IDMT_PcbItem | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
pcbUuid
</td><td>
string
</td><td>
PCB UUID
</td></tr>
</tbody></table>
## Returns
Promise<[IDMT\_PcbItem](../interfaces/IDMT_PcbItem.md) \| undefined>
PCB detailed properties of; if it is `undefined`<!-- -->, the retrieval failed
## Example
```javascript
// 1. 创建测试 PCB 并等 1.5s 同步
const pcbUuid = await eda.dmt_Pcb.createPcb();
await new Promise(r => setTimeout(r, 1500));
// 2. 按 UUID 查询 PCB 详细属性
const pcbInfo = await eda.dmt_Pcb.getPcbInfo(pcbUuid);
// 3. 输出属性
console.log('name:', pcbInfo?.name);
console.log('itemType:', pcbInfo?.itemType);
console.log('parentBoardName:', pcbInfo?.parentBoardName);
console.log('parentProjectUuid:', pcbInfo?.parentProjectUuid);
// 4. 清理测试 PCB(查询类案例不留测试对象)
await eda.dmt_Pcb.deletePcb(pcbUuid);
```
### modifypcbname
# DMT\_Pcb.modifyPcbName() method
Modify PCB name
## Signature
```typescript
function modifyPcbName(pcbUuid: string, pcbName: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
pcbUuid
</td><td>
string
</td><td>
PCB UUID
</td></tr>
<tr><td>
pcbName
</td><td>
string
</td><td>
PCB name
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether Modify Successful
## Remarks
If the PCB is already associated with a reuse block (a reuse block symbol with the same name exists in the project library), modifying the name will also modify the reuse block symbol name and the associated schematic name
## Example
```javascript
// 1. 创建专用测试 PCB 并等 1.5s 同步
const pcbUuid = await eda.dmt_Pcb.createPcb();
await new Promise(r => setTimeout(r, 1500));
// 2. 打开测试 PCB(改名只对已打开的 PCB 生效)
await eda.dmt_EditorControl.openDocument(pcbUuid);
await new Promise(r => setTimeout(r, 1000));
// 3. 修改 PCB 名称
const newName = '嘉立创示例_PCB新名称';
const renamed = await eda.dmt_Pcb.modifyPcbName(pcbUuid, newName);
console.log('renamed:', renamed);
// 4. 等 1s 让改名同步,回读验证(英文名可能被归一化为小写,按不区分大小写比较)
await new Promise(r => setTimeout(r, 1000));
const info = await eda.dmt_Pcb.getPcbInfo(pcbUuid);
console.log('renamedTo:', info?.name);
console.log('renameVerified:', (info?.name ?? '').toLowerCase() === newName.toLowerCase());
// 5. 清理测试 PCB,保持工程整洁
await eda.dmt_Pcb.deletePcb(pcbUuid);
```
references/classes/DMT_Schematic.md
# DMT\_Schematic class
Document tree / Schematic management class
## Signature
```typescript
class DMT_Schematic
```
## Remarks
Operations related to schematic management in the currently open project
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[copySchematic(schematicUuid, boardName)](./DMT_Schematic.md)
</td><td>
</td><td>
**_(BETA)_** Copy Schematic
</td></tr>
<tr><td>
[copySchematicPage(schematicPageUuid, schematicUuid)](./DMT_Schematic.md)
</td><td>
</td><td>
**_(BETA)_** Copy Schematic sheet
</td></tr>
<tr><td>
[createSchematic(boardName)](./DMT_Schematic.md)
</td><td>
</td><td>
**_(BETA)_** Create Schematic
</td></tr>
<tr><td>
[createSchematicPage(schematicUuid)](./DMT_Schematic.md)
</td><td>
</td><td>
**_(BETA)_** Create Schematic sheet
</td></tr>
<tr><td>
[deleteSchematic(schematicUuid)](./DMT_Schematic.md)
</td><td>
</td><td>
**_(BETA)_** Delete Schematic
</td></tr>
<tr><td>
[deleteSchematicPage(schematicPageUuid)](./DMT_Schematic.md)
</td><td>
</td><td>
**_(BETA)_** Delete Schematic sheet
</td></tr>
<tr><td>
[getAllSchematicPagesInfo()](./DMT_Schematic.md)
</td><td>
</td><td>
**_(BETA)_** Get all in the project schematic sheet detailed properties of
</td></tr>
<tr><td>
[getAllSchematicsInfo()](./DMT_Schematic.md)
</td><td>
</td><td>
**_(BETA)_** Get all in the project schematic detailed properties of
</td></tr>
<tr><td>
[getCurrentSchematicAllSchematicPagesInfo()](./DMT_Schematic.md)
</td><td>
</td><td>
**_(BETA)_** Get the detailed properties of all schematic sheets in the current schematic
</td></tr>
<tr><td>
[getCurrentSchematicInfo()](./DMT_Schematic.md)
</td><td>
</td><td>
**_(BETA)_** Get detailed properties of Current schematic
</td></tr>
<tr><td>
[getCurrentSchematicPageInfo()](./DMT_Schematic.md)
</td><td>
</td><td>
**_(BETA)_** Get detailed properties of Current schematic sheet
</td></tr>
<tr><td>
[getSchematicInfo(schematicUuid)](./DMT_Schematic.md)
</td><td>
</td><td>
**_(BETA)_** Get detailed properties of Schematic
</td></tr>
<tr><td>
[getSchematicPageInfo(schematicPageUuid)](./DMT_Schematic.md)
</td><td>
</td><td>
**_(BETA)_** Get detailed properties of Schematic sheet
</td></tr>
<tr><td>
[modifySchematicName(schematicUuid, schematicName)](./DMT_Schematic.md)
</td><td>
</td><td>
**_(BETA)_** Modify Schematic name
</td></tr>
<tr><td>
[modifySchematicPageName(schematicPageUuid, schematicPageName)](./DMT_Schematic.md)
</td><td>
</td><td>
**_(BETA)_** Modify Schematic sheet name
</td></tr>
<tr><td>
[modifySchematicPageTitleBlock(showTitleBlock, titleBlockData)](./DMT_Schematic.md)
</td><td>
</td><td>
**_(BETA)_** Modify the title block of a schematic sheet
</td></tr>
<tr><td>
[reorderSchematicPages(schematicUuid, schematicPageItemsArray)](./DMT_Schematic.md)
</td><td>
</td><td>
**_(BETA)_** Reorder schematic sheets
</td></tr>
</tbody></table>
---
## 方法详情
### copyschematic
# DMT\_Schematic.copySchematic() method
> 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.
Copy Schematic
## Signature
```typescript
function copySchematic(schematicUuid: string, boardName?: string): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
schematicUuid
</td><td>
string
</td><td>
Source schematic UUID
</td></tr>
<tr><td>
boardName
</td><td>
string
</td><td>
_(Optional)_ Name of the board the new schematic belongs to. If not specified, it is a free schematic
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
New schematic UUID. If it is `undefined`<!-- -->, the copy failed
## Remarks
If the schematic is already associated with a reuse block (a reuse block symbol with the same name exists in the project library), copying the schematic will also create a new reuse block symbol
## Example
```javascript
// 1. 创建专用源原理图(自带图页 p1),等 1.5s 同步
const sourceUuid = await eda.dmt_Schematic.createSchematic();
await new Promise(r => setTimeout(r, 1500));
// 2. 复制源原理图,返回副本 UUID
const copiedUuid = await eda.dmt_Schematic.copySchematic(sourceUuid);
await new Promise(r => setTimeout(r, 1500));
// 3. 回读副本,确认名称与图页被完整复制
const copyInfo = await eda.dmt_Schematic.getSchematicInfo(copiedUuid);
console.log('copiedUuid:', copiedUuid);
console.log('copyName:', copyInfo?.name);
console.log('copyPages:', (copyInfo?.page || []).map(p => p.name).join(', '));
// 4. 清理本例创建的两个原理图(先删副本再删源),保持工程整洁
await new Promise(r => setTimeout(r, 1000));
const deletedCopy = await eda.dmt_Schematic.deleteSchematic(copiedUuid);
console.log('deleted:', deletedCopy);
await new Promise(r => setTimeout(r, 1000));
const deletedSource = await eda.dmt_Schematic.deleteSchematic(sourceUuid);
console.log('deleted:', deletedSource);
```
### copyschematicpage
# DMT\_Schematic.copySchematicPage() method
> 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.
Copy Schematic sheet
## Signature
```typescript
function copySchematicPage(
schematicPageUuid: string,
schematicUuid?: string,
): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
schematicPageUuid
</td><td>
string
</td><td>
Source schematic sheet UUID
</td></tr>
<tr><td>
schematicUuid
</td><td>
string
</td><td>
_(Optional)_ Target schematic UUID. If not specified, it is the current schematic
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
New schematic sheet UUID. If it is `undefined`<!-- -->, the copy failed
## Example
```javascript
// 1. 创建专用测试原理图(自带图页 p1 作为复制源),等 1.5s 同步
const schematicUuid = await eda.dmt_Schematic.createSchematic();
await new Promise(r => setTimeout(r, 1500));
const info = await eda.dmt_Schematic.getSchematicInfo(schematicUuid);
const sourcePageUuid = info.page[0].uuid;
// 2. 复制该图页,目标显式指定为同一原理图,返回新图页 UUID
const copiedUuid = await eda.dmt_Schematic.copySchematicPage(sourcePageUuid, schematicUuid);
await new Promise(r => setTimeout(r, 1500));
// 3. 回读副本图页,确认名称与归属
const copyPage = await eda.dmt_Schematic.getSchematicPageInfo(copiedUuid);
console.log('copiedUuid:', copiedUuid);
console.log('copyPageName:', copyPage?.name);
console.log('belongsToSchematic:', copyPage?.parentSchematicUuid === schematicUuid);
// 4. 清理本例创建的原理图(副本图页随之删除)
await new Promise(r => setTimeout(r, 1000));
const deleted = await eda.dmt_Schematic.deleteSchematic(schematicUuid);
console.log('deleted:', deleted);
```
### createschematic
# DMT\_Schematic.createSchematic() method
> 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.
Create Schematic
## Signature
```typescript
function createSchematic(boardName?: string): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
boardName
</td><td>
string
</td><td>
_(Optional)_ Name of the board it belongs to. If not specified, it is a free schematic
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
Schematic UUID, if it is `undefined` creation fails
## Example
```javascript
// 1. 创建原理图(不指定 boardName,得到游离原理图),返回新原理图 UUID
const schematicUuid = await eda.dmt_Schematic.createSchematic();
console.log('schematicUuid:', schematicUuid);
// 2. 等 1.5s 让原理图在工作区落地,回读确认(自带图页 p1)
await new Promise(r => setTimeout(r, 1500));
const info = await eda.dmt_Schematic.getSchematicInfo(schematicUuid);
console.log('name:', info?.name);
console.log('pages:', (info?.page || []).map(p => p.name).join(', '));
console.log('parentBoardName:', info?.parentBoardName);
// 3. 删除本例创建的原理图,保持工程整洁
await new Promise(r => setTimeout(r, 1000));
const deleted = await eda.dmt_Schematic.deleteSchematic(schematicUuid);
console.log('deleted:', deleted);
```
### createschematicpage
# DMT\_Schematic.createSchematicPage() method
> 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.
Create Schematic sheet
## Signature
```typescript
function createSchematicPage(schematicUuid: string): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
schematicUuid
</td><td>
string
</td><td>
UUID of the schematic it belongs to
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
Schematic sheet UUID, if it is `undefined` creation fails
## Example
```javascript
// 1. 创建专用测试原理图(自带图页 p1),等 1.5s 同步
const schematicUuid = await eda.dmt_Schematic.createSchematic();
await new Promise(r => setTimeout(r, 1500));
// 2. 在该原理图下创建新图页,返回图页 UUID
const pageUuid = await eda.dmt_Schematic.createSchematicPage(schematicUuid);
console.log('pageUuid:', pageUuid);
// 3. 等 1.5s 同步,回读图页属性,确认归属
await new Promise(r => setTimeout(r, 1500));
const pageInfo = await eda.dmt_Schematic.getSchematicPageInfo(pageUuid);
console.log('pageName:', pageInfo?.name);
console.log('belongsToSchematic:', pageInfo?.parentSchematicUuid === schematicUuid);
// 4. 清理本例创建的原理图(图页随原理图一起删除)
await new Promise(r => setTimeout(r, 1000));
const deleted = await eda.dmt_Schematic.deleteSchematic(schematicUuid);
console.log('deleted:', deleted);
```
### deleteschematic
# DMT\_Schematic.deleteSchematic() method
> 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.
Delete Schematic
## Signature
```typescript
function deleteSchematic(schematicUuid: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
schematicUuid
</td><td>
string
</td><td>
Schematic UUID
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
If the schematic is already associated with a reuse block (a reuse block symbol with the same name exists in the project library), deleting the schematic will also delete the associated PCB and reuse block symbol. If the reuse block symbol cannot be deleted, it will be skipped
## Example
```javascript
// 1. 创建专用测试原理图(避免误删工程里的现有原理图),等 1.5s 同步
const schematicUuid = await eda.dmt_Schematic.createSchematic();
await new Promise(r => setTimeout(r, 1500));
// 2. 删除该原理图
const deleted = await eda.dmt_Schematic.deleteSchematic(schematicUuid);
console.log('deleted:', deleted);
// 3. 回读确认已删除(返回 undefined 说明原理图已不存在)
await new Promise(r => setTimeout(r, 1500));
const info = await eda.dmt_Schematic.getSchematicInfo(schematicUuid);
console.log('info after delete:', info === undefined ? '已不存在' : info.name);
```
### deleteschematicpage
# DMT\_Schematic.deleteSchematicPage() method
> 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.
Delete Schematic sheet
## Signature
```typescript
function deleteSchematicPage(schematicPageUuid: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
schematicPageUuid
</td><td>
string
</td><td>
Schematic sheet UUID
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 创建专用测试原理图(自带图页 p1),等 1.5s 同步
const schematicUuid = await eda.dmt_Schematic.createSchematic();
await new Promise(r => setTimeout(r, 1500));
// 2. 再追加一个测试图页 p2 作为删除目标
const pageUuid = await eda.dmt_Schematic.createSchematicPage(schematicUuid);
await new Promise(r => setTimeout(r, 1500));
// 3. 删除测试图页 p2(只删这一页,原理图保留)
const deleted = await eda.dmt_Schematic.deleteSchematicPage(pageUuid);
console.log('deleted:', deleted);
// 4. 回读确认:图页已不存在,原理图回到只剩 p1
await new Promise(r => setTimeout(r, 1500));
const pageInfo = await eda.dmt_Schematic.getSchematicPageInfo(pageUuid);
console.log('page after delete:', pageInfo === undefined ? '已不存在' : pageInfo.name);
const info = await eda.dmt_Schematic.getSchematicInfo(schematicUuid);
console.log('remaining pages:', (info?.page || []).map(p => p.name).join(', '));
// 5. 清理测试原理图
await new Promise(r => setTimeout(r, 1000));
const deletedSch = await eda.dmt_Schematic.deleteSchematic(schematicUuid);
console.log('deleted:', deletedSch);
```
### getallschematicpagesinfo
# DMT\_Schematic.getAllSchematicPagesInfo() method
> 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.
Get all in the project schematic sheet detailed properties of
## Signature
```typescript
function getAllSchematicPagesInfo(): Promise<Array<IDMT_SchematicPageItem>>;
```
## Returns
Promise<Array<[IDMT\_SchematicPageItem](../interfaces/IDMT_SchematicPageItem.md)<!-- -->>>
Array of detailed properties of all schematic sheets
## Example
```javascript
// 1. 创建测试原理图并追加一页(共 2 页),保证列表里有新近创建的页
const schematicUuid = await eda.dmt_Schematic.createSchematic();
await new Promise(r => setTimeout(r, 1500));
await eda.dmt_Schematic.createSchematicPage(schematicUuid);
await new Promise(r => setTimeout(r, 1500));
// 2. 获取工程内所有图页的详细属性
const pages = await eda.dmt_Schematic.getAllSchematicPagesInfo();
// 3. 输出每页名称、UUID 与所属原理图,确认测试页在列
pages.slice(0, 10).forEach((p, i) => {
console.log(`page[${i}]:`, p.name, p.uuid, 'parent:', p.parentSchematicUuid);
});
console.log('total:', pages.length);
console.log('testPagesIncluded:', pages.filter(p => p.parentSchematicUuid === schematicUuid).length === 2);
// 4. 清理测试原理图
await new Promise(r => setTimeout(r, 1000));
const deleted = await eda.dmt_Schematic.deleteSchematic(schematicUuid);
console.log('deleted:', deleted);
```
### getallschematicsinfo
# DMT\_Schematic.getAllSchematicsInfo() method
> 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.
Get all in the project schematic detailed properties of
## Signature
```typescript
function getAllSchematicsInfo(): Promise<Array<IDMT_SchematicItem>>;
```
## Returns
Promise<Array<[IDMT\_SchematicItem](../interfaces/IDMT_SchematicItem.md)<!-- -->>>
Array of detailed properties of all schematics
## Example
```javascript
// 1. 创建一个测试原理图并等 1.5s 同步,保证列表里有新近创建的对象
const schematicUuid = await eda.dmt_Schematic.createSchematic();
await new Promise(r => setTimeout(r, 1500));
// 2. 获取所有原理图的详细属性
const schematics = await eda.dmt_Schematic.getAllSchematicsInfo();
// 3. 输出每个原理图的名称、UUID 与图页数,确认测试原理图在列
schematics.slice(0, 10).forEach((s, i) => {
console.log(`schematic[${i}]:`, s.name, s.uuid, 'pages:', (s.page || []).length, 'board:', s.parentBoardName ?? '游离');
});
console.log('total:', schematics.length);
console.log('testSchematicIncluded:', schematics.some(s => s.uuid === schematicUuid));
// 4. 清理测试原理图
await new Promise(r => setTimeout(r, 1000));
const deleted = await eda.dmt_Schematic.deleteSchematic(schematicUuid);
console.log('deleted:', deleted);
```
### getcurrentschematicallschematicpagesinfo
# DMT\_Schematic.getCurrentSchematicAllSchematicPagesInfo() method
> 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.
Get the detailed properties of all schematic sheets in the current schematic
## Signature
```typescript
function getCurrentSchematicAllSchematicPagesInfo(): Promise<Array<IDMT_SchematicPageItem>>;
```
## Returns
Promise<Array<[IDMT\_SchematicPageItem](../interfaces/IDMT_SchematicPageItem.md)<!-- -->>>
Array of detailed properties of all schematic sheets
## Example
```javascript
// 1. 创建专用测试原理图(自带图页 p1)并追加一页
const schematicUuid = await eda.dmt_Schematic.createSchematic();
await new Promise(r => setTimeout(r, 1500));
await eda.dmt_Schematic.createSchematicPage(schematicUuid);
await new Promise(r => setTimeout(r, 1500));
// 2. 打开测试原理图的自带图页 p1,把焦点切到该原理图上
const info = await eda.dmt_Schematic.getSchematicInfo(schematicUuid);
await eda.dmt_EditorControl.openDocument(info.page[0].uuid);
await new Promise(r => setTimeout(r, 1000));
// 3. 获取当前原理图内所有图页的详细属性
const pages = await eda.dmt_Schematic.getCurrentSchematicAllSchematicPagesInfo();
// 4. 输出每页名称与 UUID,确认全部归属当前原理图
pages.forEach((p, i) => {
console.log(`page[${i}]:`, p.name, p.uuid);
});
console.log('total:', pages.length);
console.log('allBelongToCurrent:', pages.every(p => p.parentSchematicUuid === schematicUuid));
// 5. 清理测试原理图(处于打开状态也可以直接删除)
await new Promise(r => setTimeout(r, 1000));
const deleted = await eda.dmt_Schematic.deleteSchematic(schematicUuid);
console.log('deleted:', deleted);
```
### getcurrentschematicinfo
# DMT\_Schematic.getCurrentSchematicInfo() method
> 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.
Get detailed properties of Current schematic
## Signature
```typescript
function getCurrentSchematicInfo(): Promise<IDMT_SchematicItem | undefined>;
```
## Returns
Promise<[IDMT\_SchematicItem](../interfaces/IDMT_SchematicItem.md) \| undefined>
Schematic detailed properties of; if it is `undefined`<!-- -->, the retrieval failed
## Remarks
It will get the detailed properties of the schematic associated with the currently open schematic sheet that has the last input focus
## Example
```javascript
// 1. 创建专用测试原理图(自带图页 p1),打开该页让焦点落到测试原理图上
const schematicUuid = await eda.dmt_Schematic.createSchematic();
await new Promise(r => setTimeout(r, 1500));
const info = await eda.dmt_Schematic.getSchematicInfo(schematicUuid);
await eda.dmt_EditorControl.openDocument(info.page[0].uuid);
await new Promise(r => setTimeout(r, 1000));
// 2. 获取当前焦点原理图的详细属性
const current = await eda.dmt_Schematic.getCurrentSchematicInfo();
// 3. 输出原理图的名称、UUID 与图页,确认正是测试原理图
console.log('name:', current?.name);
console.log('schematicUuid:', current?.uuid);
console.log('pages:', (current?.page || []).map(p => p.name).join(', '));
console.log('isFocusedSchematic:', current?.uuid === schematicUuid);
// 4. 清理测试原理图(处于打开状态也可以直接删除)
await new Promise(r => setTimeout(r, 1000));
const deleted = await eda.dmt_Schematic.deleteSchematic(schematicUuid);
console.log('deleted:', deleted);
```
### getcurrentschematicpageinfo
# DMT\_Schematic.getCurrentSchematicPageInfo() method
> 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.
Get detailed properties of Current schematic sheet
## Signature
```typescript
function getCurrentSchematicPageInfo(): Promise<IDMT_SchematicPageItem | undefined>;
```
## Returns
Promise<[IDMT\_SchematicPageItem](../interfaces/IDMT_SchematicPageItem.md) \| undefined>
Schematic sheet detailed properties of; if it is `undefined`<!-- -->, the retrieval failed
## Remarks
It will get the detailed properties of the currently open schematic sheet that has the last input focus
## Example
```javascript
// 1. 创建专用测试原理图(自带图页 p1)并打开该页,让焦点落到测试页上
const schematicUuid = await eda.dmt_Schematic.createSchematic();
await new Promise(r => setTimeout(r, 1500));
const info = await eda.dmt_Schematic.getSchematicInfo(schematicUuid);
const pageUuid = info.page[0].uuid;
await eda.dmt_EditorControl.openDocument(pageUuid);
await new Promise(r => setTimeout(r, 1000));
// 2. 获取当前焦点图页的详细属性
const currentPage = await eda.dmt_Schematic.getCurrentSchematicPageInfo();
// 3. 输出图页名称、UUID、所属原理图与明细表开关,确认正是测试页
console.log('name:', currentPage?.name);
console.log('pageUuid:', currentPage?.uuid);
console.log('parentSchematicUuid:', currentPage?.parentSchematicUuid);
console.log('showTitleBlock:', currentPage?.showTitleBlock);
console.log('isFocusedPage:', currentPage?.uuid === pageUuid);
// 4. 清理测试原理图(处于打开状态也可以直接删除)
await new Promise(r => setTimeout(r, 1000));
const deleted = await eda.dmt_Schematic.deleteSchematic(schematicUuid);
console.log('deleted:', deleted);
```
### getschematicinfo
# DMT\_Schematic.getSchematicInfo() method
> 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.
Get detailed properties of Schematic
## Signature
```typescript
function getSchematicInfo(schematicUuid: string): Promise<IDMT_SchematicItem | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
schematicUuid
</td><td>
string
</td><td>
Schematic UUID
</td></tr>
</tbody></table>
## Returns
Promise<[IDMT\_SchematicItem](../interfaces/IDMT_SchematicItem.md) \| undefined>
Schematic detailed properties of; if it is `undefined`<!-- -->, the retrieval failed
## Example
```javascript
// 1. 创建测试原理图并等 1.5s 同步
const schematicUuid = await eda.dmt_Schematic.createSchematic();
await new Promise(r => setTimeout(r, 1500));
// 2. 按 UUID 查询原理图详细属性
const info = await eda.dmt_Schematic.getSchematicInfo(schematicUuid);
// 3. 输出属性
console.log('name:', info?.name);
console.log('itemType:', info?.itemType);
console.log('parentProjectUuid:', info?.parentProjectUuid);
console.log('pages:', (info?.page || []).map(p => p.name).join(', '));
// 4. 清理测试原理图
await new Promise(r => setTimeout(r, 1000));
const deleted = await eda.dmt_Schematic.deleteSchematic(schematicUuid);
console.log('deleted:', deleted);
```
### getschematicpageinfo
# DMT\_Schematic.getSchematicPageInfo() method
> 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.
Get detailed properties of Schematic sheet
## Signature
```typescript
function getSchematicPageInfo(
schematicPageUuid: string,
): Promise<IDMT_SchematicPageItem | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
schematicPageUuid
</td><td>
string
</td><td>
Schematic sheet UUID
</td></tr>
</tbody></table>
## Returns
Promise<[IDMT\_SchematicPageItem](../interfaces/IDMT_SchematicPageItem.md) \| undefined>
Schematic sheet detailed properties of; if it is `undefined`<!-- -->, the retrieval failed
## Example
```javascript
// 1. 创建测试原理图(自带图页 p1)并等 1.5s 同步
const schematicUuid = await eda.dmt_Schematic.createSchematic();
await new Promise(r => setTimeout(r, 1500));
const info = await eda.dmt_Schematic.getSchematicInfo(schematicUuid);
const pageUuid = info.page[0].uuid;
// 2. 按 UUID 查询图页详细属性
const pageInfo = await eda.dmt_Schematic.getSchematicPageInfo(pageUuid);
// 3. 输出属性
console.log('name:', pageInfo?.name);
console.log('itemType:', pageInfo?.itemType);
console.log('parentSchematicUuid:', pageInfo?.parentSchematicUuid);
console.log('showTitleBlock:', pageInfo?.showTitleBlock);
console.log('titleBlockFields:', Object.keys(pageInfo?.titleBlockData || {}).length);
// 4. 清理测试原理图
await new Promise(r => setTimeout(r, 1000));
const deleted = await eda.dmt_Schematic.deleteSchematic(schematicUuid);
console.log('deleted:', deleted);
```
### modifyschematicname
# DMT\_Schematic.modifySchematicName() method
> 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.
Modify Schematic name
## Signature
```typescript
function modifySchematicName(schematicUuid: string, schematicName: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
schematicUuid
</td><td>
string
</td><td>
Schematic UUID
</td></tr>
<tr><td>
schematicName
</td><td>
string
</td><td>
Schematic name
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether Modify Successful
## Remarks
If the schematic is already associated with a reuse block (a reuse block symbol with the same name exists in the project library), modifying the name will also modify the reuse block symbol name and the associated PCB name
## Example
```javascript
// 1. 创建专用测试原理图(自带图页 p1)并等 1.5s 同步
const schematicUuid = await eda.dmt_Schematic.createSchematic();
await new Promise(r => setTimeout(r, 1500));
// 2. 打开自带图页 p1(改名只对已打开的原理图生效)
const info = await eda.dmt_Schematic.getSchematicInfo(schematicUuid);
await eda.dmt_EditorControl.openDocument(info.page[0].uuid);
await new Promise(r => setTimeout(r, 1000));
// 3. 修改原理图名称(只对本例创建的测试原理图改名)
const newName = '嘉立创示例_原理图新名称';
const renamed = await eda.dmt_Schematic.modifySchematicName(schematicUuid, newName);
console.log('renamed:', renamed);
// 4. 等 1.5s 让改名同步,回读验证(英文名可能被归一化为小写,按不区分大小写比较)
await new Promise(r => setTimeout(r, 1500));
const after = await eda.dmt_Schematic.getSchematicInfo(schematicUuid);
console.log('renamedTo:', after?.name);
console.log('renameVerified:', (after?.name ?? '').toLowerCase() === newName.toLowerCase());
// 5. 清理测试原理图,保持工程整洁
await new Promise(r => setTimeout(r, 1000));
const deleted = await eda.dmt_Schematic.deleteSchematic(schematicUuid);
console.log('deleted:', deleted);
```
### modifyschematicpagename
# DMT\_Schematic.modifySchematicPageName() method
> 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.
Modify Schematic sheet name
## Signature
```typescript
function modifySchematicPageName(
schematicPageUuid: string,
schematicPageName: string,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
schematicPageUuid
</td><td>
string
</td><td>
Schematic sheet UUID
</td></tr>
<tr><td>
schematicPageName
</td><td>
string
</td><td>
Schematic sheet name
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether Modify Successful
## Example
```javascript
// 1. 创建专用测试原理图(自带图页 p1 作为改名目标)并等 1.5s 同步
const schematicUuid = await eda.dmt_Schematic.createSchematic();
await new Promise(r => setTimeout(r, 1500));
const info = await eda.dmt_Schematic.getSchematicInfo(schematicUuid);
const pageUuid = info.page[0].uuid;
// 2. 修改图页名称(只对本例创建的测试图页改名)
const newName = '嘉立创示例_电源页';
const renamed = await eda.dmt_Schematic.modifySchematicPageName(pageUuid, newName);
console.log('renamed:', renamed);
// 3. 等 1.5s 让改名同步,回读验证(英文名可能被归一化为小写,按不区分大小写比较)
await new Promise(r => setTimeout(r, 1500));
const after = await eda.dmt_Schematic.getSchematicPageInfo(pageUuid);
console.log('renamedTo:', after?.name);
console.log('renameVerified:', (after?.name ?? '').toLowerCase() === newName.toLowerCase());
// 4. 清理测试原理图,保持工程整洁
await new Promise(r => setTimeout(r, 1000));
const deleted = await eda.dmt_Schematic.deleteSchematic(schematicUuid);
console.log('deleted:', deleted);
```
### modifyschematicpagetitleblock
# DMT\_Schematic.modifySchematicPageTitleBlock() method
> 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.
Modify the title block of a schematic sheet
## Signature
```typescript
function modifySchematicPageTitleBlock(
showTitleBlock?: boolean,
titleBlockData?: Record<string, { showTitle?: boolean; showValue?: boolean; value?: any }>,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
showTitleBlock
</td><td>
boolean
</td><td>
_(Optional)_ Whether to show the title block. If undefined, the current state will be kept
</td></tr>
<tr><td>
titleBlockData
</td><td>
Record<string, { showTitle?: boolean; showValue?: boolean; value?: any }>
</td><td>
_(Optional)_ The title block items to be modified and their modified values
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the modification was successful. If `showTitleBlock` and `titleBlockData` are not passed in, `false` will be returned. Note that if unrecognized title block items exist but the program does not report an error, `true` will be returned because the unrecognized items are ignored
## Remarks
`titleBlockData` only needs to pass in any title block items to be modified as `key`<!-- -->, along with the values to modify them to. Any unrecognized title block items will be ignored, and any unpassed items and values will remain in their default state
## Example
```javascript
// 1. 创建专用测试原理图并打开自带图页 p1,让焦点落到目标页上
const schematicUuid = await eda.dmt_Schematic.createSchematic();
await new Promise(r => setTimeout(r, 1500));
const info = await eda.dmt_Schematic.getSchematicInfo(schematicUuid);
const pageUuid = info.page[0].uuid;
await eda.dmt_EditorControl.openDocument(pageUuid);
await new Promise(r => setTimeout(r, 1000));
// 2. 修改明细表:显示明细表,并把"公司"改为示例值(三个字段缺一不可)
const modified = await eda.dmt_Schematic.modifySchematicPageTitleBlock(true, {
Company: { showTitle: true, showValue: true, value: '嘉立创示例科技' },
});
console.log('modified:', modified);
// 3. 等 1.5s 同步,回读验证明细项已更新
await new Promise(r => setTimeout(r, 1500));
const after = await eda.dmt_Schematic.getSchematicPageInfo(pageUuid);
console.log('showTitleBlock:', after?.showTitleBlock);
console.log('company:', after?.titleBlockData?.Company?.value);
console.log('modifyVerified:', after?.titleBlockData?.Company?.value === '嘉立创示例科技');
// 4. 清理测试原理图,保持工程整洁
await new Promise(r => setTimeout(r, 1000));
const deleted = await eda.dmt_Schematic.deleteSchematic(schematicUuid);
console.log('deleted:', deleted);
```
### reorderschematicpages
# DMT\_Schematic.reorderSchematicPages() method
> 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.
Reorder schematic sheets
## Signature
```typescript
function reorderSchematicPages(
schematicUuid: string,
schematicPageItemsArray: Array<IDMT_SchematicPageItem>,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
schematicUuid
</td><td>
string
</td><td>
The UUID of the schematic associated with the sheets being sorted
</td></tr>
<tr><td>
schematicPageItemsArray
</td><td>
Array<[IDMT\_SchematicPageItem](../interfaces/IDMT_SchematicPageItem.md)<!-- -->>
</td><td>
Array of all schematic sheet properties
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Sorting whether the operation is successful
## Remarks
Here, the array of source schematic sheet properties needs to be obtained through [DMT\_Schematic.getAllSchematicPagesInfo()](./DMT_Schematic.md) or other upstream methods. After sorting the array, pass it in
## Example
```javascript
// 1. 创建专用测试原理图(自带图页 p1)并再追加两页,凑出可排序的页序列
const schematicUuid = await eda.dmt_Schematic.createSchematic();
await new Promise(r => setTimeout(r, 1500));
await eda.dmt_Schematic.createSchematicPage(schematicUuid);
await new Promise(r => setTimeout(r, 1500));
await eda.dmt_Schematic.createSchematicPage(schematicUuid);
await new Promise(r => setTimeout(r, 1500));
// 2. 从上游接口取得该原理图的全部图页,输出当前顺序
const allPages = await eda.dmt_Schematic.getAllSchematicPagesInfo();
const myPages = allPages.filter(p => p.parentSchematicUuid === schematicUuid);
console.log('orderBefore:', myPages.map(p => p.name).join(' -> '));
// 3. 反转页序列后传入,执行重排
const reversed = [...myPages].reverse();
const reorderOk = await eda.dmt_Schematic.reorderSchematicPages(schematicUuid, reversed);
console.log('reorderOk:', reorderOk);
// 4. 等 1.5s 同步,回读当前页顺序
await new Promise(r => setTimeout(r, 1500));
const after = await eda.dmt_Schematic.getSchematicInfo(schematicUuid);
console.log('orderAfter:', (after?.page || []).map(p => p.name).join(' -> '));
// 5. 清理测试原理图,保持工程整洁
await new Promise(r => setTimeout(r, 1000));
const deleted = await eda.dmt_Schematic.deleteSchematic(schematicUuid);
console.log('deleted:', deleted);
```
references/classes/DMT_Workspace.md
# DMT\_Workspace class
Document tree / Workspace class
## Signature
```typescript
class DMT_Workspace
```
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[getAllWorkspacesInfo()](./DMT_Workspace.md)
</td><td>
</td><td>
Get the detailed properties of all workspaces
</td></tr>
<tr><td>
[getCurrentWorkspaceInfo()](./DMT_Workspace.md)
</td><td>
</td><td>
Get the detailed properties of the current workspace
</td></tr>
<tr><td>
[toggleToWorkspace(workspaceUuid)](./DMT_Workspace.md)
</td><td>
</td><td>
Switch to workspace
</td></tr>
</tbody></table>
---
## 方法详情
### getallworkspacesinfo
# DMT\_Workspace.getAllWorkspacesInfo() method
Get the detailed properties of all workspaces
## Signature
```typescript
function getAllWorkspacesInfo(): Promise<Array<IDMT_WorkspaceItem>>;
```
## Returns
Promise<Array<[IDMT\_WorkspaceItem](../interfaces/IDMT_WorkspaceItem.md)<!-- -->>>
Detailed properties of all workspaces
## Example
```javascript
// 1. 获取所有工作区
const workspaces = await eda.dmt_Workspace.getAllWorkspacesInfo();
// 2. 输出工作区数量与每个工作区的属性(name/uuid/itemType)
console.log('工作区数量:', workspaces.length);
workspaces.forEach((ws, i) => {
console.log(`工作区${i + 1}:`, ws.name, 'uuid:', ws.uuid);
});
```
### getcurrentworkspaceinfo
# DMT\_Workspace.getCurrentWorkspaceInfo() method
Get the detailed properties of the current workspace
## Signature
```typescript
function getCurrentWorkspaceInfo(): Promise<IDMT_WorkspaceItem | undefined>;
```
## Returns
Promise<[IDMT\_WorkspaceItem](../interfaces/IDMT_WorkspaceItem.md) \| undefined>
Detailed properties of the workspace. If it is `undefined`<!-- -->, the retrieval failed
## Remarks
It will get the detailed properties of the current workspace
## Example
```javascript
// 1. 获取当前工作区属性
const workspace = await eda.dmt_Workspace.getCurrentWorkspaceInfo();
// 2. 输出当前工作区属性(uuid 可直接用作 toggleToWorkspace 的切换参数)
console.log('当前工作区名称:', workspace?.name);
console.log('当前工作区 uuid:', workspace?.uuid);
```
### toggletoworkspace
# DMT\_Workspace.toggleToWorkspace() method
Switch to workspace
## Signature
```typescript
function toggleToWorkspace(workspaceUuid?: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
workspaceUuid
</td><td>
string
</td><td>
_(Optional)_ Workspace UUID. If not specified, it will switch to the personal workspace
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the switch operation was successful
## Example
```javascript
// 1. 记录切换前的工作区(演示结束后切回,恢复现场)
const before = await eda.dmt_Workspace.getCurrentWorkspaceInfo();
// 2. 获取所有工作区,选一个非当前的作为切换目标;只有当前一个时切换自身
const workspaces = await eda.dmt_Workspace.getAllWorkspacesInfo();
const target = workspaces.find(ws => ws.uuid !== before.uuid) || before;
// 3. 切换到目标工作区
const toggled = await eda.dmt_Workspace.toggleToWorkspace(target.uuid);
console.log('切换是否成功:', toggled);
// 4. 回读当前工作区,确认已切换到目标
const now = await eda.dmt_Workspace.getCurrentWorkspaceInfo();
console.log('切换后工作区:', now.name, 'uuid:', now.uuid);
// 5. 切回原工作区,恢复现场
const restored = await eda.dmt_Workspace.toggleToWorkspace(before.uuid);
console.log('切回是否成功:', restored);
```
references/classes/EDA.md
# eda variable
## Signature
```typescript
eda: EDA;
```
---
## 属性详情
### dmt_board
# EDA.dmt\_Board property
## Signature
```typescript
function dmt_Board: DMT_Board;
```
### dmt_editorcontrol
# EDA.dmt\_EditorControl property
## Signature
```typescript
function dmt_EditorControl: DMT_EditorControl;
```
### dmt_event
# EDA.dmt\_Event property
## Signature
```typescript
function dmt_Event: DMT_Event;
```
### dmt_folder
# EDA.dmt\_Folder property
## Signature
```typescript
function dmt_Folder: DMT_Folder;
```
### dmt_panel
# EDA.dmt\_Panel property
## Signature
```typescript
function dmt_Panel: DMT_Panel;
```
### dmt_pcb
# EDA.dmt\_Pcb property
## Signature
```typescript
function dmt_Pcb: DMT_Pcb;
```
### dmt_project
# EDA.dmt\_Project property
## Signature
```typescript
function dmt_Project: DMT_Project;
```
### dmt_schematic
# EDA.dmt\_Schematic property
## Signature
```typescript
function dmt_Schematic: DMT_Schematic;
```
### dmt_selectcontrol
# EDA.dmt\_SelectControl property
## Signature
```typescript
function dmt_SelectControl: DMT_SelectControl;
```
### dmt_team
# EDA.dmt\_Team property
## Signature
```typescript
function dmt_Team: DMT_Team;
```
### dmt_workspace
# EDA.dmt\_Workspace property
## Signature
```typescript
function dmt_Workspace: DMT_Workspace;
```
### lib_3dmodel
# EDA.lib\_3DModel property
## Signature
```typescript
function lib_3DModel: LIB_3DModel;
```
### lib_cbb
# EDA.lib\_Cbb property
## Signature
```typescript
function lib_Cbb: LIB_Cbb;
```
### lib_classification
# EDA.lib\_Classification property
## Signature
```typescript
function lib_Classification: LIB_Classification;
```
### lib_device
# EDA.lib\_Device property
## Signature
```typescript
function lib_Device: LIB_Device;
```
### lib_footprint
# EDA.lib\_Footprint property
## Signature
```typescript
function lib_Footprint: LIB_Footprint;
```
### lib_librarieslist
# EDA.lib\_LibrariesList property
## Signature
```typescript
function lib_LibrariesList: LIB_LibrariesList;
```
### lib_panellibrary
# EDA.lib\_PanelLibrary property
## Signature
```typescript
function lib_PanelLibrary: LIB_PanelLibrary;
```
### lib_selectcontrol
# EDA.lib\_SelectControl property
## Signature
```typescript
function lib_SelectControl: LIB_SelectControl;
```
### lib_simulationmodel
# EDA.lib\_SimulationModel property
## Signature
```typescript
function lib_SimulationModel: LIB_SimulationModel;
```
### lib_symbol
# EDA.lib\_Symbol property
## Signature
```typescript
function lib_Symbol: LIB_Symbol;
```
### pcb_document
# EDA.pcb\_Document property
## Signature
```typescript
function pcb_Document: PCB_Document;
```
### pcb_drc
# EDA.pcb\_Drc property
## Signature
```typescript
function pcb_Drc: PCB_Drc;
```
### pcb_event
# EDA.pcb\_Event property
## Signature
```typescript
function pcb_Event: PCB_Event;
```
### pcb_imagetool
# EDA.pcb\_ImageTool property
## Signature
```typescript
function pcb_ImageTool: PCB_ImageTool;
```
### pcb_layer
# EDA.pcb\_Layer property
## Signature
```typescript
function pcb_Layer: PCB_Layer;
```
### pcb_manufacturedata
# EDA.pcb\_ManufactureData property
## Signature
```typescript
function pcb_ManufactureData: PCB_ManufactureData;
```
### pcb_mathpolygon
# EDA.pcb\_MathPolygon property
## Signature
```typescript
function pcb_MathPolygon: PCB_MathPolygon;
```
### pcb_net
# EDA.pcb\_Net property
## Signature
```typescript
function pcb_Net: PCB_Net;
```
### pcb_primitive
# EDA.pcb\_Primitive property
## Signature
```typescript
function pcb_Primitive: PCB_Primitive;
```
### pcb_primitivearc
# EDA.pcb\_PrimitiveArc property
## Signature
```typescript
function pcb_PrimitiveArc: PCB_PrimitiveArc;
```
### pcb_primitiveattribute
# EDA.pcb\_PrimitiveAttribute property
## Signature
```typescript
function pcb_PrimitiveAttribute: PCB_PrimitiveAttribute;
```
### pcb_primitivecomponent
# EDA.pcb\_PrimitiveComponent property
## Signature
```typescript
function pcb_PrimitiveComponent: PCB_PrimitiveComponent;
```
### pcb_primitivedimension
# EDA.pcb\_PrimitiveDimension property
## Signature
```typescript
function pcb_PrimitiveDimension: PCB_PrimitiveDimension;
```
### pcb_primitivefill
# EDA.pcb\_PrimitiveFill property
## Signature
```typescript
function pcb_PrimitiveFill: PCB_PrimitiveFill;
```
### pcb_primitiveimage
# EDA.pcb\_PrimitiveImage property
## Signature
```typescript
function pcb_PrimitiveImage: PCB_PrimitiveImage;
```
### pcb_primitiveline
# EDA.pcb\_PrimitiveLine property
## Signature
```typescript
function pcb_PrimitiveLine: PCB_PrimitiveLine;
```
### pcb_primitiveobject
# EDA.pcb\_PrimitiveObject property
## Signature
```typescript
function pcb_PrimitiveObject: PCB_PrimitiveObject;
```
### pcb_primitivepad
# EDA.pcb\_PrimitivePad property
## Signature
```typescript
function pcb_PrimitivePad: PCB_PrimitivePad;
```
### pcb_primitivepolyline
# EDA.pcb\_PrimitivePolyline property
## Signature
```typescript
function pcb_PrimitivePolyline: PCB_PrimitivePolyline;
```
### pcb_primitivepour
# EDA.pcb\_PrimitivePour property
## Signature
```typescript
function pcb_PrimitivePour: PCB_PrimitivePour;
```
### pcb_primitivepoured
# EDA.pcb\_PrimitivePoured property
## Signature
```typescript
function pcb_PrimitivePoured: PCB_PrimitivePoured;
```
### pcb_primitiveregion
# EDA.pcb\_PrimitiveRegion property
## Signature
```typescript
function pcb_PrimitiveRegion: PCB_PrimitiveRegion;
```
### pcb_primitivestring
# EDA.pcb\_PrimitiveString property
## Signature
```typescript
function pcb_PrimitiveString: PCB_PrimitiveString;
```
### pcb_primitivevia
# EDA.pcb\_PrimitiveVia property
## Signature
```typescript
function pcb_PrimitiveVia: PCB_PrimitiveVia;
```
### pcb_raytracerengine
# EDA.pcb\_RayTracerEngine property
## Signature
```typescript
function pcb_RayTracerEngine: PCB_RayTracerEngine;
```
### pcb_selectcontrol
# EDA.pcb\_SelectControl property
## Signature
```typescript
function pcb_SelectControl: PCB_SelectControl;
```
### pcb_tool
# EDA.pcb\_Tool property
## Signature
```typescript
function pcb_Tool: PCB_Tool;
```
### pnl_document
# EDA.pnl\_Document property
## Signature
```typescript
function pnl_Document: PNL_Document;
```
### sch_document
# EDA.sch\_Document property
## Signature
```typescript
function sch_Document: SCH_Document;
```
### sch_drc
# EDA.sch\_Drc property
## Signature
```typescript
function sch_Drc: SCH_Drc;
```
### sch_event
# EDA.sch\_Event property
## Signature
```typescript
function sch_Event: SCH_Event;
```
### sch_manufacturedata
# EDA.sch\_ManufactureData property
## Signature
```typescript
function sch_ManufactureData: SCH_ManufactureData;
```
### sch_net
# EDA.sch\_Net property
## Signature
```typescript
function sch_Net: SCH_Net;
```
### sch_netlist
# EDA.sch\_Netlist property
## Signature
```typescript
function sch_Netlist: SCH_Netlist;
```
### sch_primitive
# EDA.sch\_Primitive property
## Signature
```typescript
function sch_Primitive: SCH_Primitive;
```
### sch_primitivearc
# EDA.sch\_PrimitiveArc property
## Signature
```typescript
function sch_PrimitiveArc: SCH_PrimitiveArc;
```
### sch_primitiveattribute
# EDA.sch\_PrimitiveAttribute property
## Signature
```typescript
function sch_PrimitiveAttribute: SCH_PrimitiveAttribute;
```
### sch_primitivebus
# EDA.sch\_PrimitiveBus property
## Signature
```typescript
function sch_PrimitiveBus: SCH_PrimitiveBus;
```
### sch_primitivecircle
# EDA.sch\_PrimitiveCircle property
## Signature
```typescript
function sch_PrimitiveCircle: SCH_PrimitiveCircle;
```
### sch_primitivecomponent
# EDA.sch\_PrimitiveComponent property
## Signature
```typescript
function sch_PrimitiveComponent: SCH_PrimitiveComponent;
```
### sch_primitiveobject
# EDA.sch\_PrimitiveObject property
## Signature
```typescript
function sch_PrimitiveObject: SCH_PrimitiveObject;
```
### sch_primitivepin
# EDA.sch\_PrimitivePin property
## Signature
```typescript
function sch_PrimitivePin: SCH_PrimitivePin;
```
### sch_primitivepolygon
# EDA.sch\_PrimitivePolygon property
## Signature
```typescript
function sch_PrimitivePolygon: SCH_PrimitivePolygon;
```
### sch_primitiverectangle
# EDA.sch\_PrimitiveRectangle property
## Signature
```typescript
function sch_PrimitiveRectangle: SCH_PrimitiveRectangle;
```
### sch_primitivetext
# EDA.sch\_PrimitiveText property
## Signature
```typescript
function sch_PrimitiveText: SCH_PrimitiveText;
```
### sch_primitivewire
# EDA.sch\_PrimitiveWire property
## Signature
```typescript
function sch_PrimitiveWire: SCH_PrimitiveWire;
```
### sch_selectcontrol
# EDA.sch\_SelectControl property
## Signature
```typescript
function sch_SelectControl: SCH_SelectControl;
```
### sch_simulationengine
# EDA.sch\_SimulationEngine property
## Signature
```typescript
function sch_SimulationEngine: SCH_SimulationEngine;
```
### sch_utils
# EDA.sch\_Utils property
## Signature
```typescript
function sch_Utils: SCH_Utils;
```
### sys_clienturl
# EDA.sys\_ClientUrl property
## Signature
```typescript
function sys_ClientUrl: SYS_ClientUrl;
```
### sys_dialog
# EDA.sys\_Dialog property
## Signature
```typescript
function sys_Dialog: SYS_Dialog;
```
### sys_environment
# EDA.sys\_Environment property
## Signature
```typescript
function sys_Environment: SYS_Environment;
```
### sys_externalapi
# EDA.sys\_ExternalApi property
## Signature
```typescript
function sys_ExternalApi: SYS_ExternalApi;
```
### sys_filemanager
# EDA.sys\_FileManager property
## Signature
```typescript
function sys_FileManager: SYS_FileManager;
```
### sys_filesystem
# EDA.sys\_FileSystem property
## Signature
```typescript
function sys_FileSystem: SYS_FileSystem;
```
### sys_fontmanager
# EDA.sys\_FontManager property
## Signature
```typescript
function sys_FontManager: SYS_FontManager;
```
### sys_formatconversion
# EDA.sys\_FormatConversion property
## Signature
```typescript
function sys_FormatConversion: SYS_FormatConversion;
```
### sys_headermenu
# EDA.sys\_HeaderMenu property
## Signature
```typescript
function sys_HeaderMenu: SYS_HeaderMenu;
```
### sys_help
# EDA.sys\_Help property
## Signature
```typescript
function sys_Help: SYS_Help;
```
### sys_i18n
# EDA.sys\_I18n property
## Signature
```typescript
function sys_I18n: SYS_I18n;
```
### sys_iframe
# EDA.sys\_IFrame property
## Signature
```typescript
function sys_IFrame: SYS_IFrame;
```
### sys_loadingandprogressbar
# EDA.sys\_LoadingAndProgressBar property
## Signature
```typescript
function sys_LoadingAndProgressBar: SYS_LoadingAndProgressBar;
```
### sys_log
# EDA.sys\_Log property
## Signature
```typescript
function sys_Log: SYS_Log;
```
### sys_math
# EDA.sys\_Math property
## Signature
```typescript
function sys_Math: SYS_Math;
```
### sys_message
# EDA.sys\_Message property
## Signature
```typescript
function sys_Message: SYS_Message;
```
### sys_messagebox
# EDA.sys\_MessageBox property
## Signature
```typescript
function sys_MessageBox: SYS_MessageBox;
```
### sys_messagebus
# EDA.sys\_MessageBus property
## Signature
```typescript
function sys_MessageBus: SYS_MessageBus;
```
### sys_panelcontrol
# EDA.sys\_PanelControl property
## Signature
```typescript
function sys_PanelControl: SYS_PanelControl;
```
### sys_rightclickmenu
# EDA.sys\_RightClickMenu property
## Signature
```typescript
function sys_RightClickMenu: SYS_RightClickMenu;
```
### sys_setting
# EDA.sys\_Setting property
## Signature
```typescript
function sys_Setting: SYS_Setting;
```
### sys_shortcutkey
# EDA.sys\_ShortcutKey property
## Signature
```typescript
function sys_ShortcutKey: SYS_ShortcutKey;
```
### sys_storage
# EDA.sys\_Storage property
## Signature
```typescript
function sys_Storage: SYS_Storage;
```
### sys_timer
# EDA.sys\_Timer property
## Signature
```typescript
function sys_Timer: SYS_Timer;
```
### sys_toastmessage
# EDA.sys\_ToastMessage property
## Signature
```typescript
function sys_ToastMessage: SYS_ToastMessage;
```
### sys_tool
# EDA.sys\_Tool property
## Signature
```typescript
function sys_Tool: SYS_Tool;
```
### sys_unit
# EDA.sys\_Unit property
## Signature
```typescript
function sys_Unit: SYS_Unit;
```
### sys_websocket
# EDA.sys\_WebSocket property
## Signature
```typescript
function sys_WebSocket: SYS_WebSocket;
```
### sys_window
# EDA.sys\_Window property
## Signature
```typescript
function sys_Window: SYS_Window;
```
references/classes/IPCB_ComplexPolygon.md
# IPCB\_ComplexPolygon class
Complex polygon
## Signature
```typescript
class IPCB_ComplexPolygon
```
## Remarks
developer.mozilla.org/zh-CN/docs/Web/SVG/Attribute/fill-rule \| fill-rule<!-- -->} to combine them to achieve Boolean operations on polygons.
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[addSource(complexPolygon)](./IPCB_ComplexPolygon.md)
</td><td>
</td><td>
Add Polygon data
</td></tr>
<tr><td>
[getCenter()](./IPCB_ComplexPolygon.md)
</td><td>
</td><td>
**_(BETA)_** Get Complex polygon center point
</td></tr>
<tr><td>
[getSource()](./IPCB_ComplexPolygon.md)
</td><td>
</td><td>
Get Polygon data
</td></tr>
<tr><td>
[getSourceStrictComplex()](./IPCB_ComplexPolygon.md)
</td><td>
</td><td>
Get Complex polygon data
</td></tr>
<tr><td>
[toPolygon()](./IPCB_ComplexPolygon.md)
</td><td>
</td><td>
Split is single polygon array
</td></tr>
</tbody></table>
---
## 方法详情
### addsource
# IPCB\_ComplexPolygon.addSource() method
Add Polygon data
## Signature
```typescript
function addSource(
complexPolygon:
| TPCB_PolygonSourceArray
| Array<TPCB_PolygonSourceArray>
| IPCB_Polygon
| Array<IPCB_Polygon>,
): IPCB_ComplexPolygon;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
complexPolygon
</td><td>
[TPCB\_PolygonSourceArray](../types/TPCB_PolygonSourceArray.md) \| Array<[TPCB\_PolygonSourceArray](../types/TPCB_PolygonSourceArray.md)<!-- -->> \| [IPCB\_Polygon](./IPCB_Polygon.md) \| Array<[IPCB\_Polygon](./IPCB_Polygon.md)<!-- -->>
</td><td>
Complex polygon data
</td></tr>
</tbody></table>
## Returns
[IPCB\_ComplexPolygon](./IPCB_ComplexPolygon.md)
Complex polygon object
## Example
```javascript
// 1. 先创建一个矩形外框复杂多边形(纯数据对象,此时画布上还看不到)
const complexPolygon = eda.pcb_MathPolygon.createComplexPolygon(['R', 1000, 1000, 500, 300, 0, 0]);
// 2. 再创建一个圆形单多边形对象,作为要追加的第二块数据
const circlePolygon = eda.pcb_MathPolygon.createPolygon(['CIRCLE', 1250, 1150, 80]);
// 3. 追加进复杂多边形(返回对象本身,支持链式调用)
complexPolygon.addSource(circlePolygon);
// 4. 用组合后的复杂多边形创建填充图元,让结果在画布上可见
const fill = await eda.pcb_PrimitiveFill.create(1, complexPolygon, '', 0, 10, false);
// 修改类保留现场,供观察填充结果
console.log('primitiveId:', fill.getState_PrimitiveId());
console.log('polygonCount:', complexPolygon.getSourceStrictComplex().length);
```
### getcenter
# IPCB\_ComplexPolygon.getCenter() method
> 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.
Get Complex polygon center point
## Signature
```typescript
function getCenter(): Promise<{ x: number; y: number }>;
```
## Returns
Promise<{ x: number; y: number }>
Complex polygon center point
### getsource
# IPCB\_ComplexPolygon.getSource() method
Get Polygon data
## Signature
```typescript
function getSource(): TPCB_PolygonSourceArray | Array<TPCB_PolygonSourceArray>;
```
## Returns
[TPCB\_PolygonSourceArray](../types/TPCB_PolygonSourceArray.md) \| Array<[TPCB\_PolygonSourceArray](../types/TPCB_PolygonSourceArray.md)<!-- -->>
Single polygon or complex polygon data
## Remarks
If it only contains a single polygon, the outermost array will be simplified
## Example
```javascript
// 1. 用单个单多边形构建:getSource 会化简最外层数组
const single = eda.pcb_MathPolygon.createComplexPolygon(['R', 1000, 1000, 500, 300, 0, 0]);
// 2. 用多个单多边形构建:getSource 返回二维数组
const multi = eda.pcb_MathPolygon.createComplexPolygon([
['R', 2000, 1000, 500, 300, 0, 0],
['CIRCLE', 3000, 1150, 100],
]);
console.log('singleSource:', JSON.stringify(single.getSource()));
console.log('multiSource:', JSON.stringify(multi.getSource()));
```
### getsourcestrictcomplex
# IPCB\_ComplexPolygon.getSourceStrictComplex() method
Get Complex polygon data
## Signature
```typescript
function getSourceStrictComplex(): Array<TPCB_PolygonSourceArray>;
```
## Returns
Array<[TPCB\_PolygonSourceArray](../types/TPCB_PolygonSourceArray.md)<!-- -->>
Complex polygon data
## Remarks
Forcibly return data in complex polygon format, even if it only contains a single polygon
## Example
```javascript
// 1. 只放入一个单多边形构建复杂多边形
const complexPolygon = eda.pcb_MathPolygon.createComplexPolygon(['R', 1000, 1000, 500, 300, 0, 0]);
// 2. 对比两种读取方式:区别在嵌套深度,不在是否为数组
const simplified = complexPolygon.getSource(); // 一维:首元素是模式标记 "R"
const strict = complexPolygon.getSourceStrictComplex(); // 二维:首元素是单多边形数组
console.log('simplifiedFirstItem:', typeof simplified[0]);
console.log('strictFirstItemIsArray:', Array.isArray(strict[0]));
console.log('strictPolygonCount:', strict.length);
```
### topolygon
# IPCB\_ComplexPolygon.toPolygon() method
Split is single polygon array
## Signature
```typescript
function toPolygon(): Array<IPCB_Polygon>;
```
## Returns
Array<[IPCB\_Polygon](./IPCB_Polygon.md)<!-- -->>
Single polygon array
## Remarks
Will complex polygon split is single polygon array of objects
## Example
```javascript
// 1. 用两个单多边形(矩形 + 圆形)构建复杂多边形
const complexPolygon = eda.pcb_MathPolygon.createComplexPolygon([
['R', 1000, 1000, 500, 300, 0, 0],
['CIRCLE', 3000, 1150, 100],
]);
// 2. 拆分为单多边形对象数组
const polygons = complexPolygon.toPolygon();
// 3. 逐个读取单多边形的数据
polygons.forEach((polygon, index) => {
console.log(`polygon${index + 1}:`, JSON.stringify(polygon.getSource()));
});
console.log('count:', polygons.length);
```
references/classes/IPCB_Polygon.md
# IPCB\_Polygon class
Single polygon
## Signature
```typescript
class IPCB_Polygon
```
## Remarks
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[discretize(options)](./IPCB_Polygon.md)
</td><td>
</td><td>
**_(BETA)_** Discretize a single polygon into point data
</td></tr>
<tr><td>
[getCenter()](./IPCB_Polygon.md)
</td><td>
</td><td>
**_(BETA)_** Get Single polygon center point
</td></tr>
<tr><td>
[getSource()](./IPCB_Polygon.md)
</td><td>
</td><td>
Get Single polygon data
</td></tr>
</tbody></table>
---
## 方法详情
### discretize
# IPCB\_Polygon.discretize() method
> 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.
Discretize a single polygon into point data
## Signature
```typescript
function discretize(options?: IPCB_DiscretizeOptions): Promise<Array<IPCB_DiscretizedPoint> | null>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
options
</td><td>
[IPCB\_DiscretizeOptions](../interfaces/IPCB_DiscretizeOptions.md)
</td><td>
_(Optional)_ Discretization options
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_DiscretizedPoint](../interfaces/IPCB_DiscretizedPoint.md)<!-- -->> \| null>
Discretized point data
## Remarks
Discretize the boundary of a single polygon into a series of points
### getcenter
# IPCB\_Polygon.getCenter() method
> 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.
Get Single polygon center point
## Signature
```typescript
function getCenter(): Promise<{ x: number; y: number }>;
```
## Returns
Promise<{ x: number; y: number }>
Single polygon center point
### getsource
# IPCB\_Polygon.getSource() method
Get Single polygon data
## Signature
```typescript
function getSource(): TPCB_PolygonSourceArray;
```
## Returns
[TPCB\_PolygonSourceArray](../types/TPCB_PolygonSourceArray.md)
Single polygon data
## Example
```javascript
// 1. 用矩形模式(R x y width height rot round)创建一块单多边形
const rectPolygon = eda.pcb_MathPolygon.createPolygon(['R', 1000, 1000, 500, 300, 0, 0]);
// 2. 再用圆形模式(CIRCLE x y radius)创建一块,展示不同模式的源数据形态
const circlePolygon = eda.pcb_MathPolygon.createPolygon(['CIRCLE', 2000, 1150, 100]);
// 3. 读取源数组:矩形是 "R" 打头的参数序列,圆形是 "CIRCLE" 打头
console.log('rectSource:', JSON.stringify(rectPolygon.getSource()));
console.log('circleSource:', JSON.stringify(circlePolygon.getSource()));
// 4. 源数组可以直接喂回 createPolygon 复制出一块等价的多边形(数据回环)
const copied = eda.pcb_MathPolygon.createPolygon(rectPolygon.getSource());
console.log('roundTripMatch:', JSON.stringify(copied.getSource()) === JSON.stringify(rectPolygon.getSource()));
```
references/classes/IPCB_PrimitiveArc.md
# IPCB\_PrimitiveArc class
Arc line primitive
## Signature
```typescript
class IPCB_PrimitiveArc implements IPCB_Primitive
```
**Implements:** [IPCB\_Primitive](../interfaces/IPCB_Primitive.md)
## Remarks
Both lines and arc lines are wires, corresponding to the line traces and arc traces on the canvas
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[done()](./IPCB_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Apply the changes to the primitives to the canvas
</td></tr>
<tr><td>
[getAdjacentPrimitives()](./IPCB_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Get Adjacent primitive objects
</td></tr>
<tr><td>
[getEntireTrack(includeVias)](./IPCB_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Get the entire wire
</td></tr>
<tr><td>
[getEntireTrack(includeVias)](./IPCB_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Get the entire wire
</td></tr>
<tr><td>
[getState\_ArcAngle()](./IPCB_PrimitiveArc.md)
</td><td>
</td><td>
Get the property state: arc angle
</td></tr>
<tr><td>
[getState\_EndX()](./IPCB_PrimitiveArc.md)
</td><td>
</td><td>
Get the property state: end position X
</td></tr>
<tr><td>
[getState\_EndY()](./IPCB_PrimitiveArc.md)
</td><td>
</td><td>
Get the property state: end position Y
</td></tr>
<tr><td>
[getState\_InteractiveMode()](./IPCB_PrimitiveArc.md)
</td><td>
</td><td>
Get the property state: interaction mode
</td></tr>
<tr><td>
[getState\_Layer()](./IPCB_PrimitiveArc.md)
</td><td>
</td><td>
Get the property state: Layer
</td></tr>
<tr><td>
[getState\_LineWidth()](./IPCB_PrimitiveArc.md)
</td><td>
</td><td>
Get the property state: Line width
</td></tr>
<tr><td>
[getState\_Net()](./IPCB_PrimitiveArc.md)
</td><td>
</td><td>
Get the property state: net name
</td></tr>
<tr><td>
[getState\_PrimitiveId()](./IPCB_PrimitiveArc.md)
</td><td>
</td><td>
Get the property state: primitive ID
</td></tr>
<tr><td>
[getState\_PrimitiveLock()](./IPCB_PrimitiveArc.md)
</td><td>
</td><td>
Get the property state: whether it is locked
</td></tr>
<tr><td>
[getState\_PrimitiveType()](./IPCB_PrimitiveArc.md)
</td><td>
</td><td>
Get the property state: primitive type
</td></tr>
<tr><td>
[getState\_StartX()](./IPCB_PrimitiveArc.md)
</td><td>
</td><td>
Get the property state: start position X
</td></tr>
<tr><td>
[getState\_StartY()](./IPCB_PrimitiveArc.md)
</td><td>
</td><td>
Get the property state: start position Y
</td></tr>
<tr><td>
[isAsync()](./IPCB_PrimitiveArc.md)
</td><td>
</td><td>
Query whether the primitive is an async primitive
</td></tr>
<tr><td>
[reset()](./IPCB_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Reset the async primitive to the current canvas state
</td></tr>
<tr><td>
[setState\_ArcAngle(arcAngle)](./IPCB_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: arc angle
</td></tr>
<tr><td>
[setState\_EndX(endX)](./IPCB_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: end position X
</td></tr>
<tr><td>
[setState\_EndY(endY)](./IPCB_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: end position Y
</td></tr>
<tr><td>
[setState\_InteractiveMode(interactiveMode)](./IPCB_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: interaction mode
</td></tr>
<tr><td>
[setState\_Layer(layer)](./IPCB_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Layer
</td></tr>
<tr><td>
[setState\_LineWidth(lineWidth)](./IPCB_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Line width
</td></tr>
<tr><td>
[setState\_Net(net)](./IPCB_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: net name
</td></tr>
<tr><td>
[setState\_PrimitiveLock(primitiveLock)](./IPCB_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: whether it is locked
</td></tr>
<tr><td>
[setState\_StartX(startX)](./IPCB_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: start position X
</td></tr>
<tr><td>
[setState\_StartY(startY)](./IPCB_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: start position Y
</td></tr>
<tr><td>
[toAsync()](./IPCB_PrimitiveArc.md)
</td><td>
</td><td>
Convert Primitive to Async primitive
</td></tr>
<tr><td>
[toSync()](./IPCB_PrimitiveArc.md)
</td><td>
</td><td>
Convert Primitive to Sync primitive
</td></tr>
</tbody></table>
---
## 方法详情
### done
# IPCB\_PrimitiveArc.done() method
> 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.
Apply the changes to the primitives to the canvas
## Signature
```typescript
function done(): Promise<IPCB_PrimitiveArc>;
```
## Returns
Promise<[IPCB\_PrimitiveArc](./IPCB_PrimitiveArc.md)<!-- -->>
Arc line primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆弧重合
const x = 42000 + (Math.floor(Math.random() * 100000));
const y = 2000 + (Math.floor(Math.random() * 100000));
// 2. 创建一段测试圆弧
const arc = await eda.pcb_PrimitiveArc.create('', 1, x, y, x + 500, y + 300, 90, 10, 1, false);
// 3. 切换异步模式,连续累计两处修改(线宽 + 换层)
const asyncArc = arc.toAsync();
asyncArc.setState_LineWidth(24);
asyncArc.setState_Layer(2);
// 4. 一次性提交到画布
await asyncArc.done();
// 5. 从画布重新读取,确认两处修改都已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveArc.get(arc.getState_PrimitiveId());
console.log('lineWidth:', 10, '→', refetched.getState_LineWidth());
console.log('layer:', 1, '→', refetched.getState_Layer());
```
### getadjacentprimitives
# IPCB\_PrimitiveArc.getAdjacentPrimitives() method
> 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.
Get Adjacent primitive objects
## Signature
```typescript
function getAdjacentPrimitives(): Promise<
Array<IPCB_PrimitiveLine | IPCB_PrimitiveVia | IPCB_PrimitiveArc>
>;
```
## Returns
Promise<Array<[IPCB\_PrimitiveLine](./IPCB_PrimitiveLine.md) \| [IPCB\_PrimitiveVia](./IPCB_PrimitiveVia.md) \| [IPCB\_PrimitiveArc](./IPCB_PrimitiveArc.md)<!-- -->>>
Adjacent line, via, and arc-line primitive objects
## Remarks
It will get the line, via, and arc-line primitive objects directly connected to the arc line
## Example
```javascript
// 1. 创建一条直线走线,终点落在 (7500, 7000)
const line = await eda.pcb_PrimitiveLine.create('', 1, 7000, 7000, 7500, 7000, 10);
// 2. 创建一段圆弧,起点与直线终点重合,两段构成一整段导线
const arc = await eda.pcb_PrimitiveArc.create('', 1, 7500, 7000, 7800, 7300, 90, 10, 1, false);
// 3. 获取与圆弧直接相连的图元,并读出各自的类型
const adjacent = await arc.getAdjacentPrimitives();
// 4. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveLine.delete([line]);
await eda.pcb_PrimitiveArc.delete([arc]);
console.log('adjacent count:', adjacent.length);
adjacent.forEach((p, i) => {
console.log(`adjacent[${i}] type:`, p.getState_PrimitiveType());
});
```
### getentiretrack
# IPCB\_PrimitiveArc.getEntireTrack() method
> 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.
Get the entire wire
## Signature
```typescript
function getEntireTrack(includeVias: false): Promise<Array<IPCB_PrimitiveLine | IPCB_PrimitiveArc>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
includeVias
</td><td>
false
</td><td>
Whether to include the vias at both ends of the wire
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitiveLine](./IPCB_PrimitiveLine.md) \| [IPCB\_PrimitiveArc](./IPCB_PrimitiveArc.md)<!-- -->>>
All lines and arc lines in the entire wire
## Example
```javascript
// 1. 创建一条直线走线,终点落在 (7500, 7000)
const line = await eda.pcb_PrimitiveLine.create('', 1, 7000, 7000, 7500, 7000, 10);
// 2. 创建一段圆弧,起点与直线终点重合,两段构成一整段导线
const arc = await eda.pcb_PrimitiveArc.create('', 1, 7500, 7000, 7800, 7300, 90, 10, 1, false);
// 3. 只取导线内的直线和圆弧
const trackOnly = await arc.getEntireTrack(false);
// 4. 连两端过孔一起取(本例两端没有过孔,数量不变)
const trackWithVias = await arc.getEntireTrack(true);
// 5. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveLine.delete([line]);
await eda.pcb_PrimitiveArc.delete([arc]);
console.log('track(false) count:', trackOnly.length);
trackOnly.forEach((p, i) => {
console.log(`track(false)[${i}] type:`, p.getState_PrimitiveType());
});
console.log('track(true) count:', trackWithVias.length);
```
### getentiretrack_1
# IPCB\_PrimitiveArc.getEntireTrack() method
> 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.
Get the entire wire
## Signature
```typescript
function getEntireTrack(
includeVias: true,
): Promise<Array<IPCB_PrimitiveLine | IPCB_PrimitiveArc | IPCB_PrimitiveVia>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
includeVias
</td><td>
true
</td><td>
Whether to include the vias at both ends of the wire
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitiveLine](./IPCB_PrimitiveLine.md) \| [IPCB\_PrimitiveArc](./IPCB_PrimitiveArc.md) \| [IPCB\_PrimitiveVia](./IPCB_PrimitiveVia.md)<!-- -->>>
All lines and arc lines in the entire wire, as well as the vias connected at both ends (if any)
### getstate_arcangle
# IPCB\_PrimitiveArc.getState\_ArcAngle() method
Get the property state: arc angle
## Signature
```typescript
function getState_ArcAngle(): number;
```
## Returns
number
Arc angle
## Example
```javascript
// 1. 创建一段 90° 测试圆弧(PCB 坐标单位 mil)
const arc = await eda.pcb_PrimitiveArc.create('', 1, 1000, 1000, 1500, 1300, 90, 10, 1, false);
// 2. 读取圆弧角度
const arcAngle = arc.getState_ArcAngle();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveArc.delete([arc.getState_PrimitiveId()]);
console.log('arcAngle:', arcAngle);
```
### getstate_endx
# IPCB\_PrimitiveArc.getState\_EndX() method
Get the property state: end position X
## Signature
```typescript
function getState_EndX(): number;
```
## Returns
number
End position X
## Example
```javascript
// 1. 创建一段测试圆弧,终点 (1500, 1300)(PCB 坐标单位 mil)
const arc = await eda.pcb_PrimitiveArc.create('', 1, 1000, 1000, 1500, 1300, 90, 10, 1, false);
// 2. 读取终止位置 X
const endX = arc.getState_EndX();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveArc.delete([arc.getState_PrimitiveId()]);
console.log('endX:', endX);
```
### getstate_endy
# IPCB\_PrimitiveArc.getState\_EndY() method
Get the property state: end position Y
## Signature
```typescript
function getState_EndY(): number;
```
## Returns
number
End position Y
## Example
```javascript
// 1. 创建一段测试圆弧,终点 (1500, 1300)(PCB 坐标单位 mil)
const arc = await eda.pcb_PrimitiveArc.create('', 1, 1000, 1000, 1500, 1300, 90, 10, 1, false);
// 2. 读取终止位置 Y
const endY = arc.getState_EndY();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveArc.delete([arc.getState_PrimitiveId()]);
console.log('endY:', endY);
```
### getstate_interactivemode
# IPCB\_PrimitiveArc.getState\_InteractiveMode() method
Get the property state: interaction mode
## Signature
```typescript
function getState_InteractiveMode(): EPCB_PrimitiveArcInteractiveMode;
```
## Returns
[EPCB\_PrimitiveArcInteractiveMode](../enums/EPCB_PrimitiveArcInteractiveMode.md)
Interaction mode
## Example
```javascript
// 1. 创建一段两点圆弧(交互模式 1)的测试圆弧
const arc = await eda.pcb_PrimitiveArc.create('', 1, 1000, 1000, 1500, 1300, 90, 10, 1, false);
// 2. 读取交互模式
const interactiveMode = arc.getState_InteractiveMode();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveArc.delete([arc.getState_PrimitiveId()]);
console.log('interactiveMode:', interactiveMode);
```
### getstate_layer
# IPCB\_PrimitiveArc.getState\_Layer() method
Get the property state: Layer
## Signature
```typescript
function getState_Layer(): TPCB_LayersOfLine;
```
## Returns
[TPCB\_LayersOfLine](../types/TPCB_LayersOfLine.md)
Layer
## Example
```javascript
// 1. 创建一段顶层(1)测试圆弧
const arc = await eda.pcb_PrimitiveArc.create('', 1, 1000, 1000, 1500, 1300, 90, 10, 1, false);
// 2. 读取所在层
const layer = arc.getState_Layer();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveArc.delete([arc.getState_PrimitiveId()]);
console.log('layer:', layer);
```
### getstate_linewidth
# IPCB\_PrimitiveArc.getState\_LineWidth() method
Get the property state: Line width
## Signature
```typescript
function getState_LineWidth(): number;
```
## Returns
number
Line width
## Example
```javascript
// 1. 创建一段 10mil 线宽的测试圆弧
const arc = await eda.pcb_PrimitiveArc.create('', 1, 1000, 1000, 1500, 1300, 90, 10, 1, false);
// 2. 读取线宽
const lineWidth = arc.getState_LineWidth();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveArc.delete([arc.getState_PrimitiveId()]);
console.log('lineWidth:', lineWidth);
```
### getstate_net
# IPCB\_PrimitiveArc.getState\_Net() method
Get the property state: net name
## Signature
```typescript
function getState_Net(): string;
```
## Returns
string
Net name
## Example
```javascript
// 1. 创建一段指定网络的测试圆弧
const arc = await eda.pcb_PrimitiveArc.create('嘉立创示例_NET', 1, 1000, 1000, 1500, 1300, 90, 10, 1, false);
// 2. 读取网络名称
const net = arc.getState_Net();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveArc.delete([arc.getState_PrimitiveId()]);
console.log('net:', net);
```
### getstate_primitiveid
# IPCB\_PrimitiveArc.getState\_PrimitiveId() method
Get the property state: primitive ID
## Signature
```typescript
function getState_PrimitiveId(): string;
```
## Returns
string
Primitive ID
## Example
```javascript
// 1. 创建一段测试圆弧
const arc = await eda.pcb_PrimitiveArc.create('', 1, 1000, 1000, 1500, 1300, 90, 10, 1, false);
// 2. 读取图元 ID
const primitiveId = arc.getState_PrimitiveId();
// 3. 用该 ID 从画布重新取回圆弧,验证 ID 有效
const refetched = await eda.pcb_PrimitiveArc.get(primitiveId);
// 4. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveArc.delete([primitiveId]);
console.log('primitiveId:', primitiveId);
console.log('refetched type:', refetched.getState_PrimitiveType());
```
### getstate_primitivelock
# IPCB\_PrimitiveArc.getState\_PrimitiveLock() method
Get the property state: whether it is locked
## Signature
```typescript
function getState_PrimitiveLock(): boolean;
```
## Returns
boolean
Whether it is locked
## Example
```javascript
// 1. 创建一段测试圆弧(默认不锁定)
const arc = await eda.pcb_PrimitiveArc.create('', 1, 1000, 1000, 1500, 1300, 90, 10, 1, false);
// 2. 读取锁定状态
const locked = arc.getState_PrimitiveLock();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveArc.delete([arc.getState_PrimitiveId()]);
console.log('locked:', locked);
```
### getstate_primitivetype
# IPCB\_PrimitiveArc.getState\_PrimitiveType() method
Get the property state: primitive type
## Signature
```typescript
function getState_PrimitiveType(): EPCB_PrimitiveType;
```
## Returns
[EPCB\_PrimitiveType](../enums/EPCB_PrimitiveType.md)
Primitive type
## Example
```javascript
// 1. 创建一段测试圆弧
const arc = await eda.pcb_PrimitiveArc.create('', 1, 1000, 1000, 1500, 1300, 90, 10, 1, false);
// 2. 读取图元类型
const type = arc.getState_PrimitiveType();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveArc.delete([arc.getState_PrimitiveId()]);
console.log('type:', type);
```
### getstate_startx
# IPCB\_PrimitiveArc.getState\_StartX() method
Get the property state: start position X
## Signature
```typescript
function getState_StartX(): number;
```
## Returns
number
Start position X
## Example
```javascript
// 1. 创建一段测试圆弧,起点 (1000, 1000)(PCB 坐标单位 mil)
const arc = await eda.pcb_PrimitiveArc.create('', 1, 1000, 1000, 1500, 1300, 90, 10, 1, false);
// 2. 读取起始位置 X
const startX = arc.getState_StartX();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveArc.delete([arc.getState_PrimitiveId()]);
console.log('startX:', startX);
```
### getstate_starty
# IPCB\_PrimitiveArc.getState\_StartY() method
Get the property state: start position Y
## Signature
```typescript
function getState_StartY(): number;
```
## Returns
number
Start position Y
## Example
```javascript
// 1. 创建一段测试圆弧,起点 (1000, 1000)(PCB 坐标单位 mil)
const arc = await eda.pcb_PrimitiveArc.create('', 1, 1000, 1000, 1500, 1300, 90, 10, 1, false);
// 2. 读取起始位置 Y
const startY = arc.getState_StartY();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveArc.delete([arc.getState_PrimitiveId()]);
console.log('startY:', startY);
```
### isasync
# IPCB\_PrimitiveArc.isAsync() method
Query whether the primitive is an async primitive
## Signature
```typescript
function isAsync(): boolean;
```
## Returns
boolean
Whether Is async primitive
## Example
```javascript
// 1. 创建一段测试圆弧,创建后默认处于异步模式
const arc = await eda.pcb_PrimitiveArc.create('', 1, 1000, 1000, 1500, 1300, 90, 10, 1, false);
const asyncOnCreate = arc.isAsync();
// 2. 切换到同步模式再查询一次,对比两种模式
arc.toSync();
const asyncAfterToSync = arc.isAsync();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveArc.delete([arc.getState_PrimitiveId()]);
console.log('isAsync on create:', asyncOnCreate);
console.log('isAsync after toSync:', asyncAfterToSync);
```
### reset
# IPCB\_PrimitiveArc.reset() method
> 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.
Reset the async primitive to the current canvas state
## Signature
```typescript
function reset(): Promise<IPCB_PrimitiveArc>;
```
## Returns
Promise<[IPCB\_PrimitiveArc](./IPCB_PrimitiveArc.md)<!-- -->>
Arc line primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆弧重合
const x = 46000 + (Math.floor(Math.random() * 100000));
const y = 2000 + (Math.floor(Math.random() * 100000));
// 2. 创建一段 10mil 线宽的测试圆弧
const arc = await eda.pcb_PrimitiveArc.create('', 1, x, y, x + 500, y + 300, 90, 10, 1, false);
// 3. 切换异步模式,累计一处未提交的线宽修改(10 → 99)
const asyncArc = arc.toAsync();
asyncArc.setState_LineWidth(99);
// 4. 重置:丢弃未提交的修改,回到画布当前状态
await asyncArc.reset();
// 5. 从画布重新读取,线宽仍是 10(保留现场供观察)
const refetched = await eda.pcb_PrimitiveArc.get(arc.getState_PrimitiveId());
console.log('lineWidth after reset:', refetched.getState_LineWidth());
```
### setstate_arcangle
# IPCB\_PrimitiveArc.setState\_ArcAngle() method
> 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.
Set the property state: arc angle
## Signature
```typescript
function setState_ArcAngle(arcAngle: number): IPCB_PrimitiveArc;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
arcAngle
</td><td>
number
</td><td>
Arc angle
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveArc](./IPCB_PrimitiveArc.md)
Arc line primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆弧重合
const x = 2000 + (Math.floor(Math.random() * 100000));
const y = 2000 + (Math.floor(Math.random() * 100000));
// 2. 创建一段 90° 测试圆弧(PCB 坐标单位 mil,跨度 500×300)
const arc = await eda.pcb_PrimitiveArc.create('', 1, x, y, x + 500, y + 300, 90, 10, 1, false);
// 3. 读取修改前的角度
const before = arc.getState_ArcAngle();
// 4. 切换异步模式并修改角度(90° → 45°)
const asyncArc = arc.toAsync();
asyncArc.setState_ArcAngle(45);
await asyncArc.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveArc.get(arc.getState_PrimitiveId());
const after = refetched.getState_ArcAngle();
console.log('arcAngle:', before, '→', after);
```
### setstate_endx
# IPCB\_PrimitiveArc.setState\_EndX() method
> 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.
Set the property state: end position X
## Signature
```typescript
function setState_EndX(endX: number): IPCB_PrimitiveArc;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
endX
</td><td>
number
</td><td>
End position X
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveArc](./IPCB_PrimitiveArc.md)
Arc line primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆弧重合
const x = 14000 + (Math.floor(Math.random() * 100000));
const y = 2000 + (Math.floor(Math.random() * 100000));
// 2. 创建一段测试圆弧,终点 (x+500, y+300)
const arc = await eda.pcb_PrimitiveArc.create('', 1, x, y, x + 500, y + 300, 90, 10, 1, false);
// 3. 读取修改前的终点 X
const before = arc.getState_EndX();
// 4. 切换异步模式并平移终点 X(右移 300mil)
const asyncArc = arc.toAsync();
asyncArc.setState_EndX(x + 800);
await asyncArc.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveArc.get(arc.getState_PrimitiveId());
const after = refetched.getState_EndX();
console.log('endX:', before, '→', after);
```
### setstate_endy
# IPCB\_PrimitiveArc.setState\_EndY() method
> 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.
Set the property state: end position Y
## Signature
```typescript
function setState_EndY(endY: number): IPCB_PrimitiveArc;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
endY
</td><td>
number
</td><td>
End position Y
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveArc](./IPCB_PrimitiveArc.md)
Arc line primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆弧重合
const x = 18000 + (Math.floor(Math.random() * 100000));
const y = 2000 + (Math.floor(Math.random() * 100000));
// 2. 创建一段测试圆弧,终点 (x+500, y+300)
const arc = await eda.pcb_PrimitiveArc.create('', 1, x, y, x + 500, y + 300, 90, 10, 1, false);
// 3. 读取修改前的终点 Y
const before = arc.getState_EndY();
// 4. 切换异步模式并平移终点 Y(上移 300mil)
const asyncArc = arc.toAsync();
asyncArc.setState_EndY(y + 600);
await asyncArc.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveArc.get(arc.getState_PrimitiveId());
const after = refetched.getState_EndY();
console.log('endY:', before, '→', after);
```
### setstate_interactivemode
# IPCB\_PrimitiveArc.setState\_InteractiveMode() method
> 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.
Set the property state: interaction mode
## Signature
```typescript
function setState_InteractiveMode(
interactiveMode: EPCB_PrimitiveArcInteractiveMode,
): IPCB_PrimitiveArc;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
interactiveMode
</td><td>
[EPCB\_PrimitiveArcInteractiveMode](../enums/EPCB_PrimitiveArcInteractiveMode.md)
</td><td>
Interaction mode
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveArc](./IPCB_PrimitiveArc.md)
Arc line primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆弧重合
const x = 38000 + (Math.floor(Math.random() * 100000));
const y = 2000 + (Math.floor(Math.random() * 100000));
// 2. 创建一段两点圆弧(交互模式 1)测试圆弧
const arc = await eda.pcb_PrimitiveArc.create('', 1, x, y, x + 500, y + 300, 90, 10, 1, false);
// 3. 读取修改前的交互模式
const before = arc.getState_InteractiveMode();
// 4. 切换异步模式并改为中心圆弧(1 → 2)
const asyncArc = arc.toAsync();
asyncArc.setState_InteractiveMode(2);
await asyncArc.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveArc.get(arc.getState_PrimitiveId());
const after = refetched.getState_InteractiveMode();
console.log('interactiveMode:', before, '→', after);
```
### setstate_layer
# IPCB\_PrimitiveArc.setState\_Layer() method
> 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.
Set the property state: Layer
## Signature
```typescript
function setState_Layer(layer: TPCB_LayersOfLine): IPCB_PrimitiveArc;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfLine](../types/TPCB_LayersOfLine.md)
</td><td>
Layer
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveArc](./IPCB_PrimitiveArc.md)
Arc line primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆弧重合
const x = 22000 + (Math.floor(Math.random() * 100000));
const y = 2000 + (Math.floor(Math.random() * 100000));
// 2. 创建一段顶层(1)测试圆弧
const arc = await eda.pcb_PrimitiveArc.create('', 1, x, y, x + 500, y + 300, 90, 10, 1, false);
// 3. 读取修改前的层
const before = arc.getState_Layer();
// 4. 切换异步模式并换层(顶层 1 → 底层 2)
const asyncArc = arc.toAsync();
asyncArc.setState_Layer(2);
await asyncArc.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveArc.get(arc.getState_PrimitiveId());
const after = refetched.getState_Layer();
console.log('layer:', before, '→', after);
```
### setstate_linewidth
# IPCB\_PrimitiveArc.setState\_LineWidth() method
> 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.
Set the property state: Line width
## Signature
```typescript
function setState_LineWidth(lineWidth: number): IPCB_PrimitiveArc;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
lineWidth
</td><td>
number
</td><td>
Line width
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveArc](./IPCB_PrimitiveArc.md)
Arc line primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆弧重合
const x = 26000 + (Math.floor(Math.random() * 100000));
const y = 2000 + (Math.floor(Math.random() * 100000));
// 2. 创建一段 10mil 线宽的测试圆弧
const arc = await eda.pcb_PrimitiveArc.create('', 1, x, y, x + 500, y + 300, 90, 10, 1, false);
// 3. 读取修改前的线宽
const before = arc.getState_LineWidth();
// 4. 切换异步模式并加宽(10 → 24)
const asyncArc = arc.toAsync();
asyncArc.setState_LineWidth(24);
await asyncArc.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveArc.get(arc.getState_PrimitiveId());
const after = refetched.getState_LineWidth();
console.log('lineWidth:', before, '→', after);
```
### setstate_net
# IPCB\_PrimitiveArc.setState\_Net() method
> 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.
Set the property state: net name
## Signature
```typescript
function setState_Net(net: string): IPCB_PrimitiveArc;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string
</td><td>
Net name
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveArc](./IPCB_PrimitiveArc.md)
Arc line primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆弧重合
const x = 30000 + (Math.floor(Math.random() * 100000));
const y = 2000 + (Math.floor(Math.random() * 100000));
// 2. 创建一段无网络的测试圆弧
const arc = await eda.pcb_PrimitiveArc.create('', 1, x, y, x + 500, y + 300, 90, 10, 1, false);
// 3. 读取修改前的网络名称
const before = arc.getState_Net();
// 4. 切换异步模式并指定网络('' → '嘉立创示例_NET')
const asyncArc = arc.toAsync();
asyncArc.setState_Net('嘉立创示例_NET');
await asyncArc.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveArc.get(arc.getState_PrimitiveId());
const after = refetched.getState_Net();
console.log('net:', before, '→', after);
```
### setstate_primitivelock
# IPCB\_PrimitiveArc.setState\_PrimitiveLock() method
> 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.
Set the property state: whether it is locked
## Signature
```typescript
function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitiveArc;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveLock
</td><td>
boolean
</td><td>
Whether it is locked
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveArc](./IPCB_PrimitiveArc.md)
Arc line primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆弧重合
const x = 34000 + (Math.floor(Math.random() * 100000));
const y = 2000 + (Math.floor(Math.random() * 100000));
// 2. 创建一段测试圆弧(默认不锁定)
const arc = await eda.pcb_PrimitiveArc.create('', 1, x, y, x + 500, y + 300, 90, 10, 1, false);
// 3. 读取修改前的锁定状态
const before = arc.getState_PrimitiveLock();
// 4. 切换异步模式并锁定(false → true)
const asyncArc = arc.toAsync();
asyncArc.setState_PrimitiveLock(true);
await asyncArc.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveArc.get(arc.getState_PrimitiveId());
const after = refetched.getState_PrimitiveLock();
console.log('locked:', before, '→', after);
```
### setstate_startx
# IPCB\_PrimitiveArc.setState\_StartX() method
> 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.
Set the property state: start position X
## Signature
```typescript
function setState_StartX(startX: number): IPCB_PrimitiveArc;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
startX
</td><td>
number
</td><td>
Start position X
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveArc](./IPCB_PrimitiveArc.md)
Arc line primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆弧重合
const x = 6000 + (Math.floor(Math.random() * 100000));
const y = 2000 + (Math.floor(Math.random() * 100000));
// 2. 创建一段测试圆弧,起点 (x, y)
const arc = await eda.pcb_PrimitiveArc.create('', 1, x, y, x + 500, y + 300, 90, 10, 1, false);
// 3. 读取修改前的起点 X
const before = arc.getState_StartX();
// 4. 切换异步模式并平移起点 X(右移 300mil)
const asyncArc = arc.toAsync();
asyncArc.setState_StartX(x + 300);
await asyncArc.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveArc.get(arc.getState_PrimitiveId());
const after = refetched.getState_StartX();
console.log('startX:', before, '→', after);
```
### setstate_starty
# IPCB\_PrimitiveArc.setState\_StartY() method
> 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.
Set the property state: start position Y
## Signature
```typescript
function setState_StartY(startY: number): IPCB_PrimitiveArc;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
startY
</td><td>
number
</td><td>
Start position Y
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveArc](./IPCB_PrimitiveArc.md)
Arc line primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆弧重合
const x = 10000 + (Math.floor(Math.random() * 100000));
const y = 2000 + (Math.floor(Math.random() * 100000));
// 2. 创建一段测试圆弧,起点 (x, y)
const arc = await eda.pcb_PrimitiveArc.create('', 1, x, y, x + 500, y + 300, 90, 10, 1, false);
// 3. 读取修改前的起点 Y
const before = arc.getState_StartY();
// 4. 切换异步模式并平移起点 Y(上移 300mil)
const asyncArc = arc.toAsync();
asyncArc.setState_StartY(y + 300);
await asyncArc.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveArc.get(arc.getState_PrimitiveId());
const after = refetched.getState_StartY();
console.log('startY:', before, '→', after);
```
### toasync
# IPCB\_PrimitiveArc.toAsync() method
Convert Primitive to Async primitive
## Signature
```typescript
function toAsync(): IPCB_PrimitiveArc;
```
## Returns
[IPCB\_PrimitiveArc](./IPCB_PrimitiveArc.md)
Arc line primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆弧重合
const x = 52000 + (Math.floor(Math.random() * 100000));
const y = 2000 + (Math.floor(Math.random() * 100000));
// 2. 创建一段测试圆弧,切换到同步模式,让模式变化可观察
const arc = await eda.pcb_PrimitiveArc.create('', 1, x, y, x + 500, y + 300, 90, 10, 1, false);
arc.toSync();
// 3. 转换为异步图元
const asyncArc = arc.toAsync();
// 4. 异步模式下累计修改并提交
asyncArc.setState_LineWidth(24);
await asyncArc.done();
// 5. 从画布重新读取,确认提交生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveArc.get(arc.getState_PrimitiveId());
console.log('isAsync after toAsync:', arc.isAsync());
console.log('lineWidth:', 10, '→', refetched.getState_LineWidth());
```
### tosync
# IPCB\_PrimitiveArc.toSync() method
Convert Primitive to Sync primitive
## Signature
```typescript
function toSync(): IPCB_PrimitiveArc;
```
## Returns
[IPCB\_PrimitiveArc](./IPCB_PrimitiveArc.md)
Arc line primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆弧重合
const x = 56000 + (Math.floor(Math.random() * 100000));
const y = 2000 + (Math.floor(Math.random() * 100000));
// 2. 创建一段测试圆弧
const arc = await eda.pcb_PrimitiveArc.create('', 1, x, y, x + 500, y + 300, 90, 10, 1, false);
// 3. 转换为同步图元
const syncArc = arc.toSync();
// 4. 同步模式下修改线宽,立即生效(无需 done())
syncArc.setState_LineWidth(40);
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveArc.get(arc.getState_PrimitiveId());
console.log('isSync after toSync:', !syncArc.isAsync());
console.log('lineWidth:', 10, '→', refetched.getState_LineWidth());
```
references/classes/IPCB_PrimitiveDimension.md
# IPCB\_PrimitiveDimension class
Dimension primitive
## Signature
```typescript
class IPCB_PrimitiveDimension implements IPCB_Primitive
```
**Implements:** [IPCB\_Primitive](../interfaces/IPCB_Primitive.md)
## Remarks
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[done()](./IPCB_PrimitiveDimension.md)
</td><td>
</td><td>
**_(BETA)_** Apply the changes to the primitives to the canvas
</td></tr>
<tr><td>
[getState\_CoordinateSet()](./IPCB_PrimitiveDimension.md)
</td><td>
</td><td>
Get the property state: coordinate set
</td></tr>
<tr><td>
[getState\_DimensionType()](./IPCB_PrimitiveDimension.md)
</td><td>
</td><td>
Get the property state: dimension type
</td></tr>
<tr><td>
[getState\_Layer()](./IPCB_PrimitiveDimension.md)
</td><td>
</td><td>
Get the property state: Layer
</td></tr>
<tr><td>
[getState\_LineWidth()](./IPCB_PrimitiveDimension.md)
</td><td>
</td><td>
Get the property state: Line width
</td></tr>
<tr><td>
[getState\_Precision()](./IPCB_PrimitiveDimension.md)
</td><td>
</td><td>
Get the property state: precision
</td></tr>
<tr><td>
[getState\_PrimitiveId()](./IPCB_PrimitiveDimension.md)
</td><td>
</td><td>
Get the property state: primitive ID
</td></tr>
<tr><td>
[getState\_PrimitiveLock()](./IPCB_PrimitiveDimension.md)
</td><td>
</td><td>
Get the property state: whether it is locked
</td></tr>
<tr><td>
[getState\_PrimitiveType()](./IPCB_PrimitiveDimension.md)
</td><td>
</td><td>
Get the property state: primitive type
</td></tr>
<tr><td>
[getState\_TextFollow()](./IPCB_PrimitiveDimension.md)
</td><td>
</td><td>
Get the property state: text follows
</td></tr>
<tr><td>
[getState\_Unit()](./IPCB_PrimitiveDimension.md)
</td><td>
</td><td>
Get the property state: unit
</td></tr>
<tr><td>
[isAsync()](./IPCB_PrimitiveDimension.md)
</td><td>
</td><td>
Query whether the primitive is an async primitive
</td></tr>
<tr><td>
[reset()](./IPCB_PrimitiveDimension.md)
</td><td>
</td><td>
**_(BETA)_** Reset the async primitive to the current canvas state
</td></tr>
<tr><td>
[setState\_CoordinateSet(coordinateSet)](./IPCB_PrimitiveDimension.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: coordinate set
</td></tr>
<tr><td>
[setState\_DimensionType(dimensionType)](./IPCB_PrimitiveDimension.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: dimension type
</td></tr>
<tr><td>
[setState\_Layer(layer)](./IPCB_PrimitiveDimension.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Layer
</td></tr>
<tr><td>
[setState\_LineWidth(lineWidth)](./IPCB_PrimitiveDimension.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Line width
</td></tr>
<tr><td>
[setState\_Precision(precision)](./IPCB_PrimitiveDimension.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: precision
</td></tr>
<tr><td>
[setState\_PrimitiveLock(primitiveLock)](./IPCB_PrimitiveDimension.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: whether it is locked
</td></tr>
<tr><td>
[setState\_Unit(unit)](./IPCB_PrimitiveDimension.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: unit
</td></tr>
<tr><td>
[toAsync()](./IPCB_PrimitiveDimension.md)
</td><td>
</td><td>
Convert Primitive to Async primitive
</td></tr>
<tr><td>
[toSync()](./IPCB_PrimitiveDimension.md)
</td><td>
</td><td>
Convert Primitive to Sync primitive
</td></tr>
</tbody></table>
---
## 方法详情
### done
# IPCB\_PrimitiveDimension.done() method
> 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.
Apply the changes to the primitives to the canvas
## Signature
```typescript
function done(): Promise<IPCB_PrimitiveDimension>;
```
## Returns
Promise<[IPCB\_PrimitiveDimension](./IPCB_PrimitiveDimension.md)<!-- -->>
Dimension primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试标注重合
const x = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个长度标注
const dim = await eda.pcb_PrimitiveDimension.create(
'Length Dimension',
[x, 2000, x, 1800, x + 2000, 1800, x + 2000, 2000],
3,
undefined,
10
);
// 3. 切换异步模式,连续累计两处修改(线宽 + 换层)
const asyncDim = dim.toAsync();
asyncDim.setState_LineWidth(20);
asyncDim.setState_Layer(4);
// 4. 一次性提交到画布
await asyncDim.done();
// 5. 从画布重新读取,确认两处修改都已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveDimension.get(dim.getState_PrimitiveId());
console.log('lineWidth:', 10, '→', refetched.getState_LineWidth());
console.log('layer:', 3, '→', refetched.getState_Layer());
```
### getstate_coordinateset
# IPCB\_PrimitiveDimension.getState\_CoordinateSet() method
Get the property state: coordinate set
## Signature
```typescript
function getState_CoordinateSet(): TPCB_PrimitiveDimensionCoordinateSet;
```
## Returns
[TPCB\_PrimitiveDimensionCoordinateSet](../types/TPCB_PrimitiveDimensionCoordinateSet.md)
Coordinate set
## Example
```javascript
// 1. 创建一个长度标注(8 元素坐标集:测量端点、箭头端点各两组)
const dim = await eda.pcb_PrimitiveDimension.create(
'Length Dimension',
[1000, 1000, 1000, 800, 3000, 800, 3000, 1000],
3
);
// 2. 读取坐标集
const coordinateSet = dim.getState_CoordinateSet();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveDimension.delete([dim.getState_PrimitiveId()]);
console.log('coordinateSet:', JSON.stringify(coordinateSet));
```
### getstate_dimensiontype
# IPCB\_PrimitiveDimension.getState\_DimensionType() method
Get the property state: dimension type
## Signature
```typescript
function getState_DimensionType(): EPCB_PrimitiveDimensionType;
```
## Returns
[EPCB\_PrimitiveDimensionType](../enums/EPCB_PrimitiveDimensionType.md)
Dimension type
## Example
```javascript
// 1. 创建一个长度标注("Length Dimension")
const dim = await eda.pcb_PrimitiveDimension.create(
'Length Dimension',
[1000, 1000, 1000, 800, 3000, 800, 3000, 1000],
3
);
// 2. 读取标注类型
const dimensionType = dim.getState_DimensionType();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveDimension.delete([dim.getState_PrimitiveId()]);
console.log('dimensionType:', dimensionType);
```
### getstate_layer
# IPCB\_PrimitiveDimension.getState\_Layer() method
Get the property state: Layer
## Signature
```typescript
function getState_Layer(): TPCB_LayersOfDimension;
```
## Returns
[TPCB\_LayersOfDimension](../types/TPCB_LayersOfDimension.md)
Layer
## Example
```javascript
// 1. 创建一个顶层丝印层(3)的长度标注
const dim = await eda.pcb_PrimitiveDimension.create(
'Length Dimension',
[1000, 1000, 1000, 800, 3000, 800, 3000, 1000],
3
);
// 2. 读取所在层
const layer = dim.getState_Layer();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveDimension.delete([dim.getState_PrimitiveId()]);
console.log('layer:', layer);
```
### getstate_linewidth
# IPCB\_PrimitiveDimension.getState\_LineWidth() method
Get the property state: Line width
## Signature
```typescript
function getState_LineWidth(): number;
```
## Returns
number
Line width
## Example
```javascript
// 1. 创建一个 10mil 线宽的长度标注
const dim = await eda.pcb_PrimitiveDimension.create(
'Length Dimension',
[1000, 1000, 1000, 800, 3000, 800, 3000, 1000],
3,
undefined,
10
);
// 2. 读取线宽
const lineWidth = dim.getState_LineWidth();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveDimension.delete([dim.getState_PrimitiveId()]);
console.log('lineWidth:', lineWidth);
```
### getstate_precision
# IPCB\_PrimitiveDimension.getState\_Precision() method
Get the property state: precision
## Signature
```typescript
function getState_Precision(): number;
```
## Returns
number
Precision
## Example
```javascript
// 1. 创建一个精度为 2 位的长度标注
const dim = await eda.pcb_PrimitiveDimension.create(
'Length Dimension',
[1000, 1000, 1000, 800, 3000, 800, 3000, 1000],
3,
undefined,
undefined,
2
);
// 2. 读取精度
const precision = dim.getState_Precision();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveDimension.delete([dim.getState_PrimitiveId()]);
console.log('precision:', precision);
```
### getstate_primitiveid
# IPCB\_PrimitiveDimension.getState\_PrimitiveId() method
Get the property state: primitive ID
## Signature
```typescript
function getState_PrimitiveId(): string;
```
## Returns
string
Primitive ID
## Example
```javascript
// 1. 创建一个长度标注
const dim = await eda.pcb_PrimitiveDimension.create(
'Length Dimension',
[1000, 1000, 1000, 800, 3000, 800, 3000, 1000],
3
);
// 2. 读取图元 ID
const primitiveId = dim.getState_PrimitiveId();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveDimension.delete([primitiveId]);
console.log('primitiveId:', primitiveId);
```
### getstate_primitivelock
# IPCB\_PrimitiveDimension.getState\_PrimitiveLock() method
Get the property state: whether it is locked
## Signature
```typescript
function getState_PrimitiveLock(): boolean;
```
## Returns
boolean
Whether it is locked
## Example
```javascript
// 1. 创建一个未锁定的长度标注
const dim = await eda.pcb_PrimitiveDimension.create(
'Length Dimension',
[1000, 1000, 1000, 800, 3000, 800, 3000, 1000],
3
);
// 2. 读取锁定状态
const primitiveLock = dim.getState_PrimitiveLock();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveDimension.delete([dim.getState_PrimitiveId()]);
console.log('primitiveLock:', primitiveLock);
```
### getstate_primitivetype
# IPCB\_PrimitiveDimension.getState\_PrimitiveType() method
Get the property state: primitive type
## Signature
```typescript
function getState_PrimitiveType(): EPCB_PrimitiveType;
```
## Returns
[EPCB\_PrimitiveType](../enums/EPCB_PrimitiveType.md)
Primitive type
## Example
```javascript
// 1. 创建一个长度标注
const dim = await eda.pcb_PrimitiveDimension.create(
'Length Dimension',
[1000, 1000, 1000, 800, 3000, 800, 3000, 1000],
3
);
// 2. 读取图元类型
const primitiveType = dim.getState_PrimitiveType();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveDimension.delete([dim.getState_PrimitiveId()]);
console.log('primitiveType:', primitiveType);
```
### getstate_textfollow
# IPCB\_PrimitiveDimension.getState\_TextFollow() method
Get the property state: text follows
## Signature
```typescript
function getState_TextFollow(): 0 | 1;
```
## Returns
0 \| 1
Text follows
## Example
```javascript
// 1. 创建一个长度标注
const dim = await eda.pcb_PrimitiveDimension.create(
'Length Dimension',
[1000, 1000, 1000, 800, 3000, 800, 3000, 1000],
3
);
// 2. 读取文字跟随状态(0 或 1)
const textFollow = dim.getState_TextFollow();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveDimension.delete([dim.getState_PrimitiveId()]);
console.log('textFollow:', textFollow);
```
### getstate_unit
# IPCB\_PrimitiveDimension.getState\_Unit() method
Get the property state: unit
## Signature
```typescript
function getState_Unit():
ESYS_Unit.MILLIMETER | ESYS_Unit.CENTIMETER | ESYS_Unit.INCH | ESYS_Unit.MIL;
```
## Returns
[ESYS\_Unit.MILLIMETER](../enums/ESYS_Unit.md) \| [ESYS\_Unit.CENTIMETER](../enums/ESYS_Unit.md) \| [ESYS\_Unit.INCH](../enums/ESYS_Unit.md) \| [ESYS\_Unit.MIL](../enums/ESYS_Unit.md)
Unit
## Example
```javascript
// 1. 创建一个默认单位(毫米)的长度标注
const dim = await eda.pcb_PrimitiveDimension.create(
'Length Dimension',
[1000, 1000, 1000, 800, 3000, 800, 3000, 1000],
3
);
// 2. 读取显示单位('mm' / 'cm' / 'inch' / 'mil')
const unit = dim.getState_Unit();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveDimension.delete([dim.getState_PrimitiveId()]);
console.log('unit:', unit);
```
### isasync
# IPCB\_PrimitiveDimension.isAsync() method
Query whether the primitive is an async primitive
## Signature
```typescript
function isAsync(): boolean;
```
## Returns
boolean
Whether Is async primitive
## Example
```javascript
// 1. 创建一个长度标注,创建后默认处于异步模式
const dim = await eda.pcb_PrimitiveDimension.create(
'Length Dimension',
[1000, 1000, 1000, 800, 3000, 800, 3000, 1000],
3
);
const asyncOnCreate = dim.isAsync();
// 2. 切换到同步模式再查询一次,对比两种模式
dim.toSync();
const asyncAfterToSync = dim.isAsync();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveDimension.delete([dim.getState_PrimitiveId()]);
console.log('isAsync on create:', asyncOnCreate);
console.log('isAsync after toSync:', asyncAfterToSync);
```
### reset
# IPCB\_PrimitiveDimension.reset() method
> 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.
Reset the async primitive to the current canvas state
## Signature
```typescript
function reset(): Promise<IPCB_PrimitiveDimension>;
```
## Returns
Promise<[IPCB\_PrimitiveDimension](./IPCB_PrimitiveDimension.md)<!-- -->>
Dimension primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试标注重合
const x = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个 10mil 线宽的长度标注
const dim = await eda.pcb_PrimitiveDimension.create(
'Length Dimension',
[x, 2000, x, 1800, x + 2000, 1800, x + 2000, 2000],
3,
undefined,
10
);
// 3. 切换异步模式,累计一处未提交的线宽修改(10 → 99)
const asyncDim = dim.toAsync();
asyncDim.setState_LineWidth(99);
// 4. 重置:丢弃未提交的修改,回到画布当前状态
await asyncDim.reset();
// 5. 从画布重新读取,线宽仍是 10(保留现场供观察)
const refetched = await eda.pcb_PrimitiveDimension.get(dim.getState_PrimitiveId());
console.log('lineWidth after reset:', refetched.getState_LineWidth());
```
### setstate_coordinateset
# IPCB\_PrimitiveDimension.setState\_CoordinateSet() method
> 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.
Set the property state: coordinate set
## Signature
```typescript
function setState_CoordinateSet(
coordinateSet: TPCB_PrimitiveDimensionCoordinateSet,
): IPCB_PrimitiveDimension;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
coordinateSet
</td><td>
[TPCB\_PrimitiveDimensionCoordinateSet](../types/TPCB_PrimitiveDimensionCoordinateSet.md)
</td><td>
Coordinate set
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveDimension](./IPCB_PrimitiveDimension.md)
Dimension primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试标注重合
const x = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个长度标注(测量 x 到 x+2000 的水平距离)
const dim = await eda.pcb_PrimitiveDimension.create(
'Length Dimension',
[x, 2000, x, 1800, x + 2000, 1800, x + 2000, 2000],
3
);
const before = dim.getState_CoordinateSet();
// 3. 切换异步模式并替换坐标集:测量度改为 3000
const asyncDim = dim.toAsync();
asyncDim.setState_CoordinateSet([x, 2000, x, 1800, x + 3000, 1800, x + 3000, 2000]);
await asyncDim.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveDimension.get(dim.getState_PrimitiveId());
console.log('coordinateSet:', JSON.stringify(before), '→', JSON.stringify(refetched.getState_CoordinateSet()));
```
### setstate_dimensiontype
# IPCB\_PrimitiveDimension.setState\_DimensionType() method
> 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.
Set the property state: dimension type
## Signature
```typescript
function setState_DimensionType(
dimensionType: EPCB_PrimitiveDimensionType,
): IPCB_PrimitiveDimension;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
dimensionType
</td><td>
[EPCB\_PrimitiveDimensionType](../enums/EPCB_PrimitiveDimensionType.md)
</td><td>
Dimension type
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveDimension](./IPCB_PrimitiveDimension.md)
Dimension primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试标注重合
const x = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个长度标注(8 元素坐标集)
const dim = await eda.pcb_PrimitiveDimension.create(
'Length Dimension',
[x, 2000, x, 1800, x + 2000, 1800, x + 2000, 2000],
3
);
const before = dim.getState_DimensionType();
// 3. 切换异步模式:换成半径标注,坐标集同步换成 6 元素格式(圆上端点、标注线尾、文字位置)
const asyncDim = dim.toAsync();
asyncDim.setState_DimensionType('Radius Dimension');
asyncDim.setState_CoordinateSet([x + 1500, 3500, x + 3500, 3500, x + 2500, 4200]);
await asyncDim.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveDimension.get(dim.getState_PrimitiveId());
console.log('dimensionType:', before, '→', refetched.getState_DimensionType());
```
### setstate_layer
# IPCB\_PrimitiveDimension.setState\_Layer() method
> 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.
Set the property state: Layer
## Signature
```typescript
function setState_Layer(layer: TPCB_LayersOfDimension): IPCB_PrimitiveDimension;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfDimension](../types/TPCB_LayersOfDimension.md)
</td><td>
Layer
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveDimension](./IPCB_PrimitiveDimension.md)
Dimension primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试标注重合
const x = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个顶层丝印层(3)的长度标注
const dim = await eda.pcb_PrimitiveDimension.create(
'Length Dimension',
[x, 2000, x, 1800, x + 2000, 1800, x + 2000, 2000],
3
);
const before = dim.getState_Layer();
// 3. 切换异步模式并换到底层丝印层(4)
const asyncDim = dim.toAsync();
asyncDim.setState_Layer(4);
await asyncDim.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveDimension.get(dim.getState_PrimitiveId());
console.log('layer:', before, '→', refetched.getState_Layer());
```
### setstate_linewidth
# IPCB\_PrimitiveDimension.setState\_LineWidth() method
> 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.
Set the property state: Line width
## Signature
```typescript
function setState_LineWidth(lineWidth: number): IPCB_PrimitiveDimension;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
lineWidth
</td><td>
number
</td><td>
Line width
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveDimension](./IPCB_PrimitiveDimension.md)
Dimension primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免之前保留的测试标注重合
const x = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个 10mil 线宽的长度标注
const dim = await eda.pcb_PrimitiveDimension.create(
'Length Dimension',
[x, 2000, x, 1800, x + 2000, 1800, x + 2000, 2000],
3,
undefined,
10
);
const before = dim.getState_LineWidth();
// 3. 切换异步模式,线宽加粗到 20mil
const asyncDim = dim.toAsync();
asyncDim.setState_LineWidth(20);
await asyncDim.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveDimension.get(dim.getState_PrimitiveId());
console.log('lineWidth:', before, '→', refetched.getState_LineWidth());
```
### setstate_precision
# IPCB\_PrimitiveDimension.setState\_Precision() method
> 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.
Set the property state: precision
## Signature
```typescript
function setState_Precision(precision: number): IPCB_PrimitiveDimension;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
precision
</td><td>
number
</td><td>
Precision
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveDimension](./IPCB_PrimitiveDimension.md)
Dimension primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试标注重合
const x = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个精度为 2 位的长度标注
const dim = await eda.pcb_PrimitiveDimension.create(
'Length Dimension',
[x, 2000, x, 1800, x + 2000, 1800, x + 2000, 2000],
3,
undefined,
undefined,
2
);
const before = dim.getState_Precision();
// 3. 切换异步模式,精度提高到 3 位
const asyncDim = dim.toAsync();
asyncDim.setState_Precision(3);
await asyncDim.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveDimension.get(dim.getState_PrimitiveId());
console.log('precision:', before, '→', refetched.getState_Precision());
```
### setstate_primitivelock
# IPCB\_PrimitiveDimension.setState\_PrimitiveLock() method
> 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.
Set the property state: whether it is locked
## Signature
```typescript
function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitiveDimension;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveLock
</td><td>
boolean
</td><td>
Whether it is locked
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveDimension](./IPCB_PrimitiveDimension.md)
Dimension primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试标注重合
const x = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个未锁定的长度标注
const dim = await eda.pcb_PrimitiveDimension.create(
'Length Dimension',
[x, 2000, x, 1800, x + 2000, 1800, x + 2000, 2000],
3
);
const before = dim.getState_PrimitiveLock();
// 3. 切换异步模式并锁定标注
const asyncDim = dim.toAsync();
asyncDim.setState_PrimitiveLock(true);
await asyncDim.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveDimension.get(dim.getState_PrimitiveId());
console.log('primitiveLock:', before, '→', refetched.getState_PrimitiveLock());
```
### setstate_unit
# IPCB\_PrimitiveDimension.setState\_Unit() method
> 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.
Set the property state: unit
## Signature
```typescript
function setState_Unit(
unit: ESYS_Unit.MILLIMETER | ESYS_Unit.CENTIMETER | ESYS_Unit.INCH | ESYS_Unit.MIL,
): IPCB_PrimitiveDimension;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
unit
</td><td>
[ESYS\_Unit.MILLIMETER](../enums/ESYS_Unit.md) \| [ESYS\_Unit.CENTIMETER](../enums/ESYS_Unit.md) \| [ESYS\_Unit.INCH](../enums/ESYS_Unit.md) \| [ESYS\_Unit.MIL](../enums/ESYS_Unit.md)
</td><td>
Unit
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveDimension](./IPCB_PrimitiveDimension.md)
Dimension primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试标注重合
const x = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个默认毫米单位的长度标注
const dim = await eda.pcb_PrimitiveDimension.create(
'Length Dimension',
[x, 2000, x, 1800, x + 2000, 1800, x + 2000, 2000],
3
);
const before = dim.getState_Unit();
// 3. 切换异步模式,单位换成密尔
const asyncDim = dim.toAsync();
asyncDim.setState_Unit('mil');
await asyncDim.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveDimension.get(dim.getState_PrimitiveId());
console.log('unit:', before, '→', refetched.getState_Unit());
```
### toasync
# IPCB\_PrimitiveDimension.toAsync() method
Convert Primitive to Async primitive
## Signature
```typescript
function toAsync(): IPCB_PrimitiveDimension;
```
## Returns
[IPCB\_PrimitiveDimension](./IPCB_PrimitiveDimension.md)
Dimension primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试标注重合
const x = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个长度标注(创建后处于同步模式)
const dim = await eda.pcb_PrimitiveDimension.create(
'Length Dimension',
[x, 2000, x, 1800, x + 2000, 1800, x + 2000, 2000],
3,
undefined,
10
);
// 3. 转换为异步图元
const asyncDim = dim.toAsync();
// 4. 异步模式下累计修改并提交
asyncDim.setState_LineWidth(20);
await asyncDim.done();
// 5. 从画布重新读取,确认提交生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveDimension.get(dim.getState_PrimitiveId());
console.log('isAsync after toAsync:', dim.isAsync());
console.log('lineWidth:', 10, '→', refetched.getState_LineWidth());
```
### tosync
# IPCB\_PrimitiveDimension.toSync() method
Convert Primitive to Sync primitive
## Signature
```typescript
function toSync(): IPCB_PrimitiveDimension;
```
## Returns
[IPCB\_PrimitiveDimension](./IPCB_PrimitiveDimension.md)
Dimension primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试标注重合
const x = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个 10mil 线宽的长度标注
const dim = await eda.pcb_PrimitiveDimension.create(
'Length Dimension',
[x, 2000, x, 1800, x + 2000, 1800, x + 2000, 2000],
3,
undefined,
10
);
// 3. 转换为同步图元
const syncDim = dim.toSync();
// 4. 同步模式下修改线宽,立即生效(无需 done())
syncDim.setState_LineWidth(20);
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveDimension.get(dim.getState_PrimitiveId());
console.log('isSync after toSync:', !syncDim.isAsync());
console.log('lineWidth:', 10, '→', refetched.getState_LineWidth());
```
references/classes/IPCB_PrimitiveAttribute.md
# IPCB\_PrimitiveAttribute class
Property primitive
## Signature
```typescript
class IPCB_PrimitiveAttribute implements IPCB_Primitive
```
**Implements:** [IPCB\_Primitive](../interfaces/IPCB_Primitive.md)
## Constructors
<table><thead><tr><th>
Constructor
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[(constructor)(layer, x, y, key, value, keyVisible, valueVisible, fontFamily, fontSize, lineWidth, alignMode, rotation, reverse, expansion, mirror, primitiveLock, primitiveId, parentPrimitiveId)](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
Constructs a new instance of the `IPCB_PrimitiveAttribute` class
</td></tr>
</tbody></table>
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[done()](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Apply the changes to the primitives to the canvas
</td></tr>
<tr><td>
[getState\_AlignMode()](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: alignment mode
</td></tr>
<tr><td>
[getState\_Expansion()](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: inverted expansion
</td></tr>
<tr><td>
[getState\_FontFamily()](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: font
</td></tr>
<tr><td>
[getState\_FontSize()](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: font size
</td></tr>
<tr><td>
[getState\_Key()](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: Key
</td></tr>
<tr><td>
[getState\_KeyVisible()](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: Key whether it is visible
</td></tr>
<tr><td>
[getState\_Layer()](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: Layer
</td></tr>
<tr><td>
[getState\_LineWidth()](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: Line width
</td></tr>
<tr><td>
[getState\_Mirror()](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: whether it is mirrored
</td></tr>
<tr><td>
[getState\_ParentPrimitiveId()](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: associated parent primitive ID
</td></tr>
<tr><td>
[getState\_PrimitiveId()](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: primitive ID
</td></tr>
<tr><td>
[getState\_PrimitiveLock()](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: whether it is locked
</td></tr>
<tr><td>
[getState\_PrimitiveType()](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: primitive type
</td></tr>
<tr><td>
[getState\_Reverse()](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: whether it is inverted
</td></tr>
<tr><td>
[getState\_Rotation()](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: rotation angle
</td></tr>
<tr><td>
[getState\_Value()](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: Value
</td></tr>
<tr><td>
[getState\_ValueVisible()](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: Value whether it is visible
</td></tr>
<tr><td>
[getState\_X()](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: X coordinate
</td></tr>
<tr><td>
[getState\_Y()](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: Y coordinate
</td></tr>
<tr><td>
[isAsync()](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
Query whether the primitive is an async primitive
</td></tr>
<tr><td>
[reset()](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Reset the async primitive to the current canvas state
</td></tr>
<tr><td>
[setState\_AlignMode(alignMode)](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: alignment mode
</td></tr>
<tr><td>
[setState\_Expansion(expansion)](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: inverted expansion
</td></tr>
<tr><td>
[setState\_FontFamily(fontFamily)](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: font
</td></tr>
<tr><td>
[setState\_FontSize(fontSize)](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: font size
</td></tr>
<tr><td>
[setState\_Key(key)](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Key
</td></tr>
<tr><td>
[setState\_KeyVisible(keyVisible)](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Key whether it is visible
</td></tr>
<tr><td>
[setState\_Layer(layer)](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Layer
</td></tr>
<tr><td>
[setState\_LineWidth(lineWidth)](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Line width
</td></tr>
<tr><td>
[setState\_Mirror(mirror)](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: whether it is mirrored
</td></tr>
<tr><td>
[setState\_PrimitiveLock(primitiveLock)](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: whether it is locked
</td></tr>
<tr><td>
[setState\_Reverse(reverse)](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: whether it is inverted
</td></tr>
<tr><td>
[setState\_Rotation(rotation)](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: rotation angle
</td></tr>
<tr><td>
[setState\_Value(value)](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Value
</td></tr>
<tr><td>
[setState\_ValueVisible(valueVisible)](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Value whether it is visible
</td></tr>
<tr><td>
[setState\_X(x)](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: X coordinate
</td></tr>
<tr><td>
[setState\_Y(y)](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Y coordinate
</td></tr>
<tr><td>
[toAsync()](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
Convert Primitive to Async primitive
</td></tr>
<tr><td>
[toSync()](./IPCB_PrimitiveAttribute.md)
</td><td>
</td><td>
Convert Primitive to Sync primitive
</td></tr>
</tbody></table>
---
## 构造函数详情
### _constructor_
# IPCB\_PrimitiveAttribute.(constructor)
Constructs a new instance of the `IPCB_PrimitiveAttribute` class
## Signature
```typescript
function constructor(
layer: TPCB_LayersOfImage,
x: number | null,
y: number | null,
key: string,
value: string,
keyVisible: boolean,
valueVisible: boolean,
fontFamily: string,
fontSize: number,
lineWidth: number,
alignMode: EPCB_PrimitiveStringAlignMode,
rotation: number,
reverse: boolean,
expansion: number,
mirror: boolean,
primitiveLock: boolean,
primitiveId: string,
parentPrimitiveId: string,
);
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfImage](../types/TPCB_LayersOfImage.md)
</td><td>
</td></tr>
<tr><td>
x
</td><td>
number \| null
</td><td>
</td></tr>
<tr><td>
y
</td><td>
number \| null
</td><td>
</td></tr>
<tr><td>
key
</td><td>
string
</td><td>
</td></tr>
<tr><td>
value
</td><td>
string
</td><td>
</td></tr>
<tr><td>
keyVisible
</td><td>
boolean
</td><td>
</td></tr>
<tr><td>
valueVisible
</td><td>
boolean
</td><td>
</td></tr>
<tr><td>
fontFamily
</td><td>
string
</td><td>
</td></tr>
<tr><td>
fontSize
</td><td>
number
</td><td>
</td></tr>
<tr><td>
lineWidth
</td><td>
number
</td><td>
</td></tr>
<tr><td>
alignMode
</td><td>
[EPCB\_PrimitiveStringAlignMode](../enums/EPCB_PrimitiveStringAlignMode.md)
</td><td>
</td></tr>
<tr><td>
rotation
</td><td>
number
</td><td>
</td></tr>
<tr><td>
reverse
</td><td>
boolean
</td><td>
</td></tr>
<tr><td>
expansion
</td><td>
number
</td><td>
</td></tr>
<tr><td>
mirror
</td><td>
boolean
</td><td>
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
</td></tr>
<tr><td>
primitiveId
</td><td>
string
</td><td>
</td></tr>
<tr><td>
parentPrimitiveId
</td><td>
string
</td><td>
</td></tr>
</tbody></table>
---
## 方法详情
### done
# IPCB\_PrimitiveAttribute.done() method
> 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.
Apply the changes to the primitives to the canvas
## Signature
```typescript
function done(): Promise<IPCB_PrimitiveAttribute>;
```
## Returns
Promise<[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)<!-- -->>
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 记录修改前的字号和旋转角度
const fontSizeBefore = designator.getState_FontSize();
const rotationBefore = designator.getState_Rotation();
// 4. 批量修改两个属性,一次 done() 提交
const asyncAttr = designator.toAsync();
asyncAttr.setState_FontSize(60);
asyncAttr.setState_Rotation(90);
await asyncAttr.done();
// 5. 从画布重新读取,确认批量修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('fontSize:', fontSizeBefore, '→', refetched.getState_FontSize());
console.log('rotation:', rotationBefore, '→', refetched.getState_Rotation());
```
### getstate_alignmode
# IPCB\_PrimitiveAttribute.getState\_AlignMode() method
Get the property state: alignment mode
## Signature
```typescript
function getState_AlignMode(): EPCB_PrimitiveStringAlignMode;
```
## Returns
[EPCB\_PrimitiveStringAlignMode](../enums/EPCB_PrimitiveStringAlignMode.md)
Alignment mode
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取文本对齐模式
const alignMode = designator.getState_AlignMode();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.pcb_PrimitiveComponent.delete([compId]);
console.log('alignMode:', alignMode);
```
### getstate_expansion
# IPCB\_PrimitiveAttribute.getState\_Expansion() method
Get the property state: inverted expansion
## Signature
```typescript
function getState_Expansion(): number;
```
## Returns
number
Inverted expansion
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取反相扩展值
const expansion = designator.getState_Expansion();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.pcb_PrimitiveComponent.delete([compId]);
console.log('expansion:', expansion);
```
### getstate_fontfamily
# IPCB\_PrimitiveAttribute.getState\_FontFamily() method
Get the property state: font
## Signature
```typescript
function getState_FontFamily(): string;
```
## Returns
string
Font
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取字体名
const fontFamily = designator.getState_FontFamily();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.pcb_PrimitiveComponent.delete([compId]);
console.log('fontFamily:', fontFamily);
```
### getstate_fontsize
# IPCB\_PrimitiveAttribute.getState\_FontSize() method
Get the property state: font size
## Signature
```typescript
function getState_FontSize(): number;
```
## Returns
number
Font size
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取字号
const fontSize = designator.getState_FontSize();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.pcb_PrimitiveComponent.delete([compId]);
console.log('fontSize:', fontSize);
```
### getstate_key
# IPCB\_PrimitiveAttribute.getState\_Key() method
Get the property state: Key
## Signature
```typescript
function getState_Key(): string;
```
## Returns
string
Key
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的全部属性图元
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
// 3. 读取每个属性的 Key(属性名)
const keys = attrs.map(a => a.getState_Key());
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.pcb_PrimitiveComponent.delete([compId]);
console.log('keys:', keys.join(', '));
```
### getstate_keyvisible
# IPCB\_PrimitiveAttribute.getState\_KeyVisible() method
Get the property state: Key whether it is visible
## Signature
```typescript
function getState_KeyVisible(): boolean;
```
## Returns
boolean
Key whether it is visible
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取 Key 可见性
const keyVisible = designator.getState_KeyVisible();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.pcb_PrimitiveComponent.delete([compId]);
console.log('keyVisible:', keyVisible);
```
### getstate_layer
# IPCB\_PrimitiveAttribute.getState\_Layer() method
Get the property state: Layer
## Signature
```typescript
function getState_Layer(): TPCB_LayersOfImage;
```
## Returns
[TPCB\_LayersOfImage](../types/TPCB_LayersOfImage.md)
Layer
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取所在层
const layer = designator.getState_Layer();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.pcb_PrimitiveComponent.delete([compId]);
console.log('layer:', layer);
```
### getstate_linewidth
# IPCB\_PrimitiveAttribute.getState\_LineWidth() method
Get the property state: Line width
## Signature
```typescript
function getState_LineWidth(): number;
```
## Returns
number
Line width
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取线宽
const lineWidth = designator.getState_LineWidth();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.pcb_PrimitiveComponent.delete([compId]);
console.log('lineWidth:', lineWidth);
```
### getstate_mirror
# IPCB\_PrimitiveAttribute.getState\_Mirror() method
Get the property state: whether it is mirrored
## Signature
```typescript
function getState_Mirror(): boolean;
```
## Returns
boolean
Whether it is mirrored
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取镜像状态
const mirror = designator.getState_Mirror();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.pcb_PrimitiveComponent.delete([compId]);
console.log('mirror:', mirror);
```
### getstate_parentprimitiveid
# IPCB\_PrimitiveAttribute.getState\_ParentPrimitiveId() method
Get the property state: associated parent primitive ID
## Signature
```typescript
function getState_ParentPrimitiveId(): string;
```
## Returns
string
Associated parent primitive ID
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取父图元 ID
const parentPrimitiveId = designator.getState_ParentPrimitiveId();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.pcb_PrimitiveComponent.delete([compId]);
console.log('parentPrimitiveId:', parentPrimitiveId);
console.log('belongs to component:', parentPrimitiveId === compId);
```
### getstate_primitiveid
# IPCB\_PrimitiveAttribute.getState\_PrimitiveId() method
Get the property state: primitive ID
## Signature
```typescript
function getState_PrimitiveId(): string;
```
## Returns
string
Primitive ID
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取属性图元 ID
const primitiveId = designator.getState_PrimitiveId();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.pcb_PrimitiveComponent.delete([compId]);
console.log('primitiveId:', primitiveId);
```
### getstate_primitivelock
# IPCB\_PrimitiveAttribute.getState\_PrimitiveLock() method
Get the property state: whether it is locked
## Signature
```typescript
function getState_PrimitiveLock(): boolean;
```
## Returns
boolean
Whether it is locked
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取锁定状态
const primitiveLock = designator.getState_PrimitiveLock();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.pcb_PrimitiveComponent.delete([compId]);
console.log('primitiveLock:', primitiveLock);
```
### getstate_primitivetype
# IPCB\_PrimitiveAttribute.getState\_PrimitiveType() method
Get the property state: primitive type
## Signature
```typescript
function getState_PrimitiveType(): EPCB_PrimitiveType;
```
## Returns
[EPCB\_PrimitiveType](../enums/EPCB_PrimitiveType.md)
Primitive type
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取图元类型
const primitiveType = designator.getState_PrimitiveType();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.pcb_PrimitiveComponent.delete([compId]);
console.log('primitiveType:', primitiveType);
```
### getstate_reverse
# IPCB\_PrimitiveAttribute.getState\_Reverse() method
Get the property state: whether it is inverted
## Signature
```typescript
function getState_Reverse(): boolean;
```
## Returns
boolean
Whether it is inverted
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取反相状态
const reverse = designator.getState_Reverse();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.pcb_PrimitiveComponent.delete([compId]);
console.log('reverse:', reverse);
```
### getstate_rotation
# IPCB\_PrimitiveAttribute.getState\_Rotation() method
Get the property state: rotation angle
## Signature
```typescript
function getState_Rotation(): number;
```
## Returns
number
Rotation angle
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取旋转角度
const rotation = designator.getState_Rotation();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.pcb_PrimitiveComponent.delete([compId]);
console.log('rotation:', rotation);
```
### getstate_value
# IPCB\_PrimitiveAttribute.getState\_Value() method
Get the property state: Value
## Signature
```typescript
function getState_Value(): string;
```
## Returns
string
Value
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取属性值
const value = designator.getState_Value();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.pcb_PrimitiveComponent.delete([compId]);
console.log('value:', value);
```
### getstate_valuevisible
# IPCB\_PrimitiveAttribute.getState\_ValueVisible() method
Get the property state: Value whether it is visible
## Signature
```typescript
function getState_ValueVisible(): boolean;
```
## Returns
boolean
Value whether it is visible
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取 Value 可见性
const valueVisible = designator.getState_ValueVisible();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.pcb_PrimitiveComponent.delete([compId]);
console.log('valueVisible:', valueVisible);
```
### getstate_x
# IPCB\_PrimitiveAttribute.getState\_X() method
Get the property state: X coordinate
## Signature
```typescript
function getState_X(): number | null;
```
## Returns
number \| null
X coordinate
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取锚点 X 坐标
const x = designator.getState_X();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.pcb_PrimitiveComponent.delete([compId]);
console.log('x:', x);
```
### getstate_y
# IPCB\_PrimitiveAttribute.getState\_Y() method
Get the property state: Y coordinate
## Signature
```typescript
function getState_Y(): number | null;
```
## Returns
number \| null
Y coordinate
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取锚点 Y 坐标
const y = designator.getState_Y();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.pcb_PrimitiveComponent.delete([compId]);
console.log('y:', y);
```
### isasync
# IPCB\_PrimitiveAttribute.isAsync() method
Query whether the primitive is an async primitive
## Signature
```typescript
function isAsync(): boolean;
```
## Returns
boolean
Whether Is async primitive
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 查询异步状态
const isAsync = designator.isAsync();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.pcb_PrimitiveComponent.delete([compId]);
console.log('isAsync:', isAsync);
```
### reset
# IPCB\_PrimitiveAttribute.reset() method
> 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.
Reset the async primitive to the current canvas state
## Signature
```typescript
function reset(): Promise<IPCB_PrimitiveAttribute>;
```
## Returns
Promise<[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)<!-- -->>
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 记录画布上的原始值
const original = designator.getState_Value();
// 4. 异步模式下改一个错误值,但不提交,直接 reset() 丢弃
const asyncAttr = designator.toAsync();
asyncAttr.setState_Value('SHOULD-DISCARD');
await asyncAttr.reset();
// 5. 从画布重新读取,确认值仍是原始值(保留现场供观察)
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('value:', original, '→', refetched.getState_Value(), '(修改已丢弃)');
```
### setstate_alignmode
# IPCB\_PrimitiveAttribute.setState\_AlignMode() method
> 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.
Set the property state: alignment mode
## Signature
```typescript
function setState_AlignMode(alignMode: EPCB_PrimitiveStringAlignMode): IPCB_PrimitiveAttribute;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
alignMode
</td><td>
[EPCB\_PrimitiveStringAlignMode](../enums/EPCB_PrimitiveStringAlignMode.md)
</td><td>
Alignment mode
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取修改前的对齐模式
const before = designator.getState_AlignMode();
// 4. 切换异步模式改为居中对齐并提交
const asyncAttr = designator.toAsync();
asyncAttr.setState_AlignMode(5);
await asyncAttr.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('alignMode:', before, '→', refetched.getState_AlignMode());
```
### setstate_expansion
# IPCB\_PrimitiveAttribute.setState\_Expansion() method
> 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.
Set the property state: inverted expansion
## Signature
```typescript
function setState_Expansion(expansion: number): IPCB_PrimitiveAttribute;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
expansion
</td><td>
number
</td><td>
Inverted expansion
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取修改前的反相扩展
const before = designator.getState_Expansion();
// 4. 切换异步模式加大衬底扩展并提交
const asyncAttr = designator.toAsync();
asyncAttr.setState_Expansion(8);
await asyncAttr.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('expansion:', before, '→', refetched.getState_Expansion());
```
### setstate_fontfamily
# IPCB\_PrimitiveAttribute.setState\_FontFamily() method
> 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.
Set the property state: font
## Signature
```typescript
function setState_FontFamily(fontFamily: string): IPCB_PrimitiveAttribute;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fontFamily
</td><td>
string
</td><td>
Font
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取修改前的字体
const before = designator.getState_FontFamily();
// 4. 切换异步模式换成 Arial 并提交
const asyncAttr = designator.toAsync();
asyncAttr.setState_FontFamily('Arial');
await asyncAttr.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('fontFamily:', before, '→', refetched.getState_FontFamily());
```
### setstate_fontsize
# IPCB\_PrimitiveAttribute.setState\_FontSize() method
> 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.
Set the property state: font size
## Signature
```typescript
function setState_FontSize(fontSize: number): IPCB_PrimitiveAttribute;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fontSize
</td><td>
number
</td><td>
Font size
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取修改前的字号
const before = designator.getState_FontSize();
// 4. 切换异步模式加大字号并提交
const asyncAttr = designator.toAsync();
asyncAttr.setState_FontSize(60);
await asyncAttr.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('fontSize:', before, '→', refetched.getState_FontSize());
```
### setstate_key
# IPCB\_PrimitiveAttribute.setState\_Key() method
> 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.
Set the property state: Key
## Signature
```typescript
function setState_Key(key: string): IPCB_PrimitiveAttribute;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
key
</td><td>
string
</td><td>
Key
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取修改前的属性名
const before = designator.getState_Key();
// 4. 切换异步模式重命名属性并提交
const asyncAttr = designator.toAsync();
asyncAttr.setState_Key('Ref');
await asyncAttr.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('key:', before, '→', refetched.getState_Key());
```
### setstate_keyvisible
# IPCB\_PrimitiveAttribute.setState\_KeyVisible() method
> 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.
Set the property state: Key whether it is visible
## Signature
```typescript
function setState_KeyVisible(keyVisible: boolean): IPCB_PrimitiveAttribute;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
keyVisible
</td><td>
boolean
</td><td>
Key whether it is visible
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取修改前的 Key 可见性
const before = designator.getState_KeyVisible();
// 4. 切换异步模式打开 Key 显示并提交
const asyncAttr = designator.toAsync();
asyncAttr.setState_KeyVisible(true);
await asyncAttr.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('keyVisible:', before, '→', refetched.getState_KeyVisible());
```
### setstate_layer
# IPCB\_PrimitiveAttribute.setState\_Layer() method
> 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.
Set the property state: Layer
## Signature
```typescript
function setState_Layer(layer: TPCB_LayersOfImage): IPCB_PrimitiveAttribute;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfImage](../types/TPCB_LayersOfImage.md)
</td><td>
Layer
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取修改前的层
const before = designator.getState_Layer();
// 4. 切换异步模式挪到底层丝印(4)并提交
const asyncAttr = designator.toAsync();
asyncAttr.setState_Layer(4);
await asyncAttr.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('layer:', before, '→', refetched.getState_Layer());
```
### setstate_linewidth
# IPCB\_PrimitiveAttribute.setState\_LineWidth() method
> 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.
Set the property state: Line width
## Signature
```typescript
function setState_LineWidth(lineWidth: number): IPCB_PrimitiveAttribute;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
lineWidth
</td><td>
number
</td><td>
Line width
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取修改前的线宽
const before = designator.getState_LineWidth();
// 4. 切换异步模式加粗笔画并提交
const asyncAttr = designator.toAsync();
asyncAttr.setState_LineWidth(10);
await asyncAttr.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('lineWidth:', before, '→', refetched.getState_LineWidth());
```
### setstate_mirror
# IPCB\_PrimitiveAttribute.setState\_Mirror() method
> 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.
Set the property state: whether it is mirrored
## Signature
```typescript
function setState_Mirror(mirror: boolean): IPCB_PrimitiveAttribute;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
mirror
</td><td>
boolean
</td><td>
Whether it is mirrored
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取修改前的镜像状态
const before = designator.getState_Mirror();
// 4. 切换异步模式打开镜像并提交
const asyncAttr = designator.toAsync();
asyncAttr.setState_Mirror(true);
await asyncAttr.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('mirror:', before, '→', refetched.getState_Mirror());
```
### setstate_primitivelock
# IPCB\_PrimitiveAttribute.setState\_PrimitiveLock() method
> 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.
Set the property state: whether it is locked
## Signature
```typescript
function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitiveAttribute;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveLock
</td><td>
boolean
</td><td>
Whether it is locked
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取修改前的锁定状态
const before = designator.getState_PrimitiveLock();
// 4. 切换异步模式锁定属性并提交
const asyncAttr = designator.toAsync();
asyncAttr.setState_PrimitiveLock(true);
await asyncAttr.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('primitiveLock:', before, '→', refetched.getState_PrimitiveLock());
```
### setstate_reverse
# IPCB\_PrimitiveAttribute.setState\_Reverse() method
> 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.
Set the property state: whether it is inverted
## Signature
```typescript
function setState_Reverse(reverse: boolean): IPCB_PrimitiveAttribute;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
reverse
</td><td>
boolean
</td><td>
Whether it is inverted
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
Attribute primitive object
## Remarks
The default font does not support inversion
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取修改前的反相状态
const before = designator.getState_Reverse();
// 4. 切换异步模式:先换 Arial 字体(default 不支持反相),再开反相并提交
const asyncAttr = designator.toAsync();
asyncAttr.setState_FontFamily('Arial');
asyncAttr.setState_Reverse(true);
await asyncAttr.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('reverse:', before, '→', refetched.getState_Reverse());
```
### setstate_rotation
# IPCB\_PrimitiveAttribute.setState\_Rotation() method
> 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.
Set the property state: rotation angle
## Signature
```typescript
function setState_Rotation(rotation: number): IPCB_PrimitiveAttribute;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
rotation
</td><td>
number
</td><td>
Rotation angle
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取修改前的旋转角度
const before = designator.getState_Rotation();
// 4. 切换异步模式旋转 90° 并提交
const asyncAttr = designator.toAsync();
asyncAttr.setState_Rotation(90);
await asyncAttr.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('rotation:', before, '→', refetched.getState_Rotation());
```
### setstate_value
# IPCB\_PrimitiveAttribute.setState\_Value() method
> 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.
Set the property state: Value
## Signature
```typescript
function setState_Value(value: string): IPCB_PrimitiveAttribute;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
value
</td><td>
string
</td><td>
Value
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取修改前的属性值
const before = designator.getState_Value();
// 4. 切换异步模式修改属性值并提交
const asyncAttr = designator.toAsync();
asyncAttr.setState_Value(`${before}-MOD`);
await asyncAttr.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('value:', before, '→', refetched.getState_Value());
```
### setstate_valuevisible
# IPCB\_PrimitiveAttribute.setState\_ValueVisible() method
> 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.
Set the property state: Value whether it is visible
## Signature
```typescript
function setState_ValueVisible(valueVisible: boolean): IPCB_PrimitiveAttribute;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
valueVisible
</td><td>
boolean
</td><td>
Value whether it is visible
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取修改前的 Value 可见性
const before = designator.getState_ValueVisible();
// 4. 切换异步模式隐藏编号文本并提交
const asyncAttr = designator.toAsync();
asyncAttr.setState_ValueVisible(false);
await asyncAttr.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('valueVisible:', before, '→', refetched.getState_ValueVisible());
```
### setstate_x
# IPCB\_PrimitiveAttribute.setState\_X() method
> 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.
Set the property state: X coordinate
## Signature
```typescript
function setState_X(x: number): IPCB_PrimitiveAttribute;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
x
</td><td>
number
</td><td>
X coordinate
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取修改前的锚点 X 坐标
const before = designator.getState_X();
// 4. 切换异步模式向右移动 300mil 并提交
const asyncAttr = designator.toAsync();
asyncAttr.setState_X(before + 300);
await asyncAttr.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('x:', before, '→', refetched.getState_X());
```
### setstate_y
# IPCB\_PrimitiveAttribute.setState\_Y() method
> 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.
Set the property state: Y coordinate
## Signature
```typescript
function setState_Y(y: number): IPCB_PrimitiveAttribute;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
y
</td><td>
number
</td><td>
Y coordinate
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取修改前的锚点 Y 坐标
const before = designator.getState_Y();
// 4. 切换异步模式向上移动 300mil 并提交
const asyncAttr = designator.toAsync();
asyncAttr.setState_Y(before + 300);
await asyncAttr.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('y:', before, '→', refetched.getState_Y());
```
### toasync
# IPCB\_PrimitiveAttribute.toAsync() method
Convert Primitive to Async primitive
## Signature
```typescript
function toAsync(): IPCB_PrimitiveAttribute;
```
## Returns
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 转换为异步句柄并确认其异步状态
const asyncAttr = designator.toAsync();
// 4. 通过异步句柄修改字号并提交
asyncAttr.setState_FontSize(60);
await asyncAttr.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('isAsync:', asyncAttr.isAsync());
console.log('fontSize:', refetched.getState_FontSize());
```
### tosync
# IPCB\_PrimitiveAttribute.toSync() method
Convert Primitive to Sync primitive
## Signature
```typescript
function toSync(): IPCB_PrimitiveAttribute;
```
## Returns
[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取修改前的属性值
const before = designator.getState_Value();
// 4. 转换为同步图元后直接修改,立即生效(无需 done())
const syncAttr = designator.toSync();
syncAttr.setState_Value(`${before}-SYNC`);
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('value:', before, '→', refetched.getState_Value());
```
references/classes/IPCB_PrimitiveComponentPad.md
# IPCB\_PrimitiveComponentPad class
Device pad primitive
## Signature
```typescript
class IPCB_PrimitiveComponentPad extends IPCB_PrimitivePad
```
**Extends:** [IPCB\_PrimitivePad](./IPCB_PrimitivePad.md)
## Remarks
A device pad primitive is a special primitive. It refers to the pad associated with a footprint on the PCB canvas
You can only obtain a device pad primitive through [the getAllPinsByPrimitiveId method of the device class](./PCB_PrimitiveComponent.md) or [the getAllPads method of the device primitive](./IPCB_PrimitiveComponent.md)
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[primitiveType](./IPCB_PrimitiveComponentPad.md)
</td><td>
`protected`
`readonly`
</td><td>
[EPCB\_PrimitiveType.COMPONENT\_PAD](../enums/EPCB_PrimitiveType.md)
</td><td>
图元类型
</td></tr>
</tbody></table>
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[done()](./IPCB_PrimitiveComponentPad.md)
</td><td>
</td><td>
**_(BETA)_** Apply the changes to the primitives to the canvas
</td></tr>
<tr><td>
[getConnectedPrimitives(onlyCentreConnection)](./IPCB_PrimitiveComponentPad.md)
</td><td>
</td><td>
**_(BETA)_** Get connected primitives
</td></tr>
<tr><td>
[getConnectedPrimitives(onlyCentreConnection)](./IPCB_PrimitiveComponentPad.md)
</td><td>
</td><td>
</td></tr>
<tr><td>
[getState\_ParentComponentPrimitiveId()](./IPCB_PrimitiveComponentPad.md)
</td><td>
</td><td>
Get the property state: parent device primitive ID
</td></tr>
<tr><td>
[setState\_ParentComponentPrimitiveId()](./IPCB_PrimitiveComponentPad.md)
</td><td>
</td><td>
Set the property state: parent device primitive ID
</td></tr>
</tbody></table>
---
## 属性详情
### primitivetype
# IPCB\_PrimitiveComponentPad.primitiveType property
图元类型
## Signature
```typescript
function readonly primitiveType: EPCB_PrimitiveType.COMPONENT_PAD;
```
---
## 方法详情
### done
# IPCB\_PrimitiveComponentPad.done() method
> 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.
Apply the changes to the primitives to the canvas
## Signature
```typescript
function done(): Promise<IPCB_PrimitiveComponentPad>;
```
## Returns
Promise<[IPCB\_PrimitiveComponentPad](./IPCB_PrimitiveComponentPad.md)<!-- -->>
Device pad primitive object
## Example
```javascript
// 1. 放置一个测试器件并取第一个焊盘(随机坐标,避免与历史保留图元重合)
const x = 5000 + Math.floor(Math.random() * 50000);
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, 5000);
const pin = (await comp.getAllPins())[0];
// 2. 读取修改前的位置
const before = pin.getState_X();
// 3. 异步模式修改焊盘 X 坐标后一次提交
const asyncPin = pin.toAsync();
asyncPin.setState_X(before + 100);
await asyncPin.done();
// 4. 重新获取器件焊盘,验证修改已在画布生效
const refreshed = (await eda.pcb_PrimitiveComponent.get([comp.getState_PrimitiveId()]))[0];
const after = (await refreshed.getAllPins())[0].getState_X();
console.log('before:', before, '→ after:', after);
console.log('moved:', after === before + 100);
```
### getconnectedprimitives
# IPCB\_PrimitiveComponentPad.getConnectedPrimitives() method
> 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.
Get connected primitives
## Signature
```typescript
function getConnectedPrimitives(
onlyCentreConnection: true,
): Promise<Array<IPCB_PrimitiveLine | IPCB_PrimitiveArc | IPCB_PrimitiveVia>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
onlyCentreConnection
</td><td>
true
</td><td>
Whether to only use center connection. If it is `true`<!-- -->, only center-connected primitives (lines, arc lines, vias) are obtained; if it is `false`<!-- -->, all contacting primitives are obtained
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitiveLine](./IPCB_PrimitiveLine.md) \| [IPCB\_PrimitiveArc](./IPCB_PrimitiveArc.md) \| [IPCB\_PrimitiveVia](./IPCB_PrimitiveVia.md)<!-- -->>>
## Remarks
This API can get the primitives that are in direct contact with the pad
## Example
```javascript
// 1. 放置测试器件,取第一个焊盘的中心坐标
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
const compId = comp.getState_PrimitiveId();
const pin = (await comp.getAllPins())[0];
const padX = pin.getState_X();
const padY = pin.getState_Y();
// 2. 从焊盘中心拉一段走线(起点正好落在中心 → 属于中心连接)
const line = await eda.pcb_PrimitiveLine.create('', 1, padX, padY, padX + 600, padY, 10);
const lineId = line.getState_PrimitiveId();
// 3. 只查中心连接的图元
const centreConnected = await pin.getConnectedPrimitives(true);
// 4. 查所有接触的图元
const allConnected = await pin.getConnectedPrimitives(false);
// 5. 清理测试图元
await eda.pcb_PrimitiveLine.delete([lineId]);
await eda.pcb_PrimitiveComponent.delete([compId]);
console.log('centreConnectedCount:', centreConnected.length);
console.log('centreContainsLine:', centreConnected.some(p => p.getState_PrimitiveId() === lineId));
console.log('allConnectedCount:', allConnected.length);
```
### getconnectedprimitives_1
# IPCB\_PrimitiveComponentPad.getConnectedPrimitives() method
## Signature
```typescript
function getConnectedPrimitives(
onlyCentreConnection: false,
): Promise<
Array<
| IPCB_PrimitiveLine
| IPCB_PrimitiveArc
| IPCB_PrimitiveVia
| IPCB_PrimitivePolyline
| IPCB_PrimitiveFill
>
>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
onlyCentreConnection
</td><td>
false
</td><td>
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitiveLine](./IPCB_PrimitiveLine.md) \| [IPCB\_PrimitiveArc](./IPCB_PrimitiveArc.md) \| [IPCB\_PrimitiveVia](./IPCB_PrimitiveVia.md) \| [IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md) \| [IPCB\_PrimitiveFill](./IPCB_PrimitiveFill.md)<!-- -->>>
### getstate_parentcomponentprimitiveid
# IPCB\_PrimitiveComponentPad.getState\_ParentComponentPrimitiveId() method
Get the property state: parent device primitive ID
## Signature
```typescript
function getState_ParentComponentPrimitiveId(): string;
```
## Returns
string
Parent device primitive ID
## Example
```javascript
// 1. 放置一个测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
const compId = comp.getState_PrimitiveId();
// 2. 获取器件的焊盘图元对象,读取每个焊盘的父器件 ID
const pins = await comp.getAllPins();
const parentIds = pins.map(pin => pin.getState_ParentComponentPrimitiveId());
// 3. 清理测试器件
await eda.pcb_PrimitiveComponent.delete([compId]);
console.log('pinCount:', pins.length);
console.log('allBelongToComponent:', parentIds.every(id => id === compId));
console.log('firstPinParentId:', parentIds[0]);
```
### setstate_parentcomponentprimitiveid
# IPCB\_PrimitiveComponentPad.setState\_ParentComponentPrimitiveId() method
Set the property state: parent device primitive ID
## Signature
```typescript
function setState_ParentComponentPrimitiveId(): IPCB_PrimitiveComponentPad;
```
## Returns
[IPCB\_PrimitiveComponentPad](./IPCB_PrimitiveComponentPad.md)
Device pad primitive object
## Remarks
The properties of this device pad primitive do not support modification. Calling this API will have no effect
## Example
```javascript
// 1. 放置一个测试器件并获取焊盘图元对象
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
const compId = comp.getState_PrimitiveId();
const pin = (await comp.getAllPins())[0];
// 2. 调用前读取父器件 ID
const before = pin.getState_ParentComponentPrimitiveId();
// 3. 调用修改接口(无参数,实际不产生任何效果)
pin.setState_ParentComponentPrimitiveId();
// 4. 调用后再读一次,确认归属关系未变
const after = pin.getState_ParentComponentPrimitiveId();
console.log('parentUnchanged:', before === after);
console.log('stillBelongToComponent:', after === compId);
```
references/classes/IPCB_PrimitiveFill.md
# IPCB\_PrimitiveFill class
Fill primitive
## Signature
```typescript
class IPCB_PrimitiveFill implements IPCB_Primitive
```
**Implements:** [IPCB\_Primitive](../interfaces/IPCB_Primitive.md)
## Remarks
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[convertToPolyline()](./IPCB_PrimitiveFill.md)
</td><td>
</td><td>
**_(BETA)_** Convert to: polyline primitive
</td></tr>
<tr><td>
[convertToPour()](./IPCB_PrimitiveFill.md)
</td><td>
</td><td>
**_(BETA)_** Convert to: Copper border primitive
</td></tr>
<tr><td>
[convertToRegion()](./IPCB_PrimitiveFill.md)
</td><td>
</td><td>
**_(BETA)_** Convert to: region primitive (default is the forbidden region)
</td></tr>
<tr><td>
[done()](./IPCB_PrimitiveFill.md)
</td><td>
</td><td>
**_(BETA)_** Apply the changes to the primitives to the canvas
</td></tr>
<tr><td>
[getState\_ComplexPolygon()](./IPCB_PrimitiveFill.md)
</td><td>
</td><td>
Get the property state: complex polygon
</td></tr>
<tr><td>
[getState\_FillMode()](./IPCB_PrimitiveFill.md)
</td><td>
</td><td>
Get the property state: fill mode
</td></tr>
<tr><td>
[getState\_Layer()](./IPCB_PrimitiveFill.md)
</td><td>
</td><td>
Get the property state: Layer
</td></tr>
<tr><td>
[getState\_LineWidth()](./IPCB_PrimitiveFill.md)
</td><td>
</td><td>
Get the property state: Line width
</td></tr>
<tr><td>
[getState\_Net()](./IPCB_PrimitiveFill.md)
</td><td>
</td><td>
Get the property state: net name
</td></tr>
<tr><td>
[getState\_PrimitiveId()](./IPCB_PrimitiveFill.md)
</td><td>
</td><td>
Get the property state: primitive ID
</td></tr>
<tr><td>
[getState\_PrimitiveLock()](./IPCB_PrimitiveFill.md)
</td><td>
</td><td>
Get the property state: whether it is locked
</td></tr>
<tr><td>
[getState\_PrimitiveType()](./IPCB_PrimitiveFill.md)
</td><td>
</td><td>
Get the property state: primitive type
</td></tr>
<tr><td>
[isAsync()](./IPCB_PrimitiveFill.md)
</td><td>
</td><td>
Query whether the primitive is an async primitive
</td></tr>
<tr><td>
[reset()](./IPCB_PrimitiveFill.md)
</td><td>
</td><td>
**_(BETA)_** Reset the async primitive to the current canvas state
</td></tr>
<tr><td>
[setState\_ComplexPolygon(complexPolygon)](./IPCB_PrimitiveFill.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: complex polygon
</td></tr>
<tr><td>
[setState\_FillMode(fillMode)](./IPCB_PrimitiveFill.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: fill mode
</td></tr>
<tr><td>
[setState\_Layer(layer)](./IPCB_PrimitiveFill.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Layer
</td></tr>
<tr><td>
[setState\_LineWidth(lineWidth)](./IPCB_PrimitiveFill.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Line width
</td></tr>
<tr><td>
[setState\_Net(net)](./IPCB_PrimitiveFill.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: net name
</td></tr>
<tr><td>
[setState\_PrimitiveLock(primitiveLock)](./IPCB_PrimitiveFill.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: whether it is locked
</td></tr>
<tr><td>
[toAsync()](./IPCB_PrimitiveFill.md)
</td><td>
</td><td>
Convert Primitive to Async primitive
</td></tr>
<tr><td>
[toSync()](./IPCB_PrimitiveFill.md)
</td><td>
</td><td>
Convert Primitive to Sync primitive
</td></tr>
</tbody></table>
---
## 方法详情
### converttopolyline
# IPCB\_PrimitiveFill.convertToPolyline() method
> 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.
Convert to: polyline primitive
## Signature
```typescript
function convertToPolyline(): Promise<IPCB_PrimitivePolyline>;
```
## Returns
Promise<[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)<!-- -->>
Polyline primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个矩形填充
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const fill = await eda.pcb_PrimitiveFill.create(1, polygon, '', 0, 10, false);
// 3. 转换为折线图元(保留现场供观察)
const polyline = await fill.convertToPolyline();
console.log('primitiveType:', `Fill → ${polyline.getState_PrimitiveType()}`);
console.log('primitiveId:', polyline.getState_PrimitiveId());
```
### converttopour
# IPCB\_PrimitiveFill.convertToPour() method
> 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.
Convert to: Copper border primitive
## Signature
```typescript
function convertToPour(): Promise<IPCB_PrimitivePour>;
```
## Returns
Promise<[IPCB\_PrimitivePour](./IPCB_PrimitivePour.md)<!-- -->>
Copper border primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个矩形填充
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const fill = await eda.pcb_PrimitiveFill.create(1, polygon, '', 0, 10, false);
// 3. 转换为覆铜边框图元(保留现场供观察)
const pour = await fill.convertToPour();
console.log('primitiveType:', `Fill → ${pour.getState_PrimitiveType()}`);
console.log('primitiveId:', pour.getState_PrimitiveId());
```
### converttoregion
# IPCB\_PrimitiveFill.convertToRegion() method
> 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.
Convert to: region primitive (default is the forbidden region)
## Signature
```typescript
function convertToRegion(): Promise<IPCB_PrimitiveRegion>;
```
## Returns
Promise<[IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)<!-- -->>
Region primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个矩形填充
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const fill = await eda.pcb_PrimitiveFill.create(1, polygon, '', 0, 10, false);
// 3. 转换为区域图元(默认是禁止区域,保留现场供观察)
const region = await fill.convertToRegion();
console.log('primitiveType:', `Fill → ${region.getState_PrimitiveType()}`);
console.log('primitiveId:', region.getState_PrimitiveId());
```
### done
# IPCB\_PrimitiveFill.done() method
> 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.
Apply the changes to the primitives to the canvas
## Signature
```typescript
function done(): Promise<IPCB_PrimitiveFill>;
```
## Returns
Promise<[IPCB\_PrimitiveFill](./IPCB_PrimitiveFill.md)<!-- -->>
Fill primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个顶层铜层的矩形填充
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const fill = await eda.pcb_PrimitiveFill.create(1, polygon, '', 0, 10, false);
const before = fill.getState_Layer();
// 3. 异步模式下把填充挪到底层铜层(此时画布还没变)
const asyncFill = fill.toAsync();
asyncFill.setState_Layer(2);
await asyncFill.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveFill.get(fill.getState_PrimitiveId());
console.log('layer:', before, '→', refetched.getState_Layer());
```
### getstate_complexpolygon
# IPCB\_PrimitiveFill.getState\_ComplexPolygon() method
Get the property state: complex polygon
## Signature
```typescript
function getState_ComplexPolygon(): IPCB_Polygon;
```
## Returns
[IPCB\_Polygon](./IPCB_Polygon.md)
Complex polygon
## Example
```javascript
// 1. 创建一个已知轮廓的矩形填充(500 x 300 mil)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const fill = await eda.pcb_PrimitiveFill.create(1, polygon, '', 0, 10, false);
// 2. 读取复杂多边形对象,再取它的轮廓源数组
const complexPolygon = fill.getState_ComplexPolygon();
const source = complexPolygon.getSource();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveFill.delete([fill.getState_PrimitiveId()]);
console.log('polygonSource:', JSON.stringify(source));
```
### getstate_fillmode
# IPCB\_PrimitiveFill.getState\_FillMode() method
Get the property state: fill mode
## Signature
```typescript
function getState_FillMode(): EPCB_PrimitiveFillMode | undefined;
```
## Returns
[EPCB\_PrimitiveFillMode](../enums/EPCB_PrimitiveFillMode.md) \| undefined
Fill mode
## Example
```javascript
// 1. 创建一个实心填充的矩形
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const fill = await eda.pcb_PrimitiveFill.create(1, polygon, '', 0, 10, false);
// 2. 读取填充模式(0=SOLID 实心,1=MESH 网格,2=INNER_ELECTRICAL_LAYER 内电层)
const fillMode = fill.getState_FillMode();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveFill.delete([fill.getState_PrimitiveId()]);
console.log('fillMode:', fillMode);
```
### getstate_layer
# IPCB\_PrimitiveFill.getState\_Layer() method
Get the property state: Layer
## Signature
```typescript
function getState_Layer(): TPCB_LayersOfFill;
```
## Returns
[TPCB\_LayersOfFill](../types/TPCB_LayersOfFill.md)
Layer
## Example
```javascript
// 1. 创建一个顶层铜层(1)的矩形填充
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const fill = await eda.pcb_PrimitiveFill.create(1, polygon, '', 0, 10, false);
// 2. 读取填充所在层
const layer = fill.getState_Layer();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveFill.delete([fill.getState_PrimitiveId()]);
console.log('layer:', layer);
```
### getstate_linewidth
# IPCB\_PrimitiveFill.getState\_LineWidth() method
Get the property state: Line width
## Signature
```typescript
function getState_LineWidth(): number;
```
## Returns
number
Line width
## Example
```javascript
// 1. 创建一个 10mil 线宽的矩形填充
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const fill = await eda.pcb_PrimitiveFill.create(1, polygon, '', 0, 10, false);
// 2. 读取线宽
const lineWidth = fill.getState_LineWidth();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveFill.delete([fill.getState_PrimitiveId()]);
console.log('lineWidth:', lineWidth);
```
### getstate_net
# IPCB\_PrimitiveFill.getState\_Net() method
Get the property state: net name
## Signature
```typescript
function getState_Net(): string | undefined;
```
## Returns
string \| undefined
Net name
## Example
```javascript
// 1. 创建一个无网络的矩形填充
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const fill = await eda.pcb_PrimitiveFill.create(1, polygon, '', 0, 10, false);
// 2. 读取网络名称(无网络时为空字符串)
const net = fill.getState_Net();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveFill.delete([fill.getState_PrimitiveId()]);
console.log('net:', JSON.stringify(net));
```
### getstate_primitiveid
# IPCB\_PrimitiveFill.getState\_PrimitiveId() method
Get the property state: primitive ID
## Signature
```typescript
function getState_PrimitiveId(): string;
```
## Returns
string
Primitive ID
## Example
```javascript
// 1. 创建一个矩形填充
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const fill = await eda.pcb_PrimitiveFill.create(1, polygon, '', 0, 10, false);
// 2. 读取图元 ID
const primitiveId = fill.getState_PrimitiveId();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveFill.delete([fill.getState_PrimitiveId()]);
console.log('primitiveId:', primitiveId);
```
### getstate_primitivelock
# IPCB\_PrimitiveFill.getState\_PrimitiveLock() method
Get the property state: whether it is locked
## Signature
```typescript
function getState_PrimitiveLock(): boolean;
```
## Returns
boolean
Whether it is locked
## Example
```javascript
// 1. 创建一个未锁定的矩形填充
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const fill = await eda.pcb_PrimitiveFill.create(1, polygon, '', 0, 10, false);
// 2. 读取锁定状态
const primitiveLock = fill.getState_PrimitiveLock();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveFill.delete([fill.getState_PrimitiveId()]);
console.log('primitiveLock:', primitiveLock);
```
### getstate_primitivetype
# IPCB\_PrimitiveFill.getState\_PrimitiveType() method
Get the property state: primitive type
## Signature
```typescript
function getState_PrimitiveType(): EPCB_PrimitiveType;
```
## Returns
[EPCB\_PrimitiveType](../enums/EPCB_PrimitiveType.md)
Primitive type
## Example
```javascript
// 1. 创建一个矩形填充
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const fill = await eda.pcb_PrimitiveFill.create(1, polygon, '', 0, 10, false);
// 2. 读取图元类型
const primitiveType = fill.getState_PrimitiveType();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveFill.delete([fill.getState_PrimitiveId()]);
console.log('primitiveType:', primitiveType);
```
### isasync
# IPCB\_PrimitiveFill.isAsync() method
Query whether the primitive is an async primitive
## Signature
```typescript
function isAsync(): boolean;
```
## Returns
boolean
Whether Is async primitive
## Example
```javascript
// 1. 创建一个矩形填充
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const fill = await eda.pcb_PrimitiveFill.create(1, polygon, '', 0, 10, false);
// 2. 查询异步模式
const isAsync = fill.isAsync();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveFill.delete([fill.getState_PrimitiveId()]);
console.log('isAsync:', isAsync);
```
### reset
# IPCB\_PrimitiveFill.reset() method
> 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.
Reset the async primitive to the current canvas state
## Signature
```typescript
function reset(): Promise<IPCB_PrimitiveFill>;
```
## Returns
Promise<[IPCB\_PrimitiveFill](./IPCB_PrimitiveFill.md)<!-- -->>
Fill primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个顶层铜层的矩形填充
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const fill = await eda.pcb_PrimitiveFill.create(1, polygon, '', 0, 10, false);
const before = fill.getState_Layer();
// 3. 异步模式下把层改到底层(2),随后反悔
const asyncFill = fill.toAsync();
asyncFill.setState_Layer(2);
// 4. reset 丢弃未提交的修改(保留现场供观察)
await asyncFill.reset();
// 5. 从画布重新读取,确认层没有变
const refetched = await eda.pcb_PrimitiveFill.get(fill.getState_PrimitiveId());
console.log('layer:', before, '→', refetched.getState_Layer());
```
### setstate_complexpolygon
# IPCB\_PrimitiveFill.setState\_ComplexPolygon() method
> 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.
Set the property state: complex polygon
## Signature
```typescript
function setState_ComplexPolygon(complexPolygon: IPCB_Polygon): IPCB_PrimitiveFill;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
complexPolygon
</td><td>
[IPCB\_Polygon](./IPCB_Polygon.md)
</td><td>
Complex polygon
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveFill](./IPCB_PrimitiveFill.md)
Fill primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个 500 x 300 的矩形填充
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const fill = await eda.pcb_PrimitiveFill.create(1, polygon, '', 0, 10, false);
const before = JSON.stringify(fill.getState_ComplexPolygon().getSource());
// 3. 构造新轮廓(放大到 800 x 400),异步模式提交
const newPolygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 800, 400, 0, 0]);
const asyncFill = fill.toAsync();
asyncFill.setState_ComplexPolygon(newPolygon);
await asyncFill.done();
// 4. 从画布重新读取,确认轮廓已替换(保留现场供观察)
const refetched = await eda.pcb_PrimitiveFill.get(fill.getState_PrimitiveId());
const after = JSON.stringify(refetched.getState_ComplexPolygon().getSource());
console.log('polygonSource:', before, '→', after);
```
### setstate_fillmode
# IPCB\_PrimitiveFill.setState\_FillMode() method
> 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.
Set the property state: fill mode
## Signature
```typescript
function setState_FillMode(fillMode: EPCB_PrimitiveFillMode): IPCB_PrimitiveFill;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fillMode
</td><td>
[EPCB\_PrimitiveFillMode](../enums/EPCB_PrimitiveFillMode.md)
</td><td>
Fill mode
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveFill](./IPCB_PrimitiveFill.md)
Fill primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个内电层模式(2)的矩形填充
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const fill = await eda.pcb_PrimitiveFill.create(1, polygon, '', 2, 10, false);
const before = fill.getState_FillMode();
// 3. 异步模式切换为实心填充(0)
const asyncFill = fill.toAsync();
asyncFill.setState_FillMode(0);
await asyncFill.done();
// 4. 从画布重新读取,确认模式已切换(保留现场供观察)
const refetched = await eda.pcb_PrimitiveFill.get(fill.getState_PrimitiveId());
console.log('fillMode:', before, '→', refetched.getState_FillMode());
```
### setstate_layer
# IPCB\_PrimitiveFill.setState\_Layer() method
> 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.
Set the property state: Layer
## Signature
```typescript
function setState_Layer(layer: TPCB_LayersOfFill): IPCB_PrimitiveFill;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfFill](../types/TPCB_LayersOfFill.md)
</td><td>
Layer
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveFill](./IPCB_PrimitiveFill.md)
Fill primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个顶层铜层(1)的矩形填充
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const fill = await eda.pcb_PrimitiveFill.create(1, polygon, '', 0, 10, false);
const before = fill.getState_Layer();
// 3. 异步模式把填充挪到底层铜层(2)
const asyncFill = fill.toAsync();
asyncFill.setState_Layer(2);
await asyncFill.done();
// 4. 从画布重新读取,确认层已切换(保留现场供观察)
const refetched = await eda.pcb_PrimitiveFill.get(fill.getState_PrimitiveId());
console.log('layer:', before, '→', refetched.getState_Layer());
```
### setstate_linewidth
# IPCB\_PrimitiveFill.setState\_LineWidth() method
> 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.
Set the property state: Line width
## Signature
```typescript
function setState_LineWidth(lineWidth: number): IPCB_PrimitiveFill;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
lineWidth
</td><td>
number
</td><td>
Line width
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveFill](./IPCB_PrimitiveFill.md)
Fill primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个 10mil 线宽的矩形填充
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const fill = await eda.pcb_PrimitiveFill.create(1, polygon, '', 0, 10, false);
const before = fill.getState_LineWidth();
// 3. 切换异步模式,线宽加粗到 20mil
const asyncFill = fill.toAsync();
asyncFill.setState_LineWidth(20);
await asyncFill.done();
// 4. 从图元对象读回新值(保留现场供观察)
// 注:当前版本画布侧渲染线宽保持默认值,修改在图元对象上生效
const after = fill.getState_LineWidth();
console.log('lineWidth:', before, '→', after);
```
### setstate_net
# IPCB\_PrimitiveFill.setState\_Net() method
> 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.
Set the property state: net name
## Signature
```typescript
function setState_Net(net: string): IPCB_PrimitiveFill;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string
</td><td>
Net name
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveFill](./IPCB_PrimitiveFill.md)
Fill primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个无网络的矩形填充
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const fill = await eda.pcb_PrimitiveFill.create(1, polygon, '', 0, 10, false);
const before = fill.getState_Net();
// 3. 切换异步模式并指定网络('' → '嘉立创示例_NET')
const asyncFill = fill.toAsync();
asyncFill.setState_Net('嘉立创示例_NET');
await asyncFill.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveFill.get(fill.getState_PrimitiveId());
console.log('net:', JSON.stringify(before), '→', JSON.stringify(refetched.getState_Net()));
```
### setstate_primitivelock
# IPCB\_PrimitiveFill.setState\_PrimitiveLock() method
> 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.
Set the property state: whether it is locked
## Signature
```typescript
function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitiveFill;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveLock
</td><td>
boolean
</td><td>
Whether it is locked
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveFill](./IPCB_PrimitiveFill.md)
Fill primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个未锁定的矩形填充
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const fill = await eda.pcb_PrimitiveFill.create(1, polygon, '', 0, 10, false);
const before = fill.getState_PrimitiveLock();
// 3. 切换异步模式并锁定填充
const asyncFill = fill.toAsync();
asyncFill.setState_PrimitiveLock(true);
await asyncFill.done();
// 4. 从画布重新读取,确认已锁定(保留现场供观察)
const refetched = await eda.pcb_PrimitiveFill.get(fill.getState_PrimitiveId());
console.log('primitiveLock:', before, '→', refetched.getState_PrimitiveLock());
```
### toasync
# IPCB\_PrimitiveFill.toAsync() method
Convert Primitive to Async primitive
## Signature
```typescript
function toAsync(): IPCB_PrimitiveFill;
```
## Returns
[IPCB\_PrimitiveFill](./IPCB_PrimitiveFill.md)
Fill primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个无网络的矩形填充
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const fill = await eda.pcb_PrimitiveFill.create(1, polygon, '', 0, 10, false);
// 3. 切换异步模式后批量修改:划归网络 + 挪到底层
const asyncFill = fill.toAsync();
asyncFill.setState_Net('嘉立创示例_NET');
asyncFill.setState_Layer(2);
await asyncFill.done();
// 4. 从画布重新读取,确认批量修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveFill.get(fill.getState_PrimitiveId());
console.log('net:', JSON.stringify(refetched.getState_Net()));
console.log('layer:', refetched.getState_Layer());
```
### tosync
# IPCB\_PrimitiveFill.toSync() method
Convert Primitive to Sync primitive
## Signature
```typescript
function toSync(): IPCB_PrimitiveFill;
```
## Returns
[IPCB\_PrimitiveFill](./IPCB_PrimitiveFill.md)
Fill primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个矩形填充
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const fill = await eda.pcb_PrimitiveFill.create(1, polygon, '', 0, 10, false);
const before = fill.isAsync();
// 3. 转换为同步图元(保留现场供观察)
const syncFill = fill.toSync();
const after = syncFill.isAsync();
// 4. 同步图元直接读取属性,无需提交
console.log('isAsync:', before, '→', after);
console.log('primitiveType:', syncFill.getState_PrimitiveType());
console.log('layer:', syncFill.getState_Layer());
```
references/classes/IPCB_PrimitiveImage.md
# IPCB\_PrimitiveImage class
Image primitive
## Signature
```typescript
class IPCB_PrimitiveImage implements IPCB_Primitive
```
**Implements:** [IPCB\_Primitive](../interfaces/IPCB_Primitive.md)
## Remarks
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[done()](./IPCB_PrimitiveImage.md)
</td><td>
</td><td>
**_(BETA)_** Apply the changes to the primitives to the canvas
</td></tr>
<tr><td>
[getState\_ComplexPolygon()](./IPCB_PrimitiveImage.md)
</td><td>
</td><td>
Get the property state: image source data ( complex polygon)
</td></tr>
<tr><td>
[getState\_Height()](./IPCB_PrimitiveImage.md)
</td><td>
</td><td>
Get the property state: height
</td></tr>
<tr><td>
[getState\_HorizonMirror()](./IPCB_PrimitiveImage.md)
</td><td>
</td><td>
Get the property state: whether it is horizontally mirrored
</td></tr>
<tr><td>
[getState\_Layer()](./IPCB_PrimitiveImage.md)
</td><td>
</td><td>
Get the property state: Layer
</td></tr>
<tr><td>
[getState\_PrimitiveId()](./IPCB_PrimitiveImage.md)
</td><td>
</td><td>
Get the property state: primitive ID
</td></tr>
<tr><td>
[getState\_PrimitiveLock()](./IPCB_PrimitiveImage.md)
</td><td>
</td><td>
Get the property state: whether it is locked
</td></tr>
<tr><td>
[getState\_PrimitiveType()](./IPCB_PrimitiveImage.md)
</td><td>
</td><td>
Get the property state: primitive type
</td></tr>
<tr><td>
[getState\_Rotation()](./IPCB_PrimitiveImage.md)
</td><td>
</td><td>
Get the property state: rotation angle
</td></tr>
<tr><td>
[getState\_Width()](./IPCB_PrimitiveImage.md)
</td><td>
</td><td>
Get the property state: width
</td></tr>
<tr><td>
[getState\_X()](./IPCB_PrimitiveImage.md)
</td><td>
</td><td>
Get the property state: BBox top-left point coordinates X
</td></tr>
<tr><td>
[getState\_Y()](./IPCB_PrimitiveImage.md)
</td><td>
</td><td>
Get the property state: BBox top-left point coordinates Y
</td></tr>
<tr><td>
[isAsync()](./IPCB_PrimitiveImage.md)
</td><td>
</td><td>
Query whether the primitive is an async primitive
</td></tr>
<tr><td>
[reset()](./IPCB_PrimitiveImage.md)
</td><td>
</td><td>
**_(BETA)_** Reset the async primitive to the current canvas state
</td></tr>
<tr><td>
[setState\_Height(height)](./IPCB_PrimitiveImage.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: height
</td></tr>
<tr><td>
[setState\_HorizonMirror(horizonMirror)](./IPCB_PrimitiveImage.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: whether it is horizontally mirrored
</td></tr>
<tr><td>
[setState\_Layer(layer)](./IPCB_PrimitiveImage.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Layer
</td></tr>
<tr><td>
[setState\_PrimitiveLock(primitiveLock)](./IPCB_PrimitiveImage.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: whether it is locked
</td></tr>
<tr><td>
[setState\_Rotation(rotation)](./IPCB_PrimitiveImage.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: rotation angle
</td></tr>
<tr><td>
[setState\_Width(width)](./IPCB_PrimitiveImage.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: width
</td></tr>
<tr><td>
[setState\_X(x)](./IPCB_PrimitiveImage.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: BBox top-left point coordinates X
</td></tr>
<tr><td>
[setState\_Y(y)](./IPCB_PrimitiveImage.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: BBox top-left point coordinates Y
</td></tr>
<tr><td>
[toAsync()](./IPCB_PrimitiveImage.md)
</td><td>
</td><td>
Convert Primitive to Async primitive
</td></tr>
<tr><td>
[toSync()](./IPCB_PrimitiveImage.md)
</td><td>
</td><td>
Convert Primitive to Sync primitive
</td></tr>
</tbody></table>
---
## 方法详情
### done
# IPCB\_PrimitiveImage.done() method
> 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.
Apply the changes to the primitives to the canvas
## Signature
```typescript
function done(): Promise<IPCB_PrimitiveImage>;
```
## Returns
Promise<[IPCB\_PrimitiveImage](./IPCB_PrimitiveImage.md)<!-- -->>
Image primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个 400 x 300 的顶层图像
const complexPolygon = eda.pcb_MathPolygon.createComplexPolygon([0, 0, 'L', 200, 0, 200, 150, 0, 150]);
const image = await eda.pcb_PrimitiveImage.create(x, y, complexPolygon, 1, 400, 300, 0, false, false);
const before = image.getState_Rotation();
// 3. 异步模式下旋转 90 度(此时画布还没变)
const asyncImage = image.toAsync();
asyncImage.setState_Rotation(90);
await asyncImage.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveImage.get(image.getState_PrimitiveId());
console.log('rotation:', before, '→', refetched.getState_Rotation());
```
### getstate_complexpolygon
# IPCB\_PrimitiveImage.getState\_ComplexPolygon() method
Get the property state: image source data ( complex polygon)
## Signature
```typescript
function getState_ComplexPolygon(): TPCB_PolygonSourceArray | Array<TPCB_PolygonSourceArray>;
```
## Returns
[TPCB\_PolygonSourceArray](../types/TPCB_PolygonSourceArray.md) \| Array<[TPCB\_PolygonSourceArray](../types/TPCB_PolygonSourceArray.md)<!-- -->>
Image source data ( complex polygon)
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个源轮廓为折线多边形的顶层图像
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const complexPolygon = eda.pcb_MathPolygon.createComplexPolygon([0, 0, 'L', 200, 0, 200, 150, 0, 150]);
const image = await eda.pcb_PrimitiveImage.create(x, y, complexPolygon, 1, 400, 300, 0, false, false);
// 2. 读取源多边形数据(返回轮廓源数组)
const source = image.getState_ComplexPolygon();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveImage.delete([image.getState_PrimitiveId()]);
console.log('polygonSource:', JSON.stringify(source));
```
### getstate_height
# IPCB\_PrimitiveImage.getState\_Height() method
Get the property state: height
## Signature
```typescript
function getState_Height(): number;
```
## Returns
number
Height
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个 400 x 300 的顶层图像
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const complexPolygon = eda.pcb_MathPolygon.createComplexPolygon([0, 0, 'L', 200, 0, 200, 150, 0, 150]);
const image = await eda.pcb_PrimitiveImage.create(x, y, complexPolygon, 1, 400, 300, 0, false, false);
// 2. 读取图像高度
const height = image.getState_Height();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveImage.delete([image.getState_PrimitiveId()]);
console.log('height:', height);
```
### getstate_horizonmirror
# IPCB\_PrimitiveImage.getState\_HorizonMirror() method
Get the property state: whether it is horizontally mirrored
## Signature
```typescript
function getState_HorizonMirror(): boolean;
```
## Returns
boolean
Whether it is horizontally mirrored
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个未镜像的顶层图像
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const complexPolygon = eda.pcb_MathPolygon.createComplexPolygon([0, 0, 'L', 200, 0, 200, 150, 0, 150]);
const image = await eda.pcb_PrimitiveImage.create(x, y, complexPolygon, 1, 400, 300, 0, false, false);
// 2. 读取镜像状态
const horizonMirror = image.getState_HorizonMirror();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveImage.delete([image.getState_PrimitiveId()]);
console.log('horizonMirror:', horizonMirror);
```
### getstate_layer
# IPCB\_PrimitiveImage.getState\_Layer() method
Get the property state: Layer
## Signature
```typescript
function getState_Layer(): TPCB_LayersOfImage;
```
## Returns
[TPCB\_LayersOfImage](../types/TPCB_LayersOfImage.md)
Layer
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个顶层铜层(1)的图像
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const complexPolygon = eda.pcb_MathPolygon.createComplexPolygon([0, 0, 'L', 200, 0, 200, 150, 0, 150]);
const image = await eda.pcb_PrimitiveImage.create(x, y, complexPolygon, 1, 400, 300, 0, false, false);
// 2. 读取图像所在层
const layer = image.getState_Layer();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveImage.delete([image.getState_PrimitiveId()]);
console.log('layer:', layer);
```
### getstate_primitiveid
# IPCB\_PrimitiveImage.getState\_PrimitiveId() method
Get the property state: primitive ID
## Signature
```typescript
function getState_PrimitiveId(): string;
```
## Returns
string
Primitive ID
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个顶层图像
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const complexPolygon = eda.pcb_MathPolygon.createComplexPolygon([0, 0, 'L', 200, 0, 200, 150, 0, 150]);
const image = await eda.pcb_PrimitiveImage.create(x, y, complexPolygon, 1, 400, 300, 0, false, false);
// 2. 读取图元 ID
const primitiveId = image.getState_PrimitiveId();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveImage.delete([primitiveId]);
console.log('primitiveId:', primitiveId);
```
### getstate_primitivelock
# IPCB\_PrimitiveImage.getState\_PrimitiveLock() method
Get the property state: whether it is locked
## Signature
```typescript
function getState_PrimitiveLock(): boolean;
```
## Returns
boolean
Whether it is locked
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个未锁定的顶层图像
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const complexPolygon = eda.pcb_MathPolygon.createComplexPolygon([0, 0, 'L', 200, 0, 200, 150, 0, 150]);
const image = await eda.pcb_PrimitiveImage.create(x, y, complexPolygon, 1, 400, 300, 0, false, false);
// 2. 读取锁定状态
const primitiveLock = image.getState_PrimitiveLock();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveImage.delete([image.getState_PrimitiveId()]);
console.log('primitiveLock:', primitiveLock);
```
### getstate_primitivetype
# IPCB\_PrimitiveImage.getState\_PrimitiveType() method
Get the property state: primitive type
## Signature
```typescript
function getState_PrimitiveType(): EPCB_PrimitiveType;
```
## Returns
[EPCB\_PrimitiveType](../enums/EPCB_PrimitiveType.md)
Primitive type
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个顶层图像
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const complexPolygon = eda.pcb_MathPolygon.createComplexPolygon([0, 0, 'L', 200, 0, 200, 150, 0, 150]);
const image = await eda.pcb_PrimitiveImage.create(x, y, complexPolygon, 1, 400, 300, 0, false, false);
// 2. 读取图元类型
const primitiveType = image.getState_PrimitiveType();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveImage.delete([image.getState_PrimitiveId()]);
console.log('primitiveType:', primitiveType);
```
### getstate_rotation
# IPCB\_PrimitiveImage.getState\_Rotation() method
Get the property state: rotation angle
## Signature
```typescript
function getState_Rotation(): number;
```
## Returns
number
Rotation angle
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个未旋转的顶层图像
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const complexPolygon = eda.pcb_MathPolygon.createComplexPolygon([0, 0, 'L', 200, 0, 200, 150, 0, 150]);
const image = await eda.pcb_PrimitiveImage.create(x, y, complexPolygon, 1, 400, 300, 0, false, false);
// 2. 读取旋转角度
const rotation = image.getState_Rotation();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveImage.delete([image.getState_PrimitiveId()]);
console.log('rotation:', rotation);
```
### getstate_width
# IPCB\_PrimitiveImage.getState\_Width() method
Get the property state: width
## Signature
```typescript
function getState_Width(): number;
```
## Returns
number
Width
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个 400 x 300 的顶层图像
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const complexPolygon = eda.pcb_MathPolygon.createComplexPolygon([0, 0, 'L', 200, 0, 200, 150, 0, 150]);
const image = await eda.pcb_PrimitiveImage.create(x, y, complexPolygon, 1, 400, 300, 0, false, false);
// 2. 读取图像宽度
const width = image.getState_Width();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveImage.delete([image.getState_PrimitiveId()]);
console.log('width:', width);
```
### getstate_x
# IPCB\_PrimitiveImage.getState\_X() method
Get the property state: BBox top-left point coordinates X
## Signature
```typescript
function getState_X(): number;
```
## Returns
number
BBox top-left point coordinates X
## Example
```javascript
// 1. 生成本次运行专用的坐标,在 (x, y) 处创建一个顶层图像
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const complexPolygon = eda.pcb_MathPolygon.createComplexPolygon([0, 0, 'L', 200, 0, 200, 150, 0, 150]);
const image = await eda.pcb_PrimitiveImage.create(x, y, complexPolygon, 1, 400, 300, 0, false, false);
// 2. 读取 BBox 左上点坐标 X
const imageX = image.getState_X();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveImage.delete([image.getState_PrimitiveId()]);
console.log('x:', imageX);
```
### getstate_y
# IPCB\_PrimitiveImage.getState\_Y() method
Get the property state: BBox top-left point coordinates Y
## Signature
```typescript
function getState_Y(): number;
```
## Returns
number
BBox top-left point coordinates Y
## Example
```javascript
// 1. 生成本次运行专用的坐标,在 (x, y) 处创建一个顶层图像
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const complexPolygon = eda.pcb_MathPolygon.createComplexPolygon([0, 0, 'L', 200, 0, 200, 150, 0, 150]);
const image = await eda.pcb_PrimitiveImage.create(x, y, complexPolygon, 1, 400, 300, 0, false, false);
// 2. 读取 BBox 左上点坐标 Y
const imageY = image.getState_Y();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveImage.delete([image.getState_PrimitiveId()]);
console.log('y:', imageY);
```
### isasync
# IPCB\_PrimitiveImage.isAsync() method
Query whether the primitive is an async primitive
## Signature
```typescript
function isAsync(): boolean;
```
## Returns
boolean
Whether Is async primitive
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个顶层图像
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const complexPolygon = eda.pcb_MathPolygon.createComplexPolygon([0, 0, 'L', 200, 0, 200, 150, 0, 150]);
const image = await eda.pcb_PrimitiveImage.create(x, y, complexPolygon, 1, 400, 300, 0, false, false);
// 2. 查询异步模式
const isAsync = image.isAsync();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveImage.delete([image.getState_PrimitiveId()]);
console.log('isAsync:', isAsync);
```
### reset
# IPCB\_PrimitiveImage.reset() method
> 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.
Reset the async primitive to the current canvas state
## Signature
```typescript
function reset(): Promise<IPCB_PrimitiveImage>;
```
## Returns
Promise<[IPCB\_PrimitiveImage](./IPCB_PrimitiveImage.md)<!-- -->>
Image primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个未旋转的顶层图像
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const complexPolygon = eda.pcb_MathPolygon.createComplexPolygon([0, 0, 'L', 200, 0, 200, 150, 0, 150]);
const image = await eda.pcb_PrimitiveImage.create(x, y, complexPolygon, 1, 400, 300, 0, false, false);
const before = image.getState_Rotation();
// 2. 异步模式下把图像旋转 90 度,随后反悔
const asyncImage = image.toAsync();
asyncImage.setState_Rotation(90);
// 3. reset 丢弃未提交的修改(保留现场供观察)
await asyncImage.reset();
// 4. 从画布重新读取,确认旋转没有变
const refetched = await eda.pcb_PrimitiveImage.get(image.getState_PrimitiveId());
console.log('rotation:', before, '→', refetched.getState_Rotation());
```
### setstate_height
# IPCB\_PrimitiveImage.setState\_Height() method
> 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.
Set the property state: height
## Signature
```typescript
function setState_Height(height: number): IPCB_PrimitiveImage;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
height
</td><td>
number
</td><td>
Height
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveImage](./IPCB_PrimitiveImage.md)
Image primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个 400 x 300 的顶层图像
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const complexPolygon = eda.pcb_MathPolygon.createComplexPolygon([0, 0, 'L', 200, 0, 200, 150, 0, 150]);
const image = await eda.pcb_PrimitiveImage.create(x, y, complexPolygon, 1, 400, 300, 0, false, false);
const before = image.getState_Height();
// 2. 异步模式把高度从 300 调到 450
const asyncImage = image.toAsync();
asyncImage.setState_Height(450);
await asyncImage.done();
// 3. 从画布重新读取,确认高度已更新(保留现场供观察)
const refetched = await eda.pcb_PrimitiveImage.get(image.getState_PrimitiveId());
console.log('height:', before, '→', refetched.getState_Height());
```
### setstate_horizonmirror
# IPCB\_PrimitiveImage.setState\_HorizonMirror() method
> 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.
Set the property state: whether it is horizontally mirrored
## Signature
```typescript
function setState_HorizonMirror(horizonMirror: boolean): IPCB_PrimitiveImage;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
horizonMirror
</td><td>
boolean
</td><td>
Whether it is horizontally mirrored
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveImage](./IPCB_PrimitiveImage.md)
Image primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个未镜像的顶层图像
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const complexPolygon = eda.pcb_MathPolygon.createComplexPolygon([0, 0, 'L', 200, 0, 200, 150, 0, 150]);
const image = await eda.pcb_PrimitiveImage.create(x, y, complexPolygon, 1, 400, 300, 0, false, false);
const before = image.getState_HorizonMirror();
// 2. 异步模式开启水平镜像
const asyncImage = image.toAsync();
asyncImage.setState_HorizonMirror(true);
await asyncImage.done();
// 3. 从画布重新读取,确认镜像已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveImage.get(image.getState_PrimitiveId());
console.log('horizonMirror:', before, '→', refetched.getState_HorizonMirror());
```
### setstate_layer
# IPCB\_PrimitiveImage.setState\_Layer() method
> 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.
Set the property state: Layer
## Signature
```typescript
function setState_Layer(layer: TPCB_LayersOfImage): IPCB_PrimitiveImage;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfImage](../types/TPCB_LayersOfImage.md)
</td><td>
Layer
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveImage](./IPCB_PrimitiveImage.md)
Image primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个顶层铜层(1)的图像
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const complexPolygon = eda.pcb_MathPolygon.createComplexPolygon([0, 0, 'L', 200, 0, 200, 150, 0, 150]);
const image = await eda.pcb_PrimitiveImage.create(x, y, complexPolygon, 1, 400, 300, 0, false, false);
const before = image.getState_Layer();
// 2. 异步模式把图像挪到顶层丝印层(3)
const asyncImage = image.toAsync();
asyncImage.setState_Layer(3);
await asyncImage.done();
// 3. 从画布重新读取,确认层已切换(保留现场供观察)
const refetched = await eda.pcb_PrimitiveImage.get(image.getState_PrimitiveId());
console.log('layer:', before, '→', refetched.getState_Layer());
```
### setstate_primitivelock
# IPCB\_PrimitiveImage.setState\_PrimitiveLock() method
> 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.
Set the property state: whether it is locked
## Signature
```typescript
function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitiveImage;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveLock
</td><td>
boolean
</td><td>
Whether it is locked
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveImage](./IPCB_PrimitiveImage.md)
Image primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个未锁定的顶层图像
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const complexPolygon = eda.pcb_MathPolygon.createComplexPolygon([0, 0, 'L', 200, 0, 200, 150, 0, 150]);
const image = await eda.pcb_PrimitiveImage.create(x, y, complexPolygon, 1, 400, 300, 0, false, false);
const before = image.getState_PrimitiveLock();
// 2. 异步模式锁定图像
const asyncImage = image.toAsync();
asyncImage.setState_PrimitiveLock(true);
await asyncImage.done();
// 3. 从画布重新读取,确认锁定已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveImage.get(image.getState_PrimitiveId());
console.log('primitiveLock:', before, '→', refetched.getState_PrimitiveLock());
```
### setstate_rotation
# IPCB\_PrimitiveImage.setState\_Rotation() method
> 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.
Set the property state: rotation angle
## Signature
```typescript
function setState_Rotation(rotation: number): IPCB_PrimitiveImage;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
rotation
</td><td>
number
</td><td>
Rotation angle
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveImage](./IPCB_PrimitiveImage.md)
Image primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个未旋转的顶层图像
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const complexPolygon = eda.pcb_MathPolygon.createComplexPolygon([0, 0, 'L', 200, 0, 200, 150, 0, 150]);
const image = await eda.pcb_PrimitiveImage.create(x, y, complexPolygon, 1, 400, 300, 0, false, false);
const before = image.getState_Rotation();
// 2. 异步模式旋转 90 度
const asyncImage = image.toAsync();
asyncImage.setState_Rotation(90);
await asyncImage.done();
// 3. 从画布重新读取,确认角度已更新(保留现场供观察)
const refetched = await eda.pcb_PrimitiveImage.get(image.getState_PrimitiveId());
console.log('rotation:', before, '→', refetched.getState_Rotation());
```
### setstate_width
# IPCB\_PrimitiveImage.setState\_Width() method
> 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.
Set the property state: width
## Signature
```typescript
function setState_Width(width: number): IPCB_PrimitiveImage;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
width
</td><td>
number
</td><td>
Width
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveImage](./IPCB_PrimitiveImage.md)
Image primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个 400 x 300 的顶层图像
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const complexPolygon = eda.pcb_MathPolygon.createComplexPolygon([0, 0, 'L', 200, 0, 200, 150, 0, 150]);
const image = await eda.pcb_PrimitiveImage.create(x, y, complexPolygon, 1, 400, 300, 0, false, false);
const before = image.getState_Width();
// 2. 异步模式把宽度从 400 调到 600
const asyncImage = image.toAsync();
asyncImage.setState_Width(600);
await asyncImage.done();
// 3. 从画布重新读取,确认宽度已更新(保留现场供观察)
const refetched = await eda.pcb_PrimitiveImage.get(image.getState_PrimitiveId());
console.log('width:', before, '→', refetched.getState_Width());
```
### setstate_x
# IPCB\_PrimitiveImage.setState\_X() method
> 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.
Set the property state: BBox top-left point coordinates X
## Signature
```typescript
function setState_X(x: number): IPCB_PrimitiveImage;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
x
</td><td>
number
</td><td>
BBox top-left point coordinates X
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveImage](./IPCB_PrimitiveImage.md)
Image primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个顶层图像
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const complexPolygon = eda.pcb_MathPolygon.createComplexPolygon([0, 0, 'L', 200, 0, 200, 150, 0, 150]);
const image = await eda.pcb_PrimitiveImage.create(x, y, complexPolygon, 1, 400, 300, 0, false, false);
const before = image.getState_X();
// 2. 异步模式把图像右移 500 mil
const asyncImage = image.toAsync();
asyncImage.setState_X(before + 500);
await asyncImage.done();
// 3. 从画布重新读取,确认位置已更新(保留现场供观察)
const refetched = await eda.pcb_PrimitiveImage.get(image.getState_PrimitiveId());
console.log('x:', before, '→', refetched.getState_X());
```
### setstate_y
# IPCB\_PrimitiveImage.setState\_Y() method
> 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.
Set the property state: BBox top-left point coordinates Y
## Signature
```typescript
function setState_Y(y: number): IPCB_PrimitiveImage;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
y
</td><td>
number
</td><td>
BBox top-left point coordinates Y
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveImage](./IPCB_PrimitiveImage.md)
Image primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个顶层图像
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const complexPolygon = eda.pcb_MathPolygon.createComplexPolygon([0, 0, 'L', 200, 0, 200, 150, 0, 150]);
const image = await eda.pcb_PrimitiveImage.create(x, y, complexPolygon, 1, 400, 300, 0, false, false);
const before = image.getState_Y();
// 2. 异步模式把图像下移 500 mil
const asyncImage = image.toAsync();
asyncImage.setState_Y(before + 500);
await asyncImage.done();
// 3. 从画布重新读取,确认位置已更新(保留现场供观察)
const refetched = await eda.pcb_PrimitiveImage.get(image.getState_PrimitiveId());
console.log('y:', before, '→', refetched.getState_Y());
```
### toasync
# IPCB\_PrimitiveImage.toAsync() method
Convert Primitive to Async primitive
## Signature
```typescript
function toAsync(): IPCB_PrimitiveImage;
```
## Returns
[IPCB\_PrimitiveImage](./IPCB_PrimitiveImage.md)
Image primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个 400 x 300 的顶层图像
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const complexPolygon = eda.pcb_MathPolygon.createComplexPolygon([0, 0, 'L', 200, 0, 200, 150, 0, 150]);
const image = await eda.pcb_PrimitiveImage.create(x, y, complexPolygon, 1, 400, 300, 0, false, false);
// 2. 切换异步模式后批量修改:放大到 600 x 450
const asyncImage = image.toAsync();
asyncImage.setState_Width(600);
asyncImage.setState_Height(450);
await asyncImage.done();
// 3. 从画布重新读取,确认批量修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveImage.get(image.getState_PrimitiveId());
console.log('width:', refetched.getState_Width());
console.log('height:', refetched.getState_Height());
```
### tosync
# IPCB\_PrimitiveImage.toSync() method
Convert Primitive to Sync primitive
## Signature
```typescript
function toSync(): IPCB_PrimitiveImage;
```
## Returns
[IPCB\_PrimitiveImage](./IPCB_PrimitiveImage.md)
Image primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个 400 x 300 的顶层图像
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const complexPolygon = eda.pcb_MathPolygon.createComplexPolygon([0, 0, 'L', 200, 0, 200, 150, 0, 150]);
const image = await eda.pcb_PrimitiveImage.create(x, y, complexPolygon, 1, 400, 300, 0, false, false);
const before = image.isAsync();
// 2. 转换为同步图元(保留现场供观察)
const syncImage = image.toSync();
const after = syncImage.isAsync();
// 3. 同步图元直接读取属性,无需提交
console.log('isAsync:', before, '→', after);
console.log('primitiveType:', syncImage.getState_PrimitiveType());
console.log('layer:', syncImage.getState_Layer());
```
references/classes/IPCB_PrimitiveComponent.md
# IPCB\_PrimitiveComponent class
Device primitive
## Signature
```typescript
class IPCB_PrimitiveComponent implements IPCB_Primitive
```
**Implements:** [IPCB\_Primitive](../interfaces/IPCB_Primitive.md)
## Remarks
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[done()](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Apply the changes to the primitives to the canvas
</td></tr>
<tr><td>
[getAllPins()](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Get all pads associated with the device
</td></tr>
<tr><td>
[getState\_AddIntoBom()](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: whether to add BOM
</td></tr>
<tr><td>
[getState\_Component()](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: associate library device
</td></tr>
<tr><td>
[getState\_Designator()](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: designator
</td></tr>
<tr><td>
[getState\_Footprint()](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: associate library footprint
</td></tr>
<tr><td>
[getState\_Layer()](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: Layer
</td></tr>
<tr><td>
[getState\_Manufacturer()](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: manufacturer
</td></tr>
<tr><td>
[getState\_ManufacturerId()](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: manufacturer ID
</td></tr>
<tr><td>
[getState\_Model3D()](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: associate library 3D model
</td></tr>
<tr><td>
[getState\_Name()](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: name
</td></tr>
<tr><td>
[getState\_OtherProperty()](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: other parameters
</td></tr>
<tr><td>
[getState\_Pads()](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: pad
</td></tr>
<tr><td>
[getState\_PrimitiveId()](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: primitive ID
</td></tr>
<tr><td>
[getState\_PrimitiveLock()](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: whether it is locked
</td></tr>
<tr><td>
[getState\_PrimitiveType()](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: primitive type
</td></tr>
<tr><td>
[getState\_Rotation()](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: rotation angle
</td></tr>
<tr><td>
[getState\_Supplier()](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: supplier
</td></tr>
<tr><td>
[getState\_SupplierId()](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: supplier ID
</td></tr>
<tr><td>
[getState\_UniqueId()](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: unique ID
</td></tr>
<tr><td>
[getState\_X()](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: X coordinate
</td></tr>
<tr><td>
[getState\_Y()](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: Y coordinate
</td></tr>
<tr><td>
[isAsync()](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
Query whether the primitive is an async primitive
</td></tr>
<tr><td>
[reset()](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Reset the async primitive to the current canvas state
</td></tr>
<tr><td>
[setAttribute(key, value, keyVisible, valueVisible)](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set Property
</td></tr>
<tr><td>
[setState\_AddIntoBom(addIntoBom)](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: whether to add BOM
</td></tr>
<tr><td>
[setState\_Designator(designator)](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: designator
</td></tr>
<tr><td>
[setState\_Layer(layer)](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Layer
</td></tr>
<tr><td>
[setState\_Manufacturer(manufacturer)](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: manufacturer
</td></tr>
<tr><td>
[setState\_ManufacturerId(manufacturerId)](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: manufacturer ID
</td></tr>
<tr><td>
[setState\_Name(name)](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: name
</td></tr>
<tr><td>
[setState\_OtherProperty(otherProperty)](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: other parameters
</td></tr>
<tr><td>
[setState\_PrimitiveLock(primitiveLock)](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: whether it is locked
</td></tr>
<tr><td>
[setState\_Rotation(rotation)](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: rotation angle
</td></tr>
<tr><td>
[setState\_Supplier(supplier)](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: supplier
</td></tr>
<tr><td>
[setState\_SupplierId(supplierId)](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: supplier ID
</td></tr>
<tr><td>
[setState\_UniqueId(uniqueId)](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: unique ID
</td></tr>
<tr><td>
[setState\_X(x)](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: X coordinate
</td></tr>
<tr><td>
[setState\_Y(y)](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Y coordinate
</td></tr>
<tr><td>
[toAsync()](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
Convert Primitive to Async primitive
</td></tr>
<tr><td>
[toSync()](./IPCB_PrimitiveComponent.md)
</td><td>
</td><td>
Convert Primitive to Sync primitive
</td></tr>
</tbody></table>
---
## 方法详情
### done
# IPCB\_PrimitiveComponent.done() method
> 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.
Apply the changes to the primitives to the canvas
## Signature
```typescript
function done(): Promise<IPCB_PrimitiveComponent>;
```
## Returns
Promise<[IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)<!-- -->>
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const compId = comp.getState_PrimitiveId();
// 3. 记录修改前的位号和旋转角度
const designatorBefore = comp.getState_Designator();
const rotationBefore = comp.getState_Rotation();
// 4. 批量修改两个属性,一次 done() 提交
const asyncComp = comp.toAsync();
asyncComp.setState_Designator('C101');
asyncComp.setState_Rotation(90);
await asyncComp.done();
// 5. 从画布重新读取,确认批量修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
console.log('designator:', designatorBefore, '→', refetched[0].getState_Designator());
console.log('rotation:', rotationBefore, '→', refetched[0].getState_Rotation());
```
### getallpins
# IPCB\_PrimitiveComponent.getAllPins() method
> 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.
Get all pads associated with the device
## Signature
```typescript
function getAllPins(): Promise<Array<IPCB_PrimitiveComponentPad>>;
```
## Returns
Promise<Array<[IPCB\_PrimitiveComponentPad](./IPCB_PrimitiveComponentPad.md)<!-- -->>>
Device pad primitive array
## Example
```javascript
// 1. 放置一个测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
const compId = comp.getState_PrimitiveId();
// 2. 获取器件关联的所有焊盘图元
const pins = await comp.getAllPins();
// 3. 逐个读取焊盘的归属器件和图元 ID
const pinInfos = pins.map(pin => ({
parentMatch: pin.getState_ParentComponentPrimitiveId() === compId,
primitiveId: pin.getState_PrimitiveId(),
}));
// 4. 清理测试器件
await eda.pcb_PrimitiveComponent.delete([compId]);
console.log('pinCount:', pins.length);
console.log('allBelongToComponent:', pinInfos.every(p => p.parentMatch));
console.log('firstPinPrimitiveId:', pinInfos[0].primitiveId);
```
### getstate_addintobom
# IPCB\_PrimitiveComponent.getState\_AddIntoBom() method
Get the property state: whether to add BOM
## Signature
```typescript
function getState_AddIntoBom(): boolean;
```
## Returns
boolean
Whether Add to BOM
## Example
```javascript
// 1. 放置一个测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
// 2. 读取是否加入 BOM
const addIntoBom = comp.getState_AddIntoBom();
// 3. 清理测试器件
await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
console.log('addIntoBom:', addIntoBom);
```
### getstate_component
# IPCB\_PrimitiveComponent.getState\_Component() method
Get the property state: associate library device
## Signature
```typescript
function getState_Component(): { libraryUuid: string; uuid: string; name?: string } | undefined;
```
## Returns
{ libraryUuid: string; uuid: string; name?: string } \| undefined
Associate library device
## Example
```javascript
// 1. 放置一个测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
// 2. 读取关联的库器件信息
const component = comp.getState_Component();
// 3. 清理测试器件
await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
console.log('deviceName:', component.name);
console.log('deviceUuid:', component.uuid);
console.log('libraryUuid:', component.libraryUuid);
```
### getstate_designator
# IPCB\_PrimitiveComponent.getState\_Designator() method
Get the property state: designator
## Signature
```typescript
function getState_Designator(): string | undefined;
```
## Returns
string \| undefined
Designator
## Example
```javascript
// 1. 放置一个测试器件(位号由系统自动分配)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
// 2. 读取位号
const designator = comp.getState_Designator();
// 3. 清理测试器件
await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
console.log('designator:', designator);
```
### getstate_footprint
# IPCB\_PrimitiveComponent.getState\_Footprint() method
Get the property state: associate library footprint
## Signature
```typescript
function getState_Footprint(): { libraryUuid: string; uuid: string; name?: string } | undefined;
```
## Returns
{ libraryUuid: string; uuid: string; name?: string } \| undefined
Associate library footprint
## Example
```javascript
// 1. 放置一个测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
// 2. 读取关联的库封装信息
const footprint = comp.getState_Footprint();
// 3. 清理测试器件
await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
console.log('footprintName:', footprint.name);
console.log('footprintUuid:', footprint.uuid);
console.log('libraryUuid:', footprint.libraryUuid);
```
### getstate_layer
# IPCB\_PrimitiveComponent.getState\_Layer() method
Get the property state: Layer
## Signature
```typescript
function getState_Layer(): TPCB_LayersOfComponent;
```
## Returns
[TPCB\_LayersOfComponent](../types/TPCB_LayersOfComponent.md)
Layer
## Example
```javascript
// 1. 放置一个测试器件(默认贴在顶面)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
// 2. 读取所在面(1=顶面, 2=底面)
const layer = comp.getState_Layer();
// 3. 清理测试器件
await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
console.log('layer:', layer, layer === 1 ? '(顶面)' : '(底面)');
```
### getstate_manufacturer
# IPCB\_PrimitiveComponent.getState\_Manufacturer() method
Get the property state: manufacturer
## Signature
```typescript
function getState_Manufacturer(): string | undefined;
```
## Returns
string \| undefined
Manufacturer
## Example
```javascript
// 1. 放置一个测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
// 2. 读取制造商
const manufacturer = comp.getState_Manufacturer();
// 3. 清理测试器件
await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
console.log('manufacturer:', manufacturer);
```
### getstate_manufacturerid
# IPCB\_PrimitiveComponent.getState\_ManufacturerId() method
Get the property state: manufacturer ID
## Signature
```typescript
function getState_ManufacturerId(): string | undefined;
```
## Returns
string \| undefined
Manufacturer ID
## Example
```javascript
// 1. 放置一个测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
// 2. 读取制造商编号
const manufacturerId = comp.getState_ManufacturerId();
// 3. 清理测试器件
await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
console.log('manufacturerId:', manufacturerId);
```
### getstate_model3d
# IPCB\_PrimitiveComponent.getState\_Model3D() method
Get the property state: associate library 3D model
## Signature
```typescript
function getState_Model3D(): { libraryUuid: string; uuid: string; name?: string } | undefined;
```
## Returns
{ libraryUuid: string; uuid: string; name?: string } \| undefined
Associate library 3D model
## Example
```javascript
// 1. 放置一个测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
// 2. 读取关联的 3D 模型信息(未关联时返回 undefined)
const model3d = comp.getState_Model3D();
// 3. 清理测试器件
await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
console.log('model3dName:', model3d ? model3d.name : '(未关联 3D 模型)');
console.log('model3dUuid:', model3d ? model3d.uuid : '(未关联 3D 模型)');
```
### getstate_name
# IPCB\_PrimitiveComponent.getState\_Name() method
Get the property state: name
## Signature
```typescript
function getState_Name(): string | undefined;
```
## Returns
string \| undefined
Name
## Example
```javascript
// 1. 放置一个测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
// 2. 读取名称
const name = comp.getState_Name();
// 3. 清理测试器件
await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
console.log('name:', name);
```
### getstate_otherproperty
# IPCB\_PrimitiveComponent.getState\_OtherProperty() method
Get the property state: other parameters
## Signature
```typescript
function getState_OtherProperty(): Record<string, string | number | boolean> | undefined;
```
## Returns
Record<string, string \| number \| boolean> \| undefined
Other parameters
## Example
```javascript
// 1. 放置一个测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
// 2. 读取其它参数字典
const otherProperty = comp.getState_OtherProperty();
// 3. 清理测试器件
await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
console.log('propertyCount:', Object.keys(otherProperty).length);
console.log('value:', otherProperty.Value);
console.log('description:', otherProperty.Description);
```
### getstate_pads
# IPCB\_PrimitiveComponent.getState\_Pads() method
Get the property state: pad
## Signature
```typescript
function getState_Pads():
Array<{ primitiveId: string; net: string; padNumber: string }> | undefined;
```
## Returns
Array<{ primitiveId: string; net: string; padNumber: string }> \| undefined
Pad
## Example
```javascript
// 1. 放置一个测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
// 2. 读取焊盘摘要数据
const pads = comp.getState_Pads();
// 3. 摘要出每个焊盘的编号与网络
const padSummaries = pads.map(pad => ({ padNumber: pad.padNumber, net: pad.net }));
// 4. 清理测试器件
await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
console.log('padCount:', pads.length);
console.log('padSummaries:', JSON.stringify(padSummaries));
```
### getstate_primitiveid
# IPCB\_PrimitiveComponent.getState\_PrimitiveId() method
Get the property state: primitive ID
## Signature
```typescript
function getState_PrimitiveId(): string;
```
## Returns
string
Primitive ID
## Example
```javascript
// 1. 放置一个测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
// 2. 读取图元 ID
const primitiveId = comp.getState_PrimitiveId();
// 3. 清理测试器件
await eda.pcb_PrimitiveComponent.delete([primitiveId]);
console.log('primitiveId:', primitiveId);
```
### getstate_primitivelock
# IPCB\_PrimitiveComponent.getState\_PrimitiveLock() method
Get the property state: whether it is locked
## Signature
```typescript
function getState_PrimitiveLock(): boolean;
```
## Returns
boolean
Whether it is locked
## Example
```javascript
// 1. 放置一个测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
// 2. 读取锁定状态
const primitiveLock = comp.getState_PrimitiveLock();
// 3. 清理测试器件
await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
console.log('primitiveLock:', primitiveLock);
```
### getstate_primitivetype
# IPCB\_PrimitiveComponent.getState\_PrimitiveType() method
Get the property state: primitive type
## Signature
```typescript
function getState_PrimitiveType(): EPCB_PrimitiveType;
```
## Returns
[EPCB\_PrimitiveType](../enums/EPCB_PrimitiveType.md)
Primitive type
## Example
```javascript
// 1. 放置一个测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
// 2. 读取图元类型
const primitiveType = comp.getState_PrimitiveType();
// 3. 清理测试器件
await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
console.log('primitiveType:', primitiveType);
```
### getstate_rotation
# IPCB\_PrimitiveComponent.getState\_Rotation() method
Get the property state: rotation angle
## Signature
```typescript
function getState_Rotation(): number;
```
## Returns
number
Rotation angle
## Example
```javascript
// 1. 放置一个测试器件(默认 0 度)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
// 2. 读取旋转角度
const rotation = comp.getState_Rotation();
// 3. 清理测试器件
await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
console.log('rotation:', rotation);
```
### getstate_supplier
# IPCB\_PrimitiveComponent.getState\_Supplier() method
Get the property state: supplier
## Signature
```typescript
function getState_Supplier(): string | undefined;
```
## Returns
string \| undefined
Supplier
## Example
```javascript
// 1. 放置一个测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
// 2. 读取供应商
const supplier = comp.getState_Supplier();
// 3. 清理测试器件
await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
console.log('supplier:', supplier);
```
### getstate_supplierid
# IPCB\_PrimitiveComponent.getState\_SupplierId() method
Get the property state: supplier ID
## Signature
```typescript
function getState_SupplierId(): string | undefined;
```
## Returns
string \| undefined
Supplier ID
## Example
```javascript
// 1. 放置一个测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
// 2. 读取供应商编号
const supplierId = comp.getState_SupplierId();
// 3. 清理测试器件
await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
console.log('supplierId:', supplierId);
```
### getstate_uniqueid
# IPCB\_PrimitiveComponent.getState\_UniqueId() method
Get the property state: unique ID
## Signature
```typescript
function getState_UniqueId(): string | undefined;
```
## Returns
string \| undefined
Unique ID
## Example
```javascript
// 1. 放置一个测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
// 2. 读取唯一 ID
const uniqueId = comp.getState_UniqueId();
// 3. 清理测试器件
await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
console.log('uniqueId:', JSON.stringify(uniqueId));
```
### getstate_x
# IPCB\_PrimitiveComponent.getState\_X() method
Get the property state: X coordinate
## Signature
```typescript
function getState_X(): number;
```
## Returns
number
X coordinate
## Example
```javascript
// 1. 放置一个测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
// 2. 读取锚点 X 坐标
const x = comp.getState_X();
// 3. 清理测试器件
await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
console.log('x:', x);
```
### getstate_y
# IPCB\_PrimitiveComponent.getState\_Y() method
Get the property state: Y coordinate
## Signature
```typescript
function getState_Y(): number;
```
## Returns
number
Y coordinate
## Example
```javascript
// 1. 放置一个测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
// 2. 读取锚点 Y 坐标
const y = comp.getState_Y();
// 3. 清理测试器件
await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
console.log('y:', y);
```
### isasync
# IPCB\_PrimitiveComponent.isAsync() method
Query whether the primitive is an async primitive
## Signature
```typescript
function isAsync(): boolean;
```
## Returns
boolean
Whether Is async primitive
## Example
```javascript
// 1. 放置一个测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
// 2. 查询异步状态
const isAsync = comp.isAsync();
// 3. 清理测试器件
await eda.pcb_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
console.log('isAsync:', isAsync);
```
### reset
# IPCB\_PrimitiveComponent.reset() method
> 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.
Reset the async primitive to the current canvas state
## Signature
```typescript
function reset(): Promise<IPCB_PrimitiveComponent>;
```
## Returns
Promise<[IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)<!-- -->>
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件(默认 0 度)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const compId = comp.getState_PrimitiveId();
// 3. 记录画布上的原始旋转角度
const original = comp.getState_Rotation();
// 4. 异步模式下改一个错误值,但不提交,直接 reset() 丢弃
const asyncComp = comp.toAsync();
asyncComp.setState_Rotation(270);
await asyncComp.reset();
// 5. 从画布重新读取,确认值仍是原始值(保留现场供观察)
const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
console.log('rotation:', original, '→', refetched[0].getState_Rotation(), '(修改已丢弃)');
```
### setattribute
# IPCB\_PrimitiveComponent.setAttribute() method
> 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.
Set Property
## Signature
```typescript
function setAttribute(
key: string,
value?: string | number | boolean,
keyVisible?: boolean,
valueVisible?: boolean,
): Promise<IPCB_PrimitiveAttribute>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
key
</td><td>
string
</td><td>
Attribute name. If the device does not have an attribute with this name, the attribute will be added
</td></tr>
<tr><td>
value
</td><td>
string \| number \| boolean
</td><td>
_(Optional)_ Property value
</td></tr>
<tr><td>
keyVisible
</td><td>
boolean
</td><td>
_(Optional)_ Attribute name visibility
</td></tr>
<tr><td>
valueVisible
</td><td>
boolean
</td><td>
_(Optional)_ Attribute value visibility
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)<!-- -->>
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const compId = comp.getState_PrimitiveId();
// 3. 设置自定义属性(属性名、属性值、名称可见、值可见)
await comp.setAttribute('嘉立创示例_Tolerance', '1%', true, true);
// 4. 通过属性图元接口确认属性已写入(保留现场供观察)
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const added = attrs.find(a => a.getState_Key() === '嘉立创示例_Tolerance');
console.log('attrKey:', added.getState_Key());
console.log('attrValue:', added.getState_Value());
```
### setstate_addintobom
# IPCB\_PrimitiveComponent.setState\_AddIntoBom() method
> 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.
Set the property state: whether to add BOM
## Signature
```typescript
function setState_AddIntoBom(addIntoBom: boolean): IPCB_PrimitiveComponent;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
addIntoBom
</td><td>
boolean
</td><td>
Whether Add to BOM
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const compId = comp.getState_PrimitiveId();
// 3. 读取修改前的值
const before = comp.getState_AddIntoBom();
// 4. 异步模式改为不加入 BOM 并提交
const asyncComp = comp.toAsync();
asyncComp.setState_AddIntoBom(false);
await asyncComp.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
console.log('addIntoBom:', before, '→', refetched[0].getState_AddIntoBom());
```
### setstate_designator
# IPCB\_PrimitiveComponent.setState\_Designator() method
> 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.
Set the property state: designator
## Signature
```typescript
function setState_Designator(designator: string | undefined): IPCB_PrimitiveComponent;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
designator
</td><td>
string \| undefined
</td><td>
Designator
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件(位号由系统自动分配)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const compId = comp.getState_PrimitiveId();
// 3. 读取修改前的位号
const before = comp.getState_Designator();
// 4. 异步模式改位号并提交
const asyncComp = comp.toAsync();
asyncComp.setState_Designator('C101');
await asyncComp.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
console.log('designator:', before, '→', refetched[0].getState_Designator());
```
### setstate_layer
# IPCB\_PrimitiveComponent.setState\_Layer() method
> 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.
Set the property state: Layer
## Signature
```typescript
function setState_Layer(layer: TPCB_LayersOfComponent): IPCB_PrimitiveComponent;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfComponent](../types/TPCB_LayersOfComponent.md)
</td><td>
Layer
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件(默认贴顶面)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const compId = comp.getState_PrimitiveId();
// 3. 读取修改前的所在面
const before = comp.getState_Layer();
// 4. 异步模式翻到底面并提交
const asyncComp = comp.toAsync();
asyncComp.setState_Layer(2);
await asyncComp.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
console.log('layer:', before, '→', refetched[0].getState_Layer());
```
### setstate_manufacturer
# IPCB\_PrimitiveComponent.setState\_Manufacturer() method
> 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.
Set the property state: manufacturer
## Signature
```typescript
function setState_Manufacturer(manufacturer: string | undefined): IPCB_PrimitiveComponent;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
manufacturer
</td><td>
string \| undefined
</td><td>
Manufacturer
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const compId = comp.getState_PrimitiveId();
// 3. 读取修改前的制造商
const before = comp.getState_Manufacturer();
// 4. 异步模式修改制造商并提交
const asyncComp = comp.toAsync();
asyncComp.setState_Manufacturer('嘉立创示例_MFR');
await asyncComp.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
console.log('manufacturer:', before, '→', refetched[0].getState_Manufacturer());
```
### setstate_manufacturerid
# IPCB\_PrimitiveComponent.setState\_ManufacturerId() method
> 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.
Set the property state: manufacturer ID
## Signature
```typescript
function setState_ManufacturerId(manufacturerId: string | undefined): IPCB_PrimitiveComponent;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
manufacturerId
</td><td>
string \| undefined
</td><td>
Manufacturer ID
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const compId = comp.getState_PrimitiveId();
// 3. 读取修改前的制造商编号
const before = comp.getState_ManufacturerId();
// 4. 异步模式修改制造商编号并提交
const asyncComp = comp.toAsync();
asyncComp.setState_ManufacturerId('MFR-DEMO-001');
await asyncComp.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
console.log('manufacturerId:', before, '→', refetched[0].getState_ManufacturerId());
```
### setstate_name
# IPCB\_PrimitiveComponent.setState\_Name() method
> 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.
Set the property state: name
## Signature
```typescript
function setState_Name(name: string | undefined): IPCB_PrimitiveComponent;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
name
</td><td>
string \| undefined
</td><td>
Name
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const compId = comp.getState_PrimitiveId();
// 3. 读取修改前的名称(模板表达式)
const before = comp.getState_Name();
// 4. 异步模式改为固定名称并提交
const asyncComp = comp.toAsync();
asyncComp.setState_Name('嘉立创示例_Name');
await asyncComp.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
console.log('name:', before, '→', refetched[0].getState_Name());
```
### setstate_otherproperty
# IPCB\_PrimitiveComponent.setState\_OtherProperty() method
> 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.
Set the property state: other parameters
## Signature
```typescript
function setState_OtherProperty(
otherProperty: Record<string, string | number | boolean>,
): IPCB_PrimitiveComponent;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
otherProperty
</td><td>
Record<string, string \| number \| boolean>
</td><td>
Other parameters
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const compId = comp.getState_PrimitiveId();
// 3. 读取修改前的参数数量
const beforeCount = Object.keys(comp.getState_OtherProperty() || {}).length;
// 4. 异步模式写入新的参数字典并提交
const asyncComp = comp.toAsync();
asyncComp.setState_OtherProperty({ 嘉立创示例_Custom: 'ABC', Count: 3 });
await asyncComp.done();
// 5. 从画布重新读取,确认参数已写入(保留现场供观察)
const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
const after = refetched[0].getState_OtherProperty();
console.log('propertyCount:', beforeCount, '→', Object.keys(after).length);
console.log('customValue:', after['嘉立创示例_Custom']);
```
### setstate_primitivelock
# IPCB\_PrimitiveComponent.setState\_PrimitiveLock() method
> 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.
Set the property state: whether it is locked
## Signature
```typescript
function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitiveComponent;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveLock
</td><td>
boolean
</td><td>
Whether it is locked
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const compId = comp.getState_PrimitiveId();
// 3. 读取修改前的锁定状态
const before = comp.getState_PrimitiveLock();
// 4. 异步模式锁定器件并提交
const asyncComp = comp.toAsync();
asyncComp.setState_PrimitiveLock(true);
await asyncComp.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
console.log('primitiveLock:', before, '→', refetched[0].getState_PrimitiveLock());
```
### setstate_rotation
# IPCB\_PrimitiveComponent.setState\_Rotation() method
> 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.
Set the property state: rotation angle
## Signature
```typescript
function setState_Rotation(rotation: number): IPCB_PrimitiveComponent;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
rotation
</td><td>
number
</td><td>
Rotation angle
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件(默认 0 度)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const compId = comp.getState_PrimitiveId();
// 3. 读取修改前的旋转角度
const before = comp.getState_Rotation();
// 4. 异步模式旋转 90 度并提交
const asyncComp = comp.toAsync();
asyncComp.setState_Rotation(90);
await asyncComp.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
console.log('rotation:', before, '→', refetched[0].getState_Rotation());
```
### setstate_supplier
# IPCB\_PrimitiveComponent.setState\_Supplier() method
> 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.
Set the property state: supplier
## Signature
```typescript
function setState_Supplier(supplier: string | undefined): IPCB_PrimitiveComponent;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
supplier
</td><td>
string \| undefined
</td><td>
Supplier
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const compId = comp.getState_PrimitiveId();
// 3. 读取修改前的供应商
const before = comp.getState_Supplier();
// 4. 异步模式修改供应商并提交
const asyncComp = comp.toAsync();
asyncComp.setState_Supplier('嘉立创示例_SUP');
await asyncComp.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
console.log('supplier:', before, '→', refetched[0].getState_Supplier());
```
### setstate_supplierid
# IPCB\_PrimitiveComponent.setState\_SupplierId() method
> 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.
Set the property state: supplier ID
## Signature
```typescript
function setState_SupplierId(supplierId: string | undefined): IPCB_PrimitiveComponent;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
supplierId
</td><td>
string \| undefined
</td><td>
Supplier ID
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const compId = comp.getState_PrimitiveId();
// 3. 读取修改前的供应商编号
const before = comp.getState_SupplierId();
// 4. 异步模式修改供应商编号并提交
const asyncComp = comp.toAsync();
asyncComp.setState_SupplierId('SUP-DEMO-001');
await asyncComp.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
console.log('supplierId:', before, '→', refetched[0].getState_SupplierId());
```
### setstate_uniqueid
# IPCB\_PrimitiveComponent.setState\_UniqueId() method
> 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.
Set the property state: unique ID
## Signature
```typescript
function setState_UniqueId(uniqueId: string | undefined): IPCB_PrimitiveComponent;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
uniqueId
</td><td>
string \| undefined
</td><td>
Unique ID
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const compId = comp.getState_PrimitiveId();
// 3. 读取修改前的唯一 ID(默认空字符串)
const before = comp.getState_UniqueId();
// 4. 异步模式设置分组唯一 ID 并提交
const asyncComp = comp.toAsync();
asyncComp.setState_UniqueId('JLC-DEMO-001');
await asyncComp.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
console.log('uniqueId:', JSON.stringify(before), '→', JSON.stringify(refetched[0].getState_UniqueId()));
```
### setstate_x
# IPCB\_PrimitiveComponent.setState\_X() method
> 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.
Set the property state: X coordinate
## Signature
```typescript
function setState_X(x: number): IPCB_PrimitiveComponent;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
x
</td><td>
number
</td><td>
X coordinate
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const compId = comp.getState_PrimitiveId();
// 3. 读取修改前的锚点 X 坐标
const before = comp.getState_X();
// 4. 异步模式向右移动 300mil 并提交
const asyncComp = comp.toAsync();
asyncComp.setState_X(before + 300);
await asyncComp.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
console.log('x:', before, '→', refetched[0].getState_X());
```
### setstate_y
# IPCB\_PrimitiveComponent.setState\_Y() method
> 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.
Set the property state: Y coordinate
## Signature
```typescript
function setState_Y(y: number): IPCB_PrimitiveComponent;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
y
</td><td>
number
</td><td>
Y coordinate
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const compId = comp.getState_PrimitiveId();
// 3. 读取修改前的锚点 Y 坐标
const before = comp.getState_Y();
// 4. 异步模式向上移动 300mil 并提交
const asyncComp = comp.toAsync();
asyncComp.setState_Y(before + 300);
await asyncComp.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
console.log('y:', before, '→', refetched[0].getState_Y());
```
### toasync
# IPCB\_PrimitiveComponent.toAsync() method
Convert Primitive to Async primitive
## Signature
```typescript
function toAsync(): IPCB_PrimitiveComponent;
```
## Returns
[IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const compId = comp.getState_PrimitiveId();
// 3. 转换为异步图元
const asyncComp = comp.toAsync();
const isAsyncNow = asyncComp.isAsync();
// 4. 在异步模式下修改位号并提交
asyncComp.setState_Designator('C102');
await asyncComp.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
console.log('isAsync:', isAsyncNow);
console.log('designator:', refetched[0].getState_Designator());
```
### tosync
# IPCB\_PrimitiveComponent.toSync() method
Convert Primitive to Sync primitive
## Signature
```typescript
function toSync(): IPCB_PrimitiveComponent;
```
## Returns
[IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
// 2. 放置测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, x, y);
const compId = comp.getState_PrimitiveId();
// 3. 读取修改前的位号
const before = comp.getState_Designator();
// 4. 转换为同步图元后直接修改,立即生效(无需 done())
const syncComp = comp.toSync();
syncComp.setState_Designator('C103');
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveComponent.get([compId]);
console.log('designator:', before, '→', refetched[0].getState_Designator());
```
references/classes/IPCB_PrimitiveLine.md
# IPCB\_PrimitiveLine class
Line primitive
## Signature
```typescript
class IPCB_PrimitiveLine implements IPCB_Primitive
```
**Implements:** [IPCB\_Primitive](../interfaces/IPCB_Primitive.md)
## Remarks
Both lines and arc lines are wires, corresponding to the line traces and arc traces on the canvas
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[done()](./IPCB_PrimitiveLine.md)
</td><td>
</td><td>
**_(BETA)_** Apply the changes to the primitives to the canvas
</td></tr>
<tr><td>
[getAdjacentPrimitives()](./IPCB_PrimitiveLine.md)
</td><td>
</td><td>
**_(BETA)_** Get Adjacent primitive objects
</td></tr>
<tr><td>
[getEntireTrack(includeVias)](./IPCB_PrimitiveLine.md)
</td><td>
</td><td>
**_(BETA)_** Get the entire wire
</td></tr>
<tr><td>
[getEntireTrack(includeVias)](./IPCB_PrimitiveLine.md)
</td><td>
</td><td>
**_(BETA)_** Get the entire wire
</td></tr>
<tr><td>
[getState\_EndX()](./IPCB_PrimitiveLine.md)
</td><td>
</td><td>
Get the property state: end position X
</td></tr>
<tr><td>
[getState\_EndY()](./IPCB_PrimitiveLine.md)
</td><td>
</td><td>
Get the property state: end position Y
</td></tr>
<tr><td>
[getState\_Layer()](./IPCB_PrimitiveLine.md)
</td><td>
</td><td>
Get the property state: Layer
</td></tr>
<tr><td>
[getState\_LineWidth()](./IPCB_PrimitiveLine.md)
</td><td>
</td><td>
Get the property state: Line width
</td></tr>
<tr><td>
[getState\_Net()](./IPCB_PrimitiveLine.md)
</td><td>
</td><td>
Get the property state: net name
</td></tr>
<tr><td>
[getState\_PrimitiveId()](./IPCB_PrimitiveLine.md)
</td><td>
</td><td>
Get the property state: primitive ID
</td></tr>
<tr><td>
[getState\_PrimitiveLock()](./IPCB_PrimitiveLine.md)
</td><td>
</td><td>
Get the property state: whether it is locked
</td></tr>
<tr><td>
[getState\_PrimitiveType()](./IPCB_PrimitiveLine.md)
</td><td>
</td><td>
Get the property state: primitive type
</td></tr>
<tr><td>
[getState\_StartX()](./IPCB_PrimitiveLine.md)
</td><td>
</td><td>
Get the property state: start position X
</td></tr>
<tr><td>
[getState\_StartY()](./IPCB_PrimitiveLine.md)
</td><td>
</td><td>
Get the property state: start position Y
</td></tr>
<tr><td>
[isAsync()](./IPCB_PrimitiveLine.md)
</td><td>
</td><td>
Query whether the primitive is an async primitive
</td></tr>
<tr><td>
[reset()](./IPCB_PrimitiveLine.md)
</td><td>
</td><td>
**_(BETA)_** Reset the async primitive to the current canvas state
</td></tr>
<tr><td>
[setState\_EndX(endX)](./IPCB_PrimitiveLine.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: end position X
</td></tr>
<tr><td>
[setState\_EndY(endY)](./IPCB_PrimitiveLine.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: end position Y
</td></tr>
<tr><td>
[setState\_Layer(layer)](./IPCB_PrimitiveLine.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Layer
</td></tr>
<tr><td>
[setState\_LineWidth(lineWidth)](./IPCB_PrimitiveLine.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Line width
</td></tr>
<tr><td>
[setState\_Net(net)](./IPCB_PrimitiveLine.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: net name
</td></tr>
<tr><td>
[setState\_PrimitiveLock(primitiveLock)](./IPCB_PrimitiveLine.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: whether it is locked
</td></tr>
<tr><td>
[setState\_StartX(startX)](./IPCB_PrimitiveLine.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: start position X
</td></tr>
<tr><td>
[setState\_StartY(startY)](./IPCB_PrimitiveLine.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: start position Y
</td></tr>
<tr><td>
[toAsync()](./IPCB_PrimitiveLine.md)
</td><td>
</td><td>
Convert Primitive to Async primitive
</td></tr>
<tr><td>
[toSync()](./IPCB_PrimitiveLine.md)
</td><td>
</td><td>
Convert Primitive to Sync primitive
</td></tr>
</tbody></table>
---
## 方法详情
### done
# IPCB\_PrimitiveLine.done() method
> 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.
Apply the changes to the primitives to the canvas
## Signature
```typescript
function done(): Promise<IPCB_PrimitiveLine>;
```
## Returns
Promise<[IPCB\_PrimitiveLine](./IPCB_PrimitiveLine.md)<!-- -->>
Line primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试走线重合
const x = 42000 + (Math.floor(Math.random() * 100000));
const y = 2000 + (Math.floor(Math.random() * 100000));
// 2. 创建一条测试直线走线
const line = await eda.pcb_PrimitiveLine.create('', 1, x, y, x + 600, y, 10);
// 3. 切换异步模式,连续累计两处修改(线宽 + 换层)
const asyncLine = line.toAsync();
asyncLine.setState_LineWidth(24);
asyncLine.setState_Layer(2);
// 4. 一次性提交到画布
await asyncLine.done();
// 5. 从画布重新读取,确认两处修改都已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveLine.get(line.getState_PrimitiveId());
console.log('lineWidth:', 10, '→', refetched.getState_LineWidth());
console.log('layer:', 1, '→', refetched.getState_Layer());
```
### getadjacentprimitives
# IPCB\_PrimitiveLine.getAdjacentPrimitives() method
> 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.
Get Adjacent primitive objects
## Signature
```typescript
function getAdjacentPrimitives(): Promise<
Array<IPCB_PrimitiveLine | IPCB_PrimitiveVia | IPCB_PrimitiveArc>
>;
```
## Returns
Promise<Array<[IPCB\_PrimitiveLine](./IPCB_PrimitiveLine.md) \| [IPCB\_PrimitiveVia](./IPCB_PrimitiveVia.md) \| [IPCB\_PrimitiveArc](./IPCB_PrimitiveArc.md)<!-- -->>>
Adjacent line, via, and arc-line primitive objects
## Remarks
It will get the line, via, and arc-line primitive objects directly connected to both ends of the line
## Example
```javascript
// 1. 创建一条直线走线,终点落在 (7500, 7000)
const line = await eda.pcb_PrimitiveLine.create('', 1, 7000, 7000, 7500, 7000, 10);
// 2. 创建一段圆弧,起点与直线终点重合,两段构成一整段导线
const arc = await eda.pcb_PrimitiveArc.create('', 1, 7500, 7000, 7800, 7300, 90, 10, 1, false);
// 3. 获取与直线直接相连的图元,并读出各自的类型
const adjacent = await line.getAdjacentPrimitives();
// 4. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveLine.delete([line.getState_PrimitiveId()]);
await eda.pcb_PrimitiveArc.delete([arc.getState_PrimitiveId()]);
console.log('adjacent count:', adjacent.length);
adjacent.forEach((p, i) => {
console.log(`adjacent[${i}] type:`, p.getState_PrimitiveType());
});
```
### getentiretrack
# IPCB\_PrimitiveLine.getEntireTrack() method
> 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.
Get the entire wire
## Signature
```typescript
function getEntireTrack(includeVias: false): Promise<Array<IPCB_PrimitiveLine | IPCB_PrimitiveArc>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
includeVias
</td><td>
false
</td><td>
Whether to include the vias at both ends of the wire
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitiveLine](./IPCB_PrimitiveLine.md) \| [IPCB\_PrimitiveArc](./IPCB_PrimitiveArc.md)<!-- -->>>
All lines and arc lines in the entire wire
## Example
```javascript
// 1. 创建一条直线走线,终点落在 (7500, 7000)
const line = await eda.pcb_PrimitiveLine.create('', 1, 7000, 7000, 7500, 7000, 10);
// 2. 创建一段圆弧,起点与直线终点重合,两段构成一整段导线
const arc = await eda.pcb_PrimitiveArc.create('', 1, 7500, 7000, 7800, 7300, 90, 10, 1, false);
// 3. 只取导线内的直线和圆弧
const trackOnly = await line.getEntireTrack(false);
// 4. 连两端过孔一起取(本例两端没有过孔,数量不变)
const trackWithVias = await line.getEntireTrack(true);
// 5. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveLine.delete([line.getState_PrimitiveId()]);
await eda.pcb_PrimitiveArc.delete([arc.getState_PrimitiveId()]);
console.log('track(false) count:', trackOnly.length);
trackOnly.forEach((p, i) => {
console.log(`track(false)[${i}] type:`, p.getState_PrimitiveType());
});
console.log('track(true) count:', trackWithVias.length);
```
### getentiretrack_1
# IPCB\_PrimitiveLine.getEntireTrack() method
> 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.
Get the entire wire
## Signature
```typescript
function getEntireTrack(
includeVias: true,
): Promise<Array<IPCB_PrimitiveLine | IPCB_PrimitiveArc | IPCB_PrimitiveVia>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
includeVias
</td><td>
true
</td><td>
Whether to include the vias at both ends of the wire
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitiveLine](./IPCB_PrimitiveLine.md) \| [IPCB\_PrimitiveArc](./IPCB_PrimitiveArc.md) \| [IPCB\_PrimitiveVia](./IPCB_PrimitiveVia.md)<!-- -->>>
All lines and arc lines in the entire wire, as well as the vias connected at both ends (if any)
### getstate_endx
# IPCB\_PrimitiveLine.getState\_EndX() method
Get the property state: end position X
## Signature
```typescript
function getState_EndX(): number;
```
## Returns
number
End position X
## Example
```javascript
// 1. 创建一条测试直线,终点 (1600, 1000)
const line = await eda.pcb_PrimitiveLine.create('', 1, 1000, 1000, 1600, 1000, 10);
// 2. 读取终点 X
const endX = line.getState_EndX();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveLine.delete([line.getState_PrimitiveId()]);
console.log('endX:', endX);
```
### getstate_endy
# IPCB\_PrimitiveLine.getState\_EndY() method
Get the property state: end position Y
## Signature
```typescript
function getState_EndY(): number;
```
## Returns
number
End position Y
## Example
```javascript
// 1. 创建一条测试直线,终点 (1600, 1000)
const line = await eda.pcb_PrimitiveLine.create('', 1, 1000, 1000, 1600, 1000, 10);
// 2. 读取终点 Y
const endY = line.getState_EndY();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveLine.delete([line.getState_PrimitiveId()]);
console.log('endY:', endY);
```
### getstate_layer
# IPCB\_PrimitiveLine.getState\_Layer() method
Get the property state: Layer
## Signature
```typescript
function getState_Layer(): TPCB_LayersOfLine;
```
## Returns
[TPCB\_LayersOfLine](../types/TPCB_LayersOfLine.md)
Layer
## Example
```javascript
// 1. 创建一条顶层(1)测试直线
const line = await eda.pcb_PrimitiveLine.create('', 1, 1000, 1000, 1600, 1000, 10);
// 2. 读取所在层
const layer = line.getState_Layer();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveLine.delete([line.getState_PrimitiveId()]);
console.log('layer:', layer);
```
### getstate_linewidth
# IPCB\_PrimitiveLine.getState\_LineWidth() method
Get the property state: Line width
## Signature
```typescript
function getState_LineWidth(): number;
```
## Returns
number
Line width
## Example
```javascript
// 1. 创建一条 10mil 线宽的测试直线
const line = await eda.pcb_PrimitiveLine.create('', 1, 1000, 1000, 1600, 1000, 10);
// 2. 读取线宽
const lineWidth = line.getState_LineWidth();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveLine.delete([line.getState_PrimitiveId()]);
console.log('lineWidth:', lineWidth);
```
### getstate_net
# IPCB\_PrimitiveLine.getState\_Net() method
Get the property state: net name
## Signature
```typescript
function getState_Net(): string;
```
## Returns
string
Net name
## Example
```javascript
// 1. 创建一条指定网络的测试直线
const line = await eda.pcb_PrimitiveLine.create('嘉立创示例_NET', 1, 1000, 1000, 1600, 1000, 10);
// 2. 读取网络名称
const net = line.getState_Net();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveLine.delete([line.getState_PrimitiveId()]);
console.log('net:', net);
```
### getstate_primitiveid
# IPCB\_PrimitiveLine.getState\_PrimitiveId() method
Get the property state: primitive ID
## Signature
```typescript
function getState_PrimitiveId(): string;
```
## Returns
string
Primitive ID
## Example
```javascript
// 1. 创建一条测试直线
const line = await eda.pcb_PrimitiveLine.create('', 1, 1000, 1000, 1600, 1000, 10);
// 2. 读取图元 ID
const primitiveId = line.getState_PrimitiveId();
// 3. 用该 ID 从画布重新取回直线,验证 ID 有效
const refetched = await eda.pcb_PrimitiveLine.get(primitiveId);
// 4. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveLine.delete([primitiveId]);
console.log('primitiveId:', primitiveId);
console.log('refetched type:', refetched.getState_PrimitiveType());
```
### getstate_primitivelock
# IPCB\_PrimitiveLine.getState\_PrimitiveLock() method
Get the property state: whether it is locked
## Signature
```typescript
function getState_PrimitiveLock(): boolean;
```
## Returns
boolean
Whether it is locked
## Example
```javascript
// 1. 创建一条测试直线(默认不锁定)
const line = await eda.pcb_PrimitiveLine.create('', 1, 1000, 1000, 1600, 1000, 10);
// 2. 读取锁定状态
const locked = line.getState_PrimitiveLock();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveLine.delete([line.getState_PrimitiveId()]);
console.log('locked:', locked);
```
### getstate_primitivetype
# IPCB\_PrimitiveLine.getState\_PrimitiveType() method
Get the property state: primitive type
## Signature
```typescript
function getState_PrimitiveType(): EPCB_PrimitiveType;
```
## Returns
[EPCB\_PrimitiveType](../enums/EPCB_PrimitiveType.md)
Primitive type
## Example
```javascript
// 1. 创建一条测试直线
const line = await eda.pcb_PrimitiveLine.create('', 1, 1000, 1000, 1600, 1000, 10);
// 2. 读取图元类型
const type = line.getState_PrimitiveType();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveLine.delete([line.getState_PrimitiveId()]);
console.log('type:', type);
```
### getstate_startx
# IPCB\_PrimitiveLine.getState\_StartX() method
Get the property state: start position X
## Signature
```typescript
function getState_StartX(): number;
```
## Returns
number
Start position X
## Example
```javascript
// 1. 创建一条测试直线,起点 (1000, 1000)
const line = await eda.pcb_PrimitiveLine.create('', 1, 1000, 1000, 1600, 1000, 10);
// 2. 读取起点 X
const startX = line.getState_StartX();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveLine.delete([line.getState_PrimitiveId()]);
console.log('startX:', startX);
```
### getstate_starty
# IPCB\_PrimitiveLine.getState\_StartY() method
Get the property state: start position Y
## Signature
```typescript
function getState_StartY(): number;
```
## Returns
number
Start position Y
## Example
```javascript
// 1. 创建一条测试直线,起点 (1000, 1000)
const line = await eda.pcb_PrimitiveLine.create('', 1, 1000, 1000, 1600, 1000, 10);
// 2. 读取起点 Y
const startY = line.getState_StartY();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveLine.delete([line.getState_PrimitiveId()]);
console.log('startY:', startY);
```
### isasync
# IPCB\_PrimitiveLine.isAsync() method
Query whether the primitive is an async primitive
## Signature
```typescript
function isAsync(): boolean;
```
## Returns
boolean
Whether Is async primitive
## Example
```javascript
// 1. 创建一条测试直线,读出创建后的默认模式
const line = await eda.pcb_PrimitiveLine.create('', 1, 1000, 1000, 1600, 1000, 10);
const asyncOnCreate = line.isAsync();
// 2. 切换到同步模式再查询一次,对比两种模式
line.toSync();
const asyncAfterToSync = line.isAsync();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveLine.delete([line.getState_PrimitiveId()]);
console.log('isAsync on create:', asyncOnCreate);
console.log('isAsync after toSync:', asyncAfterToSync);
```
### reset
# IPCB\_PrimitiveLine.reset() method
> 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.
Reset the async primitive to the current canvas state
## Signature
```typescript
function reset(): Promise<IPCB_PrimitiveLine>;
```
## Returns
Promise<[IPCB\_PrimitiveLine](./IPCB_PrimitiveLine.md)<!-- -->>
Line primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试走线重合
const x = 46000 + (Math.floor(Math.random() * 100000));
const y = 2000 + (Math.floor(Math.random() * 100000));
// 2. 创建一条 10mil 线宽的测试直线
const line = await eda.pcb_PrimitiveLine.create('', 1, x, y, x + 600, y, 10);
// 3. 切换异步模式,累计一处未提交的线宽修改(10 → 99)
const asyncLine = line.toAsync();
asyncLine.setState_LineWidth(99);
// 4. 重置:丢弃未提交的修改,回到画布当前状态
await asyncLine.reset();
// 5. 从画布重新读取,线宽仍是 10(保留现场供观察)
const refetched = await eda.pcb_PrimitiveLine.get(line.getState_PrimitiveId());
console.log('lineWidth after reset:', refetched.getState_LineWidth());
```
### setstate_endx
# IPCB\_PrimitiveLine.setState\_EndX() method
> 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.
Set the property state: end position X
## Signature
```typescript
function setState_EndX(endX: number): IPCB_PrimitiveLine;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
endX
</td><td>
number
</td><td>
End position X
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveLine](./IPCB_PrimitiveLine.md)
Line primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试走线重合
const x = 14000 + (Math.floor(Math.random() * 100000));
const y = 2000 + (Math.floor(Math.random() * 100000));
// 2. 创建一条测试直线,终点 (x + 600, y)
const line = await eda.pcb_PrimitiveLine.create('', 1, x, y, x + 600, y, 10);
// 3. 读取修改前的终点 X
const before = line.getState_EndX();
// 4. 切换异步模式并拉长终点(右移 300mil)
const asyncLine = line.toAsync();
asyncLine.setState_EndX(x + 900);
await asyncLine.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveLine.get(line.getState_PrimitiveId());
const after = refetched.getState_EndX();
console.log('endX:', before, '→', after);
```
### setstate_endy
# IPCB\_PrimitiveLine.setState\_EndY() method
> 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.
Set the property state: end position Y
## Signature
```typescript
function setState_EndY(endY: number): IPCB_PrimitiveLine;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
endY
</td><td>
number
</td><td>
End position Y
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveLine](./IPCB_PrimitiveLine.md)
Line primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试走线重合
const x = 18000 + (Math.floor(Math.random() * 100000));
const y = 2000 + (Math.floor(Math.random() * 100000));
// 2. 创建一条测试直线,终点 (x + 600, y)
const line = await eda.pcb_PrimitiveLine.create('', 1, x, y, x + 600, y, 10);
// 3. 读取修改前的终点 Y
const before = line.getState_EndY();
// 4. 切换异步模式并抬高终点(上移 300mil)
const asyncLine = line.toAsync();
asyncLine.setState_EndY(y + 300);
await asyncLine.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveLine.get(line.getState_PrimitiveId());
const after = refetched.getState_EndY();
console.log('endY:', before, '→', after);
```
### setstate_layer
# IPCB\_PrimitiveLine.setState\_Layer() method
> 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.
Set the property state: Layer
## Signature
```typescript
function setState_Layer(layer: TPCB_LayersOfLine): IPCB_PrimitiveLine;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfLine](../types/TPCB_LayersOfLine.md)
</td><td>
Layer
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveLine](./IPCB_PrimitiveLine.md)
Line primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试走线重合
const x = 22000 + (Math.floor(Math.random() * 100000));
const y = 2000 + (Math.floor(Math.random() * 100000));
// 2. 创建一条顶层(1)测试直线
const line = await eda.pcb_PrimitiveLine.create('', 1, x, y, x + 600, y, 10);
// 3. 读取修改前的层
const before = line.getState_Layer();
// 4. 切换异步模式并换层(顶层 1 → 底层 2)
const asyncLine = line.toAsync();
asyncLine.setState_Layer(2);
await asyncLine.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveLine.get(line.getState_PrimitiveId());
const after = refetched.getState_Layer();
console.log('layer:', before, '→', after);
```
### setstate_linewidth
# IPCB\_PrimitiveLine.setState\_LineWidth() method
> 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.
Set the property state: Line width
## Signature
```typescript
function setState_LineWidth(lineWidth: number): IPCB_PrimitiveLine;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
lineWidth
</td><td>
number
</td><td>
Line width
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveLine](./IPCB_PrimitiveLine.md)
Line primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试走线重合
const x = 26000 + (Math.floor(Math.random() * 100000));
const y = 2000 + (Math.floor(Math.random() * 100000));
// 2. 创建一条 10mil 线宽的测试直线
const line = await eda.pcb_PrimitiveLine.create('', 1, x, y, x + 600, y, 10);
// 3. 读取修改前的线宽
const before = line.getState_LineWidth();
// 4. 切换异步模式并加宽(10 → 24)
const asyncLine = line.toAsync();
asyncLine.setState_LineWidth(24);
await asyncLine.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveLine.get(line.getState_PrimitiveId());
const after = refetched.getState_LineWidth();
console.log('lineWidth:', before, '→', after);
```
### setstate_net
# IPCB\_PrimitiveLine.setState\_Net() method
> 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.
Set the property state: net name
## Signature
```typescript
function setState_Net(net: string): IPCB_PrimitiveLine;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string
</td><td>
Net name
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveLine](./IPCB_PrimitiveLine.md)
Line primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试走线重合
const x = 30000 + (Math.floor(Math.random() * 100000));
const y = 2000 + (Math.floor(Math.random() * 100000));
// 2. 创建一条无网络的测试直线
const line = await eda.pcb_PrimitiveLine.create('', 1, x, y, x + 600, y, 10);
// 3. 读取修改前的网络名称
const before = line.getState_Net();
// 4. 切换异步模式并指定网络('' → '嘉立创示例_NET')
const asyncLine = line.toAsync();
asyncLine.setState_Net('嘉立创示例_NET');
await asyncLine.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveLine.get(line.getState_PrimitiveId());
const after = refetched.getState_Net();
console.log('net:', before, '→', after);
```
### setstate_primitivelock
# IPCB\_PrimitiveLine.setState\_PrimitiveLock() method
> 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.
Set the property state: whether it is locked
## Signature
```typescript
function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitiveLine;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveLock
</td><td>
boolean
</td><td>
Whether it is locked
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveLine](./IPCB_PrimitiveLine.md)
Line primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试走线重合
const x = 34000 + (Math.floor(Math.random() * 100000));
const y = 2000 + (Math.floor(Math.random() * 100000));
// 2. 创建一条测试直线(默认不锁定)
const line = await eda.pcb_PrimitiveLine.create('', 1, x, y, x + 600, y, 10);
// 3. 读取修改前的锁定状态
const before = line.getState_PrimitiveLock();
// 4. 切换异步模式并锁定(false → true)
const asyncLine = line.toAsync();
asyncLine.setState_PrimitiveLock(true);
await asyncLine.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveLine.get(line.getState_PrimitiveId());
const after = refetched.getState_PrimitiveLock();
console.log('locked:', before, '→', after);
```
### setstate_startx
# IPCB\_PrimitiveLine.setState\_StartX() method
> 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.
Set the property state: start position X
## Signature
```typescript
function setState_StartX(startX: number): IPCB_PrimitiveLine;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
startX
</td><td>
number
</td><td>
Start position X
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveLine](./IPCB_PrimitiveLine.md)
Line primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试走线重合
const x = 6000 + (Math.floor(Math.random() * 100000));
const y = 2000 + (Math.floor(Math.random() * 100000));
// 2. 创建一条测试直线,起点 (x, y)
const line = await eda.pcb_PrimitiveLine.create('', 1, x, y, x + 600, y, 10);
// 3. 读取修改前的起点 X
const before = line.getState_StartX();
// 4. 切换异步模式并平移起点 X(右移 300mil)
const asyncLine = line.toAsync();
asyncLine.setState_StartX(x + 300);
await asyncLine.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveLine.get(line.getState_PrimitiveId());
const after = refetched.getState_StartX();
console.log('startX:', before, '→', after);
```
### setstate_starty
# IPCB\_PrimitiveLine.setState\_StartY() method
> 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.
Set the property state: start position Y
## Signature
```typescript
function setState_StartY(startY: number): IPCB_PrimitiveLine;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
startY
</td><td>
number
</td><td>
Start position Y
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveLine](./IPCB_PrimitiveLine.md)
Line primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试走线重合
const x = 10000 + (Math.floor(Math.random() * 100000));
const y = 2000 + (Math.floor(Math.random() * 100000));
// 2. 创建一条测试直线,起点 (x, y)
const line = await eda.pcb_PrimitiveLine.create('', 1, x, y, x + 600, y, 10);
// 3. 读取修改前的起点 Y
const before = line.getState_StartY();
// 4. 切换异步模式并平移起点 Y(上移 300mil)
const asyncLine = line.toAsync();
asyncLine.setState_StartY(y + 300);
await asyncLine.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveLine.get(line.getState_PrimitiveId());
const after = refetched.getState_StartY();
console.log('startY:', before, '→', after);
```
### toasync
# IPCB\_PrimitiveLine.toAsync() method
Convert Primitive to Async primitive
## Signature
```typescript
function toAsync(): IPCB_PrimitiveLine;
```
## Returns
[IPCB\_PrimitiveLine](./IPCB_PrimitiveLine.md)
Line primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试走线重合
const x = 52000 + (Math.floor(Math.random() * 100000));
const y = 2000 + (Math.floor(Math.random() * 100000));
// 2. 创建一条测试直线,切换到同步模式,让模式变化可观察
const line = await eda.pcb_PrimitiveLine.create('', 1, x, y, x + 600, y, 10);
line.toSync();
// 3. 转换为异步图元
const asyncLine = line.toAsync();
// 4. 异步模式下累计修改并提交
asyncLine.setState_LineWidth(24);
await asyncLine.done();
// 5. 从画布重新读取,确认提交生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveLine.get(line.getState_PrimitiveId());
console.log('isAsync after toAsync:', line.isAsync());
console.log('lineWidth:', 10, '→', refetched.getState_LineWidth());
```
### tosync
# IPCB\_PrimitiveLine.toSync() method
Convert Primitive to Sync primitive
## Signature
```typescript
function toSync(): IPCB_PrimitiveLine;
```
## Returns
[IPCB\_PrimitiveLine](./IPCB_PrimitiveLine.md)
Line primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试走线重合
const x = 56000 + (Math.floor(Math.random() * 100000));
const y = 2000 + (Math.floor(Math.random() * 100000));
// 2. 创建一条测试直线
const line = await eda.pcb_PrimitiveLine.create('', 1, x, y, x + 600, y, 10);
// 3. 转换为同步图元
const syncLine = line.toSync();
// 4. 同步模式下修改线宽,立即生效(无需 done())
syncLine.setState_LineWidth(40);
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveLine.get(line.getState_PrimitiveId());
console.log('isSync after toSync:', !syncLine.isAsync());
console.log('lineWidth:', 10, '→', refetched.getState_LineWidth());
```
references/classes/IPCB_PrimitiveObject.md
# IPCB\_PrimitiveObject class
Binary embedded object primitive
## Signature
```typescript
class IPCB_PrimitiveObject implements IPCB_Primitive
```
**Implements:** [IPCB\_Primitive](../interfaces/IPCB_Primitive.md)
## Remarks
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[done()](./IPCB_PrimitiveObject.md)
</td><td>
</td><td>
**_(BETA)_** Apply the changes to the primitives to the canvas
</td></tr>
<tr><td>
[getState\_BinaryData()](./IPCB_PrimitiveObject.md)
</td><td>
</td><td>
Get the property state: binary data
</td></tr>
<tr><td>
[getState\_FileName()](./IPCB_PrimitiveObject.md)
</td><td>
</td><td>
Get the property state: file name
</td></tr>
<tr><td>
[getState\_Height()](./IPCB_PrimitiveObject.md)
</td><td>
</td><td>
Get the property state: height
</td></tr>
<tr><td>
[getState\_Layer()](./IPCB_PrimitiveObject.md)
</td><td>
</td><td>
Get the property state: Layer
</td></tr>
<tr><td>
[getState\_Mirror()](./IPCB_PrimitiveObject.md)
</td><td>
</td><td>
Get the property state: whether it is horizontally mirrored
</td></tr>
<tr><td>
[getState\_PrimitiveId()](./IPCB_PrimitiveObject.md)
</td><td>
</td><td>
Get the property state: primitive ID
</td></tr>
<tr><td>
[getState\_PrimitiveLock()](./IPCB_PrimitiveObject.md)
</td><td>
</td><td>
Get the property state: whether it is locked
</td></tr>
<tr><td>
[getState\_PrimitiveType()](./IPCB_PrimitiveObject.md)
</td><td>
</td><td>
Get the property state: primitive type
</td></tr>
<tr><td>
[getState\_Rotation()](./IPCB_PrimitiveObject.md)
</td><td>
</td><td>
Get the property state: rotation angle
</td></tr>
<tr><td>
[getState\_TopLeftX()](./IPCB_PrimitiveObject.md)
</td><td>
</td><td>
Get the property state: top-left point X
</td></tr>
<tr><td>
[getState\_TopLeftY()](./IPCB_PrimitiveObject.md)
</td><td>
</td><td>
Get the property state: top-left point Y
</td></tr>
<tr><td>
[getState\_Width()](./IPCB_PrimitiveObject.md)
</td><td>
</td><td>
Get the property state: width
</td></tr>
<tr><td>
[isAsync()](./IPCB_PrimitiveObject.md)
</td><td>
</td><td>
Query whether the primitive is an async primitive
</td></tr>
<tr><td>
[reset()](./IPCB_PrimitiveObject.md)
</td><td>
</td><td>
**_(BETA)_** Reset the async primitive to the current canvas state
</td></tr>
<tr><td>
[setState\_BinaryData(binaryData)](./IPCB_PrimitiveObject.md)
</td><td>
</td><td>
Set the property state: binary data
</td></tr>
<tr><td>
[setState\_FileName(fileName)](./IPCB_PrimitiveObject.md)
</td><td>
</td><td>
Set the property state: file name
</td></tr>
<tr><td>
[setState\_Height(height)](./IPCB_PrimitiveObject.md)
</td><td>
</td><td>
Set the property state: height
</td></tr>
<tr><td>
[setState\_Layer(layer)](./IPCB_PrimitiveObject.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Layer
</td></tr>
<tr><td>
[setState\_Mirror(mirror)](./IPCB_PrimitiveObject.md)
</td><td>
</td><td>
Set the property state: whether it is horizontally mirrored
</td></tr>
<tr><td>
[setState\_PrimitiveLock(primitiveLock)](./IPCB_PrimitiveObject.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: whether it is locked
</td></tr>
<tr><td>
[setState\_Rotation(rotation)](./IPCB_PrimitiveObject.md)
</td><td>
</td><td>
Set the property state: rotation angle
</td></tr>
<tr><td>
[setState\_TopLeftX(topLeftX)](./IPCB_PrimitiveObject.md)
</td><td>
</td><td>
Set the property state: top-left point X
</td></tr>
<tr><td>
[setState\_TopLeftY(topLeftY)](./IPCB_PrimitiveObject.md)
</td><td>
</td><td>
Set the property state: top-left point Y
</td></tr>
<tr><td>
[setState\_Width(width)](./IPCB_PrimitiveObject.md)
</td><td>
</td><td>
Set the property state: width
</td></tr>
<tr><td>
[toAsync()](./IPCB_PrimitiveObject.md)
</td><td>
</td><td>
Convert Primitive to Async primitive
</td></tr>
<tr><td>
[toSync()](./IPCB_PrimitiveObject.md)
</td><td>
</td><td>
Convert Primitive to Sync primitive
</td></tr>
</tbody></table>
---
## 方法详情
### done
# IPCB\_PrimitiveObject.done() method
> 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.
Apply the changes to the primitives to the canvas
## Signature
```typescript
function done(): Promise<IPCB_PrimitiveObject>;
```
## Returns
Promise<[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)<!-- -->>
Binary embedded object primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
// 2. 放置一个未旋转的内嵌图片
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
const before = obj.getState_Rotation();
// 3. 异步模式下旋转 90 度(此时画布还没变)
const asyncObj = obj.toAsync();
asyncObj.setState_Rotation(90);
await asyncObj.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
console.log('rotation:', before, '→', refetched.getState_Rotation());
```
### getstate_binarydata
# IPCB\_PrimitiveObject.getState\_BinaryData() method
Get the property state: binary data
## Signature
```typescript
function getState_BinaryData(): string;
```
## Returns
string
Binary data
## Remarks
The `binaryData` retrieved from the canvas may be a `hashId`<!-- -->, because our backend stores binary embedded object data in object storage,
The object storage uses `hashId` as the index. Fully retrieving the data will cause additional requests and consume performance
## Example
```javascript
// 1. 生成本次运行专用的坐标,在顶层丝印层放置一个 400 x 300 的内嵌图片
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
// 2. 读取内嵌的二进制数据
const binaryData = obj.getState_BinaryData();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
console.log('binaryData 长度:', binaryData.length);
console.log('binaryData 前缀:', binaryData.substring(0, 30));
```
### getstate_filename
# IPCB\_PrimitiveObject.getState\_FileName() method
Get the property state: file name
## Signature
```typescript
function getState_FileName(): string;
```
## Returns
string
File name
## Example
```javascript
// 1. 生成本次运行专用的坐标,在顶层丝印层放置一个内嵌图片
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'company-logo.png', false);
// 2. 读取图片文件名
const fileName = obj.getState_FileName();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
console.log('fileName:', fileName);
```
### getstate_height
# IPCB\_PrimitiveObject.getState\_Height() method
Get the property state: height
## Signature
```typescript
function getState_Height(): number;
```
## Returns
number
Height
## Example
```javascript
// 1. 生成本次运行专用的坐标,在顶层丝印层放置一个 400 x 300 的内嵌图片
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
// 2. 读取图片高度
const height = obj.getState_Height();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
console.log('height:', height);
```
### getstate_layer
# IPCB\_PrimitiveObject.getState\_Layer() method
Get the property state: Layer
## Signature
```typescript
function getState_Layer(): TPCB_LayersOfObject | undefined;
```
## Returns
[TPCB\_LayersOfObject](../types/TPCB_LayersOfObject.md) \| undefined
Layer
## Example
```javascript
// 1. 生成本次运行专用的坐标,在顶层丝印层放置一个内嵌图片
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
// 2. 读取图片所在层(3=顶层丝印)
const layer = obj.getState_Layer();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
console.log('layer:', layer);
```
### getstate_mirror
# IPCB\_PrimitiveObject.getState\_Mirror() method
Get the property state: whether it is horizontally mirrored
## Signature
```typescript
function getState_Mirror(): boolean;
```
## Returns
boolean
Whether it is horizontally mirrored
## Example
```javascript
// 1. 生成本次运行专用的坐标,在顶层丝印层放置一个未镜像的内嵌图片
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
// 2. 查询是否水平镜像
const mirror = obj.getState_Mirror();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
console.log('mirror:', mirror);
```
### getstate_primitiveid
# IPCB\_PrimitiveObject.getState\_PrimitiveId() method
Get the property state: primitive ID
## Signature
```typescript
function getState_PrimitiveId(): string;
```
## Returns
string
Primitive ID
## Example
```javascript
// 1. 生成本次运行专用的坐标,在顶层丝印层放置一个内嵌图片
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
// 2. 读取图元 ID
const primitiveId = obj.getState_PrimitiveId();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveObject.delete([primitiveId]);
console.log('primitiveId:', primitiveId);
```
### getstate_primitivelock
# IPCB\_PrimitiveObject.getState\_PrimitiveLock() method
Get the property state: whether it is locked
## Signature
```typescript
function getState_PrimitiveLock(): boolean;
```
## Returns
boolean
Whether it is locked
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个未锁定的内嵌图片
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
// 2. 查询是否锁定
const primitiveLock = obj.getState_PrimitiveLock();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
console.log('primitiveLock:', primitiveLock);
```
### getstate_primitivetype
# IPCB\_PrimitiveObject.getState\_PrimitiveType() method
Get the property state: primitive type
## Signature
```typescript
function getState_PrimitiveType(): EPCB_PrimitiveType;
```
## Returns
[EPCB\_PrimitiveType](../enums/EPCB_PrimitiveType.md)
Primitive type
## Example
```javascript
// 1. 生成本次运行专用的坐标,在顶层丝印层放置一个内嵌图片
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
// 2. 读取图元类型(内嵌图片固定返回 'Object')
const primitiveType = obj.getState_PrimitiveType();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
console.log('primitiveType:', primitiveType);
```
### getstate_rotation
# IPCB\_PrimitiveObject.getState\_Rotation() method
Get the property state: rotation angle
## Signature
```typescript
function getState_Rotation(): number;
```
## Returns
number
Rotation angle
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个未旋转的内嵌图片
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
// 2. 读取旋转角度
const rotation = obj.getState_Rotation();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
console.log('rotation:', rotation);
```
### getstate_topleftx
# IPCB\_PrimitiveObject.getState\_TopLeftX() method
Get the property state: top-left point X
## Signature
```typescript
function getState_TopLeftX(): number | undefined;
```
## Returns
number \| undefined
Top-left point X
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个内嵌图片
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
// 2. 读取左上角 X 坐标
const topLeftX = obj.getState_TopLeftX();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
console.log('topLeftX:', topLeftX);
```
### getstate_toplefty
# IPCB\_PrimitiveObject.getState\_TopLeftY() method
Get the property state: top-left point Y
## Signature
```typescript
function getState_TopLeftY(): number | undefined;
```
## Returns
number \| undefined
Top-left point Y
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个内嵌图片
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
// 2. 读取左上角 Y 坐标
const topLeftY = obj.getState_TopLeftY();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
console.log('topLeftY:', topLeftY);
```
### getstate_width
# IPCB\_PrimitiveObject.getState\_Width() method
Get the property state: width
## Signature
```typescript
function getState_Width(): number;
```
## Returns
number
Width
## Example
```javascript
// 1. 生成本次运行专用的坐标,在顶层丝印层放置一个 400 x 300 的内嵌图片
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
// 2. 读取图片宽度
const width = obj.getState_Width();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
console.log('width:', width);
```
### isasync
# IPCB\_PrimitiveObject.isAsync() method
Query whether the primitive is an async primitive
## Signature
```typescript
function isAsync(): boolean;
```
## Returns
boolean
Whether Is async primitive
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个内嵌图片
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
// 2. 查询异步模式
const isAsync = obj.isAsync();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveObject.delete([obj.getState_PrimitiveId()]);
console.log('isAsync:', isAsync);
```
### reset
# IPCB\_PrimitiveObject.reset() method
> 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.
Reset the async primitive to the current canvas state
## Signature
```typescript
function reset(): Promise<IPCB_PrimitiveObject>;
```
## Returns
Promise<[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)<!-- -->>
Binary embedded object primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个未旋转的内嵌图片
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
const before = obj.getState_Rotation();
// 2. 异步模式下把图片旋转 90 度,随后反悔
const asyncObj = obj.toAsync();
asyncObj.setState_Rotation(90);
// 3. reset 丢弃未提交的修改(保留现场供观察)
await asyncObj.reset();
// 4. 从画布重新读取,确认旋转没有变
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
console.log('rotation:', before, '→', refetched.getState_Rotation());
```
### setstate_binarydata
# IPCB\_PrimitiveObject.setState\_BinaryData() method
Set the property state: binary data
## Signature
```typescript
function setState_BinaryData(binaryData: string): IPCB_PrimitiveObject;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
binaryData
</td><td>
string
</td><td>
Binary data
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
Binary embedded object primitive object
## Remarks
The `binaryData` re-retrieved from the canvas may be a `hashId`<!-- -->, because our backend stores binary embedded object data in object storage,
The object storage uses `hashId` as the index. Fully retrieving the data will cause additional requests and consume performance
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个 4x4 图片的内嵌对象
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
const oldImage = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
// 8x8 纯色 PNG 的 data URI,作为替换用的新图
const newImage = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAEklEQVR4nGOQi7rzHx9mGBkKAFPclMHPGdtKAAAAAElFTkSuQmCC';
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, oldImage, 400, 300, 0, false, 'demo.png', false);
const before = obj.getState_BinaryData().length;
// 2. 异步模式替换为新图片数据
const asyncObj = obj.toAsync();
asyncObj.setState_BinaryData(newImage);
await asyncObj.done();
// 3. 从画布重新读取,确认数据已更新(保留现场供观察)
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
console.log('binaryData 长度:', before, '→', refetched.getState_BinaryData().length);
```
### setstate_filename
# IPCB\_PrimitiveObject.setState\_FileName() method
Set the property state: file name
## Signature
```typescript
function setState_FileName(fileName: string): IPCB_PrimitiveObject;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fileName
</td><td>
string
</td><td>
File name
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
Binary embedded object primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个内嵌图片
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'old-name.png', false);
const before = obj.getState_FileName();
// 2. 异步模式重命名文件
const asyncObj = obj.toAsync();
asyncObj.setState_FileName('company-logo.png');
await asyncObj.done();
// 3. 从画布重新读取,确认文件名已更新(保留现场供观察)
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
console.log('fileName:', before, '→', refetched.getState_FileName());
```
### setstate_height
# IPCB\_PrimitiveObject.setState\_Height() method
Set the property state: height
## Signature
```typescript
function setState_Height(height: number): IPCB_PrimitiveObject;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
height
</td><td>
number
</td><td>
Height
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
Binary embedded object primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个 400 x 300 的内嵌图片
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
const before = obj.getState_Height();
// 2. 异步模式把高度从 300 调到 450
const asyncObj = obj.toAsync();
asyncObj.setState_Height(450);
await asyncObj.done();
// 3. 从画布重新读取,确认高度已更新(保留现场供观察)
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
console.log('height:', before, '→', refetched.getState_Height());
```
### setstate_layer
# IPCB\_PrimitiveObject.setState\_Layer() method
> 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.
Set the property state: Layer
## Signature
```typescript
function setState_Layer(layer: TPCB_LayersOfObject): IPCB_PrimitiveObject;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfObject](../types/TPCB_LayersOfObject.md)
</td><td>
Layer
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
Binary embedded object primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,在顶层丝印层放置一个内嵌图片
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
const before = obj.getState_Layer();
// 2. 异步模式把图片从顶层丝印(3)挪到底层丝印(4)
const asyncObj = obj.toAsync();
asyncObj.setState_Layer(4);
await asyncObj.done();
// 3. 从画布重新读取,确认层已切换(保留现场供观察)
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
console.log('layer:', before, '→', refetched.getState_Layer());
```
### setstate_mirror
# IPCB\_PrimitiveObject.setState\_Mirror() method
Set the property state: whether it is horizontally mirrored
## Signature
```typescript
function setState_Mirror(mirror: boolean): IPCB_PrimitiveObject;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
mirror
</td><td>
boolean
</td><td>
Whether it is horizontally mirrored
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
Binary embedded object primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,在底层丝印层(4)放置一个未镜像的图片
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj = await eda.pcb_PrimitiveObject.create(4, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
const before = obj.getState_Mirror();
// 2. 异步模式打开水平镜像
const asyncObj = obj.toAsync();
asyncObj.setState_Mirror(true);
await asyncObj.done();
// 3. 从画布重新读取,确认镜像已开启(保留现场供观察)
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
console.log('mirror:', before, '→', refetched.getState_Mirror());
```
### setstate_primitivelock
# IPCB\_PrimitiveObject.setState\_PrimitiveLock() method
> 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.
Set the property state: whether it is locked
## Signature
```typescript
function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitiveObject;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveLock
</td><td>
boolean
</td><td>
Whether it is locked
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
Binary embedded object primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个未锁定的内嵌图片
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
const before = obj.getState_PrimitiveLock();
// 2. 异步模式锁定图元
const asyncObj = obj.toAsync();
asyncObj.setState_PrimitiveLock(true);
await asyncObj.done();
// 3. 从画布重新读取,确认已锁定(保留现场供观察)
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
console.log('primitiveLock:', before, '→', refetched.getState_PrimitiveLock());
```
### setstate_rotation
# IPCB\_PrimitiveObject.setState\_Rotation() method
Set the property state: rotation angle
## Signature
```typescript
function setState_Rotation(rotation: number): IPCB_PrimitiveObject;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
rotation
</td><td>
number
</td><td>
Rotation angle
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
Binary embedded object primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个未旋转的内嵌图片
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
const before = obj.getState_Rotation();
// 2. 异步模式旋转 90 度
const asyncObj = obj.toAsync();
asyncObj.setState_Rotation(90);
await asyncObj.done();
// 3. 从画布重新读取,确认角度已更新(保留现场供观察)
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
console.log('rotation:', before, '→', refetched.getState_Rotation());
```
### setstate_topleftx
# IPCB\_PrimitiveObject.setState\_TopLeftX() method
Set the property state: top-left point X
## Signature
```typescript
function setState_TopLeftX(topLeftX: number): IPCB_PrimitiveObject;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
topLeftX
</td><td>
number
</td><td>
Top-left point X
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
Binary embedded object primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个内嵌图片
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
const before = obj.getState_TopLeftX();
// 2. 异步模式水平右移 500mil
const asyncObj = obj.toAsync();
asyncObj.setState_TopLeftX(before + 500);
await asyncObj.done();
// 3. 从画布重新读取,确认 X 已更新(保留现场供观察)
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
console.log('topLeftX:', before, '→', refetched.getState_TopLeftX());
```
### setstate_toplefty
# IPCB\_PrimitiveObject.setState\_TopLeftY() method
Set the property state: top-left point Y
## Signature
```typescript
function setState_TopLeftY(topLeftY: number): IPCB_PrimitiveObject;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
topLeftY
</td><td>
number
</td><td>
Top-left point Y
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
Binary embedded object primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个内嵌图片
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
const before = obj.getState_TopLeftY();
// 2. 异步模式垂直上移 500mil
const asyncObj = obj.toAsync();
asyncObj.setState_TopLeftY(before - 500);
await asyncObj.done();
// 3. 从画布重新读取,确认 Y 已更新(保留现场供观察)
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
console.log('topLeftY:', before, '→', refetched.getState_TopLeftY());
```
### setstate_width
# IPCB\_PrimitiveObject.setState\_Width() method
Set the property state: width
## Signature
```typescript
function setState_Width(width: number): IPCB_PrimitiveObject;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
width
</td><td>
number
</td><td>
Width
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
Binary embedded object primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个 400 x 300 的内嵌图片
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
const before = obj.getState_Width();
// 2. 异步模式把宽度从 400 调到 600
const asyncObj = obj.toAsync();
asyncObj.setState_Width(600);
await asyncObj.done();
// 3. 从画布重新读取,确认宽度已更新(保留现场供观察)
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
console.log('width:', before, '→', refetched.getState_Width());
```
### toasync
# IPCB\_PrimitiveObject.toAsync() method
Convert Primitive to Async primitive
## Signature
```typescript
function toAsync(): IPCB_PrimitiveObject;
```
## Returns
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
Binary embedded object primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个 400 x 300 的内嵌图片
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
// 2. 切换异步模式后批量修改:放大到 600 x 450 并重命名
const asyncObj = obj.toAsync();
asyncObj.setState_Width(600);
asyncObj.setState_Height(450);
asyncObj.setState_FileName('logo-large.png');
await asyncObj.done();
// 3. 从画布重新读取,确认批量修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveObject.get(obj.getState_PrimitiveId());
console.log('width:', refetched.getState_Width());
console.log('height:', refetched.getState_Height());
console.log('fileName:', refetched.getState_FileName());
```
### tosync
# IPCB\_PrimitiveObject.toSync() method
Convert Primitive to Sync primitive
## Signature
```typescript
function toSync(): IPCB_PrimitiveObject;
```
## Returns
[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
Binary embedded object primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个内嵌图片
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 4x4 纯色 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
const imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, imageData, 400, 300, 0, false, 'demo.png', false);
const before = obj.isAsync();
// 2. 转换为同步图元(保留现场供观察)
const syncObj = obj.toSync();
const after = syncObj.isAsync();
// 3. 同步图元直接读取属性,无需提交
console.log('isAsync:', before, '→', after);
console.log('primitiveType:', syncObj.getState_PrimitiveType());
console.log('layer:', syncObj.getState_Layer());
```
references/classes/IPCB_PrimitivePour.md
# IPCB\_PrimitivePour class
Copper border primitive
## Signature
```typescript
class IPCB_PrimitivePour implements IPCB_Primitive
```
**Implements:** [IPCB\_Primitive](../interfaces/IPCB_Primitive.md)
## Remarks
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[convertToFill()](./IPCB_PrimitivePour.md)
</td><td>
</td><td>
**_(BETA)_** Convert to: fill primitive (default is the fill region)
</td></tr>
<tr><td>
[convertToPolyline()](./IPCB_PrimitivePour.md)
</td><td>
</td><td>
**_(BETA)_** Convert to: polyline primitive (default is the line)
</td></tr>
<tr><td>
[convertToRegion()](./IPCB_PrimitivePour.md)
</td><td>
</td><td>
**_(BETA)_** Convert to: region primitive (default is the forbidden region)
</td></tr>
<tr><td>
[done()](./IPCB_PrimitivePour.md)
</td><td>
</td><td>
**_(BETA)_** Apply the changes to the primitives to the canvas
</td></tr>
<tr><td>
[getCopperRegion()](./IPCB_PrimitivePour.md)
</td><td>
</td><td>
**_(BETA)_** Get the copper fill primitive of the copper region
</td></tr>
<tr><td>
[getState\_ComplexPolygon()](./IPCB_PrimitivePour.md)
</td><td>
</td><td>
Get the property state: complex polygon
</td></tr>
<tr><td>
[getState\_Layer()](./IPCB_PrimitivePour.md)
</td><td>
</td><td>
Get the property state: Layer
</td></tr>
<tr><td>
[getState\_LineWidth()](./IPCB_PrimitivePour.md)
</td><td>
</td><td>
Get the property state: Line width
</td></tr>
<tr><td>
[getState\_Net()](./IPCB_PrimitivePour.md)
</td><td>
</td><td>
Get the property state: net name
</td></tr>
<tr><td>
[getState\_PourFillMethod()](./IPCB_PrimitivePour.md)
</td><td>
</td><td>
Get the property state: copper fill method
</td></tr>
<tr><td>
[getState\_PourName()](./IPCB_PrimitivePour.md)
</td><td>
</td><td>
Get the property state: copper border name
</td></tr>
<tr><td>
[getState\_PourPriority()](./IPCB_PrimitivePour.md)
</td><td>
</td><td>
Get the property state: copper priority
</td></tr>
<tr><td>
[getState\_PreserveSilos()](./IPCB_PrimitivePour.md)
</td><td>
</td><td>
Get the property state: whether to keep islands
</td></tr>
<tr><td>
[getState\_PrimitiveId()](./IPCB_PrimitivePour.md)
</td><td>
</td><td>
Get the property state: primitive ID
</td></tr>
<tr><td>
[getState\_PrimitiveLock()](./IPCB_PrimitivePour.md)
</td><td>
</td><td>
Get the property state: whether it is locked
</td></tr>
<tr><td>
[getState\_PrimitiveType()](./IPCB_PrimitivePour.md)
</td><td>
</td><td>
Get the property state: primitive type
</td></tr>
<tr><td>
[isAsync()](./IPCB_PrimitivePour.md)
</td><td>
</td><td>
Query whether the primitive is an async primitive
</td></tr>
<tr><td>
[rebuildCopperRegion()](./IPCB_PrimitivePour.md)
</td><td>
</td><td>
**_(BETA)_** Rebuild the copper fill of the copper region
</td></tr>
<tr><td>
[reset()](./IPCB_PrimitivePour.md)
</td><td>
</td><td>
**_(BETA)_** Reset the async primitive to the current canvas state
</td></tr>
<tr><td>
[setState\_ComplexPolygon(complexPolygon)](./IPCB_PrimitivePour.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: complex polygon
</td></tr>
<tr><td>
[setState\_Layer(layer)](./IPCB_PrimitivePour.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Layer
</td></tr>
<tr><td>
[setState\_LineWidth(lineWidth)](./IPCB_PrimitivePour.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Line width
</td></tr>
<tr><td>
[setState\_Net(net)](./IPCB_PrimitivePour.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: net name
</td></tr>
<tr><td>
[setState\_PourFillMethod(pourFillMethod)](./IPCB_PrimitivePour.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: copper fill method
</td></tr>
<tr><td>
[setState\_PourName(pourName)](./IPCB_PrimitivePour.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: copper border name
</td></tr>
<tr><td>
[setState\_PourPriority(pourPriority)](./IPCB_PrimitivePour.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: copper priority
</td></tr>
<tr><td>
[setState\_PreserveSilos(preserveSilos)](./IPCB_PrimitivePour.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: whether to keep islands
</td></tr>
<tr><td>
[setState\_PrimitiveLock(primitiveLock)](./IPCB_PrimitivePour.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: whether it is locked
</td></tr>
<tr><td>
[toAsync()](./IPCB_PrimitivePour.md)
</td><td>
</td><td>
Convert Primitive to Async primitive
</td></tr>
<tr><td>
[toSync()](./IPCB_PrimitivePour.md)
</td><td>
</td><td>
Convert Primitive to Sync primitive
</td></tr>
</tbody></table>
---
## 方法详情
### converttofill
# IPCB\_PrimitivePour.convertToFill() method
> 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.
Convert to: fill primitive (default is the fill region)
## Signature
```typescript
function convertToFill(): Promise<IPCB_PrimitiveFill>;
```
## Returns
Promise<[IPCB\_PrimitiveFill](./IPCB_PrimitiveFill.md)<!-- -->>
Fill primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个实心覆铜边框
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('', 1, polygon, 'solid', false, '嘉立创示例_转填充', 5, 10, false);
// 3. 转换为填充图元(原覆铜边框被替换,填充保留现场供观察)
const fill = await pour.convertToFill();
console.log('primitiveType:', `${pour.getState_PrimitiveType()} → ${fill.getState_PrimitiveType()}`);
console.log('primitiveId:', fill.getState_PrimitiveId());
```
### converttopolyline
# IPCB\_PrimitivePour.convertToPolyline() method
> 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.
Convert to: polyline primitive (default is the line)
## Signature
```typescript
function convertToPolyline(): Promise<IPCB_PrimitivePolyline>;
```
## Returns
Promise<[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)<!-- -->>
Polyline primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个实心覆铜边框
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('', 1, polygon, 'solid', false, '嘉立创示例_转折线', 5, 10, false);
// 3. 转换为折线图元(原覆铜边框被替换,折线保留现场供观察)
const polyline = await pour.convertToPolyline();
console.log('primitiveType:', `${pour.getState_PrimitiveType()} → ${polyline.getState_PrimitiveType()}`);
console.log('primitiveId:', polyline.getState_PrimitiveId());
```
### converttoregion
# IPCB\_PrimitivePour.convertToRegion() method
> 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.
Convert to: region primitive (default is the forbidden region)
## Signature
```typescript
function convertToRegion(): Promise<IPCB_PrimitiveRegion>;
```
## Returns
Promise<[IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)<!-- -->>
Region primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个实心覆铜边框
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('', 1, polygon, 'solid', false, '嘉立创示例_转区域', 5, 10, false);
// 3. 转换为区域图元(默认是禁止区域,原覆铜边框被替换,区域保留现场供观察)
const region = await pour.convertToRegion();
console.log('primitiveType:', `${pour.getState_PrimitiveType()} → ${region.getState_PrimitiveType()}`);
console.log('primitiveId:', region.getState_PrimitiveId());
```
### done
# IPCB\_PrimitivePour.done() method
> 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.
Apply the changes to the primitives to the canvas
## Signature
```typescript
function done(): Promise<IPCB_PrimitivePour>;
```
## Returns
Promise<[IPCB\_PrimitivePour](./IPCB_PrimitivePour.md)<!-- -->>
Copper border primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个顶层铜层的覆铜边框
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('', 1, polygon, 'solid', false, '嘉立创示例_提交', 5, 10, false);
const before = pour.getState_Layer();
// 3. 异步模式下把覆铜边框挪到底层铜层(此时画布还没变)
const asyncPour = pour.toAsync();
asyncPour.setState_Layer(2);
await asyncPour.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitivePour.get(pour.getState_PrimitiveId());
console.log('layer:', before, '→', refetched.getState_Layer());
```
### getcopperregion
# IPCB\_PrimitivePour.getCopperRegion() method
> 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.
Get the copper fill primitive of the copper region
## Signature
```typescript
function getCopperRegion(): Promise<IPCB_PrimitivePoured | undefined>;
```
## Returns
Promise<[IPCB\_PrimitivePoured](./IPCB_PrimitivePoured.md) \| undefined>
The copper fill primitive. If no associated copper fill primitive exists, `undefined` is returned
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个覆铜边框(刚创建还没有生成填充)
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('', 1, polygon, 'solid', false, '嘉立创示例_查填充', 5, 10, false);
// 3. 查询关联的覆铜填充图元
const copperRegion = await pour.getCopperRegion();
const hasFill = copperRegion !== undefined;
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitivePour.delete([pour.getState_PrimitiveId()]);
console.log('hasCopperRegion:', hasFill);
```
### getstate_complexpolygon
# IPCB\_PrimitivePour.getState\_ComplexPolygon() method
Get the property state: complex polygon
## Signature
```typescript
function getState_ComplexPolygon(): IPCB_Polygon;
```
## Returns
[IPCB\_Polygon](./IPCB_Polygon.md)
Complex polygon
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个矩形轮廓的覆铜边框
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('', 1, polygon, 'solid', false, '嘉立创示例_读轮廓', 5, 10, false);
// 3. 读取轮廓多边形并取源数组
const complexPolygon = pour.getState_ComplexPolygon();
const source = complexPolygon.getSource();
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitivePour.delete([pour.getState_PrimitiveId()]);
console.log('source:', JSON.stringify(source));
```
### getstate_layer
# IPCB\_PrimitivePour.getState\_Layer() method
Get the property state: Layer
## Signature
```typescript
function getState_Layer(): TPCB_LayersOfCopper;
```
## Returns
[TPCB\_LayersOfCopper](../types/TPCB_LayersOfCopper.md)
Layer
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个顶层铜层(1)的覆铜边框
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('', 1, polygon, 'solid', false, '嘉立创示例_读层', 5, 10, false);
// 3. 读取层号
const layer = pour.getState_Layer();
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitivePour.delete([pour.getState_PrimitiveId()]);
console.log('layer:', layer);
```
### getstate_linewidth
# IPCB\_PrimitivePour.getState\_LineWidth() method
Get the property state: Line width
## Signature
```typescript
function getState_LineWidth(): number;
```
## Returns
number
Line width
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个 10mil 线宽的覆铜边框
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('', 1, polygon, 'solid', false, '嘉立创示例_读线宽', 5, 10, false);
// 3. 读取线宽
const lineWidth = pour.getState_LineWidth();
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitivePour.delete([pour.getState_PrimitiveId()]);
console.log('lineWidth:', lineWidth);
```
### getstate_net
# IPCB\_PrimitivePour.getState\_Net() method
Get the property state: net name
## Signature
```typescript
function getState_Net(): string;
```
## Returns
string
Net name
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个挂 GND 网络的覆铜边框
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('GND', 1, polygon, 'solid', false, '嘉立创示例_读网络', 5, 10, false);
// 3. 读取网络名称
const net = pour.getState_Net();
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitivePour.delete([pour.getState_PrimitiveId()]);
console.log('net:', net);
```
### getstate_pourfillmethod
# IPCB\_PrimitivePour.getState\_PourFillMethod() method
Get the property state: copper fill method
## Signature
```typescript
function getState_PourFillMethod(): any;
```
## Returns
any
Copper fill method
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个实心填充的覆铜边框
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('', 1, polygon, 'solid', false, '嘉立创示例_读填充法', 5, 10, false);
// 3. 读取填充方法
const fillMethod = pour.getState_PourFillMethod();
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitivePour.delete([pour.getState_PrimitiveId()]);
console.log('pourFillMethod:', fillMethod);
```
### getstate_pourname
# IPCB\_PrimitivePour.getState\_PourName() method
Get the property state: copper border name
## Signature
```typescript
function getState_PourName(): string;
```
## Returns
string
Copper border name
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个带名称的覆铜边框
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('', 1, polygon, 'solid', false, '嘉立创示例_地平面', 5, 10, false);
// 3. 读取名称
const pourName = pour.getState_PourName();
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitivePour.delete([pour.getState_PrimitiveId()]);
console.log('pourName:', pourName);
```
### getstate_pourpriority
# IPCB\_PrimitivePour.getState\_PourPriority() method
Get the property state: copper priority
## Signature
```typescript
function getState_PourPriority(): number;
```
## Returns
number
Copper priority
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个优先级为 5 的覆铜边框
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('', 1, polygon, 'solid', false, '嘉立创示例_读优先级', 5, 10, false);
// 3. 读取优先级
const priority = pour.getState_PourPriority();
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitivePour.delete([pour.getState_PrimitiveId()]);
console.log('pourPriority:', priority);
```
### getstate_preservesilos
# IPCB\_PrimitivePour.getState\_PreserveSilos() method
Get the property state: whether to keep islands
## Signature
```typescript
function getState_PreserveSilos(): boolean;
```
## Returns
boolean
Whether to keep islands
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个保留孤岛的覆铜边框
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('', 1, polygon, 'solid', true, '嘉立创示例_读孤岛', 5, 10, false);
// 3. 读取是否保留孤岛
const preserveSilos = pour.getState_PreserveSilos();
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitivePour.delete([pour.getState_PrimitiveId()]);
console.log('preserveSilos:', preserveSilos);
```
### getstate_primitiveid
# IPCB\_PrimitivePour.getState\_PrimitiveId() method
Get the property state: primitive ID
## Signature
```typescript
function getState_PrimitiveId(): string;
```
## Returns
string
Primitive ID
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个覆铜边框
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('', 1, polygon, 'solid', false, '嘉立创示例_读ID', 5, 10, false);
// 3. 读取图元 ID
const primitiveId = pour.getState_PrimitiveId();
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitivePour.delete([pour.getState_PrimitiveId()]);
console.log('primitiveId:', primitiveId);
```
### getstate_primitivelock
# IPCB\_PrimitivePour.getState\_PrimitiveLock() method
Get the property state: whether it is locked
## Signature
```typescript
function getState_PrimitiveLock(): boolean;
```
## Returns
boolean
Whether it is locked
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个锁定状态的覆铜边框
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('', 1, polygon, 'solid', false, '嘉立创示例_读锁定', 5, 10, true);
// 3. 读取锁定状态
const locked = pour.getState_PrimitiveLock();
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitivePour.delete([pour.getState_PrimitiveId()]);
console.log('primitiveLock:', locked);
```
### getstate_primitivetype
# IPCB\_PrimitivePour.getState\_PrimitiveType() method
Get the property state: primitive type
## Signature
```typescript
function getState_PrimitiveType(): EPCB_PrimitiveType;
```
## Returns
[EPCB\_PrimitiveType](../enums/EPCB_PrimitiveType.md)
Primitive type
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个覆铜边框
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('', 1, polygon, 'solid', false, '嘉立创示例_读类型', 5, 10, false);
// 3. 读取图元类型
const primitiveType = pour.getState_PrimitiveType();
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitivePour.delete([pour.getState_PrimitiveId()]);
console.log('primitiveType:', primitiveType);
```
### isasync
# IPCB\_PrimitivePour.isAsync() method
Query whether the primitive is an async primitive
## Signature
```typescript
function isAsync(): boolean;
```
## Returns
boolean
Whether Is async primitive
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个覆铜边框
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('', 1, polygon, 'solid', false, '嘉立创示例_查异步', 5, 10, false);
// 3. 查询异步状态(create 返回的即异步图元,修改需 toAsync + done)
const asyncMode = pour.isAsync();
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitivePour.delete([pour.getState_PrimitiveId()]);
console.log('isAsync:', asyncMode);
```
### rebuildcopperregion
# IPCB\_PrimitivePour.rebuildCopperRegion() method
> 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.
Rebuild the copper fill of the copper region
## Signature
```typescript
function rebuildCopperRegion(): Promise<IPCB_PrimitivePoured | undefined>;
```
## Returns
Promise<[IPCB\_PrimitivePoured](./IPCB_PrimitivePoured.md) \| undefined>
The copper fill primitive. If no copper fill primitive is rebuilt, `undefined` is returned
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个挂 GND 网络的覆铜边框(保留现场供观察)
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('GND', 1, polygon, 'solid', false, '嘉立创示例_重建覆铜', 5, 10, false);
// 3. 重建覆铜填充(成功时返回生成的覆铜填充图元)
let rebuilt = false;
let result;
try {
result = await pour.rebuildCopperRegion();
rebuilt = result !== undefined;
}
catch (e) {
// 当前版本在纯 API 创建的覆铜上重建会报内部错误,捕获后继续
console.log('说明:当前环境 rebuildCopperRegion 报错:', e.message);
}
console.log('rebuildRequested:', true);
console.log('hasCopperRegion:', rebuilt);
```
### reset
# IPCB\_PrimitivePour.reset() method
> 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.
Reset the async primitive to the current canvas state
## Signature
```typescript
function reset(): Promise<IPCB_PrimitivePour>;
```
## Returns
Promise<[IPCB\_PrimitivePour](./IPCB_PrimitivePour.md)<!-- -->>
Copper border primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个顶层铜层的覆铜边框
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('', 1, polygon, 'solid', false, '嘉立创示例_重置', 5, 10, false);
const before = pour.getState_Layer();
// 3. 异步模式下把层改到底层(2),随后反悔
const asyncPour = pour.toAsync();
asyncPour.setState_Layer(2);
// 4. reset 丢弃未提交的修改(保留现场供观察)
await asyncPour.reset();
// 5. 从画布重新读取,确认层没有变
const refetched = await eda.pcb_PrimitivePour.get(pour.getState_PrimitiveId());
console.log('layer:', before, '→', refetched.getState_Layer());
```
### setstate_complexpolygon
# IPCB\_PrimitivePour.setState\_ComplexPolygon() method
> 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.
Set the property state: complex polygon
## Signature
```typescript
function setState_ComplexPolygon(complexPolygon: IPCB_Polygon): IPCB_PrimitivePour;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
complexPolygon
</td><td>
[IPCB\_Polygon](./IPCB_Polygon.md)
</td><td>
Complex polygon
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitivePour](./IPCB_PrimitivePour.md)
Copper border primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个 500x300 的矩形覆铜边框
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('', 1, polygon, 'solid', false, '嘉立创示例_改轮廓', 5, 10, false);
const before = pour.getState_ComplexPolygon().getSource();
// 3. 异步模式下换成更大的 800x500 轮廓并提交
const asyncPour = pour.toAsync();
asyncPour.setState_ComplexPolygon(eda.pcb_MathPolygon.createPolygon(['R', x, y, 800, 500, 0, 0]));
await asyncPour.done();
// 4. 从画布重新读取,确认轮廓已更新(保留现场供观察)
const refetched = await eda.pcb_PrimitivePour.get(pour.getState_PrimitiveId());
const after = refetched.getState_ComplexPolygon().getSource();
console.log('before:', JSON.stringify(before));
console.log('after:', JSON.stringify(after));
```
### setstate_layer
# IPCB\_PrimitivePour.setState\_Layer() method
> 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.
Set the property state: Layer
## Signature
```typescript
function setState_Layer(layer: TPCB_LayersOfCopper): IPCB_PrimitivePour;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfCopper](../types/TPCB_LayersOfCopper.md)
</td><td>
Layer
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitivePour](./IPCB_PrimitivePour.md)
Copper border primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个顶层铜层(1)的覆铜边框
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('', 1, polygon, 'solid', false, '嘉立创示例_改层', 5, 10, false);
const before = pour.getState_Layer();
// 3. 异步模式把覆铜挪到底层铜层(2)
const asyncPour = pour.toAsync();
asyncPour.setState_Layer(2);
await asyncPour.done();
// 4. 从画布重新读取,确认层已切换(保留现场供观察)
const refetched = await eda.pcb_PrimitivePour.get(pour.getState_PrimitiveId());
console.log('layer:', before, '→', refetched.getState_Layer());
```
### setstate_linewidth
# IPCB\_PrimitivePour.setState\_LineWidth() method
> 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.
Set the property state: Line width
## Signature
```typescript
function setState_LineWidth(lineWidth: number): IPCB_PrimitivePour;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
lineWidth
</td><td>
number
</td><td>
Line width
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitivePour](./IPCB_PrimitivePour.md)
Copper border primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个 10mil 线宽的矩形覆铜边框
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('', 1, polygon, 'solid', false, '嘉立创示例_改线宽', 5, 10, false);
const before = pour.getState_LineWidth();
// 3. 切换异步模式,线宽加粗到 20mil
const asyncPour = pour.toAsync();
asyncPour.setState_LineWidth(20);
await asyncPour.done();
// 4. 从图元对象读回新值(保留现场供观察)
// 注:当前版本画布侧渲染线宽保持默认值,修改在图元对象上生效
const after = pour.getState_LineWidth();
console.log('lineWidth:', before, '→', after);
```
### setstate_net
# IPCB\_PrimitivePour.setState\_Net() method
> 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.
Set the property state: net name
## Signature
```typescript
function setState_Net(net: string): IPCB_PrimitivePour;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string
</td><td>
Net name
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitivePour](./IPCB_PrimitivePour.md)
Copper border primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个无网络的覆铜边框
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('', 1, polygon, 'solid', false, '嘉立创示例_改网络', 5, 10, false);
const before = pour.getState_Net();
// 3. 异步模式把覆铜挂到 GND 网络
const asyncPour = pour.toAsync();
asyncPour.setState_Net('GND');
await asyncPour.done();
// 4. 从画布重新读取,确认网络已更新(保留现场供观察)
const refetched = await eda.pcb_PrimitivePour.get(pour.getState_PrimitiveId());
console.log('net:', before, '→', refetched.getState_Net());
```
### setstate_pourfillmethod
# IPCB\_PrimitivePour.setState\_PourFillMethod() method
> 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.
Set the property state: copper fill method
## Signature
```typescript
function setState_PourFillMethod(pourFillMethod: EPCB_PrimitivePourFillMethod): IPCB_PrimitivePour;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
pourFillMethod
</td><td>
[EPCB\_PrimitivePourFillMethod](../enums/EPCB_PrimitivePourFillMethod.md)
</td><td>
Copper fill method
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitivePour](./IPCB_PrimitivePour.md)
Copper border primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个实心填充的覆铜边框
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('', 1, polygon, 'solid', false, '嘉立创示例_改填充法', 5, 10, false);
const before = pour.getState_PourFillMethod();
// 3. 异步模式把填充方法改成 90 度网格
const asyncPour = pour.toAsync();
asyncPour.setState_PourFillMethod('90grid');
await asyncPour.done();
// 4. 从画布重新读取,确认填充方法已切换(保留现场供观察)
const refetched = await eda.pcb_PrimitivePour.get(pour.getState_PrimitiveId());
console.log('pourFillMethod:', before, '→', refetched.getState_PourFillMethod());
```
### setstate_pourname
# IPCB\_PrimitivePour.setState\_PourName() method
> 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.
Set the property state: copper border name
## Signature
```typescript
function setState_PourName(pourName: string): IPCB_PrimitivePour;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
pourName
</td><td>
string
</td><td>
Copper border name
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitivePour](./IPCB_PrimitivePour.md)
Copper border primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个覆铜边框
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('', 1, polygon, 'solid', false, '嘉立创示例_原名', 5, 10, false);
const before = pour.getState_PourName();
// 3. 异步模式改名为电源区
const asyncPour = pour.toAsync();
asyncPour.setState_PourName('嘉立创示例_电源区');
await asyncPour.done();
// 4. 从画布重新读取,确认名称已更新(保留现场供观察)
const refetched = await eda.pcb_PrimitivePour.get(pour.getState_PrimitiveId());
console.log('pourName:', before, '→', refetched.getState_PourName());
```
### setstate_pourpriority
# IPCB\_PrimitivePour.setState\_PourPriority() method
> 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.
Set the property state: copper priority
## Signature
```typescript
function setState_PourPriority(pourPriority: number): IPCB_PrimitivePour;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
pourPriority
</td><td>
number
</td><td>
Copper priority
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitivePour](./IPCB_PrimitivePour.md)
Copper border primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个优先级为 5 的覆铜边框
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('', 1, polygon, 'solid', false, '嘉立创示例_改优先级', 5, 10, false);
const before = pour.getState_PourPriority();
// 3. 异步模式把优先级提到 3(更早铺铜)
const asyncPour = pour.toAsync();
asyncPour.setState_PourPriority(3);
await asyncPour.done();
// 4. 从画布重新读取,确认优先级已更新(保留现场供观察)
const refetched = await eda.pcb_PrimitivePour.get(pour.getState_PrimitiveId());
console.log('pourPriority:', before, '→', refetched.getState_PourPriority());
```
### setstate_preservesilos
# IPCB\_PrimitivePour.setState\_PreserveSilos() method
> 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.
Set the property state: whether to keep islands
## Signature
```typescript
function setState_PreserveSilos(preserveSilos: boolean): IPCB_PrimitivePour;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
preserveSilos
</td><td>
boolean
</td><td>
Whether to keep islands
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitivePour](./IPCB_PrimitivePour.md)
Copper border primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个不保留孤岛的覆铜边框
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('', 1, polygon, 'solid', false, '嘉立创示例_改孤岛', 5, 10, false);
const before = pour.getState_PreserveSilos();
// 3. 异步模式开启保留孤岛
const asyncPour = pour.toAsync();
asyncPour.setState_PreserveSilos(true);
await asyncPour.done();
// 4. 从画布重新读取,确认设置已更新(保留现场供观察)
const refetched = await eda.pcb_PrimitivePour.get(pour.getState_PrimitiveId());
console.log('preserveSilos:', before, '→', refetched.getState_PreserveSilos());
```
### setstate_primitivelock
# IPCB\_PrimitivePour.setState\_PrimitiveLock() method
> 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.
Set the property state: whether it is locked
## Signature
```typescript
function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitivePour;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveLock
</td><td>
boolean
</td><td>
Whether it is locked
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitivePour](./IPCB_PrimitivePour.md)
Copper border primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个未锁定的覆铜边框
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('', 1, polygon, 'solid', false, '嘉立创示例_改锁定', 5, 10, false);
const before = pour.getState_PrimitiveLock();
// 3. 异步模式锁定图元
const asyncPour = pour.toAsync();
asyncPour.setState_PrimitiveLock(true);
await asyncPour.done();
// 4. 从画布重新读取,确认已锁定(保留现场供观察)
const refetched = await eda.pcb_PrimitivePour.get(pour.getState_PrimitiveId());
console.log('primitiveLock:', before, '→', refetched.getState_PrimitiveLock());
```
### toasync
# IPCB\_PrimitivePour.toAsync() method
Convert Primitive to Async primitive
## Signature
```typescript
function toAsync(): IPCB_PrimitivePour;
```
## Returns
[IPCB\_PrimitivePour](./IPCB_PrimitivePour.md)
Copper border primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个顶层铜层的覆铜边框
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('', 1, polygon, 'solid', false, '嘉立创示例_转异步', 5, 10, false);
// 3. 转换为异步图元
const asyncPour = pour.toAsync();
// 4. 异步模式下连续改两个属性,一次提交
asyncPour.setState_Layer(2);
asyncPour.setState_PourName('嘉立创示例_批量改名');
await asyncPour.done();
// 5. 从画布重新读取,确认批量修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitivePour.get(pour.getState_PrimitiveId());
console.log('isAsync:', asyncPour.isAsync());
console.log('layer:', pour.getState_Layer(), '→', refetched.getState_Layer());
console.log('pourName:', pour.getState_PourName(), '→', refetched.getState_PourName());
```
### tosync
# IPCB\_PrimitivePour.toSync() method
Convert Primitive to Sync primitive
## Signature
```typescript
function toSync(): IPCB_PrimitivePour;
```
## Returns
[IPCB\_PrimitivePour](./IPCB_PrimitivePour.md)
Copper border primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个顶层铜层的覆铜边框
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('', 1, polygon, 'solid', false, '嘉立创示例_转同步', 5, 10, false);
const before = pour.getState_Layer();
// 3. 转换为同步图元(isAsync 变为 false)
const syncPour = pour.toSync();
// 4. 同步模式下直接改层,无需 done()
syncPour.setState_Layer(2);
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitivePour.get(pour.getState_PrimitiveId());
console.log('isAsync:', syncPour.isAsync());
console.log('layer:', before, '→', refetched.getState_Layer());
```
references/classes/IPCB_PrimitivePoured.md
# IPCB\_PrimitivePoured class
Copper fill primitive
## Signature
```typescript
class IPCB_PrimitivePoured implements IPCB_Primitive
```
**Implements:** [IPCB\_Primitive](../interfaces/IPCB_Primitive.md)
## Remarks
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[addSolderMaskFill(pourFillId)](./IPCB_PrimitivePoured.md)
</td><td>
</td><td>
**_(BETA)_** Add: solder mask region
</td></tr>
<tr><td>
[convertToFill(pourFillId)](./IPCB_PrimitivePoured.md)
</td><td>
</td><td>
**_(BETA)_** Convert to: fill primitive
</td></tr>
<tr><td>
[deletePourFills(pourFillIds)](./IPCB_PrimitivePoured.md)
</td><td>
</td><td>
**_(BETA)_** Delete Copper fill region
</td></tr>
<tr><td>
[getState\_PourFills()](./IPCB_PrimitivePoured.md)
</td><td>
</td><td>
Get the property state: copper fill region
</td></tr>
<tr><td>
[getState\_PourPrimitiveId()](./IPCB_PrimitivePoured.md)
</td><td>
</td><td>
Get the property state: copper border primitive ID
</td></tr>
<tr><td>
[getState\_PrimitiveId()](./IPCB_PrimitivePoured.md)
</td><td>
</td><td>
Get the property state: primitive ID
</td></tr>
<tr><td>
[getState\_PrimitiveType()](./IPCB_PrimitivePoured.md)
</td><td>
</td><td>
Get the property state: primitive type
</td></tr>
<tr><td>
[reset()](./IPCB_PrimitivePoured.md)
</td><td>
</td><td>
**_(BETA)_** Reset the async primitive to the current canvas state
</td></tr>
</tbody></table>
---
## 方法详情
### addsoldermaskfill
# IPCB\_PrimitivePoured.addSolderMaskFill() method
> 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.
Add: solder mask region
## Signature
```typescript
function addSolderMaskFill(
pourFillId: IPCB_PrimitivePouredPourFill['id'],
): Promise<IPCB_PrimitiveFill | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
pourFillId
</td><td>
[IPCB\_PrimitivePouredPourFill](../interfaces/IPCB_PrimitivePouredPourFill.md)<!-- -->\['id'\]
</td><td>
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveFill](./IPCB_PrimitiveFill.md) \| undefined>
The solder mask region fill primitive object. If conversion fails or the ID is incorrect, `undefined` is returned
## Example
```javascript
// 1. 获取画布上已有的覆铜填充图元
const pouredList = await eda.pcb_PrimitivePoured.getAll();
if (!pouredList || pouredList.length === 0) {
console.log('说明:PCB 上没有覆铜填充,请先手动绘制覆铜并重建(设计 → 覆铜)');
return;
}
const poured = pouredList[0];
// 2. 取第一个填充子区域的 ID(本方法按 pourFillId 定位,不是图元 ID)
const pourFills = poured.getState_PourFills();
if (pourFills.length === 0) {
console.log('说明:该覆铜填充没有子区域');
return;
}
// 3. 为该子区域添加阻焊区域(保留现场供观察)
const solderMaskFill = await poured.addSolderMaskFill(pourFills[0].id);
// 4. 输出生成的阻焊填充图元信息
if (solderMaskFill) {
console.log('primitiveType:', solderMaskFill.getState_PrimitiveType());
console.log('primitiveId:', solderMaskFill.getState_PrimitiveId());
} else {
console.log('说明:未能生成阻焊区域(返回 undefined)');
}
```
### converttofill
# IPCB\_PrimitivePoured.convertToFill() method
> 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.
Convert to: fill primitive
## Signature
```typescript
function convertToFill(
pourFillId: IPCB_PrimitivePouredPourFill['id'],
): Promise<IPCB_PrimitiveFill | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
pourFillId
</td><td>
[IPCB\_PrimitivePouredPourFill](../interfaces/IPCB_PrimitivePouredPourFill.md)<!-- -->\['id'\]
</td><td>
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveFill](./IPCB_PrimitiveFill.md) \| undefined>
The fill primitive object. If conversion fails or the ID is incorrect, `undefined` is returned
## Example
```javascript
// 1. 获取画布上已有的覆铜填充图元
const pouredList = await eda.pcb_PrimitivePoured.getAll();
if (!pouredList || pouredList.length === 0) {
console.log('说明:PCB 上没有覆铜填充,请先手动绘制覆铜并重建(设计 → 覆铜)');
return;
}
const poured = pouredList[0];
// 2. 取第一个填充子区域的 ID(本方法按 pourFillId 定位,不是图元 ID)
const pourFills = poured.getState_PourFills();
if (pourFills.length === 0) {
console.log('说明:该覆铜填充没有子区域');
return;
}
// 3. 将该子区域转换为独立填充图元(保留现场供观察)
const fill = await poured.convertToFill(pourFills[0].id);
// 4. 输出转换得到的填充图元信息
if (fill) {
console.log('primitiveType:', fill.getState_PrimitiveType());
console.log('primitiveId:', fill.getState_PrimitiveId());
} else {
console.log('说明:转换失败(返回 undefined)');
}
```
### deletepourfills
# IPCB\_PrimitivePoured.deletePourFills() method
> 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.
Delete Copper fill region
## Signature
```typescript
function deletePourFills(
pourFillIds: IPCB_PrimitivePouredPourFill['id'] | Array<IPCB_PrimitivePouredPourFill['id']>,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
pourFillIds
</td><td>
[IPCB\_PrimitivePouredPourFill](../interfaces/IPCB_PrimitivePouredPourFill.md)<!-- -->\['id'\] \| Array<[IPCB\_PrimitivePouredPourFill](../interfaces/IPCB_PrimitivePouredPourFill.md)<!-- -->\['id'\]>
</td><td>
Copper fill region ID
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Delete Whether the operation is successful
## Example
```javascript
// 1. 获取画布上已有的覆铜填充图元
const pouredList = await eda.pcb_PrimitivePoured.getAll();
if (!pouredList || pouredList.length === 0) {
console.log('说明:PCB 上没有覆铜填充,请先手动绘制覆铜并重建(设计 → 覆铜)');
return;
}
const poured = pouredList[0];
// 2. 取填充子区域列表(本方法按 pourFillId 定位,不是图元 ID)
const pourFills = poured.getState_PourFills();
if (pourFills.length === 0) {
console.log('说明:该覆铜填充没有子区域');
return;
}
console.log('删除前子区域数量:', pourFills.length);
// 3. 删除第一个子区域(传单个 ID;也可以传 ID 数组批量删除)
const deleted = await poured.deletePourFills(pourFills[0].id);
// 4. 从画布重新读取,确认删除结果
const refreshed = await eda.pcb_PrimitivePoured.get(poured.getState_PrimitiveId());
const after = refreshed ? refreshed.getState_PourFills().length : 0;
console.log('deleted:', deleted);
console.log('删除后子区域数量:', after);
```
### getstate_pourfills
# IPCB\_PrimitivePoured.getState\_PourFills() method
Get the property state: copper fill region
## Signature
```typescript
function getState_PourFills(): Array<IPCB_PrimitivePouredPourFill>;
```
## Returns
Array<[IPCB\_PrimitivePouredPourFill](../interfaces/IPCB_PrimitivePouredPourFill.md)<!-- -->>
Copper fill region
## Example
```javascript
// 1. 获取画布上已有的覆铜填充图元
const pouredList = await eda.pcb_PrimitivePoured.getAll();
if (!pouredList || pouredList.length === 0) {
console.log('说明:PCB 上没有覆铜填充,请先手动绘制覆铜并重建(设计 → 覆铜)');
return;
}
const poured = pouredList[0];
// 2. 读取全部填充子区域
const pourFills = poured.getState_PourFills();
console.log('pourFillCount:', pourFills.length);
// 3. 输出第一个子区域的关键属性(path 是复杂多边形对象,只输出有无)
if (pourFills.length > 0) {
const first = pourFills[0];
console.log('第一个子区域 fill:', first.fill, 'lineWidth:', first.lineWidth);
console.log('第一个子区域 path:', first.path ? '已包含' : '未包含');
}
```
### getstate_pourprimitiveid
# IPCB\_PrimitivePoured.getState\_PourPrimitiveId() method
Get the property state: copper border primitive ID
## Signature
```typescript
function getState_PourPrimitiveId(): string;
```
## Returns
string
Copper border primitive ID
## Example
```javascript
// 1. 获取画布上已有的覆铜填充图元
const pouredList = await eda.pcb_PrimitivePoured.getAll();
if (!pouredList || pouredList.length === 0) {
console.log('说明:PCB 上没有覆铜填充,请先手动绘制覆铜并重建(设计 → 覆铜)');
return;
}
const poured = pouredList[0];
// 2. 读取关联的覆铜边框图元 ID
const pourPrimitiveId = poured.getState_PourPrimitiveId();
console.log('pourPrimitiveId:', pourPrimitiveId);
// 3. 用该 ID 反查覆铜边框,验证关联有效
const pour = await eda.pcb_PrimitivePour.get(pourPrimitiveId);
console.log('对应覆铜边框:', pour ? pour.getState_PourName() : '(边框已被删除)');
```
### getstate_primitiveid
# IPCB\_PrimitivePoured.getState\_PrimitiveId() method
Get the property state: primitive ID
## Signature
```typescript
function getState_PrimitiveId(): string;
```
## Returns
string
Primitive ID
## Example
```javascript
// 1. 获取画布上已有的覆铜填充图元
const pouredList = await eda.pcb_PrimitivePoured.getAll();
if (!pouredList || pouredList.length === 0) {
console.log('说明:PCB 上没有覆铜填充,请先手动绘制覆铜并重建(设计 → 覆铜)');
return;
}
const poured = pouredList[0];
// 2. 读取图元 ID
const primitiveId = poured.getState_PrimitiveId();
console.log('primitiveId:', primitiveId);
// 3. 用该 ID 通过管理类重新读取,验证 ID 有效
const again = await eda.pcb_PrimitivePoured.get(primitiveId);
console.log('按 ID 重新读取:', again ? '成功' : '未找到');
```
### getstate_primitivetype
# IPCB\_PrimitivePoured.getState\_PrimitiveType() method
Get the property state: primitive type
## Signature
```typescript
function getState_PrimitiveType(): EPCB_PrimitiveType;
```
## Returns
[EPCB\_PrimitiveType](../enums/EPCB_PrimitiveType.md)
Primitive type
## Example
```javascript
// 1. 获取画布上已有的覆铜填充图元
const pouredList = await eda.pcb_PrimitivePoured.getAll();
if (!pouredList || pouredList.length === 0) {
console.log('说明:PCB 上没有覆铜填充,请先手动绘制覆铜并重建(设计 → 覆铜)');
return;
}
const poured = pouredList[0];
// 2. 读取图元类型
const primitiveType = poured.getState_PrimitiveType();
console.log('primitiveType:', primitiveType);
```
### reset
# IPCB\_PrimitivePoured.reset() method
> 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.
Reset the async primitive to the current canvas state
## Signature
```typescript
function reset(): Promise<IPCB_PrimitivePoured>;
```
## Returns
Promise<[IPCB\_PrimitivePoured](./IPCB_PrimitivePoured.md)<!-- -->>
Copper fill primitive object
## Example
```javascript
// 1. 获取画布上已有的覆铜填充图元
const pouredList = await eda.pcb_PrimitivePoured.getAll();
if (!pouredList || pouredList.length === 0) {
console.log('说明:PCB 上没有覆铜填充,请先手动绘制覆铜并重建(设计 → 覆铜)');
return;
}
const poured = pouredList[0];
// 2. 记录重置前的子区域数量
const before = poured.getState_PourFills().length;
// 3. 重置为当前画布状态(丢弃未提交的修改)
const resetResult = await poured.reset();
// 4. 重置返回的对象仍可正常读取状态
const after = resetResult.getState_PourFills().length;
console.log('pourFillCount:', before, '→', after);
console.log('primitiveType:', resetResult.getState_PrimitiveType());
```
references/classes/IPCB_PrimitivePad.md
# IPCB\_PrimitivePad class
Pad primitive
## Signature
```typescript
class IPCB_PrimitivePad implements IPCB_Primitive
```
**Implements:** [IPCB\_Primitive](../interfaces/IPCB_Primitive.md)
## Remarks
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[async](./IPCB_PrimitivePad.md)
</td><td>
`protected`
</td><td>
boolean
</td><td>
异步
</td></tr>
<tr><td>
[heatWelding](./IPCB_PrimitivePad.md)
</td><td>
`protected`
</td><td>
[IPCB\_PrimitivePadHeatWelding](../interfaces/IPCB_PrimitivePadHeatWelding.md) \| null
</td><td>
热焊优化参数
</td></tr>
<tr><td>
[hole](./IPCB_PrimitivePad.md)
</td><td>
`protected`
</td><td>
[TPCB\_PrimitivePadHole](../types/TPCB_PrimitivePadHole.md) \| null
</td><td>
孔
</td></tr>
<tr><td>
[holeOffsetX](./IPCB_PrimitivePad.md)
</td><td>
`protected`
</td><td>
number
</td><td>
孔偏移 X
</td></tr>
<tr><td>
[holeOffsetY](./IPCB_PrimitivePad.md)
</td><td>
`protected`
</td><td>
number
</td><td>
孔偏移 Y
</td></tr>
<tr><td>
[holeRotation](./IPCB_PrimitivePad.md)
</td><td>
`protected`
</td><td>
number
</td><td>
孔相对于焊盘的旋转角度
</td></tr>
<tr><td>
[layer](./IPCB_PrimitivePad.md)
</td><td>
`protected`
</td><td>
[TPCB\_LayersOfPad](../types/TPCB_LayersOfPad.md)
</td><td>
层
</td></tr>
<tr><td>
[metallization](./IPCB_PrimitivePad.md)
</td><td>
`protected`
</td><td>
boolean
</td><td>
是否金属化孔壁
</td></tr>
<tr><td>
[net?](./IPCB_PrimitivePad.md)
</td><td>
`protected`
</td><td>
string
</td><td>
_(Optional)_ 网络名称
</td></tr>
<tr><td>
[pad?](./IPCB_PrimitivePad.md)
</td><td>
`protected`
</td><td>
[TPCB\_PrimitivePadShape](../types/TPCB_PrimitivePadShape.md)
</td><td>
_(Optional)_ 焊盘外形
</td></tr>
<tr><td>
[padNumber](./IPCB_PrimitivePad.md)
</td><td>
`protected`
</td><td>
string
</td><td>
焊盘编号
</td></tr>
<tr><td>
[padType](./IPCB_PrimitivePad.md)
</td><td>
`protected`
</td><td>
[EPCB\_PrimitivePadType](../enums/EPCB_PrimitivePadType.md)
</td><td>
焊盘类型
</td></tr>
<tr><td>
[primitiveId?](./IPCB_PrimitivePad.md)
</td><td>
`protected`
</td><td>
string
</td><td>
_(Optional)_ 图元 ID
</td></tr>
<tr><td>
[primitiveLock](./IPCB_PrimitivePad.md)
</td><td>
`protected`
</td><td>
boolean
</td><td>
是否锁定
</td></tr>
<tr><td>
[primitiveType](./IPCB_PrimitivePad.md)
</td><td>
`protected`
`readonly`
</td><td>
[EPCB\_PrimitiveType](../enums/EPCB_PrimitiveType.md)
</td><td>
图元类型
</td></tr>
<tr><td>
[rotation](./IPCB_PrimitivePad.md)
</td><td>
`protected`
</td><td>
number
</td><td>
旋转角度
</td></tr>
<tr><td>
[solderMaskAndPasteMaskExpansion](./IPCB_PrimitivePad.md)
</td><td>
`protected`
</td><td>
[IPCB\_PrimitiveSolderMaskAndPasteMaskExpansion](../interfaces/IPCB_PrimitiveSolderMaskAndPasteMaskExpansion.md) \| null
</td><td>
阻焊/助焊扩展
</td></tr>
<tr><td>
[specialPad?](./IPCB_PrimitivePad.md)
</td><td>
`protected`
</td><td>
[TPCB\_PrimitiveSpecialPadShape](../types/TPCB_PrimitiveSpecialPadShape.md)
</td><td>
_(Optional)_ 特殊焊盘外形
</td></tr>
<tr><td>
[x](./IPCB_PrimitivePad.md)
</td><td>
`protected`
</td><td>
number
</td><td>
位置 X
</td></tr>
<tr><td>
[y](./IPCB_PrimitivePad.md)
</td><td>
`protected`
</td><td>
number
</td><td>
位置 Y
</td></tr>
</tbody></table>
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[create()](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
**_(BETA)_** In PCB canvas in create primitive
</td></tr>
<tr><td>
[done()](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
**_(BETA)_** Apply the changes to the primitives to the canvas
</td></tr>
<tr><td>
[getState\_HeatWelding()](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
Get the property state: thermal relief optimization parameters
</td></tr>
<tr><td>
[getState\_Hole()](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
Get the property state: hole
</td></tr>
<tr><td>
[getState\_HoleOffsetX()](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
Get the property state: hole offset X
</td></tr>
<tr><td>
[getState\_HoleOffsetY()](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
Get the property state: hole offset Y
</td></tr>
<tr><td>
[getState\_HoleRotation()](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
Get the property state: Rotation angle of the hole relative to the pad
</td></tr>
<tr><td>
[getState\_Layer()](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
Get the property state: Layer
</td></tr>
<tr><td>
[getState\_Metallization()](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
Get the property state: Whether the hole wall is plated
</td></tr>
<tr><td>
[getState\_Net()](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
Get the property state: net name
</td></tr>
<tr><td>
[getState\_Pad()](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
Get the property state: pad shape
</td></tr>
<tr><td>
[getState\_PadNumber()](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
Get the property state: pad number
</td></tr>
<tr><td>
[getState\_PadType()](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
Get the property state: pad type
</td></tr>
<tr><td>
[getState\_PrimitiveId()](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
Get the property state: primitive ID
</td></tr>
<tr><td>
[getState\_PrimitiveLock()](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
Get the property state: whether it is locked
</td></tr>
<tr><td>
[getState\_PrimitiveType()](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
Get the property state: primitive type
</td></tr>
<tr><td>
[getState\_Rotation()](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
Get the property state: rotation angle
</td></tr>
<tr><td>
[getState\_SolderMaskAndPasteMaskExpansion()](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
Get the property state: solder mask / paste mask expansion
</td></tr>
<tr><td>
[getState\_SpecialPad()](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
Get the property state: special pad shape
</td></tr>
<tr><td>
[getState\_X()](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
Get the property state: X position
</td></tr>
<tr><td>
[getState\_Y()](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
Get the property state: Y position
</td></tr>
<tr><td>
[isAsync()](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
Query whether the primitive is an async primitive
</td></tr>
<tr><td>
[reset()](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
**_(BETA)_** Reset the async primitive to the current canvas state
</td></tr>
<tr><td>
[setState\_HeatWelding(heatWelding)](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: thermal relief optimization parameters
</td></tr>
<tr><td>
[setState\_Hole(hole)](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: hole
</td></tr>
<tr><td>
[setState\_HoleOffsetX(holeOffsetX)](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: hole offset X
</td></tr>
<tr><td>
[setState\_HoleOffsetY(holeOffsetY)](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: hole offset Y
</td></tr>
<tr><td>
[setState\_HoleRotation(holeRotation)](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Rotation angle of the hole relative to the pad
</td></tr>
<tr><td>
[setState\_Layer(layer)](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Layer
</td></tr>
<tr><td>
[setState\_Metallization(metallization)](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Whether the hole wall is plated
</td></tr>
<tr><td>
[setState\_Net(net)](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: net
</td></tr>
<tr><td>
[setState\_Pad(pad)](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: pad shape
</td></tr>
<tr><td>
[setState\_PadNumber(padNumber)](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: pad number
</td></tr>
<tr><td>
[setState\_PrimitiveLock(primitiveLock)](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: whether it is locked
</td></tr>
<tr><td>
[setState\_Rotation(rotation)](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: rotation angle
</td></tr>
<tr><td>
[setState\_SolderMaskAndPasteMaskExpansion(solderMaskAndPasteMaskExpansion)](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: solder mask / paste mask expansion
</td></tr>
<tr><td>
[setState\_SpecialPad(specialPad)](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: special pad shape
</td></tr>
<tr><td>
[setState\_X(x)](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: X position
</td></tr>
<tr><td>
[setState\_Y(y)](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Y position
</td></tr>
<tr><td>
[toAsync()](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
Convert Primitive to Async primitive
</td></tr>
<tr><td>
[toSync()](./IPCB_PrimitivePad.md)
</td><td>
</td><td>
Convert Primitive to Sync primitive
</td></tr>
</tbody></table>
---
## 属性详情
### async
# IPCB\_PrimitivePad.async property
异步
## Signature
```typescript
function async: boolean;
```
### heatwelding
# IPCB\_PrimitivePad.heatWelding property
热焊优化参数
## Signature
```typescript
function heatWelding: IPCB_PrimitivePadHeatWelding | null;
```
### hole
# IPCB\_PrimitivePad.hole property
孔
## Signature
```typescript
function hole: TPCB_PrimitivePadHole | null;
```
### holeoffsetx
# IPCB\_PrimitivePad.holeOffsetX property
孔偏移 X
## Signature
```typescript
function holeOffsetX: number;
```
### holeoffsety
# IPCB\_PrimitivePad.holeOffsetY property
孔偏移 Y
## Signature
```typescript
function holeOffsetY: number;
```
### holerotation
# IPCB\_PrimitivePad.holeRotation property
孔相对于焊盘的旋转角度
## Signature
```typescript
function holeRotation: number;
```
### layer
# IPCB\_PrimitivePad.layer property
层
## Signature
```typescript
function layer: TPCB_LayersOfPad;
```
### metallization
# IPCB\_PrimitivePad.metallization property
是否金属化孔壁
## Signature
```typescript
function metallization: boolean;
```
### net
# IPCB\_PrimitivePad.net property
网络名称
## Signature
```typescript
function net?: string;
```
### pad
# IPCB\_PrimitivePad.pad property
焊盘外形
## Signature
```typescript
function pad?: TPCB_PrimitivePadShape;
```
### padnumber
# IPCB\_PrimitivePad.padNumber property
焊盘编号
## Signature
```typescript
function padNumber: string;
```
### padtype
# IPCB\_PrimitivePad.padType property
焊盘类型
## Signature
```typescript
function padType: EPCB_PrimitivePadType;
```
### primitiveid
# IPCB\_PrimitivePad.primitiveId property
图元 ID
## Signature
```typescript
function primitiveId?: string;
```
### primitivelock
# IPCB\_PrimitivePad.primitiveLock property
是否锁定
## Signature
```typescript
function primitiveLock: boolean;
```
### primitivetype
# IPCB\_PrimitivePad.primitiveType property
图元类型
## Signature
```typescript
function readonly primitiveType: EPCB_PrimitiveType;
```
### rotation
# IPCB\_PrimitivePad.rotation property
旋转角度
## Signature
```typescript
function rotation: number;
```
### soldermaskandpastemaskexpansion
# IPCB\_PrimitivePad.solderMaskAndPasteMaskExpansion property
阻焊/助焊扩展
## Signature
```typescript
function solderMaskAndPasteMaskExpansion: IPCB_PrimitiveSolderMaskAndPasteMaskExpansion | null;
```
### specialpad
# IPCB\_PrimitivePad.specialPad property
特殊焊盘外形
## Signature
```typescript
function specialPad?: TPCB_PrimitiveSpecialPadShape;
```
### x
# IPCB\_PrimitivePad.x property
位置 X
## Signature
```typescript
function x: number;
```
### y
# IPCB\_PrimitivePad.y property
位置 Y
## Signature
```typescript
function y: number;
```
---
## 方法详情
### create
# IPCB\_PrimitivePad.create() method
> 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.
In PCB canvas in create primitive
## Signature
```typescript
function create(): Promise<IPCB_PrimitivePad>;
```
## Returns
Promise<[IPCB\_PrimitivePad](./IPCB_PrimitivePad.md)<!-- -->>
Pad primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,在顶层放置一个圆形贴片焊盘(直径 60mil)
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
// 2. 读取创建结果,确认层、编号与外形(保留现场供画布观察)
console.log('created:', !!pad);
console.log('layer:', pad.getState_Layer());
console.log('padNumber:', pad.getState_PadNumber());
console.log('padShape:', pad.getState_Pad());
```
### done
# IPCB\_PrimitivePad.done() method
> 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.
Apply the changes to the primitives to the canvas
## Signature
```typescript
function done(): Promise<IPCB_PrimitivePad>;
```
## Returns
Promise<[IPCB\_PrimitivePad](./IPCB_PrimitivePad.md)<!-- -->>
Dimension primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,在顶层放置一个圆形贴片焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
// 2. 异步模式下连续修改旋转和编号(此时画布尚未变化)
const a = pad.toAsync();
a.setState_Rotation(90);
a.setState_PadNumber('嘉立创示例_A1');
// 3. 一次性提交到画布
await a.done();
// 4. 从画布重新读取,确认两处修改都已生效(保留现场供观察)
const ref = await eda.pcb_PrimitivePad.get(pad.getState_PrimitiveId());
console.log('rotation:', ref.getState_Rotation());
console.log('padNumber:', ref.getState_PadNumber());
```
### getstate_heatwelding
# IPCB\_PrimitivePad.getState\_HeatWelding() method
Get the property state: thermal relief optimization parameters
## Signature
```typescript
function getState_HeatWelding(): IPCB_PrimitivePadHeatWelding | null;
```
## Returns
[IPCB\_PrimitivePadHeatWelding](../interfaces/IPCB_PrimitivePadHeatWelding.md) \| null
Thermal relief optimization parameters
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个带热焊参数的焊盘和一个普通焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const heated = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0, undefined, null, { connectionMethod: 'Divergent', divergenceSpacing: 10, divergenceLineWidth: 8, divergenceAngle: 45 });
const plain = await eda.pcb_PrimitivePad.create(1, '2', x + 500, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
// 2. 分别读取热焊参数
const heatedConfig = heated.getState_HeatWelding();
const plainConfig = plain.getState_HeatWelding();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitivePad.delete([heated.getState_PrimitiveId(), plain.getState_PrimitiveId()]);
console.log('heatedConfig:', heatedConfig);
console.log('plainConfig:', plainConfig);
```
### getstate_hole
# IPCB\_PrimitivePad.getState\_Hole() method
Get the property state: hole
## Signature
```typescript
function getState_Hole(): TPCB_PrimitivePadHole | null;
```
## Returns
[TPCB\_PrimitivePadHole](../types/TPCB_PrimitivePadHole.md) \| null
Hole
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个带圆孔的通孔焊盘和一个贴片焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const through = await eda.pcb_PrimitivePad.create(12, '1', x, 3000, 0, ['ELLIPSE', 80, 80], '', ['ROUND', 30], 0, 0, 0, false, 0);
const smd = await eda.pcb_PrimitivePad.create(1, '2', x + 500, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
// 2. 分别读取钻孔参数
const throughHole = through.getState_Hole();
const smdHole = smd.getState_Hole();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitivePad.delete([through.getState_PrimitiveId(), smd.getState_PrimitiveId()]);
console.log('throughHole:', throughHole);
console.log('smdHole:', smdHole);
```
### getstate_holeoffsetx
# IPCB\_PrimitivePad.getState\_HoleOffsetX() method
Get the property state: hole offset X
## Signature
```typescript
function getState_HoleOffsetX(): number;
```
## Returns
number
Hole offset X
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个孔心向右偏 10mil 的通孔焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(12, '1', x, 3000, 0, ['ELLIPSE', 80, 80], '', ['ROUND', 30], 10, 0, 0, false, 0);
// 2. 读取孔偏移 X
const holeOffsetX = pad.getState_HoleOffsetX();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitivePad.delete([pad.getState_PrimitiveId()]);
console.log('holeOffsetX:', holeOffsetX);
```
### getstate_holeoffsety
# IPCB\_PrimitivePad.getState\_HoleOffsetY() method
Get the property state: hole offset Y
## Signature
```typescript
function getState_HoleOffsetY(): number;
```
## Returns
number
Hole offset Y
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个孔心向上偏 20mil 的通孔焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(12, '1', x, 3000, 0, ['ELLIPSE', 80, 80], '', ['ROUND', 30], 0, 20, 0, false, 0);
// 2. 读取孔偏移 Y
const holeOffsetY = pad.getState_HoleOffsetY();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitivePad.delete([pad.getState_PrimitiveId()]);
console.log('holeOffsetY:', holeOffsetY);
```
### getstate_holerotation
# IPCB\_PrimitivePad.getState\_HoleRotation() method
Get the property state: Rotation angle of the hole relative to the pad
## Signature
```typescript
function getState_HoleRotation(): number;
```
## Returns
number
Rotation angle of the hole relative to the pad
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个孔旋转 45 度的通孔焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(12, '1', x, 3000, 0, ['ELLIPSE', 80, 80], '', ['ROUND', 30], 0, 0, 45, false, 0);
// 2. 读取孔旋转角度
const holeRotation = pad.getState_HoleRotation();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitivePad.delete([pad.getState_PrimitiveId()]);
console.log('holeRotation:', holeRotation);
```
### getstate_layer
# IPCB\_PrimitivePad.getState\_Layer() method
Get the property state: Layer
## Signature
```typescript
function getState_Layer(): TPCB_LayersOfPad;
```
## Returns
[TPCB\_LayersOfPad](../types/TPCB_LayersOfPad.md)
Layer
## Example
```javascript
// 1. 生成本次运行专用的坐标,分别在顶层和多层创建焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const top = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
const multi = await eda.pcb_PrimitivePad.create(12, '2', x + 500, 3000, 0, ['ELLIPSE', 80, 80], '', ['ROUND', 30], 0, 0, 0, false, 0);
// 2. 分别读取层属性
const topLayer = top.getState_Layer();
const multiLayer = multi.getState_Layer();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitivePad.delete([top.getState_PrimitiveId(), multi.getState_PrimitiveId()]);
console.log('topLayer:', topLayer);
console.log('multiLayer:', multiLayer);
```
### getstate_metallization
# IPCB\_PrimitivePad.getState\_Metallization() method
Get the property state: Whether the hole wall is plated
## Signature
```typescript
function getState_Metallization(): boolean;
```
## Returns
boolean
Whether the hole wall is plated
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个金属化孔焊盘和一个非金属化孔焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const plated = await eda.pcb_PrimitivePad.create(12, '1', x, 3000, 0, ['ELLIPSE', 80, 80], '', ['ROUND', 30], 0, 0, 0, true, 0);
const nonPlated = await eda.pcb_PrimitivePad.create(12, '2', x + 500, 3000, 0, ['ELLIPSE', 80, 80], '', ['ROUND', 30], 0, 0, 0, false, 0);
// 2. 分别读取金属化状态
const platedMetallization = plated.getState_Metallization();
const nonPlatedMetallization = nonPlated.getState_Metallization();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitivePad.delete([plated.getState_PrimitiveId(), nonPlated.getState_PrimitiveId()]);
console.log('platedMetallization:', platedMetallization);
console.log('nonPlatedMetallization:', nonPlatedMetallization);
```
### getstate_net
# IPCB\_PrimitivePad.getState\_Net() method
Get the property state: net name
## Signature
```typescript
function getState_Net(): string | undefined;
```
## Returns
string \| undefined
Net name
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个挂网络的焊盘和一个无网络焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const netted = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], '嘉立创示例_NET1', null, 0, 0, 0, false, 0);
const free = await eda.pcb_PrimitivePad.create(1, '2', x + 500, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
// 2. 分别读取网络名称
const nettedNet = netted.getState_Net();
const freeNet = free.getState_Net();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitivePad.delete([netted.getState_PrimitiveId(), free.getState_PrimitiveId()]);
console.log('nettedNet:', nettedNet);
console.log('freeNet:', freeNet);
```
### getstate_pad
# IPCB\_PrimitivePad.getState\_Pad() method
Get the property state: pad shape
## Signature
```typescript
function getState_Pad(): TPCB_PrimitivePadShape | undefined;
```
## Returns
[TPCB\_PrimitivePadShape](../types/TPCB_PrimitivePadShape.md) \| undefined
Pad shape
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个圆形贴片焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
// 2. 读取焊盘外形
const padShape = pad.getState_Pad();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitivePad.delete([pad.getState_PrimitiveId()]);
console.log('padShape:', padShape);
```
### getstate_padnumber
# IPCB\_PrimitivePad.getState\_PadNumber() method
Get the property state: pad number
## Signature
```typescript
function getState_PadNumber(): string;
```
## Returns
string
Pad number
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个编号为 '1' 的贴片焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
// 2. 读取焊盘编号
const padNumber = pad.getState_PadNumber();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitivePad.delete([pad.getState_PrimitiveId()]);
console.log('padNumber:', padNumber);
```
### getstate_padtype
# IPCB\_PrimitivePad.getState\_PadType() method
Get the property state: pad type
## Signature
```typescript
function getState_PadType(): EPCB_PrimitivePadType;
```
## Returns
[EPCB\_PrimitivePadType](../enums/EPCB_PrimitivePadType.md)
Pad type
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个普通焊盘和一个标识点
const x = 3000 + Math.floor(Math.random() * 100000);
const normal = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
const mark = await eda.pcb_PrimitivePad.create(1, '2', x + 500, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 2);
// 2. 分别读取焊盘类型(0=普通 1=测试点 2=标识点)
const normalType = normal.getState_PadType();
const markType = mark.getState_PadType();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitivePad.delete([normal.getState_PrimitiveId(), mark.getState_PrimitiveId()]);
console.log('normalType:', normalType);
console.log('markType:', markType);
```
### getstate_primitiveid
# IPCB\_PrimitivePad.getState\_PrimitiveId() method
Get the property state: primitive ID
## Signature
```typescript
function getState_PrimitiveId(): string;
```
## Returns
string
Primitive ID
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个贴片焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
// 2. 读取图元 ID
const primitiveId = pad.getState_PrimitiveId();
// 3. 用 ID 从画布重新获取焊盘,验证句柄有效
const refetched = await eda.pcb_PrimitivePad.get(primitiveId);
// 4. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitivePad.delete([primitiveId]);
console.log('primitiveId:', primitiveId);
console.log('refetchSamePad:', refetched.getState_PrimitiveId() === primitiveId);
```
### getstate_primitivelock
# IPCB\_PrimitivePad.getState\_PrimitiveLock() method
Get the property state: whether it is locked
## Signature
```typescript
function getState_PrimitiveLock(): boolean;
```
## Returns
boolean
Whether it is locked
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个锁定的焊盘(最后一个参数 primitiveLock=true)
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0, undefined, null, null, true);
// 2. 读取锁定状态
const primitiveLock = pad.getState_PrimitiveLock();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitivePad.delete([pad.getState_PrimitiveId()]);
console.log('primitiveLock:', primitiveLock);
```
### getstate_primitivetype
# IPCB\_PrimitivePad.getState\_PrimitiveType() method
Get the property state: primitive type
## Signature
```typescript
function getState_PrimitiveType(): EPCB_PrimitiveType;
```
## Returns
[EPCB\_PrimitiveType](../enums/EPCB_PrimitiveType.md)
Primitive type
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个贴片焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
// 2. 读取图元类型(焊盘固定返回 'Pad')
const primitiveType = pad.getState_PrimitiveType();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitivePad.delete([pad.getState_PrimitiveId()]);
console.log('primitiveType:', primitiveType);
```
### getstate_rotation
# IPCB\_PrimitivePad.getState\_Rotation() method
Get the property state: rotation angle
## Signature
```typescript
function getState_Rotation(): number;
```
## Returns
number
Rotation angle
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个旋转 90 度的长圆形焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 90, ['OVAL', 80, 40], '', null, 0, 0, 0, false, 0);
// 2. 读取旋转角度
const rotation = pad.getState_Rotation();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitivePad.delete([pad.getState_PrimitiveId()]);
console.log('rotation:', rotation);
```
### getstate_soldermaskandpastemaskexpansion
# IPCB\_PrimitivePad.getState\_SolderMaskAndPasteMaskExpansion() method
Get the property state: solder mask / paste mask expansion
## Signature
```typescript
function getState_SolderMaskAndPasteMaskExpansion(): IPCB_PrimitiveSolderMaskAndPasteMaskExpansion | null;
```
## Returns
[IPCB\_PrimitiveSolderMaskAndPasteMaskExpansion](../interfaces/IPCB_PrimitiveSolderMaskAndPasteMaskExpansion.md) \| null
Solder mask / paste mask expansion
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个自定义扩展的贴片焊盘和一个默认焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const customized = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0, undefined, { topSolderMask: 4, topPasteMask: 2 });
const plain = await eda.pcb_PrimitivePad.create(1, '2', x + 500, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
// 2. 分别读取扩展配置
const customizedExpansion = customized.getState_SolderMaskAndPasteMaskExpansion();
const plainExpansion = plain.getState_SolderMaskAndPasteMaskExpansion();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitivePad.delete([customized.getState_PrimitiveId(), plain.getState_PrimitiveId()]);
console.log('customizedExpansion:', customizedExpansion);
console.log('plainExpansion:', plainExpansion);
```
### getstate_specialpad
# IPCB\_PrimitivePad.getState\_SpecialPad() method
Get the property state: special pad shape
## Signature
```typescript
function getState_SpecialPad(): TPCB_PrimitiveSpecialPadShape | undefined;
```
## Returns
[TPCB\_PrimitiveSpecialPadShape](../types/TPCB_PrimitiveSpecialPadShape.md) \| undefined
Special pad shape
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建普通焊盘与创建时尝试带特殊外形的焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const plain = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
const attempted = await eda.pcb_PrimitivePad.create(1, '2', x + 500, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0, [[1, 1, ['ELLIPSE', 40, 40]]]);
// 2. 分别读取特殊焊盘外形
const plainSpecial = plain.getState_SpecialPad();
const attemptedSpecial = attempted.getState_SpecialPad();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitivePad.delete([plain.getState_PrimitiveId(), attempted.getState_PrimitiveId()]);
console.log('plainSpecial:', plainSpecial);
console.log('attemptedSpecial:', attemptedSpecial);
console.log('normalShapeKept:', JSON.stringify(attempted.getState_Pad()) === JSON.stringify(['ELLIPSE', 60, 60]));
```
### getstate_x
# IPCB\_PrimitivePad.getState\_X() method
Get the property state: X position
## Signature
```typescript
function getState_X(): number;
```
## Returns
number
X position
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个贴片焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
// 2. 读取位置 X
const posX = pad.getState_X();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitivePad.delete([pad.getState_PrimitiveId()]);
console.log('posX:', posX);
```
### getstate_y
# IPCB\_PrimitivePad.getState\_Y() method
Get the property state: Y position
## Signature
```typescript
function getState_Y(): number;
```
## Returns
number
Y position
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个贴片焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(1, '1', x, 3500, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
// 2. 读取位置 Y
const posY = pad.getState_Y();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitivePad.delete([pad.getState_PrimitiveId()]);
console.log('posY:', posY);
```
### isasync
# IPCB\_PrimitivePad.isAsync() method
Query whether the primitive is an async primitive
## Signature
```typescript
function isAsync(): boolean;
```
## Returns
boolean
Whether Is async primitive
## Example
```javascript
// 1. 在顶层放置一个圆形贴片焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
// 2. 读取创建后的模式
const afterCreate = pad.isAsync();
// 3. 切换模式再各读一次
const afterToSync = pad.toSync().isAsync();
const afterToAsync = pad.toAsync().isAsync();
// 4. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitivePad.delete([pad.getState_PrimitiveId()]);
console.log('afterCreate:', afterCreate);
console.log('afterToSync:', afterToSync);
console.log('afterToAsync:', afterToAsync);
```
### reset
# IPCB\_PrimitivePad.reset() method
> 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.
Reset the async primitive to the current canvas state
## Signature
```typescript
function reset(): Promise<IPCB_PrimitivePad>;
```
## Returns
Promise<[IPCB\_PrimitivePad](./IPCB_PrimitivePad.md)<!-- -->>
Pad primitive object
## Example
```javascript
// 1. 在顶层放置一个未旋转的圆形贴片焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
// 2. 异步模式下把旋转改成 45 度(尚未提交)
const a = pad.toAsync();
a.setState_Rotation(45);
// 3. 重置:丢弃未提交的修改,回到画布当前状态
await a.reset();
// 4. 从画布重新读取,确认旋转仍是 0(reset 后要以重新 get() 的结果为准)
const ref = await eda.pcb_PrimitivePad.get(pad.getState_PrimitiveId());
// 5. 清理测试图元
await eda.pcb_PrimitivePad.delete([pad.getState_PrimitiveId()]);
console.log('rotationAfterReset:', ref.getState_Rotation());
```
### setstate_heatwelding
# IPCB\_PrimitivePad.setState\_HeatWelding() method
> 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.
Set the property state: thermal relief optimization parameters
## Signature
```typescript
function setState_HeatWelding(heatWelding: IPCB_PrimitivePadHeatWelding | null): IPCB_PrimitivePad;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
heatWelding
</td><td>
[IPCB\_PrimitivePadHeatWelding](../interfaces/IPCB_PrimitivePadHeatWelding.md) \| null
</td><td>
Thermal relief optimization parameters
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitivePad](./IPCB_PrimitivePad.md)
Pad primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个无热焊参数的贴片焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
const before = pad.getState_HeatWelding();
// 2. 异步模式下配置发散式热焊参数并提交
const a = pad.toAsync();
a.setState_HeatWelding({ connectionMethod: 'Divergent', divergenceSpacing: 10, divergenceLineWidth: 8, divergenceAngle: 45 });
await a.done();
// 3. 从图元对象读取配置结果(保留现场供观察)
const after = pad.getState_HeatWelding();
console.log('heatWelding:', before, '→', after);
```
### setstate_hole
# IPCB\_PrimitivePad.setState\_Hole() method
> 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.
Set the property state: hole
## Signature
```typescript
function setState_Hole(hole: TPCB_PrimitivePadHole): IPCB_PrimitivePad;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
hole
</td><td>
[TPCB\_PrimitivePadHole](../types/TPCB_PrimitivePadHole.md)
</td><td>
Pad drilling
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitivePad](./IPCB_PrimitivePad.md)
Pad primitive object
## Remarks
When setting the hole, some other property states will be set in conjunction:
1. The layer will be forcibly switched to multi-layer
This API cannot set the hole to `null`<!-- -->. If you want to remove the hole property, use the [setState\_Layer](./IPCB_PrimitivePad.md) method to switch the layer to the top or bottom layer
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个无孔的贴片焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 80, 80], '', null, 0, 0, 0, false, 0);
const beforeHole = pad.getState_Hole();
// 2. 异步模式下设置 35mil 圆孔并提交
const a = pad.toAsync();
a.setState_Hole(['ROUND', 35]);
await a.done();
// 3. 从画布重新读取,确认孔已生效且层被联动切到多层(保留现场供观察)
const ref = await eda.pcb_PrimitivePad.get(pad.getState_PrimitiveId());
console.log('hole:', beforeHole, '→', ref.getState_Hole());
console.log('layer:', ref.getState_Layer());
```
### setstate_holeoffsetx
# IPCB\_PrimitivePad.setState\_HoleOffsetX() method
> 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.
Set the property state: hole offset X
## Signature
```typescript
function setState_HoleOffsetX(holeOffsetX: number): IPCB_PrimitivePad;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
holeOffsetX
</td><td>
number
</td><td>
Hole offset X
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitivePad](./IPCB_PrimitivePad.md)
Pad primitive object
## Remarks
If the hole does not exist, the property will not be modified
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个中心孔的通孔焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(12, '1', x, 3000, 0, ['ELLIPSE', 80, 80], '', ['ROUND', 30], 0, 0, 0, false, 0);
const before = pad.getState_HoleOffsetX();
// 2. 异步模式下把孔向右偏移 10mil 并提交
const a = pad.toAsync();
a.setState_HoleOffsetX(10);
await a.done();
// 3. 从画布重新读取,确认偏移已生效(保留现场供观察)
const ref = await eda.pcb_PrimitivePad.get(pad.getState_PrimitiveId());
console.log('holeOffsetX:', before, '→', ref.getState_HoleOffsetX());
```
### setstate_holeoffsety
# IPCB\_PrimitivePad.setState\_HoleOffsetY() method
> 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.
Set the property state: hole offset Y
## Signature
```typescript
function setState_HoleOffsetY(holeOffsetY: number): IPCB_PrimitivePad;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
holeOffsetY
</td><td>
number
</td><td>
Hole offset Y
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitivePad](./IPCB_PrimitivePad.md)
Pad primitive object
## Remarks
If the hole does not exist, the property will not be modified
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个中心孔的通孔焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(12, '1', x, 3000, 0, ['ELLIPSE', 80, 80], '', ['ROUND', 30], 0, 0, 0, false, 0);
const before = pad.getState_HoleOffsetY();
// 2. 异步模式下把孔向上偏移 20mil 并提交
const a = pad.toAsync();
a.setState_HoleOffsetY(20);
await a.done();
// 3. 从画布重新读取,确认偏移已生效(保留现场供观察)
const ref = await eda.pcb_PrimitivePad.get(pad.getState_PrimitiveId());
console.log('holeOffsetY:', before, '→', ref.getState_HoleOffsetY());
```
### setstate_holerotation
# IPCB\_PrimitivePad.setState\_HoleRotation() method
> 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.
Set the property state: Rotation angle of the hole relative to the pad
## Signature
```typescript
function setState_HoleRotation(holeRotation: number): IPCB_PrimitivePad;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
holeRotation
</td><td>
number
</td><td>
Rotation angle of the hole relative to the pad
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitivePad](./IPCB_PrimitivePad.md)
Pad primitive object
## Remarks
If the hole does not exist, the property will not be modified
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个插槽通孔焊盘(槽未旋转)
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(12, '1', x, 3000, 0, ['ELLIPSE', 80, 80], '', ['SLOT', 30, 80], 0, 0, 0, false, 0);
const before = pad.getState_HoleRotation();
// 2. 异步模式下把孔旋转 45 度并提交
const a = pad.toAsync();
a.setState_HoleRotation(45);
await a.done();
// 3. 从画布重新读取,确认旋转已生效(保留现场供观察)
const ref = await eda.pcb_PrimitivePad.get(pad.getState_PrimitiveId());
console.log('holeRotation:', before, '→', ref.getState_HoleRotation());
```
### setstate_layer
# IPCB\_PrimitivePad.setState\_Layer() method
> 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.
Set the property state: Layer
## Signature
```typescript
function setState_Layer(layer: TPCB_LayersOfPad): IPCB_PrimitivePad;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfPad](../types/TPCB_LayersOfPad.md)
</td><td>
Layer
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitivePad](./IPCB_PrimitivePad.md)
Pad primitive object
## Remarks
When setting the layer, some other property states will be set in conjunction:
1. When switching between the top and bottom layers: the solder mask/paste mask expansion properties will switch accordingly, and the data values remain unchanged
2. When switching from multi-layer to single layer: it determines whether to switch to the top or bottom layer, and the solder mask/paste mask expansion properties will only keep the data corresponding to the specified layer. If a special pad exists, it will be converted to a normal pad property, and only the data corresponding to the specified layer will be kept. Hole-related properties will be reset to their default values
3. When switching from single layer to multi-layer: the solder mask/paste mask expansion properties will only keep the solder mask expansion, and the original data will be copied and applied to the top and bottom layers. The pad drilling property will be assigned a specified value: a rounded rectangle whose length and width are 60% of the pad diameter (for rounded or regular polygon pads) or the pad width (for rectangular pads). Data-wise it is a rounded rectangle, but actually it is a circle. If the pad is a polyline complex polygon, the data is calculated through a dedicated algorithm (usually abstract; it is recommended to modify it later)
## Example
```javascript
// 1. 生成本次运行专用的坐标,在顶层创建一个贴片焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
const before = pad.getState_Layer();
// 2. 异步模式下切换到底层并提交
const a = pad.toAsync();
a.setState_Layer(2);
await a.done();
// 3. 从画布重新读取,确认层已切换(保留现场供观察)
const ref = await eda.pcb_PrimitivePad.get(pad.getState_PrimitiveId());
console.log('layer:', before, '→', ref.getState_Layer());
```
### setstate_metallization
# IPCB\_PrimitivePad.setState\_Metallization() method
> 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.
Set the property state: Whether the hole wall is plated
## Signature
```typescript
function setState_Metallization(metallization: boolean): IPCB_PrimitivePad;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
metallization
</td><td>
boolean
</td><td>
Whether the hole wall is plated
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitivePad](./IPCB_PrimitivePad.md)
Pad primitive object
## Remarks
If the hole does not exist, the property will not be modified
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个非金属化的通孔焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(12, '1', x, 3000, 0, ['ELLIPSE', 80, 80], '', ['ROUND', 30], 0, 0, 0, false, 0);
const before = pad.getState_Metallization();
// 2. 异步模式下打开金属化并提交
const a = pad.toAsync();
a.setState_Metallization(true);
await a.done();
// 3. 从画布重新读取,确认金属化已生效(保留现场供观察)
const ref = await eda.pcb_PrimitivePad.get(pad.getState_PrimitiveId());
console.log('metallization:', before, '→', ref.getState_Metallization());
```
### setstate_net
# IPCB\_PrimitivePad.setState\_Net() method
> 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.
Set the property state: net
## Signature
```typescript
function setState_Net(net?: string): IPCB_PrimitivePad;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string
</td><td>
_(Optional)_ Net name
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitivePad](./IPCB_PrimitivePad.md)
Pad primitive object
## Remarks
This API is only available in the PCB editor. Both an empty string and `undefined` are treated as an empty net
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个无网络的贴片焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
const before = pad.getState_Net();
// 2. 异步模式下挂载网络并提交
const a = pad.toAsync();
a.setState_Net('嘉立创示例_NET1');
await a.done();
// 3. 从画布重新读取,确认网络已挂载(保留现场供观察)
const ref = await eda.pcb_PrimitivePad.get(pad.getState_PrimitiveId());
console.log('net:', before, '→', ref.getState_Net());
```
### setstate_pad
# IPCB\_PrimitivePad.setState\_Pad() method
> 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.
Set the property state: pad shape
## Signature
```typescript
function setState_Pad(pad: TPCB_PrimitivePadShape): IPCB_PrimitivePad;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
pad
</td><td>
[TPCB\_PrimitivePadShape](../types/TPCB_PrimitivePadShape.md)
</td><td>
Pad shape
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitivePad](./IPCB_PrimitivePad.md)
Pad primitive object
## Remarks
When setting the pad shape, some other property states will be set in conjunction:
1. The special pad shape property will be cleared
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个圆形贴片焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
const before = pad.getState_Pad();
// 2. 异步模式下改成 80 x 50 矩形并提交
const a = pad.toAsync();
a.setState_Pad(['RECT', 80, 50, 0]);
await a.done();
// 3. 从画布重新读取,确认外形已更新(保留现场供观察)
const ref = await eda.pcb_PrimitivePad.get(pad.getState_PrimitiveId());
console.log('padShape:', before, '→', ref.getState_Pad());
```
### setstate_padnumber
# IPCB\_PrimitivePad.setState\_PadNumber() method
> 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.
Set the property state: pad number
## Signature
```typescript
function setState_PadNumber(padNumber: string): IPCB_PrimitivePad;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
padNumber
</td><td>
string
</td><td>
Pad number
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitivePad](./IPCB_PrimitivePad.md)
Pad primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个编号为 '1' 的贴片焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
const before = pad.getState_PadNumber();
// 2. 异步模式下修改编号并提交
const a = pad.toAsync();
a.setState_PadNumber('嘉立创示例_A1');
await a.done();
// 3. 从画布重新读取,确认编号已更新(保留现场供观察)
const ref = await eda.pcb_PrimitivePad.get(pad.getState_PrimitiveId());
console.log('padNumber:', before, '→', ref.getState_PadNumber());
```
### setstate_primitivelock
# IPCB\_PrimitivePad.setState\_PrimitiveLock() method
> 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.
Set the property state: whether it is locked
## Signature
```typescript
function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitivePad;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveLock
</td><td>
boolean
</td><td>
Whether it is locked
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitivePad](./IPCB_PrimitivePad.md)
Pad primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个未锁定的贴片焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
const before = pad.getState_PrimitiveLock();
// 2. 异步模式下锁定焊盘并提交
const a = pad.toAsync();
a.setState_PrimitiveLock(true);
await a.done();
// 3. 从画布重新读取,确认锁定状态已生效(保留现场供观察)
const ref = await eda.pcb_PrimitivePad.get(pad.getState_PrimitiveId());
console.log('primitiveLock:', before, '→', ref.getState_PrimitiveLock());
```
### setstate_rotation
# IPCB\_PrimitivePad.setState\_Rotation() method
> 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.
Set the property state: rotation angle
## Signature
```typescript
function setState_Rotation(rotation: number): IPCB_PrimitivePad;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
rotation
</td><td>
number
</td><td>
Rotation angle
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitivePad](./IPCB_PrimitivePad.md)
Pad primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个未旋转的长圆形焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['OVAL', 80, 40], '', null, 0, 0, 0, false, 0);
const before = pad.getState_Rotation();
// 2. 异步模式下旋转 90 度并提交
const a = pad.toAsync();
a.setState_Rotation(90);
await a.done();
// 3. 从画布重新读取,确认角度已更新(保留现场供观察)
const ref = await eda.pcb_PrimitivePad.get(pad.getState_PrimitiveId());
console.log('rotation:', before, '→', ref.getState_Rotation());
```
### setstate_soldermaskandpastemaskexpansion
# IPCB\_PrimitivePad.setState\_SolderMaskAndPasteMaskExpansion() method
> 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.
Set the property state: solder mask / paste mask expansion
## Signature
```typescript
function setState_SolderMaskAndPasteMaskExpansion(
solderMaskAndPasteMaskExpansion: IPCB_PrimitiveSolderMaskAndPasteMaskExpansion | null,
): IPCB_PrimitivePad;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
solderMaskAndPasteMaskExpansion
</td><td>
[IPCB\_PrimitiveSolderMaskAndPasteMaskExpansion](../interfaces/IPCB_PrimitiveSolderMaskAndPasteMaskExpansion.md) \| null
</td><td>
Solder mask / paste mask expansion
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitivePad](./IPCB_PrimitivePad.md)
Pad primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个默认扩展(遵循规则)的贴片焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
const before = pad.getState_SolderMaskAndPasteMaskExpansion();
// 2. 异步模式下自定义顶层扩展并提交
const a = pad.toAsync();
a.setState_SolderMaskAndPasteMaskExpansion({ topSolderMask: 4, topPasteMask: 2 });
await a.done();
// 3. 从画布重新读取,确认扩展已生效(未显式设置的项由后端补默认值)
const ref = await eda.pcb_PrimitivePad.get(pad.getState_PrimitiveId());
console.log('expansion:', before, '→', ref.getState_SolderMaskAndPasteMaskExpansion());
```
### setstate_specialpad
# IPCB\_PrimitivePad.setState\_SpecialPad() method
> 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.
Set the property state: special pad shape
## Signature
```typescript
function setState_SpecialPad(specialPad: TPCB_PrimitiveSpecialPadShape): IPCB_PrimitivePad;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
specialPad
</td><td>
[TPCB\_PrimitiveSpecialPadShape](../types/TPCB_PrimitiveSpecialPadShape.md)
</td><td>
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitivePad](./IPCB_PrimitivePad.md)
Pad primitive object
## Remarks
When setting the special pad shape, some other property states will be set in conjunction:
1. The pad shape property will be cleared
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个普通贴片焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
// 2. 调用设置接口(当前版本不产生任何效果)
pad.setState_SpecialPad([[1, 1, ['ELLIPSE', 40, 40]]]);
// 3. 读取确认特殊外形未生效、普通外形保持不变
const special = pad.getState_SpecialPad();
const normalShape = pad.getState_Pad();
console.log('specialPadApplied:', special !== undefined);
console.log('normalShapeKept:', JSON.stringify(normalShape) === JSON.stringify(['ELLIPSE', 60, 60]));
```
### setstate_x
# IPCB\_PrimitivePad.setState\_X() method
> 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.
Set the property state: X position
## Signature
```typescript
function setState_X(x: number): IPCB_PrimitivePad;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
x
</td><td>
number
</td><td>
X position
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitivePad](./IPCB_PrimitivePad.md)
Pad primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个贴片焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
// 2. 异步模式下右移 200mil 并提交
const a = pad.toAsync();
a.setState_X(x + 200);
await a.done();
// 3. 从画布重新读取,确认位置已更新(保留现场供观察)
const ref = await eda.pcb_PrimitivePad.get(pad.getState_PrimitiveId());
console.log('x:', x, '→', ref.getState_X());
```
### setstate_y
# IPCB\_PrimitivePad.setState\_Y() method
> 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.
Set the property state: Y position
## Signature
```typescript
function setState_Y(y: number): IPCB_PrimitivePad;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
y
</td><td>
number
</td><td>
Y position
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitivePad](./IPCB_PrimitivePad.md)
Pad primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,创建一个贴片焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
// 2. 异步模式下移 200mil 并提交
const a = pad.toAsync();
a.setState_Y(3000 + 200);
await a.done();
// 3. 从画布重新读取,确认位置已更新(保留现场供观察)
const ref = await eda.pcb_PrimitivePad.get(pad.getState_PrimitiveId());
console.log('y:', 3000, '→', ref.getState_Y());
```
### toasync
# IPCB\_PrimitivePad.toAsync() method
Convert Primitive to Async primitive
## Signature
```typescript
function toAsync(): IPCB_PrimitivePad;
```
## Returns
[IPCB\_PrimitivePad](./IPCB_PrimitivePad.md)
Pad primitive object
## Example
```javascript
// 1. 在顶层放置一个圆形贴片焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
// 2. 切换为异步图元(返回同一图元的异步形态)
const asyncPad = pad.toAsync();
// 3. 在异步模式下修改位置并提交
asyncPad.setState_X(x + 200);
await asyncPad.done();
// 4. 从画布重新读取,确认修改已落画布(保留现场供观察)
const ref = await eda.pcb_PrimitivePad.get(pad.getState_PrimitiveId());
console.log('isAsync:', asyncPad.isAsync());
console.log('x:', x, '→', ref.getState_X());
```
### tosync
# IPCB\_PrimitivePad.toSync() method
Convert Primitive to Sync primitive
## Signature
```typescript
function toSync(): IPCB_PrimitivePad;
```
## Returns
[IPCB\_PrimitivePad](./IPCB_PrimitivePad.md)
Pad primitive object
## Example
```javascript
// 1. 在顶层放置一个圆形贴片焊盘
const x = 3000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
// 2. 切换为同步图元(返回同一图元的同步形态)
const syncPad = pad.toSync();
// 3. 同步模式下直接修改位置,无需 done() 立即生效
syncPad.setState_X(x + 300);
// 4. 从画布重新读取,确认修改已落画布(保留现场供观察)
const ref = await eda.pcb_PrimitivePad.get(pad.getState_PrimitiveId());
console.log('isAsync:', syncPad.isAsync());
console.log('x:', x, '→', ref.getState_X());
```
references/classes/IPCB_PrimitivePolyline.md
# IPCB\_PrimitivePolyline class
Polyline primitive
## Signature
```typescript
class IPCB_PrimitivePolyline implements IPCB_Primitive
```
**Implements:** [IPCB\_Primitive](../interfaces/IPCB_Primitive.md)
## Remarks
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[convertToFill()](./IPCB_PrimitivePolyline.md)
</td><td>
</td><td>
**_(BETA)_** Convert to: fill primitive
</td></tr>
<tr><td>
[convertToPour()](./IPCB_PrimitivePolyline.md)
</td><td>
</td><td>
**_(BETA)_** Convert to: Copper border primitive
</td></tr>
<tr><td>
[convertToRegion()](./IPCB_PrimitivePolyline.md)
</td><td>
</td><td>
**_(BETA)_** Convert to: Region primitive
</td></tr>
<tr><td>
[done()](./IPCB_PrimitivePolyline.md)
</td><td>
</td><td>
**_(BETA)_** Apply the changes to the primitives to the canvas
</td></tr>
<tr><td>
[getState\_Layer()](./IPCB_PrimitivePolyline.md)
</td><td>
</td><td>
Get the property state: Layer
</td></tr>
<tr><td>
[getState\_LineWidth()](./IPCB_PrimitivePolyline.md)
</td><td>
</td><td>
Get the property state: Line width
</td></tr>
<tr><td>
[getState\_Net()](./IPCB_PrimitivePolyline.md)
</td><td>
</td><td>
Get the property state: net name
</td></tr>
<tr><td>
[getState\_Polygon()](./IPCB_PrimitivePolyline.md)
</td><td>
</td><td>
Get the property state: single polygon
</td></tr>
<tr><td>
[getState\_PrimitiveId()](./IPCB_PrimitivePolyline.md)
</td><td>
</td><td>
Get the property state: primitive ID
</td></tr>
<tr><td>
[getState\_PrimitiveLock()](./IPCB_PrimitivePolyline.md)
</td><td>
</td><td>
Get the property state: whether it is locked
</td></tr>
<tr><td>
[getState\_PrimitiveType()](./IPCB_PrimitivePolyline.md)
</td><td>
</td><td>
Get the property state: primitive type
</td></tr>
<tr><td>
[isAsync()](./IPCB_PrimitivePolyline.md)
</td><td>
</td><td>
Query whether the primitive is an async primitive
</td></tr>
<tr><td>
[reset()](./IPCB_PrimitivePolyline.md)
</td><td>
</td><td>
**_(BETA)_** Reset the async primitive to the current canvas state
</td></tr>
<tr><td>
[setState\_Layer(layer)](./IPCB_PrimitivePolyline.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Layer
</td></tr>
<tr><td>
[setState\_LineWidth(lineWidth)](./IPCB_PrimitivePolyline.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Line width
</td></tr>
<tr><td>
[setState\_Net(net)](./IPCB_PrimitivePolyline.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: net name
</td></tr>
<tr><td>
[setState\_Polygon(polygon)](./IPCB_PrimitivePolyline.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: single polygon
</td></tr>
<tr><td>
[setState\_PrimitiveLock(primitiveLock)](./IPCB_PrimitivePolyline.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: whether it is locked
</td></tr>
<tr><td>
[toAsync()](./IPCB_PrimitivePolyline.md)
</td><td>
</td><td>
Convert Primitive to Async primitive
</td></tr>
<tr><td>
[toSync()](./IPCB_PrimitivePolyline.md)
</td><td>
</td><td>
Convert Primitive to Sync primitive
</td></tr>
</tbody></table>
---
## 方法详情
### converttofill
# IPCB\_PrimitivePolyline.convertToFill() method
> 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.
Convert to: fill primitive
## Signature
```typescript
function convertToFill(): Promise<IPCB_PrimitiveFill>;
```
## Returns
Promise<[IPCB\_PrimitiveFill](./IPCB_PrimitiveFill.md)<!-- -->>
Fill primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一条矩形闭合折线
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
// 3. 转换为填充图元(原折线保留,保留现场供观察)
const fill = await polyline.convertToFill();
console.log('primitiveType:', `${polyline.getState_PrimitiveType()} → ${fill.getState_PrimitiveType()}`);
console.log('primitiveId:', fill.getState_PrimitiveId());
```
### converttopour
# IPCB\_PrimitivePolyline.convertToPour() method
> 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.
Convert to: Copper border primitive
## Signature
```typescript
function convertToPour(): Promise<IPCB_PrimitivePour>;
```
## Returns
Promise<[IPCB\_PrimitivePour](./IPCB_PrimitivePour.md)<!-- -->>
Copper border primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一条矩形闭合折线
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
// 3. 转换为覆铜边框图元(原折线保留,保留现场供观察)
const pour = await polyline.convertToPour();
console.log('primitiveType:', `${polyline.getState_PrimitiveType()} → ${pour.getState_PrimitiveType()}`);
console.log('primitiveId:', pour.getState_PrimitiveId());
```
### converttoregion
# IPCB\_PrimitivePolyline.convertToRegion() method
> 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.
Convert to: Region primitive
## Signature
```typescript
function convertToRegion(): Promise<IPCB_PrimitiveRegion>;
```
## Returns
Promise<[IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)<!-- -->>
Region primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一条矩形闭合折线
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
// 3. 转换为区域图元(原折线保留,保留现场供观察)
const region = await polyline.convertToRegion();
console.log('primitiveType:', `${polyline.getState_PrimitiveType()} → ${region.getState_PrimitiveType()}`);
console.log('primitiveId:', region.getState_PrimitiveId());
```
### done
# IPCB\_PrimitivePolyline.done() method
> 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.
Apply the changes to the primitives to the canvas
## Signature
```typescript
function done(): Promise<IPCB_PrimitivePolyline>;
```
## Returns
Promise<[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)<!-- -->>
Polyline primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一条顶层铜层的折线
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
const before = polyline.getState_Layer();
// 3. 异步模式下把折线挪到底层铜层(此时画布还没变)
const asyncPolyline = polyline.toAsync();
asyncPolyline.setState_Layer(2);
await asyncPolyline.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitivePolyline.get(polyline.getState_PrimitiveId());
console.log('layer:', before, '→', refetched.getState_Layer());
```
### getstate_layer
# IPCB\_PrimitivePolyline.getState\_Layer() method
Get the property state: Layer
## Signature
```typescript
function getState_Layer(): TPCB_LayersOfLine;
```
## Returns
[TPCB\_LayersOfLine](../types/TPCB_LayersOfLine.md)
Layer
## Example
```javascript
// 1. 创建一条顶层铜层(1)的折线
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
// 2. 读取折线所在层
const layer = polyline.getState_Layer();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitivePolyline.delete([polyline.getState_PrimitiveId()]);
console.log('layer:', layer);
```
### getstate_linewidth
# IPCB\_PrimitivePolyline.getState\_LineWidth() method
Get the property state: Line width
## Signature
```typescript
function getState_LineWidth(): number;
```
## Returns
number
Line width
## Example
```javascript
// 1. 创建一条 10mil 线宽的折线
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
// 2. 读取线宽
const lineWidth = polyline.getState_LineWidth();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitivePolyline.delete([polyline.getState_PrimitiveId()]);
console.log('lineWidth:', lineWidth);
```
### getstate_net
# IPCB\_PrimitivePolyline.getState\_Net() method
Get the property state: net name
## Signature
```typescript
function getState_Net(): string;
```
## Returns
string
Net name
## Example
```javascript
// 1. 创建一条无网络的折线
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
// 2. 读取网络名称(无网络时为空字符串)
const net = polyline.getState_Net();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitivePolyline.delete([polyline.getState_PrimitiveId()]);
console.log('net:', JSON.stringify(net));
```
### getstate_polygon
# IPCB\_PrimitivePolyline.getState\_Polygon() method
Get the property state: single polygon
## Signature
```typescript
function getState_Polygon(): IPCB_Polygon;
```
## Returns
[IPCB\_Polygon](./IPCB_Polygon.md)
Single polygon
## Example
```javascript
// 1. 创建一条已知轮廓的折线(500 → 拐弯 → 300)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
// 2. 读取多边形对象,再取它的轮廓源数组
const currentPolygon = polyline.getState_Polygon();
const source = currentPolygon.getSource();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitivePolyline.delete([polyline.getState_PrimitiveId()]);
console.log('polygonSource:', JSON.stringify(source));
```
### getstate_primitiveid
# IPCB\_PrimitivePolyline.getState\_PrimitiveId() method
Get the property state: primitive ID
## Signature
```typescript
function getState_PrimitiveId(): string;
```
## Returns
string
Primitive ID
## Example
```javascript
// 1. 创建一条折线
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
// 2. 读取图元 ID
const primitiveId = polyline.getState_PrimitiveId();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitivePolyline.delete([polyline.getState_PrimitiveId()]);
console.log('primitiveId:', primitiveId);
```
### getstate_primitivelock
# IPCB\_PrimitivePolyline.getState\_PrimitiveLock() method
Get the property state: whether it is locked
## Signature
```typescript
function getState_PrimitiveLock(): boolean;
```
## Returns
boolean
Whether it is locked
## Example
```javascript
// 1. 创建一条未锁定的折线
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
// 2. 读取锁定状态
const primitiveLock = polyline.getState_PrimitiveLock();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitivePolyline.delete([polyline.getState_PrimitiveId()]);
console.log('primitiveLock:', primitiveLock);
```
### getstate_primitivetype
# IPCB\_PrimitivePolyline.getState\_PrimitiveType() method
Get the property state: primitive type
## Signature
```typescript
function getState_PrimitiveType(): EPCB_PrimitiveType;
```
## Returns
[EPCB\_PrimitiveType](../enums/EPCB_PrimitiveType.md)
Primitive type
## Example
```javascript
// 1. 创建一条折线
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
// 2. 读取图元类型
const primitiveType = polyline.getState_PrimitiveType();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitivePolyline.delete([polyline.getState_PrimitiveId()]);
console.log('primitiveType:', primitiveType);
```
### isasync
# IPCB\_PrimitivePolyline.isAsync() method
Query whether the primitive is an async primitive
## Signature
```typescript
function isAsync(): boolean;
```
## Returns
boolean
Whether Is async primitive
## Example
```javascript
// 1. 创建一条折线
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
// 2. 查询异步模式
const isAsync = polyline.isAsync();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitivePolyline.delete([polyline.getState_PrimitiveId()]);
console.log('isAsync:', isAsync);
```
### reset
# IPCB\_PrimitivePolyline.reset() method
> 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.
Reset the async primitive to the current canvas state
## Signature
```typescript
function reset(): Promise<IPCB_PrimitivePolyline>;
```
## Returns
Promise<[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)<!-- -->>
Polyline primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一条顶层铜层的折线
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
const before = polyline.getState_Layer();
// 3. 异步模式下把层改到底层(2),随后反悔
const asyncPolyline = polyline.toAsync();
asyncPolyline.setState_Layer(2);
// 4. reset 丢弃未提交的修改(保留现场供观察)
await asyncPolyline.reset();
// 5. 从画布重新读取,确认层没有变
const refetched = await eda.pcb_PrimitivePolyline.get(polyline.getState_PrimitiveId());
console.log('layer:', before, '→', refetched.getState_Layer());
```
### setstate_layer
# IPCB\_PrimitivePolyline.setState\_Layer() method
> 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.
Set the property state: Layer
## Signature
```typescript
function setState_Layer(layer: TPCB_LayersOfLine): IPCB_PrimitivePolyline;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfLine](../types/TPCB_LayersOfLine.md)
</td><td>
Layer
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)
Polyline primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一条顶层铜层(1)的折线
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
const before = polyline.getState_Layer();
// 3. 异步模式把折线挪到底层铜层(2)
const asyncPolyline = polyline.toAsync();
asyncPolyline.setState_Layer(2);
await asyncPolyline.done();
// 4. 从画布重新读取,确认层已切换(保留现场供观察)
const refetched = await eda.pcb_PrimitivePolyline.get(polyline.getState_PrimitiveId());
console.log('layer:', before, '→', refetched.getState_Layer());
```
### setstate_linewidth
# IPCB\_PrimitivePolyline.setState\_LineWidth() method
> 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.
Set the property state: Line width
## Signature
```typescript
function setState_LineWidth(lineWidth: number): IPCB_PrimitivePolyline;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
lineWidth
</td><td>
number
</td><td>
Line width
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)
Polyline primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一条 10mil 线宽的折线
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
const before = polyline.getState_LineWidth();
// 3. 切换异步模式,线宽加粗到 20mil
const asyncPolyline = polyline.toAsync();
asyncPolyline.setState_LineWidth(20);
await asyncPolyline.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitivePolyline.get(polyline.getState_PrimitiveId());
console.log('lineWidth:', before, '→', refetched.getState_LineWidth());
```
### setstate_net
# IPCB\_PrimitivePolyline.setState\_Net() method
> 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.
Set the property state: net name
## Signature
```typescript
function setState_Net(net: string): IPCB_PrimitivePolyline;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string
</td><td>
Net name
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)
Polyline primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一条无网络的折线
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
const before = polyline.getState_Net();
// 3. 切换异步模式并指定网络('' → '嘉立创示例_NET')
const asyncPolyline = polyline.toAsync();
asyncPolyline.setState_Net('嘉立创示例_NET');
await asyncPolyline.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitivePolyline.get(polyline.getState_PrimitiveId());
console.log('net:', JSON.stringify(before), '→', JSON.stringify(refetched.getState_Net()));
```
### setstate_polygon
# IPCB\_PrimitivePolyline.setState\_Polygon() method
> 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.
Set the property state: single polygon
## Signature
```typescript
function setState_Polygon(polygon: IPCB_Polygon): IPCB_PrimitivePolyline;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
polygon
</td><td>
[IPCB\_Polygon](./IPCB_Polygon.md)
</td><td>
Single polygon
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)
Polyline primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一条 500 → 拐弯 → 300 的折线
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
const before = JSON.stringify(polyline.getState_Polygon().getSource());
// 3. 构造新轮廓(拉长到 800 → 拐弯 → 600),异步模式提交
const newPolygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 800, y, x + 800, y + 600]);
const asyncPolyline = polyline.toAsync();
asyncPolyline.setState_Polygon(newPolygon);
await asyncPolyline.done();
// 4. 从画布重新读取,确认轮廓已替换(保留现场供观察)
const refetched = await eda.pcb_PrimitivePolyline.get(polyline.getState_PrimitiveId());
const after = JSON.stringify(refetched.getState_Polygon().getSource());
console.log('polygonSource:', before, '→', after);
```
### setstate_primitivelock
# IPCB\_PrimitivePolyline.setState\_PrimitiveLock() method
> 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.
Set the property state: whether it is locked
## Signature
```typescript
function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitivePolyline;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveLock
</td><td>
boolean
</td><td>
Whether it is locked
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)
Polyline primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一条未锁定的折线
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
const before = polyline.getState_PrimitiveLock();
// 3. 切换异步模式并锁定折线
const asyncPolyline = polyline.toAsync();
asyncPolyline.setState_PrimitiveLock(true);
await asyncPolyline.done();
// 4. 从画布重新读取,确认已锁定(保留现场供观察)
const refetched = await eda.pcb_PrimitivePolyline.get(polyline.getState_PrimitiveId());
console.log('primitiveLock:', before, '→', refetched.getState_PrimitiveLock());
```
### toasync
# IPCB\_PrimitivePolyline.toAsync() method
Convert Primitive to Async primitive
## Signature
```typescript
function toAsync(): IPCB_PrimitivePolyline;
```
## Returns
[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)
Polyline primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一条无网络的折线
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
// 3. 切换异步模式后批量修改:划归网络 + 挪到底层
const asyncPolyline = polyline.toAsync();
asyncPolyline.setState_Net('嘉立创示例_NET');
asyncPolyline.setState_Layer(2);
await asyncPolyline.done();
// 4. 从画布重新读取,确认批量修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitivePolyline.get(polyline.getState_PrimitiveId());
console.log('net:', JSON.stringify(refetched.getState_Net()));
console.log('layer:', refetched.getState_Layer());
```
### tosync
# IPCB\_PrimitivePolyline.toSync() method
Convert Primitive to Sync primitive
## Signature
```typescript
function toSync(): IPCB_PrimitivePolyline;
```
## Returns
[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)
Polyline primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一条折线
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
const before = polyline.isAsync();
// 3. 转换为同步图元(保留现场供观察)
const syncPolyline = polyline.toSync();
const after = syncPolyline.isAsync();
// 4. 同步图元直接读取属性,无需提交
console.log('isAsync:', before, '→', after);
console.log('primitiveType:', syncPolyline.getState_PrimitiveType());
console.log('layer:', syncPolyline.getState_Layer());
```
references/classes/IPCB_PrimitiveString.md
# IPCB\_PrimitiveString class
Text primitive
## Signature
```typescript
class IPCB_PrimitiveString implements IPCB_Primitive
```
**Implements:** [IPCB\_Primitive](../interfaces/IPCB_Primitive.md)
## Constructors
<table><thead><tr><th>
Constructor
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[(constructor)(layer, x, y, text, fontFamily, fontSize, lineWidth, alignMode, rotation, reverse, expansion, mirror, primitiveLock, primitiveId)](./IPCB_PrimitiveString.md)
</td><td>
</td><td>
Constructs a new instance of the `IPCB_PrimitiveString` class
</td></tr>
</tbody></table>
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[done()](./IPCB_PrimitiveString.md)
</td><td>
</td><td>
**_(BETA)_** Apply the changes to the primitives to the canvas
</td></tr>
<tr><td>
[getState\_AlignMode()](./IPCB_PrimitiveString.md)
</td><td>
</td><td>
Get the property state: alignment mode
</td></tr>
<tr><td>
[getState\_Expansion()](./IPCB_PrimitiveString.md)
</td><td>
</td><td>
Get the property state: inverted expansion
</td></tr>
<tr><td>
[getState\_FontFamily()](./IPCB_PrimitiveString.md)
</td><td>
</td><td>
Get the property state: font
</td></tr>
<tr><td>
[getState\_FontSize()](./IPCB_PrimitiveString.md)
</td><td>
</td><td>
Get the property state: font size
</td></tr>
<tr><td>
[getState\_Layer()](./IPCB_PrimitiveString.md)
</td><td>
</td><td>
Get the property state: Layer
</td></tr>
<tr><td>
[getState\_LineWidth()](./IPCB_PrimitiveString.md)
</td><td>
</td><td>
Get the property state: Line width
</td></tr>
<tr><td>
[getState\_Mirror()](./IPCB_PrimitiveString.md)
</td><td>
</td><td>
Get the property state: whether it is mirrored
</td></tr>
<tr><td>
[getState\_PrimitiveId()](./IPCB_PrimitiveString.md)
</td><td>
</td><td>
Get the property state: primitive ID
</td></tr>
<tr><td>
[getState\_PrimitiveLock()](./IPCB_PrimitiveString.md)
</td><td>
</td><td>
Get the property state: whether it is locked
</td></tr>
<tr><td>
[getState\_PrimitiveType()](./IPCB_PrimitiveString.md)
</td><td>
</td><td>
Get the property state: primitive type
</td></tr>
<tr><td>
[getState\_Reverse()](./IPCB_PrimitiveString.md)
</td><td>
</td><td>
Get the property state: whether it is inverted
</td></tr>
<tr><td>
[getState\_Rotation()](./IPCB_PrimitiveString.md)
</td><td>
</td><td>
Get the property state: rotation angle
</td></tr>
<tr><td>
[getState\_Text()](./IPCB_PrimitiveString.md)
</td><td>
</td><td>
Get the property state: text content
</td></tr>
<tr><td>
[getState\_X()](./IPCB_PrimitiveString.md)
</td><td>
</td><td>
Get the property state: X coordinate
</td></tr>
<tr><td>
[getState\_Y()](./IPCB_PrimitiveString.md)
</td><td>
</td><td>
Get the property state: Y coordinate
</td></tr>
<tr><td>
[isAsync()](./IPCB_PrimitiveString.md)
</td><td>
</td><td>
Query whether the primitive is an async primitive
</td></tr>
<tr><td>
[reset()](./IPCB_PrimitiveString.md)
</td><td>
</td><td>
**_(BETA)_** Reset the async primitive to the current canvas state
</td></tr>
<tr><td>
[setState\_AlignMode(alignMode)](./IPCB_PrimitiveString.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: alignment mode
</td></tr>
<tr><td>
[setState\_Expansion(expansion)](./IPCB_PrimitiveString.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: inverted expansion
</td></tr>
<tr><td>
[setState\_FontFamily(fontFamily)](./IPCB_PrimitiveString.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: font
</td></tr>
<tr><td>
[setState\_FontSize(fontSize)](./IPCB_PrimitiveString.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: font size
</td></tr>
<tr><td>
[setState\_Layer(layer)](./IPCB_PrimitiveString.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Layer
</td></tr>
<tr><td>
[setState\_LineWidth(lineWidth)](./IPCB_PrimitiveString.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Line width
</td></tr>
<tr><td>
[setState\_Mirror(mirror)](./IPCB_PrimitiveString.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: whether it is mirrored
</td></tr>
<tr><td>
[setState\_PrimitiveLock(primitiveLock)](./IPCB_PrimitiveString.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: whether it is locked
</td></tr>
<tr><td>
[setState\_Reverse(reverse)](./IPCB_PrimitiveString.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: whether it is inverted
</td></tr>
<tr><td>
[setState\_Rotation(rotation)](./IPCB_PrimitiveString.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: rotation angle
</td></tr>
<tr><td>
[setState\_Text(text)](./IPCB_PrimitiveString.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: text content
</td></tr>
<tr><td>
[setState\_X(x)](./IPCB_PrimitiveString.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: X coordinate
</td></tr>
<tr><td>
[setState\_Y(y)](./IPCB_PrimitiveString.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Y coordinate
</td></tr>
<tr><td>
[toAsync()](./IPCB_PrimitiveString.md)
</td><td>
</td><td>
Convert Primitive to Async primitive
</td></tr>
<tr><td>
[toSync()](./IPCB_PrimitiveString.md)
</td><td>
</td><td>
Convert Primitive to Sync primitive
</td></tr>
</tbody></table>
---
## 构造函数详情
### _constructor_
# IPCB\_PrimitiveString.(constructor)
Constructs a new instance of the `IPCB_PrimitiveString` class
## Signature
```typescript
function constructor(
layer: TPCB_LayersOfImage,
x: number,
y: number,
text: string,
fontFamily?: string,
fontSize?: number,
lineWidth?: number,
alignMode?: EPCB_PrimitiveStringAlignMode,
rotation?: number,
reverse?: boolean,
expansion?: number,
mirror?: boolean,
primitiveLock?: boolean,
primitiveId?: string,
);
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfImage](../types/TPCB_LayersOfImage.md)
</td><td>
</td></tr>
<tr><td>
x
</td><td>
number
</td><td>
</td></tr>
<tr><td>
y
</td><td>
number
</td><td>
</td></tr>
<tr><td>
text
</td><td>
string
</td><td>
</td></tr>
<tr><td>
fontFamily
</td><td>
string
</td><td>
_(Optional)_
</td></tr>
<tr><td>
fontSize
</td><td>
number
</td><td>
_(Optional)_
</td></tr>
<tr><td>
lineWidth
</td><td>
number
</td><td>
_(Optional)_
</td></tr>
<tr><td>
alignMode
</td><td>
[EPCB\_PrimitiveStringAlignMode](../enums/EPCB_PrimitiveStringAlignMode.md)
</td><td>
_(Optional)_
</td></tr>
<tr><td>
rotation
</td><td>
number
</td><td>
_(Optional)_
</td></tr>
<tr><td>
reverse
</td><td>
boolean
</td><td>
_(Optional)_
</td></tr>
<tr><td>
expansion
</td><td>
number
</td><td>
_(Optional)_
</td></tr>
<tr><td>
mirror
</td><td>
boolean
</td><td>
_(Optional)_
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_
</td></tr>
<tr><td>
primitiveId
</td><td>
string
</td><td>
_(Optional)_
</td></tr>
</tbody></table>
---
## 方法详情
### done
# IPCB\_PrimitiveString.done() method
> 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.
Apply the changes to the primitives to the canvas
## Signature
```typescript
function done(): Promise<IPCB_PrimitiveString>;
```
## Returns
Promise<[IPCB\_PrimitiveString](./IPCB_PrimitiveString.md)<!-- -->>
Text primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 在顶层丝印(3)放置一行文本
const str = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_TEXT', 'default', 45, 6, 3, 0, false, 0, false, false);
const before = str.getState_Text();
// 3. 异步模式下批量改两个字段(此时画布还没变)
const asyncStr = str.toAsync();
asyncStr.setState_Text('嘉立创示例_DONE');
asyncStr.setState_Rotation(90);
await asyncStr.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveString.get(str.getState_PrimitiveId());
console.log('text:', before, '→', refetched.getState_Text());
console.log('rotation:', refetched.getState_Rotation());
```
### getstate_alignmode
# IPCB\_PrimitiveString.getState\_AlignMode() method
Get the property state: alignment mode
## Signature
```typescript
function getState_AlignMode(): EPCB_PrimitiveStringAlignMode;
```
## Returns
[EPCB\_PrimitiveStringAlignMode](../enums/EPCB_PrimitiveStringAlignMode.md)
Alignment mode
## Example
```javascript
// 1. 在顶层丝印(3)放置一行左下(3)对齐的文本
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const str = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_TEXT', 'default', 45, 6, 3, 0, false, 0, false, false);
// 2. 读取对齐模式(1-9:3=左下、5=居中)
const alignMode = str.getState_AlignMode();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveString.delete([str.getState_PrimitiveId()]);
console.log('alignMode:', alignMode);
```
### getstate_expansion
# IPCB\_PrimitiveString.getState\_Expansion() method
Get the property state: inverted expansion
## Signature
```typescript
function getState_Expansion(): number;
```
## Returns
number
Inverted expansion
## Example
```javascript
// 1. 在顶层丝印(3)放置一行文本(反相扩展默认 0)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const str = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_TEXT', 'default', 45, 6, 3, 0, false, 0, false, false);
// 2. 读取反相扩展值
const expansion = str.getState_Expansion();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveString.delete([str.getState_PrimitiveId()]);
console.log('expansion:', expansion);
```
### getstate_fontfamily
# IPCB\_PrimitiveString.getState\_FontFamily() method
Get the property state: font
## Signature
```typescript
function getState_FontFamily(): string;
```
## Returns
string
Font
## Example
```javascript
// 1. 在顶层丝印(3)放置一行默认字体的文本
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const str = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_TEXT', 'default', 45, 6, 3, 0, false, 0, false, false);
// 2. 读取字体名
const fontFamily = str.getState_FontFamily();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveString.delete([str.getState_PrimitiveId()]);
console.log('fontFamily:', fontFamily);
```
### getstate_fontsize
# IPCB\_PrimitiveString.getState\_FontSize() method
Get the property state: font size
## Signature
```typescript
function getState_FontSize(): number;
```
## Returns
number
Font size
## Example
```javascript
// 1. 在顶层丝印(3)放置一行 45mil 字号的文本
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const str = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_TEXT', 'default', 45, 6, 3, 0, false, 0, false, false);
// 2. 读取字号
const fontSize = str.getState_FontSize();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveString.delete([str.getState_PrimitiveId()]);
console.log('fontSize:', fontSize);
```
### getstate_layer
# IPCB\_PrimitiveString.getState\_Layer() method
Get the property state: Layer
## Signature
```typescript
function getState_Layer(): TPCB_LayersOfImage;
```
## Returns
[TPCB\_LayersOfImage](../types/TPCB_LayersOfImage.md)
Layer
## Example
```javascript
// 1. 在顶层丝印(3)放置一行文本
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const str = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_TEXT', 'default', 45, 6, 3, 0, false, 0, false, false);
// 2. 读取所在层
const layer = str.getState_Layer();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveString.delete([str.getState_PrimitiveId()]);
console.log('layer:', layer);
```
### getstate_linewidth
# IPCB\_PrimitiveString.getState\_LineWidth() method
Get the property state: Line width
## Signature
```typescript
function getState_LineWidth(): number;
```
## Returns
number
Line width
## Example
```javascript
// 1. 在顶层丝印(3)放置一行笔画 6mil 的文本
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const str = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_TEXT', 'default', 45, 6, 3, 0, false, 0, false, false);
// 2. 读取笔画线宽
const lineWidth = str.getState_LineWidth();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveString.delete([str.getState_PrimitiveId()]);
console.log('lineWidth:', lineWidth);
```
### getstate_mirror
# IPCB\_PrimitiveString.getState\_Mirror() method
Get the property state: whether it is mirrored
## Signature
```typescript
function getState_Mirror(): boolean;
```
## Returns
boolean
Whether it is mirrored
## Example
```javascript
// 1. 在顶层丝印(3)放置一行不镜像的文本
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const str = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_TEXT', 'default', 45, 6, 3, 0, false, 0, false, false);
// 2. 读取镜像状态
const mirror = str.getState_Mirror();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveString.delete([str.getState_PrimitiveId()]);
console.log('mirror:', mirror);
```
### getstate_primitiveid
# IPCB\_PrimitiveString.getState\_PrimitiveId() method
Get the property state: primitive ID
## Signature
```typescript
function getState_PrimitiveId(): string;
```
## Returns
string
Primitive ID
## Example
```javascript
// 1. 在顶层丝印(3)放置一行文本
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const str = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_TEXT', 'default', 45, 6, 3, 0, false, 0, false, false);
// 2. 读取图元 ID
const primitiveId = str.getState_PrimitiveId();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveString.delete([primitiveId]);
console.log('primitiveId:', primitiveId);
```
### getstate_primitivelock
# IPCB\_PrimitiveString.getState\_PrimitiveLock() method
Get the property state: whether it is locked
## Signature
```typescript
function getState_PrimitiveLock(): boolean;
```
## Returns
boolean
Whether it is locked
## Example
```javascript
// 1. 在顶层丝印(3)放置一行未锁定的文本
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const str = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_TEXT', 'default', 45, 6, 3, 0, false, 0, false, false);
// 2. 读取锁定状态
const primitiveLock = str.getState_PrimitiveLock();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveString.delete([str.getState_PrimitiveId()]);
console.log('primitiveLock:', primitiveLock);
```
### getstate_primitivetype
# IPCB\_PrimitiveString.getState\_PrimitiveType() method
Get the property state: primitive type
## Signature
```typescript
function getState_PrimitiveType(): EPCB_PrimitiveType;
```
## Returns
[EPCB\_PrimitiveType](../enums/EPCB_PrimitiveType.md)
Primitive type
## Example
```javascript
// 1. 在顶层丝印(3)放置一行文本
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const str = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_TEXT', 'default', 45, 6, 3, 0, false, 0, false, false);
// 2. 读取图元类型
const primitiveType = str.getState_PrimitiveType();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveString.delete([str.getState_PrimitiveId()]);
console.log('primitiveType:', primitiveType);
```
### getstate_reverse
# IPCB\_PrimitiveString.getState\_Reverse() method
Get the property state: whether it is inverted
## Signature
```typescript
function getState_Reverse(): boolean;
```
## Returns
boolean
Whether it is inverted
## Example
```javascript
// 1. 在顶层丝印(3)放置一行不反相的文本
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const str = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_TEXT', 'default', 45, 6, 3, 0, false, 0, false, false);
// 2. 读取反相状态
const reverse = str.getState_Reverse();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveString.delete([str.getState_PrimitiveId()]);
console.log('reverse:', reverse);
```
### getstate_rotation
# IPCB\_PrimitiveString.getState\_Rotation() method
Get the property state: rotation angle
## Signature
```typescript
function getState_Rotation(): number;
```
## Returns
number
Rotation angle
## Example
```javascript
// 1. 在顶层丝印(3)放置一行不旋转(0°)的文本
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const str = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_TEXT', 'default', 45, 6, 3, 0, false, 0, false, false);
// 2. 读取旋转角度
const rotation = str.getState_Rotation();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveString.delete([str.getState_PrimitiveId()]);
console.log('rotation:', rotation);
```
### getstate_text
# IPCB\_PrimitiveString.getState\_Text() method
Get the property state: text content
## Signature
```typescript
function getState_Text(): string;
```
## Returns
string
Text content
## Example
```javascript
// 1. 在顶层丝印(3)放置一行文本
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const str = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_TEXT', 'default', 45, 6, 3, 0, false, 0, false, false);
// 2. 读取文本内容
const text = str.getState_Text();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveString.delete([str.getState_PrimitiveId()]);
console.log('text:', text);
```
### getstate_x
# IPCB\_PrimitiveString.getState\_X() method
Get the property state: X coordinate
## Signature
```typescript
function getState_X(): number;
```
## Returns
number
X coordinate
## Example
```javascript
// 1. 在顶层丝印(3)放置一行文本
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const str = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_TEXT', 'default', 45, 6, 3, 0, false, 0, false, false);
// 2. 读取锚点 X 坐标
const anchorX = str.getState_X();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveString.delete([str.getState_PrimitiveId()]);
console.log('x:', anchorX);
```
### getstate_y
# IPCB\_PrimitiveString.getState\_Y() method
Get the property state: Y coordinate
## Signature
```typescript
function getState_Y(): number;
```
## Returns
number
Y coordinate
## Example
```javascript
// 1. 在顶层丝印(3)放置一行文本
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const str = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_TEXT', 'default', 45, 6, 3, 0, false, 0, false, false);
// 2. 读取锚点 Y 坐标
const anchorY = str.getState_Y();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveString.delete([str.getState_PrimitiveId()]);
console.log('y:', anchorY);
```
### isasync
# IPCB\_PrimitiveString.isAsync() method
Query whether the primitive is an async primitive
## Signature
```typescript
function isAsync(): boolean;
```
## Returns
boolean
Whether Is async primitive
## Example
```javascript
// 1. 在顶层丝印(3)放置一行文本
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const str = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_TEXT', 'default', 45, 6, 3, 0, false, 0, false, false);
// 2. 查询异步模式
const isAsync = str.isAsync();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveString.delete([str.getState_PrimitiveId()]);
console.log('isAsync:', isAsync);
```
### reset
# IPCB\_PrimitiveString.reset() method
> 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.
Reset the async primitive to the current canvas state
## Signature
```typescript
function reset(): Promise<IPCB_PrimitiveString>;
```
## Returns
Promise<[IPCB\_PrimitiveString](./IPCB_PrimitiveString.md)<!-- -->>
This primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 在顶层丝印(3)放置一行不旋转的文本
const str = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_TEXT', 'default', 45, 6, 3, 0, false, 0, false, false);
const before = str.getState_Rotation();
// 3. 异步模式下把文本旋转 90°,随后反悔(不调 done())
const asyncStr = str.toAsync();
asyncStr.setState_Rotation(90);
// 4. reset 丢弃未提交的修改(保留现场供观察)
await asyncStr.reset();
// 5. 从画布重新读取,确认旋转角度没有变
const refetched = await eda.pcb_PrimitiveString.get(str.getState_PrimitiveId());
console.log('rotation:', before, '→', refetched.getState_Rotation());
```
### setstate_alignmode
# IPCB\_PrimitiveString.setState\_AlignMode() method
> 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.
Set the property state: alignment mode
## Signature
```typescript
function setState_AlignMode(alignMode: EPCB_PrimitiveStringAlignMode): IPCB_PrimitiveString;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
alignMode
</td><td>
[EPCB\_PrimitiveStringAlignMode](../enums/EPCB_PrimitiveStringAlignMode.md)
</td><td>
Alignment mode
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveString](./IPCB_PrimitiveString.md)
Text primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 在顶层丝印(3)放置一行左下(3)对齐的文本
const str = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_TEXT', 'default', 45, 6, 3, 0, false, 0, false, false);
const before = str.getState_AlignMode();
// 3. 异步模式把对齐模式改为居中(5)
const asyncStr = str.toAsync();
asyncStr.setState_AlignMode(5);
await asyncStr.done();
// 4. 从画布重新读取,确认修改生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveString.get(str.getState_PrimitiveId());
console.log('alignMode:', before, '→', refetched.getState_AlignMode());
```
### setstate_expansion
# IPCB\_PrimitiveString.setState\_Expansion() method
> 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.
Set the property state: inverted expansion
## Signature
```typescript
function setState_Expansion(expansion: number): IPCB_PrimitiveString;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
expansion
</td><td>
number
</td><td>
Inverted expansion
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveString](./IPCB_PrimitiveString.md)
Text primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 在顶层丝印(3)放置一行反相扩展为 0 的文本
const str = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_TEXT', 'default', 45, 6, 3, 0, false, 0, false, false);
const before = str.getState_Expansion();
// 3. 异步模式把反相扩展加大到 10
const asyncStr = str.toAsync();
asyncStr.setState_Expansion(10);
await asyncStr.done();
// 4. 从画布重新读取,确认修改生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveString.get(str.getState_PrimitiveId());
console.log('expansion:', before, '→', refetched.getState_Expansion());
```
### setstate_fontfamily
# IPCB\_PrimitiveString.setState\_FontFamily() method
> 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.
Set the property state: font
## Signature
```typescript
function setState_FontFamily(fontFamily: string): IPCB_PrimitiveString;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fontFamily
</td><td>
string
</td><td>
Font
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveString](./IPCB_PrimitiveString.md)
Text primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 在顶层丝印(3)放置一行默认字体的文本
const str = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_TEXT', 'default', 45, 6, 3, 0, false, 0, false, false);
const before = str.getState_FontFamily();
// 3. 异步模式把字体换成 Arial
const asyncStr = str.toAsync();
asyncStr.setState_FontFamily('Arial');
await asyncStr.done();
// 4. 从画布重新读取,确认修改生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveString.get(str.getState_PrimitiveId());
console.log('fontFamily:', before, '→', refetched.getState_FontFamily());
```
### setstate_fontsize
# IPCB\_PrimitiveString.setState\_FontSize() method
> 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.
Set the property state: font size
## Signature
```typescript
function setState_FontSize(fontSize: number): IPCB_PrimitiveString;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fontSize
</td><td>
number
</td><td>
Font size
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveString](./IPCB_PrimitiveString.md)
Text primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 在顶层丝印(3)放置一行 45mil 字号的文本
const str = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_TEXT', 'default', 45, 6, 3, 0, false, 0, false, false);
const before = str.getState_FontSize();
// 3. 异步模式把字号加大到 60
const asyncStr = str.toAsync();
asyncStr.setState_FontSize(60);
await asyncStr.done();
// 4. 从画布重新读取,确认修改生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveString.get(str.getState_PrimitiveId());
console.log('fontSize:', before, '→', refetched.getState_FontSize());
```
### setstate_layer
# IPCB\_PrimitiveString.setState\_Layer() method
> 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.
Set the property state: Layer
## Signature
```typescript
function setState_Layer(layer: TPCB_LayersOfImage): IPCB_PrimitiveString;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfImage](../types/TPCB_LayersOfImage.md)
</td><td>
Layer
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveString](./IPCB_PrimitiveString.md)
Text primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 在顶层丝印(3)放置一行文本
const str = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_TEXT', 'default', 45, 6, 3, 0, false, 0, false, false);
const before = str.getState_Layer();
// 3. 异步模式把文本挪到底层丝印(4)
const asyncStr = str.toAsync();
asyncStr.setState_Layer(4);
await asyncStr.done();
// 4. 从画布重新读取,确认层已切换(保留现场供观察)
const refetched = await eda.pcb_PrimitiveString.get(str.getState_PrimitiveId());
console.log('layer:', before, '→', refetched.getState_Layer());
```
### setstate_linewidth
# IPCB\_PrimitiveString.setState\_LineWidth() method
> 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.
Set the property state: Line width
## Signature
```typescript
function setState_LineWidth(lineWidth: number): IPCB_PrimitiveString;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
lineWidth
</td><td>
number
</td><td>
Line width
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveString](./IPCB_PrimitiveString.md)
Text primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 在顶层丝印(3)放置一行笔画 6mil 的文本
const str = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_TEXT', 'default', 45, 6, 3, 0, false, 0, false, false);
const before = str.getState_LineWidth();
// 3. 异步模式把笔画加粗到 10
const asyncStr = str.toAsync();
asyncStr.setState_LineWidth(10);
await asyncStr.done();
// 4. 从画布重新读取,确认修改生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveString.get(str.getState_PrimitiveId());
console.log('lineWidth:', before, '→', refetched.getState_LineWidth());
```
### setstate_mirror
# IPCB\_PrimitiveString.setState\_Mirror() method
> 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.
Set the property state: whether it is mirrored
## Signature
```typescript
function setState_Mirror(mirror: boolean): IPCB_PrimitiveString;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
mirror
</td><td>
boolean
</td><td>
Whether it is mirrored
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveString](./IPCB_PrimitiveString.md)
Text primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 在顶层丝印(3)放置一行不镜像的文本
const str = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_TEXT', 'default', 45, 6, 3, 0, false, 0, false, false);
const before = str.getState_Mirror();
// 3. 异步模式开启镜像
const asyncStr = str.toAsync();
asyncStr.setState_Mirror(true);
await asyncStr.done();
// 4. 从画布重新读取,确认修改生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveString.get(str.getState_PrimitiveId());
console.log('mirror:', before, '→', refetched.getState_Mirror());
```
### setstate_primitivelock
# IPCB\_PrimitiveString.setState\_PrimitiveLock() method
> 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.
Set the property state: whether it is locked
## Signature
```typescript
function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitiveString;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveLock
</td><td>
boolean
</td><td>
Whether it is locked
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveString](./IPCB_PrimitiveString.md)
Text primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 在顶层丝印(3)放置一行未锁定的文本
const str = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_TEXT', 'default', 45, 6, 3, 0, false, 0, false, false);
const before = str.getState_PrimitiveLock();
// 3. 异步模式锁定文本
const asyncStr = str.toAsync();
asyncStr.setState_PrimitiveLock(true);
await asyncStr.done();
// 4. 从画布重新读取,确认修改生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveString.get(str.getState_PrimitiveId());
console.log('primitiveLock:', before, '→', refetched.getState_PrimitiveLock());
```
### setstate_reverse
# IPCB\_PrimitiveString.setState\_Reverse() method
> 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.
Set the property state: whether it is inverted
## Signature
```typescript
function setState_Reverse(reverse: boolean): IPCB_PrimitiveString;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
reverse
</td><td>
boolean
</td><td>
Whether it is inverted
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveString](./IPCB_PrimitiveString.md)
Text primitive object
## Remarks
The default font does not support inversion
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 在顶层丝印(3)放置一行默认字体的文本(默认字体不支持反相)
const str = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_TEXT', 'default', 45, 6, 3, 0, false, 0, false, false);
const before = str.getState_Reverse();
// 3. 异步模式先换 Arial 字体再开启反相,一次 done() 同时提交两个修改
const asyncStr = str.toAsync();
asyncStr.setState_FontFamily('Arial');
asyncStr.setState_Reverse(true);
await asyncStr.done();
// 4. 从画布重新读取,确认修改生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveString.get(str.getState_PrimitiveId());
console.log('reverse:', before, '→', refetched.getState_Reverse());
console.log('fontFamily:', refetched.getState_FontFamily());
```
### setstate_rotation
# IPCB\_PrimitiveString.setState\_Rotation() method
> 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.
Set the property state: rotation angle
## Signature
```typescript
function setState_Rotation(rotation: number): IPCB_PrimitiveString;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
rotation
</td><td>
number
</td><td>
Rotation angle
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveString](./IPCB_PrimitiveString.md)
Text primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 在顶层丝印(3)放置一行不旋转(0°)的文本
const str = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_TEXT', 'default', 45, 6, 3, 0, false, 0, false, false);
const before = str.getState_Rotation();
// 3. 异步模式把文本旋转 90°(竖排)
const asyncStr = str.toAsync();
asyncStr.setState_Rotation(90);
await asyncStr.done();
// 4. 从画布重新读取,确认修改生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveString.get(str.getState_PrimitiveId());
console.log('rotation:', before, '→', refetched.getState_Rotation());
```
### setstate_text
# IPCB\_PrimitiveString.setState\_Text() method
> 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.
Set the property state: text content
## Signature
```typescript
function setState_Text(text: string): IPCB_PrimitiveString;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
text
</td><td>
string
</td><td>
Text content
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveString](./IPCB_PrimitiveString.md)
Text primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 在顶层丝印(3)放置一行文本
const str = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_V1.0', 'default', 45, 6, 3, 0, false, 0, false, false);
const before = str.getState_Text();
// 3. 异步模式把内容改为新版本号
const asyncStr = str.toAsync();
asyncStr.setState_Text('嘉立创示例_V2.0');
await asyncStr.done();
// 4. 从画布重新读取,确认修改生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveString.get(str.getState_PrimitiveId());
console.log('text:', before, '→', refetched.getState_Text());
```
### setstate_x
# IPCB\_PrimitiveString.setState\_X() method
> 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.
Set the property state: X coordinate
## Signature
```typescript
function setState_X(x: number): IPCB_PrimitiveString;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
x
</td><td>
number
</td><td>
X coordinate
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveString](./IPCB_PrimitiveString.md)
Text primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 在顶层丝印(3)放置一行文本
const str = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_TEXT', 'default', 45, 6, 3, 0, false, 0, false, false);
const before = str.getState_X();
// 3. 异步模式把锚点向右平移 500mil
const asyncStr = str.toAsync();
asyncStr.setState_X(before + 500);
await asyncStr.done();
// 4. 从画布重新读取,确认修改生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveString.get(str.getState_PrimitiveId());
console.log('x:', before, '→', refetched.getState_X());
```
### setstate_y
# IPCB\_PrimitiveString.setState\_Y() method
> 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.
Set the property state: Y coordinate
## Signature
```typescript
function setState_Y(y: number): IPCB_PrimitiveString;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
y
</td><td>
number
</td><td>
Y coordinate
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveString](./IPCB_PrimitiveString.md)
Text primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 在顶层丝印(3)放置一行文本
const str = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_TEXT', 'default', 45, 6, 3, 0, false, 0, false, false);
const before = str.getState_Y();
// 3. 异步模式把锚点向上平移 500mil
const asyncStr = str.toAsync();
asyncStr.setState_Y(before + 500);
await asyncStr.done();
// 4. 从画布重新读取,确认修改生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveString.get(str.getState_PrimitiveId());
console.log('y:', before, '→', refetched.getState_Y());
```
### toasync
# IPCB\_PrimitiveString.toAsync() method
Convert Primitive to Async primitive
## Signature
```typescript
function toAsync(): IPCB_PrimitiveString;
```
## Returns
[IPCB\_PrimitiveString](./IPCB_PrimitiveString.md)
Text primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 在顶层丝印(3)放置一行文本
const str = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_TEXT', 'default', 45, 6, 3, 0, false, 0, false, false);
// 3. 切换异步模式后批量修改:改内容 + 加大字号
const asyncStr = str.toAsync();
asyncStr.setState_Text('嘉立创示例_批量');
asyncStr.setState_FontSize(60);
await asyncStr.done();
// 4. 从画布重新读取,确认批量修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveString.get(str.getState_PrimitiveId());
console.log('text:', refetched.getState_Text());
console.log('fontSize:', refetched.getState_FontSize());
```
### tosync
# IPCB\_PrimitiveString.toSync() method
Convert Primitive to Sync primitive
## Signature
```typescript
function toSync(): IPCB_PrimitiveString;
```
## Returns
[IPCB\_PrimitiveString](./IPCB_PrimitiveString.md)
Text primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 在顶层丝印(3)放置一行文本
const str = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_TEXT', 'default', 45, 6, 3, 0, false, 0, false, false);
const before = str.isAsync();
// 3. 转换为同步图元(保留现场供观察)
const syncStr = str.toSync();
const after = syncStr.isAsync();
// 4. 同步图元直接读取属性,无需提交
console.log('isAsync:', before, '→', after);
console.log('primitiveType:', syncStr.getState_PrimitiveType());
console.log('layer:', syncStr.getState_Layer());
```
references/classes/IPCB_PrimitiveRegion.md
# IPCB\_PrimitiveRegion class
Region primitive
## Signature
```typescript
class IPCB_PrimitiveRegion implements IPCB_Primitive
```
**Implements:** [IPCB\_Primitive](../interfaces/IPCB_Primitive.md)
## Remarks
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[convertToFill()](./IPCB_PrimitiveRegion.md)
</td><td>
</td><td>
**_(BETA)_** Convert to: fill primitive
</td></tr>
<tr><td>
[convertToPolyline()](./IPCB_PrimitiveRegion.md)
</td><td>
</td><td>
**_(BETA)_** Convert to: polyline primitive
</td></tr>
<tr><td>
[convertToPour()](./IPCB_PrimitiveRegion.md)
</td><td>
</td><td>
**_(BETA)_** Convert to: Copper border primitive
</td></tr>
<tr><td>
[done()](./IPCB_PrimitiveRegion.md)
</td><td>
</td><td>
**_(BETA)_** Apply the changes to the primitives to the canvas
</td></tr>
<tr><td>
[getState\_ComplexPolygon()](./IPCB_PrimitiveRegion.md)
</td><td>
</td><td>
Get the property state: complex polygon
</td></tr>
<tr><td>
[getState\_Layer()](./IPCB_PrimitiveRegion.md)
</td><td>
</td><td>
Get the property state: Layer
</td></tr>
<tr><td>
[getState\_LineWidth()](./IPCB_PrimitiveRegion.md)
</td><td>
</td><td>
Get the property state: Line width
</td></tr>
<tr><td>
[getState\_PrimitiveId()](./IPCB_PrimitiveRegion.md)
</td><td>
</td><td>
Get the property state: primitive ID
</td></tr>
<tr><td>
[getState\_PrimitiveLock()](./IPCB_PrimitiveRegion.md)
</td><td>
</td><td>
Get the property state: whether it is locked
</td></tr>
<tr><td>
[getState\_PrimitiveType()](./IPCB_PrimitiveRegion.md)
</td><td>
</td><td>
Get the property state: primitive type
</td></tr>
<tr><td>
[getState\_RegionName()](./IPCB_PrimitiveRegion.md)
</td><td>
</td><td>
Get the property state: region name
</td></tr>
<tr><td>
[getState\_RuleType()](./IPCB_PrimitiveRegion.md)
</td><td>
</td><td>
Get the property state: region rule type
</td></tr>
<tr><td>
[isAsync()](./IPCB_PrimitiveRegion.md)
</td><td>
</td><td>
Query whether the primitive is an async primitive
</td></tr>
<tr><td>
[reset()](./IPCB_PrimitiveRegion.md)
</td><td>
</td><td>
**_(BETA)_** Reset the async primitive to the current canvas state
</td></tr>
<tr><td>
[setState\_ComplexPolygon(complexPolygon)](./IPCB_PrimitiveRegion.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: complex polygon
</td></tr>
<tr><td>
[setState\_Layer(layer)](./IPCB_PrimitiveRegion.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Layer
</td></tr>
<tr><td>
[setState\_LineWidth(lineWidth)](./IPCB_PrimitiveRegion.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Line width
</td></tr>
<tr><td>
[setState\_PrimitiveLock(primitiveLock)](./IPCB_PrimitiveRegion.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: whether it is locked
</td></tr>
<tr><td>
[setState\_RegionName(regionName)](./IPCB_PrimitiveRegion.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: region name
</td></tr>
<tr><td>
[setState\_RuleType(ruleType)](./IPCB_PrimitiveRegion.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: region rule type
</td></tr>
<tr><td>
[toAsync()](./IPCB_PrimitiveRegion.md)
</td><td>
</td><td>
Convert Primitive to Async primitive
</td></tr>
<tr><td>
[toSync()](./IPCB_PrimitiveRegion.md)
</td><td>
</td><td>
Convert Primitive to Sync primitive
</td></tr>
</tbody></table>
---
## 方法详情
### converttofill
# IPCB\_PrimitiveRegion.convertToFill() method
> 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.
Convert to: fill primitive
## Signature
```typescript
function convertToFill(): Promise<IPCB_PrimitiveFill>;
```
## Returns
Promise<[IPCB\_PrimitiveFill](./IPCB_PrimitiveFill.md)<!-- -->>
Fill primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个矩形区域
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
// 3. 转换为填充图元(区域本身保留,填充为新图元,保留现场供观察)
const fill = await region.convertToFill();
console.log('primitiveType:', `Region → ${fill.getState_PrimitiveType()}`);
console.log('primitiveId:', fill.getState_PrimitiveId());
```
### converttopolyline
# IPCB\_PrimitiveRegion.convertToPolyline() method
> 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.
Convert to: polyline primitive
## Signature
```typescript
function convertToPolyline(): Promise<IPCB_PrimitivePolyline>;
```
## Returns
Promise<[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)<!-- -->>
Polyline primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个矩形区域
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
// 3. 转换为折线图元(区域本身保留,折线为新图元,保留现场供观察)
const polyline = await region.convertToPolyline();
console.log('primitiveType:', `Region → ${polyline.getState_PrimitiveType()}`);
console.log('primitiveId:', polyline.getState_PrimitiveId());
```
### converttopour
# IPCB\_PrimitiveRegion.convertToPour() method
> 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.
Convert to: Copper border primitive
## Signature
```typescript
function convertToPour(): Promise<IPCB_PrimitivePour>;
```
## Returns
Promise<[IPCB\_PrimitivePour](./IPCB_PrimitivePour.md)<!-- -->>
Copper border primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个矩形区域
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
// 3. 转换为覆铜边框图元(区域本身保留,覆铜边框为新图元,保留现场供观察)
const pour = await region.convertToPour();
console.log('primitiveType:', `Region → ${pour.getState_PrimitiveType()}`);
console.log('primitiveId:', pour.getState_PrimitiveId());
```
### done
# IPCB\_PrimitiveRegion.done() method
> 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.
Apply the changes to the primitives to the canvas
## Signature
```typescript
function done(): Promise<IPCB_PrimitiveRegion>;
```
## Returns
Promise<[IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)<!-- -->>
Region primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个顶层铜层(1)的矩形区域
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
const before = region.getState_Layer();
// 3. 异步模式下把区域挪到底层铜层(此时画布还没变)
const asyncRegion = region.toAsync();
asyncRegion.setState_Layer(2);
await asyncRegion.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveRegion.get(region.getState_PrimitiveId());
console.log('layer:', before, '→', refetched.getState_Layer());
```
### getstate_complexpolygon
# IPCB\_PrimitiveRegion.getState\_ComplexPolygon() method
Get the property state: complex polygon
## Signature
```typescript
function getState_ComplexPolygon(): IPCB_Polygon;
```
## Returns
[IPCB\_Polygon](./IPCB_Polygon.md)
Complex polygon
## Example
```javascript
// 1. 创建一个已知轮廓的矩形区域(500 x 300 mil)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
// 2. 读取复杂多边形对象,再取它的轮廓源数组
const complexPolygon = region.getState_ComplexPolygon();
const source = complexPolygon.getSource();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveRegion.delete([region.getState_PrimitiveId()]);
console.log('polygonSource:', JSON.stringify(source));
```
### getstate_layer
# IPCB\_PrimitiveRegion.getState\_Layer() method
Get the property state: Layer
## Signature
```typescript
function getState_Layer(): TPCB_LayersOfRegion;
```
## Returns
[TPCB\_LayersOfRegion](../types/TPCB_LayersOfRegion.md)
Layer
## Example
```javascript
// 1. 创建一个顶层铜层(1)的矩形区域
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
// 2. 读取所在层
const layer = region.getState_Layer();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveRegion.delete([region.getState_PrimitiveId()]);
console.log('layer:', layer);
```
### getstate_linewidth
# IPCB\_PrimitiveRegion.getState\_LineWidth() method
Get the property state: Line width
## Signature
```typescript
function getState_LineWidth(): number;
```
## Returns
number
Line width
## Example
```javascript
// 1. 创建一个 10mil 线宽的矩形区域
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const region = await eda.pcb_PrimitiveRegion.create(1, polygon, undefined, undefined, 10, false);
// 2. 读取线宽
const lineWidth = region.getState_LineWidth();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveRegion.delete([region.getState_PrimitiveId()]);
console.log('lineWidth:', lineWidth);
```
### getstate_primitiveid
# IPCB\_PrimitiveRegion.getState\_PrimitiveId() method
Get the property state: primitive ID
## Signature
```typescript
function getState_PrimitiveId(): string;
```
## Returns
string
Primitive ID
## Example
```javascript
// 1. 创建一个矩形区域
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
// 2. 读取图元 ID
const primitiveId = region.getState_PrimitiveId();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveRegion.delete([region.getState_PrimitiveId()]);
console.log('primitiveId:', primitiveId);
```
### getstate_primitivelock
# IPCB\_PrimitiveRegion.getState\_PrimitiveLock() method
Get the property state: whether it is locked
## Signature
```typescript
function getState_PrimitiveLock(): boolean;
```
## Returns
boolean
Whether it is locked
## Example
```javascript
// 1. 创建一个未锁定的矩形区域
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
// 2. 读取锁定状态
const primitiveLock = region.getState_PrimitiveLock();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveRegion.delete([region.getState_PrimitiveId()]);
console.log('primitiveLock:', primitiveLock);
```
### getstate_primitivetype
# IPCB\_PrimitiveRegion.getState\_PrimitiveType() method
Get the property state: primitive type
## Signature
```typescript
function getState_PrimitiveType(): EPCB_PrimitiveType;
```
## Returns
[EPCB\_PrimitiveType](../enums/EPCB_PrimitiveType.md)
Primitive type
## Example
```javascript
// 1. 创建一个矩形区域
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
// 2. 读取图元类型
const primitiveType = region.getState_PrimitiveType();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveRegion.delete([region.getState_PrimitiveId()]);
console.log('primitiveType:', primitiveType);
```
### getstate_regionname
# IPCB\_PrimitiveRegion.getState\_RegionName() method
Get the property state: region name
## Signature
```typescript
function getState_RegionName(): string | undefined;
```
## Returns
string \| undefined
Region name
## Example
```javascript
// 1. 创建一个带名称的约束区域(ruleType=9 即 FOLLOW_REGION_RULE)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const region = await eda.pcb_PrimitiveRegion.create(1, polygon, [9], '嘉立创示例_电源约束区');
// 2. 读取区域名称
const regionName = region.getState_RegionName();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveRegion.delete([region.getState_PrimitiveId()]);
console.log('regionName:', regionName);
```
### getstate_ruletype
# IPCB\_PrimitiveRegion.getState\_RuleType() method
Get the property state: region rule type
## Signature
```typescript
function getState_RuleType(): Array<EPCB_PrimitiveRegionRuleType>;
```
## Returns
Array<[EPCB\_PrimitiveRegionRuleType](../enums/EPCB_PrimitiveRegionRuleType.md)<!-- -->>
Region rule type
## Example
```javascript
// 1. 创建一个"禁止元件"(NO_COMPONENTS=2)的规则区域
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const region = await eda.pcb_PrimitiveRegion.create(1, polygon, [2]);
// 2. 读取规则类型数组(枚举值:2=禁止元件, 5=禁止导线, 6=禁止填充, 7=禁止覆铜, 8=禁止内电层, 9=约束区域)
const ruleType = region.getState_RuleType();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveRegion.delete([region.getState_PrimitiveId()]);
console.log('ruleType:', JSON.stringify(ruleType));
```
### isasync
# IPCB\_PrimitiveRegion.isAsync() method
Query whether the primitive is an async primitive
## Signature
```typescript
function isAsync(): boolean;
```
## Returns
boolean
Whether Is async primitive
## Example
```javascript
// 1. 创建一个矩形区域
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
// 2. 查询异步模式
const isAsync = region.isAsync();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveRegion.delete([region.getState_PrimitiveId()]);
console.log('isAsync:', isAsync);
```
### reset
# IPCB\_PrimitiveRegion.reset() method
> 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.
Reset the async primitive to the current canvas state
## Signature
```typescript
function reset(): Promise<IPCB_PrimitiveRegion>;
```
## Returns
Promise<[IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)<!-- -->>
Region primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个顶层铜层的矩形区域
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
const before = region.getState_Layer();
// 3. 异步模式下把层改到底层(2),随后反悔
const asyncRegion = region.toAsync();
asyncRegion.setState_Layer(2);
// 4. reset 丢弃未提交的修改(保留现场供观察)
await asyncRegion.reset();
// 5. 从画布重新读取,确认层没有变
const refetched = await eda.pcb_PrimitiveRegion.get(region.getState_PrimitiveId());
console.log('layer:', before, '→', refetched.getState_Layer());
```
### setstate_complexpolygon
# IPCB\_PrimitiveRegion.setState\_ComplexPolygon() method
> 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.
Set the property state: complex polygon
## Signature
```typescript
function setState_ComplexPolygon(complexPolygon: IPCB_Polygon): IPCB_PrimitiveRegion;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
complexPolygon
</td><td>
[IPCB\_Polygon](./IPCB_Polygon.md)
</td><td>
Complex polygon
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)
Region primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个 500 x 300 的矩形区域
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
const before = JSON.stringify(region.getState_ComplexPolygon().getSource());
// 3. 构造新轮廓(放大到 800 x 400),异步模式提交
const newPolygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 800, 400, 0, 0]);
const asyncRegion = region.toAsync();
asyncRegion.setState_ComplexPolygon(newPolygon);
await asyncRegion.done();
// 4. 从画布重新读取,确认轮廓已替换(保留现场供观察)
const refetched = await eda.pcb_PrimitiveRegion.get(region.getState_PrimitiveId());
const after = JSON.stringify(refetched.getState_ComplexPolygon().getSource());
console.log('polygonSource:', before, '→', after);
```
### setstate_layer
# IPCB\_PrimitiveRegion.setState\_Layer() method
> 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.
Set the property state: Layer
## Signature
```typescript
function setState_Layer(layer: TPCB_LayersOfRegion): IPCB_PrimitiveRegion;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfRegion](../types/TPCB_LayersOfRegion.md)
</td><td>
Layer
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)
Region primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个顶层铜层(1)的矩形区域
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
const before = region.getState_Layer();
// 3. 异步模式把区域挪到底层铜层(2)
const asyncRegion = region.toAsync();
asyncRegion.setState_Layer(2);
await asyncRegion.done();
// 4. 从画布重新读取,确认层已切换(保留现场供观察)
const refetched = await eda.pcb_PrimitiveRegion.get(region.getState_PrimitiveId());
console.log('layer:', before, '→', refetched.getState_Layer());
```
### setstate_linewidth
# IPCB\_PrimitiveRegion.setState\_LineWidth() method
> 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.
Set the property state: Line width
## Signature
```typescript
function setState_LineWidth(lineWidth: number): IPCB_PrimitiveRegion;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
lineWidth
</td><td>
number
</td><td>
Line width
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)
Region primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个 10mil 线宽的矩形区域
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const region = await eda.pcb_PrimitiveRegion.create(1, polygon, undefined, undefined, 10, false);
const before = region.getState_LineWidth();
// 3. 切换异步模式,线宽加粗到 20mil
const asyncRegion = region.toAsync();
asyncRegion.setState_LineWidth(20);
await asyncRegion.done();
// 4. 从图元对象读回新值(保留现场供观察)
// 注:同族 Fill/Pour 的线宽修改画布侧不落,此处从图元对象读回确认
const after = region.getState_LineWidth();
console.log('lineWidth:', before, '→', after);
```
### setstate_primitivelock
# IPCB\_PrimitiveRegion.setState\_PrimitiveLock() method
> 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.
Set the property state: whether it is locked
## Signature
```typescript
function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitiveRegion;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveLock
</td><td>
boolean
</td><td>
Whether it is locked
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)
Region primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个未锁定的矩形区域
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
const before = region.getState_PrimitiveLock();
// 3. 切换异步模式并锁定区域
const asyncRegion = region.toAsync();
asyncRegion.setState_PrimitiveLock(true);
await asyncRegion.done();
// 4. 从画布重新读取,确认已锁定(保留现场供观察)
const refetched = await eda.pcb_PrimitiveRegion.get(region.getState_PrimitiveId());
console.log('primitiveLock:', before, '→', refetched.getState_PrimitiveLock());
```
### setstate_regionname
# IPCB\_PrimitiveRegion.setState\_RegionName() method
> 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.
Set the property state: region name
## Signature
```typescript
function setState_RegionName(regionName?: string): IPCB_PrimitiveRegion;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
regionName
</td><td>
string
</td><td>
_(Optional)_ Region name
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)
Region primitive object
## Remarks
Only valid when `ruleType` is [EPCB\_PrimitiveRegionRuleType.FOLLOW\_REGION\_RULE](../enums/EPCB_PrimitiveRegionRuleType.md)<!-- -->, used to match region DRC rules
If `ruleType` is [EPCB\_PrimitiveRegionRuleType.FOLLOW\_REGION\_RULE](../enums/EPCB_PrimitiveRegionRuleType.md) but `regionName` is empty, the system will automatically assign a name
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个带名称的约束区域(ruleType=9 即 FOLLOW_REGION_RULE)
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const region = await eda.pcb_PrimitiveRegion.create(1, polygon, [9], '嘉立创示例_旧区域名');
const before = region.getState_RegionName();
// 3. 异步模式修改区域名称
const asyncRegion = region.toAsync();
asyncRegion.setState_RegionName('嘉立创示例_电源约束区');
await asyncRegion.done();
// 4. 从图元对象读回新值(保留现场供观察)
// 注:当前版本名称修改画布侧不落(重新 get() 仍是旧名),修改在图元对象上生效
const after = region.getState_RegionName();
console.log('regionName:', before, '→', after);
```
### setstate_ruletype
# IPCB\_PrimitiveRegion.setState\_RuleType() method
> 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.
Set the property state: region rule type
## Signature
```typescript
function setState_RuleType(ruleType: Array<EPCB_PrimitiveRegionRuleType>): IPCB_PrimitiveRegion;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
ruleType
</td><td>
Array<[EPCB\_PrimitiveRegionRuleType](../enums/EPCB_PrimitiveRegionRuleType.md)<!-- -->>
</td><td>
Region rule type
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)
Region primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个不带规则的矩形区域
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
const before = JSON.stringify(region.getState_RuleType());
// 3. 异步模式挂上"禁止元件 + 禁止导线"两条规则(2=NO_COMPONENTS, 5=NO_WIRES)
const asyncRegion = region.toAsync();
asyncRegion.setState_RuleType([2, 5]);
await asyncRegion.done();
// 4. 从画布重新读取,确认规则已更新(保留现场供观察)
const refetched = await eda.pcb_PrimitiveRegion.get(region.getState_PrimitiveId());
console.log('ruleType:', before, '→', JSON.stringify(refetched.getState_RuleType()));
```
### toasync
# IPCB\_PrimitiveRegion.toAsync() method
Convert Primitive to Async primitive
## Signature
```typescript
function toAsync(): IPCB_PrimitiveRegion;
```
## Returns
[IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)
Region primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个顶层铜层的矩形区域
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
// 3. 切换异步模式后批量修改:挪到底层 + 挂"禁止元件"规则
const asyncRegion = region.toAsync();
asyncRegion.setState_Layer(2);
asyncRegion.setState_RuleType([2]);
await asyncRegion.done();
// 4. 从画布重新读取,确认批量修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveRegion.get(region.getState_PrimitiveId());
console.log('layer:', refetched.getState_Layer());
console.log('ruleType:', JSON.stringify(refetched.getState_RuleType()));
```
### tosync
# IPCB\_PrimitiveRegion.toSync() method
Convert Primitive to Sync primitive
## Signature
```typescript
function toSync(): IPCB_PrimitiveRegion;
```
## Returns
[IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)
Region primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个矩形区域
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const region = await eda.pcb_PrimitiveRegion.create(1, polygon);
const before = region.isAsync();
// 3. 转换为同步图元(保留现场供观察)
const syncRegion = region.toSync();
const after = syncRegion.isAsync();
// 4. 同步图元直接读取属性,无需提交
console.log('isAsync:', before, '→', after);
console.log('primitiveType:', syncRegion.getState_PrimitiveType());
console.log('layer:', syncRegion.getState_Layer());
```
references/classes/ISCH_PrimitiveCbbSymbolComponent.md
# ISCH\_PrimitiveCbbSymbolComponent class
Reuse block symbol primitive
## Signature
```typescript
class ISCH_PrimitiveCbbSymbolComponent extends ISCH_PrimitiveComponent
```
**Extends:** [ISCH\_PrimitiveComponent](./ISCH_PrimitiveComponent.md)
## Remarks
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[done()](./ISCH_PrimitiveCbbSymbolComponent.md)
</td><td>
</td><td>
**_(BETA)_** Apply the changes to the primitives to the canvas
</td></tr>
<tr><td>
[getState\_Cbb()](./ISCH_PrimitiveCbbSymbolComponent.md)
</td><td>
</td><td>
Get the property state: associate reuse block
</td></tr>
<tr><td>
[getState\_CbbSymbol()](./ISCH_PrimitiveCbbSymbolComponent.md)
</td><td>
</td><td>
Get the property state: associate reuse block symbol
</td></tr>
<tr><td>
[reset()](./ISCH_PrimitiveCbbSymbolComponent.md)
</td><td>
</td><td>
**_(BETA)_** Reset the async primitive to the current canvas state
</td></tr>
</tbody></table>
---
## 方法详情
### done
# ISCH\_PrimitiveCbbSymbolComponent.done() method
> 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.
Apply the changes to the primitives to the canvas
## Signature
```typescript
function done(): Promise<ISCH_PrimitiveCbbSymbolComponent>;
```
## Returns
Promise<[ISCH\_PrimitiveCbbSymbolComponent](./ISCH_PrimitiveCbbSymbolComponent.md)<!-- -->>
Reuse block symbol primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试符号重合
const x = 2000 + Math.floor(Math.random() * 6000);
const y = 2000 + Math.floor(Math.random() * 6000);
// 2. 放置一个测试复用模块符号(SCH 坐标单位 10mil)
const cbbList = await eda.lib_Cbb.search('');
const cbb = cbbList[0];
const symbol = await eda.sch_PrimitiveComponent.createCbbSymbol(
{ libraryUuid: cbb.libraryUuid, cbbUuid: cbb.uuid },
x,
y
);
// 3. 切换异步模式,把符号向右移动 200(约 5mm)
const asyncSymbol = symbol.toAsync();
asyncSymbol.setState_X(x + 200);
// 4. 一次性提交到画布
await asyncSymbol.done();
// 5. 从画布重新读取,确认位置修改已生效(保留现场供观察)
const refetched = await eda.sch_Primitive.getPrimitiveByPrimitiveId(symbol.getState_PrimitiveId());
console.log('x:', x, '→', refetched.getState_X());
```
### getstate_cbb
# ISCH\_PrimitiveCbbSymbolComponent.getState\_Cbb() method
Get the property state: associate reuse block
## Signature
```typescript
function getState_Cbb(): { libraryUuid: string; uuid: string };
```
## Returns
\{ libraryUuid: string; uuid: string \}
Associate reuse block
## Example
```javascript
// 1. 从系统库搜索一个复用模块
const cbbList = await eda.lib_Cbb.search('');
const cbb = cbbList[0];
// 2. 在画布上放置该模块的符号(SCH 坐标单位 10mil)
const symbol = await eda.sch_PrimitiveComponent.createCbbSymbol(
{ libraryUuid: cbb.libraryUuid, cbbUuid: cbb.uuid },
1000,
1000
);
// 3. 读取符号关联的复用模块(libraryUuid + 模块 uuid,与放置时传入的一致)
const cbbInfo = symbol.getState_Cbb();
// 4. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveComponent.delete([symbol.getState_PrimitiveId()]);
console.log('cbbInfo:', cbbInfo);
```
### getstate_cbbsymbol
# ISCH\_PrimitiveCbbSymbolComponent.getState\_CbbSymbol() method
Get the property state: associate reuse block symbol
## Signature
```typescript
function getState_CbbSymbol(): {
libraryUuid: string;
cbbUuid: string;
uuid?: string;
name?: string;
};
```
## Returns
\{ libraryUuid: string; cbbUuid: string; uuid?: string; name?: string \}
Associate reuse block symbol
## Example
```javascript
// 1. 从系统库搜索一个复用模块
const cbbList = await eda.lib_Cbb.search('');
const cbb = cbbList[0];
// 2. 在画布上放置该模块的符号(未指定具体符号 uuid,使用模块默认符号)
const symbol = await eda.sch_PrimitiveComponent.createCbbSymbol(
{ libraryUuid: cbb.libraryUuid, cbbUuid: cbb.uuid },
1000,
1000
);
// 3. 读取符号定义信息(libraryUuid + cbbUuid 必有,uuid/name 未指定时为空)
const cbbSymbol = symbol.getState_CbbSymbol();
// 4. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveComponent.delete([symbol.getState_PrimitiveId()]);
console.log('cbbSymbol:', cbbSymbol);
```
### reset
# ISCH\_PrimitiveCbbSymbolComponent.reset() method
> 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.
Reset the async primitive to the current canvas state
## Signature
```typescript
function reset(): Promise<ISCH_PrimitiveCbbSymbolComponent>;
```
## Returns
Promise<[ISCH\_PrimitiveCbbSymbolComponent](./ISCH_PrimitiveCbbSymbolComponent.md)<!-- -->>
Reuse block symbol primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试符号重合
const x = 2000 + Math.floor(Math.random() * 6000);
const y = 2000 + Math.floor(Math.random() * 6000);
// 2. 放置一个测试复用模块符号(SCH 坐标单位 10mil)
const cbbList = await eda.lib_Cbb.search('');
const cbb = cbbList[0];
const symbol = await eda.sch_PrimitiveComponent.createCbbSymbol(
{ libraryUuid: cbb.libraryUuid, cbbUuid: cbb.uuid },
x,
y
);
// 3. 异步模式下改一个错误坐标,但不提交,直接 reset() 丢弃
const asyncSymbol = symbol.toAsync();
asyncSymbol.setState_X(x + 9999);
await asyncSymbol.reset();
// 4. 从画布重新读取,确认位置仍是放置时的值(保留现场供观察)
const refetched = await eda.sch_Primitive.getPrimitiveByPrimitiveId(symbol.getState_PrimitiveId());
console.log('x:', refetched.getState_X(), '(修改已丢弃)');
```
references/classes/ISCH_PrimitiveArc.md
# ISCH\_PrimitiveArc class
Arc primitive
## Signature
```typescript
class ISCH_PrimitiveArc implements ISCH_Primitive
```
**Implements:** [ISCH\_Primitive](../interfaces/ISCH_Primitive.md)
## Remarks
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[done()](./ISCH_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Apply the changes to the primitives to the canvas
</td></tr>
<tr><td>
[getState\_Color()](./ISCH_PrimitiveArc.md)
</td><td>
</td><td>
Get the property state: color
</td></tr>
<tr><td>
[getState\_EndX()](./ISCH_PrimitiveArc.md)
</td><td>
</td><td>
Get the property state: end point X
</td></tr>
<tr><td>
[getState\_EndY()](./ISCH_PrimitiveArc.md)
</td><td>
</td><td>
Get the property state: end point Y
</td></tr>
<tr><td>
[getState\_FillColor()](./ISCH_PrimitiveArc.md)
</td><td>
</td><td>
Get the property state: fill color
</td></tr>
<tr><td>
[getState\_LineType()](./ISCH_PrimitiveArc.md)
</td><td>
</td><td>
Get the property state: line type
</td></tr>
<tr><td>
[getState\_LineWidth()](./ISCH_PrimitiveArc.md)
</td><td>
</td><td>
Get the property state: Line width
</td></tr>
<tr><td>
[getState\_PrimitiveId()](./ISCH_PrimitiveArc.md)
</td><td>
</td><td>
Get the property state: primitive ID
</td></tr>
<tr><td>
[getState\_PrimitiveType()](./ISCH_PrimitiveArc.md)
</td><td>
</td><td>
Get the property state: primitive type
</td></tr>
<tr><td>
[getState\_ReferenceX()](./ISCH_PrimitiveArc.md)
</td><td>
</td><td>
Get the property state: reference point X
</td></tr>
<tr><td>
[getState\_ReferenceY()](./ISCH_PrimitiveArc.md)
</td><td>
</td><td>
Get the property state: reference point Y
</td></tr>
<tr><td>
[getState\_StartX()](./ISCH_PrimitiveArc.md)
</td><td>
</td><td>
Get the property state: start point X
</td></tr>
<tr><td>
[getState\_StartY()](./ISCH_PrimitiveArc.md)
</td><td>
</td><td>
Get the property state: start point Y
</td></tr>
<tr><td>
[isAsync()](./ISCH_PrimitiveArc.md)
</td><td>
</td><td>
Query whether the primitive is an async primitive
</td></tr>
<tr><td>
[reset()](./ISCH_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Reset the async primitive to the current canvas state
</td></tr>
<tr><td>
[setState\_Color(color)](./ISCH_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: color
</td></tr>
<tr><td>
[setState\_EndX(endX)](./ISCH_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: end point X
</td></tr>
<tr><td>
[setState\_EndY(endY)](./ISCH_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: end point Y
</td></tr>
<tr><td>
[setState\_FillColor(fillColor)](./ISCH_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: fill color
</td></tr>
<tr><td>
[setState\_LineType(lineType)](./ISCH_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: line type
</td></tr>
<tr><td>
[setState\_LineWidth(lineWidth)](./ISCH_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Line width
</td></tr>
<tr><td>
[setState\_ReferenceX(referenceX)](./ISCH_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: reference point X
</td></tr>
<tr><td>
[setState\_ReferenceY(referenceY)](./ISCH_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: reference point Y
</td></tr>
<tr><td>
[setState\_StartX(startX)](./ISCH_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: start point X
</td></tr>
<tr><td>
[setState\_StartY(startY)](./ISCH_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: start point Y
</td></tr>
<tr><td>
[toAsync()](./ISCH_PrimitiveArc.md)
</td><td>
</td><td>
Convert Primitive to Async primitive
</td></tr>
<tr><td>
[toSync()](./ISCH_PrimitiveArc.md)
</td><td>
</td><td>
Convert Primitive to Sync primitive
</td></tr>
</tbody></table>
---
## 方法详情
### done
# ISCH\_PrimitiveArc.done() method
> 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.
Apply the changes to the primitives to the canvas
## Signature
```typescript
function done(): Promise<ISCH_PrimitiveArc>;
```
## Returns
Promise<[ISCH\_PrimitiveArc](./ISCH_PrimitiveArc.md)<!-- -->>
Arc primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆弧重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一段测试圆弧:起点 (x,y)、参考点 (x+100,y+100)、终点 (x+200,y)(SCH 坐标单位 10mil)
const arc = await eda.sch_PrimitiveArc.create(x, y, x + 100, y + 100, x + 200, y, null, null, 6, 1);
// 3. 切换异步模式,累计两处修改(终点右移 + 改颜色)
const asyncArc = arc.toAsync();
asyncArc.setState_EndX(x + 300);
asyncArc.setState_Color('#00AA00');
// 4. 一次性提交到画布
await asyncArc.done();
// 5. 从画布重新读取,确认两处修改都已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveArc.get(arc.getState_PrimitiveId());
console.log('endX:', x + 200, '→', refetched.getState_EndX());
console.log('color:', '#00AA00', '→', refetched.getState_Color());
```
### getstate_color
# ISCH\_PrimitiveArc.getState\_Color() method
Get the property state: color
## Signature
```typescript
function getState_Color(): string | null;
```
## Returns
string \| null
Color
## Example
```javascript
// 1. 创建一段红色测试圆弧(SCH 坐标单位 10mil)
const arc = await eda.sch_PrimitiveArc.create(400, 300, 500, 400, 600, 300, '#FF0000', null, 6, 1);
// 2. 读取圆弧颜色
const color = arc.getState_Color();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveArc.delete([arc.getState_PrimitiveId()]);
console.log('color:', color);
```
### getstate_endx
# ISCH\_PrimitiveArc.getState\_EndX() method
Get the property state: end point X
## Signature
```typescript
function getState_EndX(): number;
```
## Returns
number
End point X
## Example
```javascript
// 1. 创建一段测试圆弧,终点 (600, 300)(SCH 坐标单位 10mil)
const arc = await eda.sch_PrimitiveArc.create(400, 300, 500, 400, 600, 300, null, null, 6, 1);
// 2. 读取终止点 X
const endX = arc.getState_EndX();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveArc.delete([arc.getState_PrimitiveId()]);
console.log('endX:', endX);
```
### getstate_endy
# ISCH\_PrimitiveArc.getState\_EndY() method
Get the property state: end point Y
## Signature
```typescript
function getState_EndY(): number;
```
## Returns
number
End point Y
## Example
```javascript
// 1. 创建一段测试圆弧,终点 (600, 300)(SCH 坐标单位 10mil)
const arc = await eda.sch_PrimitiveArc.create(400, 300, 500, 400, 600, 300, null, null, 6, 1);
// 2. 读取终止点 Y
const endY = arc.getState_EndY();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveArc.delete([arc.getState_PrimitiveId()]);
console.log('endY:', endY);
```
### getstate_fillcolor
# ISCH\_PrimitiveArc.getState\_FillColor() method
Get the property state: fill color
## Signature
```typescript
function getState_FillColor(): string | null;
```
## Returns
string \| null
Fill color
## Example
```javascript
// 1. 创建一段带填充色的测试圆弧(SCH 坐标单位 10mil)
const arc = await eda.sch_PrimitiveArc.create(400, 300, 500, 400, 600, 300, null, '#DDEEFF', 6, 1);
// 2. 读取填充颜色
const fillColor = arc.getState_FillColor();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveArc.delete([arc.getState_PrimitiveId()]);
console.log('fillColor:', fillColor);
```
### getstate_linetype
# ISCH\_PrimitiveArc.getState\_LineType() method
Get the property state: line type
## Signature
```typescript
function getState_LineType(): ESCH_PrimitiveLineType | null;
```
## Returns
[ESCH\_PrimitiveLineType](../enums/ESCH_PrimitiveLineType.md) \| null
Line type
## Example
```javascript
// 1. 创建一段虚线(DASHED=1)测试圆弧(SCH 坐标单位 10mil)
const arc = await eda.sch_PrimitiveArc.create(400, 300, 500, 400, 600, 300, null, null, 6, 1);
// 2. 读取线型
const lineType = arc.getState_LineType();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveArc.delete([arc.getState_PrimitiveId()]);
console.log('lineType:', lineType);
```
### getstate_linewidth
# ISCH\_PrimitiveArc.getState\_LineWidth() method
Get the property state: Line width
## Signature
```typescript
function getState_LineWidth(): number | null;
```
## Returns
number \| null
Line width
## Example
```javascript
// 1. 创建一段线宽 6 的测试圆弧(SCH 坐标单位 10mil)
const arc = await eda.sch_PrimitiveArc.create(400, 300, 500, 400, 600, 300, null, null, 6, 1);
// 2. 读取线宽
const lineWidth = arc.getState_LineWidth();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveArc.delete([arc.getState_PrimitiveId()]);
console.log('lineWidth:', lineWidth);
```
### getstate_primitiveid
# ISCH\_PrimitiveArc.getState\_PrimitiveId() method
Get the property state: primitive ID
## Signature
```typescript
function getState_PrimitiveId(): string;
```
## Returns
string
Primitive ID
## Example
```javascript
// 1. 创建一段测试圆弧(SCH 坐标单位 10mil)
const arc = await eda.sch_PrimitiveArc.create(400, 300, 500, 400, 600, 300, null, null, 6, 1);
// 2. 读取图元 ID
const primitiveId = arc.getState_PrimitiveId();
// 3. 用该 ID 反查同一图元,验证 ID 有效(查询类案例不留测试对象)
const refetched = await eda.sch_PrimitiveArc.get(primitiveId);
await eda.sch_PrimitiveArc.delete([primitiveId]);
console.log('primitiveId:', primitiveId);
console.log('refetch matched:', refetched.getState_PrimitiveId() === primitiveId);
```
### getstate_primitivetype
# ISCH\_PrimitiveArc.getState\_PrimitiveType() method
Get the property state: primitive type
## Signature
```typescript
function getState_PrimitiveType(): ESCH_PrimitiveType;
```
## Returns
[ESCH\_PrimitiveType](../enums/ESCH_PrimitiveType.md)
Primitive type
## Example
```javascript
// 1. 创建一段测试圆弧(SCH 坐标单位 10mil)
const arc = await eda.sch_PrimitiveArc.create(400, 300, 500, 400, 600, 300, null, null, 6, 1);
// 2. 读取图元类型
const primitiveType = arc.getState_PrimitiveType();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveArc.delete([arc.getState_PrimitiveId()]);
console.log('primitiveType:', primitiveType);
```
### getstate_referencex
# ISCH\_PrimitiveArc.getState\_ReferenceX() method
Get the property state: reference point X
## Signature
```typescript
function getState_ReferenceX(): number;
```
## Returns
number
Reference point X
## Example
```javascript
// 1. 创建一段测试圆弧,参考点 (500, 400)(SCH 坐标单位 10mil)
const arc = await eda.sch_PrimitiveArc.create(400, 300, 500, 400, 600, 300, null, null, 6, 1);
// 2. 读取参考点 X
const referenceX = arc.getState_ReferenceX();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveArc.delete([arc.getState_PrimitiveId()]);
console.log('referenceX:', referenceX);
```
### getstate_referencey
# ISCH\_PrimitiveArc.getState\_ReferenceY() method
Get the property state: reference point Y
## Signature
```typescript
function getState_ReferenceY(): number;
```
## Returns
number
Reference point Y
## Example
```javascript
// 1. 创建一段测试圆弧,参考点 (500, 400)(SCH 坐标单位 10mil)
const arc = await eda.sch_PrimitiveArc.create(400, 300, 500, 400, 600, 300, null, null, 6, 1);
// 2. 读取参考点 Y
const referenceY = arc.getState_ReferenceY();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveArc.delete([arc.getState_PrimitiveId()]);
console.log('referenceY:', referenceY);
```
### getstate_startx
# ISCH\_PrimitiveArc.getState\_StartX() method
Get the property state: start point X
## Signature
```typescript
function getState_StartX(): number;
```
## Returns
number
Start point X
## Example
```javascript
// 1. 创建一段测试圆弧,起点 (400, 300)(SCH 坐标单位 10mil)
const arc = await eda.sch_PrimitiveArc.create(400, 300, 500, 400, 600, 300, null, null, 6, 1);
// 2. 读取起始点 X
const startX = arc.getState_StartX();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveArc.delete([arc.getState_PrimitiveId()]);
console.log('startX:', startX);
```
### getstate_starty
# ISCH\_PrimitiveArc.getState\_StartY() method
Get the property state: start point Y
## Signature
```typescript
function getState_StartY(): number;
```
## Returns
number
Start point Y
## Example
```javascript
// 1. 创建一段测试圆弧,起点 (400, 300)(SCH 坐标单位 10mil)
const arc = await eda.sch_PrimitiveArc.create(400, 300, 500, 400, 600, 300, null, null, 6, 1);
// 2. 读取起始点 Y
const startY = arc.getState_StartY();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveArc.delete([arc.getState_PrimitiveId()]);
console.log('startY:', startY);
```
### isasync
# ISCH\_PrimitiveArc.isAsync() method
Query whether the primitive is an async primitive
## Signature
```typescript
function isAsync(): boolean;
```
## Returns
boolean
Whether Is async primitive
## Example
```javascript
// 1. 创建一段测试圆弧,创建后默认处于异步模式
const arc = await eda.sch_PrimitiveArc.create(400, 300, 500, 400, 600, 300, null, null, 6, 1);
const asyncOnCreate = arc.isAsync();
// 2. 切换到同步模式再查询一次,对比两种模式
arc.toSync();
const asyncAfterToSync = arc.isAsync();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveArc.delete([arc.getState_PrimitiveId()]);
console.log('isAsync on create:', asyncOnCreate);
console.log('isAsync after toSync:', asyncAfterToSync);
```
### reset
# ISCH\_PrimitiveArc.reset() method
> 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.
Reset the async primitive to the current canvas state
## Signature
```typescript
function reset(): Promise<ISCH_PrimitiveArc>;
```
## Returns
Promise<[ISCH\_PrimitiveArc](./ISCH_PrimitiveArc.md)<!-- -->>
Arc primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆弧重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一段线宽 6 的测试圆弧(SCH 坐标单位 10mil)
const arc = await eda.sch_PrimitiveArc.create(x, y, x + 100, y + 100, x + 200, y, null, null, 6, 1);
// 3. 切换异步模式,累计一处未提交的线宽修改(6 → 99)
const asyncArc = arc.toAsync();
asyncArc.setState_LineWidth(99);
// 4. 重置:丢弃未提交的修改,回到画布当前状态
await asyncArc.reset();
// 5. 从画布重新读取,线宽仍是 6(保留现场供观察)
const refetched = await eda.sch_PrimitiveArc.get(arc.getState_PrimitiveId());
console.log('lineWidth after reset:', refetched.getState_LineWidth());
```
### setstate_color
# ISCH\_PrimitiveArc.setState\_Color() method
> 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.
Set the property state: color
## Signature
```typescript
function setState_Color(color: string | null): ISCH_PrimitiveArc;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
color
</td><td>
string \| null
</td><td>
Color
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveArc](./ISCH_PrimitiveArc.md)
Arc primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆弧重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一段红色测试圆弧(SCH 坐标单位 10mil)
const arc = await eda.sch_PrimitiveArc.create(x, y, x + 100, y + 100, x + 200, y, '#FF0000', null, 6, 1);
// 3. 读取修改前的颜色
const before = arc.getState_Color();
// 4. 切换异步模式并改为绿色
const asyncArc = arc.toAsync();
asyncArc.setState_Color('#00AA00');
await asyncArc.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveArc.get(arc.getState_PrimitiveId());
console.log('color:', before, '→', refetched.getState_Color());
```
### setstate_endx
# ISCH\_PrimitiveArc.setState\_EndX() method
> 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.
Set the property state: end point X
## Signature
```typescript
function setState_EndX(endX: number): ISCH_PrimitiveArc;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
endX
</td><td>
number
</td><td>
End point X
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveArc](./ISCH_PrimitiveArc.md)
Arc primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆弧重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一段测试圆弧,终点 (x+200, y)(SCH 坐标单位 10mil)
const arc = await eda.sch_PrimitiveArc.create(x, y, x + 100, y + 100, x + 200, y, null, null, 6, 1);
// 3. 读取修改前的终点 X
const before = arc.getState_EndX();
// 4. 切换异步模式并将终点 X 右移 100(SCH 单位,约 25.4mm)
const asyncArc = arc.toAsync();
asyncArc.setState_EndX(x + 300);
await asyncArc.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveArc.get(arc.getState_PrimitiveId());
console.log('endX:', before, '→', refetched.getState_EndX());
```
### setstate_endy
# ISCH\_PrimitiveArc.setState\_EndY() method
> 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.
Set the property state: end point Y
## Signature
```typescript
function setState_EndY(endY: number): ISCH_PrimitiveArc;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
endY
</td><td>
number
</td><td>
End point Y
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveArc](./ISCH_PrimitiveArc.md)
Arc primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆弧重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一段测试圆弧,终点 (x+200, y)(SCH 坐标单位 10mil)
const arc = await eda.sch_PrimitiveArc.create(x, y, x + 100, y + 100, x + 200, y, null, null, 6, 1);
// 3. 读取修改前的终点 Y
const before = arc.getState_EndY();
// 4. 切换异步模式并将终点 Y 下移 80(SCH 单位,约 20.3mm)
const asyncArc = arc.toAsync();
asyncArc.setState_EndY(y + 80);
await asyncArc.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveArc.get(arc.getState_PrimitiveId());
console.log('endY:', before, '→', refetched.getState_EndY());
```
### setstate_fillcolor
# ISCH\_PrimitiveArc.setState\_FillColor() method
> 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.
Set the property state: fill color
## Signature
```typescript
function setState_FillColor(fillColor: string | null): ISCH_PrimitiveArc;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fillColor
</td><td>
string \| null
</td><td>
Fill color
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveArc](./ISCH_PrimitiveArc.md)
Arc primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆弧重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一段带浅蓝填充的测试圆弧(SCH 坐标单位 10mil)
const arc = await eda.sch_PrimitiveArc.create(x, y, x + 100, y + 100, x + 200, y, null, '#DDEEFF', 6, 1);
// 3. 读取修改前的填充颜色
const before = arc.getState_FillColor();
// 4. 切换异步模式并改为浅黄填充
const asyncArc = arc.toAsync();
asyncArc.setState_FillColor('#FFE9A0');
await asyncArc.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveArc.get(arc.getState_PrimitiveId());
console.log('fillColor:', before, '→', refetched.getState_FillColor());
```
### setstate_linetype
# ISCH\_PrimitiveArc.setState\_LineType() method
> 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.
Set the property state: line type
## Signature
```typescript
function setState_LineType(lineType: ESCH_PrimitiveLineType | null): ISCH_PrimitiveArc;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
lineType
</td><td>
[ESCH\_PrimitiveLineType](../enums/ESCH_PrimitiveLineType.md) \| null
</td><td>
Line type
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveArc](./ISCH_PrimitiveArc.md)
Arc primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆弧重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一段虚线(DASHED=1)测试圆弧(SCH 坐标单位 10mil)
const arc = await eda.sch_PrimitiveArc.create(x, y, x + 100, y + 100, x + 200, y, null, null, 6, 1);
// 3. 读取修改前的线型
const before = arc.getState_LineType();
// 4. 切换异步模式并改为点线(DOTTED=2)
const asyncArc = arc.toAsync();
asyncArc.setState_LineType(2);
await asyncArc.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveArc.get(arc.getState_PrimitiveId());
console.log('lineType:', before, '→', refetched.getState_LineType());
```
### setstate_linewidth
# ISCH\_PrimitiveArc.setState\_LineWidth() method
> 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.
Set the property state: Line width
## Signature
```typescript
function setState_LineWidth(lineWidth: number | null): ISCH_PrimitiveArc;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
lineWidth
</td><td>
number \| null
</td><td>
Line width
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveArc](./ISCH_PrimitiveArc.md)
Arc primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆弧重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一段线宽 6 的测试圆弧(SCH 坐标单位 10mil)
const arc = await eda.sch_PrimitiveArc.create(x, y, x + 100, y + 100, x + 200, y, null, null, 6, 1);
// 3. 读取修改前的线宽
const before = arc.getState_LineWidth();
// 4. 切换异步模式并加粗到 12
const asyncArc = arc.toAsync();
asyncArc.setState_LineWidth(12);
await asyncArc.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveArc.get(arc.getState_PrimitiveId());
console.log('lineWidth:', before, '→', refetched.getState_LineWidth());
```
### setstate_referencex
# ISCH\_PrimitiveArc.setState\_ReferenceX() method
> 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.
Set the property state: reference point X
## Signature
```typescript
function setState_ReferenceX(referenceX: number): ISCH_PrimitiveArc;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
referenceX
</td><td>
number
</td><td>
Reference point X
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveArc](./ISCH_PrimitiveArc.md)
Arc primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆弧重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一段测试圆弧,参考点 (x+100, y+100)(SCH 坐标单位 10mil)
const arc = await eda.sch_PrimitiveArc.create(x, y, x + 100, y + 100, x + 200, y, null, null, 6, 1);
// 3. 读取修改前的参考点 X
const before = arc.getState_ReferenceX();
// 4. 切换异步模式并将参考点 X 右移 60,弧的弯曲程度随之变化
const asyncArc = arc.toAsync();
asyncArc.setState_ReferenceX(x + 160);
await asyncArc.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveArc.get(arc.getState_PrimitiveId());
console.log('referenceX:', before, '→', refetched.getState_ReferenceX());
```
### setstate_referencey
# ISCH\_PrimitiveArc.setState\_ReferenceY() method
> 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.
Set the property state: reference point Y
## Signature
```typescript
function setState_ReferenceY(referenceY: number): ISCH_PrimitiveArc;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
referenceY
</td><td>
number
</td><td>
Reference point Y
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveArc](./ISCH_PrimitiveArc.md)
Arc primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆弧重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一段测试圆弧,参考点 (x+100, y+100)(SCH 坐标单位 10mil)
const arc = await eda.sch_PrimitiveArc.create(x, y, x + 100, y + 100, x + 200, y, null, null, 6, 1);
// 3. 读取修改前的参考点 Y
const before = arc.getState_ReferenceY();
// 4. 切换异步模式并将参考点 Y 下移 60,弧的开口方向随之变化
const asyncArc = arc.toAsync();
asyncArc.setState_ReferenceY(y + 160);
await asyncArc.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveArc.get(arc.getState_PrimitiveId());
console.log('referenceY:', before, '→', refetched.getState_ReferenceY());
```
### setstate_startx
# ISCH\_PrimitiveArc.setState\_StartX() method
> 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.
Set the property state: start point X
## Signature
```typescript
function setState_StartX(startX: number): ISCH_PrimitiveArc;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
startX
</td><td>
number
</td><td>
Start point X
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveArc](./ISCH_PrimitiveArc.md)
Arc primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆弧重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一段测试圆弧,起点 (x, y)(SCH 坐标单位 10mil)
const arc = await eda.sch_PrimitiveArc.create(x, y, x + 100, y + 100, x + 200, y, null, null, 6, 1);
// 3. 读取修改前的起点 X
const before = arc.getState_StartX();
// 4. 切换异步模式并将起点 X 左移 60
const asyncArc = arc.toAsync();
asyncArc.setState_StartX(x - 60);
await asyncArc.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveArc.get(arc.getState_PrimitiveId());
console.log('startX:', before, '→', refetched.getState_StartX());
```
### setstate_starty
# ISCH\_PrimitiveArc.setState\_StartY() method
> 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.
Set the property state: start point Y
## Signature
```typescript
function setState_StartY(startY: number): ISCH_PrimitiveArc;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
startY
</td><td>
number
</td><td>
Start point Y
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveArc](./ISCH_PrimitiveArc.md)
Arc primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆弧重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一段测试圆弧,起点 (x, y)(SCH 坐标单位 10mil)
const arc = await eda.sch_PrimitiveArc.create(x, y, x + 100, y + 100, x + 200, y, null, null, 6, 1);
// 3. 读取修改前的起点 Y
const before = arc.getState_StartY();
// 4. 切换异步模式并将起点 Y 上移 60
const asyncArc = arc.toAsync();
asyncArc.setState_StartY(y - 60);
await asyncArc.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveArc.get(arc.getState_PrimitiveId());
console.log('startY:', before, '→', refetched.getState_StartY());
```
### toasync
# ISCH\_PrimitiveArc.toAsync() method
Convert Primitive to Async primitive
## Signature
```typescript
function toAsync(): ISCH_PrimitiveArc;
```
## Returns
[ISCH\_PrimitiveArc](./ISCH_PrimitiveArc.md)
Arc primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆弧重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一段测试圆弧,切换到同步模式,让模式变化可观察
const arc = await eda.sch_PrimitiveArc.create(x, y, x + 100, y + 100, x + 200, y, null, null, 6, 1);
arc.toSync();
// 3. 转换为异步图元
const asyncArc = arc.toAsync();
// 4. 异步模式下累计修改并提交
asyncArc.setState_LineWidth(12);
await asyncArc.done();
// 5. 从画布重新读取,确认提交生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveArc.get(arc.getState_PrimitiveId());
console.log('isAsync after toAsync:', arc.isAsync());
console.log('lineWidth:', 6, '→', refetched.getState_LineWidth());
```
### tosync
# ISCH\_PrimitiveArc.toSync() method
Convert Primitive to Sync primitive
## Signature
```typescript
function toSync(): ISCH_PrimitiveArc;
```
## Returns
[ISCH\_PrimitiveArc](./ISCH_PrimitiveArc.md)
Arc primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆弧重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一段测试圆弧(创建后默认处于异步模式)
const arc = await eda.sch_PrimitiveArc.create(x, y, x + 100, y + 100, x + 200, y, null, null, 6, 1);
// 3. 转换为同步图元
const syncArc = arc.toSync();
// 4. 同步模式下修改终点 X,立即生效,无需 done()
syncArc.setState_EndX(x + 300);
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveArc.get(arc.getState_PrimitiveId());
console.log('isAsync after toSync:', arc.isAsync());
console.log('endX:', x + 200, '→', refetched.getState_EndX());
```
references/classes/IPCB_PrimitiveVia.md
# IPCB\_PrimitiveVia class
Via primitive
## Signature
```typescript
class IPCB_PrimitiveVia implements IPCB_Primitive
```
**Implements:** [IPCB\_Primitive](../interfaces/IPCB_Primitive.md)
## Remarks
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[done()](./IPCB_PrimitiveVia.md)
</td><td>
</td><td>
**_(BETA)_** Apply the changes to the primitives to the canvas
</td></tr>
<tr><td>
[getAdjacentPrimitives()](./IPCB_PrimitiveVia.md)
</td><td>
</td><td>
**_(BETA)_** Get Adjacent primitive objects
</td></tr>
<tr><td>
[getState\_DesignRuleBlindViaName()](./IPCB_PrimitiveVia.md)
</td><td>
</td><td>
Get the property state: blind/buried via design rule item name
</td></tr>
<tr><td>
[getState\_Diameter()](./IPCB_PrimitiveVia.md)
</td><td>
</td><td>
Get the property state: outer diameter
</td></tr>
<tr><td>
[getState\_HoleDiameter()](./IPCB_PrimitiveVia.md)
</td><td>
</td><td>
Get the property state: hole diameter
</td></tr>
<tr><td>
[getState\_Net()](./IPCB_PrimitiveVia.md)
</td><td>
</td><td>
Get the property state: net name
</td></tr>
<tr><td>
[getState\_PrimitiveId()](./IPCB_PrimitiveVia.md)
</td><td>
</td><td>
Get the property state: primitive ID
</td></tr>
<tr><td>
[getState\_PrimitiveLock()](./IPCB_PrimitiveVia.md)
</td><td>
</td><td>
Get the property state: whether it is locked
</td></tr>
<tr><td>
[getState\_PrimitiveType()](./IPCB_PrimitiveVia.md)
</td><td>
</td><td>
Get the property state: primitive type
</td></tr>
<tr><td>
[getState\_SolderMaskExpansion()](./IPCB_PrimitiveVia.md)
</td><td>
</td><td>
Get the property state: solder mask / paste mask expansion
</td></tr>
<tr><td>
[getState\_ViaType()](./IPCB_PrimitiveVia.md)
</td><td>
</td><td>
Get the property state: via type
</td></tr>
<tr><td>
[getState\_X()](./IPCB_PrimitiveVia.md)
</td><td>
</td><td>
Get the property state: X coordinate
</td></tr>
<tr><td>
[getState\_Y()](./IPCB_PrimitiveVia.md)
</td><td>
</td><td>
Get the property state: Y coordinate
</td></tr>
<tr><td>
[isAsync()](./IPCB_PrimitiveVia.md)
</td><td>
</td><td>
Query whether the primitive is an async primitive
</td></tr>
<tr><td>
[reset()](./IPCB_PrimitiveVia.md)
</td><td>
</td><td>
**_(BETA)_** Reset the async primitive to the current canvas state
</td></tr>
<tr><td>
[setState\_DesignRuleBlindViaName(designRuleBlindViaName)](./IPCB_PrimitiveVia.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: blind/buried via design rule item name
</td></tr>
<tr><td>
[setState\_Diameter(diameter)](./IPCB_PrimitiveVia.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: outer diameter
</td></tr>
<tr><td>
[setState\_HoleDiameter(holeDiameter)](./IPCB_PrimitiveVia.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: hole diameter
</td></tr>
<tr><td>
[setState\_Net(net)](./IPCB_PrimitiveVia.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: net name
</td></tr>
<tr><td>
[setState\_PrimitiveLock(primitiveLock)](./IPCB_PrimitiveVia.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: whether it is locked
</td></tr>
<tr><td>
[setState\_SolderMaskExpansion(solderMaskExpansion)](./IPCB_PrimitiveVia.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: solder mask / paste mask expansion
</td></tr>
<tr><td>
[setState\_ViaType(viaType)](./IPCB_PrimitiveVia.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: via type
</td></tr>
<tr><td>
[setState\_X(x)](./IPCB_PrimitiveVia.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: X coordinate
</td></tr>
<tr><td>
[setState\_Y(y)](./IPCB_PrimitiveVia.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Y coordinate
</td></tr>
<tr><td>
[toAsync()](./IPCB_PrimitiveVia.md)
</td><td>
</td><td>
Convert Primitive to Async primitive
</td></tr>
<tr><td>
[toSync()](./IPCB_PrimitiveVia.md)
</td><td>
</td><td>
Convert Primitive to Sync primitive
</td></tr>
</tbody></table>
---
## 方法详情
### done
# IPCB\_PrimitiveVia.done() method
> 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.
Apply the changes to the primitives to the canvas
## Signature
```typescript
function done(): Promise<IPCB_PrimitiveVia>;
```
## Returns
Promise<[IPCB\_PrimitiveVia](./IPCB_PrimitiveVia.md)<!-- -->>
Via primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个孔径 20mil、外径 40mil 的测试过孔
const x = 3000 + Math.floor(Math.random() * 100000);
const via = await eda.pcb_PrimitiveVia.create('', x, 3000, 20, 40);
// 2. 异步模式下连续修改外径和挂网络(此时画布尚未变化)
const a = via.toAsync();
a.setState_Diameter(60);
a.setState_Net('GND');
// 3. 一次性提交到画布
await a.done();
// 4. 从画布重新读取,确认两处修改都已生效(保留现场供观察)
const ref = await eda.pcb_PrimitiveVia.get(via.getState_PrimitiveId());
console.log('diameter:', 40, '→', ref.getState_Diameter());
console.log('net:', '', '→', ref.getState_Net());
```
### getadjacentprimitives
# IPCB\_PrimitiveVia.getAdjacentPrimitives() method
> 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.
Get Adjacent primitive objects
## Signature
```typescript
function getAdjacentPrimitives(): Promise<Array<IPCB_PrimitiveLine | IPCB_PrimitiveArc>>;
```
## Returns
Promise<Array<[IPCB\_PrimitiveLine](./IPCB_PrimitiveLine.md) \| [IPCB\_PrimitiveArc](./IPCB_PrimitiveArc.md)<!-- -->>>
Adjacent wire and arc-line primitive objects
## Remarks
It will get the wire and arc-line primitive objects directly connected to the via
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个测试过孔
const x = 3000 + Math.floor(Math.random() * 100000);
const via = await eda.pcb_PrimitiveVia.create('', x, 3000, 20, 40);
// 2. 在过孔两侧各拉一条顶层导线,端点落在过孔中心构成连接
const line1 = await eda.pcb_PrimitiveLine.create('', 1, x - 600, 3000, x, 3000, 10);
const line2 = await eda.pcb_PrimitiveLine.create('', 1, x, 3000, x + 600, 3000, 10);
// 3. 获取与过孔直接相连的图元,并读出各自的类型
const adjacent = await via.getAdjacentPrimitives();
// 4. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveVia.delete([via.getState_PrimitiveId()]);
await eda.pcb_PrimitiveLine.delete([line1.getState_PrimitiveId(), line2.getState_PrimitiveId()]);
console.log('adjacent count:', adjacent.length);
adjacent.forEach((p, i) => {
console.log(`adjacent[${i}] type:`, p.getState_PrimitiveType());
});
```
### getstate_designruleblindvianame
# IPCB\_PrimitiveVia.getState\_DesignRuleBlindViaName() method
Get the property state: blind/buried via design rule item name
## Signature
```typescript
function getState_DesignRuleBlindViaName(): string | null;
```
## Returns
string \| null
Blind/buried via design rule item name
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个普通通孔(无设计规则项)
const x = 3000 + Math.floor(Math.random() * 100000);
const via = await eda.pcb_PrimitiveVia.create('', x, 3000, 20, 40);
const before = via.getState_DesignRuleBlindViaName();
// 2. 异步模式下设置一个规则项名称并提交
const a = via.toAsync();
a.setState_DesignRuleBlindViaName('嘉立创示例_盲孔');
await a.done();
// 3. 名称需与设计规则中的盲埋孔项匹配才落画布,未匹配时从图元对象本地读取
const after = via.getState_DesignRuleBlindViaName();
// 4. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveVia.delete([via.getState_PrimitiveId()]);
console.log('designRuleBlindViaName:', before, '→', after);
```
### getstate_diameter
# IPCB\_PrimitiveVia.getState\_Diameter() method
Get the property state: outer diameter
## Signature
```typescript
function getState_Diameter(): number;
```
## Returns
number
Outer diameter
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个外径 40mil 的测试过孔
const x = 3000 + Math.floor(Math.random() * 100000);
const via = await eda.pcb_PrimitiveVia.create('', x, 3000, 20, 40);
// 2. 读取外径属性
const diameter = via.getState_Diameter();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveVia.delete([via.getState_PrimitiveId()]);
console.log('diameter:', diameter);
```
### getstate_holediameter
# IPCB\_PrimitiveVia.getState\_HoleDiameter() method
Get the property state: hole diameter
## Signature
```typescript
function getState_HoleDiameter(): number;
```
## Returns
number
Hole diameter
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个孔径 20mil 的测试过孔
const x = 3000 + Math.floor(Math.random() * 100000);
const via = await eda.pcb_PrimitiveVia.create('', x, 3000, 20, 40);
// 2. 读取孔径属性
const holeDiameter = via.getState_HoleDiameter();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveVia.delete([via.getState_PrimitiveId()]);
console.log('holeDiameter:', holeDiameter);
```
### getstate_net
# IPCB\_PrimitiveVia.getState\_Net() method
Get the property state: net name
## Signature
```typescript
function getState_Net(): string;
```
## Returns
string
Net name
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个挂在 GND 网络的测试过孔
const x = 3000 + Math.floor(Math.random() * 100000);
const via = await eda.pcb_PrimitiveVia.create('GND', x, 3000, 20, 40);
// 2. 读取网络名称
const net = via.getState_Net();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveVia.delete([via.getState_PrimitiveId()]);
console.log('net:', net);
```
### getstate_primitiveid
# IPCB\_PrimitiveVia.getState\_PrimitiveId() method
Get the property state: primitive ID
## Signature
```typescript
function getState_PrimitiveId(): string;
```
## Returns
string
Primitive ID
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个测试过孔
const x = 3000 + Math.floor(Math.random() * 100000);
const via = await eda.pcb_PrimitiveVia.create('', x, 3000, 20, 40);
// 2. 读取图元 ID
const primitiveId = via.getState_PrimitiveId();
// 3. 用该 ID 从画布重新读取过孔,验证 ID 有效
const refetched = await eda.pcb_PrimitiveVia.get(primitiveId);
// 4. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveVia.delete([primitiveId]);
console.log('primitiveId:', primitiveId);
console.log('refetched type:', refetched.getState_PrimitiveType());
```
### getstate_primitivelock
# IPCB\_PrimitiveVia.getState\_PrimitiveLock() method
Get the property state: whether it is locked
## Signature
```typescript
function getState_PrimitiveLock(): boolean;
```
## Returns
boolean
Whether it is locked
## Example
```javascript
// 1. 生成本次运行专用的坐标,分别放置未锁定和已锁定的两个测试过孔
const x = 3000 + Math.floor(Math.random() * 100000);
const normal = await eda.pcb_PrimitiveVia.create('', x, 3000, 20, 40, 0, null, null, false);
const locked = await eda.pcb_PrimitiveVia.create('', x + 500, 3000, 20, 40, 0, null, null, true);
// 2. 分别读取锁定状态
const normalLock = normal.getState_PrimitiveLock();
const lockedLock = locked.getState_PrimitiveLock();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveVia.delete([normal.getState_PrimitiveId(), locked.getState_PrimitiveId()]);
console.log('normalLock:', normalLock);
console.log('lockedLock:', lockedLock);
```
### getstate_primitivetype
# IPCB\_PrimitiveVia.getState\_PrimitiveType() method
Get the property state: primitive type
## Signature
```typescript
function getState_PrimitiveType(): EPCB_PrimitiveType;
```
## Returns
[EPCB\_PrimitiveType](../enums/EPCB_PrimitiveType.md)
Primitive type
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个测试过孔
const x = 3000 + Math.floor(Math.random() * 100000);
const via = await eda.pcb_PrimitiveVia.create('', x, 3000, 20, 40);
// 2. 读取图元类型
const primitiveType = via.getState_PrimitiveType();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveVia.delete([via.getState_PrimitiveId()]);
console.log('primitiveType:', primitiveType);
```
### getstate_soldermaskexpansion
# IPCB\_PrimitiveVia.getState\_SolderMaskExpansion() method
Get the property state: solder mask / paste mask expansion
## Signature
```typescript
function getState_SolderMaskExpansion(): IPCB_PrimitiveSolderMaskAndPasteMaskExpansion | null;
```
## Returns
[IPCB\_PrimitiveSolderMaskAndPasteMaskExpansion](../interfaces/IPCB_PrimitiveSolderMaskAndPasteMaskExpansion.md) \| null
Solder mask / paste mask expansion
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个默认扩展(遵循规则)的测试过孔
const x = 3000 + Math.floor(Math.random() * 100000);
const plain = await eda.pcb_PrimitiveVia.create('', x, 3000, 20, 40);
const plainExpansion = plain.getState_SolderMaskExpansion();
// 2. 异步模式下给第二个过孔自定义顶层阻焊扩展并提交
const customized = await eda.pcb_PrimitiveVia.create('', x + 500, 3000, 20, 40);
const a = customized.toAsync();
a.setState_SolderMaskExpansion({ topSolderMask: 4 });
await a.done();
// 3. 从画布重新读取自定义扩展(未设置的底层项返回 null)
const customizedExpansion = customized.getState_SolderMaskExpansion();
// 4. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveVia.delete([plain.getState_PrimitiveId(), customized.getState_PrimitiveId()]);
console.log('plainExpansion:', plainExpansion);
console.log('customizedExpansion:', customizedExpansion);
```
### getstate_viatype
# IPCB\_PrimitiveVia.getState\_ViaType() method
Get the property state: via type
## Signature
```typescript
function getState_ViaType(): EPCB_PrimitiveViaType;
```
## Returns
[EPCB\_PrimitiveViaType](../enums/EPCB_PrimitiveViaType.md)
Via type
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个通孔类型的测试过孔
const x = 3000 + Math.floor(Math.random() * 100000);
const via = await eda.pcb_PrimitiveVia.create('', x, 3000, 20, 40);
const before = via.getState_ViaType();
// 2. 把第二个过孔切换为缝合孔类型后读取对比
const suture = await eda.pcb_PrimitiveVia.create('', x + 500, 3000, 20, 40);
const a = suture.toAsync();
a.setState_ViaType(2);
await a.done();
const sutureType = suture.getState_ViaType();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveVia.delete([via.getState_PrimitiveId(), suture.getState_PrimitiveId()]);
console.log('viaType:', before, '→', sutureType);
```
### getstate_x
# IPCB\_PrimitiveVia.getState\_X() method
Get the property state: X coordinate
## Signature
```typescript
function getState_X(): number;
```
## Returns
number
X coordinate
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个测试过孔
const x = 3000 + Math.floor(Math.random() * 100000);
const via = await eda.pcb_PrimitiveVia.create('', x, 3000, 20, 40);
// 2. 读取中心点横坐标
const viaX = via.getState_X();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveVia.delete([via.getState_PrimitiveId()]);
console.log('x:', viaX);
```
### getstate_y
# IPCB\_PrimitiveVia.getState\_Y() method
Get the property state: Y coordinate
## Signature
```typescript
function getState_Y(): number;
```
## Returns
number
Y coordinate
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个测试过孔
const x = 3000 + Math.floor(Math.random() * 100000);
const via = await eda.pcb_PrimitiveVia.create('', x, 5000, 20, 40);
// 2. 读取中心点纵坐标
const viaY = via.getState_Y();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveVia.delete([via.getState_PrimitiveId()]);
console.log('y:', viaY);
```
### isasync
# IPCB\_PrimitiveVia.isAsync() method
Query whether the primitive is an async primitive
## Signature
```typescript
function isAsync(): boolean;
```
## Returns
boolean
Whether Is async primitive
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个测试过孔
const x = 3000 + Math.floor(Math.random() * 100000);
const via = await eda.pcb_PrimitiveVia.create('', x, 3000, 20, 40);
// 2. 读取创建后的模式
const afterCreate = via.isAsync();
// 3. 切换模式再各读一次
const afterToSync = via.toSync().isAsync();
const afterToAsync = via.toAsync().isAsync();
// 4. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveVia.delete([via.getState_PrimitiveId()]);
console.log('afterCreate:', afterCreate);
console.log('afterToSync:', afterToSync);
console.log('afterToAsync:', afterToAsync);
```
### reset
# IPCB\_PrimitiveVia.reset() method
> 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.
Reset the async primitive to the current canvas state
## Signature
```typescript
function reset(): Promise<IPCB_PrimitiveVia>;
```
## Returns
Promise<[IPCB\_PrimitiveVia](./IPCB_PrimitiveVia.md)<!-- -->>
Via primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试过孔重合
const x = 3000 + Math.floor(Math.random() * 100000);
const via = await eda.pcb_PrimitiveVia.create('', x, 3000, 20, 40);
// 2. 切换异步模式,累计一处未提交的外径修改(40 → 99)
const asyncVia = via.toAsync();
asyncVia.setState_Diameter(99);
// 3. 重置:丢弃未提交的修改,回到画布当前状态
await asyncVia.reset();
// 4. 从画布重新读取,外径仍是 40(保留现场供观察)
const refetched = await eda.pcb_PrimitiveVia.get(via.getState_PrimitiveId());
console.log('diameter after reset:', refetched.getState_Diameter());
```
### setstate_designruleblindvianame
# IPCB\_PrimitiveVia.setState\_DesignRuleBlindViaName() method
> 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.
Set the property state: blind/buried via design rule item name
## Signature
```typescript
function setState_DesignRuleBlindViaName(designRuleBlindViaName: string | null): IPCB_PrimitiveVia;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
designRuleBlindViaName
</td><td>
string \| null
</td><td>
Blind/buried via design rule item name
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveVia](./IPCB_PrimitiveVia.md)
Via primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个普通通孔(无规则项名称)
const x = 3000 + Math.floor(Math.random() * 100000);
const via = await eda.pcb_PrimitiveVia.create('', x, 3000, 20, 40);
const before = via.getState_DesignRuleBlindViaName();
// 2. 异步模式下关联规则项名称并提交
const a = via.toAsync();
a.setState_DesignRuleBlindViaName('嘉立创示例_盲孔');
await a.done();
// 3. 名称需与设计规则中的盲埋孔项匹配才落画布,未匹配时从图元对象本地读取
const after = via.getState_DesignRuleBlindViaName();
// 4. 保留现场供观察
console.log('designRuleBlindViaName:', before, '→', after);
```
### setstate_diameter
# IPCB\_PrimitiveVia.setState\_Diameter() method
> 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.
Set the property state: outer diameter
## Signature
```typescript
function setState_Diameter(diameter: number): IPCB_PrimitiveVia;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
diameter
</td><td>
number
</td><td>
Outer diameter
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveVia](./IPCB_PrimitiveVia.md)
Via primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个外径 40mil 的测试过孔
const x = 3000 + Math.floor(Math.random() * 100000);
const via = await eda.pcb_PrimitiveVia.create('', x, 3000, 20, 40);
const before = via.getState_Diameter();
// 2. 异步模式下加大外径并提交
const a = via.toAsync();
a.setState_Diameter(60);
await a.done();
// 3. 从画布重新读取,确认外径已生效(保留现场供观察)
const ref = await eda.pcb_PrimitiveVia.get(via.getState_PrimitiveId());
console.log('diameter:', before, '→', ref.getState_Diameter());
```
### setstate_holediameter
# IPCB\_PrimitiveVia.setState\_HoleDiameter() method
> 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.
Set the property state: hole diameter
## Signature
```typescript
function setState_HoleDiameter(holeDiameter: number): IPCB_PrimitiveVia;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
holeDiameter
</td><td>
number
</td><td>
Hole diameter
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveVia](./IPCB_PrimitiveVia.md)
Via primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个孔径 20mil 的测试过孔
const x = 3000 + Math.floor(Math.random() * 100000);
const via = await eda.pcb_PrimitiveVia.create('', x, 3000, 20, 40);
const before = via.getState_HoleDiameter();
// 2. 异步模式下加大孔径并提交
const a = via.toAsync();
a.setState_HoleDiameter(28);
await a.done();
// 3. 从画布重新读取,确认孔径已生效(保留现场供观察)
const ref = await eda.pcb_PrimitiveVia.get(via.getState_PrimitiveId());
console.log('holeDiameter:', before, '→', ref.getState_HoleDiameter());
```
### setstate_net
# IPCB\_PrimitiveVia.setState\_Net() method
> 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.
Set the property state: net name
## Signature
```typescript
function setState_Net(net: string): IPCB_PrimitiveVia;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string
</td><td>
Net name
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveVia](./IPCB_PrimitiveVia.md)
Via primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个无网络的测试过孔
const x = 3000 + Math.floor(Math.random() * 100000);
const via = await eda.pcb_PrimitiveVia.create('', x, 3000, 20, 40);
const before = via.getState_Net();
// 2. 异步模式下挂到 GND 网络并提交
const a = via.toAsync();
a.setState_Net('GND');
await a.done();
// 3. 从画布重新读取,确认网络已生效(保留现场供观察)
const ref = await eda.pcb_PrimitiveVia.get(via.getState_PrimitiveId());
console.log('net:', before, '→', ref.getState_Net());
```
### setstate_primitivelock
# IPCB\_PrimitiveVia.setState\_PrimitiveLock() method
> 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.
Set the property state: whether it is locked
## Signature
```typescript
function setState_PrimitiveLock(primitiveLock: boolean): IPCB_PrimitiveVia;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveLock
</td><td>
boolean
</td><td>
Whether it is locked
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveVia](./IPCB_PrimitiveVia.md)
Via primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个未锁定的测试过孔
const x = 3000 + Math.floor(Math.random() * 100000);
const via = await eda.pcb_PrimitiveVia.create('', x, 3000, 20, 40);
const before = via.getState_PrimitiveLock();
// 2. 异步模式下锁定并提交
const a = via.toAsync();
a.setState_PrimitiveLock(true);
await a.done();
// 3. 从画布重新读取,确认锁定已生效(保留现场供观察)
const ref = await eda.pcb_PrimitiveVia.get(via.getState_PrimitiveId());
console.log('primitiveLock:', before, '→', ref.getState_PrimitiveLock());
```
### setstate_soldermaskexpansion
# IPCB\_PrimitiveVia.setState\_SolderMaskExpansion() method
> 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.
Set the property state: solder mask / paste mask expansion
## Signature
```typescript
function setState_SolderMaskExpansion(
solderMaskExpansion: IPCB_PrimitiveSolderMaskAndPasteMaskExpansion | null,
): IPCB_PrimitiveVia;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
solderMaskExpansion
</td><td>
[IPCB\_PrimitiveSolderMaskAndPasteMaskExpansion](../interfaces/IPCB_PrimitiveSolderMaskAndPasteMaskExpansion.md) \| null
</td><td>
Solder mask / paste mask expansion
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveVia](./IPCB_PrimitiveVia.md)
Via primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个默认扩展(遵循规则)的测试过孔
const x = 3000 + Math.floor(Math.random() * 100000);
const via = await eda.pcb_PrimitiveVia.create('', x, 3000, 20, 40);
const before = via.getState_SolderMaskExpansion();
// 2. 异步模式下自定义顶层阻焊扩展并提交
const a = via.toAsync();
a.setState_SolderMaskExpansion({ topSolderMask: 4 });
await a.done();
// 3. 从画布重新读取,确认扩展已生效(未设置的底层项返回 null)
const ref = await eda.pcb_PrimitiveVia.get(via.getState_PrimitiveId());
console.log('expansion:', before, '→', ref.getState_SolderMaskExpansion());
```
### setstate_viatype
# IPCB\_PrimitiveVia.setState\_ViaType() method
> 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.
Set the property state: via type
## Signature
```typescript
function setState_ViaType(viaType: EPCB_PrimitiveViaType): IPCB_PrimitiveVia;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
viaType
</td><td>
[EPCB\_PrimitiveViaType](../enums/EPCB_PrimitiveViaType.md)
</td><td>
Via type
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveVia](./IPCB_PrimitiveVia.md)
Via primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个通孔类型的测试过孔
const x = 3000 + Math.floor(Math.random() * 100000);
const via = await eda.pcb_PrimitiveVia.create('', x, 3000, 20, 40);
const before = via.getState_ViaType();
// 2. 异步模式下切换为缝合孔并提交
const a = via.toAsync();
a.setState_ViaType(2);
await a.done();
// 3. 从画布重新读取,确认类型已生效(保留现场供观察)
const ref = await eda.pcb_PrimitiveVia.get(via.getState_PrimitiveId());
console.log('viaType:', before, '→', ref.getState_ViaType());
```
### setstate_x
# IPCB\_PrimitiveVia.setState\_X() method
> 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.
Set the property state: X coordinate
## Signature
```typescript
function setState_X(x: number): IPCB_PrimitiveVia;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
x
</td><td>
number
</td><td>
X coordinate
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveVia](./IPCB_PrimitiveVia.md)
Via primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个测试过孔
const x = 3000 + Math.floor(Math.random() * 100000);
const via = await eda.pcb_PrimitiveVia.create('', x, 3000, 20, 40);
// 2. 异步模式下向右平移 300mil 并提交
const a = via.toAsync();
a.setState_X(x + 300);
await a.done();
// 3. 从画布重新读取,确认位置已生效(保留现场供观察)
const ref = await eda.pcb_PrimitiveVia.get(via.getState_PrimitiveId());
console.log('x:', x, '→', ref.getState_X());
```
### setstate_y
# IPCB\_PrimitiveVia.setState\_Y() method
> 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.
Set the property state: Y coordinate
## Signature
```typescript
function setState_Y(y: number): IPCB_PrimitiveVia;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
y
</td><td>
number
</td><td>
Y coordinate
</td></tr>
</tbody></table>
## Returns
[IPCB\_PrimitiveVia](./IPCB_PrimitiveVia.md)
Via primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个测试过孔
const x = 3000 + Math.floor(Math.random() * 100000);
const via = await eda.pcb_PrimitiveVia.create('', x, 3000, 20, 40);
// 2. 异步模式下向上平移 300mil 并提交
const a = via.toAsync();
a.setState_Y(3300);
await a.done();
// 3. 从画布重新读取,确认位置已生效(保留现场供观察)
const ref = await eda.pcb_PrimitiveVia.get(via.getState_PrimitiveId());
console.log('y:', 3000, '→', ref.getState_Y());
```
### toasync
# IPCB\_PrimitiveVia.toAsync() method
Convert Primitive to Async primitive
## Signature
```typescript
function toAsync(): IPCB_PrimitiveVia;
```
## Returns
[IPCB\_PrimitiveVia](./IPCB_PrimitiveVia.md)
Via primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,放置一个测试过孔
const x = 3000 + Math.floor(Math.random() * 100000);
const via = await eda.pcb_PrimitiveVia.create('', x, 3000, 20, 40);
// 2. 切换为异步图元(返回同一图元的异步形态)
const asyncVia = via.toAsync();
// 3. 在异步模式下平移位置并提交
asyncVia.setState_X(x + 200);
await asyncVia.done();
// 4. 从画布重新读取,确认修改已落画布(保留现场供观察)
const ref = await eda.pcb_PrimitiveVia.get(via.getState_PrimitiveId());
console.log('isAsync:', asyncVia.isAsync());
console.log('x:', x, '→', ref.getState_X());
```
### tosync
# IPCB\_PrimitiveVia.toSync() method
Convert Primitive to Sync primitive
## Signature
```typescript
function toSync(): IPCB_PrimitiveVia;
```
## Returns
[IPCB\_PrimitiveVia](./IPCB_PrimitiveVia.md)
Via primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试过孔重合
const x = 3000 + Math.floor(Math.random() * 100000);
const via = await eda.pcb_PrimitiveVia.create('', x, 3000, 20, 40);
// 2. 转换为同步图元
const syncVia = via.toSync();
// 3. 同步模式下加大外径,立即生效(无需 done())
syncVia.setState_Diameter(55);
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.pcb_PrimitiveVia.get(via.getState_PrimitiveId());
console.log('isSync after toSync:', !syncVia.isAsync());
console.log('diameter:', 40, '→', refetched.getState_Diameter());
```
references/classes/ISCH_PrimitiveCircle.md
# ISCH\_PrimitiveCircle class
Circle primitive
## Signature
```typescript
class ISCH_PrimitiveCircle implements ISCH_Primitive
```
**Implements:** [ISCH\_Primitive](../interfaces/ISCH_Primitive.md)
## Remarks
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[done()](./ISCH_PrimitiveCircle.md)
</td><td>
</td><td>
**_(BETA)_** Apply the changes to the primitives to the canvas
</td></tr>
<tr><td>
[getState\_CenterX()](./ISCH_PrimitiveCircle.md)
</td><td>
</td><td>
Get the property state: center of the circle X
</td></tr>
<tr><td>
[getState\_CenterY()](./ISCH_PrimitiveCircle.md)
</td><td>
</td><td>
Get the property state: center of the circle Y
</td></tr>
<tr><td>
[getState\_Color()](./ISCH_PrimitiveCircle.md)
</td><td>
</td><td>
Get the property state: color
</td></tr>
<tr><td>
[getState\_FillColor()](./ISCH_PrimitiveCircle.md)
</td><td>
</td><td>
Get the property state: fill color
</td></tr>
<tr><td>
[getState\_FillStyle()](./ISCH_PrimitiveCircle.md)
</td><td>
</td><td>
Get the property state: fill style
</td></tr>
<tr><td>
[getState\_LineType()](./ISCH_PrimitiveCircle.md)
</td><td>
</td><td>
Get the property state: line type
</td></tr>
<tr><td>
[getState\_LineWidth()](./ISCH_PrimitiveCircle.md)
</td><td>
</td><td>
Get the property state: Line width
</td></tr>
<tr><td>
[getState\_PrimitiveId()](./ISCH_PrimitiveCircle.md)
</td><td>
</td><td>
Get the property state: primitive ID
</td></tr>
<tr><td>
[getState\_PrimitiveType()](./ISCH_PrimitiveCircle.md)
</td><td>
</td><td>
Get the property state: primitive type
</td></tr>
<tr><td>
[getState\_Radius()](./ISCH_PrimitiveCircle.md)
</td><td>
</td><td>
Get the property state: radius
</td></tr>
<tr><td>
[isAsync()](./ISCH_PrimitiveCircle.md)
</td><td>
</td><td>
Query whether the primitive is an async primitive
</td></tr>
<tr><td>
[reset()](./ISCH_PrimitiveCircle.md)
</td><td>
</td><td>
**_(BETA)_** Reset the async primitive to the current canvas state
</td></tr>
<tr><td>
[setState\_CenterX(centerX)](./ISCH_PrimitiveCircle.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: center of the circle X
</td></tr>
<tr><td>
[setState\_CenterY(centerY)](./ISCH_PrimitiveCircle.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: center of the circle Y
</td></tr>
<tr><td>
[setState\_Color(color)](./ISCH_PrimitiveCircle.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: color
</td></tr>
<tr><td>
[setState\_FillColor(fillColor)](./ISCH_PrimitiveCircle.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: fill color
</td></tr>
<tr><td>
[setState\_FillStyle(fillStyle)](./ISCH_PrimitiveCircle.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: fill style
</td></tr>
<tr><td>
[setState\_LineType(lineType)](./ISCH_PrimitiveCircle.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: line type
</td></tr>
<tr><td>
[setState\_LineWidth(lineWidth)](./ISCH_PrimitiveCircle.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Line width
</td></tr>
<tr><td>
[setState\_Radius(radius)](./ISCH_PrimitiveCircle.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: radius
</td></tr>
<tr><td>
[toAsync()](./ISCH_PrimitiveCircle.md)
</td><td>
</td><td>
Convert Primitive to Async primitive
</td></tr>
<tr><td>
[toSync()](./ISCH_PrimitiveCircle.md)
</td><td>
</td><td>
Convert Primitive to Sync primitive
</td></tr>
</tbody></table>
---
## 方法详情
### done
# ISCH\_PrimitiveCircle.done() method
> 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.
Apply the changes to the primitives to the canvas
## Signature
```typescript
function done(): Promise<ISCH_PrimitiveCircle>;
```
## Returns
Promise<[ISCH\_PrimitiveCircle](./ISCH_PrimitiveCircle.md)<!-- -->>
Circle primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个测试圆,圆心 (x, y)、半径 150(SCH 坐标单位 10mil)
const circle = await eda.sch_PrimitiveCircle.create(x, y, 150);
// 3. 切换异步模式,累计两处修改(半径扩大 + 改颜色)
const asyncCircle = circle.toAsync();
asyncCircle.setState_Radius(250);
asyncCircle.setState_Color('#00AA00');
// 4. 一次性提交到画布
await asyncCircle.done();
// 5. 从画布重新读取,确认两处修改都已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveCircle.get(circle.getState_PrimitiveId());
console.log('radius:', 150, '→', refetched.getState_Radius());
console.log('color:', '#00AA00', '→', refetched.getState_Color());
```
### getstate_centerx
# ISCH\_PrimitiveCircle.getState\_CenterX() method
Get the property state: center of the circle X
## Signature
```typescript
function getState_CenterX(): number;
```
## Returns
number
Center of the circle X
## Example
```javascript
// 1. 创建一个测试圆,圆心 (400, 300)、半径 150(SCH 坐标单位 10mil)
const circle = await eda.sch_PrimitiveCircle.create(400, 300, 150);
// 2. 读取圆心 X
const centerX = circle.getState_CenterX();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveCircle.delete([circle.getState_PrimitiveId()]);
console.log('centerX:', centerX);
```
### getstate_centery
# ISCH\_PrimitiveCircle.getState\_CenterY() method
Get the property state: center of the circle Y
## Signature
```typescript
function getState_CenterY(): number;
```
## Returns
number
Center of the circle Y
## Example
```javascript
// 1. 创建一个测试圆,圆心 (400, 300)、半径 150(SCH 坐标单位 10mil)
const circle = await eda.sch_PrimitiveCircle.create(400, 300, 150);
// 2. 读取圆心 Y
const centerY = circle.getState_CenterY();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveCircle.delete([circle.getState_PrimitiveId()]);
console.log('centerY:', centerY);
```
### getstate_color
# ISCH\_PrimitiveCircle.getState\_Color() method
Get the property state: color
## Signature
```typescript
function getState_Color(): string | null;
```
## Returns
string \| null
Color
## Example
```javascript
// 1. 创建一个红色轮廓的测试圆(SCH 坐标单位 10mil)
const circle = await eda.sch_PrimitiveCircle.create(400, 300, 150, '#FF0000');
// 2. 读取轮廓颜色
const color = circle.getState_Color();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveCircle.delete([circle.getState_PrimitiveId()]);
console.log('color:', color);
```
### getstate_fillcolor
# ISCH\_PrimitiveCircle.getState\_FillColor() method
Get the property state: fill color
## Signature
```typescript
function getState_FillColor(): string | null;
```
## Returns
string \| null
Fill color
## Example
```javascript
// 1. 创建一个带填充色的测试圆:轮廓红、填充黄(SCH 坐标单位 10mil)
const circle = await eda.sch_PrimitiveCircle.create(400, 300, 150, '#FF0000', '#FFEC8B');
// 2. 读取填充颜色
const fillColor = circle.getState_FillColor();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveCircle.delete([circle.getState_PrimitiveId()]);
console.log('fillColor:', fillColor);
```
### getstate_fillstyle
# ISCH\_PrimitiveCircle.getState\_FillStyle() method
Get the property state: fill style
## Signature
```typescript
function getState_FillStyle(): ESCH_PrimitiveFillStyle | null;
```
## Returns
[ESCH\_PrimitiveFillStyle](../enums/ESCH_PrimitiveFillStyle.md) \| null
Fill style
## Example
```javascript
// 1. 创建一个实心填充的测试圆(fillStyle 传字符串枚举,如 'Solid')
const circle = await eda.sch_PrimitiveCircle.create(400, 300, 150, '#FF0000', '#FFEC8B', 6, 0, 'Solid');
// 2. 读取填充样式
const fillStyle = circle.getState_FillStyle();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveCircle.delete([circle.getState_PrimitiveId()]);
console.log('fillStyle:', fillStyle);
```
### getstate_linetype
# ISCH\_PrimitiveCircle.getState\_LineType() method
Get the property state: line type
## Signature
```typescript
function getState_LineType(): ESCH_PrimitiveLineType | null;
```
## Returns
[ESCH\_PrimitiveLineType](../enums/ESCH_PrimitiveLineType.md) \| null
Line type
## Example
```javascript
// 1. 创建一个虚线轮廓的测试圆(lineType 传数字枚举,1 = DASHED)
const circle = await eda.sch_PrimitiveCircle.create(400, 300, 150, '#FF0000', null, 6, 1);
// 2. 读取线型
const lineType = circle.getState_LineType();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveCircle.delete([circle.getState_PrimitiveId()]);
console.log('lineType:', lineType);
```
### getstate_linewidth
# ISCH\_PrimitiveCircle.getState\_LineWidth() method
Get the property state: Line width
## Signature
```typescript
function getState_LineWidth(): number | null;
```
## Returns
number \| null
Line width
## Example
```javascript
// 1. 创建一个线宽 6 的测试圆(SCH 坐标单位 10mil)
const circle = await eda.sch_PrimitiveCircle.create(400, 300, 150, '#FF0000', null, 6, 0);
// 2. 读取线宽
const lineWidth = circle.getState_LineWidth();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveCircle.delete([circle.getState_PrimitiveId()]);
console.log('lineWidth:', lineWidth);
```
### getstate_primitiveid
# ISCH\_PrimitiveCircle.getState\_PrimitiveId() method
Get the property state: primitive ID
## Signature
```typescript
function getState_PrimitiveId(): string;
```
## Returns
string
Primitive ID
## Example
```javascript
// 1. 创建一个测试圆(SCH 坐标单位 10mil)
const circle = await eda.sch_PrimitiveCircle.create(400, 300, 150);
// 2. 读取图元 ID
const primitiveId = circle.getState_PrimitiveId();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveCircle.delete([circle.getState_PrimitiveId()]);
console.log('primitiveId:', primitiveId);
```
### getstate_primitivetype
# ISCH\_PrimitiveCircle.getState\_PrimitiveType() method
Get the property state: primitive type
## Signature
```typescript
function getState_PrimitiveType(): ESCH_PrimitiveType;
```
## Returns
[ESCH\_PrimitiveType](../enums/ESCH_PrimitiveType.md)
Primitive type
## Example
```javascript
// 1. 创建一个测试圆(SCH 坐标单位 10mil)
const circle = await eda.sch_PrimitiveCircle.create(400, 300, 150);
// 2. 读取图元类型
const primitiveType = circle.getState_PrimitiveType();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveCircle.delete([circle.getState_PrimitiveId()]);
console.log('primitiveType:', primitiveType);
```
### getstate_radius
# ISCH\_PrimitiveCircle.getState\_Radius() method
Get the property state: radius
## Signature
```typescript
function getState_Radius(): number;
```
## Returns
number
Radius
## Example
```javascript
// 1. 创建一个半径 150 的测试圆(SCH 坐标单位 10mil)
const circle = await eda.sch_PrimitiveCircle.create(400, 300, 150);
// 2. 读取半径
const radius = circle.getState_Radius();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveCircle.delete([circle.getState_PrimitiveId()]);
console.log('radius:', radius);
```
### isasync
# ISCH\_PrimitiveCircle.isAsync() method
Query whether the primitive is an async primitive
## Signature
```typescript
function isAsync(): boolean;
```
## Returns
boolean
Whether Is async primitive
## Example
```javascript
// 1. 创建一个测试圆,创建后默认处于异步模式
const circle = await eda.sch_PrimitiveCircle.create(400, 300, 150);
const asyncOnCreate = circle.isAsync();
// 2. 切换到同步模式再查询一次,对比两种模式
circle.toSync();
const asyncAfterToSync = circle.isAsync();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveCircle.delete([circle.getState_PrimitiveId()]);
console.log('isAsync on create:', asyncOnCreate);
console.log('isAsync after toSync:', asyncAfterToSync);
```
### reset
# ISCH\_PrimitiveCircle.reset() method
> 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.
Reset the async primitive to the current canvas state
## Signature
```typescript
function reset(): Promise<ISCH_PrimitiveCircle>;
```
## Returns
Promise<[ISCH\_PrimitiveCircle](./ISCH_PrimitiveCircle.md)<!-- -->>
Circle primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个线宽 6 的测试圆(SCH 坐标单位 10mil)
const circle = await eda.sch_PrimitiveCircle.create(x, y, 150, '#FF0000', null, 6, 0);
// 3. 切换异步模式,累计一处未提交的线宽修改(6 → 99)
const asyncCircle = circle.toAsync();
asyncCircle.setState_LineWidth(99);
// 4. 重置:丢弃未提交的修改,回到画布当前状态
await asyncCircle.reset();
// 5. 从画布重新读取,线宽仍是 6(保留现场供观察)
const refetched = await eda.sch_PrimitiveCircle.get(circle.getState_PrimitiveId());
console.log('lineWidth after reset:', refetched.getState_LineWidth());
```
### setstate_centerx
# ISCH\_PrimitiveCircle.setState\_CenterX() method
> 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.
Set the property state: center of the circle X
## Signature
```typescript
function setState_CenterX(centerX: number): ISCH_PrimitiveCircle;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
centerX
</td><td>
number
</td><td>
Center of the circle X
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveCircle](./ISCH_PrimitiveCircle.md)
Circle primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个测试圆,圆心 (x, y)、半径 150(SCH 坐标单位 10mil)
const circle = await eda.sch_PrimitiveCircle.create(x, y, 150);
// 3. 切换异步模式并把圆心右移 200
const asyncCircle = circle.toAsync();
asyncCircle.setState_CenterX(x + 200);
await asyncCircle.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveCircle.get(circle.getState_PrimitiveId());
console.log('centerX:', x, '→', refetched.getState_CenterX());
```
### setstate_centery
# ISCH\_PrimitiveCircle.setState\_CenterY() method
> 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.
Set the property state: center of the circle Y
## Signature
```typescript
function setState_CenterY(centerY: number): ISCH_PrimitiveCircle;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
centerY
</td><td>
number
</td><td>
Center of the circle Y
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveCircle](./ISCH_PrimitiveCircle.md)
Circle primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个测试圆,圆心 (x, y)、半径 150(SCH 坐标单位 10mil)
const circle = await eda.sch_PrimitiveCircle.create(x, y, 150);
// 3. 切换异步模式并把圆心上移 200
const asyncCircle = circle.toAsync();
asyncCircle.setState_CenterY(y + 200);
await asyncCircle.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveCircle.get(circle.getState_PrimitiveId());
console.log('centerY:', y, '→', refetched.getState_CenterY());
```
### setstate_color
# ISCH\_PrimitiveCircle.setState\_Color() method
> 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.
Set the property state: color
## Signature
```typescript
function setState_Color(color: string | null): ISCH_PrimitiveCircle;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
color
</td><td>
string \| null
</td><td>
Color
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveCircle](./ISCH_PrimitiveCircle.md)
Circle primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个红色轮廓的测试圆(SCH 坐标单位 10mil)
const circle = await eda.sch_PrimitiveCircle.create(x, y, 150, '#FF0000');
// 3. 切换异步模式并改为绿色
const asyncCircle = circle.toAsync();
asyncCircle.setState_Color('#00AA00');
await asyncCircle.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveCircle.get(circle.getState_PrimitiveId());
console.log('color:', '#FF0000', '→', refetched.getState_Color());
```
### setstate_fillcolor
# ISCH\_PrimitiveCircle.setState\_FillColor() method
> 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.
Set the property state: fill color
## Signature
```typescript
function setState_FillColor(fillColor: string | null): ISCH_PrimitiveCircle;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fillColor
</td><td>
string \| null
</td><td>
Fill color
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveCircle](./ISCH_PrimitiveCircle.md)
Circle primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个黄色填充的测试圆(SCH 坐标单位 10mil)
const circle = await eda.sch_PrimitiveCircle.create(x, y, 150, '#FF0000', '#FFEC8B');
// 3. 切换异步模式并改为浅蓝填充
const asyncCircle = circle.toAsync();
asyncCircle.setState_FillColor('#A0D8EF');
await asyncCircle.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveCircle.get(circle.getState_PrimitiveId());
console.log('fillColor:', '#FFEC8B', '→', refetched.getState_FillColor());
```
### setstate_fillstyle
# ISCH\_PrimitiveCircle.setState\_FillStyle() method
> 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.
Set the property state: fill style
## Signature
```typescript
function setState_FillStyle(fillStyle: ESCH_PrimitiveFillStyle | null): ISCH_PrimitiveCircle;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fillStyle
</td><td>
[ESCH\_PrimitiveFillStyle](../enums/ESCH_PrimitiveFillStyle.md) \| null
</td><td>
Fill style
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveCircle](./ISCH_PrimitiveCircle.md)
Circle primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个实心填充的测试圆(fillStyle 传字符串枚举 'Solid')
const circle = await eda.sch_PrimitiveCircle.create(x, y, 150, '#FF0000', '#FFEC8B', 6, 0, 'Solid');
// 3. 切换异步模式并改为网格填充
const asyncCircle = circle.toAsync();
asyncCircle.setState_FillStyle('Grid');
await asyncCircle.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveCircle.get(circle.getState_PrimitiveId());
console.log('fillStyle:', 'Solid', '→', refetched.getState_FillStyle());
```
### setstate_linetype
# ISCH\_PrimitiveCircle.setState\_LineType() method
> 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.
Set the property state: line type
## Signature
```typescript
function setState_LineType(lineType: ESCH_PrimitiveLineType | null): ISCH_PrimitiveCircle;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
lineType
</td><td>
[ESCH\_PrimitiveLineType](../enums/ESCH_PrimitiveLineType.md) \| null
</td><td>
Line type
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveCircle](./ISCH_PrimitiveCircle.md)
Circle primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个实线轮廓的测试圆(lineType 0 = SOLID)
const circle = await eda.sch_PrimitiveCircle.create(x, y, 150, '#FF0000', null, 6, 0);
// 3. 切换异步模式并改为虚线
const asyncCircle = circle.toAsync();
asyncCircle.setState_LineType(1);
await asyncCircle.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveCircle.get(circle.getState_PrimitiveId());
console.log('lineType:', 0, '→', refetched.getState_LineType());
```
### setstate_linewidth
# ISCH\_PrimitiveCircle.setState\_LineWidth() method
> 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.
Set the property state: Line width
## Signature
```typescript
function setState_LineWidth(lineWidth: number | null): ISCH_PrimitiveCircle;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
lineWidth
</td><td>
number \| null
</td><td>
Line width
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveCircle](./ISCH_PrimitiveCircle.md)
Circle primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个线宽 6 的测试圆(SCH 坐标单位 10mil)
const circle = await eda.sch_PrimitiveCircle.create(x, y, 150, '#FF0000', null, 6, 0);
// 3. 切换异步模式并把线宽加粗到 10
const asyncCircle = circle.toAsync();
asyncCircle.setState_LineWidth(10);
await asyncCircle.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveCircle.get(circle.getState_PrimitiveId());
console.log('lineWidth:', 6, '→', refetched.getState_LineWidth());
```
### setstate_radius
# ISCH\_PrimitiveCircle.setState\_Radius() method
> 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.
Set the property state: radius
## Signature
```typescript
function setState_Radius(radius: number): ISCH_PrimitiveCircle;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
radius
</td><td>
number
</td><td>
Radius
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveCircle](./ISCH_PrimitiveCircle.md)
Circle primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个半径 150 的测试圆(SCH 坐标单位 10mil)
const circle = await eda.sch_PrimitiveCircle.create(x, y, 150);
// 3. 切换异步模式并把半径扩大到 250
const asyncCircle = circle.toAsync();
asyncCircle.setState_Radius(250);
await asyncCircle.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveCircle.get(circle.getState_PrimitiveId());
console.log('radius:', 150, '→', refetched.getState_Radius());
```
### toasync
# ISCH\_PrimitiveCircle.toAsync() method
Convert Primitive to Async primitive
## Signature
```typescript
function toAsync(): ISCH_PrimitiveCircle;
```
## Returns
[ISCH\_PrimitiveCircle](./ISCH_PrimitiveCircle.md)
Circle primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个测试圆(SCH 坐标单位 10mil)
const circle = await eda.sch_PrimitiveCircle.create(x, y, 150);
// 3. 先切换到同步模式,再切回异步模式
circle.toSync();
const asyncCircle = circle.toAsync();
// 4. 异步模式下修改半径,调用 done() 提交到画布
asyncCircle.setState_Radius(250);
await asyncCircle.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveCircle.get(circle.getState_PrimitiveId());
console.log('isAsync after toAsync:', circle.isAsync());
console.log('radius:', 150, '→', refetched.getState_Radius());
```
### tosync
# ISCH\_PrimitiveCircle.toSync() method
Convert Primitive to Sync primitive
## Signature
```typescript
function toSync(): ISCH_PrimitiveCircle;
```
## Returns
[ISCH\_PrimitiveCircle](./ISCH_PrimitiveCircle.md)
Circle primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试圆重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个测试圆(创建后默认处于异步模式)
const circle = await eda.sch_PrimitiveCircle.create(x, y, 150);
// 3. 转换为同步图元
const syncCircle = circle.toSync();
// 4. 同步模式下扩大半径,立即生效,无需 done()
syncCircle.setState_Radius(250);
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveCircle.get(circle.getState_PrimitiveId());
console.log('isAsync after toSync:', circle.isAsync());
console.log('radius:', 150, '→', refetched.getState_Radius());
```
references/classes/ISCH_PrimitiveAttribute.md
# ISCH\_PrimitiveAttribute class
Property primitive
## Signature
```typescript
class ISCH_PrimitiveAttribute implements ISCH_Primitive
```
**Implements:** [ISCH\_Primitive](../interfaces/ISCH_Primitive.md)
## Remarks
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[done()](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Apply the changes to the primitives to the canvas
</td></tr>
<tr><td>
[getState\_AlignMode()](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: alignment mode
</td></tr>
<tr><td>
[getState\_Bold()](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: whether it is bold
</td></tr>
<tr><td>
[getState\_Color()](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: text color
</td></tr>
<tr><td>
[getState\_FillColor()](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: fill color
</td></tr>
<tr><td>
[getState\_FontName()](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: font name
</td></tr>
<tr><td>
[getState\_FontSize()](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: font size
</td></tr>
<tr><td>
[getState\_Italic()](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: whether it is italic
</td></tr>
<tr><td>
[getState\_Key()](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: key
</td></tr>
<tr><td>
[getState\_KeyVisible()](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: whether the key is visible
</td></tr>
<tr><td>
[getState\_ParentPrimitiveId()](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: parent primitive ID
</td></tr>
<tr><td>
[getState\_PrimitiveId()](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: primitive ID
</td></tr>
<tr><td>
[getState\_PrimitiveType()](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: primitive type
</td></tr>
<tr><td>
[getState\_Rotation()](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: rotation angle
</td></tr>
<tr><td>
[getState\_UnderLine()](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: whether it is underlined
</td></tr>
<tr><td>
[getState\_Value()](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: value
</td></tr>
<tr><td>
[getState\_ValueVisible()](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: whether the value is visible
</td></tr>
<tr><td>
[getState\_X()](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: X coordinate
</td></tr>
<tr><td>
[getState\_Y()](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
Get the property state: Y coordinate
</td></tr>
<tr><td>
[isAsync()](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
Query whether the primitive is an async primitive
</td></tr>
<tr><td>
[reset()](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Reset the async primitive to the current canvas state
</td></tr>
<tr><td>
[setState\_AlignMode(alignMode)](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: alignment mode
</td></tr>
<tr><td>
[setState\_Bold(bold)](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: whether it is bold
</td></tr>
<tr><td>
[setState\_Color(color)](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: text color
</td></tr>
<tr><td>
[setState\_FillColor(fillColor)](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: fill color
</td></tr>
<tr><td>
[setState\_FontName(fontName)](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: font name
</td></tr>
<tr><td>
[setState\_FontSize(fontSize)](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: font size
</td></tr>
<tr><td>
[setState\_Italic(italic)](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: whether it is italic
</td></tr>
<tr><td>
[setState\_Key(key)](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: key
</td></tr>
<tr><td>
[setState\_KeyVisible(keyVisible)](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: whether the key is visible
</td></tr>
<tr><td>
[setState\_Rotation(rotation)](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: rotation angle
</td></tr>
<tr><td>
[setState\_UnderLine(underLine)](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: whether it is underlined
</td></tr>
<tr><td>
[setState\_Value(value)](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: value
</td></tr>
<tr><td>
[setState\_ValueVisible(valueVisible)](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: whether the value is visible
</td></tr>
<tr><td>
[setState\_X(x)](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: X coordinate
</td></tr>
<tr><td>
[setState\_Y(y)](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Y coordinate
</td></tr>
<tr><td>
[toAsync()](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
Convert Primitive to Async primitive
</td></tr>
<tr><td>
[toSync()](./ISCH_PrimitiveAttribute.md)
</td><td>
</td><td>
Convert Primitive to Sync primitive
</td></tr>
</tbody></table>
---
## 方法详情
### done
# ISCH\_PrimitiveAttribute.done() method
> 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.
Apply the changes to the primitives to the canvas
## Signature
```typescript
function done(): Promise<ISCH_PrimitiveAttribute>;
```
## Returns
Promise<[ISCH\_PrimitiveAttribute](./ISCH_PrimitiveAttribute.md)<!-- -->>
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 6000);
const y = 2000 + Math.floor(Math.random() * 6000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 记录修改前的字号和旋转角度
const fontSizeBefore = designator.getState_FontSize();
const rotationBefore = designator.getState_Rotation();
// 4. 批量修改两个属性,一次 done() 提交
const asyncAttr = designator.toAsync();
asyncAttr.setState_FontSize(50);
asyncAttr.setState_Rotation(90);
await asyncAttr.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('fontSize:', fontSizeBefore, '→', refetched.getState_FontSize());
console.log('rotation:', rotationBefore, '→', refetched.getState_Rotation());
```
### getstate_alignmode
# ISCH\_PrimitiveAttribute.getState\_AlignMode() method
Get the property state: alignment mode
## Signature
```typescript
function getState_AlignMode(): ESCH_PrimitiveTextAlignMode | null;
```
## Returns
[ESCH\_PrimitiveTextAlignMode](../enums/ESCH_PrimitiveTextAlignMode.md) \| null
Alignment mode
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取编号文本的对齐模式(1~9 对应左上/中上/居中等九宫格方位,null 为跟随默认)
const alignMode = designator.getState_AlignMode();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('alignMode:', alignMode);
```
### getstate_bold
# ISCH\_PrimitiveAttribute.getState\_Bold() method
Get the property state: whether it is bold
## Signature
```typescript
function getState_Bold(): boolean | null;
```
## Returns
boolean \| null
Whether it is bold
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取编号文本是否加粗(null 表示跟随默认样式)
const bold = designator.getState_Bold();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('bold:', bold);
```
### getstate_color
# ISCH\_PrimitiveAttribute.getState\_Color() method
Get the property state: text color
## Signature
```typescript
function getState_Color(): string | null;
```
## Returns
string \| null
Text color
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取编号文本颜色(null 表示跟随默认颜色)
const color = designator.getState_Color();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('color:', color);
```
### getstate_fillcolor
# ISCH\_PrimitiveAttribute.getState\_FillColor() method
Get the property state: fill color
## Signature
```typescript
function getState_FillColor(): string | null;
```
## Returns
string \| null
Fill color
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取编号文本底色(null 表示无底色)
const fillColor = designator.getState_FillColor();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('fillColor:', fillColor);
```
### getstate_fontname
# ISCH\_PrimitiveAttribute.getState\_FontName() method
Get the property state: font name
## Signature
```typescript
function getState_FontName(): string | null;
```
## Returns
string \| null
Font name
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取编号文本的字体名称(null 表示跟随默认字体)
const fontName = designator.getState_FontName();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('fontName:', fontName);
```
### getstate_fontsize
# ISCH\_PrimitiveAttribute.getState\_FontSize() method
Get the property state: font size
## Signature
```typescript
function getState_FontSize(): number | null;
```
## Returns
number \| null
Font size
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取编号文本的字号,单位 mm(null 表示跟随默认字号)
const fontSize = designator.getState_FontSize();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('fontSize:', fontSize);
```
### getstate_italic
# ISCH\_PrimitiveAttribute.getState\_Italic() method
Get the property state: whether it is italic
## Signature
```typescript
function getState_Italic(): boolean | null;
```
## Returns
boolean \| null
Whether it is italic
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取编号文本是否斜体(null 表示跟随默认样式)
const italic = designator.getState_Italic();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('italic:', italic);
```
### getstate_key
# ISCH\_PrimitiveAttribute.getState\_Key() method
Get the property state: key
## Signature
```typescript
function getState_Key(): string;
```
## Returns
string
Key
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取器件全部属性的 Key(属性名)
const keys = attrs.map(a => a.getState_Key());
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('keys:', keys.join(', '));
```
### getstate_keyvisible
# ISCH\_PrimitiveAttribute.getState\_KeyVisible() method
Get the property state: whether the key is visible
## Signature
```typescript
function getState_KeyVisible(): boolean | null;
```
## Returns
boolean \| null
Whether the key is visible
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取 Key(属性名前缀)是否可见
const keyVisible = designator.getState_KeyVisible();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('keyVisible:', keyVisible);
```
### getstate_parentprimitiveid
# ISCH\_PrimitiveAttribute.getState\_ParentPrimitiveId() method
Get the property state: parent primitive ID
## Signature
```typescript
function getState_ParentPrimitiveId(): string;
```
## Returns
string
Parent primitive ID
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取父图元 ID,并与所属器件的 ID 比对
const parentPrimitiveId = designator.getState_ParentPrimitiveId();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('parentPrimitiveId:', parentPrimitiveId);
console.log('belongs to component:', parentPrimitiveId === compId);
```
### getstate_primitiveid
# ISCH\_PrimitiveAttribute.getState\_PrimitiveId() method
Get the property state: primitive ID
## Signature
```typescript
function getState_PrimitiveId(): string;
```
## Returns
string
Primitive ID
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取属性图元 ID
const primitiveId = designator.getState_PrimitiveId();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('primitiveId:', primitiveId);
```
### getstate_primitivetype
# ISCH\_PrimitiveAttribute.getState\_PrimitiveType() method
Get the property state: primitive type
## Signature
```typescript
function getState_PrimitiveType(): ESCH_PrimitiveType;
```
## Returns
[ESCH\_PrimitiveType](../enums/ESCH_PrimitiveType.md)
Primitive type
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取图元类型(属性图元固定为 Attribute)
const primitiveType = designator.getState_PrimitiveType();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('primitiveType:', primitiveType);
```
### getstate_rotation
# ISCH\_PrimitiveAttribute.getState\_Rotation() method
Get the property state: rotation angle
## Signature
```typescript
function getState_Rotation(): number | null;
```
## Returns
number \| null
Rotation angle
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取编号文本的旋转角度(度)
const rotation = designator.getState_Rotation();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('rotation:', rotation);
```
### getstate_underline
# ISCH\_PrimitiveAttribute.getState\_UnderLine() method
Get the property state: whether it is underlined
## Signature
```typescript
function getState_UnderLine(): boolean | null;
```
## Returns
boolean \| null
Whether it is underlined
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取编号文本是否加下划线(null 表示跟随默认样式)
const underLine = designator.getState_UnderLine();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('underLine:', underLine);
```
### getstate_value
# ISCH\_PrimitiveAttribute.getState\_Value() method
Get the property state: value
## Signature
```typescript
function getState_Value(): string;
```
## Returns
string
Value
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取编号属性的值
const value = designator.getState_Value();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('value:', value);
```
### getstate_valuevisible
# ISCH\_PrimitiveAttribute.getState\_ValueVisible() method
Get the property state: whether the value is visible
## Signature
```typescript
function getState_ValueVisible(): boolean | null;
```
## Returns
boolean \| null
Whether the value is visible
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取值是否可见
const valueVisible = designator.getState_ValueVisible();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('valueVisible:', valueVisible);
```
### getstate_x
# ISCH\_PrimitiveAttribute.getState\_X() method
Get the property state: X coordinate
## Signature
```typescript
function getState_X(): number | null;
```
## Returns
number \| null
X coordinate
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取编号文本的 X 坐标(原理图单位,1 单位 = 10mil)
const attrX = designator.getState_X();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('attrX:', attrX);
```
### getstate_y
# ISCH\_PrimitiveAttribute.getState\_Y() method
Get the property state: Y coordinate
## Signature
```typescript
function getState_Y(): number | null;
```
## Returns
number \| null
Y coordinate
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取编号文本的 Y 坐标(原理图单位,1 单位 = 10mil)
const attrY = designator.getState_Y();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('attrY:', attrY);
```
### isasync
# ISCH\_PrimitiveAttribute.isAsync() method
Query whether the primitive is an async primitive
## Signature
```typescript
function isAsync(): boolean;
```
## Returns
boolean
Whether Is async primitive
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 查询异步状态
const isAsync = designator.isAsync();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('isAsync:', isAsync);
```
### reset
# ISCH\_PrimitiveAttribute.reset() method
> 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.
Reset the async primitive to the current canvas state
## Signature
```typescript
function reset(): Promise<ISCH_PrimitiveAttribute>;
```
## Returns
Promise<[ISCH\_PrimitiveAttribute](./ISCH_PrimitiveAttribute.md)<!-- -->>
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 6000);
const y = 2000 + Math.floor(Math.random() * 6000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 记录画布上的原始值
const original = designator.getState_Value();
// 4. 异步模式下改一个错误值,但不提交,直接 reset() 丢弃
const asyncAttr = designator.toAsync();
asyncAttr.setState_Value('SHOULD-DISCARD');
await asyncAttr.reset();
// 5. 从画布重新读取,确认值仍是原始值(保留现场供观察)
const refetched = await eda.sch_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('value:', original, '→', refetched.getState_Value(), '(修改已丢弃)');
```
### setstate_alignmode
# ISCH\_PrimitiveAttribute.setState\_AlignMode() method
> 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.
Set the property state: alignment mode
## Signature
```typescript
function setState_AlignMode(alignMode: ESCH_PrimitiveTextAlignMode | null): ISCH_PrimitiveAttribute;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
alignMode
</td><td>
[ESCH\_PrimitiveTextAlignMode](../enums/ESCH_PrimitiveTextAlignMode.md) \| null
</td><td>
Alignment mode
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveAttribute](./ISCH_PrimitiveAttribute.md)
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 6000);
const y = 2000 + Math.floor(Math.random() * 6000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取修改前的对齐模式
const before = designator.getState_AlignMode();
// 4. 切换异步模式设置为中上对齐并提交
const asyncAttr = designator.toAsync();
asyncAttr.setState_AlignMode(4);
await asyncAttr.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('alignMode:', before, '→', refetched.getState_AlignMode());
```
### setstate_bold
# ISCH\_PrimitiveAttribute.setState\_Bold() method
> 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.
Set the property state: whether it is bold
## Signature
```typescript
function setState_Bold(bold: boolean | null): ISCH_PrimitiveAttribute;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
bold
</td><td>
boolean \| null
</td><td>
Whether it is bold
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveAttribute](./ISCH_PrimitiveAttribute.md)
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 6000);
const y = 2000 + Math.floor(Math.random() * 6000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 切换异步模式加粗编号并提交
const asyncAttr = designator.toAsync();
asyncAttr.setState_Bold(true);
await asyncAttr.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('bold:', refetched.getState_Bold());
```
### setstate_color
# ISCH\_PrimitiveAttribute.setState\_Color() method
> 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.
Set the property state: text color
## Signature
```typescript
function setState_Color(color: string | null): ISCH_PrimitiveAttribute;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
color
</td><td>
string \| null
</td><td>
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveAttribute](./ISCH_PrimitiveAttribute.md)
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 6000);
const y = 2000 + Math.floor(Math.random() * 6000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 切换异步模式,Color 与 FillColor 同时设置才生效
const asyncAttr = designator.toAsync();
asyncAttr.setState_Color('#FFEC8B');
asyncAttr.setState_FillColor('#FFEC8B');
await asyncAttr.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('color:', refetched.getState_Color());
```
### setstate_fillcolor
# ISCH\_PrimitiveAttribute.setState\_FillColor() method
> 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.
Set the property state: fill color
## Signature
```typescript
function setState_FillColor(fillColor: string | null): ISCH_PrimitiveAttribute;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fillColor
</td><td>
string \| null
</td><td>
Fill color
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveAttribute](./ISCH_PrimitiveAttribute.md)
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 6000);
const y = 2000 + Math.floor(Math.random() * 6000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 切换异步模式设置底色并提交
const asyncAttr = designator.toAsync();
asyncAttr.setState_FillColor('#FFEC8B');
await asyncAttr.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('fillColor:', refetched.getState_FillColor());
```
### setstate_fontname
# ISCH\_PrimitiveAttribute.setState\_FontName() method
> 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.
Set the property state: font name
## Signature
```typescript
function setState_FontName(fontName: string | null): ISCH_PrimitiveAttribute;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fontName
</td><td>
string \| null
</td><td>
Font name
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveAttribute](./ISCH_PrimitiveAttribute.md)
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 6000);
const y = 2000 + Math.floor(Math.random() * 6000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 切换异步模式设置字体并提交
const asyncAttr = designator.toAsync();
asyncAttr.setState_FontName('Arial');
await asyncAttr.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('fontName:', refetched.getState_FontName());
```
### setstate_fontsize
# ISCH\_PrimitiveAttribute.setState\_FontSize() method
> 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.
Set the property state: font size
## Signature
```typescript
function setState_FontSize(fontSize: number | null): ISCH_PrimitiveAttribute;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fontSize
</td><td>
number \| null
</td><td>
Font size
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveAttribute](./ISCH_PrimitiveAttribute.md)
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 6000);
const y = 2000 + Math.floor(Math.random() * 6000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 切换异步模式设置字号并提交(传入 50,读回 0.5mm)
const asyncAttr = designator.toAsync();
asyncAttr.setState_FontSize(50);
await asyncAttr.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('fontSize:', refetched.getState_FontSize());
```
### setstate_italic
# ISCH\_PrimitiveAttribute.setState\_Italic() method
> 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.
Set the property state: whether it is italic
## Signature
```typescript
function setState_Italic(italic: boolean | null): ISCH_PrimitiveAttribute;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
italic
</td><td>
boolean \| null
</td><td>
Whether it is italic
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveAttribute](./ISCH_PrimitiveAttribute.md)
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 6000);
const y = 2000 + Math.floor(Math.random() * 6000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 切换异步模式设置斜体并提交
const asyncAttr = designator.toAsync();
asyncAttr.setState_Italic(true);
await asyncAttr.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('italic:', refetched.getState_Italic());
```
### setstate_key
# ISCH\_PrimitiveAttribute.setState\_Key() method
> 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.
Set the property state: key
## Signature
```typescript
function setState_Key(key: string): ISCH_PrimitiveAttribute;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
key
</td><td>
string
</td><td>
Key
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveAttribute](./ISCH_PrimitiveAttribute.md)
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 6000);
const y = 2000 + Math.floor(Math.random() * 6000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取修改前的属性名
const before = designator.getState_Key();
// 4. 切换异步模式重命名属性并提交
const asyncAttr = designator.toAsync();
asyncAttr.setState_Key('Ref');
await asyncAttr.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('key:', before, '→', refetched.getState_Key());
```
### setstate_keyvisible
# ISCH\_PrimitiveAttribute.setState\_KeyVisible() method
> 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.
Set the property state: whether the key is visible
## Signature
```typescript
function setState_KeyVisible(keyVisible: boolean | null): ISCH_PrimitiveAttribute;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
keyVisible
</td><td>
boolean \| null
</td><td>
Whether the key is visible
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveAttribute](./ISCH_PrimitiveAttribute.md)
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 6000);
const y = 2000 + Math.floor(Math.random() * 6000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 切换异步模式显示属性名前缀并提交
const asyncAttr = designator.toAsync();
asyncAttr.setState_KeyVisible(true);
await asyncAttr.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('keyVisible:', refetched.getState_KeyVisible());
```
### setstate_rotation
# ISCH\_PrimitiveAttribute.setState\_Rotation() method
> 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.
Set the property state: rotation angle
## Signature
```typescript
function setState_Rotation(rotation: number | null): ISCH_PrimitiveAttribute;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
rotation
</td><td>
number \| null
</td><td>
Rotation angle
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveAttribute](./ISCH_PrimitiveAttribute.md)
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 6000);
const y = 2000 + Math.floor(Math.random() * 6000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取修改前的角度,切换异步模式旋转 90° 并提交
const before = designator.getState_Rotation();
const asyncAttr = designator.toAsync();
asyncAttr.setState_Rotation(90);
await asyncAttr.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('rotation:', before, '→', refetched.getState_Rotation());
```
### setstate_underline
# ISCH\_PrimitiveAttribute.setState\_UnderLine() method
> 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.
Set the property state: whether it is underlined
## Signature
```typescript
function setState_UnderLine(underLine: boolean | null): ISCH_PrimitiveAttribute;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
underLine
</td><td>
boolean \| null
</td><td>
Whether it is underlined
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveAttribute](./ISCH_PrimitiveAttribute.md)
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 6000);
const y = 2000 + Math.floor(Math.random() * 6000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 切换异步模式加下划线并提交
const asyncAttr = designator.toAsync();
asyncAttr.setState_UnderLine(true);
await asyncAttr.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('underLine:', refetched.getState_UnderLine());
```
### setstate_value
# ISCH\_PrimitiveAttribute.setState\_Value() method
> 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.
Set the property state: value
## Signature
```typescript
function setState_Value(value: string): ISCH_PrimitiveAttribute;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
value
</td><td>
string
</td><td>
Value
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveAttribute](./ISCH_PrimitiveAttribute.md)
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 6000);
const y = 2000 + Math.floor(Math.random() * 6000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取修改前的属性值
const before = designator.getState_Value();
// 4. 切换异步模式修改属性值并提交
const asyncAttr = designator.toAsync();
asyncAttr.setState_Value(`${before}-MOD`);
await asyncAttr.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('value:', before, '→', refetched.getState_Value());
```
### setstate_valuevisible
# ISCH\_PrimitiveAttribute.setState\_ValueVisible() method
> 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.
Set the property state: whether the value is visible
## Signature
```typescript
function setState_ValueVisible(valueVisible: boolean | null): ISCH_PrimitiveAttribute;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
valueVisible
</td><td>
boolean \| null
</td><td>
Whether the value is visible
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveAttribute](./ISCH_PrimitiveAttribute.md)
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 6000);
const y = 2000 + Math.floor(Math.random() * 6000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取修改前的可见状态
const before = designator.getState_ValueVisible();
// 4. 切换异步模式隐藏属性值并提交
const asyncAttr = designator.toAsync();
asyncAttr.setState_ValueVisible(false);
await asyncAttr.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('valueVisible:', before, '→', refetched.getState_ValueVisible());
```
### setstate_x
# ISCH\_PrimitiveAttribute.setState\_X() method
> 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.
Set the property state: X coordinate
## Signature
```typescript
function setState_X(x: number | null): ISCH_PrimitiveAttribute;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
x
</td><td>
number \| null
</td><td>
X coordinate
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveAttribute](./ISCH_PrimitiveAttribute.md)
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 6000);
const y = 2000 + Math.floor(Math.random() * 6000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取修改前的 X 坐标,向右平移 50 单位(约 12.7mm)
const before = designator.getState_X();
const asyncAttr = designator.toAsync();
asyncAttr.setState_X(before + 50);
await asyncAttr.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('attrX:', before, '→', refetched.getState_X());
```
### setstate_y
# ISCH\_PrimitiveAttribute.setState\_Y() method
> 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.
Set the property state: Y coordinate
## Signature
```typescript
function setState_Y(y: number | null): ISCH_PrimitiveAttribute;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
y
</td><td>
number \| null
</td><td>
Y coordinate
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveAttribute](./ISCH_PrimitiveAttribute.md)
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 6000);
const y = 2000 + Math.floor(Math.random() * 6000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取修改前的 Y 坐标,向下平移 50 单位(读回值符号相反)
const before = designator.getState_Y();
const asyncAttr = designator.toAsync();
asyncAttr.setState_Y(before + 50);
await asyncAttr.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('attrY:', before, '→', refetched.getState_Y());
```
### toasync
# ISCH\_PrimitiveAttribute.toAsync() method
Convert Primitive to Async primitive
## Signature
```typescript
function toAsync(): ISCH_PrimitiveAttribute;
```
## Returns
[ISCH\_PrimitiveAttribute](./ISCH_PrimitiveAttribute.md)
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 6000);
const y = 2000 + Math.floor(Math.random() * 6000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 转换为异步句柄并确认其异步状态
const asyncAttr = designator.toAsync();
// 4. 通过异步句柄修改字号并提交(传入 50,读回 0.5mm)
asyncAttr.setState_FontSize(50);
await asyncAttr.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('isAsync:', asyncAttr.isAsync());
console.log('fontSize:', refetched.getState_FontSize());
```
### tosync
# ISCH\_PrimitiveAttribute.toSync() method
Convert Primitive to Sync primitive
## Signature
```typescript
function toSync(): ISCH_PrimitiveAttribute;
```
## Returns
[ISCH\_PrimitiveAttribute](./ISCH_PrimitiveAttribute.md)
Attribute primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 6000);
const y = 2000 + Math.floor(Math.random() * 6000);
// 2. 放置测试器件并取出 Designator(编号)属性
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(comp.getState_PrimitiveId());
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取修改前的属性值
const before = designator.getState_Value();
// 4. 转换为同步图元后直接修改,立即生效(无需 done())
const syncAttr = designator.toSync();
syncAttr.setState_Value(`${before}-SYNC`);
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveAttribute.get(designator.getState_PrimitiveId());
console.log('value:', before, '→', refetched.getState_Value());
```
references/classes/ISCH_PrimitiveObject.md
# ISCH\_PrimitiveObject class
Binary embedded object primitive
## Signature
```typescript
class ISCH_PrimitiveObject implements ISCH_Primitive
```
**Implements:** [ISCH\_Primitive](../interfaces/ISCH_Primitive.md)
## Remarks
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[done()](./ISCH_PrimitiveObject.md)
</td><td>
</td><td>
**_(BETA)_** Apply the changes to the primitives to the canvas
</td></tr>
<tr><td>
[getState\_Content()](./ISCH_PrimitiveObject.md)
</td><td>
</td><td>
Get the property state: object content
</td></tr>
<tr><td>
[getState\_FileName()](./ISCH_PrimitiveObject.md)
</td><td>
</td><td>
Get the property state: file name
</td></tr>
<tr><td>
[getState\_Height()](./ISCH_PrimitiveObject.md)
</td><td>
</td><td>
Get the property state: height
</td></tr>
<tr><td>
[getState\_Mirror()](./ISCH_PrimitiveObject.md)
</td><td>
</td><td>
Get the property state: whether it is mirrored
</td></tr>
<tr><td>
[getState\_PrimitiveId()](./ISCH_PrimitiveObject.md)
</td><td>
</td><td>
Get the property state: primitive ID
</td></tr>
<tr><td>
[getState\_PrimitiveType()](./ISCH_PrimitiveObject.md)
</td><td>
</td><td>
Get the property state: primitive type
</td></tr>
<tr><td>
[getState\_Rotation()](./ISCH_PrimitiveObject.md)
</td><td>
</td><td>
Get the property state: rotation angle
</td></tr>
<tr><td>
[getState\_StartX()](./ISCH_PrimitiveObject.md)
</td><td>
</td><td>
Get the property state: X coordinate
</td></tr>
<tr><td>
[getState\_StartY()](./ISCH_PrimitiveObject.md)
</td><td>
</td><td>
Get the property state: Y coordinate
</td></tr>
<tr><td>
[getState\_Width()](./ISCH_PrimitiveObject.md)
</td><td>
</td><td>
Get the property state: width
</td></tr>
<tr><td>
[isAsync()](./ISCH_PrimitiveObject.md)
</td><td>
</td><td>
Query whether the primitive is an async primitive
</td></tr>
<tr><td>
[reset()](./ISCH_PrimitiveObject.md)
</td><td>
</td><td>
**_(BETA)_** Reset the async primitive to the current canvas state
</td></tr>
<tr><td>
[setState\_Content(content)](./ISCH_PrimitiveObject.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: object content
</td></tr>
<tr><td>
[setState\_FileName(fileName)](./ISCH_PrimitiveObject.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: file name
</td></tr>
<tr><td>
[setState\_Height(height)](./ISCH_PrimitiveObject.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: height
</td></tr>
<tr><td>
[setState\_Mirror(mirror)](./ISCH_PrimitiveObject.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: whether it is mirrored
</td></tr>
<tr><td>
[setState\_Rotation(rotation)](./ISCH_PrimitiveObject.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: rotation angle
</td></tr>
<tr><td>
[setState\_StartX(startX)](./ISCH_PrimitiveObject.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: start point coordinates X
</td></tr>
<tr><td>
[setState\_StartY(startY)](./ISCH_PrimitiveObject.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: start point coordinates Y
</td></tr>
<tr><td>
[setState\_Width(width)](./ISCH_PrimitiveObject.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: width
</td></tr>
<tr><td>
[toAsync()](./ISCH_PrimitiveObject.md)
</td><td>
</td><td>
Convert Primitive to Async primitive
</td></tr>
<tr><td>
[toSync()](./ISCH_PrimitiveObject.md)
</td><td>
</td><td>
Convert Primitive to Sync primitive
</td></tr>
</tbody></table>
---
## 方法详情
### done
# ISCH\_PrimitiveObject.done() method
> 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.
Apply the changes to the primitives to the canvas
## Signature
```typescript
function done(): Promise<ISCH_PrimitiveObject>;
```
## Returns
Promise<[ISCH\_PrimitiveObject](./ISCH_PrimitiveObject.md)<!-- -->>
Binary embedded object primitive object
### getstate_content
# ISCH\_PrimitiveObject.getState\_Content() method
Get the property state: object content
## Signature
```typescript
function getState_Content(): File | string;
```
## Returns
File \| string
Object content
### getstate_filename
# ISCH\_PrimitiveObject.getState\_FileName() method
Get the property state: file name
## Signature
```typescript
function getState_FileName(): string;
```
## Returns
string
File name
### getstate_height
# ISCH\_PrimitiveObject.getState\_Height() method
Get the property state: height
## Signature
```typescript
function getState_Height(): number;
```
## Returns
number
Height
### getstate_mirror
# ISCH\_PrimitiveObject.getState\_Mirror() method
Get the property state: whether it is mirrored
## Signature
```typescript
function getState_Mirror(): boolean;
```
## Returns
boolean
Whether it is mirrored
### getstate_primitiveid
# ISCH\_PrimitiveObject.getState\_PrimitiveId() method
Get the property state: primitive ID
## Signature
```typescript
function getState_PrimitiveId(): string;
```
## Returns
string
Primitive ID
### getstate_primitivetype
# ISCH\_PrimitiveObject.getState\_PrimitiveType() method
Get the property state: primitive type
## Signature
```typescript
function getState_PrimitiveType(): ESCH_PrimitiveType;
```
## Returns
[ESCH\_PrimitiveType](../enums/ESCH_PrimitiveType.md)
Primitive type
### getstate_rotation
# ISCH\_PrimitiveObject.getState\_Rotation() method
Get the property state: rotation angle
## Signature
```typescript
function getState_Rotation(): number;
```
## Returns
number
Rotation angle
### getstate_startx
# ISCH\_PrimitiveObject.getState\_StartX() method
Get the property state: X coordinate
## Signature
```typescript
function getState_StartX(): number;
```
## Returns
number
X coordinate
### getstate_starty
# ISCH\_PrimitiveObject.getState\_StartY() method
Get the property state: Y coordinate
## Signature
```typescript
function getState_StartY(): number;
```
## Returns
number
Y coordinate
### getstate_width
# ISCH\_PrimitiveObject.getState\_Width() method
Get the property state: width
## Signature
```typescript
function getState_Width(): number;
```
## Returns
number
Width
### isasync
# ISCH\_PrimitiveObject.isAsync() method
Query whether the primitive is an async primitive
## Signature
```typescript
function isAsync(): boolean;
```
## Returns
boolean
Whether Is async primitive
### reset
# ISCH\_PrimitiveObject.reset() method
> 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.
Reset the async primitive to the current canvas state
## Signature
```typescript
function reset(): Promise<ISCH_PrimitiveObject>;
```
## Returns
Promise<[ISCH\_PrimitiveObject](./ISCH_PrimitiveObject.md)<!-- -->>
Binary embedded object primitive object
### setstate_content
# ISCH\_PrimitiveObject.setState\_Content() method
> 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.
Set the property state: object content
## Signature
```typescript
function setState_Content(content: File | string): ISCH_PrimitiveObject;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
content
</td><td>
File \| string
</td><td>
Object content
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveObject](./ISCH_PrimitiveObject.md)
Binary embedded object primitive object
### setstate_filename
# ISCH\_PrimitiveObject.setState\_FileName() method
> 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.
Set the property state: file name
## Signature
```typescript
function setState_FileName(fileName: string): ISCH_PrimitiveObject;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fileName
</td><td>
string
</td><td>
File name
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveObject](./ISCH_PrimitiveObject.md)
Binary embedded object primitive object
### setstate_height
# ISCH\_PrimitiveObject.setState\_Height() method
> 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.
Set the property state: height
## Signature
```typescript
function setState_Height(height: number): ISCH_PrimitiveObject;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
height
</td><td>
number
</td><td>
Height
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveObject](./ISCH_PrimitiveObject.md)
Binary embedded object primitive object
### setstate_mirror
# ISCH\_PrimitiveObject.setState\_Mirror() method
> 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.
Set the property state: whether it is mirrored
## Signature
```typescript
function setState_Mirror(mirror: boolean): ISCH_PrimitiveObject;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
mirror
</td><td>
boolean
</td><td>
Whether it is mirrored
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveObject](./ISCH_PrimitiveObject.md)
Binary embedded object primitive object
### setstate_rotation
# ISCH\_PrimitiveObject.setState\_Rotation() method
> 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.
Set the property state: rotation angle
## Signature
```typescript
function setState_Rotation(rotation: number): ISCH_PrimitiveObject;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
rotation
</td><td>
number
</td><td>
Rotation angle
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveObject](./ISCH_PrimitiveObject.md)
Binary embedded object primitive object
### setstate_startx
# ISCH\_PrimitiveObject.setState\_StartX() method
> 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.
Set the property state: start point coordinates X
## Signature
```typescript
function setState_StartX(startX: number): ISCH_PrimitiveObject;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
startX
</td><td>
number
</td><td>
Start point coordinates X
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveObject](./ISCH_PrimitiveObject.md)
Binary embedded object primitive object
### setstate_starty
# ISCH\_PrimitiveObject.setState\_StartY() method
> 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.
Set the property state: start point coordinates Y
## Signature
```typescript
function setState_StartY(startY: number): ISCH_PrimitiveObject;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
startY
</td><td>
number
</td><td>
Start point coordinates Y
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveObject](./ISCH_PrimitiveObject.md)
Binary embedded object primitive object
### setstate_width
# ISCH\_PrimitiveObject.setState\_Width() method
> 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.
Set the property state: width
## Signature
```typescript
function setState_Width(width: number): ISCH_PrimitiveObject;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
width
</td><td>
number
</td><td>
Width
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveObject](./ISCH_PrimitiveObject.md)
Binary embedded object primitive object
### toasync
# ISCH\_PrimitiveObject.toAsync() method
Convert Primitive to Async primitive
## Signature
```typescript
function toAsync(): ISCH_PrimitiveObject;
```
## Returns
[ISCH\_PrimitiveObject](./ISCH_PrimitiveObject.md)
Binary embedded object primitive object
### tosync
# ISCH\_PrimitiveObject.toSync() method
Convert Primitive to Sync primitive
## Signature
```typescript
function toSync(): ISCH_PrimitiveObject;
```
## Returns
[ISCH\_PrimitiveObject](./ISCH_PrimitiveObject.md)
Binary embedded object primitive object
references/classes/ISCH_PrimitiveComponentPin.md
# ISCH\_PrimitiveComponentPin class
Device pin primitive
## Signature
```typescript
class ISCH_PrimitiveComponentPin extends ISCH_PrimitivePin
```
**Extends:** [ISCH\_PrimitivePin](./ISCH_PrimitivePin.md)
## Remarks
A device pin primitive is a special primitive. It refers to the pin associated with a symbol on the schematic canvas
For a device pin primitive, only the `pinNumber` and `noConnected` properties can be changed; all other properties are read-only. And you can only obtain a device pin primitive through [the getAllPinsByPrimitiveId method of the device class](./SCH_PrimitiveComponent.md) or [the getAllPins method of the device primitive](./ISCH_PrimitiveComponent.md)
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[primitiveType](./ISCH_PrimitiveComponentPin.md)
</td><td>
`protected`
`readonly`
</td><td>
[ESCH\_PrimitiveType.COMPONENT\_PIN](../enums/ESCH_PrimitiveType.md)
</td><td>
图元类型
</td></tr>
</tbody></table>
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[done()](./ISCH_PrimitiveComponentPin.md)
</td><td>
</td><td>
**_(BETA)_** Apply the changes to the primitives to the canvas
</td></tr>
</tbody></table>
---
## 属性详情
### primitivetype
# ISCH\_PrimitiveComponentPin.primitiveType property
图元类型
## Signature
```typescript
function readonly primitiveType: ESCH_PrimitiveType.COMPONENT_PIN;
```
---
## 方法详情
### done
# ISCH\_PrimitiveComponentPin.done() method
> 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.
Apply the changes to the primitives to the canvas
## Signature
```typescript
function done(): Promise<ISCH_PrimitiveComponentPin>;
```
## Returns
Promise<[ISCH\_PrimitiveComponentPin](./ISCH_PrimitiveComponentPin.md)<!-- -->>
Device pin primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 放置一个测试器件并取其引脚
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const pins = await comp.getAllPins();
const before = pins[0].getState_PinNumber();
// 3. 异步模式改两个引脚的编号(此时画布尚未变化)
const pin1 = pins[0].toAsync();
pin1.setState_PinNumber('A1');
const pin2 = pins[1].toAsync();
pin2.setState_PinNumber('A2');
// 4. 逐个提交,修改写入画布(保留现场供观察)
await pin1.done();
await pin2.done();
// 5. 从画布重新取引脚,确认两脚编号都已更新
const pinsAfter = await comp.getAllPins();
console.log('pin1:', before, '→', pinsAfter[0].getState_PinNumber());
console.log('pin2:', pinsAfter[1].getState_PinNumber());
```
references/classes/ISCH_PrimitiveBus.md
# ISCH\_PrimitiveBus class
Bus primitive
## Signature
```typescript
class ISCH_PrimitiveBus implements ISCH_Primitive
```
**Implements:** [ISCH\_Primitive](../interfaces/ISCH_Primitive.md)
## Remarks
Unresolved issues:
The `ISCH_PrimitiveWire.net` global net name property involves multi-sheet refresh, so the currently obtained value may be \*\*incorrect\*\*. When you try to set multiple names for a wire or bus (by placing multiple net labels), the obtained `net` property may not be the latest. You need to wait for the canvas event to asynchronously refresh the global nets before reading it again.
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[done()](./ISCH_PrimitiveBus.md)
</td><td>
</td><td>
**_(BETA)_** Apply the changes to the primitives to the canvas
</td></tr>
<tr><td>
[getState\_BusName()](./ISCH_PrimitiveBus.md)
</td><td>
</td><td>
Get the property state: bus name
</td></tr>
<tr><td>
[getState\_Color()](./ISCH_PrimitiveBus.md)
</td><td>
</td><td>
Get the property state: bus color
</td></tr>
<tr><td>
[getState\_Line()](./ISCH_PrimitiveBus.md)
</td><td>
</td><td>
Get the property state: polyline coordinate group
</td></tr>
<tr><td>
[getState\_LineType()](./ISCH_PrimitiveBus.md)
</td><td>
</td><td>
Get the property state: line type
</td></tr>
<tr><td>
[getState\_LineWidth()](./ISCH_PrimitiveBus.md)
</td><td>
</td><td>
Get the property state: Line width
</td></tr>
<tr><td>
[getState\_PrimitiveId()](./ISCH_PrimitiveBus.md)
</td><td>
</td><td>
Get the property state: primitive ID
</td></tr>
<tr><td>
[getState\_PrimitiveType()](./ISCH_PrimitiveBus.md)
</td><td>
</td><td>
Get the property state: primitive type
</td></tr>
<tr><td>
[isAsync()](./ISCH_PrimitiveBus.md)
</td><td>
</td><td>
Query whether the primitive is an async primitive
</td></tr>
<tr><td>
[setState\_BusName(busName)](./ISCH_PrimitiveBus.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: bus name
</td></tr>
<tr><td>
[setState\_Color(color)](./ISCH_PrimitiveBus.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Bus color
</td></tr>
<tr><td>
[setState\_Line(line)](./ISCH_PrimitiveBus.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: polyline coordinate group
</td></tr>
<tr><td>
[setState\_LineType(lineType)](./ISCH_PrimitiveBus.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: line type
</td></tr>
<tr><td>
[setState\_LineWidth(lineWidth)](./ISCH_PrimitiveBus.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Line width
</td></tr>
<tr><td>
[toAsync()](./ISCH_PrimitiveBus.md)
</td><td>
</td><td>
Convert Primitive to Async primitive
</td></tr>
<tr><td>
[toSync()](./ISCH_PrimitiveBus.md)
</td><td>
</td><td>
Convert Primitive to Sync primitive
</td></tr>
</tbody></table>
---
## 方法详情
### done
# ISCH\_PrimitiveBus.done() method
> 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.
Apply the changes to the primitives to the canvas
## Signature
```typescript
function done(): Promise<ISCH_PrimitiveBus>;
```
## Returns
Promise<[ISCH\_PrimitiveBus](./ISCH_PrimitiveBus.md)<!-- -->>
Bus primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试总线重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一条测试总线(SCH 坐标单位 10mil)
const bus = await eda.sch_PrimitiveBus.create('DATA[0..7]', [x, y, x + 400, y]);
// 3. 切换异步模式,累计两处修改(改名称 + 改颜色)
const asyncBus = bus.toAsync();
asyncBus.setState_BusName('ADDR[0..15]');
asyncBus.setState_Color('#00AA00');
// 4. 一次性提交到画布
await asyncBus.done();
// 5. 从画布重新读取,确认两处修改都已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveBus.get(bus.getState_PrimitiveId());
console.log('busName:', 'DATA[0..7]', '→', refetched.getState_BusName());
console.log('color:', '#00AA00', '→', refetched.getState_Color());
```
### getstate_busname
# ISCH\_PrimitiveBus.getState\_BusName() method
Get the property state: bus name
## Signature
```typescript
function getState_BusName(): string;
```
## Returns
string
Bus name
## Example
```javascript
// 1. 创建一条名为 DATA[0..7] 的测试总线(总线名称必须是合法切片格式,SCH 坐标单位 10mil)
const bus = await eda.sch_PrimitiveBus.create('DATA[0..7]', [1000, 1000, 1400, 1000]);
// 2. 读取总线名称
const busName = bus.getState_BusName();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveBus.delete([bus.getState_PrimitiveId()]);
console.log('busName:', busName);
```
### getstate_color
# ISCH\_PrimitiveBus.getState\_Color() method
Get the property state: bus color
## Signature
```typescript
function getState_Color(): string | null;
```
## Returns
string \| null
Bus color
## Example
```javascript
// 1. 创建一条红色测试总线(SCH 坐标单位 10mil)
const bus = await eda.sch_PrimitiveBus.create('DATA[0..7]', [1000, 1000, 1400, 1000], '#FF0000', 6, 1);
// 2. 读取总线颜色
const color = bus.getState_Color();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveBus.delete([bus.getState_PrimitiveId()]);
console.log('color:', color);
```
### getstate_line
# ISCH\_PrimitiveBus.getState\_Line() method
Get the property state: polyline coordinate group
## Signature
```typescript
function getState_Line(): Array<number> | Array<Array<number>>;
```
## Returns
Array<number> \| Array<Array<number>>
Polyline coordinate group
## Example
```javascript
// 1. 创建一条水平测试总线(SCH 坐标单位 10mil)
const bus = await eda.sch_PrimitiveBus.create('DATA[0..7]', [1000, 1000, 1400, 1000]);
// 2. 读取多段线坐标组(返回画布规格化后的坐标,段内端点顺序可能与创建时相反)
const line = bus.getState_Line();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveBus.delete([bus.getState_PrimitiveId()]);
console.log('line:', JSON.stringify(line));
```
### getstate_linetype
# ISCH\_PrimitiveBus.getState\_LineType() method
Get the property state: line type
## Signature
```typescript
function getState_LineType(): ESCH_PrimitiveLineType | null;
```
## Returns
[ESCH\_PrimitiveLineType](../enums/ESCH_PrimitiveLineType.md) \| null
Line type
## Example
```javascript
// 1. 创建一条虚线(DASHED=1)测试总线(SCH 坐标单位 10mil)
const bus = await eda.sch_PrimitiveBus.create('DATA[0..7]', [1000, 1000, 1400, 1000], null, 6, 1);
// 2. 读取线型
const lineType = bus.getState_LineType();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveBus.delete([bus.getState_PrimitiveId()]);
console.log('lineType:', lineType);
```
### getstate_linewidth
# ISCH\_PrimitiveBus.getState\_LineWidth() method
Get the property state: Line width
## Signature
```typescript
function getState_LineWidth(): number | null;
```
## Returns
number \| null
Line width
## Example
```javascript
// 1. 创建一条线宽 6 的测试总线(SCH 坐标单位 10mil)
const bus = await eda.sch_PrimitiveBus.create('DATA[0..7]', [1000, 1000, 1400, 1000], null, 6, null);
// 2. 读取线宽
const lineWidth = bus.getState_LineWidth();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveBus.delete([bus.getState_PrimitiveId()]);
console.log('lineWidth:', lineWidth);
```
### getstate_primitiveid
# ISCH\_PrimitiveBus.getState\_PrimitiveId() method
Get the property state: primitive ID
## Signature
```typescript
function getState_PrimitiveId(): string;
```
## Returns
string
Primitive ID
## Example
```javascript
// 1. 创建一条测试总线(SCH 坐标单位 10mil)
const bus = await eda.sch_PrimitiveBus.create('DATA[0..7]', [1000, 1000, 1400, 1000]);
// 2. 读取图元 ID
const primitiveId = bus.getState_PrimitiveId();
// 3. 用该 ID 反查同一图元,验证 ID 有效(查询类案例不留测试对象)
const refetched = await eda.sch_PrimitiveBus.get(primitiveId);
await eda.sch_PrimitiveBus.delete([primitiveId]);
console.log('primitiveId:', primitiveId);
console.log('refetch matched:', refetched.getState_PrimitiveId() === primitiveId);
```
### getstate_primitivetype
# ISCH\_PrimitiveBus.getState\_PrimitiveType() method
Get the property state: primitive type
## Signature
```typescript
function getState_PrimitiveType(): ESCH_PrimitiveType;
```
## Returns
[ESCH\_PrimitiveType](../enums/ESCH_PrimitiveType.md)
Primitive type
## Example
```javascript
// 1. 创建一条测试总线(SCH 坐标单位 10mil)
const bus = await eda.sch_PrimitiveBus.create('DATA[0..7]', [1000, 1000, 1400, 1000]);
// 2. 读取图元类型
const primitiveType = bus.getState_PrimitiveType();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveBus.delete([bus.getState_PrimitiveId()]);
console.log('primitiveType:', primitiveType);
```
### isasync
# ISCH\_PrimitiveBus.isAsync() method
Query whether the primitive is an async primitive
## Signature
```typescript
function isAsync(): boolean;
```
## Returns
boolean
Whether Is async primitive
## Example
```javascript
// 1. 创建一条测试总线,创建后默认处于异步模式
const bus = await eda.sch_PrimitiveBus.create('DATA[0..7]', [1000, 1000, 1400, 1000]);
const asyncOnCreate = bus.isAsync();
// 2. 切换到同步模式再查询一次,对比两种模式
bus.toSync();
const asyncAfterToSync = bus.isAsync();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveBus.delete([bus.getState_PrimitiveId()]);
console.log('isAsync on create:', asyncOnCreate);
console.log('isAsync after toSync:', asyncAfterToSync);
```
### setstate_busname
# ISCH\_PrimitiveBus.setState\_BusName() method
> 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.
Set the property state: bus name
## Signature
```typescript
function setState_BusName(busName: string): ISCH_PrimitiveBus;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
busName
</td><td>
string
</td><td>
Bus name
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveBus](./ISCH_PrimitiveBus.md)
Bus primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试总线重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一条名为 DATA[0..7] 的测试总线(SCH 坐标单位 10mil)
const bus = await eda.sch_PrimitiveBus.create('DATA[0..7]', [x, y, x + 400, y]);
// 3. 读取修改前的名称
const before = bus.getState_BusName();
// 4. 切换异步模式并改名为 ADDR[0..15]
const asyncBus = bus.toAsync();
asyncBus.setState_BusName('ADDR[0..15]');
await asyncBus.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveBus.get(bus.getState_PrimitiveId());
console.log('busName:', before, '→', refetched.getState_BusName());
```
### setstate_color
# ISCH\_PrimitiveBus.setState\_Color() method
> 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.
Set the property state: Bus color
## Signature
```typescript
function setState_Color(color: string | null): ISCH_PrimitiveBus;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
color
</td><td>
string \| null
</td><td>
Bus color
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveBus](./ISCH_PrimitiveBus.md)
Bus primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试总线重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一条红色测试总线(SCH 坐标单位 10mil)
const bus = await eda.sch_PrimitiveBus.create('DATA[0..7]', [x, y, x + 400, y], '#FF0000', 6, 1);
// 3. 读取修改前的颜色
const before = bus.getState_Color();
// 4. 切换异步模式并改为绿色
const asyncBus = bus.toAsync();
asyncBus.setState_Color('#00AA00');
await asyncBus.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveBus.get(bus.getState_PrimitiveId());
console.log('color:', before, '→', refetched.getState_Color());
```
### setstate_line
# ISCH\_PrimitiveBus.setState\_Line() method
> 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.
Set the property state: polyline coordinate group
## Signature
```typescript
function setState_Line(line: Array<number> | Array<Array<number>>): ISCH_PrimitiveBus;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
line
</td><td>
Array<number> \| Array<Array<number>>
</td><td>
Polyline coordinate group
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveBus](./ISCH_PrimitiveBus.md)
Bus primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试总线重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一条水平单段测试总线(SCH 坐标单位 10mil)
const bus = await eda.sch_PrimitiveBus.create('DATA[0..7]', [x, y, x + 400, y]);
// 3. 读取修改前的路径
const before = bus.getState_Line();
// 4. 切换异步模式并改为 L 形两段(先水平再垂直,段间共享端点)
const asyncBus = bus.toAsync();
asyncBus.setState_Line([x, y, x + 400, y, x + 400, y + 400]);
await asyncBus.done();
// 5. 从画布重新读取,确认路径已更新(保留现场供观察)
const refetched = await eda.sch_PrimitiveBus.get(bus.getState_PrimitiveId());
console.log('line:', JSON.stringify(before), '→', JSON.stringify(refetched.getState_Line()));
```
### setstate_linetype
# ISCH\_PrimitiveBus.setState\_LineType() method
> 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.
Set the property state: line type
## Signature
```typescript
function setState_LineType(lineType: ESCH_PrimitiveLineType | null): ISCH_PrimitiveBus;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
lineType
</td><td>
[ESCH\_PrimitiveLineType](../enums/ESCH_PrimitiveLineType.md) \| null
</td><td>
Line type
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveBus](./ISCH_PrimitiveBus.md)
Bus primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试总线重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一条虚线(DASHED=1)测试总线(SCH 坐标单位 10mil)
const bus = await eda.sch_PrimitiveBus.create('DATA[0..7]', [x, y, x + 400, y], null, 6, 1);
// 3. 读取修改前的线型
const before = bus.getState_LineType();
// 4. 切换异步模式并改为点线(DOTTED=2)
const asyncBus = bus.toAsync();
asyncBus.setState_LineType(2);
await asyncBus.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveBus.get(bus.getState_PrimitiveId());
console.log('lineType:', before, '→', refetched.getState_LineType());
```
### setstate_linewidth
# ISCH\_PrimitiveBus.setState\_LineWidth() method
> 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.
Set the property state: Line width
## Signature
```typescript
function setState_LineWidth(lineWidth: number | null): ISCH_PrimitiveBus;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
lineWidth
</td><td>
number \| null
</td><td>
Line width
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveBus](./ISCH_PrimitiveBus.md)
Bus primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试总线重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一条线宽 6 的测试总线(SCH 坐标单位 10mil)
const bus = await eda.sch_PrimitiveBus.create('DATA[0..7]', [x, y, x + 400, y], null, 6, null);
// 3. 读取修改前的线宽
const before = bus.getState_LineWidth();
// 4. 切换异步模式并加粗到 10
const asyncBus = bus.toAsync();
asyncBus.setState_LineWidth(10);
await asyncBus.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveBus.get(bus.getState_PrimitiveId());
console.log('lineWidth:', before, '→', refetched.getState_LineWidth());
```
### toasync
# ISCH\_PrimitiveBus.toAsync() method
Convert Primitive to Async primitive
## Signature
```typescript
function toAsync(): ISCH_PrimitiveBus;
```
## Returns
[ISCH\_PrimitiveBus](./ISCH_PrimitiveBus.md)
Bus primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试总线重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一条测试总线(创建后默认处于异步模式)
const bus = await eda.sch_PrimitiveBus.create('DATA[0..7]', [x, y, x + 400, y]);
// 3. 转换为异步图元
const asyncBus = bus.toAsync();
// 4. 异步模式下累计修改并提交
asyncBus.setState_LineWidth(10);
await asyncBus.done();
// 5. 从画布重新读取,确认提交生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveBus.get(bus.getState_PrimitiveId());
console.log('isAsync after toAsync:', bus.isAsync());
console.log('lineWidth:', 6, '→', refetched.getState_LineWidth());
```
### tosync
# ISCH\_PrimitiveBus.toSync() method
Convert Primitive to Sync primitive
## Signature
```typescript
function toSync(): ISCH_PrimitiveBus;
```
## Returns
[ISCH\_PrimitiveBus](./ISCH_PrimitiveBus.md)
Bus primitive object
## Example
```javascript
// 1. 创建一条测试总线(创建后默认处于异步模式)
const bus = await eda.sch_PrimitiveBus.create('DATA[0..7]', [1000, 1000, 1400, 1000]);
// 2. 转换为同步图元,isAsync() 变为 false
const syncBus = bus.toSync();
const isAsyncAfterToSync = syncBus.isAsync();
// 3. 清理测试图元(本案例只演示模式转换,不修改画布)
await eda.sch_PrimitiveBus.delete([bus.getState_PrimitiveId()]);
console.log('isAsync after toSync:', isAsyncAfterToSync);
```
references/classes/ISCH_PrimitiveComponent.md
# ISCH\_PrimitiveComponent class
Device primitive
## Signature
```typescript
class ISCH_PrimitiveComponent implements ISCH_Primitive
```
**Implements:** [ISCH\_Primitive](../interfaces/ISCH_Primitive.md)
## Remarks
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[async](./ISCH_PrimitiveComponent.md)
</td><td>
`protected`
</td><td>
boolean
</td><td>
异步
</td></tr>
<tr><td>
[designator?](./ISCH_PrimitiveComponent.md)
</td><td>
`protected`
</td><td>
string
</td><td>
_(Optional)_ Component 属性:位号
</td></tr>
<tr><td>
[mirror](./ISCH_PrimitiveComponent.md)
</td><td>
`protected`
</td><td>
boolean
</td><td>
是否镜像
</td></tr>
<tr><td>
[name?](./ISCH_PrimitiveComponent.md)
</td><td>
`protected`
</td><td>
string
</td><td>
_(Optional)_ Component 属性:名称
</td></tr>
<tr><td>
[otherProperty?](./ISCH_PrimitiveComponent.md)
</td><td>
`protected`
</td><td>
Record<string, string \| number \| boolean>
</td><td>
_(Optional)_ 其它参数
</td></tr>
<tr><td>
[primitiveId?](./ISCH_PrimitiveComponent.md)
</td><td>
`protected`
</td><td>
string
</td><td>
_(Optional)_ 图元 ID
</td></tr>
<tr><td>
[rotation](./ISCH_PrimitiveComponent.md)
</td><td>
`protected`
</td><td>
number
</td><td>
旋转角度
</td></tr>
<tr><td>
[x](./ISCH_PrimitiveComponent.md)
</td><td>
`protected`
</td><td>
number
</td><td>
坐标 X
</td></tr>
<tr><td>
[y](./ISCH_PrimitiveComponent.md)
</td><td>
`protected`
</td><td>
number
</td><td>
坐标 Y
</td></tr>
</tbody></table>
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[done()](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Apply the changes to the primitives to the canvas
</td></tr>
<tr><td>
[getAllPins()](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Get all pins associated with the device
</td></tr>
<tr><td>
[getState\_AddIntoBom()](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: whether to add BOM
</td></tr>
<tr><td>
[getState\_AddIntoPcb()](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: whether to switch to PCB
</td></tr>
<tr><td>
[getState\_Component()](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: associate library device
</td></tr>
<tr><td>
[getState\_ComponentType()](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: device type
</td></tr>
<tr><td>
[getState\_Designator()](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: designator
</td></tr>
<tr><td>
[getState\_Footprint()](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: associate library footprint
</td></tr>
<tr><td>
[getState\_Manufacturer()](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: manufacturer
</td></tr>
<tr><td>
[getState\_ManufacturerId()](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: manufacturer ID
</td></tr>
<tr><td>
[getState\_Mirror()](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: whether it is mirrored
</td></tr>
<tr><td>
[getState\_Name()](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: name
</td></tr>
<tr><td>
[getState\_Net()](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: net name
</td></tr>
<tr><td>
[getState\_OtherProperty()](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: other parameters
</td></tr>
<tr><td>
[getState\_PrimitiveId()](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: primitive ID
</td></tr>
<tr><td>
[getState\_PrimitiveType()](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: primitive type
</td></tr>
<tr><td>
[getState\_Rotation()](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: rotation angle
</td></tr>
<tr><td>
[getState\_SubPartName()](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: sub-part name
</td></tr>
<tr><td>
[getState\_Supplier()](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: supplier
</td></tr>
<tr><td>
[getState\_SupplierId()](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: supplier ID
</td></tr>
<tr><td>
[getState\_Symbol()](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: associate library symbol
</td></tr>
<tr><td>
[getState\_UniqueId()](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: unique ID
</td></tr>
<tr><td>
[getState\_X()](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: X coordinate
</td></tr>
<tr><td>
[getState\_Y()](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
Get the property state: Y coordinate
</td></tr>
<tr><td>
[isAsync()](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
Query whether the primitive is an async primitive
</td></tr>
<tr><td>
[reset()](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Reset the async primitive to the current canvas state
</td></tr>
<tr><td>
[setState\_AddIntoBom(addIntoBom)](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: whether to add BOM
</td></tr>
<tr><td>
[setState\_AddIntoPcb(addIntoPcb)](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: whether to switch to PCB
</td></tr>
<tr><td>
[setState\_Designator(designator)](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: designator
</td></tr>
<tr><td>
[setState\_Manufacturer(manufacturer)](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: manufacturer
</td></tr>
<tr><td>
[setState\_ManufacturerId(manufacturerId)](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: manufacturer ID
</td></tr>
<tr><td>
[setState\_Mirror(mirror)](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: whether it is mirrored
</td></tr>
<tr><td>
[setState\_Name(name)](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: name
</td></tr>
<tr><td>
[setState\_Net(net)](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: net name
</td></tr>
<tr><td>
[setState\_OtherProperty(otherProperty)](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: other parameters
</td></tr>
<tr><td>
[setState\_Rotation(rotation)](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: rotation angle
</td></tr>
<tr><td>
[setState\_Supplier(supplier)](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: supplier
</td></tr>
<tr><td>
[setState\_SupplierId(supplierId)](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: supplier ID
</td></tr>
<tr><td>
[setState\_UniqueId(uniqueId)](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: unique ID
</td></tr>
<tr><td>
[setState\_X(x)](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: X coordinate
</td></tr>
<tr><td>
[setState\_Y(y)](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Y coordinate
</td></tr>
<tr><td>
[toAsync()](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
Convert Primitive to Async primitive
</td></tr>
<tr><td>
[toSync()](./ISCH_PrimitiveComponent.md)
</td><td>
</td><td>
Convert Primitive to Sync primitive
</td></tr>
</tbody></table>
---
## 属性详情
### async
# ISCH\_PrimitiveComponent.async property
异步
## Signature
```typescript
function async: boolean;
```
### designator
# ISCH\_PrimitiveComponent.designator property
Component 属性:位号
## Signature
```typescript
function designator?: string;
```
### mirror
# ISCH\_PrimitiveComponent.mirror property
是否镜像
## Signature
```typescript
function mirror: boolean;
```
### name
# ISCH\_PrimitiveComponent.name property
Component 属性:名称
## Signature
```typescript
function name?: string;
```
### otherproperty
# ISCH\_PrimitiveComponent.otherProperty property
其它参数
## Signature
```typescript
function otherProperty?: Record<string, string | number | boolean>;
```
### primitiveid
# ISCH\_PrimitiveComponent.primitiveId property
图元 ID
## Signature
```typescript
function primitiveId?: string;
```
### rotation
# ISCH\_PrimitiveComponent.rotation property
旋转角度
## Signature
```typescript
function rotation: number;
```
### x
# ISCH\_PrimitiveComponent.x property
坐标 X
## Signature
```typescript
function x: number;
```
### y
# ISCH\_PrimitiveComponent.y property
坐标 Y
## Signature
```typescript
function y: number;
```
---
## 方法详情
### done
# ISCH\_PrimitiveComponent.done() method
> 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.
Apply the changes to the primitives to the canvas
## Signature
```typescript
function done(): Promise<ISCH_PrimitiveComponent>;
```
## Returns
Promise<[ISCH\_PrimitiveComponent](./ISCH_PrimitiveComponent.md)<!-- -->>
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 放置一个测试器件(SCH 坐标单位 10mil)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
// 3. 切换异步模式,累计两处修改(写正式位号 + 旋转 90°)
const asyncComp = comp.toAsync();
asyncComp.setState_Designator('C200');
asyncComp.setState_Rotation(90);
// 4. 一次性提交到画布
await asyncComp.done();
// 5. 从画布重新读取,确认两处修改都已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveComponent.get(comp.getState_PrimitiveId());
console.log('designator: C? →', refetched.getState_Designator());
console.log('rotation: 0 →', refetched.getState_Rotation());
```
### getallpins
# ISCH\_PrimitiveComponent.getAllPins() method
> 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.
Get all pins associated with the device
## Signature
```typescript
function getAllPins(): Promise<Array<ISCH_PrimitiveComponentPin> | undefined>;
```
## Returns
Promise<Array<[ISCH\_PrimitiveComponentPin](./ISCH_PrimitiveComponentPin.md)<!-- -->> \| undefined>
Device pin primitive array
## Example
```javascript
// 1. 放置一个测试器件(C0402 电容有两个引脚,SCH 坐标单位 10mil)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 获取器件全部引脚(C0402 电容返回 2 个引脚图元)
const pins = await comp.getAllPins();
// 3. 清理测试器件(查询类需要清理)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('pinCount:', pins.length);
```
### getstate_addintobom
# ISCH\_PrimitiveComponent.getState\_AddIntoBom() method
Get the property state: whether to add BOM
## Signature
```typescript
function getState_AddIntoBom(): boolean | undefined;
```
## Returns
boolean \| undefined
Whether Add to BOM
## Example
```javascript
// 1. 放置一个测试器件(SCH 坐标单位 10mil)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 读取是否加入 BOM(默认 true)
const addIntoBom = comp.getState_AddIntoBom();
// 3. 清理测试器件(查询类需要清理)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('addIntoBom:', addIntoBom);
```
### getstate_addintopcb
# ISCH\_PrimitiveComponent.getState\_AddIntoPcb() method
Get the property state: whether to switch to PCB
## Signature
```typescript
function getState_AddIntoPcb(): boolean | undefined;
```
## Returns
boolean \| undefined
Whether Transfer to PCB
## Example
```javascript
// 1. 放置一个测试器件(SCH 坐标单位 10mil)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 读取是否转到 PCB(默认 true)
const addIntoPcb = comp.getState_AddIntoPcb();
// 3. 清理测试器件(查询类需要清理)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('addIntoPcb:', addIntoPcb);
```
### getstate_component
# ISCH\_PrimitiveComponent.getState\_Component() method
Get the property state: associate library device
## Signature
```typescript
function getState_Component(): { libraryUuid: string; uuid: string; name?: string } | undefined;
```
## Returns
{ libraryUuid: string; uuid: string; name?: string } \| undefined
Associate library device
## Example
```javascript
// 1. 放置一个测试器件(SCH 坐标单位 10mil)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 读取关联的库器件(含所属库 uuid 和器件 uuid)
const component = comp.getState_Component();
// 3. 清理测试器件(查询类需要清理)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('component:', JSON.stringify(component));
```
### getstate_componenttype
# ISCH\_PrimitiveComponent.getState\_ComponentType() method
Get the property state: device type
## Signature
```typescript
function getState_ComponentType(): ESCH_PrimitiveComponentType;
```
## Returns
[ESCH\_PrimitiveComponentType](../enums/ESCH_PrimitiveComponentType.md)
Device type
## Example
```javascript
// 1. 放置一个测试器件(普通元件,SCH 坐标单位 10mil)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 读取器件类型(普通元件为 'part')
const componentType = comp.getState_ComponentType();
// 3. 清理测试器件(查询类需要清理)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('componentType:', componentType);
```
### getstate_designator
# ISCH\_PrimitiveComponent.getState\_Designator() method
Get the property state: designator
## Signature
```typescript
function getState_Designator(): string | undefined;
```
## Returns
string \| undefined
Designator
## Example
```javascript
// 1. 放置一个测试器件(SCH 坐标单位 10mil)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 读取位号(未分配时是带问号的临时位号,如 C?)
const designator = comp.getState_Designator();
// 3. 清理测试器件(查询类需要清理)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('designator:', designator);
```
### getstate_footprint
# ISCH\_PrimitiveComponent.getState\_Footprint() method
Get the property state: associate library footprint
## Signature
```typescript
function getState_Footprint(): { libraryUuid: string; uuid: string; name?: string } | undefined;
```
## Returns
{ libraryUuid: string; uuid: string; name?: string } \| undefined
Associate library footprint
## Example
```javascript
// 1. 放置一个测试器件(SCH 坐标单位 10mil)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 读取关联的库封装(器件未绑定封装时为 undefined)
const footprint = comp.getState_Footprint();
// 3. 清理测试器件(查询类需要清理)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('footprint:', JSON.stringify(footprint));
```
### getstate_manufacturer
# ISCH\_PrimitiveComponent.getState\_Manufacturer() method
Get the property state: manufacturer
## Signature
```typescript
function getState_Manufacturer(): string | undefined;
```
## Returns
string \| undefined
Manufacturer
## Example
```javascript
// 1. 放置一个测试器件(SCH 坐标单位 10mil)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 读取制造商(库器件未填写时为 undefined)
const manufacturer = comp.getState_Manufacturer();
// 3. 清理测试器件(查询类需要清理)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('manufacturer:', manufacturer);
```
### getstate_manufacturerid
# ISCH\_PrimitiveComponent.getState\_ManufacturerId() method
Get the property state: manufacturer ID
## Signature
```typescript
function getState_ManufacturerId(): string | undefined;
```
## Returns
string \| undefined
Manufacturer ID
## Example
```javascript
// 1. 放置一个测试器件(SCH 坐标单位 10mil)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 读取制造商编号(库器件未填写时为 undefined)
const manufacturerId = comp.getState_ManufacturerId();
// 3. 清理测试器件(查询类需要清理)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('manufacturerId:', manufacturerId);
```
### getstate_mirror
# ISCH\_PrimitiveComponent.getState\_Mirror() method
Get the property state: whether it is mirrored
## Signature
```typescript
function getState_Mirror(): boolean;
```
## Returns
boolean
Whether it is mirrored
## Example
```javascript
// 1. 放置一个测试器件(SCH 坐标单位 10mil)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 读取镜像状态(默认 false)
const mirror = comp.getState_Mirror();
// 3. 清理测试器件(查询类需要清理)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('mirror:', mirror);
```
### getstate_name
# ISCH\_PrimitiveComponent.getState\_Name() method
Get the property state: name
## Signature
```typescript
function getState_Name(): string | undefined;
```
## Returns
string \| undefined
Name
## Example
```javascript
// 1. 放置一个测试器件(SCH 坐标单位 10mil)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 读取名称(默认继承库器件名)
const name = comp.getState_Name();
// 3. 清理测试器件(查询类需要清理)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('name:', name);
```
### getstate_net
# ISCH\_PrimitiveComponent.getState\_Net() method
Get the property state: net name
## Signature
```typescript
function getState_Net(): string | undefined;
```
## Returns
string \| undefined
Net name
## Example
```javascript
// 1. 放置一个测试器件(SCH 坐标单位 10mil)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 读取器件级网络名(普通元件为 undefined,引脚网络需查引脚对象)
const net = comp.getState_Net();
// 3. 清理测试器件(查询类需要清理)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('net:', net);
```
### getstate_otherproperty
# ISCH\_PrimitiveComponent.getState\_OtherProperty() method
Get the property state: other parameters
## Signature
```typescript
function getState_OtherProperty(): Record<string, string | number | boolean> | undefined;
```
## Returns
Record<string, string \| number \| boolean> \| undefined
Other parameters
## Example
```javascript
// 1. 放置一个测试器件(SCH 坐标单位 10mil)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 读取全部自定义参数(Record<键, 值>,未设置时为 undefined)
const otherProperty = comp.getState_OtherProperty();
// 3. 清理测试器件(查询类需要清理)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('otherProperty:', JSON.stringify(otherProperty));
```
### getstate_primitiveid
# ISCH\_PrimitiveComponent.getState\_PrimitiveId() method
Get the property state: primitive ID
## Signature
```typescript
function getState_PrimitiveId(): string;
```
## Returns
string
Primitive ID
## Example
```javascript
// 1. 放置一个测试器件(SCH 坐标单位 10mil)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
// 2. 读取图元 ID
const compId = comp.getState_PrimitiveId();
// 3. 清理测试器件(查询类需要清理)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('compId:', compId);
```
### getstate_primitivetype
# ISCH\_PrimitiveComponent.getState\_PrimitiveType() method
Get the property state: primitive type
## Signature
```typescript
function getState_PrimitiveType(): ESCH_PrimitiveType;
```
## Returns
[ESCH\_PrimitiveType](../enums/ESCH_PrimitiveType.md)
Primitive type
## Example
```javascript
// 1. 放置一个测试器件(SCH 坐标单位 10mil)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 读取图元类型(器件图元为 'Component')
const primitiveType = comp.getState_PrimitiveType();
// 3. 清理测试器件(查询类需要清理)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('primitiveType:', primitiveType);
```
### getstate_rotation
# ISCH\_PrimitiveComponent.getState\_Rotation() method
Get the property state: rotation angle
## Signature
```typescript
function getState_Rotation(): number;
```
## Returns
number
Rotation angle
## Example
```javascript
// 1. 放置一个测试器件(SCH 坐标单位 10mil)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 读取旋转角度(默认 0)
const rotation = comp.getState_Rotation();
// 3. 清理测试器件(查询类需要清理)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('rotation:', rotation);
```
### getstate_subpartname
# ISCH\_PrimitiveComponent.getState\_SubPartName() method
Get the property state: sub-part name
## Signature
```typescript
function getState_SubPartName(): string | undefined;
```
## Returns
string \| undefined
Sub-part name
## Example
```javascript
// 1. 放置一个测试器件(SCH 坐标单位 10mil)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 读取子部件名称(单子部件器件为 undefined)
const subPartName = comp.getState_SubPartName();
// 3. 清理测试器件(查询类需要清理)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('subPartName:', subPartName);
```
### getstate_supplier
# ISCH\_PrimitiveComponent.getState\_Supplier() method
Get the property state: supplier
## Signature
```typescript
function getState_Supplier(): string | undefined;
```
## Returns
string \| undefined
Supplier
## Example
```javascript
// 1. 放置一个测试器件(SCH 坐标单位 10mil)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 读取供应商(库器件未填写时为 undefined)
const supplier = comp.getState_Supplier();
// 3. 清理测试器件(查询类需要清理)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('supplier:', supplier);
```
### getstate_supplierid
# ISCH\_PrimitiveComponent.getState\_SupplierId() method
Get the property state: supplier ID
## Signature
```typescript
function getState_SupplierId(): string | undefined;
```
## Returns
string \| undefined
Supplier ID
## Example
```javascript
// 1. 放置一个测试器件(SCH 坐标单位 10mil)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 读取供应商编号(库器件未填写时为 undefined)
const supplierId = comp.getState_SupplierId();
// 3. 清理测试器件(查询类需要清理)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('supplierId:', supplierId);
```
### getstate_symbol
# ISCH\_PrimitiveComponent.getState\_Symbol() method
Get the property state: associate library symbol
## Signature
```typescript
function getState_Symbol(): { libraryUuid: string; uuid: string; name?: string } | undefined;
```
## Returns
{ libraryUuid: string; uuid: string; name?: string } \| undefined
Associate library symbol
## Example
```javascript
// 1. 放置一个测试器件(SCH 坐标单位 10mil)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 读取关联的库符号
const symbol = comp.getState_Symbol();
// 3. 清理测试器件(查询类需要清理)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('symbol:', JSON.stringify(symbol));
```
### getstate_uniqueid
# ISCH\_PrimitiveComponent.getState\_UniqueId() method
Get the property state: unique ID
## Signature
```typescript
function getState_UniqueId(): string | undefined;
```
## Returns
string \| undefined
Unique ID
## Example
```javascript
// 1. 放置一个测试器件(SCH 坐标单位 10mil)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 读取唯一 ID
const uniqueId = comp.getState_UniqueId();
// 3. 清理测试器件(查询类需要清理)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('uniqueId:', uniqueId);
```
### getstate_x
# ISCH\_PrimitiveComponent.getState\_X() method
Get the property state: X coordinate
## Signature
```typescript
function getState_X(): number;
```
## Returns
number
X coordinate
## Example
```javascript
// 1. 放置一个测试器件(SCH 坐标单位 10mil,100 ≈ 25.4mm)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 读取放置位置的 X 坐标
const x = comp.getState_X();
// 3. 清理测试器件(查询类需要清理)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('x:', x);
```
### getstate_y
# ISCH\_PrimitiveComponent.getState\_Y() method
Get the property state: Y coordinate
## Signature
```typescript
function getState_Y(): number;
```
## Returns
number
Y coordinate
## Example
```javascript
// 1. 放置一个测试器件(SCH 坐标单位 10mil,100 ≈ 25.4mm)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 读取放置位置的 Y 坐标(与放置时传入值一致)
const y = comp.getState_Y();
// 3. 清理测试器件(查询类需要清理)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('y:', y);
```
### isasync
# ISCH\_PrimitiveComponent.isAsync() method
Query whether the primitive is an async primitive
## Signature
```typescript
function isAsync(): boolean;
```
## Returns
boolean
Whether Is async primitive
## Example
```javascript
// 1. 放置一个测试器件(SCH 坐标单位 10mil)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 查询创建后的默认模式(新创建的图元默认为异步)
const isAsyncOnCreate = comp.isAsync();
// 3. 转为同步后再查一次,对比两种模式
const syncComp = comp.toSync();
const isAsyncAfterToSync = syncComp.isAsync();
// 4. 清理测试器件(查询类需要清理)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('isAsync on create:', isAsyncOnCreate);
console.log('isAsync after toSync:', isAsyncAfterToSync);
```
### reset
# ISCH\_PrimitiveComponent.reset() method
> 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.
Reset the async primitive to the current canvas state
## Signature
```typescript
function reset(): Promise<ISCH_PrimitiveComponent>;
```
## Returns
Promise<[ISCH\_PrimitiveComponent](./ISCH_PrimitiveComponent.md)<!-- -->>
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 放置一个测试器件,记录画布上的位号
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const compId = comp.getState_PrimitiveId();
const before = comp.getState_Designator();
// 3. 异步模式写入一个错误位号,但不提交,直接重置丢弃
const asyncComp = comp.toAsync();
asyncComp.setState_Designator('WRONG');
await asyncComp.reset();
// 4. 从画布重新读取,位号仍是重置前的值(保留现场供观察)
const refetched = await eda.sch_PrimitiveComponent.get(compId);
console.log('designator:', before, '→', refetched.getState_Designator());
```
### setstate_addintobom
# ISCH\_PrimitiveComponent.setState\_AddIntoBom() method
> 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.
Set the property state: whether to add BOM
## Signature
```typescript
function setState_AddIntoBom(addIntoBom: boolean | undefined): ISCH_PrimitiveComponent;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
addIntoBom
</td><td>
boolean \| undefined
</td><td>
Whether Add to BOM
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveComponent](./ISCH_PrimitiveComponent.md)
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 放置一个测试器件(SCH 坐标单位 10mil)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const before = comp.getState_AddIntoBom();
// 3. 切换异步模式,改为不加入 BOM 后提交
const asyncComp = comp.toAsync();
asyncComp.setState_AddIntoBom(false);
await asyncComp.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveComponent.get(comp.getState_PrimitiveId());
console.log('addIntoBom:', before, '→', refetched.getState_AddIntoBom());
```
### setstate_addintopcb
# ISCH\_PrimitiveComponent.setState\_AddIntoPcb() method
> 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.
Set the property state: whether to switch to PCB
## Signature
```typescript
function setState_AddIntoPcb(addIntoPcb: boolean | undefined): ISCH_PrimitiveComponent;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
addIntoPcb
</td><td>
boolean \| undefined
</td><td>
Whether Transfer to PCB
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveComponent](./ISCH_PrimitiveComponent.md)
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 放置一个测试器件(SCH 坐标单位 10mil)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const before = comp.getState_AddIntoPcb();
// 3. 切换异步模式,改为不转 PCB 后提交
const asyncComp = comp.toAsync();
asyncComp.setState_AddIntoPcb(false);
await asyncComp.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveComponent.get(comp.getState_PrimitiveId());
console.log('addIntoPcb:', before, '→', refetched.getState_AddIntoPcb());
```
### setstate_designator
# ISCH\_PrimitiveComponent.setState\_Designator() method
> 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.
Set the property state: designator
## Signature
```typescript
function setState_Designator(designator: string | undefined): ISCH_PrimitiveComponent;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
designator
</td><td>
string \| undefined
</td><td>
Designator
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveComponent](./ISCH_PrimitiveComponent.md)
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 放置一个测试器件,读取自动分配的临时位号(如 C?)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const before = comp.getState_Designator();
// 3. 切换异步模式,写入正式位号后提交
const asyncComp = comp.toAsync();
asyncComp.setState_Designator('C100');
await asyncComp.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveComponent.get(comp.getState_PrimitiveId());
console.log('designator:', before, '→', refetched.getState_Designator());
```
### setstate_manufacturer
# ISCH\_PrimitiveComponent.setState\_Manufacturer() method
> 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.
Set the property state: manufacturer
## Signature
```typescript
function setState_Manufacturer(manufacturer: string | undefined): ISCH_PrimitiveComponent;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
manufacturer
</td><td>
string \| undefined
</td><td>
Manufacturer
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveComponent](./ISCH_PrimitiveComponent.md)
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 放置一个测试器件,读取默认制造商
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const before = comp.getState_Manufacturer();
// 3. 切换异步模式,写入制造商后提交
const asyncComp = comp.toAsync();
asyncComp.setState_Manufacturer('YAGEO');
await asyncComp.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveComponent.get(comp.getState_PrimitiveId());
console.log('manufacturer:', before, '→', refetched.getState_Manufacturer());
```
### setstate_manufacturerid
# ISCH\_PrimitiveComponent.setState\_ManufacturerId() method
> 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.
Set the property state: manufacturer ID
## Signature
```typescript
function setState_ManufacturerId(manufacturerId: string | undefined): ISCH_PrimitiveComponent;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
manufacturerId
</td><td>
string \| undefined
</td><td>
Manufacturer ID
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveComponent](./ISCH_PrimitiveComponent.md)
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 放置一个测试器件,读取默认制造商编号
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const before = comp.getState_ManufacturerId();
// 3. 切换异步模式,写入 MPN 后提交
const asyncComp = comp.toAsync();
asyncComp.setState_ManufacturerId('CC0402KRX7R7BB104');
await asyncComp.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveComponent.get(comp.getState_PrimitiveId());
console.log('manufacturerId:', before, '→', refetched.getState_ManufacturerId());
```
### setstate_mirror
# ISCH\_PrimitiveComponent.setState\_Mirror() method
> 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.
Set the property state: whether it is mirrored
## Signature
```typescript
function setState_Mirror(mirror: boolean): ISCH_PrimitiveComponent;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
mirror
</td><td>
boolean
</td><td>
Whether it is mirrored
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveComponent](./ISCH_PrimitiveComponent.md)
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 放置一个测试器件,读取默认镜像状态(false)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const before = comp.getState_Mirror();
// 3. 切换异步模式,开启镜像后提交
const asyncComp = comp.toAsync();
asyncComp.setState_Mirror(true);
await asyncComp.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveComponent.get(comp.getState_PrimitiveId());
console.log('mirror:', before, '→', refetched.getState_Mirror());
```
### setstate_name
# ISCH\_PrimitiveComponent.setState\_Name() method
> 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.
Set the property state: name
## Signature
```typescript
function setState_Name(name: string | undefined): ISCH_PrimitiveComponent;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
name
</td><td>
string \| undefined
</td><td>
Name
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveComponent](./ISCH_PrimitiveComponent.md)
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 放置一个测试器件,读取默认名称(继承库器件名)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const before = comp.getState_Name();
// 3. 切换异步模式,写入用途名后提交
const asyncComp = comp.toAsync();
asyncComp.setState_Name('12V 输入滤波电容');
await asyncComp.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveComponent.get(comp.getState_PrimitiveId());
console.log('name:', before, '→', refetched.getState_Name());
```
### setstate_net
# ISCH\_PrimitiveComponent.setState\_Net() method
> 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.
Set the property state: net name
## Signature
```typescript
function setState_Net(net: string | undefined): ISCH_PrimitiveComponent;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string \| undefined
</td><td>
Net name
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveComponent](./ISCH_PrimitiveComponent.md)
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 放置一个测试器件,读取默认网络名
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const before = comp.getState_Net();
// 3. 切换异步模式,写入网络名后提交
const asyncComp = comp.toAsync();
asyncComp.setState_Net('VCC');
await asyncComp.done();
// 4. 从画布重新读取,普通元件读回空串(保留现场供观察)
const refetched = await eda.sch_PrimitiveComponent.get(comp.getState_PrimitiveId());
console.log('net:', before, '→', refetched.getState_Net());
```
### setstate_otherproperty
# ISCH\_PrimitiveComponent.setState\_OtherProperty() method
> 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.
Set the property state: other parameters
## Signature
```typescript
function setState_OtherProperty(
otherProperty: Record<string, string | number | boolean>,
): ISCH_PrimitiveComponent;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
otherProperty
</td><td>
Record<string, string \| number \| boolean>
</td><td>
Other parameters
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveComponent](./ISCH_PrimitiveComponent.md)
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 放置一个测试器件,读取默认参数集
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const before = comp.getState_OtherProperty();
// 3. 切换异步模式,写入规格参数组后提交
const asyncComp = comp.toAsync();
asyncComp.setState_OtherProperty({ Capacitance: '100nF', Voltage: '50V', Tolerance: '±10%' });
await asyncComp.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveComponent.get(comp.getState_PrimitiveId());
console.log('otherProperty:', JSON.stringify(before), '→', JSON.stringify(refetched.getState_OtherProperty()));
```
### setstate_rotation
# ISCH\_PrimitiveComponent.setState\_Rotation() method
> 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.
Set the property state: rotation angle
## Signature
```typescript
function setState_Rotation(rotation: number): ISCH_PrimitiveComponent;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
rotation
</td><td>
number
</td><td>
Rotation angle
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveComponent](./ISCH_PrimitiveComponent.md)
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 放置一个测试器件,读取默认角度(0)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const before = comp.getState_Rotation();
// 3. 切换异步模式,旋转 90° 后提交
const asyncComp = comp.toAsync();
asyncComp.setState_Rotation(90);
await asyncComp.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveComponent.get(comp.getState_PrimitiveId());
console.log('rotation:', before, '→', refetched.getState_Rotation());
```
### setstate_supplier
# ISCH\_PrimitiveComponent.setState\_Supplier() method
> 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.
Set the property state: supplier
## Signature
```typescript
function setState_Supplier(supplier: string | undefined): ISCH_PrimitiveComponent;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
supplier
</td><td>
string \| undefined
</td><td>
Supplier
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveComponent](./ISCH_PrimitiveComponent.md)
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 放置一个测试器件,读取默认供应商
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const before = comp.getState_Supplier();
// 3. 切换异步模式,写入供应商后提交
const asyncComp = comp.toAsync();
asyncComp.setState_Supplier('LCSC');
await asyncComp.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveComponent.get(comp.getState_PrimitiveId());
console.log('supplier:', before, '→', refetched.getState_Supplier());
```
### setstate_supplierid
# ISCH\_PrimitiveComponent.setState\_SupplierId() method
> 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.
Set the property state: supplier ID
## Signature
```typescript
function setState_SupplierId(supplierId: string | undefined): ISCH_PrimitiveComponent;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
supplierId
</td><td>
string \| undefined
</td><td>
Supplier ID
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveComponent](./ISCH_PrimitiveComponent.md)
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 放置一个测试器件,读取默认供应商编号
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const before = comp.getState_SupplierId();
// 3. 切换异步模式,写入编号后提交
const asyncComp = comp.toAsync();
asyncComp.setState_SupplierId('C1546');
await asyncComp.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveComponent.get(comp.getState_PrimitiveId());
console.log('supplierId:', before, '→', refetched.getState_SupplierId());
```
### setstate_uniqueid
# ISCH\_PrimitiveComponent.setState\_UniqueId() method
> 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.
Set the property state: unique ID
## Signature
```typescript
function setState_UniqueId(uniqueId: string | undefined): ISCH_PrimitiveComponent;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
uniqueId
</td><td>
string \| undefined
</td><td>
Unique ID
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveComponent](./ISCH_PrimitiveComponent.md)
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 放置一个测试器件,读取系统分配的唯一 ID
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const before = comp.getState_UniqueId();
// 3. 切换异步模式,写入新唯一 ID 后提交
const asyncComp = comp.toAsync();
asyncComp.setState_UniqueId('example-unique-id-001');
await asyncComp.done();
// 4. 从画布重新读取,观察写入结果(保留现场供观察)
const refetched = await eda.sch_PrimitiveComponent.get(comp.getState_PrimitiveId());
console.log('uniqueId:', before, '→', refetched.getState_UniqueId());
```
### setstate_x
# ISCH\_PrimitiveComponent.setState\_X() method
> 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.
Set the property state: X coordinate
## Signature
```typescript
function setState_X(x: number): ISCH_PrimitiveComponent;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
x
</td><td>
number
</td><td>
X coordinate
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveComponent](./ISCH_PrimitiveComponent.md)
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 放置一个测试器件,记录初始 X 坐标
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
// 3. 切换异步模式,向右移动 200 单位(约 5mm)后提交
const asyncComp = comp.toAsync();
asyncComp.setState_X(x + 200);
await asyncComp.done();
// 4. 从画布重新读取,确认移动已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveComponent.get(comp.getState_PrimitiveId());
console.log('x:', x, '→', refetched.getState_X());
```
### setstate_y
# ISCH\_PrimitiveComponent.setState\_Y() method
> 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.
Set the property state: Y coordinate
## Signature
```typescript
function setState_Y(y: number): ISCH_PrimitiveComponent;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
y
</td><td>
number
</td><td>
Y coordinate
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveComponent](./ISCH_PrimitiveComponent.md)
Device primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 放置一个测试器件,记录初始 Y 坐标
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
// 3. 切换异步模式,移动 200 单位(约 5mm)后提交
const asyncComp = comp.toAsync();
asyncComp.setState_Y(y + 200);
await asyncComp.done();
// 4. 从画布重新读取,确认移动已生效(读回值与设置值同号)
const refetched = await eda.sch_PrimitiveComponent.get(comp.getState_PrimitiveId());
console.log('y:', y, '+200 →', refetched.getState_Y());
```
### toasync
# ISCH\_PrimitiveComponent.toAsync() method
Convert Primitive to Async primitive
## Signature
```typescript
function toAsync(): ISCH_PrimitiveComponent;
```
## Returns
[ISCH\_PrimitiveComponent](./ISCH_PrimitiveComponent.md)
Arc line primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 放置一个测试器件(创建后默认处于异步模式)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
// 3. 显式转换为异步图元(同步图元由此回到异步模式)
const asyncComp = comp.toAsync();
asyncComp.setState_Designator('C300');
// 4. 提交到画布
await asyncComp.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveComponent.get(comp.getState_PrimitiveId());
console.log('isAsync:', comp.isAsync());
console.log('designator: C? →', refetched.getState_Designator());
```
### tosync
# ISCH\_PrimitiveComponent.toSync() method
Convert Primitive to Sync primitive
## Signature
```typescript
function toSync(): ISCH_PrimitiveComponent;
```
## Returns
[ISCH\_PrimitiveComponent](./ISCH_PrimitiveComponent.md)
Arc line primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试器件重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 放置一个测试器件(创建后默认处于异步模式)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const compId = comp.getState_PrimitiveId();
// 3. 转换为同步图元
const syncComp = comp.toSync();
// 4. 同步模式下写位号,立即生效,无需 done()
syncComp.setState_Designator('C400');
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveComponent.get(compId);
console.log('isAsync after toSync:', syncComp.isAsync());
console.log('designator: C? →', refetched.getState_Designator());
```
references/classes/ISCH_PrimitivePin.md
# ISCH\_PrimitivePin class
Pin primitive
## Signature
```typescript
class ISCH_PrimitivePin implements ISCH_Primitive
```
**Implements:** [ISCH\_Primitive](../interfaces/ISCH_Primitive.md)
## Remarks
Pin primitives are only available in the symbol editor. In a schematic sheet, the pin associated with a symbol is called [a device pin primitive](./ISCH_PrimitiveComponentPin.md)
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[async](./ISCH_PrimitivePin.md)
</td><td>
`protected`
</td><td>
boolean
</td><td>
异步
</td></tr>
<tr><td>
[noConnected?](./ISCH_PrimitivePin.md)
</td><td>
`protected`
</td><td>
boolean
</td><td>
_(Optional)_ 是否存在非连接标识
</td></tr>
<tr><td>
[otherProperty?](./ISCH_PrimitivePin.md)
</td><td>
`protected`
</td><td>
Record<string, string \| number \| boolean>
</td><td>
_(Optional)_ 其它参数
</td></tr>
<tr><td>
[pinColor](./ISCH_PrimitivePin.md)
</td><td>
`protected`
</td><td>
string \| null
</td><td>
引脚颜色
</td></tr>
<tr><td>
[pinLength](./ISCH_PrimitivePin.md)
</td><td>
`protected`
</td><td>
number
</td><td>
引脚长度
</td></tr>
<tr><td>
[pinName](./ISCH_PrimitivePin.md)
</td><td>
`protected`
</td><td>
string
</td><td>
引脚名称
</td></tr>
<tr><td>
[pinNumber](./ISCH_PrimitivePin.md)
</td><td>
`protected`
</td><td>
string
</td><td>
引脚编号
</td></tr>
<tr><td>
[pinShape](./ISCH_PrimitivePin.md)
</td><td>
`protected`
</td><td>
[ESCH\_PrimitivePinShape](../enums/ESCH_PrimitivePinShape.md)
</td><td>
引脚形状
</td></tr>
<tr><td>
[pinType](./ISCH_PrimitivePin.md)
</td><td>
`protected`
</td><td>
[ESCH\_PrimitivePinType](../enums/ESCH_PrimitivePinType.md)
</td><td>
引脚类型
</td></tr>
<tr><td>
[primitiveId?](./ISCH_PrimitivePin.md)
</td><td>
`protected`
</td><td>
string
</td><td>
_(Optional)_ 图元 ID
</td></tr>
<tr><td>
[primitiveType](./ISCH_PrimitivePin.md)
</td><td>
`protected`
`readonly`
</td><td>
[ESCH\_PrimitiveType](../enums/ESCH_PrimitiveType.md)
</td><td>
图元类型
</td></tr>
<tr><td>
[rotation](./ISCH_PrimitivePin.md)
</td><td>
`protected`
</td><td>
number
</td><td>
旋转角度
</td></tr>
<tr><td>
[x](./ISCH_PrimitivePin.md)
</td><td>
`protected`
</td><td>
number
</td><td>
坐标 X
</td></tr>
<tr><td>
[y](./ISCH_PrimitivePin.md)
</td><td>
`protected`
</td><td>
number
</td><td>
坐标 Y
</td></tr>
</tbody></table>
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[done()](./ISCH_PrimitivePin.md)
</td><td>
</td><td>
**_(BETA)_** Apply the changes to the primitives to the canvas
</td></tr>
<tr><td>
[getState\_NoConnected()](./ISCH_PrimitivePin.md)
</td><td>
</td><td>
Get the property state: whether there is a no-connect flag
</td></tr>
<tr><td>
[getState\_OtherProperty()](./ISCH_PrimitivePin.md)
</td><td>
</td><td>
Get the property state: other parameters
</td></tr>
<tr><td>
[getState\_PinColor()](./ISCH_PrimitivePin.md)
</td><td>
</td><td>
Get the property state: pin color
</td></tr>
<tr><td>
[getState\_PinLength()](./ISCH_PrimitivePin.md)
</td><td>
</td><td>
Get the property state: pin length
</td></tr>
<tr><td>
[getState\_PinName()](./ISCH_PrimitivePin.md)
</td><td>
</td><td>
Get the property state: pin name
</td></tr>
<tr><td>
[getState\_PinNumber()](./ISCH_PrimitivePin.md)
</td><td>
</td><td>
Get the property state: pin number
</td></tr>
<tr><td>
[getState\_PinShape()](./ISCH_PrimitivePin.md)
</td><td>
</td><td>
Get the property state: pin shape
</td></tr>
<tr><td>
[getState\_pinType()](./ISCH_PrimitivePin.md)
</td><td>
</td><td>
Get the property state: pin type
</td></tr>
<tr><td>
[getState\_PrimitiveId()](./ISCH_PrimitivePin.md)
</td><td>
</td><td>
Get the property state: primitive ID
</td></tr>
<tr><td>
[getState\_PrimitiveType()](./ISCH_PrimitivePin.md)
</td><td>
</td><td>
Get the property state: primitive type
</td></tr>
<tr><td>
[getState\_Rotation()](./ISCH_PrimitivePin.md)
</td><td>
</td><td>
Get the property state: rotation angle
</td></tr>
<tr><td>
[getState\_X()](./ISCH_PrimitivePin.md)
</td><td>
</td><td>
Get the property state: X coordinate
</td></tr>
<tr><td>
[getState\_Y()](./ISCH_PrimitivePin.md)
</td><td>
</td><td>
Get the property state: Y coordinate
</td></tr>
<tr><td>
[isAsync()](./ISCH_PrimitivePin.md)
</td><td>
</td><td>
Query whether the primitive is an async primitive
</td></tr>
<tr><td>
[reset()](./ISCH_PrimitivePin.md)
</td><td>
</td><td>
**_(BETA)_** Reset the async primitive to the current canvas state
</td></tr>
<tr><td>
[setState\_NoConnected(noConnected)](./ISCH_PrimitivePin.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: whether there is a no-connect flag
</td></tr>
<tr><td>
[setState\_OtherProperty(otherProperty)](./ISCH_PrimitivePin.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: other parameters
</td></tr>
<tr><td>
[setState\_PinColor(pinColor)](./ISCH_PrimitivePin.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: pin color
</td></tr>
<tr><td>
[setState\_PinLength(pinLength)](./ISCH_PrimitivePin.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: pin length
</td></tr>
<tr><td>
[setState\_PinName(pinName)](./ISCH_PrimitivePin.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: pin name
</td></tr>
<tr><td>
[setState\_PinNumber(pinNumber)](./ISCH_PrimitivePin.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: pin number
</td></tr>
<tr><td>
[setState\_PinShape(pinShape)](./ISCH_PrimitivePin.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: pin shape
</td></tr>
<tr><td>
[setState\_PinType(pinType)](./ISCH_PrimitivePin.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: pin type
</td></tr>
<tr><td>
[setState\_Rotation(rotation)](./ISCH_PrimitivePin.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: rotation angle
</td></tr>
<tr><td>
[setState\_X(x)](./ISCH_PrimitivePin.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: X coordinate
</td></tr>
<tr><td>
[setState\_Y(y)](./ISCH_PrimitivePin.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Y coordinate
</td></tr>
<tr><td>
[toAsync()](./ISCH_PrimitivePin.md)
</td><td>
</td><td>
Convert Primitive to Async primitive
</td></tr>
<tr><td>
[toSync()](./ISCH_PrimitivePin.md)
</td><td>
</td><td>
Convert Primitive to Sync primitive
</td></tr>
</tbody></table>
---
## 属性详情
### async
# ISCH\_PrimitivePin.async property
异步
## Signature
```typescript
function async: boolean;
```
### noconnected
# ISCH\_PrimitivePin.noConnected property
是否存在非连接标识
## Signature
```typescript
function noConnected?: boolean;
```
### otherproperty
# ISCH\_PrimitivePin.otherProperty property
其它参数
## Signature
```typescript
function otherProperty?: Record<string, string | number | boolean>;
```
### pincolor
# ISCH\_PrimitivePin.pinColor property
引脚颜色
## Signature
```typescript
function pinColor: string | null;
```
### pinlength
# ISCH\_PrimitivePin.pinLength property
引脚长度
## Signature
```typescript
function pinLength: number;
```
### pinname
# ISCH\_PrimitivePin.pinName property
引脚名称
## Signature
```typescript
function pinName: string;
```
### pinnumber
# ISCH\_PrimitivePin.pinNumber property
引脚编号
## Signature
```typescript
function pinNumber: string;
```
### pinshape
# ISCH\_PrimitivePin.pinShape property
引脚形状
## Signature
```typescript
function pinShape: ESCH_PrimitivePinShape;
```
### pintype
# ISCH\_PrimitivePin.pinType property
引脚类型
## Signature
```typescript
function pinType: ESCH_PrimitivePinType;
```
### primitiveid
# ISCH\_PrimitivePin.primitiveId property
图元 ID
## Signature
```typescript
function primitiveId?: string;
```
### primitivetype
# ISCH\_PrimitivePin.primitiveType property
图元类型
## Signature
```typescript
function readonly primitiveType: ESCH_PrimitiveType;
```
### rotation
# ISCH\_PrimitivePin.rotation property
旋转角度
## Signature
```typescript
function rotation: number;
```
### x
# ISCH\_PrimitivePin.x property
坐标 X
## Signature
```typescript
function x: number;
```
### y
# ISCH\_PrimitivePin.y property
坐标 Y
## Signature
```typescript
function y: number;
```
---
## 方法详情
### done
# ISCH\_PrimitivePin.done() method
> 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.
Apply the changes to the primitives to the canvas
## Signature
```typescript
function done(): Promise<ISCH_PrimitivePin>;
```
## Returns
Promise<[ISCH\_PrimitivePin](./ISCH_PrimitivePin.md)<!-- -->>
Pin primitive object
## Example
```javascript
// 0. 确保当前文档是符号编辑器:优先复用测试符号,没有则新建后打开
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('嘉立创示例_Pin测试符号', libUuid);
const symUuid = found[0] ? found[0].uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 生成本次运行专用的坐标,避免与之前保留的测试引脚重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 在符号画布上创建一个测试引脚
const pin = await eda.sch_PrimitivePin.create(x, y, '1', 'CLK', 0, 10, null, 'None', 'IN');
// 3. 异步模式下连续修改编号和名称(此时画布尚未变化)
const asyncPin = pin.toAsync();
asyncPin.setState_PinNumber('A1');
asyncPin.setState_PinName('SYS_CLK');
// 4. done() 一次性提交两处修改
const applied = await asyncPin.done();
// 5. 从画布重新取引脚,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitivePin.get(pin.getState_PrimitiveId());
console.log('applied number:', refetched.getState_PinNumber());
console.log('applied name:', refetched.getState_PinName());
console.log('done returns same primitive:', applied.getState_PrimitiveId() === pin.getState_PrimitiveId());
```
### getstate_noconnected
# ISCH\_PrimitivePin.getState\_NoConnected() method
Get the property state: whether there is a no-connect flag
## Signature
```typescript
function getState_NoConnected(): boolean | undefined;
```
## Returns
boolean \| undefined
Whether there is a no-connect flag
## Example
```javascript
// 0. 确保当前文档是符号编辑器:优先复用测试符号,没有则新建后打开
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('嘉立创示例_Pin测试符号', libUuid);
const symUuid = found[0] ? found[0].uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 在符号画布上创建一个测试引脚
const pin = await eda.sch_PrimitivePin.create(400, 300, '1', 'NC', 0, 10, null, 'None', 'Passive');
// 2. 从画布重新取引脚实例后读取非连接标识(新引脚默认 false)
const fresh = await eda.sch_PrimitivePin.get(pin.getState_PrimitiveId());
const noConnected = fresh.getState_NoConnected();
// 3. 清理测试引脚(查询类需要清理)
await eda.sch_PrimitivePin.delete([pin.getState_PrimitiveId()]);
console.log('noConnected:', noConnected);
```
### getstate_otherproperty
# ISCH\_PrimitivePin.getState\_OtherProperty() method
Get the property state: other parameters
## Signature
```typescript
function getState_OtherProperty(): Record<string, string | number | boolean> | undefined;
```
## Returns
Record<string, string \| number \| boolean> \| undefined
Other parameters
## Example
```javascript
// 0. 确保当前文档是符号编辑器:优先复用测试符号,没有则新建后打开
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('嘉立创示例_Pin测试符号', libUuid);
const symUuid = found[0] ? found[0].uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 在符号画布上创建一个测试引脚
const pin = await eda.sch_PrimitivePin.create(400, 300, '1', 'CLK', 0, 10, null, 'None', 'IN');
// 2. 从画布重新取引脚实例后读取其它参数
const fresh = await eda.sch_PrimitivePin.get(pin.getState_PrimitiveId());
const otherProperty = fresh.getState_OtherProperty();
// 3. 清理测试引脚(查询类需要清理)
await eda.sch_PrimitivePin.delete([pin.getState_PrimitiveId()]);
console.log('otherProperty:', otherProperty);
```
### getstate_pincolor
# ISCH\_PrimitivePin.getState\_PinColor() method
Get the property state: pin color
## Signature
```typescript
function getState_PinColor(): string | null;
```
## Returns
string \| null
Pin color
## Example
```javascript
// 0. 确保当前文档是符号编辑器:优先复用测试符号,没有则新建后打开
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('嘉立创示例_Pin测试符号', libUuid);
const symUuid = found[0] ? found[0].uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 在符号画布上创建一个测试引脚,指定颜色 #0000FF
const pin = await eda.sch_PrimitivePin.create(400, 300, '1', 'CLK', 0, 10, '#0000FF', 'None', 'IN');
// 2. 读取引脚颜色
const pinColor = pin.getState_PinColor();
// 3. 清理测试引脚(查询类需要清理)
await eda.sch_PrimitivePin.delete([pin.getState_PrimitiveId()]);
console.log('pinColor:', pinColor);
```
### getstate_pinlength
# ISCH\_PrimitivePin.getState\_PinLength() method
Get the property state: pin length
## Signature
```typescript
function getState_PinLength(): number;
```
## Returns
number
Pin length
## Example
```javascript
// 0. 确保当前文档是符号编辑器:优先复用测试符号,没有则新建后打开
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('嘉立创示例_Pin测试符号', libUuid);
const symUuid = found[0] ? found[0].uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 在符号画布上创建一个测试引脚,引脚长度 20
const pin = await eda.sch_PrimitivePin.create(400, 300, '1', 'CLK', 0, 20, null, 'None', 'IN');
// 2. 读取引脚长度
const pinLength = pin.getState_PinLength();
// 3. 清理测试引脚(查询类需要清理)
await eda.sch_PrimitivePin.delete([pin.getState_PrimitiveId()]);
console.log('pinLength:', pinLength);
```
### getstate_pinname
# ISCH\_PrimitivePin.getState\_PinName() method
Get the property state: pin name
## Signature
```typescript
function getState_PinName(): string;
```
## Returns
string
Pin name
## Example
```javascript
// 0. 确保当前文档是符号编辑器:优先复用测试符号,没有则新建后打开
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('嘉立创示例_Pin测试符号', libUuid);
const symUuid = found[0] ? found[0].uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 在符号画布上创建一个测试引脚,名称为 CLK
const pin = await eda.sch_PrimitivePin.create(400, 300, '1', 'CLK', 0, 10, null, 'None', 'IN');
// 2. 读取引脚名称
const pinName = pin.getState_PinName();
// 3. 清理测试引脚(查询类需要清理)
await eda.sch_PrimitivePin.delete([pin.getState_PrimitiveId()]);
console.log('pinName:', pinName);
```
### getstate_pinnumber
# ISCH\_PrimitivePin.getState\_PinNumber() method
Get the property state: pin number
## Signature
```typescript
function getState_PinNumber(): string;
```
## Returns
string
Pin number
## Example
```javascript
// 0. 确保当前文档是符号编辑器:优先复用测试符号,没有则新建后打开
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('嘉立创示例_Pin测试符号', libUuid);
const symUuid = found[0] ? found[0].uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 在符号画布上创建一个测试引脚,编号为 1
const pin = await eda.sch_PrimitivePin.create(400, 300, '1', 'CLK', 0, 10, null, 'None', 'IN');
// 2. 读取引脚编号
const pinNumber = pin.getState_PinNumber();
// 3. 清理测试引脚(查询类需要清理)
await eda.sch_PrimitivePin.delete([pin.getState_PrimitiveId()]);
console.log('pinNumber:', pinNumber);
```
### getstate_pinshape
# ISCH\_PrimitivePin.getState\_PinShape() method
Get the property state: pin shape
## Signature
```typescript
function getState_PinShape(): ESCH_PrimitivePinShape;
```
## Returns
[ESCH\_PrimitivePinShape](../enums/ESCH_PrimitivePinShape.md)
Pin shape
## Example
```javascript
// 0. 确保当前文档是符号编辑器:优先复用测试符号,没有则新建后打开
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('嘉立创示例_Pin测试符号', libUuid);
const symUuid = found[0] ? found[0].uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 在符号画布上创建一个测试引脚,形状为 Clock(时钟标记)
const pin = await eda.sch_PrimitivePin.create(400, 300, '1', 'CLK', 0, 10, null, 'Clock', 'IN');
// 2. 读取引脚形状
const pinShape = pin.getState_PinShape();
// 3. 清理测试引脚(查询类需要清理)
await eda.sch_PrimitivePin.delete([pin.getState_PrimitiveId()]);
console.log('pinShape:', pinShape);
```
### getstate_pintype
# ISCH\_PrimitivePin.getState\_pinType() method
Get the property state: pin type
## Signature
```typescript
function getState_pinType(): ESCH_PrimitivePinType;
```
## Returns
[ESCH\_PrimitivePinType](../enums/ESCH_PrimitivePinType.md)
Pin type
## Example
```javascript
// 0. 确保当前文档是符号编辑器:优先复用测试符号,没有则新建后打开
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('嘉立创示例_Pin测试符号', libUuid);
const symUuid = found[0] ? found[0].uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 在符号画布上创建一个测试引脚,电气类型为 IN
const pin = await eda.sch_PrimitivePin.create(400, 300, '1', 'CLK', 0, 10, null, 'None', 'IN');
// 2. 读取引脚电气类型(方法名小写 p 开头,签名如此)
const pinType = pin.getState_pinType();
// 3. 清理测试引脚(查询类需要清理)
await eda.sch_PrimitivePin.delete([pin.getState_PrimitiveId()]);
console.log('pinType:', pinType);
```
### getstate_primitiveid
# ISCH\_PrimitivePin.getState\_PrimitiveId() method
Get the property state: primitive ID
## Signature
```typescript
function getState_PrimitiveId(): string;
```
## Returns
string
Primitive ID
## Example
```javascript
// 0. 确保当前文档是符号编辑器:优先复用测试符号,没有则新建后打开
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('嘉立创示例_Pin测试符号', libUuid);
const symUuid = found[0] ? found[0].uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 在符号画布上创建一个测试引脚
const pin = await eda.sch_PrimitivePin.create(400, 300, '1', 'CLK', 0, 10, null, 'None', 'IN');
// 2. 读取图元 ID
const primitiveId = pin.getState_PrimitiveId();
// 3. 用该 ID 从画布重新取回引脚,验证 ID 有效
const refetched = await eda.sch_PrimitivePin.get(primitiveId);
// 4. 清理测试引脚(查询类需要清理)
await eda.sch_PrimitivePin.delete([primitiveId]);
console.log('primitiveId:', primitiveId);
console.log('refetched number:', refetched.getState_PinNumber());
```
### getstate_primitivetype
# ISCH\_PrimitivePin.getState\_PrimitiveType() method
Get the property state: primitive type
## Signature
```typescript
function getState_PrimitiveType(): ESCH_PrimitiveType;
```
## Returns
[ESCH\_PrimitiveType](../enums/ESCH_PrimitiveType.md)
Primitive type
## Example
```javascript
// 0. 确保当前文档是符号编辑器:优先复用测试符号,没有则新建后打开
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('嘉立创示例_Pin测试符号', libUuid);
const symUuid = found[0] ? found[0].uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 在符号画布上创建一个测试引脚
const pin = await eda.sch_PrimitivePin.create(400, 300, '1', 'CLK', 0, 10, null, 'None', 'IN');
// 2. 读取图元类型
const primitiveType = pin.getState_PrimitiveType();
// 3. 清理测试引脚(查询类需要清理)
await eda.sch_PrimitivePin.delete([pin.getState_PrimitiveId()]);
console.log('primitiveType:', primitiveType);
```
### getstate_rotation
# ISCH\_PrimitivePin.getState\_Rotation() method
Get the property state: rotation angle
## Signature
```typescript
function getState_Rotation(): number;
```
## Returns
number
Rotation angle
## Example
```javascript
// 0. 确保当前文档是符号编辑器:优先复用测试符号,没有则新建后打开
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('嘉立创示例_Pin测试符号', libUuid);
const symUuid = found[0] ? found[0].uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 在符号画布上创建一个测试引脚,旋转 90 度(朝上)
const pin = await eda.sch_PrimitivePin.create(400, 300, '1', 'CLK', 90, 10, null, 'None', 'IN');
// 2. 读取旋转角度
const rotation = pin.getState_Rotation();
// 3. 清理测试引脚(查询类需要清理)
await eda.sch_PrimitivePin.delete([pin.getState_PrimitiveId()]);
console.log('rotation:', rotation);
```
### getstate_x
# ISCH\_PrimitivePin.getState\_X() method
Get the property state: X coordinate
## Signature
```typescript
function getState_X(): number;
```
## Returns
number
X coordinate
## Example
```javascript
// 0. 确保当前文档是符号编辑器:优先复用测试符号,没有则新建后打开
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('嘉立创示例_Pin测试符号', libUuid);
const symUuid = found[0] ? found[0].uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 在符号画布上创建一个测试引脚(X = 400,约 101.6mm)
const pin = await eda.sch_PrimitivePin.create(400, 300, '1', 'CLK', 0, 10, null, 'None', 'IN');
// 2. 读取引脚坐标 X
const x = pin.getState_X();
// 3. 清理测试引脚(查询类需要清理)
await eda.sch_PrimitivePin.delete([pin.getState_PrimitiveId()]);
console.log('x:', x);
```
### getstate_y
# ISCH\_PrimitivePin.getState\_Y() method
Get the property state: Y coordinate
## Signature
```typescript
function getState_Y(): number;
```
## Returns
number
Y coordinate
## Example
```javascript
// 0. 确保当前文档是符号编辑器:优先复用测试符号,没有则新建后打开
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('嘉立创示例_Pin测试符号', libUuid);
const symUuid = found[0] ? found[0].uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 在符号画布上创建一个测试引脚(Y = 300,约 76.2mm)
const pin = await eda.sch_PrimitivePin.create(400, 300, '1', 'CLK', 0, 10, null, 'None', 'IN');
// 2. 读取引脚坐标 Y
const y = pin.getState_Y();
// 3. 清理测试引脚(查询类需要清理)
await eda.sch_PrimitivePin.delete([pin.getState_PrimitiveId()]);
console.log('y:', y);
```
### isasync
# ISCH\_PrimitivePin.isAsync() method
Query whether the primitive is an async primitive
## Signature
```typescript
function isAsync(): boolean;
```
## Returns
boolean
Whether Is async primitive
## Example
```javascript
// 0. 确保当前文档是符号编辑器:优先复用测试符号,没有则新建后打开
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('嘉立创示例_Pin测试符号', libUuid);
const symUuid = found[0] ? found[0].uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 在符号画布上创建一个测试引脚(默认异步模式)
const pin = await eda.sch_PrimitivePin.create(400, 300, '1', 'CLK', 0, 10, null, 'None', 'IN');
const asyncByDefault = pin.isAsync();
// 2. 转同步后再查,模式变为 false
const syncPin = pin.toSync();
const afterToSync = syncPin.isAsync();
// 3. 再转回异步,模式恢复 true
const asyncAgain = syncPin.toAsync();
const afterToAsync = asyncAgain.isAsync();
// 4. 清理测试引脚(查询类需要清理)
await eda.sch_PrimitivePin.delete([pin.getState_PrimitiveId()]);
console.log('asyncByDefault:', asyncByDefault);
console.log('afterToSync:', afterToSync);
console.log('afterToAsync:', afterToAsync);
```
### reset
# ISCH\_PrimitivePin.reset() method
> 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.
Reset the async primitive to the current canvas state
## Signature
```typescript
function reset(): Promise<ISCH_PrimitivePin>;
```
## Returns
Promise<[ISCH\_PrimitivePin](./ISCH_PrimitivePin.md)<!-- -->>
Pin primitive object
## Example
```javascript
// 0. 确保当前文档是符号编辑器:优先复用测试符号,没有则新建后打开
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('嘉立创示例_Pin测试符号', libUuid);
const symUuid = found[0] ? found[0].uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 生成本次运行专用的坐标,避免与之前保留的测试引脚重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 在符号画布上创建一个测试引脚,名称为 CLK
const pin = await eda.sch_PrimitivePin.create(x, y, '1', 'CLK', 0, 10, null, 'None', 'IN');
// 3. 异步模式下把名称改成错误值
const asyncPin = pin.toAsync();
asyncPin.setState_PinName('WRONG_NAME');
// 4. reset() 丢弃未提交的修改
await asyncPin.reset();
// 5. 从画布重新取引脚,名称仍是原来的值(保留现场供观察)
const refetched = await eda.sch_PrimitivePin.get(pin.getState_PrimitiveId());
console.log('pinName after reset:', refetched.getState_PinName());
```
### setstate_noconnected
# ISCH\_PrimitivePin.setState\_NoConnected() method
> 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.
Set the property state: whether there is a no-connect flag
## Signature
```typescript
function setState_NoConnected(noConnected: boolean): ISCH_PrimitivePin;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
noConnected
</td><td>
boolean
</td><td>
Whether there is a no-connect flag
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitivePin](./ISCH_PrimitivePin.md)
Pin primitive object
## Example
```javascript
// 0. 确保当前文档是符号编辑器:优先复用测试符号,没有则新建后打开
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('嘉立创示例_Pin测试符号', libUuid);
const symUuid = found[0] ? found[0].uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 生成本次运行专用的坐标,避免与之前保留的测试引脚重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 在符号画布上创建一个测试引脚,默认无非连接标识
const pin = await eda.sch_PrimitivePin.create(x, y, '1', 'NC', 0, 10, null, 'None', 'Passive');
const before = pin.getState_NoConnected();
// 3. 切换异步模式,打上非连接标识后提交画布
const asyncPin = pin.toAsync();
asyncPin.setState_NoConnected(true);
await asyncPin.done();
// 4. 从画布重新取引脚,确认标识已更新(保留现场供观察)
const refetched = await eda.sch_PrimitivePin.get(pin.getState_PrimitiveId());
console.log('noConnected:', before, '→', refetched.getState_NoConnected());
```
### setstate_otherproperty
# ISCH\_PrimitivePin.setState\_OtherProperty() method
> 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.
Set the property state: other parameters
## Signature
```typescript
function setState_OtherProperty(
otherProperty: Record<string, string | number | boolean>,
): ISCH_PrimitivePin;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
otherProperty
</td><td>
Record<string, string \| number \| boolean>
</td><td>
Other parameters
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitivePin](./ISCH_PrimitivePin.md)
Pin primitive object
## Example
```javascript
// 0. 确保当前文档是符号编辑器:优先复用测试符号,没有则新建后打开
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('嘉立创示例_Pin测试符号', libUuid);
const symUuid = found[0] ? found[0].uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 生成本次运行专用的坐标,避免与之前保留的测试引脚重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 在符号画布上创建一个测试引脚
const pin = await eda.sch_PrimitivePin.create(x, y, '1', 'CLK', 0, 10, null, 'None', 'IN');
const before = pin.getState_OtherProperty();
// 3. 切换异步模式,写入一个扩展键值后提交画布
const asyncPin = pin.toAsync();
asyncPin.setState_OtherProperty({ note: 'demo', level: 3 });
await asyncPin.done();
// 4. 从画布重新取引脚,查看其它参数(保留现场供观察)
const refetched = await eda.sch_PrimitivePin.get(pin.getState_PrimitiveId());
console.log('otherProperty:', before, '→', refetched.getState_OtherProperty());
```
### setstate_pincolor
# ISCH\_PrimitivePin.setState\_PinColor() method
> 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.
Set the property state: pin color
## Signature
```typescript
function setState_PinColor(pinColor: string | null): ISCH_PrimitivePin;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
pinColor
</td><td>
string \| null
</td><td>
Pin color
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitivePin](./ISCH_PrimitivePin.md)
Pin primitive object
## Example
```javascript
// 0. 确保当前文档是符号编辑器:优先复用测试符号,没有则新建后打开
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('嘉立创示例_Pin测试符号', libUuid);
const symUuid = found[0] ? found[0].uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 生成本次运行专用的坐标,避免与之前保留的测试引脚重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 在符号画布上创建一个测试引脚,颜色 #0000FF
const pin = await eda.sch_PrimitivePin.create(x, y, '1', 'CLK', 0, 10, '#0000FF', 'None', 'IN');
const before = pin.getState_PinColor();
// 3. 切换异步模式,把颜色改成 #FF0000 后提交画布
const asyncPin = pin.toAsync();
asyncPin.setState_PinColor('#FF0000');
await asyncPin.done();
// 4. 从画布重新取引脚,确认颜色已更新(保留现场供观察)
const refetched = await eda.sch_PrimitivePin.get(pin.getState_PrimitiveId());
console.log('pinColor:', before, '→', refetched.getState_PinColor());
```
### setstate_pinlength
# ISCH\_PrimitivePin.setState\_PinLength() method
> 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.
Set the property state: pin length
## Signature
```typescript
function setState_PinLength(pinLength: number): ISCH_PrimitivePin;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
pinLength
</td><td>
number
</td><td>
Pin length
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitivePin](./ISCH_PrimitivePin.md)
Pin primitive object
## Example
```javascript
// 0. 确保当前文档是符号编辑器:优先复用测试符号,没有则新建后打开
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('嘉立创示例_Pin测试符号', libUuid);
const symUuid = found[0] ? found[0].uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 生成本次运行专用的坐标,避免与之前保留的测试引脚重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 在符号画布上创建一个测试引脚,引脚长度 10
const pin = await eda.sch_PrimitivePin.create(x, y, '1', 'CLK', 0, 10, null, 'None', 'IN');
const before = pin.getState_PinLength();
// 3. 切换异步模式,把长度改成 20 后提交画布
const asyncPin = pin.toAsync();
asyncPin.setState_PinLength(20);
await asyncPin.done();
// 4. 从画布重新取引脚,确认长度已更新(保留现场供观察)
const refetched = await eda.sch_PrimitivePin.get(pin.getState_PrimitiveId());
console.log('pinLength:', before, '→', refetched.getState_PinLength());
```
### setstate_pinname
# ISCH\_PrimitivePin.setState\_PinName() method
> 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.
Set the property state: pin name
## Signature
```typescript
function setState_PinName(pinName: string): ISCH_PrimitivePin;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
pinName
</td><td>
string
</td><td>
Pin name
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitivePin](./ISCH_PrimitivePin.md)
Pin primitive object
## Example
```javascript
// 0. 确保当前文档是符号编辑器:优先复用测试符号,没有则新建后打开
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('嘉立创示例_Pin测试符号', libUuid);
const symUuid = found[0] ? found[0].uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 生成本次运行专用的坐标,避免与之前保留的测试引脚重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 在符号画布上创建一个测试引脚,名称为 CLK
const pin = await eda.sch_PrimitivePin.create(x, y, '1', 'CLK', 0, 10, null, 'None', 'IN');
const before = pin.getState_PinName();
// 3. 切换异步模式,把名称改成 SYS_CLK 后提交画布
const asyncPin = pin.toAsync();
asyncPin.setState_PinName('SYS_CLK');
await asyncPin.done();
// 4. 从画布重新取引脚,确认名称已更新(保留现场供观察)
const refetched = await eda.sch_PrimitivePin.get(pin.getState_PrimitiveId());
console.log('pinName:', before, '→', refetched.getState_PinName());
```
### setstate_pinnumber
# ISCH\_PrimitivePin.setState\_PinNumber() method
> 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.
Set the property state: pin number
## Signature
```typescript
function setState_PinNumber(pinNumber: string): ISCH_PrimitivePin;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
pinNumber
</td><td>
string
</td><td>
Pin number
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitivePin](./ISCH_PrimitivePin.md)
Pin primitive object
## Example
```javascript
// 0. 确保当前文档是符号编辑器:优先复用测试符号,没有则新建后打开
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('嘉立创示例_Pin测试符号', libUuid);
const symUuid = found[0] ? found[0].uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 生成本次运行专用的坐标,避免与之前保留的测试引脚重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 在符号画布上创建一个测试引脚,编号为 1
const pin = await eda.sch_PrimitivePin.create(x, y, '1', 'CLK', 0, 10, null, 'None', 'IN');
const before = pin.getState_PinNumber();
// 3. 切换异步模式,把编号改成 A1 后提交画布
const asyncPin = pin.toAsync();
asyncPin.setState_PinNumber('A1');
await asyncPin.done();
// 4. 从画布重新取引脚,确认编号已更新(保留现场供观察)
const refetched = await eda.sch_PrimitivePin.get(pin.getState_PrimitiveId());
console.log('pinNumber:', before, '→', refetched.getState_PinNumber());
```
### setstate_pinshape
# ISCH\_PrimitivePin.setState\_PinShape() method
> 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.
Set the property state: pin shape
## Signature
```typescript
function setState_PinShape(pinShape: ESCH_PrimitivePinShape): ISCH_PrimitivePin;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
pinShape
</td><td>
[ESCH\_PrimitivePinShape](../enums/ESCH_PrimitivePinShape.md)
</td><td>
Pin shape
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitivePin](./ISCH_PrimitivePin.md)
Pin primitive object
## Example
```javascript
// 0. 确保当前文档是符号编辑器:优先复用测试符号,没有则新建后打开
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('嘉立创示例_Pin测试符号', libUuid);
const symUuid = found[0] ? found[0].uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 生成本次运行专用的坐标,避免与之前保留的测试引脚重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 在符号画布上创建一个测试引脚,形状 None
const pin = await eda.sch_PrimitivePin.create(x, y, '1', 'CLK', 0, 10, null, 'None', 'IN');
const before = pin.getState_PinShape();
// 3. 切换异步模式,把形状改成 Clock(时钟标记)后提交画布
const asyncPin = pin.toAsync();
asyncPin.setState_PinShape('Clock');
await asyncPin.done();
// 4. 从画布重新取引脚,确认形状已更新(保留现场供观察)
const refetched = await eda.sch_PrimitivePin.get(pin.getState_PrimitiveId());
console.log('pinShape:', before, '→', refetched.getState_PinShape());
```
### setstate_pintype
# ISCH\_PrimitivePin.setState\_PinType() method
> 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.
Set the property state: pin type
## Signature
```typescript
function setState_PinType(pinType: ESCH_PrimitivePinType): ISCH_PrimitivePin;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
pinType
</td><td>
[ESCH\_PrimitivePinType](../enums/ESCH_PrimitivePinType.md)
</td><td>
Pin type
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitivePin](./ISCH_PrimitivePin.md)
Pin primitive object
## Example
```javascript
// 0. 确保当前文档是符号编辑器:优先复用测试符号,没有则新建后打开
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('嘉立创示例_Pin测试符号', libUuid);
const symUuid = found[0] ? found[0].uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 生成本次运行专用的坐标,避免与之前保留的测试引脚重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 在符号画布上创建一个测试引脚,电气类型 IN
const pin = await eda.sch_PrimitivePin.create(x, y, '1', 'CLK', 0, 10, null, 'None', 'IN');
const before = pin.getState_pinType();
// 3. 切换异步模式,把类型改成 OUT 后提交画布
const asyncPin = pin.toAsync();
asyncPin.setState_PinType('OUT');
await asyncPin.done();
// 4. 从画布重新取引脚,确认类型已更新(保留现场供观察)
const refetched = await eda.sch_PrimitivePin.get(pin.getState_PrimitiveId());
console.log('pinType:', before, '→', refetched.getState_pinType());
```
### setstate_rotation
# ISCH\_PrimitivePin.setState\_Rotation() method
> 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.
Set the property state: rotation angle
## Signature
```typescript
function setState_Rotation(rotation: number): ISCH_PrimitivePin;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
rotation
</td><td>
number
</td><td>
Rotation angle
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitivePin](./ISCH_PrimitivePin.md)
Pin primitive object
## Example
```javascript
// 0. 确保当前文档是符号编辑器:优先复用测试符号,没有则新建后打开
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('嘉立创示例_Pin测试符号', libUuid);
const symUuid = found[0] ? found[0].uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 生成本次运行专用的坐标,避免与之前保留的测试引脚重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 在符号画布上创建一个测试引脚,旋转 0 度
const pin = await eda.sch_PrimitivePin.create(x, y, '1', 'CLK', 0, 10, null, 'None', 'IN');
const before = pin.getState_Rotation();
// 3. 切换异步模式,把旋转角度改成 90(朝上)后提交画布
const asyncPin = pin.toAsync();
asyncPin.setState_Rotation(90);
await asyncPin.done();
// 4. 从画布重新取引脚,确认角度已更新(保留现场供观察)
const refetched = await eda.sch_PrimitivePin.get(pin.getState_PrimitiveId());
console.log('rotation:', before, '→', refetched.getState_Rotation());
```
### setstate_x
# ISCH\_PrimitivePin.setState\_X() method
> 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.
Set the property state: X coordinate
## Signature
```typescript
function setState_X(x: number): ISCH_PrimitivePin;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
x
</td><td>
number
</td><td>
X coordinate
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitivePin](./ISCH_PrimitivePin.md)
Pin primitive object
## Example
```javascript
// 0. 确保当前文档是符号编辑器:优先复用测试符号,没有则新建后打开
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('嘉立创示例_Pin测试符号', libUuid);
const symUuid = found[0] ? found[0].uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 生成本次运行专用的坐标,避免与之前保留的测试引脚重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 在符号画布上创建一个测试引脚
const pin = await eda.sch_PrimitivePin.create(x, y, '1', 'CLK', 0, 10, null, 'None', 'IN');
const before = pin.getState_X();
// 3. 切换异步模式,右移 200(约 50.8mm)后提交画布
const asyncPin = pin.toAsync();
asyncPin.setState_X(before + 200);
await asyncPin.done();
// 4. 从画布重新取引脚,确认坐标已更新(保留现场供观察)
const refetched = await eda.sch_PrimitivePin.get(pin.getState_PrimitiveId());
console.log('x:', before, '→', refetched.getState_X());
```
### setstate_y
# ISCH\_PrimitivePin.setState\_Y() method
> 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.
Set the property state: Y coordinate
## Signature
```typescript
function setState_Y(y: number): ISCH_PrimitivePin;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
y
</td><td>
number
</td><td>
Y coordinate
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitivePin](./ISCH_PrimitivePin.md)
Pin primitive object
## Example
```javascript
// 0. 确保当前文档是符号编辑器:优先复用测试符号,没有则新建后打开
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('嘉立创示例_Pin测试符号', libUuid);
const symUuid = found[0] ? found[0].uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 生成本次运行专用的坐标,避免与之前保留的测试引脚重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 在符号画布上创建一个测试引脚
const pin = await eda.sch_PrimitivePin.create(x, y, '1', 'CLK', 0, 10, null, 'None', 'IN');
const before = pin.getState_Y();
// 3. 切换异步模式,上移 200(约 50.8mm)后提交画布
const asyncPin = pin.toAsync();
asyncPin.setState_Y(before + 200);
await asyncPin.done();
// 4. 从画布重新取引脚,确认坐标已更新(保留现场供观察)
const refetched = await eda.sch_PrimitivePin.get(pin.getState_PrimitiveId());
console.log('y:', before, '→', refetched.getState_Y());
```
### toasync
# ISCH\_PrimitivePin.toAsync() method
Convert Primitive to Async primitive
## Signature
```typescript
function toAsync(): ISCH_PrimitivePin;
```
## Returns
[ISCH\_PrimitivePin](./ISCH_PrimitivePin.md)
Pin primitive object
## Example
```javascript
// 0. 确保当前文档是符号编辑器:优先复用测试符号,没有则新建后打开
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('嘉立创示例_Pin测试符号', libUuid);
const symUuid = found[0] ? found[0].uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 生成本次运行专用的坐标,避免与之前保留的测试引脚重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 在符号画布上创建一个测试引脚,并转入异步模式
const pin = await eda.sch_PrimitivePin.create(x, y, '1', 'CLK', 0, 10, null, 'None', 'IN');
const asyncPin = pin.toAsync();
const isAsyncNow = asyncPin.isAsync();
// 3. 异步模式下修改编号,done() 提交画布
asyncPin.setState_PinNumber('B2');
await asyncPin.done();
// 4. 从画布重新取引脚,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitivePin.get(pin.getState_PrimitiveId());
console.log('isAsync after toAsync:', isAsyncNow);
console.log('pinNumber:', refetched.getState_PinNumber());
```
### tosync
# ISCH\_PrimitivePin.toSync() method
Convert Primitive to Sync primitive
## Signature
```typescript
function toSync(): ISCH_PrimitivePin;
```
## Returns
[ISCH\_PrimitivePin](./ISCH_PrimitivePin.md)
Pin primitive object
## Example
```javascript
// 0. 确保当前文档是符号编辑器:优先复用测试符号,没有则新建后打开
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('嘉立创示例_Pin测试符号', libUuid);
const symUuid = found[0] ? found[0].uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 生成本次运行专用的坐标,避免与之前保留的测试引脚重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 在符号画布上创建一个测试引脚,并转入同步模式
const pin = await eda.sch_PrimitivePin.create(x, y, '1', 'CLK', 0, 10, null, 'None', 'IN');
const syncPin = pin.toSync();
const isAsyncNow = syncPin.isAsync();
// 3. 同步模式下改编号,立即生效,无需 done()
syncPin.setState_PinNumber('C3');
// 4. 从画布重新取引脚,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitivePin.get(pin.getState_PrimitiveId());
console.log('isAsync after toSync:', isAsyncNow);
console.log('pinNumber:', refetched.getState_PinNumber());
```
references/classes/ISCH_PrimitivePolygon.md
# ISCH\_PrimitivePolygon class
Polygon (polyline) primitive
## Signature
```typescript
class ISCH_PrimitivePolygon implements ISCH_Primitive
```
**Implements:** [ISCH\_Primitive](../interfaces/ISCH_Primitive.md)
## Remarks
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[done()](./ISCH_PrimitivePolygon.md)
</td><td>
</td><td>
**_(BETA)_** Apply the changes to the primitives to the canvas
</td></tr>
<tr><td>
[getState\_Color()](./ISCH_PrimitivePolygon.md)
</td><td>
</td><td>
Get the property state: color
</td></tr>
<tr><td>
[getState\_FillColor()](./ISCH_PrimitivePolygon.md)
</td><td>
</td><td>
Get the property state: fill color
</td></tr>
<tr><td>
[getState\_Line()](./ISCH_PrimitivePolygon.md)
</td><td>
</td><td>
Get the property state: coordinate group
</td></tr>
<tr><td>
[getState\_LineType()](./ISCH_PrimitivePolygon.md)
</td><td>
</td><td>
Get the property state: line type
</td></tr>
<tr><td>
[getState\_LineWidth()](./ISCH_PrimitivePolygon.md)
</td><td>
</td><td>
Get the property state: Line width
</td></tr>
<tr><td>
[getState\_PrimitiveId()](./ISCH_PrimitivePolygon.md)
</td><td>
</td><td>
Get the property state: primitive ID
</td></tr>
<tr><td>
[getState\_PrimitiveType()](./ISCH_PrimitivePolygon.md)
</td><td>
</td><td>
Get the property state: primitive type
</td></tr>
<tr><td>
[isAsync()](./ISCH_PrimitivePolygon.md)
</td><td>
</td><td>
Query whether the primitive is an async primitive
</td></tr>
<tr><td>
[reset()](./ISCH_PrimitivePolygon.md)
</td><td>
</td><td>
**_(BETA)_** Reset the async primitive to the current canvas state
</td></tr>
<tr><td>
[setState\_Color(color)](./ISCH_PrimitivePolygon.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: color
</td></tr>
<tr><td>
[setState\_FillColor(fillColor)](./ISCH_PrimitivePolygon.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: fill color
</td></tr>
<tr><td>
[setState\_Line(line)](./ISCH_PrimitivePolygon.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: coordinate group
</td></tr>
<tr><td>
[setState\_LineType(lineType)](./ISCH_PrimitivePolygon.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: line type
</td></tr>
<tr><td>
[setState\_LineWidth(lineWidth)](./ISCH_PrimitivePolygon.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Line width
</td></tr>
<tr><td>
[toAsync()](./ISCH_PrimitivePolygon.md)
</td><td>
</td><td>
Convert Primitive to Async primitive
</td></tr>
<tr><td>
[toSync()](./ISCH_PrimitivePolygon.md)
</td><td>
</td><td>
Convert Primitive to Sync primitive
</td></tr>
</tbody></table>
---
## 方法详情
### done
# ISCH\_PrimitivePolygon.done() method
> 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.
Apply the changes to the primitives to the canvas
## Signature
```typescript
function done(): Promise<ISCH_PrimitivePolygon>;
```
## Returns
Promise<[ISCH\_PrimitivePolygon](./ISCH_PrimitivePolygon.md)<!-- -->>
Polygon primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试多边形重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const line = [x, y, x + 400, y, x + 400, y + 300, x, y + 300];
// 2. 创建一个测试多边形:4 顶点矩形、线宽 6(SCH 坐标单位 10mil)
const polygon = await eda.sch_PrimitivePolygon.create(line, '#FF0000', null, 6, 0);
// 3. 切换异步模式,累计两处修改(加粗边线 + 改颜色)
const asyncPolygon = polygon.toAsync();
asyncPolygon.setState_LineWidth(10);
asyncPolygon.setState_Color('#00AA00');
// 4. 一次性提交到画布
await asyncPolygon.done();
// 5. 从画布重新读取,确认两处修改都已生效(保留现场供观察)
const refetched = await eda.sch_PrimitivePolygon.get(polygon.getState_PrimitiveId());
console.log('lineWidth:', 6, '→', refetched.getState_LineWidth());
console.log('color:', '#00AA00', '→', refetched.getState_Color());
```
### getstate_color
# ISCH\_PrimitivePolygon.getState\_Color() method
Get the property state: color
## Signature
```typescript
function getState_Color(): string | null;
```
## Returns
string \| null
Color
## Example
```javascript
// 1. 创建一个红色轮廓的测试多边形(SCH 坐标单位 10mil)
const line = [400, 300, 800, 300, 800, 600, 400, 600];
const polygon = await eda.sch_PrimitivePolygon.create(line, '#FF0000');
// 2. 读取轮廓颜色
const color = polygon.getState_Color();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitivePolygon.delete([polygon.getState_PrimitiveId()]);
console.log('color:', color);
```
### getstate_fillcolor
# ISCH\_PrimitivePolygon.getState\_FillColor() method
Get the property state: fill color
## Signature
```typescript
function getState_FillColor(): string | null;
```
## Returns
string \| null
Fill color
## Example
```javascript
// 1. 创建一个黄色填充的测试多边形(SCH 坐标单位 10mil)
const line = [400, 300, 800, 300, 800, 600, 400, 600];
const polygon = await eda.sch_PrimitivePolygon.create(line, '#FF0000', '#FFFF00');
// 2. 读取填充颜色
const fillColor = polygon.getState_FillColor();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitivePolygon.delete([polygon.getState_PrimitiveId()]);
console.log('fillColor:', fillColor);
```
### getstate_line
# ISCH\_PrimitivePolygon.getState\_Line() method
Get the property state: coordinate group
## Signature
```typescript
function getState_Line(): Array<number>;
```
## Returns
Array<number>
Coordinate group
## Example
```javascript
// 1. 创建一个 4 顶点矩形测试多边形(SCH 坐标单位 10mil)
const line = [400, 300, 800, 300, 800, 600, 400, 600];
const polygon = await eda.sch_PrimitivePolygon.create(line, '#FF0000');
// 2. 读取顶点坐标组
const coords = polygon.getState_Line();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitivePolygon.delete([polygon.getState_PrimitiveId()]);
console.log('line:', JSON.stringify(coords));
```
### getstate_linetype
# ISCH\_PrimitivePolygon.getState\_LineType() method
Get the property state: line type
## Signature
```typescript
function getState_LineType(): ESCH_PrimitiveLineType | null;
```
## Returns
[ESCH\_PrimitiveLineType](../enums/ESCH_PrimitiveLineType.md) \| null
Line type
## Example
```javascript
// 1. 创建一个虚线边框的测试多边形(末参 1 = DASHED,SCH 坐标单位 10mil)
const line = [400, 300, 800, 300, 800, 600, 400, 600];
const polygon = await eda.sch_PrimitivePolygon.create(line, '#FF0000', null, 6, 1);
// 2. 读取线型
const lineType = polygon.getState_LineType();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitivePolygon.delete([polygon.getState_PrimitiveId()]);
console.log('lineType:', lineType);
```
### getstate_linewidth
# ISCH\_PrimitivePolygon.getState\_LineWidth() method
Get the property state: Line width
## Signature
```typescript
function getState_LineWidth(): number | null;
```
## Returns
number \| null
Line width
## Example
```javascript
// 1. 创建一个线宽 6 的测试多边形(SCH 坐标单位 10mil)
const line = [400, 300, 800, 300, 800, 600, 400, 600];
const polygon = await eda.sch_PrimitivePolygon.create(line, '#FF0000', null, 6, 0);
// 2. 读取线宽
const lineWidth = polygon.getState_LineWidth();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitivePolygon.delete([polygon.getState_PrimitiveId()]);
console.log('lineWidth:', lineWidth);
```
### getstate_primitiveid
# ISCH\_PrimitivePolygon.getState\_PrimitiveId() method
Get the property state: primitive ID
## Signature
```typescript
function getState_PrimitiveId(): string;
```
## Returns
string
Primitive ID
## Example
```javascript
// 1. 创建一个测试多边形:4 个顶点构成矩形(SCH 坐标单位 10mil,line 为 [x1,y1, x2,y2, x3,y3, x4,y4] 扁平数组)
const line = [400, 300, 800, 300, 800, 600, 400, 600];
const polygon = await eda.sch_PrimitivePolygon.create(line, '#FF0000');
// 2. 读取图元 ID
const primitiveId = polygon.getState_PrimitiveId();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitivePolygon.delete([polygon.getState_PrimitiveId()]);
console.log('primitiveId:', primitiveId);
```
### getstate_primitivetype
# ISCH\_PrimitivePolygon.getState\_PrimitiveType() method
Get the property state: primitive type
## Signature
```typescript
function getState_PrimitiveType(): ESCH_PrimitiveType;
```
## Returns
[ESCH\_PrimitiveType](../enums/ESCH_PrimitiveType.md)
Primitive type
## Example
```javascript
// 1. 创建一个测试多边形(SCH 坐标单位 10mil)
const line = [400, 300, 800, 300, 800, 600, 400, 600];
const polygon = await eda.sch_PrimitivePolygon.create(line, '#FF0000');
// 2. 读取图元类型
const primitiveType = polygon.getState_PrimitiveType();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitivePolygon.delete([polygon.getState_PrimitiveId()]);
console.log('primitiveType:', primitiveType);
```
### isasync
# ISCH\_PrimitivePolygon.isAsync() method
Query whether the primitive is an async primitive
## Signature
```typescript
function isAsync(): boolean;
```
## Returns
boolean
Whether Is async primitive
## Example
```javascript
// 1. 创建一个测试多边形,创建后默认处于异步模式(SCH 坐标单位 10mil)
const line = [400, 300, 800, 300, 800, 600, 400, 600];
const polygon = await eda.sch_PrimitivePolygon.create(line, '#FF0000');
const asyncOnCreate = polygon.isAsync();
// 2. 切换到同步模式再查询一次,对比两种模式
polygon.toSync();
const asyncAfterToSync = polygon.isAsync();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitivePolygon.delete([polygon.getState_PrimitiveId()]);
console.log('isAsync on create:', asyncOnCreate);
console.log('isAsync after toSync:', asyncAfterToSync);
```
### reset
# ISCH\_PrimitivePolygon.reset() method
> 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.
Reset the async primitive to the current canvas state
## Signature
```typescript
function reset(): Promise<ISCH_PrimitivePolygon>;
```
## Returns
Promise<[ISCH\_PrimitivePolygon](./ISCH_PrimitivePolygon.md)<!-- -->>
Polygon primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试多边形重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const line = [x, y, x + 400, y, x + 400, y + 300, x, y + 300];
// 2. 创建一个线宽 6 的测试多边形(SCH 坐标单位 10mil)
const polygon = await eda.sch_PrimitivePolygon.create(line, '#FF0000', null, 6, 0);
// 3. 切换异步模式,累计一处未提交的线宽修改(6 → 99)
const asyncPolygon = polygon.toAsync();
asyncPolygon.setState_LineWidth(99);
// 4. 重置:丢弃未提交的修改,回到画布当前状态
await asyncPolygon.reset();
// 5. 从画布重新读取,线宽仍是 6(保留现场供观察)
const refetched = await eda.sch_PrimitivePolygon.get(polygon.getState_PrimitiveId());
console.log('lineWidth after reset:', refetched.getState_LineWidth());
```
### setstate_color
# ISCH\_PrimitivePolygon.setState\_Color() method
> 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.
Set the property state: color
## Signature
```typescript
function setState_Color(color: string | null): ISCH_PrimitivePolygon;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
color
</td><td>
string \| null
</td><td>
Color
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitivePolygon](./ISCH_PrimitivePolygon.md)
Polygon primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试多边形重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const line = [x, y, x + 400, y, x + 400, y + 300, x, y + 300];
// 2. 创建一个红色轮廓的测试多边形(SCH 坐标单位 10mil)
const polygon = await eda.sch_PrimitivePolygon.create(line, '#FF0000');
// 3. 切换异步模式并改为绿色
const asyncPolygon = polygon.toAsync();
asyncPolygon.setState_Color('#00AA00');
await asyncPolygon.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitivePolygon.get(polygon.getState_PrimitiveId());
console.log('color:', '#FF0000', '→', refetched.getState_Color());
```
### setstate_fillcolor
# ISCH\_PrimitivePolygon.setState\_FillColor() method
> 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.
Set the property state: fill color
## Signature
```typescript
function setState_FillColor(fillColor: string | null): ISCH_PrimitivePolygon;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fillColor
</td><td>
string \| null
</td><td>
Fill color
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitivePolygon](./ISCH_PrimitivePolygon.md)
Polygon primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试多边形重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const line = [x, y, x + 400, y, x + 400, y + 300, x, y + 300];
// 2. 创建一个黄色填充的测试多边形(SCH 坐标单位 10mil)
const polygon = await eda.sch_PrimitivePolygon.create(line, '#FF0000', '#FFFF00');
// 3. 切换异步模式并改为浅绿填充
const asyncPolygon = polygon.toAsync();
asyncPolygon.setState_FillColor('#AAFFAA');
await asyncPolygon.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitivePolygon.get(polygon.getState_PrimitiveId());
console.log('fillColor:', '#FFFF00', '→', refetched.getState_FillColor());
```
### setstate_line
# ISCH\_PrimitivePolygon.setState\_Line() method
> 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.
Set the property state: coordinate group
## Signature
```typescript
function setState_Line(line: Array<number>): ISCH_PrimitivePolygon;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
line
</td><td>
Array<number>
</td><td>
Coordinate group
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitivePolygon](./ISCH_PrimitivePolygon.md)
Polygon primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试多边形重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个 4 顶点矩形测试多边形(SCH 坐标单位 10mil)
const rect = [x, y, x + 400, y, x + 400, y + 300, x, y + 300];
const polygon = await eda.sch_PrimitivePolygon.create(rect, '#FF0000');
// 3. 切换异步模式,改为 3 顶点三角形
const asyncPolygon = polygon.toAsync();
asyncPolygon.setState_Line([x, y, x + 400, y, x + 200, y + 350]);
await asyncPolygon.done();
// 4. 从画布重新读取,确认形状已替换(保留现场供观察)
const refetched = await eda.sch_PrimitivePolygon.get(polygon.getState_PrimitiveId());
console.log('line:', JSON.stringify(rect), '→', JSON.stringify(refetched.getState_Line()));
```
### setstate_linetype
# ISCH\_PrimitivePolygon.setState\_LineType() method
> 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.
Set the property state: line type
## Signature
```typescript
function setState_LineType(lineType: ESCH_PrimitiveLineType | null): ISCH_PrimitivePolygon;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
lineType
</td><td>
[ESCH\_PrimitiveLineType](../enums/ESCH_PrimitiveLineType.md) \| null
</td><td>
Line type
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitivePolygon](./ISCH_PrimitivePolygon.md)
Polygon primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试多边形重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const line = [x, y, x + 400, y, x + 400, y + 300, x, y + 300];
// 2. 创建一个实线边框的测试多边形(末参 0 = SOLID)
const polygon = await eda.sch_PrimitivePolygon.create(line, '#FF0000', null, 6, 0);
// 3. 切换异步模式并改为虚线(1 = DASHED)
const asyncPolygon = polygon.toAsync();
asyncPolygon.setState_LineType(1);
await asyncPolygon.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitivePolygon.get(polygon.getState_PrimitiveId());
console.log('lineType:', 0, '→', refetched.getState_LineType());
```
### setstate_linewidth
# ISCH\_PrimitivePolygon.setState\_LineWidth() method
> 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.
Set the property state: Line width
## Signature
```typescript
function setState_LineWidth(lineWidth: number | null): ISCH_PrimitivePolygon;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
lineWidth
</td><td>
number \| null
</td><td>
Line width
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitivePolygon](./ISCH_PrimitivePolygon.md)
Polygon primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试多边形重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const line = [x, y, x + 400, y, x + 400, y + 300, x, y + 300];
// 2. 创建一个线宽 6 的测试多边形(SCH 坐标单位 10mil)
const polygon = await eda.sch_PrimitivePolygon.create(line, '#FF0000', null, 6, 0);
// 3. 切换异步模式并加粗到 10
const asyncPolygon = polygon.toAsync();
asyncPolygon.setState_LineWidth(10);
await asyncPolygon.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitivePolygon.get(polygon.getState_PrimitiveId());
console.log('lineWidth:', 6, '→', refetched.getState_LineWidth());
```
### toasync
# ISCH\_PrimitivePolygon.toAsync() method
Convert Primitive to Async primitive
## Signature
```typescript
function toAsync(): ISCH_PrimitivePolygon;
```
## Returns
[ISCH\_PrimitivePolygon](./ISCH_PrimitivePolygon.md)
Polygon primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试多边形重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const line = [x, y, x + 400, y, x + 400, y + 300, x, y + 300];
// 2. 创建一个测试多边形(创建后默认已处于异步模式)
const polygon = await eda.sch_PrimitivePolygon.create(line, '#FF0000');
// 3. 转换为异步图元,修改边线颜色后提交
const asyncPolygon = polygon.toAsync();
asyncPolygon.setState_Color('#00AA00');
await asyncPolygon.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitivePolygon.get(polygon.getState_PrimitiveId());
console.log('isAsync after toAsync:', polygon.isAsync());
console.log('color:', '#00AA00', '→', refetched.getState_Color());
```
### tosync
# ISCH\_PrimitivePolygon.toSync() method
Convert Primitive to Sync primitive
## Signature
```typescript
function toSync(): ISCH_PrimitivePolygon;
```
## Returns
[ISCH\_PrimitivePolygon](./ISCH_PrimitivePolygon.md)
Polygon primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试多边形重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const line = [x, y, x + 400, y, x + 400, y + 300, x, y + 300];
// 2. 创建一个测试多边形(创建后默认处于异步模式)
const polygon = await eda.sch_PrimitivePolygon.create(line, '#FF0000', null, 6, 0);
// 3. 转换为同步图元
const syncPolygon = polygon.toSync();
// 4. 同步模式下加粗边线,立即生效,无需 done()
syncPolygon.setState_LineWidth(15);
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitivePolygon.get(polygon.getState_PrimitiveId());
console.log('isAsync after toSync:', polygon.isAsync());
console.log('lineWidth:', 6, '→', refetched.getState_LineWidth());
```
references/classes/ISCH_PrimitiveText.md
# ISCH\_PrimitiveText class
Text primitive
## Signature
```typescript
class ISCH_PrimitiveText implements ISCH_Primitive
```
**Implements:** [ISCH\_Primitive](../interfaces/ISCH_Primitive.md)
## Remarks
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[done()](./ISCH_PrimitiveText.md)
</td><td>
</td><td>
**_(BETA)_** Apply the changes to the primitives to the canvas
</td></tr>
<tr><td>
[getState\_AlignMode()](./ISCH_PrimitiveText.md)
</td><td>
</td><td>
Get the property state: alignment mode
</td></tr>
<tr><td>
[getState\_Bold()](./ISCH_PrimitiveText.md)
</td><td>
</td><td>
Get the property state: whether it is bold
</td></tr>
<tr><td>
[getState\_Content()](./ISCH_PrimitiveText.md)
</td><td>
</td><td>
Get the property state: text content
</td></tr>
<tr><td>
[getState\_FontName()](./ISCH_PrimitiveText.md)
</td><td>
</td><td>
Get the property state: font name
</td></tr>
<tr><td>
[getState\_FontSize()](./ISCH_PrimitiveText.md)
</td><td>
</td><td>
Get the property state: font size
</td></tr>
<tr><td>
[getState\_Italic()](./ISCH_PrimitiveText.md)
</td><td>
</td><td>
Get the property state: whether it is italic
</td></tr>
<tr><td>
[getState\_PrimitiveId()](./ISCH_PrimitiveText.md)
</td><td>
</td><td>
Get the property state: primitive ID
</td></tr>
<tr><td>
[getState\_PrimitiveType()](./ISCH_PrimitiveText.md)
</td><td>
</td><td>
Get the property state: primitive type
</td></tr>
<tr><td>
[getState\_Rotation()](./ISCH_PrimitiveText.md)
</td><td>
</td><td>
Get the property state: rotation angle
</td></tr>
<tr><td>
[getState\_TextColor()](./ISCH_PrimitiveText.md)
</td><td>
</td><td>
Get the property state: text color
</td></tr>
<tr><td>
[getState\_UnderLine()](./ISCH_PrimitiveText.md)
</td><td>
</td><td>
Get the property state: whether it is underlined
</td></tr>
<tr><td>
[getState\_X()](./ISCH_PrimitiveText.md)
</td><td>
</td><td>
Get the property state: X coordinate
</td></tr>
<tr><td>
[getState\_Y()](./ISCH_PrimitiveText.md)
</td><td>
</td><td>
Get the property state: Y coordinate
</td></tr>
<tr><td>
[isAsync()](./ISCH_PrimitiveText.md)
</td><td>
</td><td>
Query whether the primitive is an async primitive
</td></tr>
<tr><td>
[reset()](./ISCH_PrimitiveText.md)
</td><td>
</td><td>
**_(BETA)_** Reset the async primitive to the current canvas state
</td></tr>
<tr><td>
[setState\_AlignMode(alignMode)](./ISCH_PrimitiveText.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: alignment mode
</td></tr>
<tr><td>
[setState\_Bold(bold)](./ISCH_PrimitiveText.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: whether it is bold
</td></tr>
<tr><td>
[setState\_Content(content)](./ISCH_PrimitiveText.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: text content
</td></tr>
<tr><td>
[setState\_FontName(fontName)](./ISCH_PrimitiveText.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: font name
</td></tr>
<tr><td>
[setState\_FontSize(fontSize)](./ISCH_PrimitiveText.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: font size
</td></tr>
<tr><td>
[setState\_Italic(italic)](./ISCH_PrimitiveText.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: whether it is italic
</td></tr>
<tr><td>
[setState\_Rotation(rotation)](./ISCH_PrimitiveText.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: rotation angle
</td></tr>
<tr><td>
[setState\_TextColor(textColor)](./ISCH_PrimitiveText.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: text color
</td></tr>
<tr><td>
[setState\_UnderLine(underLine)](./ISCH_PrimitiveText.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: whether it is underlined
</td></tr>
<tr><td>
[setState\_X(x)](./ISCH_PrimitiveText.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: X coordinate
</td></tr>
<tr><td>
[setState\_Y(y)](./ISCH_PrimitiveText.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Y coordinate
</td></tr>
<tr><td>
[toAsync()](./ISCH_PrimitiveText.md)
</td><td>
</td><td>
Convert Primitive to Async primitive
</td></tr>
<tr><td>
[toSync()](./ISCH_PrimitiveText.md)
</td><td>
</td><td>
Convert Primitive to Sync primitive
</td></tr>
</tbody></table>
---
## 方法详情
### done
# ISCH\_PrimitiveText.done() method
> 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.
Apply the changes to the primitives to the canvas
## Signature
```typescript
function done(): Promise<ISCH_PrimitiveText>;
```
## Returns
Promise<[ISCH\_PrimitiveText](./ISCH_PrimitiveText.md)<!-- -->>
Text primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试文本重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个测试文本(SCH 坐标单位 10mil)
const text = await eda.sch_PrimitiveText.create(x, y, '嘉立创示例_初版');
// 3. 切换异步模式,累计两处修改(改文字 + 换红色)
const asyncText = text.toAsync();
asyncText.setState_Content('嘉立创示例_V2');
asyncText.setState_TextColor('#FF0000');
// 4. 一次性提交到画布
await asyncText.done();
// 5. 从画布重新读取,确认两处修改都已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveText.get(text.getState_PrimitiveId());
console.log('content:', '嘉立创示例_初版', '→', refetched.getState_Content());
console.log('textColor:', '#FF0000', '→', refetched.getState_TextColor());
```
### getstate_alignmode
# ISCH\_PrimitiveText.getState\_AlignMode() method
Get the property state: alignment mode
## Signature
```typescript
function getState_AlignMode(): ESCH_PrimitiveTextAlignMode;
```
## Returns
[ESCH\_PrimitiveTextAlignMode](../enums/ESCH_PrimitiveTextAlignMode.md)
Alignment mode
## Example
```javascript
// 1. 创建一个右下对齐的测试文本(第 11 参是对齐模式,9 = RIGHT_BOTTOM)
const text = await eda.sch_PrimitiveText.create(400, 300, '嘉立创示例_对齐', 0, null, null, null, false, false, false, 9);
// 2. 读取对齐模式
const alignMode = text.getState_AlignMode();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveText.delete([text.getState_PrimitiveId()]);
console.log('alignMode:', alignMode);
```
### getstate_bold
# ISCH\_PrimitiveText.getState\_Bold() method
Get the property state: whether it is bold
## Signature
```typescript
function getState_Bold(): boolean;
```
## Returns
boolean
Whether it is bold
## Example
```javascript
// 1. 创建一个加粗的测试文本(第 8 参是是否加粗)
const text = await eda.sch_PrimitiveText.create(400, 300, '嘉立创示例_重点', 0, null, null, null, true);
// 2. 读取是否加粗
const bold = text.getState_Bold();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveText.delete([text.getState_PrimitiveId()]);
console.log('bold:', bold);
```
### getstate_content
# ISCH\_PrimitiveText.getState\_Content() method
Get the property state: text content
## Signature
```typescript
function getState_Content(): string;
```
## Returns
string
Text content
## Example
```javascript
// 1. 创建一个测试文本(SCH 坐标单位 10mil,第 3 参是文字内容)
const text = await eda.sch_PrimitiveText.create(400, 300, '嘉立创示例_标题');
// 2. 读取文字内容
const content = text.getState_Content();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveText.delete([text.getState_PrimitiveId()]);
console.log('content:', content);
```
### getstate_fontname
# ISCH\_PrimitiveText.getState\_FontName() method
Get the property state: font name
## Signature
```typescript
function getState_FontName(): string | null;
```
## Returns
string \| null
Font name
## Example
```javascript
// 1. 创建一个指定 Arial 字体的测试文本(第 6 参是字体名称)
const text = await eda.sch_PrimitiveText.create(400, 300, '嘉立创示例_字体', 0, null, 'Arial');
// 2. 读取字体名称
const fontName = text.getState_FontName();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveText.delete([text.getState_PrimitiveId()]);
console.log('fontName:', fontName);
```
### getstate_fontsize
# ISCH\_PrimitiveText.getState\_FontSize() method
Get the property state: font size
## Signature
```typescript
function getState_FontSize(): number | null;
```
## Returns
number \| null
Font size
## Example
```javascript
// 1. 创建一个字号 20 的测试文本(第 7 参是字体大小)
const text = await eda.sch_PrimitiveText.create(400, 300, '嘉立创示例_大标题', 0, null, null, 20);
// 2. 读取字体大小
const fontSize = text.getState_FontSize();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveText.delete([text.getState_PrimitiveId()]);
console.log('fontSize:', fontSize);
```
### getstate_italic
# ISCH\_PrimitiveText.getState\_Italic() method
Get the property state: whether it is italic
## Signature
```typescript
function getState_Italic(): boolean;
```
## Returns
boolean
Whether it is italic
## Example
```javascript
// 1. 创建一个斜体的测试文本(第 9 参是是否斜体)
const text = await eda.sch_PrimitiveText.create(400, 300, '嘉立创示例_注释', 0, null, null, null, false, true);
// 2. 读取是否斜体
const italic = text.getState_Italic();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveText.delete([text.getState_PrimitiveId()]);
console.log('italic:', italic);
```
### getstate_primitiveid
# ISCH\_PrimitiveText.getState\_PrimitiveId() method
Get the property state: primitive ID
## Signature
```typescript
function getState_PrimitiveId(): string;
```
## Returns
string
Primitive ID
## Example
```javascript
// 1. 创建一个测试文本
const text = await eda.sch_PrimitiveText.create(400, 300, '嘉立创示例_文本');
// 2. 读取图元 ID
const primitiveId = text.getState_PrimitiveId();
// 3. 用 ID 从画布重取实例,验证 ID 有效
const refetched = await eda.sch_PrimitiveText.get(primitiveId);
// 4. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveText.delete([primitiveId]);
console.log('primitiveId:', primitiveId);
console.log('refetched content:', refetched.getState_Content());
```
### getstate_primitivetype
# ISCH\_PrimitiveText.getState\_PrimitiveType() method
Get the property state: primitive type
## Signature
```typescript
function getState_PrimitiveType(): ESCH_PrimitiveType;
```
## Returns
[ESCH\_PrimitiveType](../enums/ESCH_PrimitiveType.md)
Primitive type
## Example
```javascript
// 1. 创建一个测试文本
const text = await eda.sch_PrimitiveText.create(400, 300, '嘉立创示例_文本');
// 2. 读取图元类型
const primitiveType = text.getState_PrimitiveType();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveText.delete([text.getState_PrimitiveId()]);
console.log('primitiveType:', primitiveType);
```
### getstate_rotation
# ISCH\_PrimitiveText.getState\_Rotation() method
Get the property state: rotation angle
## Signature
```typescript
function getState_Rotation(): number;
```
## Returns
number
Rotation angle
## Example
```javascript
// 1. 创建一个旋转 90° 的测试文本(第 4 参是旋转角,SCH 坐标单位 10mil)
const text = await eda.sch_PrimitiveText.create(400, 300, '嘉立创示例_竖排', 90);
// 2. 读取旋转角度
const rotation = text.getState_Rotation();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveText.delete([text.getState_PrimitiveId()]);
console.log('rotation:', rotation);
```
### getstate_textcolor
# ISCH\_PrimitiveText.getState\_TextColor() method
Get the property state: text color
## Signature
```typescript
function getState_TextColor(): string | null;
```
## Returns
string \| null
Text color
## Example
```javascript
// 1. 创建一个红色文字的测试文本(第 5 参是文字颜色)
const text = await eda.sch_PrimitiveText.create(400, 300, '嘉立创示例_警示', 0, '#FF0000');
// 2. 读取文字颜色
const textColor = text.getState_TextColor();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveText.delete([text.getState_PrimitiveId()]);
console.log('textColor:', textColor);
```
### getstate_underline
# ISCH\_PrimitiveText.getState\_UnderLine() method
Get the property state: whether it is underlined
## Signature
```typescript
function getState_UnderLine(): boolean;
```
## Returns
boolean
Whether it is underlined
## Example
```javascript
// 1. 创建一个带下划线的测试文本(第 10 参是是否下划线)
const text = await eda.sch_PrimitiveText.create(400, 300, '嘉立创示例_强调', 0, null, null, null, false, false, true);
// 2. 读取是否加下划线
const underLine = text.getState_UnderLine();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveText.delete([text.getState_PrimitiveId()]);
console.log('underLine:', underLine);
```
### getstate_x
# ISCH\_PrimitiveText.getState\_X() method
Get the property state: X coordinate
## Signature
```typescript
function getState_X(): number;
```
## Returns
number
X coordinate
## Example
```javascript
// 1. 创建一个测试文本(SCH 坐标单位 10mil,1mm ≈ 3.937 单位)
const text = await eda.sch_PrimitiveText.create(400, 300, '嘉立创示例_文本');
// 2. 读取定位点 X 坐标
const x = text.getState_X();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveText.delete([text.getState_PrimitiveId()]);
console.log('x:', x);
```
### getstate_y
# ISCH\_PrimitiveText.getState\_Y() method
Get the property state: Y coordinate
## Signature
```typescript
function getState_Y(): number;
```
## Returns
number
Y coordinate
## Example
```javascript
// 1. 创建一个测试文本(SCH 坐标单位 10mil,1mm ≈ 3.937 单位)
const text = await eda.sch_PrimitiveText.create(400, 300, '嘉立创示例_文本');
// 2. 读取定位点 Y 坐标
const y = text.getState_Y();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveText.delete([text.getState_PrimitiveId()]);
console.log('y:', y);
```
### isasync
# ISCH\_PrimitiveText.isAsync() method
Query whether the primitive is an async primitive
## Signature
```typescript
function isAsync(): boolean;
```
## Returns
boolean
Whether Is async primitive
## Example
```javascript
// 1. 创建一个测试文本,创建后默认处于异步模式
const text = await eda.sch_PrimitiveText.create(400, 300, '嘉立创示例_文本');
const asyncOnCreate = text.isAsync();
// 2. 切换到同步模式再查询一次,对比两种模式
text.toSync();
const asyncAfterToSync = text.isAsync();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveText.delete([text.getState_PrimitiveId()]);
console.log('isAsync on create:', asyncOnCreate);
console.log('isAsync after toSync:', asyncAfterToSync);
```
### reset
# ISCH\_PrimitiveText.reset() method
> 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.
Reset the async primitive to the current canvas state
## Signature
```typescript
function reset(): Promise<ISCH_PrimitiveText>;
```
## Returns
Promise<[ISCH\_PrimitiveText](./ISCH_PrimitiveText.md)<!-- -->>
Text primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试文本重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个黑色文字的测试文本(SCH 坐标单位 10mil)
const text = await eda.sch_PrimitiveText.create(x, y, '嘉立创示例_保留', 0, '#000000');
// 3. 切换异步模式,累计一处未提交的修改(文字内容 → 误改值)
const asyncText = text.toAsync();
asyncText.setState_Content('嘉立创示例_误改');
// 4. 重置:丢弃未提交的修改,回到画布当前状态
await asyncText.reset();
// 5. 从画布重新读取,文字内容仍是原值(保留现场供观察)
const refetched = await eda.sch_PrimitiveText.get(text.getState_PrimitiveId());
console.log('content after reset:', refetched.getState_Content());
```
### setstate_alignmode
# ISCH\_PrimitiveText.setState\_AlignMode() method
> 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.
Set the property state: alignment mode
## Signature
```typescript
function setState_AlignMode(alignMode: ESCH_PrimitiveTextAlignMode): ISCH_PrimitiveText;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
alignMode
</td><td>
[ESCH\_PrimitiveTextAlignMode](../enums/ESCH_PrimitiveTextAlignMode.md)
</td><td>
Alignment mode
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveText](./ISCH_PrimitiveText.md)
Text primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试文本重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个测试文本(SCH 坐标单位 10mil)
const text = await eda.sch_PrimitiveText.create(x, y, '嘉立创示例_对齐');
// 3. 切换异步模式,修改对齐模式
const asyncText = text.toAsync();
asyncText.setState_AlignMode(1);
await asyncText.done();
// 4. 从画布重新读取对齐模式(读回 5 = CENTER,按读回值确认效果;保留现场供观察)
const refetched = await eda.sch_PrimitiveText.get(text.getState_PrimitiveId());
console.log('alignMode:', 1, '→', refetched.getState_AlignMode());
```
### setstate_bold
# ISCH\_PrimitiveText.setState\_Bold() method
> 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.
Set the property state: whether it is bold
## Signature
```typescript
function setState_Bold(bold: boolean): ISCH_PrimitiveText;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
bold
</td><td>
boolean
</td><td>
Whether it is bold
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveText](./ISCH_PrimitiveText.md)
Text primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试文本重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个常规字重的测试文本(SCH 坐标单位 10mil)
const text = await eda.sch_PrimitiveText.create(x, y, '嘉立创示例_标题');
// 3. 切换异步模式,加粗
const asyncText = text.toAsync();
asyncText.setState_Bold(true);
await asyncText.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveText.get(text.getState_PrimitiveId());
console.log('bold:', false, '→', refetched.getState_Bold());
```
### setstate_content
# ISCH\_PrimitiveText.setState\_Content() method
> 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.
Set the property state: text content
## Signature
```typescript
function setState_Content(content: string): ISCH_PrimitiveText;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
content
</td><td>
string
</td><td>
Text content
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveText](./ISCH_PrimitiveText.md)
Text primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试文本重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个测试文本(SCH 坐标单位 10mil)
const text = await eda.sch_PrimitiveText.create(x, y, '嘉立创示例_初版');
// 3. 切换异步模式,改写文字内容
const asyncText = text.toAsync();
asyncText.setState_Content('嘉立创示例_定稿');
await asyncText.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveText.get(text.getState_PrimitiveId());
console.log('content:', '嘉立创示例_初版', '→', refetched.getState_Content());
```
### setstate_fontname
# ISCH\_PrimitiveText.setState\_FontName() method
> 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.
Set the property state: font name
## Signature
```typescript
function setState_FontName(fontName: string | null): ISCH_PrimitiveText;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fontName
</td><td>
string \| null
</td><td>
Font name
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveText](./ISCH_PrimitiveText.md)
Text primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试文本重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个默认字体的测试文本(SCH 坐标单位 10mil)
const text = await eda.sch_PrimitiveText.create(x, y, '嘉立创示例_标题');
// 3. 切换异步模式,换成 Arial 字体
const asyncText = text.toAsync();
asyncText.setState_FontName('Arial');
await asyncText.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveText.get(text.getState_PrimitiveId());
console.log('fontName:', text.getState_FontName(), '→', refetched.getState_FontName());
```
### setstate_fontsize
# ISCH\_PrimitiveText.setState\_FontSize() method
> 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.
Set the property state: font size
## Signature
```typescript
function setState_FontSize(fontSize: number | null): ISCH_PrimitiveText;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fontSize
</td><td>
number \| null
</td><td>
Font size
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveText](./ISCH_PrimitiveText.md)
Text primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试文本重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个默认字号的测试文本(SCH 坐标单位 10mil)
const text = await eda.sch_PrimitiveText.create(x, y, '嘉立创示例_标题');
// 3. 切换异步模式,把字号增大到 20
const asyncText = text.toAsync();
asyncText.setState_FontSize(20);
await asyncText.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveText.get(text.getState_PrimitiveId());
console.log('fontSize:', text.getState_FontSize(), '→', refetched.getState_FontSize());
```
### setstate_italic
# ISCH\_PrimitiveText.setState\_Italic() method
> 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.
Set the property state: whether it is italic
## Signature
```typescript
function setState_Italic(italic: boolean): ISCH_PrimitiveText;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
italic
</td><td>
boolean
</td><td>
Whether it is italic
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveText](./ISCH_PrimitiveText.md)
Text primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试文本重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个常规字形的测试文本(SCH 坐标单位 10mil)
const text = await eda.sch_PrimitiveText.create(x, y, '嘉立创示例_注释');
// 3. 切换异步模式,改为斜体
const asyncText = text.toAsync();
asyncText.setState_Italic(true);
await asyncText.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveText.get(text.getState_PrimitiveId());
console.log('italic:', false, '→', refetched.getState_Italic());
```
### setstate_rotation
# ISCH\_PrimitiveText.setState\_Rotation() method
> 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.
Set the property state: rotation angle
## Signature
```typescript
function setState_Rotation(rotation: number): ISCH_PrimitiveText;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
rotation
</td><td>
number
</td><td>
Rotation angle
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveText](./ISCH_PrimitiveText.md)
Text primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试文本重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个测试文本(SCH 坐标单位 10mil)
const text = await eda.sch_PrimitiveText.create(x, y, '嘉立创示例_横排');
// 3. 切换异步模式,旋转 90° 变竖排
const asyncText = text.toAsync();
asyncText.setState_Rotation(90);
await asyncText.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveText.get(text.getState_PrimitiveId());
console.log('rotation:', 0, '→', refetched.getState_Rotation());
```
### setstate_textcolor
# ISCH\_PrimitiveText.setState\_TextColor() method
> 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.
Set the property state: text color
## Signature
```typescript
function setState_TextColor(textColor: string | null): ISCH_PrimitiveText;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
textColor
</td><td>
string \| null
</td><td>
Text color
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveText](./ISCH_PrimitiveText.md)
Text primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试文本重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个黑色文字的测试文本(SCH 坐标单位 10mil)
const text = await eda.sch_PrimitiveText.create(x, y, '嘉立创示例_说明', 0, '#000000');
// 3. 切换异步模式,把文字换成红色警示色
const asyncText = text.toAsync();
asyncText.setState_TextColor('#FF0000');
await asyncText.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveText.get(text.getState_PrimitiveId());
console.log('textColor:', '#000000', '→', refetched.getState_TextColor());
```
### setstate_underline
# ISCH\_PrimitiveText.setState\_UnderLine() method
> 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.
Set the property state: whether it is underlined
## Signature
```typescript
function setState_UnderLine(underLine: boolean): ISCH_PrimitiveText;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
underLine
</td><td>
boolean
</td><td>
Whether it is underlined
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveText](./ISCH_PrimitiveText.md)
Text primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试文本重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个无下划线的测试文本(SCH 坐标单位 10mil)
const text = await eda.sch_PrimitiveText.create(x, y, '嘉立创示例_V1.0');
// 3. 切换异步模式,加下划线
const asyncText = text.toAsync();
asyncText.setState_UnderLine(true);
await asyncText.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveText.get(text.getState_PrimitiveId());
console.log('underLine:', false, '→', refetched.getState_UnderLine());
```
### setstate_x
# ISCH\_PrimitiveText.setState\_X() method
> 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.
Set the property state: X coordinate
## Signature
```typescript
function setState_X(x: number): ISCH_PrimitiveText;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
x
</td><td>
number
</td><td>
X coordinate
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveText](./ISCH_PrimitiveText.md)
Text primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试文本重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个测试文本(SCH 坐标单位 10mil)
const text = await eda.sch_PrimitiveText.create(x, y, '嘉立创示例_文本');
// 3. 切换异步模式,把定位点 X 移到 x + 300
const asyncText = text.toAsync();
asyncText.setState_X(x + 300);
await asyncText.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveText.get(text.getState_PrimitiveId());
console.log('x:', x, '→', refetched.getState_X());
```
### setstate_y
# ISCH\_PrimitiveText.setState\_Y() method
> 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.
Set the property state: Y coordinate
## Signature
```typescript
function setState_Y(y: number): ISCH_PrimitiveText;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
y
</td><td>
number
</td><td>
Y coordinate
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveText](./ISCH_PrimitiveText.md)
Text primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试文本重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个测试文本(SCH 坐标单位 10mil)
const text = await eda.sch_PrimitiveText.create(x, y, '嘉立创示例_文本');
// 3. 切换异步模式,把定位点 Y 移到 y + 200
const asyncText = text.toAsync();
asyncText.setState_Y(y + 200);
await asyncText.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveText.get(text.getState_PrimitiveId());
console.log('y:', y, '→', refetched.getState_Y());
```
### toasync
# ISCH\_PrimitiveText.toAsync() method
Convert Primitive to Async primitive
## Signature
```typescript
function toAsync(): ISCH_PrimitiveText;
```
## Returns
[ISCH\_PrimitiveText](./ISCH_PrimitiveText.md)
Text primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试文本重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个测试文本(创建后默认已处于异步模式)
const text = await eda.sch_PrimitiveText.create(x, y, '嘉立创示例_文本');
// 3. 显式转换为异步图元(返回自身,可链式累计修改后提交)
const asyncText = text.toAsync();
asyncText.setState_Content('嘉立创示例_已更新');
await asyncText.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveText.get(text.getState_PrimitiveId());
console.log('isAsync after toAsync:', text.isAsync());
console.log('content:', '嘉立创示例_文本', '→', refetched.getState_Content());
```
### tosync
# ISCH\_PrimitiveText.toSync() method
Convert Primitive to Sync primitive
## Signature
```typescript
function toSync(): ISCH_PrimitiveText;
```
## Returns
[ISCH\_PrimitiveText](./ISCH_PrimitiveText.md)
Text primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试文本重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个测试文本(创建后默认处于异步模式)
const text = await eda.sch_PrimitiveText.create(x, y, '嘉立创示例_文本');
// 3. 转换为同步图元
const syncText = text.toSync();
// 4. 同步模式下把文字改为定稿内容,立即生效,无需 done()
syncText.setState_Content('嘉立创示例_定稿');
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveText.get(text.getState_PrimitiveId());
console.log('isAsync after toSync:', text.isAsync());
console.log('content:', '嘉立创示例_文本', '→', refetched.getState_Content());
```
references/classes/ISCH_PrimitiveRectangle.md
# ISCH\_PrimitiveRectangle class
Rectangle primitive
## Signature
```typescript
class ISCH_PrimitiveRectangle implements ISCH_Primitive
```
**Implements:** [ISCH\_Primitive](../interfaces/ISCH_Primitive.md)
## Remarks
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[done()](./ISCH_PrimitiveRectangle.md)
</td><td>
</td><td>
**_(BETA)_** Apply the changes to the primitives to the canvas
</td></tr>
<tr><td>
[getState\_Color()](./ISCH_PrimitiveRectangle.md)
</td><td>
</td><td>
Get the property state: border color
</td></tr>
<tr><td>
[getState\_CornerRadius()](./ISCH_PrimitiveRectangle.md)
</td><td>
</td><td>
Get the property state: corner radius
</td></tr>
<tr><td>
[getState\_FillColor()](./ISCH_PrimitiveRectangle.md)
</td><td>
</td><td>
Get the property state: fill color
</td></tr>
<tr><td>
[getState\_FillStyle()](./ISCH_PrimitiveRectangle.md)
</td><td>
</td><td>
Get the property state: fill style
</td></tr>
<tr><td>
[getState\_Height()](./ISCH_PrimitiveRectangle.md)
</td><td>
</td><td>
Get the property state: height
</td></tr>
<tr><td>
[getState\_LineType()](./ISCH_PrimitiveRectangle.md)
</td><td>
</td><td>
Get the property state: line type
</td></tr>
<tr><td>
[getState\_LineWidth()](./ISCH_PrimitiveRectangle.md)
</td><td>
</td><td>
Get the property state: Line width
</td></tr>
<tr><td>
[getState\_PrimitiveId()](./ISCH_PrimitiveRectangle.md)
</td><td>
</td><td>
Get the property state: primitive ID
</td></tr>
<tr><td>
[getState\_PrimitiveType()](./ISCH_PrimitiveRectangle.md)
</td><td>
</td><td>
Get the property state: primitive type
</td></tr>
<tr><td>
[getState\_Rotation()](./ISCH_PrimitiveRectangle.md)
</td><td>
</td><td>
Get the property state: rotation angle
</td></tr>
<tr><td>
[getState\_TopLeftX()](./ISCH_PrimitiveRectangle.md)
</td><td>
</td><td>
Get the property state: top-left point X
</td></tr>
<tr><td>
[getState\_TopLeftY()](./ISCH_PrimitiveRectangle.md)
</td><td>
</td><td>
Get the property state: top-left point Y
</td></tr>
<tr><td>
[getState\_Width()](./ISCH_PrimitiveRectangle.md)
</td><td>
</td><td>
Get the property state: width
</td></tr>
<tr><td>
[isAsync()](./ISCH_PrimitiveRectangle.md)
</td><td>
</td><td>
Query whether the primitive is an async primitive
</td></tr>
<tr><td>
[reset()](./ISCH_PrimitiveRectangle.md)
</td><td>
</td><td>
**_(BETA)_** Reset the async primitive to the current canvas state
</td></tr>
<tr><td>
[setState\_Color(color)](./ISCH_PrimitiveRectangle.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: border color
</td></tr>
<tr><td>
[setState\_CornerRadius(cornerRadius)](./ISCH_PrimitiveRectangle.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: corner radius
</td></tr>
<tr><td>
[setState\_FillColor(fillColor)](./ISCH_PrimitiveRectangle.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: fill color
</td></tr>
<tr><td>
[setState\_FillStyle(fillStyle)](./ISCH_PrimitiveRectangle.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: fill style
</td></tr>
<tr><td>
[setState\_Height(height)](./ISCH_PrimitiveRectangle.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: height
</td></tr>
<tr><td>
[setState\_LineType(lineType)](./ISCH_PrimitiveRectangle.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: line type
</td></tr>
<tr><td>
[setState\_LineWidth(lineWidth)](./ISCH_PrimitiveRectangle.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Line width
</td></tr>
<tr><td>
[setState\_Rotation(rotation)](./ISCH_PrimitiveRectangle.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: rotation angle
</td></tr>
<tr><td>
[setState\_TopLeftX(topLeftX)](./ISCH_PrimitiveRectangle.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: top-left point X
</td></tr>
<tr><td>
[setState\_TopLeftY(topLeftY)](./ISCH_PrimitiveRectangle.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: top-left point Y
</td></tr>
<tr><td>
[setState\_Width(width)](./ISCH_PrimitiveRectangle.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: width
</td></tr>
<tr><td>
[toAsync()](./ISCH_PrimitiveRectangle.md)
</td><td>
</td><td>
Convert Primitive to Async primitive
</td></tr>
<tr><td>
[toSync()](./ISCH_PrimitiveRectangle.md)
</td><td>
</td><td>
Convert Primitive to Sync primitive
</td></tr>
</tbody></table>
---
## 方法详情
### done
# ISCH\_PrimitiveRectangle.done() method
> 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.
Apply the changes to the primitives to the canvas
## Signature
```typescript
function done(): Promise<ISCH_PrimitiveRectangle>;
```
## Returns
Promise<[ISCH\_PrimitiveRectangle](./ISCH_PrimitiveRectangle.md)<!-- -->>
Rectangle primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试矩形重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个 200×100 的测试矩形(SCH 坐标单位 10mil)
const rect = await eda.sch_PrimitiveRectangle.create(x, y, 200, 100);
// 3. 切换异步模式,累计两处修改(尺寸扩大 + 改边框颜色)
const asyncRect = rect.toAsync();
asyncRect.setState_Width(300);
asyncRect.setState_Color('#00AA00');
// 4. 一次性提交到画布
await asyncRect.done();
// 5. 从画布重新读取,确认两处修改都已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveRectangle.get(rect.getState_PrimitiveId());
console.log('width:', 200, '→', refetched.getState_Width());
console.log('color:', '#00AA00', '→', refetched.getState_Color());
```
### getstate_color
# ISCH\_PrimitiveRectangle.getState\_Color() method
Get the property state: border color
## Signature
```typescript
function getState_Color(): string | null;
```
## Returns
string \| null
Border color
## Example
```javascript
// 1. 创建一个红色边框的测试矩形(SCH 坐标单位 10mil)
const rect = await eda.sch_PrimitiveRectangle.create(400, 300, 200, 100, 0, 0, '#FF0000');
// 2. 读取边框颜色
const color = rect.getState_Color();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveRectangle.delete([rect.getState_PrimitiveId()]);
console.log('color:', color);
```
### getstate_cornerradius
# ISCH\_PrimitiveRectangle.getState\_CornerRadius() method
Get the property state: corner radius
## Signature
```typescript
function getState_CornerRadius(): number;
```
## Returns
number
Corner radius
## Example
```javascript
// 1. 创建一个圆角半径 10 的测试矩形(SCH 坐标单位 10mil)
const rect = await eda.sch_PrimitiveRectangle.create(400, 300, 200, 100, 10);
// 2. 读取圆角半径
const cornerRadius = rect.getState_CornerRadius();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveRectangle.delete([rect.getState_PrimitiveId()]);
console.log('cornerRadius:', cornerRadius);
```
### getstate_fillcolor
# ISCH\_PrimitiveRectangle.getState\_FillColor() method
Get the property state: fill color
## Signature
```typescript
function getState_FillColor(): string | null;
```
## Returns
string \| null
Fill color
## Example
```javascript
// 1. 创建一个黄色填充的测试矩形(SCH 坐标单位 10mil)
const rect = await eda.sch_PrimitiveRectangle.create(400, 300, 200, 100, 0, 0, null, '#FFFF00');
// 2. 读取填充颜色
const fillColor = rect.getState_FillColor();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveRectangle.delete([rect.getState_PrimitiveId()]);
console.log('fillColor:', fillColor);
```
### getstate_fillstyle
# ISCH\_PrimitiveRectangle.getState\_FillStyle() method
Get the property state: fill style
## Signature
```typescript
function getState_FillStyle(): ESCH_PrimitiveFillStyle | null;
```
## Returns
[ESCH\_PrimitiveFillStyle](../enums/ESCH_PrimitiveFillStyle.md) \| null
Fill style
## Example
```javascript
// 1. 创建一个网格填充的测试矩形(SCH 坐标单位 10mil)
const rect = await eda.sch_PrimitiveRectangle.create(400, 300, 200, 100, 0, 0, null, null, null, null, 'Grid');
// 2. 读取填充样式
const fillStyle = rect.getState_FillStyle();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveRectangle.delete([rect.getState_PrimitiveId()]);
console.log('fillStyle:', fillStyle);
```
### getstate_height
# ISCH\_PrimitiveRectangle.getState\_Height() method
Get the property state: height
## Signature
```typescript
function getState_Height(): number;
```
## Returns
number
Height
## Example
```javascript
// 1. 创建一个 200×100 的测试矩形(SCH 坐标单位 10mil)
const rect = await eda.sch_PrimitiveRectangle.create(400, 300, 200, 100);
// 2. 读取矩形的高
const height = rect.getState_Height();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveRectangle.delete([rect.getState_PrimitiveId()]);
console.log('height:', height);
```
### getstate_linetype
# ISCH\_PrimitiveRectangle.getState\_LineType() method
Get the property state: line type
## Signature
```typescript
function getState_LineType(): ESCH_PrimitiveLineType | null;
```
## Returns
[ESCH\_PrimitiveLineType](../enums/ESCH_PrimitiveLineType.md) \| null
Line type
## Example
```javascript
// 1. 创建一个虚线边框的测试矩形(末参 1 = 虚线,SCH 坐标单位 10mil)
const rect = await eda.sch_PrimitiveRectangle.create(400, 300, 200, 100, 0, 0, '#FF0000', null, 6, 1);
// 2. 读取线型
const lineType = rect.getState_LineType();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveRectangle.delete([rect.getState_PrimitiveId()]);
console.log('lineType:', lineType);
```
### getstate_linewidth
# ISCH\_PrimitiveRectangle.getState\_LineWidth() method
Get the property state: Line width
## Signature
```typescript
function getState_LineWidth(): number | null;
```
## Returns
number \| null
Line width
## Example
```javascript
// 1. 创建一个线宽 6 的测试矩形(SCH 坐标单位 10mil)
const rect = await eda.sch_PrimitiveRectangle.create(400, 300, 200, 100, 0, 0, '#FF0000', null, 6);
// 2. 读取边框线宽
const lineWidth = rect.getState_LineWidth();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveRectangle.delete([rect.getState_PrimitiveId()]);
console.log('lineWidth:', lineWidth);
```
### getstate_primitiveid
# ISCH\_PrimitiveRectangle.getState\_PrimitiveId() method
Get the property state: primitive ID
## Signature
```typescript
function getState_PrimitiveId(): string;
```
## Returns
string
Primitive ID
## Example
```javascript
// 1. 创建一个测试矩形(SCH 坐标单位 10mil)
const rect = await eda.sch_PrimitiveRectangle.create(400, 300, 200, 100);
// 2. 读取图元 ID
const primitiveId = rect.getState_PrimitiveId();
// 3. 用 ID 从画布重取矩形,验证 ID 有效
const refetched = await eda.sch_PrimitiveRectangle.get(primitiveId);
// 4. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveRectangle.delete([primitiveId]);
console.log('primitiveId:', primitiveId);
console.log('refetched width:', refetched.getState_Width());
```
### getstate_primitivetype
# ISCH\_PrimitiveRectangle.getState\_PrimitiveType() method
Get the property state: primitive type
## Signature
```typescript
function getState_PrimitiveType(): ESCH_PrimitiveType;
```
## Returns
[ESCH\_PrimitiveType](../enums/ESCH_PrimitiveType.md)
Primitive type
## Example
```javascript
// 1. 创建一个测试矩形(SCH 坐标单位 10mil)
const rect = await eda.sch_PrimitiveRectangle.create(400, 300, 200, 100);
// 2. 读取图元类型
const primitiveType = rect.getState_PrimitiveType();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveRectangle.delete([rect.getState_PrimitiveId()]);
console.log('primitiveType:', primitiveType);
```
### getstate_rotation
# ISCH\_PrimitiveRectangle.getState\_Rotation() method
Get the property state: rotation angle
## Signature
```typescript
function getState_Rotation(): number;
```
## Returns
number
Rotation angle
## Example
```javascript
// 1. 创建一个旋转 45° 的测试矩形(第 6 参是旋转角,SCH 坐标单位 10mil)
const rect = await eda.sch_PrimitiveRectangle.create(400, 300, 200, 100, 0, 45);
// 2. 读取旋转角度
const rotation = rect.getState_Rotation();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveRectangle.delete([rect.getState_PrimitiveId()]);
console.log('rotation:', rotation);
```
### getstate_topleftx
# ISCH\_PrimitiveRectangle.getState\_TopLeftX() method
Get the property state: top-left point X
## Signature
```typescript
function getState_TopLeftX(): number;
```
## Returns
number
Top-left point X
## Example
```javascript
// 1. 创建一个左上角在 (400, 300) 的测试矩形(SCH 坐标单位 10mil)
const rect = await eda.sch_PrimitiveRectangle.create(400, 300, 200, 100);
// 2. 读取左上角 X 坐标
const topLeftX = rect.getState_TopLeftX();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveRectangle.delete([rect.getState_PrimitiveId()]);
console.log('topLeftX:', topLeftX);
```
### getstate_toplefty
# ISCH\_PrimitiveRectangle.getState\_TopLeftY() method
Get the property state: top-left point Y
## Signature
```typescript
function getState_TopLeftY(): number;
```
## Returns
number
Top-left point Y
## Example
```javascript
// 1. 创建一个左上角在 (400, 300) 的测试矩形(SCH 坐标单位 10mil)
const rect = await eda.sch_PrimitiveRectangle.create(400, 300, 200, 100);
// 2. 读取左上角 Y 坐标
const topLeftY = rect.getState_TopLeftY();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveRectangle.delete([rect.getState_PrimitiveId()]);
console.log('topLeftY:', topLeftY);
```
### getstate_width
# ISCH\_PrimitiveRectangle.getState\_Width() method
Get the property state: width
## Signature
```typescript
function getState_Width(): number;
```
## Returns
number
Width
## Example
```javascript
// 1. 创建一个 200×100 的测试矩形(SCH 坐标单位 10mil)
const rect = await eda.sch_PrimitiveRectangle.create(400, 300, 200, 100);
// 2. 读取矩形的宽
const width = rect.getState_Width();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveRectangle.delete([rect.getState_PrimitiveId()]);
console.log('width:', width);
```
### isasync
# ISCH\_PrimitiveRectangle.isAsync() method
Query whether the primitive is an async primitive
## Signature
```typescript
function isAsync(): boolean;
```
## Returns
boolean
Whether Is async primitive
## Example
```javascript
// 1. 创建一个测试矩形,创建后默认处于异步模式
const rect = await eda.sch_PrimitiveRectangle.create(400, 300, 200, 100);
const asyncOnCreate = rect.isAsync();
// 2. 切换到同步模式再查询一次,对比两种模式
rect.toSync();
const asyncAfterToSync = rect.isAsync();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveRectangle.delete([rect.getState_PrimitiveId()]);
console.log('isAsync on create:', asyncOnCreate);
console.log('isAsync after toSync:', asyncAfterToSync);
```
### reset
# ISCH\_PrimitiveRectangle.reset() method
> 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.
Reset the async primitive to the current canvas state
## Signature
```typescript
function reset(): Promise<ISCH_PrimitiveRectangle>;
```
## Returns
Promise<[ISCH\_PrimitiveRectangle](./ISCH_PrimitiveRectangle.md)<!-- -->>
Rectangle primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试矩形重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个线宽 6 的测试矩形(SCH 坐标单位 10mil)
const rect = await eda.sch_PrimitiveRectangle.create(x, y, 200, 100, 0, 0, '#FF0000', null, 6);
// 3. 切换异步模式,累计一处未提交的线宽修改(6 → 99)
const asyncRect = rect.toAsync();
asyncRect.setState_LineWidth(99);
// 4. 重置:丢弃未提交的修改,回到画布当前状态
await asyncRect.reset();
// 5. 从画布重新读取,线宽仍是 6(保留现场供观察)
const refetched = await eda.sch_PrimitiveRectangle.get(rect.getState_PrimitiveId());
console.log('lineWidth after reset:', refetched.getState_LineWidth());
```
### setstate_color
# ISCH\_PrimitiveRectangle.setState\_Color() method
> 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.
Set the property state: border color
## Signature
```typescript
function setState_Color(color: string | null): ISCH_PrimitiveRectangle;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
color
</td><td>
string \| null
</td><td>
Border color
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveRectangle](./ISCH_PrimitiveRectangle.md)
Rectangle primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试矩形重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个红色边框的测试矩形(SCH 坐标单位 10mil)
const rect = await eda.sch_PrimitiveRectangle.create(x, y, 200, 100, 0, 0, '#FF0000');
// 3. 切换异步模式,把边框换成绿色
const asyncRect = rect.toAsync();
asyncRect.setState_Color('#00AA00');
await asyncRect.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveRectangle.get(rect.getState_PrimitiveId());
console.log('color:', '#FF0000', '→', refetched.getState_Color());
```
### setstate_cornerradius
# ISCH\_PrimitiveRectangle.setState\_CornerRadius() method
> 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.
Set the property state: corner radius
## Signature
```typescript
function setState_CornerRadius(cornerRadius: number): ISCH_PrimitiveRectangle;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
cornerRadius
</td><td>
number
</td><td>
Corner radius
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveRectangle](./ISCH_PrimitiveRectangle.md)
Rectangle primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试矩形重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个直角测试矩形(SCH 坐标单位 10mil)
const rect = await eda.sch_PrimitiveRectangle.create(x, y, 200, 100);
// 3. 切换异步模式,把圆角半径调到 20
const asyncRect = rect.toAsync();
asyncRect.setState_CornerRadius(20);
await asyncRect.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveRectangle.get(rect.getState_PrimitiveId());
console.log('cornerRadius:', 0, '→', refetched.getState_CornerRadius());
```
### setstate_fillcolor
# ISCH\_PrimitiveRectangle.setState\_FillColor() method
> 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.
Set the property state: fill color
## Signature
```typescript
function setState_FillColor(fillColor: string | null): ISCH_PrimitiveRectangle;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fillColor
</td><td>
string \| null
</td><td>
Fill color
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveRectangle](./ISCH_PrimitiveRectangle.md)
Rectangle primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试矩形重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个无填充的测试矩形(SCH 坐标单位 10mil)
const rect = await eda.sch_PrimitiveRectangle.create(x, y, 200, 100);
// 3. 切换异步模式,设置浅黄填充
const asyncRect = rect.toAsync();
asyncRect.setState_FillColor('#FFEC8B');
await asyncRect.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveRectangle.get(rect.getState_PrimitiveId());
console.log('fillColor:', null, '→', refetched.getState_FillColor());
```
### setstate_fillstyle
# ISCH\_PrimitiveRectangle.setState\_FillStyle() method
> 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.
Set the property state: fill style
## Signature
```typescript
function setState_FillStyle(fillStyle: ESCH_PrimitiveFillStyle | null): ISCH_PrimitiveRectangle;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fillStyle
</td><td>
[ESCH\_PrimitiveFillStyle](../enums/ESCH_PrimitiveFillStyle.md) \| null
</td><td>
Fill style
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveRectangle](./ISCH_PrimitiveRectangle.md)
Rectangle primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试矩形重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个无填充的测试矩形(SCH 坐标单位 10mil)
const rect = await eda.sch_PrimitiveRectangle.create(x, y, 200, 100);
// 3. 切换异步模式,设置网格填充样式
const asyncRect = rect.toAsync();
asyncRect.setState_FillStyle('Grid');
await asyncRect.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveRectangle.get(rect.getState_PrimitiveId());
console.log('fillStyle:', null, '→', refetched.getState_FillStyle());
```
### setstate_height
# ISCH\_PrimitiveRectangle.setState\_Height() method
> 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.
Set the property state: height
## Signature
```typescript
function setState_Height(height: number): ISCH_PrimitiveRectangle;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
height
</td><td>
number
</td><td>
Height
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveRectangle](./ISCH_PrimitiveRectangle.md)
Rectangle primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试矩形重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个 200×100 的测试矩形(SCH 坐标单位 10mil)
const rect = await eda.sch_PrimitiveRectangle.create(x, y, 200, 100);
// 3. 切换异步模式,把高扩大到 150
const asyncRect = rect.toAsync();
asyncRect.setState_Height(150);
await asyncRect.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveRectangle.get(rect.getState_PrimitiveId());
console.log('height:', 100, '→', refetched.getState_Height());
```
### setstate_linetype
# ISCH\_PrimitiveRectangle.setState\_LineType() method
> 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.
Set the property state: line type
## Signature
```typescript
function setState_LineType(lineType: ESCH_PrimitiveLineType | null): ISCH_PrimitiveRectangle;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
lineType
</td><td>
[ESCH\_PrimitiveLineType](../enums/ESCH_PrimitiveLineType.md) \| null
</td><td>
Line type
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveRectangle](./ISCH_PrimitiveRectangle.md)
Rectangle primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试矩形重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个实线边框的测试矩形(末参 0 = 实线,SCH 坐标单位 10mil)
const rect = await eda.sch_PrimitiveRectangle.create(x, y, 200, 100, 0, 0, '#FF0000', null, 6, 0);
// 3. 切换异步模式,把线型改为虚线(1)
const asyncRect = rect.toAsync();
asyncRect.setState_LineType(1);
await asyncRect.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveRectangle.get(rect.getState_PrimitiveId());
console.log('lineType:', 0, '→', refetched.getState_LineType());
```
### setstate_linewidth
# ISCH\_PrimitiveRectangle.setState\_LineWidth() method
> 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.
Set the property state: Line width
## Signature
```typescript
function setState_LineWidth(lineWidth: number | null): ISCH_PrimitiveRectangle;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
lineWidth
</td><td>
number \| null
</td><td>
Line width
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveRectangle](./ISCH_PrimitiveRectangle.md)
Rectangle primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试矩形重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个线宽 6 的测试矩形(SCH 坐标单位 10mil)
const rect = await eda.sch_PrimitiveRectangle.create(x, y, 200, 100, 0, 0, '#FF0000', null, 6);
// 3. 切换异步模式,把线宽加粗到 15
const asyncRect = rect.toAsync();
asyncRect.setState_LineWidth(15);
await asyncRect.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveRectangle.get(rect.getState_PrimitiveId());
console.log('lineWidth:', 6, '→', refetched.getState_LineWidth());
```
### setstate_rotation
# ISCH\_PrimitiveRectangle.setState\_Rotation() method
> 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.
Set the property state: rotation angle
## Signature
```typescript
function setState_Rotation(rotation: number): ISCH_PrimitiveRectangle;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
rotation
</td><td>
number
</td><td>
Rotation angle
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveRectangle](./ISCH_PrimitiveRectangle.md)
Rectangle primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试矩形重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个未旋转的测试矩形(SCH 坐标单位 10mil)
const rect = await eda.sch_PrimitiveRectangle.create(x, y, 200, 100);
// 3. 切换异步模式,提交旋转 30°
const asyncRect = rect.toAsync();
asyncRect.setState_Rotation(30);
await asyncRect.done();
// 4. 从画布重新读取:形状已旋转(左上角坐标变化),角度读数仍为 0
const refetched = await eda.sch_PrimitiveRectangle.get(rect.getState_PrimitiveId());
console.log('rotation:', 0, '→', refetched.getState_Rotation());
console.log('topLeft moved by rotate:', x, '→', refetched.getState_TopLeftX());
```
### setstate_topleftx
# ISCH\_PrimitiveRectangle.setState\_TopLeftX() method
> 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.
Set the property state: top-left point X
## Signature
```typescript
function setState_TopLeftX(topLeftX: number): ISCH_PrimitiveRectangle;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
topLeftX
</td><td>
number
</td><td>
Top-left point X
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveRectangle](./ISCH_PrimitiveRectangle.md)
Rectangle primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试矩形重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个测试矩形(SCH 坐标单位 10mil)
const rect = await eda.sch_PrimitiveRectangle.create(x, y, 200, 100);
// 3. 切换异步模式,把左上角 X 移到 x + 300
const asyncRect = rect.toAsync();
asyncRect.setState_TopLeftX(x + 300);
await asyncRect.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveRectangle.get(rect.getState_PrimitiveId());
console.log('topLeftX:', x, '→', refetched.getState_TopLeftX());
```
### setstate_toplefty
# ISCH\_PrimitiveRectangle.setState\_TopLeftY() method
> 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.
Set the property state: top-left point Y
## Signature
```typescript
function setState_TopLeftY(topLeftY: number): ISCH_PrimitiveRectangle;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
topLeftY
</td><td>
number
</td><td>
Top-left point Y
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveRectangle](./ISCH_PrimitiveRectangle.md)
Rectangle primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试矩形重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个测试矩形(SCH 坐标单位 10mil)
const rect = await eda.sch_PrimitiveRectangle.create(x, y, 200, 100);
// 3. 切换异步模式,把左上角 Y 移到 y + 200
const asyncRect = rect.toAsync();
asyncRect.setState_TopLeftY(y + 200);
await asyncRect.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveRectangle.get(rect.getState_PrimitiveId());
console.log('topLeftY:', y, '→', refetched.getState_TopLeftY());
```
### setstate_width
# ISCH\_PrimitiveRectangle.setState\_Width() method
> 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.
Set the property state: width
## Signature
```typescript
function setState_Width(width: number): ISCH_PrimitiveRectangle;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
width
</td><td>
number
</td><td>
Width
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveRectangle](./ISCH_PrimitiveRectangle.md)
Rectangle primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试矩形重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个 200×100 的测试矩形(SCH 坐标单位 10mil)
const rect = await eda.sch_PrimitiveRectangle.create(x, y, 200, 100);
// 3. 切换异步模式,把宽扩大到 300
const asyncRect = rect.toAsync();
asyncRect.setState_Width(300);
await asyncRect.done();
// 4. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveRectangle.get(rect.getState_PrimitiveId());
console.log('width:', 200, '→', refetched.getState_Width());
```
### toasync
# ISCH\_PrimitiveRectangle.toAsync() method
Convert Primitive to Async primitive
## Signature
```typescript
function toAsync(): ISCH_PrimitiveRectangle;
```
## Returns
[ISCH\_PrimitiveRectangle](./ISCH_PrimitiveRectangle.md)
Rectangle primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试矩形重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个测试矩形(创建后默认处于异步模式)
const rect = await eda.sch_PrimitiveRectangle.create(x, y, 200, 100);
// 3. 先切换到同步模式,再转回异步模式,确认可来回切换
rect.toSync();
const asyncRect = rect.toAsync();
// 4. 异步模式下批量修改尺寸,一次提交
asyncRect.setState_Width(300);
asyncRect.setState_Height(150);
await asyncRect.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveRectangle.get(rect.getState_PrimitiveId());
console.log('isAsync after toAsync:', rect.isAsync());
console.log('width:', 200, '→', refetched.getState_Width());
console.log('height:', 100, '→', refetched.getState_Height());
```
### tosync
# ISCH\_PrimitiveRectangle.toSync() method
Convert Primitive to Sync primitive
## Signature
```typescript
function toSync(): ISCH_PrimitiveRectangle;
```
## Returns
[ISCH\_PrimitiveRectangle](./ISCH_PrimitiveRectangle.md)
Rectangle primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试矩形重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个测试矩形(创建后默认处于异步模式)
const rect = await eda.sch_PrimitiveRectangle.create(x, y, 200, 100);
// 3. 转换为同步图元
const syncRect = rect.toSync();
// 4. 同步模式下把宽扩大到 300,立即生效,无需 done()
syncRect.setState_Width(300);
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveRectangle.get(rect.getState_PrimitiveId());
console.log('isAsync after toSync:', rect.isAsync());
console.log('width:', 200, '→', refetched.getState_Width());
```
references/classes/LIB_3DModel.md
# LIB\_3DModel class
Comprehensive library / 3D model class
## Signature
```typescript
class LIB_3DModel
```
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[copy(modelUuid, libraryUuid, targetLibraryUuid, targetClassification, newModelName)](./LIB_3DModel.md)
</td><td>
</td><td>
**_(BETA)_** Copy 3D model
</td></tr>
<tr><td>
[create(libraryUuid, modelFile, classification, unit)](./LIB_3DModel.md)
</td><td>
</td><td>
**_(BETA)_** Create 3D model
</td></tr>
<tr><td>
[delete(modelUuid, libraryUuid)](./LIB_3DModel.md)
</td><td>
</td><td>
**_(BETA)_** Delete 3D model
</td></tr>
<tr><td>
[get(modelUuid, libraryUuid)](./LIB_3DModel.md)
</td><td>
</td><td>
**_(BETA)_** Get all properties of the 3D model
</td></tr>
<tr><td>
[modify(modelUuid, libraryUuid, modelName, classification, description)](./LIB_3DModel.md)
</td><td>
</td><td>
**_(BETA)_** Modify 3D model
</td></tr>
<tr><td>
[search(key, libraryUuid, classification, itemsOfPage, page)](./LIB_3DModel.md)
</td><td>
</td><td>
**_(BETA)_** Search 3D model
</td></tr>
</tbody></table>
---
## 方法详情
### copy
# LIB\_3DModel.copy() method
> 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.
Copy 3D model
## Signature
```typescript
function copy(
modelUuid: string,
libraryUuid: string,
targetLibraryUuid: string,
targetClassification?: ILIB_ClassificationIndex | Array<string>,
newModelName?: string,
): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
modelUuid
</td><td>
string
</td><td>
3D model UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
targetLibraryUuid
</td><td>
string
</td><td>
Target library UUID
</td></tr>
<tr><td>
targetClassification
</td><td>
[ILIB\_ClassificationIndex](../interfaces/ILIB_ClassificationIndex.md) \| Array<string>
</td><td>
_(Optional)_ Classification in the target library
</td></tr>
<tr><td>
newModelName
</td><td>
string
</td><td>
_(Optional)_ New 3D model name. If a 3D model with the same name exists in the target library, the copy will fail
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
UUID of the new 3D model in the target library
## Example
```javascript
// 1. 获取个人库 UUID(复制目标库)
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
// 2. 从系统库找一个 3D 模型作为复制来源
const results = await eda.lib_3DModel.search('0402', undefined, undefined, 1);
const source = results[0];
// 3. 复制到个人库,指定新名称避免同名冲突
const newName = `CopyOf_${source.name}_${Date.now()}`;
const copiedUuid = await eda.lib_3DModel.copy(
source.uuid,
source.libraryUuid,
libraryUuid,
undefined,
newName
);
// 创建类保留现场
console.log('source:', source.name, source.uuid);
console.log('copiedUuid:', copiedUuid);
console.log('newName:', newName);
```
### create
# LIB\_3DModel.create() method
> 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.
Create 3D model
## Signature
```typescript
function create(
libraryUuid: string,
modelFile: Blob,
classification?: ILIB_ClassificationIndex | Array<string>,
unit?:
| ESYS_Unit.MILLIMETER
| ESYS_Unit.CENTIMETER
| ESYS_Unit.METER
| ESYS_Unit.MIL
| ESYS_Unit.INCH,
): Promise<Array<string> | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
modelFile
</td><td>
Blob
</td><td>
3D model file data
</td></tr>
<tr><td>
classification
</td><td>
[ILIB\_ClassificationIndex](../interfaces/ILIB_ClassificationIndex.md) \| Array<string>
</td><td>
_(Optional)_ Classification
</td></tr>
<tr><td>
unit
</td><td>
[ESYS\_Unit.MILLIMETER](../enums/ESYS_Unit.md) \| [ESYS\_Unit.CENTIMETER](../enums/ESYS_Unit.md) \| [ESYS\_Unit.METER](../enums/ESYS_Unit.md) \| [ESYS\_Unit.MIL](../enums/ESYS_Unit.md) \| [ESYS\_Unit.INCH](../enums/ESYS_Unit.md)
</td><td>
_(Optional)_ Unit
</td></tr>
</tbody></table>
## Returns
Promise<Array<string> \| undefined>
UUIDs of all created 3D models
## Remarks
The passed-in `modelFile` can be an archive of multiple model files. EDA will automatically extract the multiple models
在客户端离线模式下,3D 模型库是本地的一个目录,本接口会将数据组织后导入到指定的库目录中
## Example
```javascript
// 1. 获取个人库 UUID
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
// 2. 构造一个单面片的 ASCII STL 模型文件
const stl = [
'solid example',
'facet normal 0 0 1',
'outer loop',
'vertex 0 0 0',
'vertex 10 0 0',
'vertex 0 10 0',
'endloop',
'endfacet',
'endsolid example',
].join('\n');
const blob = new Blob([stl], { type: 'model/stl' });
// 3. 导入到个人库,模型单位为毫米
const modelUuids = await eda.lib_3DModel.create(libraryUuid, blob, [], 'mm');
// 创建类保留现场
console.log('libraryUuid:', libraryUuid);
console.log('created:', modelUuids ? modelUuids.length : 0);
```
### delete
# LIB\_3DModel.delete() method
> 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.
Delete 3D model
## Signature
```typescript
function delete(modelUuid: string, libraryUuid: string): Promise<boolean | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
modelUuid
</td><td>
string
</td><td>
3D model UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
</tbody></table>
## Returns
Promise<boolean \| undefined>
Whether the operation is successful
## Example
```javascript
// 1. 获取个人库 UUID
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
// 2. 复制一个系统库模型到个人库作为删除对象
const results = await eda.lib_3DModel.search('0402', undefined, undefined, 1);
const source = results[0];
const copiedUuid = await eda.lib_3DModel.copy(
source.uuid,
source.libraryUuid,
libraryUuid,
undefined,
`ToDelete_${Date.now()}`
);
// 3. 删除复制品
const deleted = await eda.lib_3DModel.delete(copiedUuid, libraryUuid);
console.log('copiedUuid:', copiedUuid);
console.log('deleted:', deleted);
```
### get
# LIB\_3DModel.get() method
> 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.
Get all properties of the 3D model
## Signature
```typescript
function get(modelUuid: string, libraryUuid?: string): Promise<ILIB_3DModelItem | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
modelUuid
</td><td>
string
</td><td>
3D model UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
_(Optional)_ Library UUID, default is system library, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
</tbody></table>
## Returns
Promise<[ILIB\_3DModelItem](../interfaces/ILIB_3DModelItem.md) \| undefined>
3D model property
### modify
# LIB\_3DModel.modify() method
> 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.
Modify 3D model
## Signature
```typescript
function modify(
modelUuid: string,
libraryUuid: string,
modelName?: string,
classification?: ILIB_ClassificationIndex | Array<string> | null,
description?: string | null,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
modelUuid
</td><td>
string
</td><td>
3D model UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
modelName
</td><td>
string
</td><td>
_(Optional)_ 3D model name
</td></tr>
<tr><td>
classification
</td><td>
[ILIB\_ClassificationIndex](../interfaces/ILIB_ClassificationIndex.md) \| Array<string> \| null
</td><td>
_(Optional)_ Classification
</td></tr>
<tr><td>
description
</td><td>
string \| null
</td><td>
_(Optional)_ Description
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
If you want to clear certain properties, set their values to `null`
## Example
```javascript
// 1. 获取个人库 UUID
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
// 2. 复制一个系统库模型到个人库作为修改对象
const results = await eda.lib_3DModel.search('0402', undefined, undefined, 1);
const source = results[0];
const copiedUuid = await eda.lib_3DModel.copy(
source.uuid,
source.libraryUuid,
libraryUuid,
undefined,
`ToModify_${Date.now()}`
);
// 3. 修改名称和描述(classification 保持不变传 [])
const modifiedName = `Renamed_${Date.now()}`;
const modified = await eda.lib_3DModel.modify(
copiedUuid,
libraryUuid,
modifiedName,
[],
'3D model example'
);
// 修改类保留现场
console.log('copiedUuid:', copiedUuid);
console.log('modified:', modified);
console.log('newName:', modifiedName);
```
### search
# LIB\_3DModel.search() method
> 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.
Search 3D model
## Signature
```typescript
function search(
key: string,
libraryUuid?: string,
classification?: ILIB_ClassificationIndex | Array<string>,
itemsOfPage?: number,
page?: number,
): Promise<Array<ILIB_3DModelSearchItem>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
key
</td><td>
string
</td><td>
Search keyword
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
_(Optional)_ Library UUID, default is system library, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
classification
</td><td>
[ILIB\_ClassificationIndex](../interfaces/ILIB_ClassificationIndex.md) \| Array<string>
</td><td>
_(Optional)_ Classification, defaults to all
</td></tr>
<tr><td>
itemsOfPage
</td><td>
number
</td><td>
_(Optional)_ Number of search results per page
</td></tr>
<tr><td>
page
</td><td>
number
</td><td>
_(Optional)_ Page count
</td></tr>
</tbody></table>
## Returns
Promise<Array<[ILIB\_3DModelSearchItem](../interfaces/ILIB_3DModelSearchItem.md)<!-- -->>>
List of searched 3D model properties
## Example
```javascript
// 1. 按关键字搜索系统库中的 3D 模型,每页 5 条
const results = await eda.lib_3DModel.search('0402', undefined, undefined, 5);
// 2. 输出搜索结果
console.log('count:', results.length);
results.forEach((item, i) => {
console.log(`[${i}] name:`, item.name, 'uuid:', item.uuid, 'libraryUuid:', item.libraryUuid);
});
```
references/classes/ISCH_PrimitiveWire.md
# ISCH\_PrimitiveWire class
Wire primitive
## Signature
```typescript
class ISCH_PrimitiveWire implements ISCH_Primitive
```
**Implements:** [ISCH\_Primitive](../interfaces/ISCH_Primitive.md)
## Remarks
Unresolved issues:
The `ISCH_PrimitiveWire.net` global net name property involves multi-sheet refresh, so the currently obtained value may be \*\*incorrect\*\*. When you try to set multiple names for a wire or bus (by placing multiple net labels), the obtained `net` property may not be the latest. You need to wait for the canvas event to asynchronously refresh the global nets before reading it again.
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[done()](./ISCH_PrimitiveWire.md)
</td><td>
</td><td>
**_(BETA)_** Apply the changes to the primitives to the canvas
</td></tr>
<tr><td>
[getState\_Color()](./ISCH_PrimitiveWire.md)
</td><td>
</td><td>
Get the property state: bus color
</td></tr>
<tr><td>
[getState\_Line()](./ISCH_PrimitiveWire.md)
</td><td>
</td><td>
Get the property state: polyline coordinate group
</td></tr>
<tr><td>
[getState\_LineType()](./ISCH_PrimitiveWire.md)
</td><td>
</td><td>
Get the property state: line type
</td></tr>
<tr><td>
[getState\_LineWidth()](./ISCH_PrimitiveWire.md)
</td><td>
</td><td>
Get the property state: Line width
</td></tr>
<tr><td>
[getState\_Net()](./ISCH_PrimitiveWire.md)
</td><td>
</td><td>
Get the property state: net name
</td></tr>
<tr><td>
[getState\_PrimitiveId()](./ISCH_PrimitiveWire.md)
</td><td>
</td><td>
Get the property state: primitive ID
</td></tr>
<tr><td>
[getState\_PrimitiveType()](./ISCH_PrimitiveWire.md)
</td><td>
</td><td>
Get the property state: primitive type
</td></tr>
<tr><td>
[isAsync()](./ISCH_PrimitiveWire.md)
</td><td>
</td><td>
Query whether the primitive is an async primitive
</td></tr>
<tr><td>
[setState\_Color(color)](./ISCH_PrimitiveWire.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: wire color
</td></tr>
<tr><td>
[setState\_Line(line)](./ISCH_PrimitiveWire.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: polyline coordinate group
</td></tr>
<tr><td>
[setState\_LineType(lineType)](./ISCH_PrimitiveWire.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: line type
</td></tr>
<tr><td>
[setState\_LineWidth(lineWidth)](./ISCH_PrimitiveWire.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: Line width
</td></tr>
<tr><td>
[setState\_Net(net)](./ISCH_PrimitiveWire.md)
</td><td>
</td><td>
**_(BETA)_** Set the property state: net name
</td></tr>
<tr><td>
[toAsync()](./ISCH_PrimitiveWire.md)
</td><td>
</td><td>
Convert Primitive to Async primitive
</td></tr>
<tr><td>
[toSync()](./ISCH_PrimitiveWire.md)
</td><td>
</td><td>
Convert Primitive to Sync primitive
</td></tr>
</tbody></table>
---
## 方法详情
### done
# ISCH\_PrimitiveWire.done() method
> 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.
Apply the changes to the primitives to the canvas
## Signature
```typescript
function done(): Promise<ISCH_PrimitiveWire>;
```
## Returns
Promise<[ISCH\_PrimitiveWire](./ISCH_PrimitiveWire.md)<!-- -->>
Wire primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试导线重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一条测试导线(SCH 坐标单位 10mil)
const wire = await eda.sch_PrimitiveWire.create([x, y, x + 400, y], 'SIG_A');
// 3. 切换异步模式,累计两处修改(改网络 + 改颜色)
const asyncWire = wire.toAsync();
asyncWire.setState_Net('SIG_B');
asyncWire.setState_Color('#00AA00');
// 4. 一次性提交到画布
await asyncWire.done();
// 5. 从画布重新读取,确认两处修改都已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveWire.get(wire.getState_PrimitiveId());
console.log('net:', 'SIG_A', '→', refetched.getState_Net());
console.log('color:', '#00AA00', '→', refetched.getState_Color());
```
### getstate_color
# ISCH\_PrimitiveWire.getState\_Color() method
Get the property state: bus color
## Signature
```typescript
function getState_Color(): string | null;
```
## Returns
string \| null
Bus color
## Example
```javascript
// 1. 创建一条红色测试导线(SCH 坐标单位 10mil)
const wire = await eda.sch_PrimitiveWire.create([1000, 1000, 1400, 1000], null, '#FF0000', 6, 1);
// 2. 读取导线颜色
const color = wire.getState_Color();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveWire.delete([wire.getState_PrimitiveId()]);
console.log('color:', color);
```
### getstate_line
# ISCH\_PrimitiveWire.getState\_Line() method
Get the property state: polyline coordinate group
## Signature
```typescript
function getState_Line(): Array<number> | Array<Array<number>>;
```
## Returns
Array<number> \| Array<Array<number>>
Polyline coordinate group
## Example
```javascript
// 1. 创建一条水平测试导线(SCH 坐标单位 10mil)
const wire = await eda.sch_PrimitiveWire.create([1000, 1000, 1400, 1000]);
// 2. 读取多段线坐标组(返回画布规格化后的坐标,段内端点顺序可能与创建时相反)
const line = wire.getState_Line();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveWire.delete([wire.getState_PrimitiveId()]);
console.log('line:', JSON.stringify(line));
```
### getstate_linetype
# ISCH\_PrimitiveWire.getState\_LineType() method
Get the property state: line type
## Signature
```typescript
function getState_LineType(): ESCH_PrimitiveLineType | null;
```
## Returns
[ESCH\_PrimitiveLineType](../enums/ESCH_PrimitiveLineType.md) \| null
Line type
## Example
```javascript
// 1. 创建一条虚线(DASHED=1)测试导线(SCH 坐标单位 10mil)
const wire = await eda.sch_PrimitiveWire.create([1000, 1000, 1400, 1000], null, null, null, 1);
// 2. 读取线型
const lineType = wire.getState_LineType();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveWire.delete([wire.getState_PrimitiveId()]);
console.log('lineType:', lineType);
```
### getstate_linewidth
# ISCH\_PrimitiveWire.getState\_LineWidth() method
Get the property state: Line width
## Signature
```typescript
function getState_LineWidth(): number | null;
```
## Returns
number \| null
Line width
## Example
```javascript
// 1. 创建一条线宽 6 的测试导线(SCH 坐标单位 10mil)
const wire = await eda.sch_PrimitiveWire.create([1000, 1000, 1400, 1000], null, null, 6, null);
// 2. 读取线宽
const lineWidth = wire.getState_LineWidth();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveWire.delete([wire.getState_PrimitiveId()]);
console.log('lineWidth:', lineWidth);
```
### getstate_net
# ISCH\_PrimitiveWire.getState\_Net() method
Get the property state: net name
## Signature
```typescript
function getState_Net(): string;
```
## Returns
string
Net name
## Example
```javascript
// 1. 创建一条属于 SIG_A 网络的测试导线(SCH 坐标单位 10mil)
const wire = await eda.sch_PrimitiveWire.create([1000, 1000, 1400, 1000], 'SIG_A');
// 2. 读取网络名称
const net = wire.getState_Net();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveWire.delete([wire.getState_PrimitiveId()]);
console.log('net:', net);
```
### getstate_primitiveid
# ISCH\_PrimitiveWire.getState\_PrimitiveId() method
Get the property state: primitive ID
## Signature
```typescript
function getState_PrimitiveId(): string;
```
## Returns
string
Primitive ID
## Example
```javascript
// 1. 创建一条测试导线(SCH 坐标单位 10mil)
const wire = await eda.sch_PrimitiveWire.create([1000, 1000, 1400, 1000]);
// 2. 读取图元 ID
const primitiveId = wire.getState_PrimitiveId();
// 3. 用该 ID 反查同一图元,验证 ID 有效(查询类案例不留测试对象)
const refetched = await eda.sch_PrimitiveWire.get(primitiveId);
await eda.sch_PrimitiveWire.delete([primitiveId]);
console.log('primitiveId:', primitiveId);
console.log('refetch matched:', refetched.getState_PrimitiveId() === primitiveId);
```
### getstate_primitivetype
# ISCH\_PrimitiveWire.getState\_PrimitiveType() method
Get the property state: primitive type
## Signature
```typescript
function getState_PrimitiveType(): ESCH_PrimitiveType;
```
## Returns
[ESCH\_PrimitiveType](../enums/ESCH_PrimitiveType.md)
Primitive type
## Example
```javascript
// 1. 创建一条测试导线(SCH 坐标单位 10mil)
const wire = await eda.sch_PrimitiveWire.create([1000, 1000, 1400, 1000]);
// 2. 读取图元类型
const primitiveType = wire.getState_PrimitiveType();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveWire.delete([wire.getState_PrimitiveId()]);
console.log('primitiveType:', primitiveType);
```
### isasync
# ISCH\_PrimitiveWire.isAsync() method
Query whether the primitive is an async primitive
## Signature
```typescript
function isAsync(): boolean;
```
## Returns
boolean
Whether Is async primitive
## Example
```javascript
// 1. 创建一条测试导线,创建后默认处于异步模式
const wire = await eda.sch_PrimitiveWire.create([1000, 1000, 1400, 1000]);
const asyncOnCreate = wire.isAsync();
// 2. 切换到同步模式再查询一次,对比两种模式
wire.toSync();
const asyncAfterToSync = wire.isAsync();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.sch_PrimitiveWire.delete([wire.getState_PrimitiveId()]);
console.log('isAsync on create:', asyncOnCreate);
console.log('isAsync after toSync:', asyncAfterToSync);
```
### setstate_color
# ISCH\_PrimitiveWire.setState\_Color() method
> 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.
Set the property state: wire color
## Signature
```typescript
function setState_Color(color: string | null): ISCH_PrimitiveWire;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
color
</td><td>
string \| null
</td><td>
Wire color
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveWire](./ISCH_PrimitiveWire.md)
Wire primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试导线重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一条红色测试导线(SCH 坐标单位 10mil)
const wire = await eda.sch_PrimitiveWire.create([x, y, x + 400, y], null, '#FF0000', 6, 1);
// 3. 读取修改前的颜色
const before = wire.getState_Color();
// 4. 切换异步模式并改为绿色
const asyncWire = wire.toAsync();
asyncWire.setState_Color('#00AA00');
await asyncWire.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveWire.get(wire.getState_PrimitiveId());
console.log('color:', before, '→', refetched.getState_Color());
```
### setstate_line
# ISCH\_PrimitiveWire.setState\_Line() method
> 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.
Set the property state: polyline coordinate group
## Signature
```typescript
function setState_Line(line: Array<number> | Array<Array<number>>): ISCH_PrimitiveWire;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
line
</td><td>
Array<number> \| Array<Array<number>>
</td><td>
Polyline coordinate group
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveWire](./ISCH_PrimitiveWire.md)
Wire primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试导线重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一条水平单段测试导线(SCH 坐标单位 10mil)
const wire = await eda.sch_PrimitiveWire.create([x, y, x + 400, y]);
// 3. 读取修改前的路径
const before = wire.getState_Line();
// 4. 切换异步模式并改为 L 形两段(先水平再垂直,段间共享端点)
const asyncWire = wire.toAsync();
asyncWire.setState_Line([x, y, x + 400, y, x + 400, y + 400]);
await asyncWire.done();
// 5. 从画布重新读取,确认路径已更新(返回画布规格化坐标,保留现场供观察)
const refetched = await eda.sch_PrimitiveWire.get(wire.getState_PrimitiveId());
console.log('line:', JSON.stringify(before), '→', JSON.stringify(refetched.getState_Line()));
```
### setstate_linetype
# ISCH\_PrimitiveWire.setState\_LineType() method
> 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.
Set the property state: line type
## Signature
```typescript
function setState_LineType(lineType: ESCH_PrimitiveLineType | null): ISCH_PrimitiveWire;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
lineType
</td><td>
[ESCH\_PrimitiveLineType](../enums/ESCH_PrimitiveLineType.md) \| null
</td><td>
Line type
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveWire](./ISCH_PrimitiveWire.md)
Wire primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试导线重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一条虚线(DASHED=1)测试导线(SCH 坐标单位 10mil)
const wire = await eda.sch_PrimitiveWire.create([x, y, x + 400, y], null, null, null, 1);
// 3. 读取修改前的线型
const before = wire.getState_LineType();
// 4. 切换异步模式并改为点线(DOTTED=2)
const asyncWire = wire.toAsync();
asyncWire.setState_LineType(2);
await asyncWire.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveWire.get(wire.getState_PrimitiveId());
console.log('lineType:', before, '→', refetched.getState_LineType());
```
### setstate_linewidth
# ISCH\_PrimitiveWire.setState\_LineWidth() method
> 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.
Set the property state: Line width
## Signature
```typescript
function setState_LineWidth(lineWidth: number | null): ISCH_PrimitiveWire;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
lineWidth
</td><td>
number \| null
</td><td>
Line width
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveWire](./ISCH_PrimitiveWire.md)
Wire primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试导线重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一条线宽 6 的测试导线(SCH 坐标单位 10mil)
const wire = await eda.sch_PrimitiveWire.create([x, y, x + 400, y], null, null, 6, null);
// 3. 读取修改前的线宽
const before = wire.getState_LineWidth();
// 4. 切换异步模式并加粗到 10
const asyncWire = wire.toAsync();
asyncWire.setState_LineWidth(10);
await asyncWire.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveWire.get(wire.getState_PrimitiveId());
console.log('lineWidth:', before, '→', refetched.getState_LineWidth());
```
### setstate_net
# ISCH\_PrimitiveWire.setState\_Net() method
> 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.
Set the property state: net name
## Signature
```typescript
function setState_Net(net: string): ISCH_PrimitiveWire;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string
</td><td>
Net name
</td></tr>
</tbody></table>
## Returns
[ISCH\_PrimitiveWire](./ISCH_PrimitiveWire.md)
Wire primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试导线重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一条属于 SIG_A 网络的测试导线(SCH 坐标单位 10mil)
const wire = await eda.sch_PrimitiveWire.create([x, y, x + 400, y], 'SIG_A');
// 3. 读取修改前的网络名称
const before = wire.getState_Net();
// 4. 切换异步模式并改为 SIG_B
const asyncWire = wire.toAsync();
asyncWire.setState_Net('SIG_B');
await asyncWire.done();
// 5. 从画布重新读取,确认修改已生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveWire.get(wire.getState_PrimitiveId());
console.log('net:', before, '→', refetched.getState_Net());
```
### toasync
# ISCH\_PrimitiveWire.toAsync() method
Convert Primitive to Async primitive
## Signature
```typescript
function toAsync(): ISCH_PrimitiveWire;
```
## Returns
[ISCH\_PrimitiveWire](./ISCH_PrimitiveWire.md)
Wire primitive object
## Example
```javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试导线重合
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一条测试导线(创建后默认处于异步模式)
const wire = await eda.sch_PrimitiveWire.create([x, y, x + 400, y], null, null, 6, null);
// 3. 转换为异步图元
const asyncWire = wire.toAsync();
// 4. 异步模式下累计修改并提交
asyncWire.setState_LineWidth(10);
await asyncWire.done();
// 5. 从画布重新读取,确认提交生效(保留现场供观察)
const refetched = await eda.sch_PrimitiveWire.get(wire.getState_PrimitiveId());
console.log('isAsync after toAsync:', wire.isAsync());
console.log('lineWidth:', 6, '→', refetched.getState_LineWidth());
```
### tosync
# ISCH\_PrimitiveWire.toSync() method
Convert Primitive to Sync primitive
## Signature
```typescript
function toSync(): ISCH_PrimitiveWire;
```
## Returns
[ISCH\_PrimitiveWire](./ISCH_PrimitiveWire.md)
Wire primitive object
## Example
```javascript
// 1. 创建一条测试导线(创建后默认处于异步模式)
const wire = await eda.sch_PrimitiveWire.create([1000, 1000, 1400, 1000]);
// 2. 转换为同步图元,isAsync() 变为 false
const syncWire = wire.toSync();
const isAsyncAfterToSync = syncWire.isAsync();
// 3. 清理测试图元(本案例只演示模式转换,不修改画布)
await eda.sch_PrimitiveWire.delete([wire.getState_PrimitiveId()]);
console.log('isAsync after toSync:', isAsyncAfterToSync);
```
references/classes/LIB_Cbb.md
# LIB\_Cbb class
Comprehensive library / reuse block class
## Signature
```typescript
class LIB_Cbb
```
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[copy(cbbUuid, libraryUuid, targetLibraryUuid, targetClassification, newCbbName)](./LIB_Cbb.md)
</td><td>
</td><td>
**_(BETA)_** Copy Reuse block
</td></tr>
<tr><td>
[create(libraryUuid, cbbName, classification, description)](./LIB_Cbb.md)
</td><td>
</td><td>
**_(BETA)_** Create Reuse block
</td></tr>
<tr><td>
[delete(cbbUuid, libraryUuid)](./LIB_Cbb.md)
</td><td>
</td><td>
**_(BETA)_** Delete Reuse block
</td></tr>
<tr><td>
[get(cbbUuid, libraryUuid)](./LIB_Cbb.md)
</td><td>
</td><td>
**_(BETA)_** Get all properties of the reuse block
</td></tr>
<tr><td>
[modify(cbbUuid, libraryUuid, cbbName, classification, description)](./LIB_Cbb.md)
</td><td>
</td><td>
**_(BETA)_** Modify Reuse block
</td></tr>
<tr><td>
[openProjectInEditor(cbbUuid, libraryUuid)](./LIB_Cbb.md)
</td><td>
</td><td>
**_(BETA)_** Open in the editor reuse block project
</td></tr>
<tr><td>
[openSymbolInEditor(cbbUuid, libraryUuid, splitScreenId)](./LIB_Cbb.md)
</td><td>
</td><td>
**_(BETA)_** Open in the editor reuse block symbol
</td></tr>
<tr><td>
[search(key, libraryUuid, classification, itemsOfPage, page)](./LIB_Cbb.md)
</td><td>
</td><td>
**_(BETA)_** Search reuse block
</td></tr>
</tbody></table>
---
## 方法详情
### copy
# LIB\_Cbb.copy() method
> 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.
Copy Reuse block
## Signature
```typescript
function copy(
cbbUuid: string,
libraryUuid: string,
targetLibraryUuid: string,
targetClassification?: ILIB_ClassificationIndex | Array<string>,
newCbbName?: string,
): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
cbbUuid
</td><td>
string
</td><td>
Reuse block UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
targetLibraryUuid
</td><td>
string
</td><td>
Target library UUID
</td></tr>
<tr><td>
targetClassification
</td><td>
[ILIB\_ClassificationIndex](../interfaces/ILIB_ClassificationIndex.md) \| Array<string>
</td><td>
_(Optional)_ Classification in the target library
</td></tr>
<tr><td>
newCbbName
</td><td>
string
</td><td>
_(Optional)_ New reuse block name. If a reuse block with the same name exists in the target library, the copy will fail
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
UUID of the new reuse block in the target library
## Example
```javascript
// 1. 获取系统库与个人库 UUID
const systemLib = await eda.lib_LibrariesList.getSystemLibraryUuid();
const personalLib = await eda.lib_LibrariesList.getPersonalLibraryUuid();
// 2. 从系统库找一个复用模块作为复制来源
const results = await eda.lib_Cbb.search('', systemLib, undefined, 1);
const source = results[0];
// 3. 复制到个人库,指定新名称避免同名冲突(分类传 [] = 不分类)
const newName = `嘉立创示例_复制_${Date.now()}`;
const copiedUuid = await eda.lib_Cbb.copy(source.uuid, systemLib, personalLib, [], newName);
// 创建类保留现场(复制品留在个人库中供观察)
console.log('source:', source.name, source.uuid);
console.log('copiedUuid:', copiedUuid);
console.log('newName:', newName);
```
### create
# LIB\_Cbb.create() method
> 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.
Create Reuse block
## Signature
```typescript
function create(
libraryUuid: string,
cbbName: string,
classification?: ILIB_ClassificationIndex | Array<string>,
description?: string,
): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
cbbName
</td><td>
string
</td><td>
Reuse block name
</td></tr>
<tr><td>
classification
</td><td>
[ILIB\_ClassificationIndex](../interfaces/ILIB_ClassificationIndex.md) \| Array<string>
</td><td>
_(Optional)_ Classification
</td></tr>
<tr><td>
description
</td><td>
string
</td><td>
_(Optional)_ Description
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
Reuse block UUID
## Example
```javascript
// 1. 获取个人库 UUID
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
// 2. 在个人库创建复用模块(分类传空数组 = 不分类)
const cbbName = `嘉立创示例_新建模块_${Date.now()}`;
const cbbUuid = await eda.lib_Cbb.create(libraryUuid, cbbName, [], '示例描述');
// 创建类保留现场
console.log('libraryUuid:', libraryUuid);
console.log('cbbName:', cbbName);
console.log('cbbUuid:', cbbUuid);
```
### delete
# LIB\_Cbb.delete() method
> 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.
Delete Reuse block
## Signature
```typescript
function delete(cbbUuid: string, libraryUuid: string): Promise<boolean | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
cbbUuid
</td><td>
string
</td><td>
Reuse block UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
</tbody></table>
## Returns
Promise<boolean \| undefined>
Whether the operation is successful
## Example
```javascript
// 1. 获取系统库与个人库 UUID
const systemLib = await eda.lib_LibrariesList.getSystemLibraryUuid();
const personalLib = await eda.lib_LibrariesList.getPersonalLibraryUuid();
// 2. 复制一个系统库模块到个人库作为删除对象
const results = await eda.lib_Cbb.search('', systemLib, undefined, 1);
const source = results[0];
const cbbUuid = await eda.lib_Cbb.copy(source.uuid, systemLib, personalLib, [], `嘉立创示例_删除_${Date.now()}`);
// 3. 删除复制品
const deleted = await eda.lib_Cbb.delete(cbbUuid, personalLib);
console.log('cbbUuid:', cbbUuid);
console.log('deleted:', deleted);
```
### get
# LIB\_Cbb.get() method
> 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.
Get all properties of the reuse block
## Signature
```typescript
function get(cbbUuid: string, libraryUuid?: string): Promise<ILIB_CbbItem | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
cbbUuid
</td><td>
string
</td><td>
Reuse block UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
_(Optional)_ Library UUID, default is system library, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
</tbody></table>
## Returns
Promise<[ILIB\_CbbItem](../interfaces/ILIB_CbbItem.md) \| undefined>
Reuse block property
### modify
# LIB\_Cbb.modify() method
> 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.
Modify Reuse block
## Signature
```typescript
function modify(
cbbUuid: string,
libraryUuid: string,
cbbName?: string,
classification?: ILIB_ClassificationIndex | Array<string> | null,
description?: string | null,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
cbbUuid
</td><td>
string
</td><td>
Reuse block UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
cbbName
</td><td>
string
</td><td>
_(Optional)_ Reuse block name
</td></tr>
<tr><td>
classification
</td><td>
[ILIB\_ClassificationIndex](../interfaces/ILIB_ClassificationIndex.md) \| Array<string> \| null
</td><td>
_(Optional)_ Classification
</td></tr>
<tr><td>
description
</td><td>
string \| null
</td><td>
_(Optional)_ Description
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
If you want to clear certain properties, set their values to `null`
## Example
```javascript
// 1. 获取系统库与个人库 UUID
const systemLib = await eda.lib_LibrariesList.getSystemLibraryUuid();
const personalLib = await eda.lib_LibrariesList.getPersonalLibraryUuid();
// 2. 复制一个系统库模块到个人库作为修改对象
const results = await eda.lib_Cbb.search('', systemLib, undefined, 1);
const source = results[0];
const cbbUuid = await eda.lib_Cbb.copy(source.uuid, systemLib, personalLib, [], `嘉立创示例_修改_${Date.now()}`);
// 3. 修改名称和描述(分类保持不变传 [])
const newName = `嘉立创示例_重命名_${Date.now()}`;
const modified = await eda.lib_Cbb.modify(cbbUuid, personalLib, newName, [], '修改后的描述');
// 修改类保留现场
console.log('cbbUuid:', cbbUuid);
console.log('modified:', modified);
console.log('newName:', newName);
```
### openprojectineditor
# LIB\_Cbb.openProjectInEditor() method
> 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.
Open in the editor reuse block project
## Signature
```typescript
function openProjectInEditor(cbbUuid: string, libraryUuid: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
cbbUuid
</td><td>
string
</td><td>
Reuse block UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
## Remarks
This operation will open the module project in the EDA front end. If another project was previously opened with unsaved changes, executing this operation will directly lose all unsaved data
## Example
```javascript
// 1. 记录当前工程,便于演示结束后恢复
const projectInfo = await eda.dmt_Project.getCurrentProjectInfo();
// 2. 复制一个系统库模块到个人库作为打开对象
const systemLib = await eda.lib_LibrariesList.getSystemLibraryUuid();
const personalLib = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const results = await eda.lib_Cbb.search('', systemLib, undefined, 1);
const source = results[0];
const cbbUuid = await eda.lib_Cbb.copy(source.uuid, systemLib, personalLib, [], `嘉立创示例_打开工程_${Date.now()}`);
// 3. 在编辑器打开模块工程
const opened = await eda.lib_Cbb.openProjectInEditor(cbbUuid, personalLib);
// 4. 恢复原来打开的工程
await new Promise(r => setTimeout(r, 1000));
await eda.dmt_Project.openProject(projectInfo.uuid);
console.log('source:', source.name, source.uuid);
console.log('opened:', opened);
console.log('restored:', projectInfo.uuid);
```
### opensymbolineditor
# LIB\_Cbb.openSymbolInEditor() method
> 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.
Open in the editor reuse block symbol
## Signature
```typescript
function openSymbolInEditor(
cbbUuid: string,
libraryUuid: string,
splitScreenId?: string,
): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
cbbUuid
</td><td>
string
</td><td>
Reuse block UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
splitScreenId
</td><td>
string
</td><td>
_(Optional)_ Split screen ID. If not filled in, it opens in the split screen with the last input focus by default. It can be obtained using the APIs in [DMT\_EditorControl](./DMT_EditorControl.md)
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
Tab ID, corresponding to [IDMT\_EditorTabItem.tabId](../interfaces/IDMT_EditorTabItem.md)<!-- -->. You can use [DMT\_EditorControl.getSplitScreenIdByTabId()](./DMT_EditorControl.md) to get the split screen ID
## Example
```javascript
// 1. 记录当前工程,便于演示结束后恢复
const projectInfo = await eda.dmt_Project.getCurrentProjectInfo();
// 2. 复制一个系统库模块到个人库作为演示对象
const systemLib = await eda.lib_LibrariesList.getSystemLibraryUuid();
const personalLib = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const results = await eda.lib_Cbb.search('', systemLib, undefined, 1);
const source = results[0];
const cbbUuid = await eda.lib_Cbb.copy(source.uuid, systemLib, personalLib, [], `嘉立创示例_打开符号_${Date.now()}`);
// 3. 先打开模块工程(openSymbolInEditor 的前置条件)
await eda.lib_Cbb.openProjectInEditor(cbbUuid, personalLib);
await new Promise(r => setTimeout(r, 1000));
// 4. 在编辑器打开模块符号,返回标签页 ID
const tabId = await eda.lib_Cbb.openSymbolInEditor(cbbUuid, personalLib);
// 5. 恢复原来打开的工程
await eda.dmt_Project.openProject(projectInfo.uuid);
console.log('source:', source.name, source.uuid);
console.log('tabId:', tabId);
```
### search
# LIB\_Cbb.search() method
> 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.
Search reuse block
## Signature
```typescript
function search(
key: string,
libraryUuid?: string,
classification?: ILIB_ClassificationIndex | Array<string>,
itemsOfPage?: number,
page?: number,
): Promise<Array<ILIB_CbbSearchItem>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
key
</td><td>
string
</td><td>
Search keyword
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
_(Optional)_ Library UUID, default is system library, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
classification
</td><td>
[ILIB\_ClassificationIndex](../interfaces/ILIB_ClassificationIndex.md) \| Array<string>
</td><td>
_(Optional)_ Classification, defaults to all
</td></tr>
<tr><td>
itemsOfPage
</td><td>
number
</td><td>
_(Optional)_ Number of search results per page
</td></tr>
<tr><td>
page
</td><td>
number
</td><td>
_(Optional)_ Page count
</td></tr>
</tbody></table>
## Returns
Promise<Array<[ILIB\_CbbSearchItem](../interfaces/ILIB_CbbSearchItem.md)<!-- -->>>
List of searched reuse block properties
## Example
```javascript
// 1. 空关键字列出系统库全部复用模块,每页 5 条
const results = await eda.lib_Cbb.search('', undefined, undefined, 5);
// 2. 输出搜索结果
console.log('count:', results.length);
results.forEach((item, i) => {
console.log(`[${i}] name:`, item.name, 'uuid:', item.uuid);
});
```
references/classes/LIB_Footprint.md
# LIB\_Footprint class
Comprehensive library / footprint class
## Signature
```typescript
class LIB_Footprint
```
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[copy(footprintUuid, libraryUuid, targetLibraryUuid, targetClassification, newFootprintName)](./LIB_Footprint.md)
</td><td>
</td><td>
**_(BETA)_** Copy Footprint
</td></tr>
<tr><td>
[create(libraryUuid, footprintName, classification, description, otherProperty, model3D)](./LIB_Footprint.md)
</td><td>
</td><td>
**_(BETA)_** Create Footprint
</td></tr>
<tr><td>
[delete(footprintUuid, libraryUuid)](./LIB_Footprint.md)
</td><td>
</td><td>
**_(BETA)_** Delete Footprint
</td></tr>
<tr><td>
[get(footprintUuid, libraryUuid)](./LIB_Footprint.md)
</td><td>
</td><td>
**_(BETA)_** Get all properties of the footprint
</td></tr>
<tr><td>
[getDocumentSource(footprintUuid, libraryUuid)](./LIB_Footprint.md)
</td><td>
</td><td>
**_(BETA)_** 获取封装的文档源码
</td></tr>
<tr><td>
[getRenderImage(source)](./LIB_Footprint.md)
</td><td>
</td><td>
**_(BETA)_** Get the footprint render image
</td></tr>
<tr><td>
[modify(footprintUuid, libraryUuid, footprintName, classification, description, otherProperty, model3D)](./LIB_Footprint.md)
</td><td>
</td><td>
**_(BETA)_** Modify Footprint
</td></tr>
<tr><td>
[openInEditor(footprintUuid, libraryUuid, splitScreenId)](./LIB_Footprint.md)
</td><td>
</td><td>
**_(BETA)_** Open in the editor document
</td></tr>
<tr><td>
[search(key, libraryUuid, classification, itemsOfPage, page)](./LIB_Footprint.md)
</td><td>
</td><td>
**_(BETA)_** Search footprint
</td></tr>
<tr><td>
[searchByProperties(properties, libraryUuid)](./LIB_Footprint.md)
</td><td>
</td><td>
**_(BETA)_** Search footprints precisely by properties
</td></tr>
<tr><td>
[updateDocumentSource(footprintUuid, libraryUuid, documentSource)](./LIB_Footprint.md)
</td><td>
</td><td>
**_(BETA)_** Update the document source code of the footprint
</td></tr>
</tbody></table>
---
## 方法详情
### copy
# LIB\_Footprint.copy() method
> 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.
Copy Footprint
## Signature
```typescript
function copy(
footprintUuid: string,
libraryUuid: string,
targetLibraryUuid: string,
targetClassification?: ILIB_ClassificationIndex | Array<string>,
newFootprintName?: string,
): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
footprintUuid
</td><td>
string
</td><td>
Footprint UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
targetLibraryUuid
</td><td>
string
</td><td>
Target library UUID
</td></tr>
<tr><td>
targetClassification
</td><td>
[ILIB\_ClassificationIndex](../interfaces/ILIB_ClassificationIndex.md) \| Array<string>
</td><td>
_(Optional)_ Classification in the target library
</td></tr>
<tr><td>
newFootprintName
</td><td>
string
</td><td>
_(Optional)_ New footprint name. If a footprint with the same name exists in the target library, the copy will fail
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
UUID of the new footprint in the target library
## Example
```javascript
// 1. 搜索系统库,取一个封装作为复制来源
const [source] = await eda.lib_Footprint.search('0402', undefined, undefined, 1, 1);
// 2. 获取个人库 UUID
const targetLibraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
// 3. 从系统库复制到个人库,指定新名称避免同名冲突(分类传 [] = 不分类)
const newName = `嘉立创示例_封装副本_${Date.now()}`;
const copiedUuid = await eda.lib_Footprint.copy(
source.uuid,
source.libraryUuid,
targetLibraryUuid,
[],
newName
);
// 创建类保留现场(副本留在个人库中供观察)
console.log('sourceUuid:', source.uuid);
console.log('copiedUuid:', copiedUuid);
console.log('newName:', newName);
```
### create
# LIB\_Footprint.create() method
> 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.
Create Footprint
## Signature
```typescript
function create(
libraryUuid: string,
footprintName: string,
classification?: ILIB_ClassificationIndex | Array<string>,
description?: string,
otherProperty?: Record<string, boolean | number | string | undefined>,
model3D?: { name: string; uuid: string; libraryUuid: string },
): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
footprintName
</td><td>
string
</td><td>
Footprint name
</td></tr>
<tr><td>
classification
</td><td>
[ILIB\_ClassificationIndex](../interfaces/ILIB_ClassificationIndex.md) \| Array<string>
</td><td>
_(Optional)_ Classification
</td></tr>
<tr><td>
description
</td><td>
string
</td><td>
_(Optional)_ Description
</td></tr>
<tr><td>
otherProperty
</td><td>
Record<string, boolean \| number \| string \| undefined>
</td><td>
_(Optional)_ 其它属性
</td></tr>
<tr><td>
model3D
</td><td>
\{ name: string; uuid: string; libraryUuid: string \}
</td><td>
_(Optional)_ 关联 3D 模型 ADD since EDA v4.1.22
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
Footprint UUID
## Example
```javascript
// 1. 获取个人库 UUID
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
// 2. 创建封装(分类传 [] = 不分类)
const footprintName = `嘉立创示例_新封装_${Date.now()}`;
const footprintUuid = await eda.lib_Footprint.create(libraryUuid, footprintName, [], '示例封装描述');
// 创建类保留现场(新封装留在个人库中供观察)
console.log('footprintUuid:', footprintUuid);
console.log('footprintName:', footprintName);
```
### delete
# LIB\_Footprint.delete() method
> 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.
Delete Footprint
## Signature
```typescript
function delete(footprintUuid: string, libraryUuid: string): Promise<boolean | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
footprintUuid
</td><td>
string
</td><td>
Footprint UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
</tbody></table>
## Returns
Promise<boolean \| undefined>
Whether the operation is successful
## Example
```javascript
// 1. 获取个人库 UUID 并新建删除对象
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const footprintUuid = await eda.lib_Footprint.create(
libraryUuid,
`嘉立创示例_待删除封装_${Date.now()}`,
[]
);
// 2. 删除该封装
const deleted = await eda.lib_Footprint.delete(footprintUuid, libraryUuid);
console.log('footprintUuid:', footprintUuid);
console.log('deleted:', deleted);
```
### get
# LIB\_Footprint.get() method
> 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.
Get all properties of the footprint
## Signature
```typescript
function get(footprintUuid: string, libraryUuid?: string): Promise<ILIB_FootprintItem | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
footprintUuid
</td><td>
string
</td><td>
Footprint UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
_(Optional)_ Library UUID, default is system library, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
</tbody></table>
## Returns
Promise<[ILIB\_FootprintItem](../interfaces/ILIB_FootprintItem.md) \| undefined>
Footprint property
### getdocumentsource
# LIB\_Footprint.getDocumentSource() method
> 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.
获取封装的文档源码
## Signature
```typescript
function getDocumentSource(
footprintUuid: string,
libraryUuid?: string,
): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
footprintUuid
</td><td>
string
</td><td>
封装 UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
_(Optional)_ 库 UUID,默认为系统库,可以使用 [LIB\_LibrariesList](./LIB_LibrariesList.md) 内的接口获取
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
封装的 3.0 文档源码(efoo JSON 字符串),获取失败返回 `undefined`
## Remarks
与 [LIB\_Footprint.updateDocumentSource()](./LIB_Footprint.md) 对称的读取接口;返回 \*\*3.0 格式\*\*(efoo)的封装源数据, 可直接用于组装 PCB 源数据(如 AI 生成 eprj3 工程)。
支持工程库 / 非工程库(系统库 / 个人库 / 扩展库): - 工程库:从当前打开的工程 worker 读取(含未保存内容); - 非工程库:从 lib.worker 读取(含未保存内容),worker 无缓存时回退网络获取, 自动处理 `history_uuid`<!-- -->(历史版本)、`dataStrId`<!-- -->(远程存储)与 2.0 → 3.0 格式转换。
获取失败(如库条目不存在)将返回 `undefined`
### getrenderimage
# LIB\_Footprint.getRenderImage() method
> 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.
Get the footprint render image
## Signature
```typescript
function getRenderImage(source: {
footprintUuid: string;
libraryUuid: string;
}): Promise<Blob | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
source
</td><td>
\{ footprintUuid: string; libraryUuid: string \}
</td><td>
</td></tr>
</tbody></table>
## Returns
Promise<Blob \| undefined>
Footprint render image
## Example
```javascript
// 1. 搜索系统库,取一个封装作为渲染来源
const [source] = await eda.lib_Footprint.search('0402', undefined, undefined, 1, 1);
// 2. 获取渲染图(PNG Blob)
const blob = await eda.lib_Footprint.getRenderImage({
footprintUuid: source.uuid,
libraryUuid: source.libraryUuid,
});
// 3. Blob 可转成 URL 直接展示:URL.createObjectURL(blob)
console.log('sourceName:', source.name);
console.log('imageSize:', blob.size);
console.log('imageType:', blob.type);
```
### modify
# LIB\_Footprint.modify() method
> 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.
Modify Footprint
## Signature
```typescript
function modify(
footprintUuid: string,
libraryUuid: string,
footprintName?: string,
classification?: ILIB_ClassificationIndex | Array<string> | null,
description?: string | null,
otherProperty?: Record<string, boolean | number | string | undefined | null>,
model3D?: { name: string; uuid: string; libraryUuid: string },
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
footprintUuid
</td><td>
string
</td><td>
Footprint UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
footprintName
</td><td>
string
</td><td>
_(Optional)_ Footprint name
</td></tr>
<tr><td>
classification
</td><td>
[ILIB\_ClassificationIndex](../interfaces/ILIB_ClassificationIndex.md) \| Array<string> \| null
</td><td>
_(Optional)_ Classification
</td></tr>
<tr><td>
description
</td><td>
string \| null
</td><td>
_(Optional)_ Description
</td></tr>
<tr><td>
otherProperty
</td><td>
Record<string, boolean \| number \| string \| undefined \| null>
</td><td>
_(Optional)_ 其它属性,如希望清除某些属性,则将其的值设置为 `null`
</td></tr>
<tr><td>
model3D
</td><td>
\{ name: string; uuid: string; libraryUuid: string \}
</td><td>
_(Optional)_ 关联 3D 模型 ADD since v4.1.22
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
If you want to clear certain properties, set their values to `null`
## Example
```javascript
// 1. 获取个人库 UUID 并新建修改对象
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const footprintUuid = await eda.lib_Footprint.create(
libraryUuid,
`嘉立创示例_封装修改前_${Date.now()}`,
[],
'修改前的描述'
);
// 2. 修改名称和描述(分类保持不变传 [])
const newName = `嘉立创示例_封装修改后_${Date.now()}`;
const modified = await eda.lib_Footprint.modify(footprintUuid, libraryUuid, newName, [], '修改后的描述');
// 修改类保留现场
console.log('footprintUuid:', footprintUuid);
console.log('modified:', modified);
console.log('newName:', newName);
```
### openineditor
# LIB\_Footprint.openInEditor() method
> 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.
Open in the editor document
## Signature
```typescript
function openInEditor(
footprintUuid: string,
libraryUuid: string,
splitScreenId?: string,
): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
footprintUuid
</td><td>
string
</td><td>
Footprint UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
splitScreenId
</td><td>
string
</td><td>
_(Optional)_ Split screen ID. If not filled in, it opens in the split screen with the last input focus by default. It can be obtained using the APIs in [DMT\_EditorControl](./DMT_EditorControl.md)
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
Tab ID, corresponding to [IDMT\_EditorTabItem.tabId](../interfaces/IDMT_EditorTabItem.md)<!-- -->. You can use [DMT\_EditorControl.getSplitScreenIdByTabId()](./DMT_EditorControl.md) to get the split screen ID
## Example
```javascript
// 1. 获取个人库 UUID 并新建封装
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const footprintUuid = await eda.lib_Footprint.create(
libraryUuid,
`嘉立创示例_编辑封装_${Date.now()}`,
[]
);
// 2. 在编辑器中打开该封装,返回标签页 ID(uuid@libraryUuid 格式)
const tabId = await eda.lib_Footprint.openInEditor(footprintUuid, libraryUuid);
// 打开后保留现场(编辑器停留在新封装页供观察;不需要时可传 tabId 给
// dmt_EditorControl.closeDocument 关闭)
console.log('footprintUuid:', footprintUuid);
console.log('tabId:', tabId);
```
### search
# LIB\_Footprint.search() method
> 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.
Search footprint
## Signature
```typescript
function search(
key: string,
libraryUuid?: string,
classification?: ILIB_ClassificationIndex | Array<string>,
itemsOfPage?: number,
page?: number,
): Promise<Array<ILIB_FootprintSearchItem>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
key
</td><td>
string
</td><td>
Search keyword
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
_(Optional)_ Library UUID, default is system library, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
classification
</td><td>
[ILIB\_ClassificationIndex](../interfaces/ILIB_ClassificationIndex.md) \| Array<string>
</td><td>
_(Optional)_ Classification, defaults to all
</td></tr>
<tr><td>
itemsOfPage
</td><td>
number
</td><td>
_(Optional)_ Number of search results per page
</td></tr>
<tr><td>
page
</td><td>
number
</td><td>
_(Optional)_ Page count
</td></tr>
</tbody></table>
## Returns
Promise<Array<[ILIB\_FootprintSearchItem](../interfaces/ILIB_FootprintSearchItem.md)<!-- -->>>
List of searched footprint properties
## Example
```javascript
// 1. 按关键字搜索系统库中的封装,每页 5 条
const results = await eda.lib_Footprint.search('0402', undefined, undefined, 5, 1);
// 2. 输出搜索结果
console.log('count:', results.length);
results.forEach((item, i) => {
console.log(`[${i}] name:`, item.name, 'uuid:', item.uuid, 'libraryUuid:', item.libraryUuid);
});
```
### searchbyproperties
# LIB\_Footprint.searchByProperties() method
> 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.
Search footprints precisely by properties
## Signature
```typescript
function searchByProperties(
properties: ILIB_FootprintPropertiesForSearch,
libraryUuid?: string,
): Promise<Array<ILIB_FootprintSearchItem>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
properties
</td><td>
[ILIB\_FootprintPropertiesForSearch](../interfaces/ILIB_FootprintPropertiesForSearch.md)
</td><td>
Property
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
_(Optional)_ Library UUID, default is system library, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
</tbody></table>
## Returns
Promise<Array<[ILIB\_FootprintSearchItem](../interfaces/ILIB_FootprintSearchItem.md)<!-- -->>>
List of searched footprint properties
## Example
```javascript
// 1. 按名称精确搜索(官方属性集合目前仅支持 name)
// 当前版本该接口不稳定:可能抛错,也可能正常返回 undefined,两种都要兼容
let results;
try {
results = await eda.lib_Footprint.searchByProperties({ name: '0402' });
}
catch (e) {
console.log('当前版本按 name 搜索抛错:', e.message);
}
if (!Array.isArray(results))
results = [];
// 2. 输出搜索结果
console.log('count:', results.length);
results.forEach((item, i) => {
console.log(`[${i}] name:`, item.name, 'uuid:', item.uuid, 'libraryUuid:', item.libraryUuid);
});
```
### updatedocumentsource
# LIB\_Footprint.updateDocumentSource() method
> 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.
Update the document source code of the footprint
## Signature
```typescript
function updateDocumentSource(
footprintUuid: string,
libraryUuid: string,
documentSource: string,
): Promise<boolean | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
footprintUuid
</td><td>
string
</td><td>
Footprint UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
documentSource
</td><td>
string
</td><td>
Document source code
</td></tr>
</tbody></table>
## Returns
Promise<boolean \| undefined>
Whether the update is successful
## Example
```javascript
// 1. 获取个人库 UUID 并新建封装
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const footprintUuid = await eda.lib_Footprint.create(
libraryUuid,
`嘉立创示例_源码封装_${Date.now()}`,
[]
);
// 2. 在编辑器中打开封装,等待文档加载完成
const tabId = await eda.lib_Footprint.openInEditor(footprintUuid, libraryUuid);
await new Promise(r => setTimeout(r, 1500));
// 3. 读取当前打开封装的文档源码
const documentSource = await eda.sys_FileManager.getDocumentSource();
// 4. 把源码写回库中的封装(此处原样写回;实际使用时可先改写 documentSource)
const updated = await eda.lib_Footprint.updateDocumentSource(footprintUuid, libraryUuid, documentSource);
// 5. 关闭编辑器标签页(封装本体保留在库中)
await eda.dmt_EditorControl.closeDocument(tabId);
// 修改类保留现场
console.log('footprintUuid:', footprintUuid);
console.log('sourceLength:', documentSource.length);
console.log('updated:', updated);
```
references/classes/LIB_Classification.md
# LIB\_Classification class
Comprehensive library / library classification index class
## Signature
```typescript
class LIB_Classification
```
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[createPrimary(libraryUuid, libraryType, primaryClassificationName)](./LIB_Classification.md)
</td><td>
</td><td>
**_(BETA)_** Create a primary classification
</td></tr>
<tr><td>
[createSecondary(libraryUuid, libraryType, primaryClassificationUuid, secondaryClassificationName)](./LIB_Classification.md)
</td><td>
</td><td>
**_(BETA)_** Create a secondary classification
</td></tr>
<tr><td>
[deleteByIndex(classificationIndex)](./LIB_Classification.md)
</td><td>
</td><td>
**_(BETA)_** Delete the classification at the specified index
</td></tr>
<tr><td>
[deleteByUuid(libraryUuid, classificationUuid)](./LIB_Classification.md)
</td><td>
</td><td>
**_(BETA)_** Delete the classification with the specified UUID
</td></tr>
<tr><td>
[getAllClassificationTree(libraryUuid, libraryType)](./LIB_Classification.md)
</td><td>
</td><td>
**_(BETA)_** Get the tree composed of all classification information
</td></tr>
<tr><td>
[getIndexByName(libraryUuid, libraryType, primaryClassificationName, secondaryClassificationName)](./LIB_Classification.md)
</td><td>
</td><td>
**_(BETA)_** Get the classification index of the classification with the specified name
</td></tr>
<tr><td>
[getNameByIndex(classificationIndex)](./LIB_Classification.md)
</td><td>
</td><td>
**_(BETA)_** Get the name of the classification at the specified index
</td></tr>
<tr><td>
[getNameByUuid(libraryUuid, libraryType, primaryClassificationUuid, secondaryClassificationUuid)](./LIB_Classification.md)
</td><td>
</td><td>
**_(BETA)_** Get the name of the classification with the specified UUID
</td></tr>
</tbody></table>
---
## 方法详情
### createprimary
# LIB\_Classification.createPrimary() method
> 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.
> Warning: This API is now obsolete.
>
> since EDA v3.2; dropped EDA v3.3
Create a primary classification
## Signature
```typescript
function createPrimary(
libraryUuid: string,
libraryType: ELIB_LibraryType,
primaryClassificationName: string,
): Promise<ILIB_ClassificationIndex | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID
</td></tr>
<tr><td>
libraryType
</td><td>
[ELIB\_LibraryType](../enums/ELIB_LibraryType.md)
</td><td>
Library type
</td></tr>
<tr><td>
primaryClassificationName
</td><td>
string
</td><td>
Primary classification name
</td></tr>
</tbody></table>
## Returns
Promise<[ILIB\_ClassificationIndex](../interfaces/ILIB_ClassificationIndex.md) \| undefined>
Classification index
## Example
```javascript
// 1. 获取个人库 UUID
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
// 2. 在个人库的复用模块分类体系中创建一级分类(ELIB_LibraryType.CBB = '1')
const name = `嘉立创示例_一级分类_${Date.now()}`;
const index = await eda.lib_Classification.createPrimary(libraryUuid, '1', name);
// 创建类保留现场
console.log('libraryUuid:', libraryUuid);
console.log('name:', name);
console.log('primaryClassificationUuid:', index.primaryClassificationUuid);
```
### createsecondary
# LIB\_Classification.createSecondary() method
> 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.
> Warning: This API is now obsolete.
>
> since EDA v3.2; dropped EDA v3.3
Create a secondary classification
## Signature
```typescript
function createSecondary(
libraryUuid: string,
libraryType: ELIB_LibraryType,
primaryClassificationUuid: string,
secondaryClassificationName: string,
): Promise<ILIB_ClassificationIndex | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID
</td></tr>
<tr><td>
libraryType
</td><td>
[ELIB\_LibraryType](../enums/ELIB_LibraryType.md)
</td><td>
Library type
</td></tr>
<tr><td>
primaryClassificationUuid
</td><td>
string
</td><td>
Primary classification UUID
</td></tr>
<tr><td>
secondaryClassificationName
</td><td>
string
</td><td>
Secondary classification name
</td></tr>
</tbody></table>
## Returns
Promise<[ILIB\_ClassificationIndex](../interfaces/ILIB_ClassificationIndex.md) \| undefined>
Classification index
## Example
```javascript
// 1. 获取个人库 UUID
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
// 2. 先创建一级分类作为父目录(复用已有分类时可用 getIndexByName 查 UUID)
const primaryName = `嘉立创示例_二级演示一级_${Date.now()}`;
const primaryIndex = await eda.lib_Classification.createPrimary(libraryUuid, '1', primaryName);
// 3. 在该一级分类下创建二级分类
const secondaryName = `嘉立创示例_二级分类_${Date.now()}`;
const secondaryIndex = await eda.lib_Classification.createSecondary(
libraryUuid,
'1',
primaryIndex.primaryClassificationUuid,
secondaryName
);
// 创建类保留现场
console.log('primaryName:', primaryName);
console.log('secondaryName:', secondaryName);
console.log('secondaryClassificationUuid:', secondaryIndex.secondaryClassificationUuid);
```
### deletebyindex
# LIB\_Classification.deleteByIndex() method
> 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.
> Warning: This API is now obsolete.
>
> since EDA v3.2; dropped EDA v3.3
Delete the classification at the specified index
## Signature
```typescript
function deleteByIndex(classificationIndex: ILIB_ClassificationIndex): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
classificationIndex
</td><td>
[ILIB\_ClassificationIndex](../interfaces/ILIB_ClassificationIndex.md)
</td><td>
Classification index
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 获取个人库 UUID
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
// 2. 创建一个测试分类作为删除对象(复用模块库,ELIB_LibraryType.CBB = '1')
const name = `嘉立创示例_待删除分类_${Date.now()}`;
const index = await eda.lib_Classification.createPrimary(libraryUuid, '1', name);
// 3. 按索引对象删除该分类
const deleted = await eda.lib_Classification.deleteByIndex(index);
// 删除类保留现场(分类已不存在,库面板中可确认)
console.log('name:', name);
console.log('deleted:', deleted);
```
### deletebyuuid
# LIB\_Classification.deleteByUuid() method
> 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.
> Warning: This API is now obsolete.
>
> since EDA v3.2; dropped EDA v3.3
Delete the classification with the specified UUID
## Signature
```typescript
function deleteByUuid(libraryUuid: string, classificationUuid: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID
</td></tr>
<tr><td>
classificationUuid
</td><td>
string
</td><td>
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 获取个人库 UUID
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
// 2. 创建一个测试分类作为删除对象(复用模块库,ELIB_LibraryType.CBB = '1')
const name = `嘉立创示例_待删除UUID分类_${Date.now()}`;
const index = await eda.lib_Classification.createPrimary(libraryUuid, '1', name);
// 3. 按分类 UUID 删除
const deleted = await eda.lib_Classification.deleteByUuid(
libraryUuid,
index.primaryClassificationUuid
);
// 删除类保留现场(分类已不存在,库面板中可确认)
console.log('name:', name);
console.log('deleted:', deleted);
```
### getallclassificationtree
# LIB\_Classification.getAllClassificationTree() method
> 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.
> Warning: This API is now obsolete.
>
> since EDA v3.2; dropped EDA v3.3
Get the tree composed of all classification information
## Signature
```typescript
function getAllClassificationTree(
libraryUuid: string,
libraryType: ELIB_LibraryType,
): Promise<
Array<{
name: string;
uuid: string;
children?: Array<{ name: string; uuid: string }> | undefined;
}>
>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID
</td></tr>
<tr><td>
libraryType
</td><td>
[ELIB\_LibraryType](../enums/ELIB_LibraryType.md)
</td><td>
Library type
</td></tr>
</tbody></table>
## Returns
Promise<Array<{ name: string; uuid: string; children?: Array<{ name: string; uuid: string }> \| undefined }>>
Tree structure data composed of classification information
## Example
```javascript
// 1. 获取个人库 UUID
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
// 2. 创建一个测试分类,让树里有可见数据(复用模块库,ELIB_LibraryType.CBB = '1')
const name = `嘉立创示例_树查询_${Date.now()}`;
const index = await eda.lib_Classification.createPrimary(libraryUuid, '1', name);
// 3. 读取完整分类树
const tree = await eda.lib_Classification.getAllClassificationTree(libraryUuid, '1');
// 4. 清理测试分类(查询类需要清理)
await eda.lib_Classification.deleteByUuid(libraryUuid, index.primaryClassificationUuid);
// 5. 输出树结构
console.log('total:', tree.length);
tree.forEach((node, i) => {
console.log(`[${i}] name:`, node.name, 'uuid:', node.uuid, 'children:', (node.children || []).length);
});
```
### getindexbyname
# LIB\_Classification.getIndexByName() method
> 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.
> Warning: This API is now obsolete.
>
> since EDA v3.2; dropped EDA v3.3
Get the classification index of the classification with the specified name
## Signature
```typescript
function getIndexByName(
libraryUuid: string,
libraryType: ELIB_LibraryType,
primaryClassificationName: string,
secondaryClassificationName?: string,
): Promise<ILIB_ClassificationIndex | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID
</td></tr>
<tr><td>
libraryType
</td><td>
[ELIB\_LibraryType](../enums/ELIB_LibraryType.md)
</td><td>
Library type
</td></tr>
<tr><td>
primaryClassificationName
</td><td>
string
</td><td>
Primary classification name
</td></tr>
<tr><td>
secondaryClassificationName
</td><td>
string
</td><td>
_(Optional)_ Secondary classification name
</td></tr>
</tbody></table>
## Returns
Promise<[ILIB\_ClassificationIndex](../interfaces/ILIB_ClassificationIndex.md) \| undefined>
Classification index
## Remarks
The classification index contains the UUID of the classification. For details, refer to [ILIB\_ClassificationIndex](../interfaces/ILIB_ClassificationIndex.md)
## Example
```javascript
// 1. 获取个人库 UUID
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
// 2. 创建两级测试分类(复用模块库,ELIB_LibraryType.CBB = '1')
const tag = Date.now();
const primaryName = `嘉立创示例_按名索引一级_${tag}`;
const secondaryName = `嘉立创示例_按名索引二级_${tag}`;
const primaryIndex = await eda.lib_Classification.createPrimary(libraryUuid, '1', primaryName);
await eda.lib_Classification.createSecondary(
libraryUuid,
'1',
primaryIndex.primaryClassificationUuid,
secondaryName
);
// 3. 只按一级名称查索引
const primaryOnly = await eda.lib_Classification.getIndexByName(libraryUuid, '1', primaryName);
// 4. 按一级 + 二级名称查索引(secondaryClassificationName 可选)
const withSecondary = await eda.lib_Classification.getIndexByName(
libraryUuid,
'1',
primaryName,
secondaryName
);
// 5. 清理测试分类(查询类需要清理)
await eda.lib_Classification.deleteByUuid(libraryUuid, primaryIndex.primaryClassificationUuid);
console.log('primaryOnly.primaryClassificationUuid:', primaryOnly.primaryClassificationUuid);
console.log('withSecondary.secondaryClassificationUuid:', withSecondary.secondaryClassificationUuid);
```
### getnamebyindex
# LIB\_Classification.getNameByIndex() method
> 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.
> Warning: This API is now obsolete.
>
> since EDA v3.2; dropped EDA v3.3
Get the name of the classification at the specified index
## Signature
```typescript
function getNameByIndex(
classificationIndex: ILIB_ClassificationIndex,
): Promise<
| { primaryClassificationName: string; secondaryClassificationName?: string | undefined }
| undefined
>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
classificationIndex
</td><td>
[ILIB\_ClassificationIndex](../interfaces/ILIB_ClassificationIndex.md)
</td><td>
Classification index
</td></tr>
</tbody></table>
## Returns
Promise<{ primaryClassificationName: string; secondaryClassificationName?: string \| undefined } \| undefined>
Name of the two-level classification
## Example
```javascript
// 1. 获取个人库 UUID
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
// 2. 创建两级测试分类,拿到两个索引对象(复用模块库)
const tag = Date.now();
const primaryName = `嘉立创示例_按索引查名一级_${tag}`;
const secondaryName = `嘉立创示例_按索引查名二级_${tag}`;
const primaryIndex = await eda.lib_Classification.createPrimary(libraryUuid, '1', primaryName);
const secondaryIndex = await eda.lib_Classification.createSecondary(
libraryUuid,
'1',
primaryIndex.primaryClassificationUuid,
secondaryName
);
// 3. 分别解析一级索引、二级索引的名称
const primaryNames = await eda.lib_Classification.getNameByIndex(primaryIndex);
const secondaryNames = await eda.lib_Classification.getNameByIndex(secondaryIndex);
// 4. 清理测试分类(查询类需要清理)
await eda.lib_Classification.deleteByUuid(libraryUuid, primaryIndex.primaryClassificationUuid);
console.log('primaryNames:', primaryNames);
console.log('secondaryNames:', secondaryNames);
```
### getnamebyuuid
# LIB\_Classification.getNameByUuid() method
> 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.
> Warning: This API is now obsolete.
>
> since EDA v3.2; dropped EDA v3.3
Get the name of the classification with the specified UUID
## Signature
```typescript
function getNameByUuid(
libraryUuid: string,
libraryType: ELIB_LibraryType,
primaryClassificationUuid: string,
secondaryClassificationUuid?: string,
): Promise<
| { primaryClassificationName: string; secondaryClassificationName?: string | undefined }
| undefined
>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID
</td></tr>
<tr><td>
libraryType
</td><td>
[ELIB\_LibraryType](../enums/ELIB_LibraryType.md)
</td><td>
Library type
</td></tr>
<tr><td>
primaryClassificationUuid
</td><td>
string
</td><td>
Primary classification UUID
</td></tr>
<tr><td>
secondaryClassificationUuid
</td><td>
string
</td><td>
_(Optional)_ Secondary classification UUID. If not specified, only the primary classification information is obtained
</td></tr>
</tbody></table>
## Returns
Promise<{ primaryClassificationName: string; secondaryClassificationName?: string \| undefined } \| undefined>
Name of the two-level classification
## Example
```javascript
// 1. 获取个人库 UUID
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
// 2. 创建两级测试分类(复用模块库,ELIB_LibraryType.CBB = '1')
const tag = Date.now();
const primaryName = `嘉立创示例_按UUID查名一级_${tag}`;
const secondaryName = `嘉立创示例_按UUID查名二级_${tag}`;
const primaryIndex = await eda.lib_Classification.createPrimary(libraryUuid, '1', primaryName);
const secondaryIndex = await eda.lib_Classification.createSecondary(
libraryUuid,
'1',
primaryIndex.primaryClassificationUuid,
secondaryName
);
// 3. 只传一级 UUID:返回一级名称
const primaryNames = await eda.lib_Classification.getNameByUuid(
libraryUuid,
'1',
primaryIndex.primaryClassificationUuid
);
// 4. 传一级 + 二级 UUID:两级名称都返回
const bothNames = await eda.lib_Classification.getNameByUuid(
libraryUuid,
'1',
primaryIndex.primaryClassificationUuid,
secondaryIndex.secondaryClassificationUuid
);
// 5. 清理测试分类(查询类需要清理)
await eda.lib_Classification.deleteByUuid(libraryUuid, primaryIndex.primaryClassificationUuid);
console.log('primaryNames:', primaryNames);
console.log('bothNames:', bothNames);
```
references/classes/LIB_Device.md
# LIB\_Device class
Comprehensive library / device class
## Signature
```typescript
class LIB_Device
```
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[copy(deviceUuid, libraryUuid, targetLibraryUuid, targetClassification, newDeviceName)](./LIB_Device.md)
</td><td>
</td><td>
**_(BETA)_** Copy Device
</td></tr>
<tr><td>
[create(libraryUuid, deviceName, classification, association, description, property)](./LIB_Device.md)
</td><td>
</td><td>
**_(BETA)_** Create Device
</td></tr>
<tr><td>
[delete(deviceUuid, libraryUuid)](./LIB_Device.md)
</td><td>
</td><td>
**_(BETA)_** Delete Device
</td></tr>
<tr><td>
[get(deviceUuid, libraryUuid)](./LIB_Device.md)
</td><td>
</td><td>
**_(BETA)_** Get all properties of the device
</td></tr>
<tr><td>
[getByLcscIds(lcscIds, libraryUuid, allowMultiMatch)](./LIB_Device.md)
</td><td>
</td><td>
**_(BETA)_** Get a device using an LCSC C number
</td></tr>
<tr><td>
[getByLcscIds(lcscIds, libraryUuid, allowMultiMatch)](./LIB_Device.md)
</td><td>
</td><td>
**_(BETA)_** Batch get devices using LCSC C numbers
</td></tr>
<tr><td>
[modify(deviceUuid, libraryUuid, deviceName, classification, association, description, property)](./LIB_Device.md)
</td><td>
</td><td>
**_(BETA)_** Modify Device
</td></tr>
<tr><td>
[search(key, libraryUuid, classification, symbolType, itemsOfPage, page)](./LIB_Device.md)
</td><td>
</td><td>
**_(BETA)_** Search device
</td></tr>
<tr><td>
[searchByProperties(properties, libraryUuid, classification, symbolType, itemsOfPage, page)](./LIB_Device.md)
</td><td>
</td><td>
**_(BETA)_** Search devices precisely by properties
</td></tr>
</tbody></table>
---
## 方法详情
### copy
# LIB\_Device.copy() method
> 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.
Copy Device
## Signature
```typescript
function copy(
deviceUuid: string,
libraryUuid: string,
targetLibraryUuid: string,
targetClassification?: ILIB_ClassificationIndex | Array<string>,
newDeviceName?: string,
): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
deviceUuid
</td><td>
string
</td><td>
Device UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
targetLibraryUuid
</td><td>
string
</td><td>
Target library UUID
</td></tr>
<tr><td>
targetClassification
</td><td>
[ILIB\_ClassificationIndex](../interfaces/ILIB_ClassificationIndex.md) \| Array<string>
</td><td>
_(Optional)_ Classification in the target library
</td></tr>
<tr><td>
newDeviceName
</td><td>
string
</td><td>
_(Optional)_ New device name. If a device with the same name exists in the target library, the copy will fail
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
UUID of the new device in the target library
## Example
```javascript
// 1. 获取个人库 UUID
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
// 2. 新建一个轻量器件作为复制来源
const sourceName = `嘉立创示例_复制源_${Date.now()}`;
const sourceUuid = await eda.lib_Device.create(libraryUuid, sourceName, [], { symbolType: 2 });
// 3. 复制到同一库,指定新名称避免同名冲突(分类传 [] = 不分类)
const newName = `嘉立创示例_复制品_${Date.now()}`;
const copiedUuid = await eda.lib_Device.copy(sourceUuid, libraryUuid, libraryUuid, [], newName);
// 创建类保留现场(原件与复制品都留在个人库中供观察)
console.log('sourceUuid:', sourceUuid);
console.log('copiedUuid:', copiedUuid);
console.log('newName:', newName);
```
### create
# LIB\_Device.create() method
> 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.
Create Device
## Signature
```typescript
function create(
libraryUuid: string,
deviceName: string,
classification?: ILIB_ClassificationIndex | Array<string>,
association?: {
symbolType?: ELIB_SymbolType;
symbolUuid?: string;
symbol?: { uuid: string; libraryUuid: string };
footprintUuid?: string;
footprint?: { uuid: string; libraryUuid: string };
model3D?: { uuid: string; libraryUuid: string };
imageData?: File | Blob;
},
description?: string,
property?: ILIB_DeviceExtendPropertyItem,
): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
deviceName
</td><td>
string
</td><td>
Device name
</td></tr>
<tr><td>
classification
</td><td>
[ILIB\_ClassificationIndex](../interfaces/ILIB_ClassificationIndex.md) \| Array<string>
</td><td>
_(Optional)_ Classification
</td></tr>
<tr><td>
association
</td><td>
{ symbolType?: [ELIB\_SymbolType](../enums/ELIB_SymbolType.md)<!-- -->; symbolUuid?: string; symbol?: { uuid: string; libraryUuid: string }; footprintUuid?: string; footprint?: { uuid: string; libraryUuid: string }; model3D?: { uuid: string; libraryUuid: string }; imageData?: File \| Blob }
</td><td>
_(Optional)_ Associate a symbol, footprint, and image. Specifying `symbolType` creates a new symbol; if no new symbol is needed, `symbolType` does not need to be specified. However, note that if no new symbol is created and no symbol association information is specified, the device cannot be created
</td></tr>
<tr><td>
description
</td><td>
string
</td><td>
_(Optional)_ Description
</td></tr>
<tr><td>
property
</td><td>
[ILIB\_DeviceExtendPropertyItem](../interfaces/ILIB_DeviceExtendPropertyItem.md)
</td><td>
_(Optional)_ Other property, only `designator`<!-- -->, `addIntoBom`<!-- -->, `addIntoPcb` exists default value
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
Device UUID
## Example
```javascript
// 1. 获取个人库 UUID
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
// 2. 创建器件:新建元件符号(symbolType: 2)并设置默认属性
const deviceName = `嘉立创示例_新器件_${Date.now()}`;
const deviceUuid = await eda.lib_Device.create(
libraryUuid,
deviceName,
[],
{ symbolType: 2 },
'示例器件描述',
{ designator: 'R', addIntoBom: true, addIntoPcb: true }
);
// 创建类保留现场(新器件留在个人库中供观察)
console.log('deviceUuid:', deviceUuid);
console.log('deviceName:', deviceName);
```
### delete
# LIB\_Device.delete() method
> 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.
Delete Device
## Signature
```typescript
function delete(deviceUuid: string, libraryUuid: string): Promise<boolean | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
deviceUuid
</td><td>
string
</td><td>
Device UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
</tbody></table>
## Returns
Promise<boolean \| undefined>
Whether the operation is successful
## Example
```javascript
// 1. 获取个人库 UUID 并新建删除对象
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const deviceUuid = await eda.lib_Device.create(
libraryUuid,
`嘉立创示例_待删除_${Date.now()}`,
[],
{ symbolType: 2 }
);
// 2. 删除该器件
const deleted = await eda.lib_Device.delete(deviceUuid, libraryUuid);
console.log('deviceUuid:', deviceUuid);
console.log('deleted:', deleted);
```
### get
# LIB\_Device.get() method
> 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.
Get all properties of the device
## Signature
```typescript
function get(deviceUuid: string, libraryUuid?: string): Promise<ILIB_DeviceItem | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
deviceUuid
</td><td>
string
</td><td>
Device UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
_(Optional)_ Library UUID, default is system library, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
</tbody></table>
## Returns
Promise<[ILIB\_DeviceItem](../interfaces/ILIB_DeviceItem.md) \| undefined>
Device property
### getbylcscids
# LIB\_Device.getByLcscIds() method
> 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.
Get a device using an LCSC C number
## Signature
```typescript
function getByLcscIds<T extends boolean>(
lcscIds: string,
libraryUuid?: string,
allowMultiMatch?: T,
): Promise<T extends true ? ILIB_DeviceSearchItem | undefined : Array<ILIB_DeviceSearchItem>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
lcscIds
</td><td>
string
</td><td>
LCSC C number
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
_(Optional)_ Library UUID, default is system library, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
allowMultiMatch
</td><td>
T
</td><td>
_(Optional)_ Whether a single LCSC C number is allowed to match multiple results
</td></tr>
</tbody></table>
## Returns
Promise<T extends true ? [ILIB\_DeviceSearchItem](../interfaces/ILIB_DeviceSearchItem.md) \| undefined : Array<[ILIB\_DeviceSearchItem](../interfaces/ILIB_DeviceSearchItem.md)<!-- -->>>
Searched device properties
## Remarks
By default, if multiple devices with the same C number are matched in the same library, only the first result will be returned;
If you want to return multiple results, set `allowMultiMatch` to `true`<!-- -->;
This API is temporarily unavailable in the private deployment environment
### getbylcscids_1
# LIB\_Device.getByLcscIds() method
> 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.
Batch get devices using LCSC C numbers
## Signature
```typescript
function getByLcscIds(
lcscIds: Array<string>,
libraryUuid?: string,
allowMultiMatch?: boolean,
): Promise<Array<ILIB_DeviceSearchItem>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
lcscIds
</td><td>
Array<string>
</td><td>
Array of LCSC C numbers
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
_(Optional)_ Library UUID, default is system library, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
allowMultiMatch
</td><td>
boolean
</td><td>
_(Optional)_ Whether a single LCSC C number is allowed to match multiple results
</td></tr>
</tbody></table>
## Returns
Promise<Array<[ILIB\_DeviceSearchItem](../interfaces/ILIB_DeviceSearchItem.md)<!-- -->>>
List of searched device properties
## Remarks
By default, if multiple devices with the same C number are matched in the same library, only the first result will be returned;
If you want to return multiple results, set `allowMultiMatch` to `true`<!-- -->;
This API is temporarily unavailable in the private deployment environment
## Example
```javascript
// 1. 单个 C 编号查询(默认搜索系统库)
const one = await eda.lib_Device.getByLcscIds('C1523');
console.log('single count:', one.length);
console.log('[0] uuid:', one[0].uuid, 'supplierId:', one[0].supplierId);
// 2. 批量查询多个 C 编号
const many = await eda.lib_Device.getByLcscIds(['C1523', 'C17168']);
console.log('batch count:', many.length);
many.forEach((item, i) => {
console.log(`[${i}] uuid:`, item.uuid, 'supplierId:', item.supplierId);
});
```
### modify
# LIB\_Device.modify() method
> 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.
Modify Device
## Signature
```typescript
function modify(
deviceUuid: string,
libraryUuid: string,
deviceName?: string,
classification?: ILIB_ClassificationIndex | Array<string> | null,
association?: {
symbolUuid?: string;
symbol?: { uuid: string; libraryUuid: string };
footprintUuid?: string | null;
footprint?: { uuid: string; libraryUuid: string } | null;
model3D?: { uuid: string; libraryUuid: string } | null;
imageData?: File | Blob | null;
},
description?: string | null,
property?: {
name?: string | null;
designator?: string;
addIntoBom?: boolean;
addIntoPcb?: boolean;
net?: string;
manufacturer?: string | null;
manufacturerId?: string | null;
supplier?: string | null;
supplierId?: string | null;
otherProperty?: Record<string, boolean | number | string | undefined | null>;
},
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
deviceUuid
</td><td>
string
</td><td>
Device UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
deviceName
</td><td>
string
</td><td>
_(Optional)_ Device name
</td></tr>
<tr><td>
classification
</td><td>
[ILIB\_ClassificationIndex](../interfaces/ILIB_ClassificationIndex.md) \| Array<string> \| null
</td><td>
_(Optional)_ Classification
</td></tr>
<tr><td>
association
</td><td>
\{ symbolUuid?: string; symbol?: \{ uuid: string; libraryUuid: string \}; footprintUuid?: string \| null; footprint?: \{ uuid: string; libraryUuid: string \} \| null; model3D?: \{ uuid: string; libraryUuid: string \} \| null; imageData?: File \| Blob \| null \}
</td><td>
_(Optional)_ Associated symbol, footprint, image
</td></tr>
<tr><td>
description
</td><td>
string \| null
</td><td>
_(Optional)_ Description
</td></tr>
<tr><td>
property
</td><td>
{ name?: string \| null; designator?: string; addIntoBom?: boolean; addIntoPcb?: boolean; net?: string; manufacturer?: string \| null; manufacturerId?: string \| null; supplier?: string \| null; supplierId?: string \| null; otherProperty?: Record<string, boolean \| number \| string \| undefined \| null> }
</td><td>
_(Optional)_ Other property
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
If you want to clear certain properties, set their values to `null`
## Example
```javascript
// 1. 获取个人库 UUID 并新建修改对象
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const deviceUuid = await eda.lib_Device.create(
libraryUuid,
`嘉立创示例_修改前_${Date.now()}`,
[],
{ symbolType: 2 },
'修改前的描述'
);
// 2. 修改名称和描述(分类保持不变传 [])
const newName = `嘉立创示例_修改后_${Date.now()}`;
const modified = await eda.lib_Device.modify(deviceUuid, libraryUuid, newName, [], '修改后的描述');
// 3. 再补充修改扩展属性(位号、制造商)
await eda.lib_Device.modify(deviceUuid, libraryUuid, undefined, [], undefined, { designator: 'R', manufacturer: '嘉立创' });
// 修改类保留现场
console.log('deviceUuid:', deviceUuid);
console.log('modified:', modified);
console.log('newName:', newName);
```
### search
# LIB\_Device.search() method
> 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.
Search device
## Signature
```typescript
function search(
key: string,
libraryUuid?: string,
classification?: ILIB_ClassificationIndex | Array<string>,
symbolType?: ELIB_SymbolType,
itemsOfPage?: number,
page?: number,
): Promise<Array<ILIB_DeviceSearchItem>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
key
</td><td>
string
</td><td>
Search keyword
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
_(Optional)_ Library UUID, default is system library, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
classification
</td><td>
[ILIB\_ClassificationIndex](../interfaces/ILIB_ClassificationIndex.md) \| Array<string>
</td><td>
_(Optional)_ Classification, defaults to all
</td></tr>
<tr><td>
symbolType
</td><td>
[ELIB\_SymbolType](../enums/ELIB_SymbolType.md)
</td><td>
_(Optional)_ Symbol type, defaults to all
</td></tr>
<tr><td>
itemsOfPage
</td><td>
number
</td><td>
_(Optional)_ Number of search results per page
</td></tr>
<tr><td>
page
</td><td>
number
</td><td>
_(Optional)_ Page count
</td></tr>
</tbody></table>
## Returns
Promise<Array<[ILIB\_DeviceSearchItem](../interfaces/ILIB_DeviceSearchItem.md)<!-- -->>>
List of searched device properties
## Example
```javascript
// 1. 按关键字搜索系统库中的器件,每页 5 条
const results = await eda.lib_Device.search('0402', undefined, undefined, undefined, 5, 1);
// 2. 输出搜索结果
console.log('count:', results.length);
results.forEach((item, i) => {
console.log(`[${i}] name:`, item.name, 'uuid:', item.uuid, 'supplierId:', item.supplierId);
});
```
### searchbyproperties
# LIB\_Device.searchByProperties() method
> 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.
Search devices precisely by properties
## Signature
```typescript
function searchByProperties(
properties: ILIB_DevicePropertiesForSearch,
libraryUuid?: string,
classification?: Array<string>,
symbolType?: ELIB_SymbolType,
itemsOfPage?: number,
page?: number,
): Promise<Array<ILIB_DeviceSearchItem>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
properties
</td><td>
[ILIB\_DevicePropertiesForSearch](../interfaces/ILIB_DevicePropertiesForSearch.md)
</td><td>
Property
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
_(Optional)_ Library UUID, default is system library, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
classification
</td><td>
Array<string>
</td><td>
_(Optional)_ Classification, defaults to all ADD since EDA v4
</td></tr>
<tr><td>
symbolType
</td><td>
[ELIB\_SymbolType](../enums/ELIB_SymbolType.md)
</td><td>
_(Optional)_ Symbol type, defaults to all
</td></tr>
<tr><td>
itemsOfPage
</td><td>
number
</td><td>
_(Optional)_ Number of search results per page
</td></tr>
<tr><td>
page
</td><td>
number
</td><td>
_(Optional)_ Page count
</td></tr>
</tbody></table>
## Returns
Promise<Array<[ILIB\_DeviceSearchItem](../interfaces/ILIB_DeviceSearchItem.md)<!-- -->>>
List of searched device properties
## Example
```javascript
// 1. 按立创 C 编号精确搜索,每页 5 条
const results = await eda.lib_Device.searchByProperties(
{ supplierId: 'C1523' },
undefined,
undefined,
undefined,
5,
1
);
// 2. 输出搜索结果
console.log('count:', results.length);
results.forEach((item, i) => {
console.log(`[${i}] name:`, item.name, 'uuid:', item.uuid, 'supplierId:', item.supplierId);
});
```
references/classes/LIB_SelectControl.md
# LIB\_SelectControl class
Comprehensive library / selection control class
## Signature
```typescript
class LIB_SelectControl
```
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[getSelectedLibraryRowInfo()](./LIB_SelectControl.md)
</td><td>
</td><td>
**_(BETA)_** Get the information of the currently selected row in the bottom library
</td></tr>
</tbody></table>
---
## 方法详情
### getselectedlibraryrowinfo
# LIB\_SelectControl.getSelectedLibraryRowInfo() method
> 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.
Get the information of the currently selected row in the bottom library
## Signature
```typescript
function getSelectedLibraryRowInfo(): Promise<ILIB_LibraryItem | undefined>;
```
## Returns
Promise<[ILIB\_LibraryItem](../interfaces/ILIB_LibraryItem.md) \| undefined>
Library property object; if it is `undefined`<!-- -->, the retrieval failed
## Remarks
It will get the library type, UUID, and the UUID of the library it belongs to for the currently selected row in the bottom library
## Example
```javascript
// 1. 读取当前选中行
const row = await eda.lib_SelectControl.getSelectedLibraryRowInfo();
// 2. 库类型对照(ELIB_LibraryType)
const typeNames = {
1: '复用模块',
2: '符号',
3: '器件',
4: '封装',
5: '3D 模型',
29: '面板库',
32: '仿真模型(Ngspice)',
33: '仿真模型(SimulIDE)',
};
// 3. 输出选中行的关键信息(uuid + libraryUuid 可直接传给库管理接口)
console.log('libraryType:', row.libraryType, `(${typeNames[row.libraryType] || '未知类型'})`);
console.log('uuid:', row.uuid);
console.log('libraryUuid:', row.libraryUuid);
```
references/classes/LIB_PanelLibrary.md
# LIB\_PanelLibrary class
Comprehensive library / panel library class
## Signature
```typescript
class LIB_PanelLibrary
```
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[copy(panelLibraryUuid, libraryUuid, targetLibraryUuid, targetClassification, newPanelLibraryName)](./LIB_PanelLibrary.md)
</td><td>
</td><td>
**_(BETA)_** Copy Panel library
</td></tr>
<tr><td>
[create(libraryUuid, panelLibraryName, classification, description)](./LIB_PanelLibrary.md)
</td><td>
</td><td>
**_(BETA)_** Create Panel library
</td></tr>
<tr><td>
[delete(panelLibraryUuid, libraryUuid)](./LIB_PanelLibrary.md)
</td><td>
</td><td>
**_(BETA)_** Delete Panel library
</td></tr>
<tr><td>
[get(panelLibraryUuid, libraryUuid)](./LIB_PanelLibrary.md)
</td><td>
</td><td>
**_(BETA)_** Get all properties of the panel library
</td></tr>
<tr><td>
[modify(panelLibraryUuid, libraryUuid, panelLibraryName, classification, description)](./LIB_PanelLibrary.md)
</td><td>
</td><td>
**_(BETA)_** Modify Panel library
</td></tr>
<tr><td>
[openInEditor(panelLibraryUuid, libraryUuid, splitScreenId)](./LIB_PanelLibrary.md)
</td><td>
</td><td>
**_(BETA)_** Open in the editor document
</td></tr>
<tr><td>
[search(key, libraryUuid, classification, itemsOfPage, page)](./LIB_PanelLibrary.md)
</td><td>
</td><td>
**_(BETA)_** Search panel library
</td></tr>
</tbody></table>
---
## 方法详情
### copy
# LIB\_PanelLibrary.copy() method
> 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.
Copy Panel library
## Signature
```typescript
function copy(
panelLibraryUuid: string,
libraryUuid: string,
targetLibraryUuid: string,
targetClassification?: ILIB_ClassificationIndex | Array<string>,
newPanelLibraryName?: string,
): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
panelLibraryUuid
</td><td>
string
</td><td>
Panel library UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
targetLibraryUuid
</td><td>
string
</td><td>
Target library UUID
</td></tr>
<tr><td>
targetClassification
</td><td>
[ILIB\_ClassificationIndex](../interfaces/ILIB_ClassificationIndex.md) \| Array<string>
</td><td>
_(Optional)_ Classification in the target library
</td></tr>
<tr><td>
newPanelLibraryName
</td><td>
string
</td><td>
_(Optional)_ New panel library name. If a panel library with the same name exists in the target library, the copy will fail
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
UUID of the new panel library in the target library
## Example
```javascript
// 1. 搜索系统库,取一个面板库作为复制来源
const [source] = await eda.lib_PanelLibrary.search('', undefined, undefined, 1, 1);
// 2. 获取个人库 UUID
const targetLibraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
// 3. 从系统库复制到个人库,指定新名称避免同名冲突(分类传 [] = 不分类)
const newName = `嘉立创示例_面板库副本_${Date.now()}`;
const copiedUuid = await eda.lib_PanelLibrary.copy(
source.uuid,
source.libraryUuid,
targetLibraryUuid,
[],
newName
);
// 创建类保留现场(副本留在个人库中供观察)
console.log('sourceUuid:', source.uuid);
console.log('copiedUuid:', copiedUuid);
console.log('newName:', newName);
```
### create
# LIB\_PanelLibrary.create() method
> 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.
Create Panel library
## Signature
```typescript
function create(
libraryUuid: string,
panelLibraryName: string,
classification?: ILIB_ClassificationIndex | Array<string>,
description?: string,
): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
panelLibraryName
</td><td>
string
</td><td>
Panel library name
</td></tr>
<tr><td>
classification
</td><td>
[ILIB\_ClassificationIndex](../interfaces/ILIB_ClassificationIndex.md) \| Array<string>
</td><td>
_(Optional)_ Classification
</td></tr>
<tr><td>
description
</td><td>
string
</td><td>
_(Optional)_ Description
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
Panel library UUID
## Example
```javascript
// 1. 获取个人库 UUID
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
// 2. 创建面板库(分类传 [] = 不分类)
const panelLibraryName = `嘉立创示例_新面板库_${Date.now()}`;
const panelLibraryUuid = await eda.lib_PanelLibrary.create(libraryUuid, panelLibraryName, [], '示例面板库描述');
// 创建类保留现场(新面板库留在个人库中供观察)
console.log('panelLibraryUuid:', panelLibraryUuid);
console.log('panelLibraryName:', panelLibraryName);
```
### delete
# LIB\_PanelLibrary.delete() method
> 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.
Delete Panel library
## Signature
```typescript
function delete(panelLibraryUuid: string, libraryUuid: string): Promise<boolean | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
panelLibraryUuid
</td><td>
string
</td><td>
Panel library UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
</tbody></table>
## Returns
Promise<boolean \| undefined>
Whether the operation is successful
## Example
```javascript
// 1. 获取个人库 UUID 并新建删除对象
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const panelLibraryUuid = await eda.lib_PanelLibrary.create(
libraryUuid,
`嘉立创示例_待删除面板库_${Date.now()}`,
[]
);
// 2. 删除该面板库
const deleted = await eda.lib_PanelLibrary.delete(panelLibraryUuid, libraryUuid);
console.log('panelLibraryUuid:', panelLibraryUuid);
console.log('deleted:', deleted);
```
### get
# LIB\_PanelLibrary.get() method
> 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.
Get all properties of the panel library
## Signature
```typescript
function get(
panelLibraryUuid: string,
libraryUuid?: string,
): Promise<ILIB_PanelLibraryItem | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
panelLibraryUuid
</td><td>
string
</td><td>
Panel library UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
_(Optional)_ Library UUID, default is system library, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
</tbody></table>
## Returns
Promise<[ILIB\_PanelLibraryItem](../interfaces/ILIB_PanelLibraryItem.md) \| undefined>
Panel library property
### modify
# LIB\_PanelLibrary.modify() method
> 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.
Modify Panel library
## Signature
```typescript
function modify(
panelLibraryUuid: string,
libraryUuid: string,
panelLibraryName?: string,
classification?: ILIB_ClassificationIndex | Array<string> | null,
description?: string | null,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
panelLibraryUuid
</td><td>
string
</td><td>
Panel library UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
panelLibraryName
</td><td>
string
</td><td>
_(Optional)_ Panel library name
</td></tr>
<tr><td>
classification
</td><td>
[ILIB\_ClassificationIndex](../interfaces/ILIB_ClassificationIndex.md) \| Array<string> \| null
</td><td>
_(Optional)_ Classification
</td></tr>
<tr><td>
description
</td><td>
string \| null
</td><td>
_(Optional)_ Description
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
If you want to clear certain properties, set their values to `null`
## Example
```javascript
// 1. 获取个人库 UUID 并新建修改对象
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const panelLibraryUuid = await eda.lib_PanelLibrary.create(
libraryUuid,
`嘉立创示例_面板库修改前_${Date.now()}`,
[],
'修改前的描述'
);
// 2. 修改名称和描述(分类保持不变传 [])
const newName = `嘉立创示例_面板库修改后_${Date.now()}`;
const modified = await eda.lib_PanelLibrary.modify(panelLibraryUuid, libraryUuid, newName, [], '修改后的描述');
// 修改类保留现场
console.log('panelLibraryUuid:', panelLibraryUuid);
console.log('modified:', modified);
console.log('newName:', newName);
```
### openineditor
# LIB\_PanelLibrary.openInEditor() method
> 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.
Open in the editor document
## Signature
```typescript
function openInEditor(
panelLibraryUuid: string,
libraryUuid: string,
splitScreenId?: string,
): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
panelLibraryUuid
</td><td>
string
</td><td>
Panel library UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
splitScreenId
</td><td>
string
</td><td>
_(Optional)_ Split screen ID. If not filled in, it opens in the split screen with the last input focus by default. It can be obtained using the APIs in [DMT\_EditorControl](./DMT_EditorControl.md)
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
Tab ID, corresponding to [IDMT\_EditorTabItem.tabId](../interfaces/IDMT_EditorTabItem.md)<!-- -->. You can use [DMT\_EditorControl.getSplitScreenIdByTabId()](./DMT_EditorControl.md) to get the split screen ID
## Example
```javascript
// 1. 获取个人库 UUID 并新建面板库
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const panelLibraryUuid = await eda.lib_PanelLibrary.create(
libraryUuid,
`嘉立创示例_编辑面板库_${Date.now()}`,
[]
);
// 2. 在编辑器中打开该面板库,返回标签页 ID(uuid@libraryUuid 格式)
const tabId = await eda.lib_PanelLibrary.openInEditor(panelLibraryUuid, libraryUuid);
// 打开后保留现场(编辑器停留在新面板库页供观察;不需要时可传 tabId 给
// dmt_EditorControl.closeDocument 关闭)
console.log('panelLibraryUuid:', panelLibraryUuid);
console.log('tabId:', tabId);
```
### search
# LIB\_PanelLibrary.search() method
> 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.
Search panel library
## Signature
```typescript
function search(
key: string,
libraryUuid?: string,
classification?: ILIB_ClassificationIndex | Array<string>,
itemsOfPage?: number,
page?: number,
): Promise<Array<ILIB_PanelLibrarySearchItem>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
key
</td><td>
string
</td><td>
Search keyword
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
_(Optional)_ Library UUID, default is system library, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
classification
</td><td>
[ILIB\_ClassificationIndex](../interfaces/ILIB_ClassificationIndex.md) \| Array<string>
</td><td>
_(Optional)_ Classification, defaults to all
</td></tr>
<tr><td>
itemsOfPage
</td><td>
number
</td><td>
_(Optional)_ Number of search results per page
</td></tr>
<tr><td>
page
</td><td>
number
</td><td>
_(Optional)_ Page count
</td></tr>
</tbody></table>
## Returns
Promise<Array<[ILIB\_PanelLibrarySearchItem](../interfaces/ILIB_PanelLibrarySearchItem.md)<!-- -->>>
List of searched panel library properties
## Example
```javascript
// 1. 按空关键字列出系统库中的面板库,每页 5 条(换成 '三角' 等关键字即为按名称过滤)
const results = await eda.lib_PanelLibrary.search('', undefined, undefined, 5, 1);
// 2. 输出搜索结果
console.log('count:', results.length);
results.forEach((item, i) => {
console.log(`[${i}] name:`, item.name, 'uuid:', item.uuid, 'libraryUuid:', item.libraryUuid);
});
```
references/classes/LIB_LibrariesList.md
# LIB\_LibrariesList class
Comprehensive library / library list class
## Signature
```typescript
class LIB_LibrariesList
```
## Remarks
All APIs here are based on the current workspace environment of the editor. To switch to another workspace, use the [DMT\_Workspace.toggleToWorkspace()](./DMT_Workspace.md) API
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[getAllLibrariesList()](./LIB_LibrariesList.md)
</td><td>
</td><td>
Get the list of all libraries
</td></tr>
<tr><td>
[getFavoriteLibraryUuid()](./LIB_LibrariesList.md)
</td><td>
</td><td>
Get the UUID of the favorite library
</td></tr>
<tr><td>
[getPersonalLibraryUuid()](./LIB_LibrariesList.md)
</td><td>
</td><td>
Get the UUID of the personal library
</td></tr>
<tr><td>
[getProjectLibraryUuid()](./LIB_LibrariesList.md)
</td><td>
</td><td>
Get the UUID of the project library
</td></tr>
<tr><td>
[getSystemLibraryUuid()](./LIB_LibrariesList.md)
</td><td>
</td><td>
Get the UUID of the system library
</td></tr>
<tr><td>
[registerExtendLibrary(title, libraryFunctions)](./LIB_LibrariesList.md)
</td><td>
</td><td>
**_(BETA)_** Register an external library
</td></tr>
</tbody></table>
---
## 方法详情
### getalllibrarieslist
# LIB\_LibrariesList.getAllLibrariesList() method
Get the list of all libraries
## Signature
```typescript
function getAllLibrariesList(): Promise<Array<ILIB_LibraryInfo>>;
```
## Returns
Promise<Array<[ILIB\_LibraryInfo](../interfaces/ILIB_LibraryInfo.md)<!-- -->>>
Library information list
## Remarks
This does not get the information of the system library, personal library, project library, or favorite library. To get their information, use the [getSystemLibraryUuid](./LIB_LibrariesList.md)<!-- -->, [getPersonalLibraryUuid](./LIB_LibrariesList.md)<!-- -->, [getProjectLibraryUuid](./LIB_LibrariesList.md)<!-- -->, and [getFavoriteLibraryUuid](./LIB_LibrariesList.md) APIs
## Example
```javascript
// 1. 获取所有库的列表
const libraries = await eda.lib_LibrariesList.getAllLibrariesList();
// 2. 输出库数量及每个库的名称、UUID
console.log('count:', libraries.length);
libraries.forEach((lib, i) => {
console.log(`[${i}] name:`, lib.name, 'uuid:', lib.uuid);
});
```
### getfavoritelibraryuuid
# LIB\_LibrariesList.getFavoriteLibraryUuid() method
Get the UUID of the favorite library
## Signature
```typescript
function getFavoriteLibraryUuid(): Promise<string | undefined>;
```
## Returns
Promise<string \| undefined>
UUID of the favorite library
## Remarks
It will get the UUID of the favorite library under the current editor workspace
### getpersonallibraryuuid
# LIB\_LibrariesList.getPersonalLibraryUuid() method
Get the UUID of the personal library
## Signature
```typescript
function getPersonalLibraryUuid(): Promise<string | undefined>;
```
## Returns
Promise<string \| undefined>
UUID of the personal library
## Remarks
It will get the UUID of the personal library under the current editor workspace. In the private deployment environment, the personal library does not exist, and this API will always return `undefined`
### getprojectlibraryuuid
# LIB\_LibrariesList.getProjectLibraryUuid() method
Get the UUID of the project library
## Signature
```typescript
function getProjectLibraryUuid(): Promise<string | undefined>;
```
## Returns
Promise<string \| undefined>
UUID of the project library
## Remarks
Calling it without an open project will return `undefined`
### getsystemlibraryuuid
# LIB\_LibrariesList.getSystemLibraryUuid() method
Get the UUID of the system library
## Signature
```typescript
function getSystemLibraryUuid(): Promise<string | undefined>;
```
## Returns
Promise<string \| undefined>
UUID of the system library
### registerextendlibrary
# LIB\_LibrariesList.registerExtendLibrary() method
> 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.
Register an external library
## Signature
```typescript
function registerExtendLibrary(
title: string,
libraryFunctions: {
device?: ILIB_ExtendLibraryDeviceFunctions;
symbol?: ILIB_ExtendLibrarySymbolFunctions;
footprint?: ILIB_ExtendLibraryFootprintFunctions;
cbb?: ILIB_ExtendLibraryCbbFunctions;
model3d?: ILIB_ExtendLibrary3DModelFunctions;
},
): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
title
</td><td>
string
</td><td>
Title
</td></tr>
<tr><td>
libraryFunctions
</td><td>
{ device?: [ILIB\_ExtendLibraryDeviceFunctions](../interfaces/ILIB_ExtendLibraryDeviceFunctions.md)<!-- -->; symbol?: [ILIB\_ExtendLibrarySymbolFunctions](../interfaces/ILIB_ExtendLibrarySymbolFunctions.md)<!-- -->; footprint?: [ILIB\_ExtendLibraryFootprintFunctions](../interfaces/ILIB_ExtendLibraryFootprintFunctions.md)<!-- -->; cbb?: [ILIB\_ExtendLibraryCbbFunctions](../interfaces/ILIB_ExtendLibraryCbbFunctions.md)<!-- -->; model3d?: [ILIB\_ExtendLibrary3DModelFunctions](../interfaces/ILIB_ExtendLibrary3DModelFunctions.md) }
</td><td>
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
Library UUID
## Remarks
Note: This API is only valid for extensions. Calling it in a standalone script environment will always `throw Error`
## Example
```javascript
// 1. 实现外部库的符号数据回调(真实场景中在此对接自己的数据源)
const symbolFunctions = {
// 分类树:库面板左侧的分类目录
getClassificationTree: async () => [
{ name: '电阻', uuid: 'resistor' },
{ name: '电容', uuid: 'capacitor' }
],
// 列表搜索:响应用户的关键字搜索与分页,返回分页结构
getList: async (props) => {
const all = [{ uuid: 'demo_0402', title: '示例符号 0402' }];
return {
count: all.length,
lists: all,
page: props.page || 1,
pageSize: props.pageSize || 10,
totalPage: 1
};
},
// 详情:用户选中条目后获取完整信息
getDetail: async (uuid) => {
return { uuid, title: '示例符号 0402' };
}
};
// 2. 以指定标题注册外部库,挂载符号类型资源
const libUuid = await eda.lib_LibrariesList.registerExtendLibrary('嘉立创示例_外部库', {
symbol: symbolFunctions
});
// 3. 输出注册结果,库面板中即可看到「嘉立创示例_外部库」
console.log('libUuid:', libUuid);
```
references/classes/LIB_SimulationModel.md
# LIB\_SimulationModel class
Comprehensive library / simulation model class
## Signature
```typescript
class LIB_SimulationModel
```
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[copy(simulationModelUuid, libraryUuid, targetLibraryUuid, targetClassification, newSimulationModelName)](./LIB_SimulationModel.md)
</td><td>
</td><td>
**_(BETA)_** Copy the simulation model
</td></tr>
<tr><td>
[create(libraryUuid, model, classification, description)](./LIB_SimulationModel.md)
</td><td>
</td><td>
**_(BETA)_** Create a simulation model
</td></tr>
<tr><td>
[delete(simulationModelUuid, libraryUuid)](./LIB_SimulationModel.md)
</td><td>
</td><td>
**_(BETA)_** Delete the simulation model
</td></tr>
<tr><td>
[get(simulationModelUuid, libraryUuid)](./LIB_SimulationModel.md)
</td><td>
</td><td>
**_(BETA)_** Get all properties of the simulation model
</td></tr>
<tr><td>
[modify(simulationModelUuid, libraryUuid, modelProps, classification, description)](./LIB_SimulationModel.md)
</td><td>
</td><td>
**_(BETA)_** Modify the simulation model
</td></tr>
<tr><td>
[search(key, libraryUuid, classification, simulationModelType, itemsOfPage, page)](./LIB_SimulationModel.md)
</td><td>
</td><td>
**_(BETA)_** Search simulation models
</td></tr>
</tbody></table>
---
## 方法详情
### copy
# LIB\_SimulationModel.copy() method
> 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.
Copy the simulation model
## Signature
```typescript
function copy(
simulationModelUuid: string,
libraryUuid: string,
targetLibraryUuid: string,
targetClassification?: Array<string>,
newSimulationModelName?: string,
): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
simulationModelUuid
</td><td>
string
</td><td>
Simulation model UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
targetLibraryUuid
</td><td>
string
</td><td>
Target library UUID
</td></tr>
<tr><td>
targetClassification
</td><td>
Array<string>
</td><td>
_(Optional)_ Classification in the target library
</td></tr>
<tr><td>
newSimulationModelName
</td><td>
string
</td><td>
_(Optional)_ New simulation model name. If a symbol with the same name exists in the target library, the copy will fail
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
UUID of the new simulation model in the target library
## Remarks
ADD since EDA v3.2.167
## Example
```javascript
// 1. 获取个人库 UUID,并新建一个仿真模型作为复制来源
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const sourceName = `嘉立创示例_仿真模型来源_${Date.now()}`;
const sourceUuid = await eda.lib_SimulationModel.create(libraryUuid, {
modelType: 'Ngspice',
modelData: '* 示例电阻模型\n.model EXAMPLE_RES RES(R=1k)\n',
modelName: sourceName,
});
// 2. 同库复制,指定新名称避免同名冲突(分类传 [] = 不分类)
const newName = `嘉立创示例_仿真模型副本_${Date.now()}`;
const copiedUuid = await eda.lib_SimulationModel.copy(
sourceUuid,
libraryUuid,
libraryUuid,
[],
newName
);
// 创建类保留现场(副本留在个人库中供观察)
console.log('sourceUuid:', sourceUuid);
console.log('copiedUuid:', copiedUuid);
console.log('newName:', newName);
```
### create
# LIB\_SimulationModel.create() method
> 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.
Create a simulation model
## Signature
```typescript
function create(
libraryUuid: string,
model: { modelType: 'Ngspice' } & (
| { modelFile: Blob; modelName?: string; modelCategory?: string; modelPin?: string }
| { modelData: string; modelName?: string; modelCategory?: string; modelPin?: string }
),
classification?: Array<string>,
description?: string,
): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
model
</td><td>
{ modelType: 'Ngspice' } & ({ modelFile: Blob; modelName?: string; modelCategory?: string; modelPin?: string } \| { modelData: string; modelName?: string; modelCategory?: string; modelPin?: string })
</td><td>
Simulation model data
</td></tr>
<tr><td>
classification
</td><td>
Array<string>
</td><td>
_(Optional)_ Classification
</td></tr>
<tr><td>
description
</td><td>
string
</td><td>
_(Optional)_ Description
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
Simulation model UUID
## Remarks
ADD since EDA v3.2.167
## Example
```javascript
// 1. 获取个人库 UUID
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
// 2. 创建 Ngspice 仿真模型(modelData 传 .model 语句文本,分类传 [] = 不分类)
const modelName = `嘉立创示例_新仿真模型_${Date.now()}`;
const simulationModelUuid = await eda.lib_SimulationModel.create(
libraryUuid,
{
modelType: 'Ngspice',
modelData: '* 示例电阻模型\n.model EXAMPLE_RES RES(R=1k)\n',
modelName,
modelPin: '1,2',
},
[],
'示例仿真模型描述'
);
// 创建类保留现场(新仿真模型留在个人库中供观察)
console.log('simulationModelUuid:', simulationModelUuid);
console.log('modelName:', modelName);
```
### delete
# LIB\_SimulationModel.delete() method
> 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.
Delete the simulation model
## Signature
```typescript
function delete(simulationModelUuid: string, libraryUuid: string): Promise<boolean | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
simulationModelUuid
</td><td>
string
</td><td>
Simulation model UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
</tbody></table>
## Returns
Promise<boolean \| undefined>
Whether the operation is successful
## Remarks
ADD since EDA v3.2.167
## Example
```javascript
// 1. 获取个人库 UUID 并新建删除对象
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const simulationModelUuid = await eda.lib_SimulationModel.create(
libraryUuid,
{
modelType: 'Ngspice',
modelData: '* 示例电阻模型\n.model EXAMPLE_RES RES(R=1k)\n',
modelName: `嘉立创示例_待删除仿真模型_${Date.now()}`,
},
[]
);
// 2. 删除该仿真模型
const deleted = await eda.lib_SimulationModel.delete(simulationModelUuid, libraryUuid);
console.log('simulationModelUuid:', simulationModelUuid);
console.log('deleted:', deleted);
```
### get
# LIB\_SimulationModel.get() method
> 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.
Get all properties of the simulation model
## Signature
```typescript
function get(
simulationModelUuid: string,
libraryUuid?: string,
): Promise<ILIB_SimulationModelItem | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
simulationModelUuid
</td><td>
string
</td><td>
Simulation model UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
_(Optional)_ Library UUID, default is system library, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
</tbody></table>
## Returns
Promise<[ILIB\_SimulationModelItem](../interfaces/ILIB_SimulationModelItem.md) \| undefined>
Simulation model properties
## Remarks
Note: This API is only valid for the private deployment edition. Calling it in other editions will always `throw Error` ADD since EDA v3.2.167
### modify
# LIB\_SimulationModel.modify() method
> 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.
Modify the simulation model
## Signature
```typescript
function modify(
simulationModelUuid: string,
libraryUuid: string,
modelProps?: { modelName?: string; modelCategory?: string; modelPin?: string },
classification?: Array<string> | null,
description?: string | null,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
simulationModelUuid
</td><td>
string
</td><td>
Simulation model UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
modelProps
</td><td>
\{ modelName?: string; modelCategory?: string; modelPin?: string \}
</td><td>
_(Optional)_ Simulation model properties
</td></tr>
<tr><td>
classification
</td><td>
Array<string> \| null
</td><td>
_(Optional)_ Classification
</td></tr>
<tr><td>
description
</td><td>
string \| null
</td><td>
_(Optional)_ Description
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
If you want to clear certain properties, set their values to `null` ADD since EDA v3.2.167
## Example
```javascript
// 1. 获取个人库 UUID 并新建修改对象
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const simulationModelUuid = await eda.lib_SimulationModel.create(
libraryUuid,
{
modelType: 'Ngspice',
modelData: '* 示例电阻模型\n.model EXAMPLE_RES RES(R=1k)\n',
modelName: `嘉立创示例_仿真模型修改前_${Date.now()}`,
},
[],
'修改前的描述'
);
// 2. 修改名称和描述(分类保持不变传 [])
const newName = `嘉立创示例_仿真模型修改后_${Date.now()}`;
const modified = await eda.lib_SimulationModel.modify(
simulationModelUuid,
libraryUuid,
{ modelName: newName },
[],
'修改后的描述'
);
// 修改类保留现场
console.log('simulationModelUuid:', simulationModelUuid);
console.log('modified:', modified);
console.log('newName:', newName);
```
### search
# LIB\_SimulationModel.search() method
> 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.
Search simulation models
## Signature
```typescript
function search(
key: string,
libraryUuid?: string,
classification?: Array<string>,
simulationModelType?: ELIB_SimulationModelType,
itemsOfPage?: number,
page?: number,
): Promise<Array<ILIB_SimulationModelSearchItem>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
key
</td><td>
string
</td><td>
Search keyword
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
_(Optional)_ Library UUID, default is system library, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
classification
</td><td>
Array<string>
</td><td>
_(Optional)_ Classification, defaults to all
</td></tr>
<tr><td>
simulationModelType
</td><td>
[ELIB\_SimulationModelType](../enums/ELIB_SimulationModelType.md)
</td><td>
_(Optional)_ Simulation model type, defaults to all
</td></tr>
<tr><td>
itemsOfPage
</td><td>
number
</td><td>
_(Optional)_ Number of search results per page
</td></tr>
<tr><td>
page
</td><td>
number
</td><td>
_(Optional)_ Page count
</td></tr>
</tbody></table>
## Returns
Promise<Array<[ILIB\_SimulationModelSearchItem](../interfaces/ILIB_SimulationModelSearchItem.md)<!-- -->>>
List of searched simulation model properties
## Remarks
ADD since EDA v3.2.167
## Example
```javascript
// 1. 按空关键字列出系统库中的仿真模型,每页 5 条,只看 Ngspice 类型(换成 '2N3904' 等关键字即为按名称过滤)
const results = await eda.lib_SimulationModel.search('', undefined, undefined, 'Ngspice', 5, 1);
// 2. 输出搜索结果
console.log('count:', results.length);
results.forEach((item, i) => {
console.log(`[${i}] name:`, item.name, 'uuid:', item.uuid, 'libraryUuid:', item.libraryUuid);
});
```
references/classes/PCB_Event.md
# PCB\_Event class
PCB & footprint / event class
## Signature
```typescript
class PCB_Event
```
## Remarks
Register an event callback
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[addCrossProbeSelectEventListener(id, callFn)](./PCB_Event.md)
</td><td>
</td><td>
**_(BETA)_** Add a cross-probe selection event listener
</td></tr>
<tr><td>
[addImageEventListener(id, callFn)](./PCB_Event.md)
</td><td>
</td><td>
**_(BETA)_** 新增插入图片事件监听
</td></tr>
<tr><td>
[addMouseEventListener(id, eventType, callFn, onlyOnce)](./PCB_Event.md)
</td><td>
</td><td>
**_(BETA)_** Add a mouse event listener
</td></tr>
<tr><td>
[addNetEventListener(id, eventType, callFn, onlyOnce)](./PCB_Event.md)
</td><td>
</td><td>
**_(BETA)_** Add a net event listener
</td></tr>
<tr><td>
[addPrimitiveEventListener(id, eventType, callFn, onlyOnce)](./PCB_Event.md)
</td><td>
</td><td>
**_(BETA)_** Add a primitive event listener
</td></tr>
<tr><td>
[addRayTracerEngine3DViewCameraChangeEventListener(id, callFn, onlyOnce)](./PCB_Event.md)
</td><td>
</td><td>
**_(BETA)_** Add a ray tracer engine 3D preview camera change (dragging the 3D model) event listener
</td></tr>
<tr><td>
[addRayTracerEngine3DViewClickMaterialEventListener(id, callFn, onlyOnce)](./PCB_Event.md)
</td><td>
</td><td>
**_(BETA)_** Add a ray tracer engine 3D preview material click event listener
</td></tr>
<tr><td>
[addRealTimeDrcResultEventListener(id, eventType, callFn)](./PCB_Event.md)
</td><td>
</td><td>
**_(BETA)_** Add a real-time DRC result event listener
</td></tr>
<tr><td>
[isEventListenerAlreadyExist(id)](./PCB_Event.md)
</td><td>
</td><td>
Query whether the event listener exists
</td></tr>
<tr><td>
[removeEventListener(id)](./PCB_Event.md)
</td><td>
</td><td>
Remove Event listener
</td></tr>
</tbody></table>
---
## 方法详情
### addcrossprobeselecteventlistener
# PCB\_Event.addCrossProbeSelectEventListener() method
> 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.
Add a cross-probe selection event listener
## Signature
```typescript
function addCrossProbeSelectEventListener(
id: string,
callFn: (props: any) => void | Promise<void>,
): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
Event ID, used to prevent duplicate event registration
</td></tr>
<tr><td>
callFn
</td><td>
(props: any) => void \| Promise<void>
</td><td>
The callback function triggered when the event fires
</td></tr>
</tbody></table>
## Returns
void
## Remarks
Note: This API is only valid for extensions. Calling it in a standalone script environment will always `throw Error`
## Example
```javascript
const listenerId = '嘉立创示例_cross_probe';
// 1. 注册交叉选择事件监听(回调在用户执行交叉选中时触发,本例不依赖实际触发)
eda.pcb_Event.addCrossProbeSelectEventListener(listenerId, (props) => {
console.log('crossProbeSelect:', JSON.stringify(props));
});
// 2. 回读确认注册成功(同 id 重复注册会被防重机制忽略)
const registered = eda.pcb_Event.isEventListenerAlreadyExist(listenerId);
console.log('registered:', registered);
// 3. 清理监听
const removed = eda.pcb_Event.removeEventListener(listenerId);
console.log('removed:', removed);
```
### addimageeventlistener
# PCB\_Event.addImageEventListener() method
> 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.
> Warning: This API is now obsolete.
>
> 临时接口(插入图片 PCB 迁移打通流程用):统一事件机制落地后替换,请尽快迁移,勿在新功能中继续依赖
新增插入图片事件监听
## Signature
```typescript
function addImageEventListener(
id: string,
callFn: (message: { file?: File; source: 'toolbar' | 'paste' }) => void | Promise<void>,
): boolean;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
事件 ID,用于防止重复注册(内部自动加扩展 uuid 前缀)
</td></tr>
<tr><td>
callFn
</td><td>
(message: { file?: File; source: 'toolbar' \| 'paste' }) => void \| Promise<void>
</td><td>
事件触发时的回调,接收 pro-ui 触发的放置图片请求
</td></tr>
</tbody></table>
## Returns
boolean
是否注册成功
## Remarks
ADD since EDA v5
### addmouseeventlistener
# PCB\_Event.addMouseEventListener() method
> 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.
Add a mouse event listener
## Signature
```typescript
function addMouseEventListener(
id: string,
eventType: 'all' | EPCB_MouseEventType,
callFn: (
eventType: EPCB_MouseEventType,
props: [
{
primitiveId: string;
primitiveType: EPCB_PrimitiveType;
net?: string;
designator?: string;
parentComponentPrimitiveId?: string;
parentComponentDesignator?: string;
},
],
) => void | Promise<void>,
onlyOnce?: boolean,
): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
Event ID, used to prevent duplicate event registration
</td></tr>
<tr><td>
eventType
</td><td>
'all' \| [EPCB\_MouseEventType](../enums/EPCB_MouseEventType.md)
</td><td>
Event type
</td></tr>
<tr><td>
callFn
</td><td>
(eventType: [EPCB\_MouseEventType](../enums/EPCB_MouseEventType.md)<!-- -->, props: \[{ primitiveId: string; primitiveType: [EPCB\_PrimitiveType](../enums/EPCB_PrimitiveType.md)<!-- -->; net?: string; designator?: string; parentComponentPrimitiveId?: string; parentComponentDesignator?: string }\]) => void \| Promise<void>
</td><td>
The callback function triggered when the event fires
</td></tr>
<tr><td>
onlyOnce
</td><td>
boolean
</td><td>
_(Optional)_ Whether to listen only once
</td></tr>
</tbody></table>
## Returns
void
## Remarks
Note: This API is only valid for extensions. Calling it in a standalone script environment will always `throw Error`
## Example
```javascript
const listenerId = '嘉立创示例_mouse_event';
// 1. 注册鼠标事件监听,eventType 用 'all' 接收全部鼠标事件,onlyOnce 为 false 持续监听
eda.pcb_Event.addMouseEventListener(
listenerId,
'all',
(eventType, props) => {
// 回调在用户画布操作时触发;props 是命中图元的信息数组
console.log('mouseEvent:', eventType, JSON.stringify(props));
},
false
);
// 2. 回读确认注册成功
const registered = eda.pcb_Event.isEventListenerAlreadyExist(listenerId);
console.log('registered:', registered);
// 3. 清理监听
const removed = eda.pcb_Event.removeEventListener(listenerId);
console.log('removed:', removed);
```
### addneteventlistener
# PCB\_Event.addNetEventListener() method
> 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.
Add a net event listener
## Signature
```typescript
function addNetEventListener(
id: string,
eventType: 'all' | EPCB_NetEventType,
callFn: (eventType: EPCB_NetEventType, props: [{ net: string }]) => void | Promise<void>,
onlyOnce?: boolean,
): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
Event ID, used to prevent duplicate event registration
</td></tr>
<tr><td>
eventType
</td><td>
'all' \| [EPCB\_NetEventType](../enums/EPCB_NetEventType.md)
</td><td>
Event type
</td></tr>
<tr><td>
callFn
</td><td>
(eventType: [EPCB\_NetEventType](../enums/EPCB_NetEventType.md)<!-- -->, props: \[{ net: string }\]) => void \| Promise<void>
</td><td>
The callback function triggered when the event fires
</td></tr>
<tr><td>
onlyOnce
</td><td>
boolean
</td><td>
_(Optional)_ Whether to listen only once
</td></tr>
</tbody></table>
## Returns
void
## Remarks
Net select event only
1. When the net option is selected in the filter panel and a net is selected on the canvas
2. When a net is selected in Engineering Design -<!-- -->> Nets
the event will be triggered
Note: This API is only valid for extensions. Calling it in a standalone script environment will always `throw Error`
## Example
```javascript
const listenerId = '嘉立创示例_net_event';
// 1. 注册网络事件监听,eventType 用 'all' 接收全部网络事件
eda.pcb_Event.addNetEventListener(
listenerId,
'all',
(eventType, props) => {
// 回调在网络选中变化时触发;props 是网络信息数组
console.log('netEvent:', eventType, JSON.stringify(props));
},
false
);
// 2. 回读确认注册成功
const registered = eda.pcb_Event.isEventListenerAlreadyExist(listenerId);
console.log('registered:', registered);
// 3. 清理监听
const removed = eda.pcb_Event.removeEventListener(listenerId);
console.log('removed:', removed);
```
### addprimitiveeventlistener
# PCB\_Event.addPrimitiveEventListener() method
> 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.
Add a primitive event listener
## Signature
```typescript
function addPrimitiveEventListener(
id: string,
eventType: 'all' | EPCB_PrimitiveEventType,
callFn: (
eventType: EPCB_PrimitiveEventType,
props: [
{
primitiveId: string;
primitiveType: EPCB_PrimitiveType;
net?: string;
designator?: string;
parentComponentPrimitiveId?: string;
parentComponentDesignator?: string;
},
],
) => void | Promise<void>,
onlyOnce?: boolean,
): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
Event ID, used to prevent duplicate event registration
</td></tr>
<tr><td>
eventType
</td><td>
'all' \| [EPCB\_PrimitiveEventType](../enums/EPCB_PrimitiveEventType.md)
</td><td>
Event type
</td></tr>
<tr><td>
callFn
</td><td>
(eventType: [EPCB\_PrimitiveEventType](../enums/EPCB_PrimitiveEventType.md)<!-- -->, props: \[{ primitiveId: string; primitiveType: [EPCB\_PrimitiveType](../enums/EPCB_PrimitiveType.md)<!-- -->; net?: string; designator?: string; parentComponentPrimitiveId?: string; parentComponentDesignator?: string }\]) => void \| Promise<void>
</td><td>
The callback function triggered when the event fires
</td></tr>
<tr><td>
onlyOnce
</td><td>
boolean
</td><td>
_(Optional)_ Whether to listen only once
</td></tr>
</tbody></table>
## Returns
void
## Remarks
Note: This API is only valid for extensions. Calling it in a standalone script environment will always `throw Error`
## Example
```javascript
const listenerId = '嘉立创示例_primitive_event';
const events = [];
// 1. 注册图元事件监听,eventType 用 'all' 接收全部图元事件
eda.pcb_Event.addPrimitiveEventListener(
listenerId,
'all',
(eventType, props) => {
events.push({ eventType, primitiveType: props?.[0]?.primitiveType });
},
false
);
// 2. 创建一个测试焊盘,触发图元 add 事件
const pad = await eda.pcb_PrimitivePad.create(1, '1', 5000, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
await new Promise(r => setTimeout(r, 500));
// 3. 删除测试焊盘,再触发一次图元删除事件(同时清理测试图元)
await eda.pcb_PrimitivePad.delete([pad.getState_PrimitiveId()]);
await new Promise(r => setTimeout(r, 500));
// 4. 观察两次操作分别触发的事件
console.log('events:', JSON.stringify(events));
// 5. 清理监听
const removed = eda.pcb_Event.removeEventListener(listenerId);
console.log('removed:', removed);
```
### addraytracerengine3dviewcamerachangeeventlistener
# PCB\_Event.addRayTracerEngine3DViewCameraChangeEventListener() method
> 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.
Add a ray tracer engine 3D preview camera change (dragging the 3D model) event listener
## Signature
```typescript
function addRayTracerEngine3DViewCameraChangeEventListener(
id: string,
callFn: (props: {
position: { x: number; y: number; z: number };
rotation: { x: number; y: number; z: number };
focalLength: number;
}) => void | Promise<void>,
onlyOnce?: boolean,
): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
Event ID, used to prevent duplicate event registration
</td></tr>
<tr><td>
callFn
</td><td>
(props: { position: { x: number; y: number; z: number }; rotation: { x: number; y: number; z: number }; focalLength: number }) => void \| Promise<void>
</td><td>
The callback function triggered when the event fires
</td></tr>
<tr><td>
onlyOnce
</td><td>
boolean
</td><td>
_(Optional)_ Whether to listen only once
</td></tr>
</tbody></table>
## Returns
void
## Remarks
Note: This API is only valid for extensions. Calling it in a standalone script environment will always `throw Error` ADD since EDA v4
## Example
```javascript
const listenerId = '嘉立创示例_3d_camera';
// 1. 注册相机变动监听(回调在 3D 预览拖动时触发,本例不依赖实际触发)
eda.pcb_Event.addRayTracerEngine3DViewCameraChangeEventListener(
listenerId,
(props) => {
console.log('cameraChange:', JSON.stringify(props));
}
);
// 2. 回读确认注册成功
const registered = eda.pcb_Event.isEventListenerAlreadyExist(listenerId);
console.log('registered:', registered);
// 3. 清理监听
const removed = eda.pcb_Event.removeEventListener(listenerId);
console.log('removed:', removed);
```
### addraytracerengine3dviewclickmaterialeventlistener
# PCB\_Event.addRayTracerEngine3DViewClickMaterialEventListener() method
> 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.
Add a ray tracer engine 3D preview material click event listener
## Signature
```typescript
function addRayTracerEngine3DViewClickMaterialEventListener(
id: string,
callFn: (props: { materialId: number; material: any }) => void | Promise<void>,
onlyOnce?: boolean,
): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
Event ID, used to prevent duplicate event registration
</td></tr>
<tr><td>
callFn
</td><td>
(props: { materialId: number; material: any }) => void \| Promise<void>
</td><td>
The callback function triggered when the event fires
</td></tr>
<tr><td>
onlyOnce
</td><td>
boolean
</td><td>
_(Optional)_ Whether to listen only once
</td></tr>
</tbody></table>
## Returns
void
## Remarks
Note: This API is only valid for extensions. Calling it in a standalone script environment will always `throw Error` ADD since EDA v4
## Example
```javascript
const listenerId = '嘉立创示例_3d_material';
// 1. 注册点击材质监听(回调在 3D 预览点击材质时触发,本例不依赖实际触发)
eda.pcb_Event.addRayTracerEngine3DViewClickMaterialEventListener(
listenerId,
(props) => {
console.log('clickMaterial:', JSON.stringify(props));
}
);
// 2. 回读确认注册成功
const registered = eda.pcb_Event.isEventListenerAlreadyExist(listenerId);
console.log('registered:', registered);
// 3. 清理监听
const removed = eda.pcb_Event.removeEventListener(listenerId);
console.log('removed:', removed);
```
### addrealtimedrcresulteventlistener
# PCB\_Event.addRealTimeDrcResultEventListener() method
> 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.
Add a real-time DRC result event listener
## Signature
```typescript
function addRealTimeDrcResultEventListener(
id: string,
eventType: 'all',
callFn: (eventType: undefined, props: [{ drcResult: any }]) => void | Promise<void>,
): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
Event ID, used to prevent duplicate event registration
</td></tr>
<tr><td>
eventType
</td><td>
'all'
</td><td>
Event type
</td></tr>
<tr><td>
callFn
</td><td>
(eventType: undefined, props: \[{ drcResult: any }\]) => void \| Promise<void>
</td><td>
The callback function triggered when the event fires
</td></tr>
</tbody></table>
## Returns
void
## Remarks
Note: This API is only valid for extensions. Calling it in a standalone script environment will always `throw Error`
## Example
```javascript
const listenerId = '嘉立创示例_drc_result';
// 1. 注册实时 DRC 结果监听,eventType 固定为 'all'
eda.pcb_Event.addRealTimeDrcResultEventListener(
listenerId,
'all',
(eventType, props) => {
// 回调在实时 DRC 检出违规时触发;props 是 DRC 结果数组
console.log('drcResult:', JSON.stringify(props));
}
);
// 2. 回读确认注册成功
const registered = eda.pcb_Event.isEventListenerAlreadyExist(listenerId);
console.log('registered:', registered);
// 3. 清理监听
const removed = eda.pcb_Event.removeEventListener(listenerId);
console.log('removed:', removed);
```
### iseventlisteneralreadyexist
# PCB\_Event.isEventListenerAlreadyExist() method
Query whether the event listener exists
## Signature
```typescript
function isEventListenerAlreadyExist(id: string): boolean;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
Event ID
</td></tr>
</tbody></table>
## Returns
boolean
Whether the event listener exists
## Example
```javascript
const listenerId = '嘉立创示例_event_exist';
// 1. 注册前查询:应为 false
const before = eda.pcb_Event.isEventListenerAlreadyExist(listenerId);
console.log('before:', before);
// 2. 注册一个鼠标事件监听使 id 生效
eda.pcb_Event.addMouseEventListener(listenerId, 'all', () => {}, false);
// 3. 注册后查询:应为 true
const after = eda.pcb_Event.isEventListenerAlreadyExist(listenerId);
console.log('after:', after);
// 4. 移除后查询:应回到 false
eda.pcb_Event.removeEventListener(listenerId);
const afterRemove = eda.pcb_Event.isEventListenerAlreadyExist(listenerId);
console.log('afterRemove:', afterRemove);
```
### removeeventlistener
# PCB\_Event.removeEventListener() method
Remove Event listener
## Signature
```typescript
function removeEventListener(id: string): boolean;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
Event ID
</td></tr>
</tbody></table>
## Returns
boolean
Whether Remove Specify event listener
## Example
```javascript
const listenerId = '嘉立创示例_event_remove';
// 1. 先注册一个鼠标事件监听作为移除目标
eda.pcb_Event.addMouseEventListener(listenerId, 'all', () => {}, false);
const registered = eda.pcb_Event.isEventListenerAlreadyExist(listenerId);
console.log('registered:', registered);
// 2. 移除该监听
const removed = eda.pcb_Event.removeEventListener(listenerId);
console.log('removed:', removed);
// 3. 回读确认已不存在
const existAfter = eda.pcb_Event.isEventListenerAlreadyExist(listenerId);
console.log('existAfter:', existAfter);
// 4. 重复移除同一 id:返回 false(本就未注册)
const removedAgain = eda.pcb_Event.removeEventListener(listenerId);
console.log('removedAgain:', removedAgain);
```
references/classes/PCB_Document.md
# PCB\_Document class
PCB & footprint / document operation class
## Signature
```typescript
class PCB_Document
```
## Remarks
Operations performed on the design document as a whole
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[autoLayout()](./PCB_Document.md)
</td><td>
</td><td>
**_(BETA)_** Auto layout
</td></tr>
<tr><td>
[autoRouting(props)](./PCB_Document.md)
</td><td>
</td><td>
**_(BETA)_** Auto routing
</td></tr>
<tr><td>
[clearRouting(type)](./PCB_Document.md)
</td><td>
</td><td>
**_(BETA)_** Clear routing
</td></tr>
<tr><td>
[convertCanvasOriginToDataOrigin(x, y)](./PCB_Document.md)
</td><td>
</td><td>
Input a canvas coordinate and return the data coordinate corresponding to that coordinate
</td></tr>
<tr><td>
[convertDataOriginToCanvasOrigin(x, y)](./PCB_Document.md)
</td><td>
</td><td>
Input a data coordinate and return the canvas coordinate corresponding to that coordinate
</td></tr>
<tr><td>
[getCalculatingRatlineStatus()](./PCB_Document.md)
</td><td>
</td><td>
Get the current ratline calculation function status
</td></tr>
<tr><td>
[getCanvasOrigin()](./PCB_Document.md)
</td><td>
</td><td>
Get the offset coordinate of the canvas origin relative to the data origin
</td></tr>
<tr><td>
[getCanvasUpdateCalculationStatus()](./PCB_Document.md)
</td><td>
</td><td>
**_(BETA)_** 查询当前画布更新计算状态
</td></tr>
<tr><td>
[getCurrentFilterConfiguration()](./PCB_Document.md)
</td><td>
</td><td>
**_(BETA)_** Get Current canvas filter configuration
</td></tr>
<tr><td>
[getPrimitiveAtPoint(x, y)](./PCB_Document.md)
</td><td>
</td><td>
**_(BETA)_** Get The primitive at the coordinate point
</td></tr>
<tr><td>
[getPrimitivesInRegion(left, right, top, bottom, leftToRight)](./PCB_Document.md)
</td><td>
</td><td>
**_(BETA)_** Get All primitives in the region
</td></tr>
<tr><td>
[importAutoLayoutJsonFile(autoLayoutFile)](./PCB_Document.md)
</td><td>
</td><td>
**_(BETA)_** Import auto layout file (JSON)
</td></tr>
<tr><td>
[importAutoRouteJsonFile(autoRouteFile)](./PCB_Document.md)
</td><td>
</td><td>
**_(BETA)_** Import auto routing file (JSON)
</td></tr>
<tr><td>
[importAutoRouteSesFile(autoRouteFile)](./PCB_Document.md)
</td><td>
</td><td>
**_(BETA)_** Import auto routing file (SES)
</td></tr>
<tr><td>
[importChanges(uuid)](./PCB_Document.md)
</td><td>
</td><td>
Import changes from the schematic
</td></tr>
<tr><td>
[navigateToCoordinates(x, y)](./PCB_Document.md)
</td><td>
</td><td>
Locate to canvas coordinate
</td></tr>
<tr><td>
[navigateToRegion(left, right, top, bottom)](./PCB_Document.md)
</td><td>
</td><td>
**_(BETA)_** Locate to canvas region
</td></tr>
<tr><td>
[save()](./PCB_Document.md)
</td><td>
</td><td>
Save Document
</td></tr>
<tr><td>
[setCanvasOrigin(offsetX, offsetY)](./PCB_Document.md)
</td><td>
</td><td>
Set the offset coordinate of the canvas origin relative to the data origin
</td></tr>
<tr><td>
[startCalculatingRatline()](./PCB_Document.md)
</td><td>
</td><td>
Start the ratline calculation function
</td></tr>
<tr><td>
[startCanvasUpdateCalculation()](./PCB_Document.md)
</td><td>
</td><td>
**_(BETA)_** 开始画布更新计算
</td></tr>
<tr><td>
[stopCalculatingRatline()](./PCB_Document.md)
</td><td>
</td><td>
Stop the ratline calculation function
</td></tr>
<tr><td>
[stopCanvasUpdateCalculation()](./PCB_Document.md)
</td><td>
</td><td>
**_(BETA)_** 停止画布更新计算
</td></tr>
<tr><td>
[triggerCanvasUpdateCalculation()](./PCB_Document.md)
</td><td>
</td><td>
**_(BETA)_** 触发一次画布更新计算
</td></tr>
<tr><td>
[zoomToBoardOutline()](./PCB_Document.md)
</td><td>
</td><td>
**_(BETA)_** Zoom to the board outline (fit the board outline)
</td></tr>
</tbody></table>
---
## 方法详情
### autolayout
# PCB\_Document.autoLayout() method
> 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.
Auto layout
## Signature
```typescript
function autoLayout(): Promise<IPCB_AutoLayoutResult>;
```
## Returns
Promise<[IPCB\_AutoLayoutResult](../interfaces/IPCB_AutoLayoutResult.md)<!-- -->>
Auto layout result
## Remarks
ADD since EDA v3.2.150 本接口预期将会执行较长时间,可以尝试异步处理或增加超时时限
/ EDA v4.1.66
### autorouting
# PCB\_Document.autoRouting() method
> 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.
Auto routing
## Signature
```typescript
function autoRouting(props?: IPCB_AutoRoutingProps): Promise<IPCB_AutoRoutingResult>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
props
</td><td>
[IPCB\_AutoRoutingProps](../interfaces/IPCB_AutoRoutingProps.md)
</td><td>
_(Optional)_ Auto routing parameter
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_AutoRoutingResult](../interfaces/IPCB_AutoRoutingResult.md)<!-- -->>
Auto routing result
## Remarks
ADD since EDA v3.2.150 If no parameters are passed in, auto routing will be performed for all unrouted nets
本接口预期将会执行较长时间,可以尝试异步处理或增加超时时限
/ EDA v4.1.66
## Example
```javascript
// 对所有未布线的网络进行自动布线
const result = await eda.pcb_Document.autoRouting();
console.log(`布线完成:${result.routedNets}/${result.totalNets}`);
// 指定网络进行自动布线,并忽略部分网络
const result = await eda.pcb_Document.autoRouting({
nets: ['VCC', 'GND', 'SDA', 'SCL'],
ignoreNets: ['NC'],
cornerStyle: EPCB_AutoRoutingCornerStyle.DEGREE_45,
optimization: EPCB_AutoRoutingOptimization.COMPLETION,
});
```
### clearrouting
# PCB\_Document.clearRouting() method
> 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.
Clear routing
## Signature
```typescript
function clearRouting(type?: 'all' | 'net' | 'connection'): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
type
</td><td>
'all' \| 'net' \| 'connection'
</td><td>
_(Optional)_ Clear type. If you need to specify a clear type, select the specified primitive in advance
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
### convertcanvasorigintodataorigin
# PCB\_Document.convertCanvasOriginToDataOrigin() method
Input a canvas coordinate and return the data coordinate corresponding to that coordinate
## Signature
```typescript
function convertCanvasOriginToDataOrigin(x: number, y: number): Promise<{ x: number; y: number }>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
x
</td><td>
number
</td><td>
</td></tr>
<tr><td>
y
</td><td>
number
</td><td>
</td></tr>
</tbody></table>
## Returns
Promise<{ x: number; y: number }>
Data origin coordinate
## Remarks
The coordinates displayed on the EasyEDA front end are all relative to the canvas origin; the EasyEDA API uses the data origin; when creating a PCB, the default canvas origin equals the data origin
## Example
```javascript
// 1. 创建测试 PCB 并打开(文档级 API 作用于当前激活的 PCB)
const pcbUuid = await eda.dmt_Pcb.createPcb();
await new Promise(r => setTimeout(r, 1500));
await eda.dmt_EditorControl.openDocument(pcbUuid);
await new Promise(r => setTimeout(r, 1000));
// 2. 换算画布坐标 (300, 400)。新建 PCB 画布原点与数据原点重合,换算值不变
const before = await eda.pcb_Document.convertCanvasOriginToDataOrigin(300, 400);
console.log('before:', JSON.stringify(before));
// 3. 设置画布原点偏移后再换算同一坐标,观察映射随之变化
await eda.pcb_Document.setCanvasOrigin(50, 100);
const after = await eda.pcb_Document.convertCanvasOriginToDataOrigin(300, 400);
console.log('after:', JSON.stringify(after));
// 4. 清理测试 PCB(偏移随文档一起删除)
await eda.dmt_Pcb.deletePcb(pcbUuid);
```
### convertdataorigintocanvasorigin
# PCB\_Document.convertDataOriginToCanvasOrigin() method
Input a data coordinate and return the canvas coordinate corresponding to that coordinate
## Signature
```typescript
function convertDataOriginToCanvasOrigin(x: number, y: number): Promise<{ x: number; y: number }>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
x
</td><td>
number
</td><td>
Data origin X
</td></tr>
<tr><td>
y
</td><td>
number
</td><td>
Data origin Y
</td></tr>
</tbody></table>
## Returns
Promise<{ x: number; y: number }>
Canvas origin coordinate
## Remarks
The coordinates displayed on the EasyEDA front end are all relative to the canvas origin; the EasyEDA API uses the data origin; when creating a PCB, the default canvas origin equals the data origin
## Example
```javascript
// 1. 创建测试 PCB 并打开(文档级 API 作用于当前激活的 PCB)
const pcbUuid = await eda.dmt_Pcb.createPcb();
await new Promise(r => setTimeout(r, 1500));
await eda.dmt_EditorControl.openDocument(pcbUuid);
await new Promise(r => setTimeout(r, 1000));
// 2. 换算数据坐标 (300, 400)。新建 PCB 画布原点与数据原点重合,换算值不变
const before = await eda.pcb_Document.convertDataOriginToCanvasOrigin(300, 400);
console.log('before:', JSON.stringify(before));
// 3. 设置画布原点偏移后再换算同一坐标,观察映射随之变化
await eda.pcb_Document.setCanvasOrigin(50, 100);
const after = await eda.pcb_Document.convertDataOriginToCanvasOrigin(300, 400);
console.log('after:', JSON.stringify(after));
// 4. 清理测试 PCB(偏移随文档一起删除)
await eda.dmt_Pcb.deletePcb(pcbUuid);
```
### getcalculatingratlinestatus
# PCB\_Document.getCalculatingRatlineStatus() method
> Warning: This API is now obsolete.
>
> since EDA v4.2
Get the current ratline calculation function status
## Signature
```typescript
function getCalculatingRatlineStatus(): Promise<
EPCB_DocumentRatlineCalculatingActiveStatus | undefined
>;
```
## Returns
Promise<[EPCB\_DocumentRatlineCalculatingActiveStatus](../enums/EPCB_DocumentRatlineCalculatingActiveStatus.md) \| undefined>
Function state
### getcanvasorigin
# PCB\_Document.getCanvasOrigin() method
Get the offset coordinate of the canvas origin relative to the data origin
## Signature
```typescript
function getCanvasOrigin(): Promise<{ offsetX: number; offsetY: number }>;
```
## Returns
Promise<{ offsetX: number; offsetY: number }>
The offset coordinate of the canvas origin relative to the data origin
## Remarks
The coordinates displayed on the EasyEDA Pro front end are all relative to the canvas origin;
The EasyEDA Pro API uses the data origin;
If the returned data is `{ canvasOriginOffsetX: 100, canvasOriginOffsetY: 200 }`<!-- -->, it means the canvas origin is at a position 100 units to the right and 200 units up from the data origin;
The units here are data-level units, which are equivalent to mil on the canvas level in span
### getcanvasupdatecalculationstatus
# PCB\_Document.getCanvasUpdateCalculationStatus() method
> 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.
查询当前画布更新计算状态
## Signature
```typescript
function getCanvasUpdateCalculationStatus(): Promise<
EPCB_DocumentCanvasUpdateCalculationActiveStatus | undefined
>;
```
## Returns
Promise<[EPCB\_DocumentCanvasUpdateCalculationActiveStatus](../enums/EPCB_DocumentCanvasUpdateCalculationActiveStatus.md) \| undefined>
画布更新计算功能状态
## Remarks
画布更新计算包括画布渲染更新、属性面板更新等 ADD since EDA v4.2
### getcurrentfilterconfiguration
# PCB\_Document.getCurrentFilterConfiguration() method
> 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.
Get Current canvas filter configuration
## Signature
```typescript
function getCurrentFilterConfiguration(): Promise<Record<string, any> | undefined>;
```
## Returns
Promise<Record<string, any> \| undefined>
Current canvas filter configuration; `undefined` indicates that the retrieval failed
### getprimitiveatpoint
# PCB\_Document.getPrimitiveAtPoint() method
> 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.
Get The primitive at the coordinate point
## Signature
```typescript
function getPrimitiveAtPoint(x: number, y: number): Promise<IPCB_Primitive | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
x
</td><td>
number
</td><td>
Coordinate point X
</td></tr>
<tr><td>
y
</td><td>
number
</td><td>
Coordinate point Y
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_Primitive](../interfaces/IPCB_Primitive.md) \| undefined>
The primitive at the coordinate point. If no primitive can be found at the coordinate point, `undefined` will be returned
## Remarks
This operation is similar to clicking with the mouse on the front end; it will get the primitive at the specified coordinate point
## Example
```javascript
// 1. 创建测试 PCB 并打开
const pcbUuid = await eda.dmt_Pcb.createPcb();
await new Promise(r => setTimeout(r, 1500));
await eda.dmt_EditorControl.openDocument(pcbUuid);
await new Promise(r => setTimeout(r, 1000));
// 2. 在 (500, 500) 放一个测试焊盘作为拾取目标
const pad = await eda.pcb_PrimitivePad.create(1, '1', 500, 500, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
const padId = pad.getState_PrimitiveId();
// 3. 拾取焊盘中心点,返回该焊盘图元
const hit = await eda.pcb_Document.getPrimitiveAtPoint(500, 500);
console.log('hitPrimitiveId:', hit.getState_PrimitiveId());
// 4. 拾取空白坐标点,返回 undefined
const miss = await eda.pcb_Document.getPrimitiveAtPoint(90000, 90000);
console.log('空白坐标点:', miss === undefined ? '未找到图元' : '找到图元');
// 5. 清理测试图元和测试 PCB
await eda.pcb_PrimitivePad.delete([padId]);
await eda.dmt_Pcb.deletePcb(pcbUuid);
```
### getprimitivesinregion
# PCB\_Document.getPrimitivesInRegion() method
> 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.
Get All primitives in the region
## Signature
```typescript
function getPrimitivesInRegion(
left: number,
right: number,
top: number,
bottom: number,
leftToRight?: boolean,
): Promise<Array<IPCB_Primitive>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
left
</td><td>
number
</td><td>
First X coordinate of the rectangle
</td></tr>
<tr><td>
right
</td><td>
number
</td><td>
Second X coordinate of the rectangle
</td></tr>
<tr><td>
top
</td><td>
number
</td><td>
First Y coordinate of the rectangle
</td></tr>
<tr><td>
bottom
</td><td>
number
</td><td>
Second Y coordinate of the rectangle
</td></tr>
<tr><td>
leftToRight
</td><td>
boolean
</td><td>
_(Optional)_ Whether to only get primitives that are fully enclosed by the box selection. If `false`<!-- -->, primitives touched by the selection are also obtained
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_Primitive](../interfaces/IPCB_Primitive.md)<!-- -->>>
All primitives in the region
## Example
```javascript
// 1. 创建测试 PCB 并打开
const pcbUuid = await eda.dmt_Pcb.createPcb();
await new Promise(r => setTimeout(r, 1500));
await eda.dmt_EditorControl.openDocument(pcbUuid);
await new Promise(r => setTimeout(r, 1000));
// 2. 放两个测试焊盘:一个在 (500, 500),一个在 (3000, 3000)
const padA = await eda.pcb_PrimitivePad.create(1, '1', 500, 500, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
const padB = await eda.pcb_PrimitivePad.create(1, '2', 3000, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
// 3. 小区域 (0,1000,1000,0) 只盖住第一个焊盘
const small = await eda.pcb_Document.getPrimitivesInRegion(0, 1000, 1000, 0);
console.log('smallRegionCount:', small.length);
// 4. 大区域 (0,4000,4000,0) 盖住两个焊盘,完全框选模式
const big = await eda.pcb_Document.getPrimitivesInRegion(0, 4000, 4000, 0, true);
console.log('bigRegionCount:', big.length);
// 5. 清理测试图元和测试 PCB
await eda.pcb_PrimitivePad.delete([padA.getState_PrimitiveId(), padB.getState_PrimitiveId()]);
await eda.dmt_Pcb.deletePcb(pcbUuid);
```
### importautolayoutjsonfile
# PCB\_Document.importAutoLayoutJsonFile() method
> 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.
Import auto layout file (JSON)
## Signature
```typescript
function importAutoLayoutJsonFile(autoLayoutFile: File): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
autoLayoutFile
</td><td>
File
</td><td>
The JSON file to import
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the import operation is successful
## Remarks
You can use to read in a file
## Example
```javascript
// 1. 创建测试 PCB 并打开(导入作用于当前激活的 PCB)
const pcbUuid = await eda.dmt_Pcb.createPcb();
await new Promise(r => setTimeout(r, 1500));
await eda.dmt_EditorControl.openDocument(pcbUuid);
await new Promise(r => setTimeout(r, 1000));
// 2. 构造布局 JSON 文件对象(真实场景:readFileFromFileSystem 读取外部导出的文件)
const layoutFile = new File([JSON.stringify({})], 'auto-layout.json', { type: 'application/json' });
// 3. 导入自动布局文件
const imported = await eda.pcb_Document.importAutoLayoutJsonFile(layoutFile);
console.log('imported:', imported);
// 4. 清理测试 PCB
await eda.dmt_Pcb.deletePcb(pcbUuid);
```
### importautoroutejsonfile
# PCB\_Document.importAutoRouteJsonFile() method
> 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.
Import auto routing file (JSON)
## Signature
```typescript
function importAutoRouteJsonFile(autoRouteFile: File): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
autoRouteFile
</td><td>
File
</td><td>
The JSON file to import
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the import operation is successful
## Remarks
You can use to read in a file
## Example
```javascript
// 1. 创建测试 PCB 并打开(导入作用于当前激活的 PCB)
const pcbUuid = await eda.dmt_Pcb.createPcb();
await new Promise(r => setTimeout(r, 1500));
await eda.dmt_EditorControl.openDocument(pcbUuid);
await new Promise(r => setTimeout(r, 1000));
// 2. 构造布线 JSON 文件对象(真实场景:readFileFromFileSystem 读取外部导出的文件)
const routeFile = new File([JSON.stringify({})], 'auto-route.json', { type: 'application/json' });
// 3. 导入自动布线文件
const imported = await eda.pcb_Document.importAutoRouteJsonFile(routeFile);
console.log('imported:', imported);
// 4. 清理测试 PCB
await eda.dmt_Pcb.deletePcb(pcbUuid);
```
### importautoroutesesfile
# PCB\_Document.importAutoRouteSesFile() method
> 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.
Import auto routing file (SES)
## Signature
```typescript
function importAutoRouteSesFile(autoRouteFile: File): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
autoRouteFile
</td><td>
File
</td><td>
The SES file to import
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the import operation is successful
## Remarks
You can use to read in a file
### importchanges
# PCB\_Document.importChanges() method
Import changes from the schematic
## Signature
```typescript
function importChanges(uuid?: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
uuid
</td><td>
string
</td><td>
_(Optional)_ Schematic UUID. By default, the schematic associated with the same Board is used
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the import operation was successful. If the import fails or the free PCB has no schematic UUID passed in, `false` is returned
## Example
```javascript
// 1. 创建测试原理图和测试 PCB
const schUuid = await eda.dmt_Schematic.createSchematic();
await new Promise(r => setTimeout(r, 1500));
const pcbUuid = await eda.dmt_Pcb.createPcb();
await new Promise(r => setTimeout(r, 1500));
// 2. 创建板子把原理图与 PCB 关联起来(返回板子名称)
const boardName = await eda.dmt_Board.createBoard(schUuid, pcbUuid);
await new Promise(r => setTimeout(r, 1500));
console.log('boardName:', boardName);
// 3. 打开 PCB 并从关联原理图导入变更
await eda.dmt_EditorControl.openDocument(pcbUuid);
await new Promise(r => setTimeout(r, 1000));
const imported = await eda.pcb_Document.importChanges();
console.log('imported:', imported);
// 4. 清理:删板子、删 PCB、删原理图
await eda.dmt_Board.deleteBoard(boardName);
await new Promise(r => setTimeout(r, 1000));
await eda.dmt_Pcb.deletePcb(pcbUuid);
await eda.dmt_Schematic.deleteSchematic(schUuid);
```
### navigatetocoordinates
# PCB\_Document.navigateToCoordinates() method
Locate to canvas coordinate
## Signature
```typescript
function navigateToCoordinates(x: number, y: number): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
x
</td><td>
number
</td><td>
X coordinate
</td></tr>
<tr><td>
y
</td><td>
number
</td><td>
Y coordinate
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
This API positions on the front-end canvas to the specified data-level coordinate;
If you want the front-end canvas coordinate to be consistent with the passed-in data during this operation, it is recommended to call the [PCB\_Document.setCanvasOrigin()](./PCB_Document.md) method and set the offset to zero;
The units here are data-level units, which are equivalent to mil on the canvas level in span
## Example
```javascript
// 1. 创建测试 PCB 并打开(视口操作作用于当前激活的 PCB)
const pcbUuid = await eda.dmt_Pcb.createPcb();
await new Promise(r => setTimeout(r, 1500));
await eda.dmt_EditorControl.openDocument(pcbUuid);
await new Promise(r => setTimeout(r, 1000));
// 2. 定位到数据坐标 (1000, 800)
const navigated = await eda.pcb_Document.navigateToCoordinates(1000, 800);
console.log('navigated:', navigated);
// 3. 清理测试 PCB
await eda.dmt_Pcb.deletePcb(pcbUuid);
```
### navigatetoregion
# PCB\_Document.navigateToRegion() method
> 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.
Locate to canvas region
## Signature
```typescript
function navigateToRegion(
left: number,
right: number,
top: number,
bottom: number,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
left
</td><td>
number
</td><td>
First X coordinate of the rectangle
</td></tr>
<tr><td>
right
</td><td>
number
</td><td>
Second X coordinate of the rectangle
</td></tr>
<tr><td>
top
</td><td>
number
</td><td>
First Y coordinate of the rectangle
</td></tr>
<tr><td>
bottom
</td><td>
number
</td><td>
Second Y coordinate of the rectangle
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
This API positions on the front-end canvas to the specified region. The region data is an offset relative to the data origin;
For example: the passed-in data is `{left: 0, right: 60, top: 100, bottom: -20}` =<!-- -->> `navigateToRegion(0, 60, 100, -20)`<!-- -->, then the canvas will be positioned to a rectangular range centered at `[30, 40]` with a length of `60` in the x-axis direction and `120` in the y-axis direction;
This API does not perform zooming, but it will generate a rectangle frame indicating the positioning center and the region range;
The units here are data-level units, which are equivalent to mil on the canvas level in span
## Example
```javascript
// 1. 创建测试 PCB 并打开(视口操作作用于当前激活的 PCB)
const pcbUuid = await eda.dmt_Pcb.createPcb();
await new Promise(r => setTimeout(r, 1500));
await eda.dmt_EditorControl.openDocument(pcbUuid);
await new Promise(r => setTimeout(r, 1000));
// 2. 定位到矩形区域:X 从 0 到 2000,Y 从 2000 到 0(视口将以中心 (1000,1000) 呈现)
const navigated = await eda.pcb_Document.navigateToRegion(0, 2000, 2000, 0);
console.log('navigated:', navigated);
// 3. 清理测试 PCB
await eda.dmt_Pcb.deletePcb(pcbUuid);
```
### save
# PCB\_Document.save() method
Save Document
## Signature
```typescript
function save(): Promise<boolean>;
```
## Returns
Promise<boolean>
Whether the save operation was successful. Errors such as save failure and upload failure all return `false`
## Example
```javascript
// 1. 创建测试 PCB 并打开(保存作用于当前激活的 PCB)
const pcbUuid = await eda.dmt_Pcb.createPcb();
await new Promise(r => setTimeout(r, 1500));
await eda.dmt_EditorControl.openDocument(pcbUuid);
await new Promise(r => setTimeout(r, 1000));
// 2. 保存当前 PCB
const saved = await eda.pcb_Document.save();
console.log('saved:', saved);
// 3. 清理测试 PCB
await eda.dmt_Pcb.deletePcb(pcbUuid);
```
### setcanvasorigin
# PCB\_Document.setCanvasOrigin() method
Set the offset coordinate of the canvas origin relative to the data origin
## Signature
```typescript
function setCanvasOrigin(offsetX: number, offsetY: number): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
offsetX
</td><td>
number
</td><td>
X coordinate offset of the canvas origin relative to the data origin
</td></tr>
<tr><td>
offsetY
</td><td>
number
</td><td>
Y coordinate offset of the canvas origin relative to the data origin
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
The coordinates displayed on the EasyEDA Pro front end are all relative to the canvas origin;
The EasyEDA Pro API uses the data origin;
If you want the front-end canvas coordinate to be consistent with the data during API operations, it is recommended to call this method and set the offset to zero, i.e. `setCanvasOrigin(0, 0)`<!-- -->;
The units here are data-level units, which are equivalent to mil on the canvas level in span
## Example
```javascript
// 1. 创建测试 PCB 并打开(原点设置作用于当前激活的 PCB)
const pcbUuid = await eda.dmt_Pcb.createPcb();
await new Promise(r => setTimeout(r, 1500));
await eda.dmt_EditorControl.openDocument(pcbUuid);
await new Promise(r => setTimeout(r, 1000));
// 2. 设置画布原点偏移为 (50, 100)
const set = await eda.pcb_Document.setCanvasOrigin(50, 100);
console.log('set:', set);
// 3. 读回偏移验证已生效
const origin = await eda.pcb_Document.getCanvasOrigin();
console.log('origin:', JSON.stringify(origin));
// 4. 清理测试 PCB(偏移随文档一起删除)
await eda.dmt_Pcb.deletePcb(pcbUuid);
```
### startcalculatingratline
# PCB\_Document.startCalculatingRatline() method
> Warning: This API is now obsolete.
>
> since EDA v4.2
Start the ratline calculation function
## Signature
```typescript
function startCalculatingRatline(): Promise<boolean>;
```
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
A ratline calculation will be triggered when starting
## Example
```javascript
// 1. 创建测试 PCB 并打开(飞线开关作用于当前激活的 PCB)
const pcbUuid = await eda.dmt_Pcb.createPcb();
await new Promise(r => setTimeout(r, 1500));
await eda.dmt_EditorControl.openDocument(pcbUuid);
await new Promise(r => setTimeout(r, 1000));
// 2. 启动飞线计算
const started = await eda.pcb_Document.startCalculatingRatline();
console.log('started:', started);
// 3. 清理测试 PCB
await eda.dmt_Pcb.deletePcb(pcbUuid);
```
### startcanvasupdatecalculation
# PCB\_Document.startCanvasUpdateCalculation() method
> 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.
开始画布更新计算
## Signature
```typescript
function startCanvasUpdateCalculation(): Promise<boolean>;
```
## Returns
Promise<boolean>
操作是否成功
## Remarks
画布更新计算包括画布渲染更新、属性面板更新等
如若不理解该开关的含义,请勿调用本接口进行任何操作 ADD since EDA v4.2
### stopcalculatingratline
# PCB\_Document.stopCalculatingRatline() method
> Warning: This API is now obsolete.
>
> since EDA v4.2
Stop the ratline calculation function
## Signature
```typescript
function stopCalculatingRatline(): Promise<boolean>;
```
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 创建测试 PCB 并打开(飞线开关作用于当前激活的 PCB)
const pcbUuid = await eda.dmt_Pcb.createPcb();
await new Promise(r => setTimeout(r, 1500));
await eda.dmt_EditorControl.openDocument(pcbUuid);
await new Promise(r => setTimeout(r, 1000));
// 2. 停止飞线计算
const stopped = await eda.pcb_Document.stopCalculatingRatline();
console.log('stopped:', stopped);
// 3. 清理测试 PCB
await eda.dmt_Pcb.deletePcb(pcbUuid);
```
### stopcanvasupdatecalculation
# PCB\_Document.stopCanvasUpdateCalculation() method
> 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.
停止画布更新计算
## Signature
```typescript
function stopCanvasUpdateCalculation(): Promise<boolean>;
```
## Returns
Promise<boolean>
操作是否成功
## Remarks
画布更新计算包括画布渲染更新、属性面板更新等
如若不理解该开关的含义,请勿调用本接口进行任何操作 ADD since EDA v4.2
### triggercanvasupdatecalculation
# PCB\_Document.triggerCanvasUpdateCalculation() method
> 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.
触发一次画布更新计算
## Signature
```typescript
function triggerCanvasUpdateCalculation(): Promise<boolean>;
```
## Returns
Promise<boolean>
操作是否成功
## Remarks
画布更新计算包括画布渲染更新、属性面板更新等
如若不理解该开关的含义,请勿调用本接口进行任何操作 ADD since EDA v4.2
### zoomtoboardoutline
# PCB\_Document.zoomToBoardOutline() method
> 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.
Zoom to the board outline (fit the board outline)
## Signature
```typescript
function zoomToBoardOutline(): Promise<boolean>;
```
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 创建测试 PCB 并打开(视口操作作用于当前激活的 PCB)
const pcbUuid = await eda.dmt_Pcb.createPcb();
await new Promise(r => setTimeout(r, 1500));
await eda.dmt_EditorControl.openDocument(pcbUuid);
await new Promise(r => setTimeout(r, 1000));
// 2. 缩放到板框
const zoomed = await eda.pcb_Document.zoomToBoardOutline();
console.log('zoomed:', zoomed);
// 3. 清理测试 PCB
await eda.dmt_Pcb.deletePcb(pcbUuid);
```
references/classes/LIB_Symbol.md
# LIB\_Symbol class
Comprehensive library / symbol class
## Signature
```typescript
class LIB_Symbol
```
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[copy(symbolUuid, libraryUuid, targetLibraryUuid, targetClassification, newSymbolName)](./LIB_Symbol.md)
</td><td>
</td><td>
**_(BETA)_** Copy Symbol
</td></tr>
<tr><td>
[create(libraryUuid, symbolName, classification, symbolType, description, otherProperty)](./LIB_Symbol.md)
</td><td>
</td><td>
**_(BETA)_** Create Symbol
</td></tr>
<tr><td>
[delete(symbolUuid, libraryUuid)](./LIB_Symbol.md)
</td><td>
</td><td>
**_(BETA)_** Delete Symbol
</td></tr>
<tr><td>
[get(symbolUuid, libraryUuid)](./LIB_Symbol.md)
</td><td>
</td><td>
**_(BETA)_** Get all properties of the symbol
</td></tr>
<tr><td>
[getDocumentSource(symbolUuid, libraryUuid)](./LIB_Symbol.md)
</td><td>
</td><td>
**_(BETA)_** 获取符号的文档源码
</td></tr>
<tr><td>
[getRenderImage(source)](./LIB_Symbol.md)
</td><td>
</td><td>
**_(BETA)_** Get the symbol render image
</td></tr>
<tr><td>
[modify(symbolUuid, libraryUuid, symbolName, classification, description, otherProperty)](./LIB_Symbol.md)
</td><td>
</td><td>
**_(BETA)_** Modify Symbol
</td></tr>
<tr><td>
[openInEditor(symbolUuid, libraryUuid, splitScreenId)](./LIB_Symbol.md)
</td><td>
</td><td>
**_(BETA)_** Open in the editor document
</td></tr>
<tr><td>
[search(key, libraryUuid, classification, symbolType, itemsOfPage, page)](./LIB_Symbol.md)
</td><td>
</td><td>
**_(BETA)_** Search symbol
</td></tr>
<tr><td>
[searchByProperties(properties, libraryUuid)](./LIB_Symbol.md)
</td><td>
</td><td>
**_(BETA)_** Search symbols precisely by properties
</td></tr>
<tr><td>
[updateDocumentSource(symbolUuid, libraryUuid, documentSource)](./LIB_Symbol.md)
</td><td>
</td><td>
**_(BETA)_** Update the document source code of the symbol
</td></tr>
</tbody></table>
---
## 方法详情
### copy
# LIB\_Symbol.copy() method
> 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.
Copy Symbol
## Signature
```typescript
function copy(
symbolUuid: string,
libraryUuid: string,
targetLibraryUuid: string,
targetClassification?: ILIB_ClassificationIndex | Array<string>,
newSymbolName?: string,
): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
symbolUuid
</td><td>
string
</td><td>
Symbol UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
targetLibraryUuid
</td><td>
string
</td><td>
Target library UUID
</td></tr>
<tr><td>
targetClassification
</td><td>
[ILIB\_ClassificationIndex](../interfaces/ILIB_ClassificationIndex.md) \| Array<string>
</td><td>
_(Optional)_ Classification in the target library
</td></tr>
<tr><td>
newSymbolName
</td><td>
string
</td><td>
_(Optional)_ New symbol name. If a symbol with the same name exists in the target library, the copy will fail
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
UUID of the new symbol in the target library
## Example
```javascript
// 1. 列出系统库符号(关键字传空 = 列出全部),取一个作为复制来源
const [source] = await eda.lib_Symbol.search('', undefined, [], undefined, 1, 1);
// 2. 获取个人库 UUID
const targetLibraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
// 3. 从系统库复制到个人库,指定新名称避免同名冲突(分类传 [] = 不分类)
const newName = `嘉立创示例_符号副本_${Date.now()}`;
const copiedUuid = await eda.lib_Symbol.copy(
source.uuid,
source.libraryUuid,
targetLibraryUuid,
[],
newName
);
// 创建类保留现场(副本留在个人库中供观察)
console.log('sourceUuid:', source.uuid);
console.log('copiedUuid:', copiedUuid);
console.log('newName:', newName);
```
### create
# LIB\_Symbol.create() method
> 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.
Create Symbol
## Signature
```typescript
function create(
libraryUuid: string,
symbolName: string,
classification?: ILIB_ClassificationIndex | Array<string>,
symbolType?: ELIB_SymbolType,
description?: string,
otherProperty?: Record<string, boolean | number | string | undefined>,
): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
symbolName
</td><td>
string
</td><td>
Symbol name
</td></tr>
<tr><td>
classification
</td><td>
[ILIB\_ClassificationIndex](../interfaces/ILIB_ClassificationIndex.md) \| Array<string>
</td><td>
_(Optional)_ Classification
</td></tr>
<tr><td>
symbolType
</td><td>
[ELIB\_SymbolType](../enums/ELIB_SymbolType.md)
</td><td>
_(Optional)_ Symbol type
</td></tr>
<tr><td>
description
</td><td>
string
</td><td>
_(Optional)_ Description
</td></tr>
<tr><td>
otherProperty
</td><td>
Record<string, boolean \| number \| string \| undefined>
</td><td>
_(Optional)_ 其它属性
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
Symbol UUID
## Example
```javascript
// 1. 获取个人库 UUID
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
// 2. 创建符号(分类传 [] = 不分类;符号类型 '1' = 原理图符号,见 ELIB_SymbolType)
const symbolName = `嘉立创示例_新符号_${Date.now()}`;
const symbolUuid = await eda.lib_Symbol.create(libraryUuid, symbolName, [], '1', '示例符号描述');
// 创建类保留现场(新符号留在个人库中供观察)
console.log('symbolUuid:', symbolUuid);
console.log('symbolName:', symbolName);
```
### delete
# LIB\_Symbol.delete() method
> 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.
Delete Symbol
## Signature
```typescript
function delete(symbolUuid: string, libraryUuid: string): Promise<boolean | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
symbolUuid
</td><td>
string
</td><td>
Symbol UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
</tbody></table>
## Returns
Promise<boolean \| undefined>
Whether the operation is successful
## Example
```javascript
// 1. 获取个人库 UUID 并新建删除对象
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const symbolUuid = await eda.lib_Symbol.create(libraryUuid, `嘉立创示例_待删除符号_${Date.now()}`, []);
// 2. 删除该符号
const deleted = await eda.lib_Symbol.delete(symbolUuid, libraryUuid);
console.log('symbolUuid:', symbolUuid);
console.log('deleted:', deleted);
```
### get
# LIB\_Symbol.get() method
> 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.
Get all properties of the symbol
## Signature
```typescript
function get(symbolUuid: string, libraryUuid?: string): Promise<ILIB_SymbolItem | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
symbolUuid
</td><td>
string
</td><td>
Symbol UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
_(Optional)_ Library UUID, default is system library, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
</tbody></table>
## Returns
Promise<[ILIB\_SymbolItem](../interfaces/ILIB_SymbolItem.md) \| undefined>
Symbol property
### getdocumentsource
# LIB\_Symbol.getDocumentSource() method
> 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.
获取符号的文档源码
## Signature
```typescript
function getDocumentSource(symbolUuid: string, libraryUuid?: string): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
symbolUuid
</td><td>
string
</td><td>
符号 UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
_(Optional)_ 库 UUID,默认为系统库,可以使用 [LIB\_LibrariesList](./LIB_LibrariesList.md) 内的接口获取
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
符号的 3.0 文档源码(esym JSON 字符串),获取失败返回 `undefined`
## Remarks
与 [LIB\_Symbol.updateDocumentSource()](./LIB_Symbol.md) 对称的读取接口;返回 \*\*3.0 格式\*\*(esym)的符号源数据, 可直接用于组装原理图源数据(如 AI 生成 eprj3 工程)。
支持工程库 / 非工程库(系统库 / 个人库 / 扩展库): - 工程库:从当前打开的工程 worker 读取(含未保存内容); - 非工程库:从 lib.worker 读取(含未保存内容),worker 无缓存时回退网络获取, 自动处理 `history_uuid`<!-- -->(历史版本)、`dataStrId`<!-- -->(远程存储)与 2.0 → 3.0 格式转换。
获取失败(如库条目不存在)将返回 `undefined`
### getrenderimage
# LIB\_Symbol.getRenderImage() method
> 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.
Get the symbol render image
## Signature
```typescript
function getRenderImage(source: {
symbolUuid: string;
libraryUuid: string;
subPartName?: string;
}): Promise<Blob | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
source
</td><td>
\{ symbolUuid: string; libraryUuid: string; subPartName?: string \}
</td><td>
</td></tr>
</tbody></table>
## Returns
Promise<Blob \| undefined>
Symbol render image
## Example
```javascript
// 1. 列出系统库符号,取一个作为渲染来源
const [source] = await eda.lib_Symbol.search('', undefined, [], undefined, 1, 1);
// 2. 获取渲染图(PNG Blob)
const blob = await eda.lib_Symbol.getRenderImage({
symbolUuid: source.uuid,
libraryUuid: source.libraryUuid,
});
// 3. Blob 可转成 URL 直接展示:URL.createObjectURL(blob)
console.log('sourceName:', source.name);
console.log('imageSize:', blob.size);
console.log('imageType:', blob.type);
```
### modify
# LIB\_Symbol.modify() method
> 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.
Modify Symbol
## Signature
```typescript
function modify(
symbolUuid: string,
libraryUuid: string,
symbolName?: string,
classification?: ILIB_ClassificationIndex | Array<string> | null,
description?: string | null,
otherProperty?: Record<string, boolean | number | string | undefined | null>,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
symbolUuid
</td><td>
string
</td><td>
Symbol UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
symbolName
</td><td>
string
</td><td>
_(Optional)_ Symbol name
</td></tr>
<tr><td>
classification
</td><td>
[ILIB\_ClassificationIndex](../interfaces/ILIB_ClassificationIndex.md) \| Array<string> \| null
</td><td>
_(Optional)_ Classification
</td></tr>
<tr><td>
description
</td><td>
string \| null
</td><td>
_(Optional)_ Description
</td></tr>
<tr><td>
otherProperty
</td><td>
Record<string, boolean \| number \| string \| undefined \| null>
</td><td>
_(Optional)_ 其它属性,如希望清除某些属性,则将其的值设置为 `null`
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
If you want to clear certain properties, set their values to `null`
## Example
```javascript
// 1. 获取个人库 UUID 并新建修改对象
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const symbolUuid = await eda.lib_Symbol.create(
libraryUuid,
`嘉立创示例_符号修改前_${Date.now()}`,
[],
'1',
'修改前的描述'
);
// 2. 修改名称和描述(分类保持不变传 [])
const newName = `嘉立创示例_符号修改后_${Date.now()}`;
const modified = await eda.lib_Symbol.modify(symbolUuid, libraryUuid, newName, [], '修改后的描述');
// 修改类保留现场
console.log('symbolUuid:', symbolUuid);
console.log('modified:', modified);
console.log('newName:', newName);
```
### openineditor
# LIB\_Symbol.openInEditor() method
> 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.
Open in the editor document
## Signature
```typescript
function openInEditor(
symbolUuid: string,
libraryUuid: string,
splitScreenId?: string,
): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
symbolUuid
</td><td>
string
</td><td>
Symbol UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
splitScreenId
</td><td>
string
</td><td>
_(Optional)_ Split screen ID. If not filled in, it opens in the split screen with the last input focus by default. It can be obtained using the APIs in [DMT\_EditorControl](./DMT_EditorControl.md)
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
Tab ID, corresponding to [IDMT\_EditorTabItem.tabId](../interfaces/IDMT_EditorTabItem.md)<!-- -->. You can use [DMT\_EditorControl.getSplitScreenIdByTabId()](./DMT_EditorControl.md) to get the split screen ID
## Example
```javascript
// 1. 获取个人库 UUID,从系统库复制一个符号作为编辑对象
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const [source] = await eda.lib_Symbol.search('', undefined, [], undefined, 1, 1);
const symbolUuid = await eda.lib_Symbol.copy(
source.uuid,
source.libraryUuid,
libraryUuid,
[],
`嘉立创示例_编辑符号_${Date.now()}`
);
// 2. 在编辑器中打开该符号,返回标签页 ID(uuid@libraryUuid 格式)
const tabId = await eda.lib_Symbol.openInEditor(symbolUuid, libraryUuid);
// 打开后保留现场(编辑器停留在新符号页供观察;不需要时可传 tabId 给
// dmt_EditorControl.closeDocument 关闭)
console.log('symbolUuid:', symbolUuid);
console.log('tabId:', tabId);
```
### search
# LIB\_Symbol.search() method
> 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.
Search symbol
## Signature
```typescript
function search(
key: string,
libraryUuid?: string,
classification?: ILIB_ClassificationIndex | Array<string>,
symbolType?: ELIB_SymbolType,
itemsOfPage?: number,
page?: number,
): Promise<Array<ILIB_SymbolSearchItem>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
key
</td><td>
string
</td><td>
Search keyword
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
_(Optional)_ Library UUID, default is system library, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
classification
</td><td>
[ILIB\_ClassificationIndex](../interfaces/ILIB_ClassificationIndex.md) \| Array<string>
</td><td>
_(Optional)_ Classification, defaults to all
</td></tr>
<tr><td>
symbolType
</td><td>
[ELIB\_SymbolType](../enums/ELIB_SymbolType.md)
</td><td>
_(Optional)_ Symbol type, defaults to all
</td></tr>
<tr><td>
itemsOfPage
</td><td>
number
</td><td>
_(Optional)_ Number of search results per page
</td></tr>
<tr><td>
page
</td><td>
number
</td><td>
_(Optional)_ Page count
</td></tr>
</tbody></table>
## Returns
Promise<Array<[ILIB\_SymbolSearchItem](../interfaces/ILIB_SymbolSearchItem.md)<!-- -->>>
List of searched symbol properties
## Example
```javascript
// 1. 尝试按关键字搜索(当前版本非空关键字会抛错,如实展示)
try {
const keywordResults = await eda.lib_Symbol.search('0402');
console.log('关键字搜索返回', keywordResults.length, '条');
}
catch (e) {
// 剥掉错误类型前缀;注意:正则写法尾部会产生星号+斜杠序列,会闭掉 tsdoc 注释,故用 split
console.log('关键字搜索当前版本抛错:', String(e.message).split('Error: ').pop());
}
// 2. 改用空关键字列出系统库符号,每页 5 条
const results = await eda.lib_Symbol.search('', undefined, [], undefined, 5, 1);
// 3. 输出搜索结果(需要过滤时可按 item.name 自行筛选)
console.log('count:', results.length);
results.forEach((item, i) => {
console.log(`[${i}] name:`, item.name, 'uuid:', item.uuid, 'libraryUuid:', item.libraryUuid);
});
```
### searchbyproperties
# LIB\_Symbol.searchByProperties() method
> 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.
Search symbols precisely by properties
## Signature
```typescript
function searchByProperties(
properties: ILIB_SymbolPropertiesForSearch,
libraryUuid?: string,
): Promise<Array<ILIB_SymbolSearchItem>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
properties
</td><td>
[ILIB\_SymbolPropertiesForSearch](../interfaces/ILIB_SymbolPropertiesForSearch.md)
</td><td>
Property
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
_(Optional)_ Library UUID, default is system library, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
</tbody></table>
## Returns
Promise<Array<[ILIB\_SymbolSearchItem](../interfaces/ILIB_SymbolSearchItem.md)<!-- -->>>
List of searched symbol properties
## Example
```javascript
// 1. 按名称精确搜索(官方属性集合目前仅支持 name)
// 当前版本该接口不稳定:可能抛错,也可能正常返回 undefined,两种都要兼容
let results;
try {
results = await eda.lib_Symbol.searchByProperties({ name: '0402' });
}
catch (e) {
console.log('当前版本按 name 搜索抛错:', e.message);
}
if (!Array.isArray(results))
results = [];
// 2. 输出搜索结果
console.log('count:', results.length);
results.forEach((item, i) => {
console.log(`[${i}] name:`, item.name, 'uuid:', item.uuid, 'libraryUuid:', item.libraryUuid);
});
```
### updatedocumentsource
# LIB\_Symbol.updateDocumentSource() method
> 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.
Update the document source code of the symbol
## Signature
```typescript
function updateDocumentSource(
symbolUuid: string,
libraryUuid: string,
documentSource: string,
): Promise<boolean | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
symbolUuid
</td><td>
string
</td><td>
Symbol UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
Library UUID, you can use [LIB\_LibrariesList](./LIB_LibrariesList.md) APIs in
</td></tr>
<tr><td>
documentSource
</td><td>
string
</td><td>
Document source code
</td></tr>
</tbody></table>
## Returns
Promise<boolean \| undefined>
Whether the update is successful
## Example
```javascript
// 1. 获取个人库 UUID,从系统库复制一个符号(有内容,源码链路才完整)
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const [source] = await eda.lib_Symbol.search('', undefined, [], undefined, 1, 1);
const symbolUuid = await eda.lib_Symbol.copy(
source.uuid,
source.libraryUuid,
libraryUuid,
[],
`嘉立创示例_源码符号_${Date.now()}`
);
// 2. 在编辑器中打开符号,等待文档加载完成
const tabId = await eda.lib_Symbol.openInEditor(symbolUuid, libraryUuid);
await new Promise(r => setTimeout(r, 1500));
// 3. 读取当前打开符号的文档源码
const documentSource = await eda.sys_FileManager.getDocumentSource();
// 4. 把源码写回库中的符号(此处原样写回;实际使用时可先改写 documentSource)
const updated = await eda.lib_Symbol.updateDocumentSource(symbolUuid, libraryUuid, documentSource);
// 5. 关闭编辑器标签页(符号本体保留在库中)
await eda.dmt_EditorControl.closeDocument(tabId);
// 修改类保留现场
console.log('symbolUuid:', symbolUuid);
console.log('sourceLength:', documentSource.length);
console.log('updated:', updated);
```
references/classes/PCB_ImageTool.md
# PCB\_ImageTool class
PCB 图片工具类
## Signature
```typescript
class PCB_ImageTool
```
## Remarks
ADD since EDA v5
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[processImage(file, options)](./PCB_ImageTool.md)
</td><td>
</td><td>
**_(BETA)_** 选图处理门面(弹窗内重选图片:校验/压缩/读尺寸/预览 dataURL 全由服务端完成)
</td></tr>
<tr><td>
[runInsertImageCommand()](./PCB_ImageTool.md)
</td><td>
</td><td>
**_(BETA)_** 运行系统插入图片命令(扩展快捷键桥接)
</td></tr>
<tr><td>
[startPlaceTrueColorPicture(options)](./PCB_ImageTool.md)
</td><td>
</td><td>
**_(BETA)_** 开始放置真彩图片(权限校验 → 图片审核 → 内核上传 → 模板注册 → 触发放置)
</td></tr>
<tr><td>
[startPlaceVectorImage(options)](./PCB_ImageTool.md)
</td><td>
</td><td>
**_(BETA)_** 开始放置矢量图片(将描摹好的路径交给内核,触发十字光标放置)
</td></tr>
</tbody></table>
---
## 方法详情
### processimage
# PCB\_ImageTool.processImage() method
> 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.
> Warning: This API is now obsolete.
>
> 临时接口(插入图片 PCB 迁移打通流程用):等统一放置接口重构落地后删除替换,请尽快迁移,勿在新功能中继续依赖
选图处理门面(弹窗内重选图片:校验/压缩/读尺寸/预览 dataURL 全由服务端完成)
## Signature
```typescript
function processImage(
file: File,
options?: { maxBytes?: number; acceptableBytes?: number },
): Promise<{
file: File;
dataURL: string;
width: number;
height: number;
actualFormat: string;
msg: string;
}>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
file
</td><td>
File
</td><td>
弹窗内重选 `openReadFileDialog` 返回的 File
</td></tr>
<tr><td>
options
</td><td>
\{ maxBytes?: number; acceptableBytes?: number \}
</td><td>
_(Optional)_ .acceptableBytes - 可接受大小(超过则压缩),默认 2M
</td></tr>
</tbody></table>
## Returns
Promise<{ file: File; dataURL: string; width: number; height: number; actualFormat: string; msg: string; }>
处理结果:`file` 压缩后文件;`dataURL` 预览图 dataURL(decode 失败为空字符串);`width`<!-- -->/`height` 原始自然尺寸;`actualFormat` 原图实际格式(magic bytes 探测,识别失败为空串);`msg` 提示消息
## Remarks
注意:`msg` 仅作为提示文本返回,\*\*服务端已内部弹出 ToastMsg\*\*(`getImageInfoByFileWithProgressTip` 内部 toast), 扩展侧\*\*无需也不应\*\*再对 `msg` 调用 `showMessage`<!-- -->,否则会双弹;仅当扩展需要自绘提示时才消费该字段。 ADD since EDA v5
## Example
```javascript
// 弹窗内重选图片:选择 → 处理 → 更新预览(提示已由服务端 toast,此处不重复弹)
const file = await eda.sys_FileSystem.openReadFileDialog(['.png', '.jpg']);
if (!file) {
return;
}
const res = await eda.pcb_ImageTool.processImage({ file });
if (res.dataURL) {
// 更新预览:res.dataURL(图)、res.width/res.height(原始尺寸)
console.log('图片已就绪:', res.file.name, res.width, res.height);
}
```
### runinsertimagecommand
# PCB\_ImageTool.runInsertImageCommand() method
> 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.
> Warning: This API is now obsolete.
>
> 临时接口,等待统一放置接口机制落地后替换
运行系统插入图片命令(扩展快捷键桥接)
## Signature
```typescript
function runInsertImageCommand(): Promise<boolean>;
```
## Returns
Promise<boolean>
命令是否已派发
## Remarks
与工具栏按钮/系统菜单同走 `doCommand('insertImage')`<!-- -->,由宿主按当前文档类型路由: SCH/符号/仿真/面板 → 旧直接放置流程;PCB/封装 → 扩展弹窗(publishInsertImageEvent → 扩展 addImageEventListener)。 ADD since EDA v5
### startplacetruecolorpicture
# PCB\_ImageTool.startPlaceTrueColorPicture() method
> 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.
> Warning: This API is now obsolete.
>
> 临时接口(插入图片 PCB 迁移打通流程用):等统一放置接口重构落地后删除替换,请尽快迁移,勿在新功能中继续依赖
开始放置真彩图片(权限校验 → 图片审核 → 内核上传 → 模板注册 → 触发放置)
## Signature
```typescript
function startPlaceTrueColorPicture(options: {
imageBlob: Blob;
width: number;
height: number;
unit?: 'mm' | 'mil';
fileName: string;
}): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
options
</td><td>
{ imageBlob: Blob; width: number; height: number; unit?: 'mm' \| 'mil'; fileName: string }
</td><td>
.fileName - 文件名
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
放置工具是否成功触发(权限未过/审核未过/导入失败返回 false)
## Remarks
ADD since EDA v5
## Example
```javascript
// 放置真彩图片(压缩在选图阶段已完成)
const ok = await eda.pcb_ImageTool.startPlaceTrueColorPicture({
imageBlob: file,
width: 50,
height: 30,
unit: 'mm',
fileName: 'photo.png',
});
console.log('真彩放置已触发:', ok);
```
### startplacevectorimage
# PCB\_ImageTool.startPlaceVectorImage() method
> 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.
> Warning: This API is now obsolete.
>
> 临时接口(插入图片 PCB 迁移打通流程用):等统一放置接口重构落地后删除替换,请尽快迁移,勿在新功能中继续依赖
开始放置矢量图片(将描摹好的路径交给内核,触发十字光标放置)
## Signature
```typescript
function startPlaceVectorImage(options: {
path: string;
width: number;
height: number;
unit?: 'mm' | 'mil';
}): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
options
</td><td>
{ path: string; width: number; height: number; unit?: 'mm' \| 'mil' }
</td><td>
.unit - 单位,默认 `mm`
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
放置工具是否成功触发
## Remarks
ADD since EDA v5
## Example
```javascript
// 1. 描摹图片得到矢量路径
const traced = await eda.pcb_MathPolygon.traceImage({ imageBlob, quality: 'high' });
if (!traced) {
console.log('空描摹:无图可放置');
return;
}
// 2. 触发放置(用户点哪放哪)
const ok = await eda.pcb_ImageTool.startPlaceVectorImage({
path: traced.path,
width: 50,
height: 30,
unit: 'mm',
});
console.log('矢量放置已触发:', ok);
```
references/classes/PCB_Layer.md
# PCB\_Layer class
PCB & footprint / layer operation class
## Signature
```typescript
class PCB_Layer
```
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[addCustomLayer()](./PCB_Layer.md)
</td><td>
</td><td>
**_(BETA)_** Add a custom layer
</td></tr>
<tr><td>
[deletePhysicalStackingConfiguration(configurationName, physicalProps)](./PCB_Layer.md)
</td><td>
</td><td>
**_(BETA)_** Delete Physical stacking configuration
</td></tr>
<tr><td>
[getAllLayers()](./PCB_Layer.md)
</td><td>
</td><td>
**_(BETA)_** Get the detailed properties of all layers
</td></tr>
<tr><td>
[getAllPhysicalStackingConfigurations(physicalProps)](./PCB_Layer.md)
</td><td>
</td><td>
**_(BETA)_** Get all Physical stacking configuration
</td></tr>
<tr><td>
[getCurrentLayer()](./PCB_Layer.md)
</td><td>
</td><td>
**_(BETA)_** Get the detailed properties of the current layer
</td></tr>
<tr><td>
[getCurrentPhysicalStackingConfiguration()](./PCB_Layer.md)
</td><td>
</td><td>
**_(BETA)_** Get Current physical stacking configuration
</td></tr>
<tr><td>
[getCurrentPhysicalStackingConfigurationName()](./PCB_Layer.md)
</td><td>
</td><td>
**_(BETA)_** Get Current physical stacking configuration name
</td></tr>
<tr><td>
[getDefaultPhysicalStackingConfigurationName(physicalProps)](./PCB_Layer.md)
</td><td>
</td><td>
**_(BETA)_** Get the name of the default physical stacking configuration for new PCBs
</td></tr>
<tr><td>
[getPhysicalStackingConfiguration(configurationName, physicalProps)](./PCB_Layer.md)
</td><td>
</td><td>
**_(BETA)_** Get Specify physical stacking configuration
</td></tr>
<tr><td>
[lockLayer(layer)](./PCB_Layer.md)
</td><td>
</td><td>
**_(BETA)_** Lock the layer
</td></tr>
<tr><td>
[modifyLayer(layer, property)](./PCB_Layer.md)
</td><td>
</td><td>
**_(BETA)_** Modify Layer properties
</td></tr>
<tr><td>
[overwriteCurrentPhysicalStackingConfiguration(physicalStackingConfiguration)](./PCB_Layer.md)
</td><td>
</td><td>
**_(BETA)_** Overwrite current physical stacking configuration
</td></tr>
<tr><td>
[removeLayer(layer)](./PCB_Layer.md)
</td><td>
</td><td>
**_(BETA)_** Remove Layer
</td></tr>
<tr><td>
[renamePhysicalStackingConfiguration(originalConfigurationName, configurationName, physicalProps)](./PCB_Layer.md)
</td><td>
</td><td>
**_(BETA)_** Rename the physical stacking configuration
</td></tr>
<tr><td>
[savePhysicalStackingConfiguration(physicalStackingConfiguration, configurationName, physicalProps, allowOverwrite)](./PCB_Layer.md)
</td><td>
</td><td>
**_(BETA)_** Save Physical stacking configuration
</td></tr>
<tr><td>
[selectLayer(layer)](./PCB_Layer.md)
</td><td>
</td><td>
Select a layer
</td></tr>
<tr><td>
[setAsDefaultPhysicalStackingConfiguration(configurationName, physicalProps)](./PCB_Layer.md)
</td><td>
</td><td>
**_(BETA)_** Set as the default physical stacking configuration for new PCBs
</td></tr>
<tr><td>
[setInactiveLayerDisplayMode(displayMode)](./PCB_Layer.md)
</td><td>
</td><td>
**_(BETA)_** Set Inactive layer display mode
</td></tr>
<tr><td>
[setInactiveLayerTransparency(transparency)](./PCB_Layer.md)
</td><td>
</td><td>
**_(BETA)_** Set the inactive layer transparency
</td></tr>
<tr><td>
[setLayerColorConfiguration(colorConfiguration)](./PCB_Layer.md)
</td><td>
</td><td>
**_(BETA)_** Set the layer color configuration
</td></tr>
<tr><td>
[setLayerInvisible(layer, setOtherLayerVisible)](./PCB_Layer.md)
</td><td>
</td><td>
**_(BETA)_** Set the layer to invisible
</td></tr>
<tr><td>
[setLayerVisible(layer, setOtherLayerInvisible)](./PCB_Layer.md)
</td><td>
</td><td>
**_(BETA)_** Set the layer to visible
</td></tr>
<tr><td>
[setPcbType(pcbType)](./PCB_Layer.md)
</td><td>
</td><td>
**_(BETA)_** Set PCB type
</td></tr>
<tr><td>
[setTheNumberOfCopperLayers(numberOfLayers)](./PCB_Layer.md)
</td><td>
</td><td>
**_(BETA)_** Set Number of copper layers
</td></tr>
<tr><td>
[unlockLayer(layer)](./PCB_Layer.md)
</td><td>
</td><td>
**_(BETA)_** Unlock the layer
</td></tr>
</tbody></table>
---
## 方法详情
### addcustomlayer
# PCB\_Layer.addCustomLayer() method
> 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.
Add a custom layer
## Signature
```typescript
function addCustomLayer(): Promise<TPCB_LayersOfCustom | undefined>;
```
## Returns
Promise<[TPCB\_LayersOfCustom](../types/TPCB_LayersOfCustom.md) \| undefined>
The layer ID of the newly added custom layer. If it is `undefined`<!-- -->, the addition failed, possibly because the number of custom layers has reached the upper limit
## Example
```javascript
// 1. 先移除历史运行遗留的自定义层,保证案例可以反复执行
const layers = await eda.pcb_Layer.getAllLayers();
for (const item of layers.filter(l => l.type === 'CUSTOM')) {
await eda.pcb_Layer.removeLayer(item.id);
}
// 2. 新增自定义层,返回新层的图层 ID(CUSTOM_1=71 起顺延分配)
const customLayerId = await eda.pcb_Layer.addCustomLayer();
// 3. 从图层列表确认新层已存在(保留现场,可在图层面板观察)
const after = await eda.pcb_Layer.getAllLayers();
const newLayer = after.find(l => l.id === customLayerId);
console.log('customLayerId:', customLayerId);
console.log('newLayerName:', newLayer?.name);
console.log('customLayerCount:', after.filter(l => l.type === 'CUSTOM').length);
```
### deletephysicalstackingconfiguration
# PCB\_Layer.deletePhysicalStackingConfiguration() method
> 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.
Delete Physical stacking configuration
## Signature
```typescript
function deletePhysicalStackingConfiguration(
configurationName: string,
physicalProps?: IPCB_SubstratePhysicalProperties,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
configurationName
</td><td>
string
</td><td>
Configuration name
</td></tr>
<tr><td>
physicalProps
</td><td>
[IPCB\_SubstratePhysicalProperties](../interfaces/IPCB_SubstratePhysicalProperties.md)
</td><td>
_(Optional)_ 物理属性,如若不传入则默认为当前 PCB 属性
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Delete Whether Successful
## Remarks
ADD since EDA v4.2
### getalllayers
# PCB\_Layer.getAllLayers() method
> 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.
Get the detailed properties of all layers
## Signature
```typescript
function getAllLayers(): Promise<Array<IPCB_LayerItem>>;
```
## Returns
Promise<Array<[IPCB\_LayerItem](../interfaces/IPCB_LayerItem.md)<!-- -->>>
Detailed properties of all layers
## Example
```javascript
// 1. 一次性取回当前 PCB 的全部图层
const layers = await eda.pcb_Layer.getAllLayers();
// 2. 查看顶层(TOP=1)的典型属性
const top = layers.find(l => l.id === 1);
// 3. 统计信号层(铜箔层)数量
const copperCount = layers.filter(l => l.type === 'SIGNAL').length;
console.log('totalCount:', layers.length);
console.log('topLayerName:', top?.name);
console.log('topLayerColor:', top?.color);
console.log('topLayerLocked:', top?.locked);
console.log('copperLayerCount:', copperCount);
```
### getallphysicalstackingconfigurations
# PCB\_Layer.getAllPhysicalStackingConfigurations() method
> 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.
Get all Physical stacking configuration
## Signature
```typescript
function getAllPhysicalStackingConfigurations(
physicalProps?: IPCB_SubstratePhysicalProperties,
): Promise<Array<IPCB_PhysicalStackingConfiguration>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
physicalProps
</td><td>
[IPCB\_SubstratePhysicalProperties](../interfaces/IPCB_SubstratePhysicalProperties.md)
</td><td>
_(Optional)_ 物理属性,如若不传入则默认为当前 PCB 属性
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PhysicalStackingConfiguration](../interfaces/IPCB_PhysicalStackingConfiguration.md)<!-- -->>>
All physical stacking configurations
## Remarks
ADD since EDA v4.2
### getcurrentlayer
# PCB\_Layer.getCurrentLayer() method
> 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.
Get the detailed properties of the current layer
## Signature
```typescript
function getCurrentLayer(): Promise<IPCB_LayerItem | undefined>;
```
## Returns
Promise<[IPCB\_LayerItem](../interfaces/IPCB_LayerItem.md) \| undefined>
Detailed properties of the current layer. `undefined` is returned when there is no active layer or no PCB canvas
## Remarks
ADD since EDA v4.2
### getcurrentphysicalstackingconfiguration
# PCB\_Layer.getCurrentPhysicalStackingConfiguration() method
> 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.
Get Current physical stacking configuration
## Signature
```typescript
function getCurrentPhysicalStackingConfiguration(): Promise<
IPCB_PhysicalStackingConfiguration | undefined
>;
```
## Returns
Promise<[IPCB\_PhysicalStackingConfiguration](../interfaces/IPCB_PhysicalStackingConfiguration.md) \| undefined>
Current physical stacking configuration; `undefined` indicates that the retrieval failed
## Remarks
ADD since EDA v4.2
### getcurrentphysicalstackingconfigurationname
# PCB\_Layer.getCurrentPhysicalStackingConfigurationName() method
> 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.
Get Current physical stacking configuration name
## Signature
```typescript
function getCurrentPhysicalStackingConfigurationName(): Promise<string | undefined>;
```
## Returns
Promise<string \| undefined>
Current physical stacking configuration name; `undefined` indicates that the retrieval failed
## Remarks
ADD since EDA v4.2
### getdefaultphysicalstackingconfigurationname
# PCB\_Layer.getDefaultPhysicalStackingConfigurationName() method
> 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.
Get the name of the default physical stacking configuration for new PCBs
## Signature
```typescript
function getDefaultPhysicalStackingConfigurationName(
physicalProps?: IPCB_SubstratePhysicalProperties,
): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
physicalProps
</td><td>
[IPCB\_SubstratePhysicalProperties](../interfaces/IPCB_SubstratePhysicalProperties.md)
</td><td>
_(Optional)_ 物理属性,如若不传入则默认为当前 PCB 属性
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
Default physical stacking configuration name of; `undefined` indicates that the retrieval failed
## Remarks
ADD since EDA v4.2
### getphysicalstackingconfiguration
# PCB\_Layer.getPhysicalStackingConfiguration() method
> 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.
Get Specify physical stacking configuration
## Signature
```typescript
function getPhysicalStackingConfiguration(
configurationName: string,
physicalProps?: IPCB_SubstratePhysicalProperties,
): Promise<IPCB_PhysicalStackingConfiguration | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
configurationName
</td><td>
string
</td><td>
Configuration name
</td></tr>
<tr><td>
physicalProps
</td><td>
[IPCB\_SubstratePhysicalProperties](../interfaces/IPCB_SubstratePhysicalProperties.md)
</td><td>
_(Optional)_ 物理属性,如若不传入则默认为当前 PCB 属性
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PhysicalStackingConfiguration](../interfaces/IPCB_PhysicalStackingConfiguration.md) \| undefined>
Physical stacking configuration, `undefined` is does not exist this physical stacking
## Remarks
ADD since EDA v4.2
### locklayer
# PCB\_Layer.lockLayer() method
> 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.
Lock the layer
## Signature
```typescript
function lockLayer(
layer?: TPCB_LayersInTheSelectable | Array<TPCB_LayersInTheSelectable>,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersInTheSelectable](../types/TPCB_LayersInTheSelectable.md) \| Array<[TPCB\_LayersInTheSelectable](../types/TPCB_LayersInTheSelectable.md)<!-- -->>
</td><td>
_(Optional)_ Layer. If no layer is specified, all layers are used by default
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 锁定顶层(TOP=1)与底层(BOTTOM=2),传入层数组
const lockResult = await eda.pcb_Layer.lockLayer([1, 2]);
// 2. 从图层列表确认锁定状态
const layers = await eda.pcb_Layer.getAllLayers();
const top = layers.find(l => l.id === 1);
// 3. 恢复现场:解锁这两层,避免影响后续编辑
const restoreResult = await eda.pcb_Layer.unlockLayer([1, 2]);
console.log('lockResult:', lockResult);
console.log('topLockedNow:', top?.locked);
console.log('restoreResult:', restoreResult);
```
### modifylayer
# PCB\_Layer.modifyLayer() method
> 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.
Modify Layer properties
## Signature
```typescript
function modifyLayer(
layer: TPCB_LayersInTheSelectable,
property: {
name?: string;
type?: TPCB_LayerTypesOfInnerLayer;
color?: string;
transparency?: number;
},
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersInTheSelectable](../types/TPCB_LayersInTheSelectable.md)
</td><td>
Layer
</td></tr>
<tr><td>
property
</td><td>
{ name?: string; type?: [TPCB\_LayerTypesOfInnerLayer](../types/TPCB_LayerTypesOfInnerLayer.md)<!-- -->; color?: string; transparency?: number }
</td><td>
Property
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
The modified layer properties. If it is `undefined`<!-- -->, the modification failed or the layer does not exist
## Remarks
Only inner layers and custom layers can have their names modified; only inner layers can have their types modified. Transparency only supports values between 0-100
## Example
```javascript
// 1. 新增一个自定义层作为修改对象
const customLayerId = await eda.pcb_Layer.addCustomLayer();
// 2. 读取修改前的名称与颜色
const before = (await eda.pcb_Layer.getAllLayers()).find(l => l.id === customLayerId);
// 3. 修改名称、颜色与透明度(保留现场供观察)
const modifyResult = await eda.pcb_Layer.modifyLayer(customLayerId, {
name: '嘉立创示例_工艺说明',
color: '#FF6600',
transparency: 30,
});
// 4. 重新读取图层列表确认修改生效
const after = (await eda.pcb_Layer.getAllLayers()).find(l => l.id === customLayerId);
console.log('modifyResult:', modifyResult);
console.log('nameBefore:', before?.name, '→ nameAfter:', after?.name);
console.log('colorBefore:', before?.color, '→ colorAfter:', after?.color);
```
### overwritecurrentphysicalstackingconfiguration
# PCB\_Layer.overwriteCurrentPhysicalStackingConfiguration() method
> 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.
Overwrite current physical stacking configuration
## Signature
```typescript
function overwriteCurrentPhysicalStackingConfiguration(
physicalStackingConfiguration: IPCB_PhysicalStackingConfiguration,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
physicalStackingConfiguration
</td><td>
[IPCB\_PhysicalStackingConfiguration](../interfaces/IPCB_PhysicalStackingConfiguration.md)
</td><td>
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Overwrite whether it is successful
## Remarks
It will overwrite the current physical stacking configuration of the PCB. Please note the risk of data loss
如果传入的物理叠层配置不符合当前 PCB 的物理属性,将会直接返回 `false` 且不进行修改 ADD since EDA v4.2
### removelayer
# PCB\_Layer.removeLayer() method
> 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.
Remove Layer
## Signature
```typescript
function removeLayer(layer: TPCB_LayersOfCustom): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfCustom](../types/TPCB_LayersOfCustom.md)
</td><td>
Layer
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
Currently only custom layers can be removed
## Example
```javascript
// 1. 新增一个自定义层作为移除对象
const customLayerId = await eda.pcb_Layer.addCustomLayer();
// 2. 移除该自定义层,返回操作是否成功
const removeResult = await eda.pcb_Layer.removeLayer(customLayerId);
// 3. 确认该层已从图层列表消失
const rest = (await eda.pcb_Layer.getAllLayers()).filter(l => l.type === 'CUSTOM');
console.log('removeResult:', removeResult);
console.log('removedLayerId:', customLayerId);
console.log('customLayerLeft:', rest.length);
```
### renamephysicalstackingconfiguration
# PCB\_Layer.renamePhysicalStackingConfiguration() method
> 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.
Rename the physical stacking configuration
## Signature
```typescript
function renamePhysicalStackingConfiguration(
originalConfigurationName: string,
configurationName: string,
physicalProps?: IPCB_SubstratePhysicalProperties,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
originalConfigurationName
</td><td>
string
</td><td>
Original physical stacking configuration name
</td></tr>
<tr><td>
configurationName
</td><td>
string
</td><td>
New physical stacking configuration name
</td></tr>
<tr><td>
physicalProps
</td><td>
[IPCB\_SubstratePhysicalProperties](../interfaces/IPCB_SubstratePhysicalProperties.md)
</td><td>
_(Optional)_ 物理属性,如若不传入则默认为当前 PCB 属性
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the rename was successful
## Remarks
ADD since EDA v4.2
### savephysicalstackingconfiguration
# PCB\_Layer.savePhysicalStackingConfiguration() method
> 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.
Save Physical stacking configuration
## Signature
```typescript
function savePhysicalStackingConfiguration(
physicalStackingConfiguration: IPCB_PhysicalStackingConfiguration,
configurationName: string,
physicalProps?: IPCB_SubstratePhysicalProperties,
allowOverwrite?: boolean,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
physicalStackingConfiguration
</td><td>
[IPCB\_PhysicalStackingConfiguration](../interfaces/IPCB_PhysicalStackingConfiguration.md)
</td><td>
Physical stacking configuration
</td></tr>
<tr><td>
configurationName
</td><td>
string
</td><td>
Configuration name
</td></tr>
<tr><td>
physicalProps
</td><td>
[IPCB\_SubstratePhysicalProperties](../interfaces/IPCB_SubstratePhysicalProperties.md)
</td><td>
_(Optional)_ 物理属性,如若不传入则默认为当前 PCB 属性
</td></tr>
<tr><td>
allowOverwrite
</td><td>
boolean
</td><td>
_(Optional)_ Whether to allow overwriting a physical stacking configuration with the same name. If `false`<!-- -->, `false` will be returned when a configuration with the same name is encountered. Please note the possible risk of data loss
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Save Whether Successful
## Remarks
ADD since EDA v4.2
### selectlayer
# PCB\_Layer.selectLayer() method
Select a layer
## Signature
```typescript
function selectLayer(layer: TPCB_LayersInTheSelectable): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersInTheSelectable](../types/TPCB_LayersInTheSelectable.md)
</td><td>
Layer
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation was successful. `false` is returned if the specified layer does not exist
## Example
```javascript
// 1. 切换当前工作层到底层(BOTTOM=2)
const selectResult = await eda.pcb_Layer.selectLayer(2);
// 2. 再切回顶层(TOP=1),恢复常用工作层
const restoreResult = await eda.pcb_Layer.selectLayer(1);
console.log('selectResult:', selectResult);
console.log('restoreResult:', restoreResult);
```
### setasdefaultphysicalstackingconfiguration
# PCB\_Layer.setAsDefaultPhysicalStackingConfiguration() method
> 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.
Set as the default physical stacking configuration for new PCBs
## Signature
```typescript
function setAsDefaultPhysicalStackingConfiguration(
configurationName: string,
physicalProps?: IPCB_SubstratePhysicalProperties,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
configurationName
</td><td>
string
</td><td>
Configuration name
</td></tr>
<tr><td>
physicalProps
</td><td>
[IPCB\_SubstratePhysicalProperties](../interfaces/IPCB_SubstratePhysicalProperties.md)
</td><td>
_(Optional)_ 物理属性,如若不传入则默认为当前 PCB 属性
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Set Whether Successful
## Remarks
The return value is result-oriented. Repeatedly setting the same physical stacking as the default will also return `true` ADD since EDA v4.2
### setinactivelayerdisplaymode
# PCB\_Layer.setInactiveLayerDisplayMode() method
> 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.
Set Inactive layer display mode
## Signature
```typescript
function setInactiveLayerDisplayMode(displayMode?: EPCB_InactiveLayerDisplayMode): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
displayMode
</td><td>
[EPCB\_InactiveLayerDisplayMode](../enums/EPCB_InactiveLayerDisplayMode.md)
</td><td>
_(Optional)_ Display mode
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether Set Successful
## Example
```javascript
// 1. 将非激活层设为置灰模式(TURN_GRAY=1)
const setResult = await eda.pcb_Layer.setInactiveLayerDisplayMode(1);
// 2. 恢复为正常亮度(NORMAL_BRIGHTNESS=0),避免影响日常查看
const restoreResult = await eda.pcb_Layer.setInactiveLayerDisplayMode(0);
console.log('setResult:', setResult);
console.log('restoreResult:', restoreResult);
```
### setinactivelayertransparency
# PCB\_Layer.setInactiveLayerTransparency() method
> 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.
Set the inactive layer transparency
## Signature
```typescript
function setInactiveLayerTransparency(transparency: number): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
transparency
</td><td>
number
</td><td>
Transparency, range `0-100`
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 将非激活层透明度设为 60,让当前编辑层更突出
const setResult = await eda.pcb_Layer.setInactiveLayerTransparency(60);
// 2. 恢复为 0(不透明),避免影响日常查看
const restoreResult = await eda.pcb_Layer.setInactiveLayerTransparency(0);
console.log('setResult:', setResult);
console.log('restoreResult:', restoreResult);
```
### setlayercolorconfiguration
# PCB\_Layer.setLayerColorConfiguration() method
> 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.
Set the layer color configuration
## Signature
```typescript
function setLayerColorConfiguration(
colorConfiguration: EPCB_LayerColorConfiguration,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
colorConfiguration
</td><td>
[EPCB\_LayerColorConfiguration](../enums/EPCB_LayerColorConfiguration.md)
</td><td>
Color configuration
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 记录切换前顶层的颜色
const before = (await eda.pcb_Layer.getAllLayers()).find(l => l.id === 1);
// 2. 切换为 Altium Designer 配色(ALTIUM_DESIGNER=2)
const setResult = await eda.pcb_Layer.setLayerColorConfiguration(2);
// 3. 查看切换后顶层的颜色
const after = (await eda.pcb_Layer.getAllLayers()).find(l => l.id === 1);
// 4. 恢复嘉立创 EDA 默认配色(EASYEDA=1)
const restoreResult = await eda.pcb_Layer.setLayerColorConfiguration(1);
console.log('setResult:', setResult);
console.log('topColorBefore:', before?.color, '→ topColorAfter:', after?.color);
console.log('restoreResult:', restoreResult);
```
### setlayerinvisible
# PCB\_Layer.setLayerInvisible() method
> 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.
Set the layer to invisible
## Signature
```typescript
function setLayerInvisible(
layer?: TPCB_LayersInTheSelectable | Array<TPCB_LayersInTheSelectable>,
setOtherLayerVisible?: boolean,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersInTheSelectable](../types/TPCB_LayersInTheSelectable.md) \| Array<[TPCB\_LayersInTheSelectable](../types/TPCB_LayersInTheSelectable.md)<!-- -->>
</td><td>
_(Optional)_ Layer. If no layer is specified, all layers are used by default
</td></tr>
<tr><td>
setOtherLayerVisible
</td><td>
boolean
</td><td>
_(Optional)_ Whether to set other layers to visible
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 隐藏底层丝印层(BOTTOM_SILKSCREEN=4)
const hideResult = await eda.pcb_Layer.setLayerInvisible(4);
// 2. 从图层列表确认显隐状态(HIDDEN=2)
const layers = await eda.pcb_Layer.getAllLayers();
const silk = layers.find(l => l.id === 4);
// 3. 恢复可见,避免影响后续查看
const restoreResult = await eda.pcb_Layer.setLayerVisible(4);
console.log('hideResult:', hideResult);
console.log('silkLayerStatus:', silk?.layerStatus);
console.log('restoreResult:', restoreResult);
```
### setlayervisible
# PCB\_Layer.setLayerVisible() method
> 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.
Set the layer to visible
## Signature
```typescript
function setLayerVisible(
layer?: TPCB_LayersInTheSelectable | Array<TPCB_LayersInTheSelectable>,
setOtherLayerInvisible?: boolean,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersInTheSelectable](../types/TPCB_LayersInTheSelectable.md) \| Array<[TPCB\_LayersInTheSelectable](../types/TPCB_LayersInTheSelectable.md)<!-- -->>
</td><td>
_(Optional)_ Layer. If no layer is specified, all layers are used by default
</td></tr>
<tr><td>
setOtherLayerInvisible
</td><td>
boolean
</td><td>
_(Optional)_ Whether to set other layers to invisible
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 先隐藏底层丝印层(BOTTOM_SILKSCREEN=4)制造初始状态
await eda.pcb_Layer.setLayerInvisible(4);
// 2. 恢复底层丝印层可见
const showResult = await eda.pcb_Layer.setLayerVisible(4);
// 3. 从图层列表确认显隐状态(SHOW=1)
const layers = await eda.pcb_Layer.getAllLayers();
const silk = layers.find(l => l.id === 4);
console.log('showResult:', showResult);
console.log('silkLayerStatus:', silk?.layerStatus);
```
### setpcbtype
# PCB\_Layer.setPcbType() method
> 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.
Set PCB type
## Signature
```typescript
function setPcbType(pcbType: EPCB_PcbPlateType): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
pcbType
</td><td>
[EPCB\_PcbPlateType](../enums/EPCB_PcbPlateType.md)
</td><td>
PCB type
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
This is mainly to support FPC flexible board design. If the PCB type is set to FPC flexible board, an FPC stiffener layer will be added.
Please note:
1. EasyEDA does not yet support FPC flexible board production with more than 2 copper layers;
2. When switching the PCB type from FPC flexible board to ordinary board, any primitives on the FPC stiffener layer must be deleted in advance; otherwise, the switch will fail and `false` will be returned.
## Example
```javascript
// 1. 记录切换前的图层总数
const before = await eda.pcb_Layer.getAllLayers();
// 2. 切换为 FPC 软板(FPC=2),自动新增补强层
const fpcResult = await eda.pcb_Layer.setPcbType(2);
// 3. 查看切换后的图层总数变化
const fpcLayers = await eda.pcb_Layer.getAllLayers();
// 4. 切回普通板材(NORMAL=1),恢复原板材类型
const restoreResult = await eda.pcb_Layer.setPcbType(1);
console.log('fpcResult:', fpcResult);
console.log('layerCountBefore:', before.length, '→ layerCountAfter:', fpcLayers.length);
console.log('restoreResult:', restoreResult);
```
### setthenumberofcopperlayers
# PCB\_Layer.setTheNumberOfCopperLayers() method
> 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.
Set Number of copper layers
## Signature
```typescript
function setTheNumberOfCopperLayers(numberOfLayers: TPCB_NumberOfCopperLayers): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
numberOfLayers
</td><td>
[TPCB\_NumberOfCopperLayers](../types/TPCB_NumberOfCopperLayers.md)
</td><td>
Number of copper layers
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
A newly created PCB document has two copper layers by default
## Example
```javascript
// 1. 记录调整前的信号层(铜箔层)数量
const before = (await eda.pcb_Layer.getAllLayers()).filter(l => l.type === 'SIGNAL').length;
// 2. 将铜箔层数调整为 4 层,新增 INNER_1(15)、INNER_2(16)两个内层
const setResult = await eda.pcb_Layer.setTheNumberOfCopperLayers(4);
// 3. 确认内层已加入图层列表
const afterLayers = await eda.pcb_Layer.getAllLayers();
const after = afterLayers.filter(l => l.type === 'SIGNAL').length;
const inner1 = afterLayers.find(l => l.id === 15);
// 4. 恢复为 2 层板,移除空的内层(内层上有图元时无法减少层数)
const restoreResult = await eda.pcb_Layer.setTheNumberOfCopperLayers(2);
console.log('setResult:', setResult);
console.log('copperCountBefore:', before, '→ copperCountAfter:', after);
console.log('inner1Name:', inner1?.name);
console.log('restoreResult:', restoreResult);
```
### unlocklayer
# PCB\_Layer.unlockLayer() method
> 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.
Unlock the layer
## Signature
```typescript
function unlockLayer(
layer?: TPCB_LayersInTheSelectable | Array<TPCB_LayersInTheSelectable>,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersInTheSelectable](../types/TPCB_LayersInTheSelectable.md) \| Array<[TPCB\_LayersInTheSelectable](../types/TPCB_LayersInTheSelectable.md)<!-- -->>
</td><td>
_(Optional)_ Layer. If no layer is specified, all layers are used by default
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 先锁定顶层(TOP=1)制造初始状态
await eda.pcb_Layer.lockLayer(1);
// 2. 解锁顶层,返回操作是否成功
const unlockResult = await eda.pcb_Layer.unlockLayer(1);
// 3. 从图层列表确认锁定已解除
const layers = await eda.pcb_Layer.getAllLayers();
const top = layers.find(l => l.id === 1);
console.log('unlockResult:', unlockResult);
console.log('topStillLocked:', top?.locked);
```
references/classes/PCB_Drc.md
# PCB\_Drc class
PCB & footprint / design rule check (DRC) class
## Signature
```typescript
class PCB_Drc
```
## Remarks
Check and set DRC rules
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[addNetToEqualLengthNetGroup(equalLengthNetGroupName, net)](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Add a net to an equal-length net group
</td></tr>
<tr><td>
[addNetToNetClass(netClassName, net)](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Will net add to net class
</td></tr>
<tr><td>
[addPadPairToPadPairGroup(padPairGroupName, padPair)](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Add a pad pair to a pad pair group
</td></tr>
<tr><td>
[check(strict, userInterface, includeVerboseError)](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Check DRC
</td></tr>
<tr><td>
[check(strict, userInterface, includeVerboseError)](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Check DRC
</td></tr>
<tr><td>
[createDifferentialPair(differentialPairName, positiveNet, negativeNet)](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Create a differential pair
</td></tr>
<tr><td>
[createEqualLengthNetGroup(equalLengthNetGroupName, nets, color)](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Create an equal-length net group
</td></tr>
<tr><td>
[createNetClass(netClassName, nets, color)](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Create Net class
</td></tr>
<tr><td>
[createPadPairGroup(padPairGroupName, padPairs)](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Create a pad pair group
</td></tr>
<tr><td>
[deleteDifferentialPair(differentialPairName)](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Delete the differential pair
</td></tr>
<tr><td>
[deleteEqualLengthNetGroup(equalLengthNetGroupName)](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Delete the equal-length net group
</td></tr>
<tr><td>
[deleteNetClass(netClassName)](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Delete Net class
</td></tr>
<tr><td>
[deletePadPairGroup(padPairGroupName)](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Delete the pad pair group
</td></tr>
<tr><td>
[deleteRuleConfiguration(configurationName)](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Delete Design rule configuration
</td></tr>
<tr><td>
[getAllDifferentialPairs()](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Get the detailed properties of all differential pairs
</td></tr>
<tr><td>
[getAllEqualLengthNetGroups()](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Get the detailed properties of all equal-length net groups
</td></tr>
<tr><td>
[getAllNetClasses()](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Get all Net class detailed properties of
</td></tr>
<tr><td>
[getAllPadPairGroups()](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Get the detailed properties of all pad pair groups
</td></tr>
<tr><td>
[getAllRuleConfigurations(includeSystem)](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Get all Design rule configuration
</td></tr>
<tr><td>
[getCurrentRuleConfiguration()](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Get Current design rule configuration
</td></tr>
<tr><td>
[getCurrentRuleConfigurationName()](./PCB_Drc.md)
</td><td>
</td><td>
Get Current design rule configuration name
</td></tr>
<tr><td>
[getDefaultRuleConfigurationName()](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Get the name of the default design rule configuration for new PCBs
</td></tr>
<tr><td>
[getNetByNetRules()](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Get Net - net rules
</td></tr>
<tr><td>
[getNetRules()](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Get Net rules
</td></tr>
<tr><td>
[getPadPairGroupMinWireLength(padPairGroupName)](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Get the minimum wire length of a pad pair group
</td></tr>
<tr><td>
[getRealTimeDrcStatus()](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Get Real-time DRC check state
</td></tr>
<tr><td>
[getRegionRules()](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Get region rules
</td></tr>
<tr><td>
[getRuleConfiguration(configurationName)](./PCB_Drc.md)
</td><td>
</td><td>
Get Specify design rule configuration
</td></tr>
<tr><td>
[modifyDifferentialPairName(originalDifferentialPairName, differentialPairName)](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Modify the name of the differential pair
</td></tr>
<tr><td>
[modifyDifferentialPairNegativeNet(differentialPairName, negativeNet)](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Modify the negative net of the differential pair
</td></tr>
<tr><td>
[modifyDifferentialPairPositiveNet(differentialPairName, positiveNet)](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Modify the positive net of the differential pair
</td></tr>
<tr><td>
[modifyEqualLengthNetGroupName(originalEqualLengthNetGroupName, equalLengthNetGroupName)](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Modify the name of the equal-length net group
</td></tr>
<tr><td>
[modifyNetClassName(originalNetClassName, netClassName)](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Modify Net class name of
</td></tr>
<tr><td>
[modifyPadPairGroupName(originalPadPairGroupName, padPairGroupName)](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Modify the name of the pad pair group
</td></tr>
<tr><td>
[overwriteCurrentRuleConfiguration(ruleConfiguration)](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Overwrite current design rule configuration
</td></tr>
<tr><td>
[overwriteNetByNetRules(netByNetRules)](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Overwrite net - net rules
</td></tr>
<tr><td>
[overwriteNetRules(netRules)](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Overwrite net rules
</td></tr>
<tr><td>
[overwriteRegionRules(regionRules)](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Overwrite region rules
</td></tr>
<tr><td>
[removeNetFromEqualLengthNetGroup(equalLengthNetGroupName, net)](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Remove a net from an equal-length net group
</td></tr>
<tr><td>
[removeNetFromNetClass(netClassName, net)](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** From net class in remove net
</td></tr>
<tr><td>
[removePadPairFromPadPairGroup(padPairGroupName, padPair)](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Remove a pad pair from a pad pair group
</td></tr>
<tr><td>
[renameRuleConfiguration(originalConfigurationName, configurationName)](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Rename the design rule configuration
</td></tr>
<tr><td>
[saveRuleConfiguration(ruleConfiguration, configurationName, allowOverwrite)](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Save Design rule configuration
</td></tr>
<tr><td>
[setAsDefaultRuleConfiguration(configurationName)](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Set as the default design rule configuration for new PCBs
</td></tr>
<tr><td>
[startRealTimeDrc()](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Start real-time DRC check
</td></tr>
<tr><td>
[stopRealTimeDrc()](./PCB_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Stop real-time DRC check
</td></tr>
</tbody></table>
---
## 方法详情
### addnettoequallengthnetgroup
# PCB\_Drc.addNetToEqualLengthNetGroup() method
> 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.
Add a net to an equal-length net group
## Signature
```typescript
function addNetToEqualLengthNetGroup(
equalLengthNetGroupName: string,
net: string | Array<string>,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
equalLengthNetGroupName
</td><td>
string
</td><td>
Equal-length net group name
</td></tr>
<tr><td>
net
</td><td>
string \| Array<string>
</td><td>
Net name
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 准备三个真实网络(放带网络的测试焊盘,模拟一组数据总线)
const x = 3000 + Math.floor(Math.random() * 20000);
await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], 'JLC_DEMO_D0', null, 0, 0, 0, false, 0);
await eda.pcb_PrimitivePad.create(1, '2', x + 500, 3000, 0, ['ELLIPSE', 60, 60], 'JLC_DEMO_D1', null, 0, 0, 0, false, 0);
await eda.pcb_PrimitivePad.create(1, '3', x + 1000, 3000, 0, ['ELLIPSE', 60, 60], 'JLC_DEMO_D2', null, 0, 0, 0, false, 0);
// 2. 先建空等长组,再逐个/批量添加网络
await eda.pcb_Drc.createEqualLengthNetGroup('嘉立创示例_等长网络组', [], { r: 0, g: 255, b: 0, alpha: 1 });
const addedOne = await eda.pcb_Drc.addNetToEqualLengthNetGroup('嘉立创示例_等长网络组', 'JLC_DEMO_D0');
const addedBatch = await eda.pcb_Drc.addNetToEqualLengthNetGroup('嘉立创示例_等长网络组', ['JLC_DEMO_D1', 'JLC_DEMO_D2']);
console.log('addedOne:', addedOne);
console.log('addedBatch:', addedBatch);
```
### addnettonetclass
# PCB\_Drc.addNetToNetClass() method
> 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.
Will net add to net class
## Signature
```typescript
function addNetToNetClass(netClassName: string, net: string | Array<string>): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
netClassName
</td><td>
string
</td><td>
Net class name
</td></tr>
<tr><td>
net
</td><td>
string \| Array<string>
</td><td>
Net name
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 准备三个真实网络(放带网络的测试焊盘)
const x = 3000 + Math.floor(Math.random() * 20000);
await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], 'JLC_DEMO_P', null, 0, 0, 0, false, 0);
await eda.pcb_PrimitivePad.create(1, '2', x + 500, 3000, 0, ['ELLIPSE', 60, 60], 'JLC_DEMO_N', null, 0, 0, 0, false, 0);
await eda.pcb_PrimitivePad.create(1, '3', x + 1000, 3000, 0, ['ELLIPSE', 60, 60], 'JLC_DEMO_CLK', null, 0, 0, 0, false, 0);
// 2. 先建网络类,再逐个/批量添加网络
await eda.pcb_Drc.createNetClass('嘉立创示例_网络类', [], { r: 255, g: 0, b: 0, alpha: 1 });
const addedOne = await eda.pcb_Drc.addNetToNetClass('嘉立创示例_网络类', 'JLC_DEMO_P');
const addedBatch = await eda.pcb_Drc.addNetToNetClass('嘉立创示例_网络类', ['JLC_DEMO_N', 'JLC_DEMO_CLK']);
console.log('addedOne:', addedOne);
console.log('addedBatch:', addedBatch);
```
### addpadpairtopadpairgroup
# PCB\_Drc.addPadPairToPadPairGroup() method
> 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.
Add a pad pair to a pad pair group
## Signature
```typescript
function addPadPairToPadPairGroup(
padPairGroupName: string,
padPair: [string, string] | Array<[string, string]>,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
padPairGroupName
</td><td>
string
</td><td>
Pad pair group name
</td></tr>
<tr><td>
padPair
</td><td>
\[string, string\] \| Array<\[string, string\]>
</td><td>
Pad for
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
There are three different usages, and make sure the corresponding pads already exist on the canvas. They are: 1. Free pad - free pad; 2. Device pad - device pad; 3. Device pad - free pad await eda.pcb\_Drc.addPadPairToPadPairGroup('test',\['e0','e1'\]) // 游离焊盘-游离焊盘 await eda.pcb\_Drc.addPadPairToPadPairGroup('test',\['R1:1','R1:2'\]) // 器件焊盘 - 器件焊盘 await eda.pcb\_Drc.addPadPairToPadPairGroup('test',\['R1:1','e1'\]) // 器件焊盘 - 游离焊盘
### check
# PCB\_Drc.check() method
> 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.
Check DRC
## Signature
```typescript
function check(
strict: boolean,
userInterface: boolean,
includeVerboseError: false,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
strict
</td><td>
boolean
</td><td>
Whether strict checking is enabled. The current PCB is uniformly in strict checking mode
</td></tr>
<tr><td>
userInterface
</td><td>
boolean
</td><td>
Whether to show the UI (open the bottom DRC window)
</td></tr>
<tr><td>
includeVerboseError
</td><td>
false
</td><td>
Whether to include detailed error information in the return value. If it is `true`<!-- -->, the return value will always be an array
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the DRC check passed
## Example
```javascript
// 1. 详细模式:返回全部违规项(含描述),无违规则为空数组
const details = await eda.pcb_Drc.check(true, false, true);
console.log('violationCount:', details.length);
details.forEach((d, i) => {
console.log(`[${i}]`, typeof d === 'string' ? d : JSON.stringify(d));
});
// 2. 布尔模式:只返回是否全部通过
const passed = await eda.pcb_Drc.check(true, false, false);
console.log('allPassed:', passed);
```
### check_1
# PCB\_Drc.check() method
> 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.
Check DRC
## Signature
```typescript
function check(
strict: boolean,
userInterface: boolean,
includeVerboseError: true,
): Promise<Array<any>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
strict
</td><td>
boolean
</td><td>
Whether strict checking is enabled. The current PCB is uniformly in strict checking mode
</td></tr>
<tr><td>
userInterface
</td><td>
boolean
</td><td>
Whether to show the UI (open the bottom DRC window)
</td></tr>
<tr><td>
includeVerboseError
</td><td>
true
</td><td>
Whether to include detailed error information in the return value. If it is `true`<!-- -->, the return value will always be an array
</td></tr>
</tbody></table>
## Returns
Promise<Array<any>>
Detailed results of the DRC check
### createdifferentialpair
# PCB\_Drc.createDifferentialPair() method
> 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.
Create a differential pair
## Signature
```typescript
function createDifferentialPair(
differentialPairName: string,
positiveNet: string,
negativeNet: string,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
differentialPairName
</td><td>
string
</td><td>
Differential pair name
</td></tr>
<tr><td>
positiveNet
</td><td>
string
</td><td>
Positive net name
</td></tr>
<tr><td>
negativeNet
</td><td>
string
</td><td>
Negative net name
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 生成本次运行专用的网络名和差分对名(差分对名和网络名不能与其他差分对重复)
const ts = Date.now();
const netP = `JLC_DEMO_DP_P_${ts}`;
const netN = `JLC_DEMO_DP_N_${ts}`;
// 2. 放两个带差分网络的焊盘,让网络进入网表
const x = 3000 + Math.floor(Math.random() * 20000);
const padP = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], netP, null, 0, 0, 0, false, 0);
const padN = await eda.pcb_PrimitivePad.create(1, '2', x + 500, 3000, 0, ['ELLIPSE', 60, 60], netN, null, 0, 0, 0, false, 0);
// 3. 创建差分对(保留现场供观察)
const created = await eda.pcb_Drc.createDifferentialPair(`嘉立创示例_差分对_${ts}`, netP, netN);
console.log('pairName:', `嘉立创示例_差分对_${ts}`);
console.log('created:', created);
```
### createequallengthnetgroup
# PCB\_Drc.createEqualLengthNetGroup() method
> 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.
Create an equal-length net group
## Signature
```typescript
function createEqualLengthNetGroup(
equalLengthNetGroupName: string,
nets: Array<string>,
color: IPCB_EqualLengthNetGroupItem['color'],
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
equalLengthNetGroupName
</td><td>
string
</td><td>
Equal-length net group name
</td></tr>
<tr><td>
nets
</td><td>
Array<string>
</td><td>
Net name array
</td></tr>
<tr><td>
color
</td><td>
[IPCB\_EqualLengthNetGroupItem](../interfaces/IPCB_EqualLengthNetGroupItem.md)<!-- -->\['color'\]
</td><td>
Equal-length net group color
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 创建一个空的等长网络组,指定面板显示颜色(保留现场供观察)
const created = await eda.pcb_Drc.createEqualLengthNetGroup('嘉立创示例_等长网络组', [], { r: 0, g: 255, b: 0, alpha: 1 });
console.log('created:', created);
```
### createnetclass
# PCB\_Drc.createNetClass() method
> 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.
Create Net class
## Signature
```typescript
function createNetClass(
netClassName: string,
nets: Array<string>,
color: IPCB_EqualLengthNetGroupItem['color'],
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
netClassName
</td><td>
string
</td><td>
Net class name
</td></tr>
<tr><td>
nets
</td><td>
Array<string>
</td><td>
Net name array
</td></tr>
<tr><td>
color
</td><td>
[IPCB\_EqualLengthNetGroupItem](../interfaces/IPCB_EqualLengthNetGroupItem.md)<!-- -->\['color'\]
</td><td>
Net class color
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 放两个带网络的测试焊盘,让 JLC_DEMO_P / JLC_DEMO_N 进入网表
const x = 3000 + Math.floor(Math.random() * 20000);
const padP = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], 'JLC_DEMO_P', null, 0, 0, 0, false, 0);
const padN = await eda.pcb_PrimitivePad.create(1, '2', x + 500, 3000, 0, ['ELLIPSE', 60, 60], 'JLC_DEMO_N', null, 0, 0, 0, false, 0);
// 2. 创建网络类并纳入这两个网络,颜色用于面板区分(保留现场供观察)
const created = await eda.pcb_Drc.createNetClass('嘉立创示例_网络类', ['JLC_DEMO_P', 'JLC_DEMO_N'], { r: 255, g: 0, b: 0, alpha: 1 });
console.log('created:', created);
```
### createpadpairgroup
# PCB\_Drc.createPadPairGroup() method
> 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.
Create a pad pair group
## Signature
```typescript
function createPadPairGroup(
padPairGroupName: string,
padPairs: Array<[string, string]>,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
padPairGroupName
</td><td>
string
</td><td>
Pad pair group name
</td></tr>
<tr><td>
padPairs
</td><td>
Array<\[string, string\]>
</td><td>
Pad for array
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
There are three different usages, and make sure the corresponding pads already exist on the canvas. They are: 1. Free pad - free pad; 2. Device pad - device pad; 3. Device pad - free pad await eda.pcb\_Drc.createPadPairGroup('test',\[\['e0','e1'\]\]) // 游离焊盘-游离焊盘 await eda.pcb\_Drc.createPadPairGroup('test',\[\['R1:1','R1:2'\],\['R2:1','R2:2'\]\]) // 器件焊盘 - 器件焊盘 await eda.pcb\_Drc.createPadPairGroup('test',\[\['R1:1','e0'\],\['R1:2','e1'\]\]) // 器件焊盘 - 游离焊盘
### deletedifferentialpair
# PCB\_Drc.deleteDifferentialPair() method
> 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.
Delete the differential pair
## Signature
```typescript
function deleteDifferentialPair(differentialPairName: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
differentialPairName
</td><td>
string
</td><td>
Differential pair name
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 生成本次运行专用的网络名和差分对名(网络不能属于其他差分对)
const ts = Date.now();
const netP = `JLC_DEMO_DP_P_${ts}`;
const netN = `JLC_DEMO_DP_N_${ts}`;
// 2. 放带差分网络的焊盘并创建差分对
const x = 3000 + Math.floor(Math.random() * 20000);
await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], netP, null, 0, 0, 0, false, 0);
await eda.pcb_PrimitivePad.create(1, '2', x + 500, 3000, 0, ['ELLIPSE', 60, 60], netN, null, 0, 0, 0, false, 0);
const pairName = `嘉立创示例_待删差分对_${ts}`;
await eda.pcb_Drc.createDifferentialPair(pairName, netP, netN);
// 3. 删除该差分对
const result = await eda.pcb_Drc.deleteDifferentialPair(pairName);
console.log('result:', result);
```
### deleteequallengthnetgroup
# PCB\_Drc.deleteEqualLengthNetGroup() method
> 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.
Delete the equal-length net group
## Signature
```typescript
function deleteEqualLengthNetGroup(equalLengthNetGroupName: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
equalLengthNetGroupName
</td><td>
string
</td><td>
Equal-length net group name
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 建一个待删除的等长网络组(重名创建是幂等的,重复运行也安全)
await eda.pcb_Drc.createEqualLengthNetGroup('嘉立创示例_待删等长组', [], { r: 0, g: 255, b: 0, alpha: 1 });
// 2. 删除该等长网络组
const result = await eda.pcb_Drc.deleteEqualLengthNetGroup('嘉立创示例_待删等长组');
console.log('result:', result);
```
### deletenetclass
# PCB\_Drc.deleteNetClass() method
> 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.
Delete Net class
## Signature
```typescript
function deleteNetClass(netClassName: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
netClassName
</td><td>
string
</td><td>
Net class name
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 建一个待删除的网络类(重名创建是幂等的,重复运行也安全)
await eda.pcb_Drc.createNetClass('嘉立创示例_待删网络类', [], { r: 255, g: 0, b: 0, alpha: 1 });
// 2. 删除该网络类
const result = await eda.pcb_Drc.deleteNetClass('嘉立创示例_待删网络类');
console.log('result:', result);
```
### deletepadpairgroup
# PCB\_Drc.deletePadPairGroup() method
> 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.
Delete the pad pair group
## Signature
```typescript
function deletePadPairGroup(padPairGroupName: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
padPairGroupName
</td><td>
string
</td><td>
Pad pair group name
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
### deleteruleconfiguration
# PCB\_Drc.deleteRuleConfiguration() method
> 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.
Delete Design rule configuration
## Signature
```typescript
function deleteRuleConfiguration(configurationName: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
configurationName
</td><td>
string
</td><td>
Configuration name
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Delete Whether Successful
## Remarks
The system configuration does not allow deletion
## Example
```javascript
// 1. 读取当前配置并保存为待删除的自定义配置
const current = await eda.pcb_Drc.getCurrentRuleConfiguration();
await eda.pcb_Drc.saveRuleConfiguration(current.config, '嘉立创示例_待删配置', true);
// 2. 删除该自定义配置
const result = await eda.pcb_Drc.deleteRuleConfiguration('嘉立创示例_待删配置');
console.log('result:', result);
```
### getalldifferentialpairs
# PCB\_Drc.getAllDifferentialPairs() method
> 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.
Get the detailed properties of all differential pairs
## Signature
```typescript
function getAllDifferentialPairs(): Promise<Array<IPCB_DifferentialPairItem> | Record<string, any>>;
```
## Returns
Promise<Array<[IPCB\_DifferentialPairItem](../interfaces/IPCB_DifferentialPairItem.md)<!-- -->> \| Record<string, any>>
Detailed properties of all differential pairs
## Remarks
- The return value type is changed to an object BREAKING CHANGE since EDA v3.4
## Example
```javascript
// 1. 生成本次运行专用的网络名和差分对名,创建测试差分对
const ts = Date.now();
const netP = `JLC_DEMO_DP_P_${ts}`;
const netN = `JLC_DEMO_DP_N_${ts}`;
const x = 3000 + Math.floor(Math.random() * 20000);
await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], netP, null, 0, 0, 0, false, 0);
await eda.pcb_PrimitivePad.create(1, '2', x + 500, 3000, 0, ['ELLIPSE', 60, 60], netN, null, 0, 0, 0, false, 0);
const pairName = `嘉立创示例_查询差分对_${ts}`;
await eda.pcb_Drc.createDifferentialPair(pairName, netP, netN);
// 2. 查询所有差分对(v3.4 起返回结构可能为数组或对象,先按数组遍历)
const pairs = await eda.pcb_Drc.getAllDifferentialPairs();
const list = Array.isArray(pairs) ? pairs : Object.values(pairs);
console.log('count:', list.length);
list.forEach((p, i) => {
console.log(`[${i}] name:`, p.name, 'positiveNet:', p.positiveNet, 'negativeNet:', p.negativeNet);
});
// 3. 清理测试差分对(查询类清理现场)
await eda.pcb_Drc.deleteDifferentialPair(pairName);
```
### getallequallengthnetgroups
# PCB\_Drc.getAllEqualLengthNetGroups() method
> 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.
Get the detailed properties of all equal-length net groups
## Signature
```typescript
function getAllEqualLengthNetGroups(): Promise<Array<IPCB_EqualLengthNetGroupItem>>;
```
## Returns
Promise<Array<[IPCB\_EqualLengthNetGroupItem](../interfaces/IPCB_EqualLengthNetGroupItem.md)<!-- -->>>
Detailed properties of all equal-length net groups
## Example
```javascript
// 1. 建一个测试等长组作为查询对象
await eda.pcb_Drc.createEqualLengthNetGroup('嘉立创示例_查询等长组', [], { r: 0, g: 255, b: 0, alpha: 1 });
// 2. 查询所有等长网络组
const groups = await eda.pcb_Drc.getAllEqualLengthNetGroups();
console.log('count:', groups.length);
groups.forEach((g, i) => {
console.log(`[${i}] name:`, g.name);
});
// 3. 清理测试等长组(查询类清理现场)
await eda.pcb_Drc.deleteEqualLengthNetGroup('嘉立创示例_查询等长组');
```
### getallnetclasses
# PCB\_Drc.getAllNetClasses() method
> 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.
Get all Net class detailed properties of
## Signature
```typescript
function getAllNetClasses(): Promise<Array<IPCB_NetClassItem>>;
```
## Returns
Promise<Array<[IPCB\_NetClassItem](../interfaces/IPCB_NetClassItem.md)<!-- -->>>
Detailed properties of all net classes
## Example
```javascript
// 1. 建一个测试网络类作为查询对象
await eda.pcb_Drc.createNetClass('嘉立创示例_查询网络类', [], { r: 255, g: 0, b: 0, alpha: 1 });
// 2. 查询所有网络类
const classes = await eda.pcb_Drc.getAllNetClasses();
console.log('count:', classes.length);
classes.forEach((c, i) => {
console.log(`[${i}] name:`, c.name);
});
// 3. 清理测试网络类(查询类清理现场)
await eda.pcb_Drc.deleteNetClass('嘉立创示例_查询网络类');
```
### getallpadpairgroups
# PCB\_Drc.getAllPadPairGroups() method
> 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.
Get the detailed properties of all pad pair groups
## Signature
```typescript
function getAllPadPairGroups(): Promise<Array<IPCB_PadPairGroupItem>>;
```
## Returns
Promise<Array<[IPCB\_PadPairGroupItem](../interfaces/IPCB_PadPairGroupItem.md)<!-- -->>>
Detailed properties of all pad pair groups
## Example
```javascript
// 1. 查询所有焊盘对组
const groups = await eda.pcb_Drc.getAllPadPairGroups();
// 2. 输出每个组的名称和焊盘对
console.log('count:', groups.length);
groups.forEach((g, i) => {
console.log(`[${i}] name:`, g.name);
g.padPairs.forEach((pair, j) => {
console.log(` pair[${j}]:`, pair[0], '↔', pair[1]);
});
});
```
### getallruleconfigurations
# PCB\_Drc.getAllRuleConfigurations() method
> 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.
Get all Design rule configuration
## Signature
```typescript
function getAllRuleConfigurations(includeSystem?: boolean): Promise<Array<Record<string, any>>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
includeSystem
</td><td>
boolean
</td><td>
_(Optional)_ Whether Get System design rule configuration
</td></tr>
</tbody></table>
## Returns
Promise<Array<Record<string, any>>>
All design rule configurations
## Example
```javascript
// 1. 查询全部设计规则配置(含系统配置)
const all = await eda.pcb_Drc.getAllRuleConfigurations(true);
// 2. 输出配置数量和名称
console.log('count:', all.length);
all.forEach((c, i) => {
console.log(`[${i}] name:`, c.name);
});
```
### getcurrentruleconfiguration
# PCB\_Drc.getCurrentRuleConfiguration() method
> 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.
Get Current design rule configuration
## Signature
```typescript
function getCurrentRuleConfiguration(): Promise<Record<string, any> | undefined>;
```
## Returns
Promise<Record<string, any> \| undefined>
Current design rule configuration; `undefined` indicates that the retrieval failed
### getcurrentruleconfigurationname
# PCB\_Drc.getCurrentRuleConfigurationName() method
Get Current design rule configuration name
## Signature
```typescript
function getCurrentRuleConfigurationName(): Promise<string | undefined>;
```
## Returns
Promise<string \| undefined>
Current design rule configuration name; `undefined` indicates that the retrieval failed
### getdefaultruleconfigurationname
# PCB\_Drc.getDefaultRuleConfigurationName() method
> 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.
Get the name of the default design rule configuration for new PCBs
## Signature
```typescript
function getDefaultRuleConfigurationName(): Promise<string | undefined>;
```
## Returns
Promise<string \| undefined>
Default design rule configuration name of; `undefined` indicates that the retrieval failed
### getnetbynetrules
# PCB\_Drc.getNetByNetRules() method
> 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.
Get Net - net rules
## Signature
```typescript
function getNetByNetRules(): Promise<Record<string, any>>;
```
## Returns
Promise<Record<string, any>>
All net-by-net rules of the current PCB
### getnetrules
# PCB\_Drc.getNetRules() method
> 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.
Get Net rules
## Signature
```typescript
function getNetRules(): Promise<Array<Record<string, any>>>;
```
## Returns
Promise<Array<Record<string, any>>>
All net rules of the current PCB
### getpadpairgroupminwirelength
# PCB\_Drc.getPadPairGroupMinWireLength() method
> 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.
Get the minimum wire length of a pad pair group
## Signature
```typescript
function getPadPairGroupMinWireLength(
padPairGroupName: string,
): Promise<Array<IPCB_PadPairMinWireLengthItem>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
padPairGroupName
</td><td>
string
</td><td>
Pad pair group name
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PadPairMinWireLengthItem](../interfaces/IPCB_PadPairMinWireLengthItem.md)<!-- -->>>
The minimum wire lengths of all pad pairs
### getrealtimedrcstatus
# PCB\_Drc.getRealTimeDrcStatus() method
> 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.
Get Real-time DRC check state
## Signature
```typescript
function getRealTimeDrcStatus(): Promise<boolean>;
```
## Returns
Promise<boolean>
Real-time DRC check status. If real-time DRC is stopped, not in a PCB, or the retrieval fails, `false` is returned
## Remarks
ADD since EDA v4.2
### getregionrules
# PCB\_Drc.getRegionRules() method
> 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.
Get region rules
## Signature
```typescript
function getRegionRules(): Promise<Array<Record<string, any>>>;
```
## Returns
Promise<Array<Record<string, any>>>
- All region rules of the current PCB
### getruleconfiguration
# PCB\_Drc.getRuleConfiguration() method
Get Specify design rule configuration
## Signature
```typescript
function getRuleConfiguration(configurationName: string): Promise<Record<string, any> | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
configurationName
</td><td>
string
</td><td>
Configuration name
</td></tr>
</tbody></table>
## Returns
Promise<Record<string, any> \| undefined>
Design rule configuration, `undefined` is does not exist this design rules
### modifydifferentialpairname
# PCB\_Drc.modifyDifferentialPairName() method
> 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.
Modify the name of the differential pair
## Signature
```typescript
function modifyDifferentialPairName(
originalDifferentialPairName: string,
differentialPairName: string,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
originalDifferentialPairName
</td><td>
string
</td><td>
Original differential pair name
</td></tr>
<tr><td>
differentialPairName
</td><td>
string
</td><td>
New differential pair name
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 生成本次运行专用的网络名和差分对名(网络不能属于其他差分对)
const ts = Date.now();
const netP = `JLC_DEMO_DP_P_${ts}`;
const netN = `JLC_DEMO_DP_N_${ts}`;
// 2. 放带差分网络的焊盘并创建差分对
const x = 3000 + Math.floor(Math.random() * 20000);
await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], netP, null, 0, 0, 0, false, 0);
await eda.pcb_PrimitivePad.create(1, '2', x + 500, 3000, 0, ['ELLIPSE', 60, 60], netN, null, 0, 0, 0, false, 0);
const pairName = `嘉立创示例_差分对_${ts}`;
await eda.pcb_Drc.createDifferentialPair(pairName, netP, netN);
// 3. 改名(保留现场供观察)
const newName = `嘉立创示例_差分对_改_${ts}`;
const result = await eda.pcb_Drc.modifyDifferentialPairName(pairName, newName);
console.log('newName:', newName);
console.log('result:', result);
```
### modifydifferentialpairnegativenet
# PCB\_Drc.modifyDifferentialPairNegativeNet() method
> 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.
Modify the negative net of the differential pair
## Signature
```typescript
function modifyDifferentialPairNegativeNet(
differentialPairName: string,
negativeNet: string,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
differentialPairName
</td><td>
string
</td><td>
Differential pair name
</td></tr>
<tr><td>
negativeNet
</td><td>
string
</td><td>
Negative net name
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 生成本次运行专用的网络名(避免与其他差分对冲突)
const ts = Date.now();
const netP = `JLC_DEMO_DP_P_${ts}`;
const netN = `JLC_DEMO_DP_N_${ts}`;
const newNetN = `JLC_DEMO_DP_N2_${ts}`;
// 2. 放三个带网络的焊盘并创建差分对
const x = 3000 + Math.floor(Math.random() * 20000);
await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], netP, null, 0, 0, 0, false, 0);
await eda.pcb_PrimitivePad.create(1, '2', x + 500, 3000, 0, ['ELLIPSE', 60, 60], netN, null, 0, 0, 0, false, 0);
await eda.pcb_PrimitivePad.create(1, '3', x + 1000, 3000, 0, ['ELLIPSE', 60, 60], newNetN, null, 0, 0, 0, false, 0);
const pairName = `嘉立创示例_差分对_${ts}`;
await eda.pcb_Drc.createDifferentialPair(pairName, netP, netN);
// 3. 把负网络替换为 newNetN(保留现场供观察)
const result = await eda.pcb_Drc.modifyDifferentialPairNegativeNet(pairName, newNetN);
console.log('newNegativeNet:', newNetN);
console.log('result:', result);
```
### modifydifferentialpairpositivenet
# PCB\_Drc.modifyDifferentialPairPositiveNet() method
> 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.
Modify the positive net of the differential pair
## Signature
```typescript
function modifyDifferentialPairPositiveNet(
differentialPairName: string,
positiveNet: string,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
differentialPairName
</td><td>
string
</td><td>
Differential pair name
</td></tr>
<tr><td>
positiveNet
</td><td>
string
</td><td>
Positive net name
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 生成本次运行专用的网络名(避免与其他差分对冲突)
const ts = Date.now();
const netP = `JLC_DEMO_DP_P_${ts}`;
const netN = `JLC_DEMO_DP_N_${ts}`;
const newNetP = `JLC_DEMO_DP_P2_${ts}`;
// 2. 放三个带网络的焊盘并创建差分对
const x = 3000 + Math.floor(Math.random() * 20000);
await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], netP, null, 0, 0, 0, false, 0);
await eda.pcb_PrimitivePad.create(1, '2', x + 500, 3000, 0, ['ELLIPSE', 60, 60], netN, null, 0, 0, 0, false, 0);
await eda.pcb_PrimitivePad.create(1, '3', x + 1000, 3000, 0, ['ELLIPSE', 60, 60], newNetP, null, 0, 0, 0, false, 0);
const pairName = `嘉立创示例_差分对_${ts}`;
await eda.pcb_Drc.createDifferentialPair(pairName, netP, netN);
// 3. 把正网络替换为 newNetP(保留现场供观察)
const result = await eda.pcb_Drc.modifyDifferentialPairPositiveNet(pairName, newNetP);
console.log('newPositiveNet:', newNetP);
console.log('result:', result);
```
### modifyequallengthnetgroupname
# PCB\_Drc.modifyEqualLengthNetGroupName() method
> 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.
Modify the name of the equal-length net group
## Signature
```typescript
function modifyEqualLengthNetGroupName(
originalEqualLengthNetGroupName: string,
equalLengthNetGroupName: string,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
originalEqualLengthNetGroupName
</td><td>
string
</td><td>
Original equal-length net group name
</td></tr>
<tr><td>
equalLengthNetGroupName
</td><td>
string
</td><td>
New equal-length net group name
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 建一个待改名的等长网络组
await eda.pcb_Drc.createEqualLengthNetGroup('嘉立创示例_等长网络组', [], { r: 0, g: 255, b: 0, alpha: 1 });
// 2. 改名(用时间戳后缀避免与之前保留的现场重名,保留现场供观察)
const newName = `嘉立创示例_等长网络组_改_${Date.now()}`;
const result = await eda.pcb_Drc.modifyEqualLengthNetGroupName('嘉立创示例_等长网络组', newName);
console.log('newName:', newName);
console.log('result:', result);
```
### modifynetclassname
# PCB\_Drc.modifyNetClassName() method
> 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.
Modify Net class name of
## Signature
```typescript
function modifyNetClassName(originalNetClassName: string, netClassName: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
originalNetClassName
</td><td>
string
</td><td>
Original net class name
</td></tr>
<tr><td>
netClassName
</td><td>
string
</td><td>
New net class name
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 建一个待改名的网络类
await eda.pcb_Drc.createNetClass('嘉立创示例_网络类', [], { r: 255, g: 0, b: 0, alpha: 1 });
// 2. 改名(用时间戳后缀避免与之前保留的现场重名,保留现场供观察)
const newName = `嘉立创示例_网络类_改_${Date.now()}`;
const result = await eda.pcb_Drc.modifyNetClassName('嘉立创示例_网络类', newName);
console.log('newName:', newName);
console.log('result:', result);
```
### modifypadpairgroupname
# PCB\_Drc.modifyPadPairGroupName() method
> 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.
Modify the name of the pad pair group
## Signature
```typescript
function modifyPadPairGroupName(
originalPadPairGroupName: string,
padPairGroupName: string,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
originalPadPairGroupName
</td><td>
string
</td><td>
Original pad pair group name
</td></tr>
<tr><td>
padPairGroupName
</td><td>
string
</td><td>
New pad pair group name
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
### overwritecurrentruleconfiguration
# PCB\_Drc.overwriteCurrentRuleConfiguration() method
> 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.
Overwrite current design rule configuration
## Signature
```typescript
function overwriteCurrentRuleConfiguration(
ruleConfiguration: Record<string, any>,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
ruleConfiguration
</td><td>
Record<string, any>
</td><td>
Design rule configuration
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Overwrite whether it is successful
## Remarks
It will overwrite the current design rule configuration of the PCB. Please note the risk of data loss
## Example
```javascript
// 1. 读取当前设计规则配置(返回 { config, name },规则数据在 config 里)
const current = await eda.pcb_Drc.getCurrentRuleConfiguration();
// 2. 整体写回当前配置(原样写回演示覆写成功,实际使用时可先修改 config 中的字段)
const result = await eda.pcb_Drc.overwriteCurrentRuleConfiguration(current.config);
console.log('configName:', current.name);
console.log('result:', result);
```
### overwritenetbynetrules
# PCB\_Drc.overwriteNetByNetRules() method
> 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.
Overwrite net - net rules
## Signature
```typescript
function overwriteNetByNetRules(netByNetRules: Record<string, any>): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
netByNetRules
</td><td>
Record<string, any>
</td><td>
Net - net rules
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Overwrite whether it is successful
## Remarks
It will overwrite all net-by-net rules of the current PCB. Please note the risk of data loss
## Example
```javascript
// 1. 读取当前所有网络-网络规则(对象,键是规则类别名)
const netByNetRules = await eda.pcb_Drc.getNetByNetRules();
// 2. 整体写回(原样写回演示覆写成功,实际使用时可先修改对象字段)
const result = await eda.pcb_Drc.overwriteNetByNetRules(netByNetRules);
console.log('ruleKeys:', Object.keys(netByNetRules).join(', '));
console.log('result:', result);
```
### overwritenetrules
# PCB\_Drc.overwriteNetRules() method
> 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.
Overwrite net rules
## Signature
```typescript
function overwriteNetRules(netRules: Array<Record<string, any>>): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
netRules
</td><td>
Array<Record<string, any>>
</td><td>
Net rules
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Overwrite whether it is successful
## Remarks
It will overwrite all net rules of the current PCB. Please note the risk of data loss
## Example
```javascript
// 1. 读取当前所有网络规则(数组)
const netRules = await eda.pcb_Drc.getNetRules();
// 2. 整体写回(原样写回演示覆写成功,实际使用时可先增删改数组元素)
const result = await eda.pcb_Drc.overwriteNetRules(netRules);
console.log('ruleCount:', netRules.length);
console.log('result:', result);
```
### overwriteregionrules
# PCB\_Drc.overwriteRegionRules() method
> 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.
Overwrite region rules
## Signature
```typescript
function overwriteRegionRules(regionRules: Array<Record<string, any>>): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
regionRules
</td><td>
Array<Record<string, any>>
</td><td>
Region rules
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Overwrite whether it is successful
## Remarks
It will overwrite all region rules of the current PCB. Please note the risk of data loss
## Example
```javascript
// 1. 读取当前所有区域规则(数组)
const regionRules = await eda.pcb_Drc.getRegionRules();
// 2. 整体写回(原样写回演示覆写成功,实际使用时可先增删改数组元素)
const result = await eda.pcb_Drc.overwriteRegionRules(regionRules);
console.log('ruleCount:', regionRules.length);
console.log('result:', result);
```
### removenetfromequallengthnetgroup
# PCB\_Drc.removeNetFromEqualLengthNetGroup() method
> 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.
Remove a net from an equal-length net group
## Signature
```typescript
function removeNetFromEqualLengthNetGroup(
equalLengthNetGroupName: string,
net: string | Array<string>,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
equalLengthNetGroupName
</td><td>
string
</td><td>
Equal-length net group name
</td></tr>
<tr><td>
net
</td><td>
string \| Array<string>
</td><td>
Net name
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 准备两个真实网络(放带网络的测试焊盘)
const x = 3000 + Math.floor(Math.random() * 20000);
await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], 'JLC_DEMO_D0', null, 0, 0, 0, false, 0);
await eda.pcb_PrimitivePad.create(1, '2', x + 500, 3000, 0, ['ELLIPSE', 60, 60], 'JLC_DEMO_D1', null, 0, 0, 0, false, 0);
// 2. 建等长组并纳入网络
await eda.pcb_Drc.createEqualLengthNetGroup('嘉立创示例_等长网络组', ['JLC_DEMO_D0', 'JLC_DEMO_D1'], { r: 0, g: 255, b: 0, alpha: 1 });
// 3. 先单个移除,再批量移除
const removedOne = await eda.pcb_Drc.removeNetFromEqualLengthNetGroup('嘉立创示例_等长网络组', 'JLC_DEMO_D0');
const removedBatch = await eda.pcb_Drc.removeNetFromEqualLengthNetGroup('嘉立创示例_等长网络组', ['JLC_DEMO_D1']);
console.log('removedOne:', removedOne);
console.log('removedBatch:', removedBatch);
```
### removenetfromnetclass
# PCB\_Drc.removeNetFromNetClass() method
> 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.
From net class in remove net
## Signature
```typescript
function removeNetFromNetClass(netClassName: string, net: string | Array<string>): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
netClassName
</td><td>
string
</td><td>
Net class name
</td></tr>
<tr><td>
net
</td><td>
string \| Array<string>
</td><td>
Net name
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 准备两个真实网络(放带网络的测试焊盘)
const x = 3000 + Math.floor(Math.random() * 20000);
await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], 'JLC_DEMO_P', null, 0, 0, 0, false, 0);
await eda.pcb_PrimitivePad.create(1, '2', x + 500, 3000, 0, ['ELLIPSE', 60, 60], 'JLC_DEMO_N', null, 0, 0, 0, false, 0);
// 2. 建网络类并纳入网络
await eda.pcb_Drc.createNetClass('嘉立创示例_网络类', ['JLC_DEMO_P', 'JLC_DEMO_N'], { r: 255, g: 0, b: 0, alpha: 1 });
// 3. 先单个移除,再批量移除
const removedOne = await eda.pcb_Drc.removeNetFromNetClass('嘉立创示例_网络类', 'JLC_DEMO_P');
const removedBatch = await eda.pcb_Drc.removeNetFromNetClass('嘉立创示例_网络类', ['JLC_DEMO_N']);
console.log('removedOne:', removedOne);
console.log('removedBatch:', removedBatch);
```
### removepadpairfrompadpairgroup
# PCB\_Drc.removePadPairFromPadPairGroup() method
> 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.
Remove a pad pair from a pad pair group
## Signature
```typescript
function removePadPairFromPadPairGroup(
padPairGroupName: string,
padPair: [string, string] | Array<[string, string]>,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
padPairGroupName
</td><td>
string
</td><td>
Pad pair group name
</td></tr>
<tr><td>
padPair
</td><td>
\[string, string\] \| Array<\[string, string\]>
</td><td>
Pad for
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
There are three different usages, and make sure the corresponding pads already exist on the canvas. They are: 1. Free pad - free pad; 2. Device pad - device pad; 3. Device pad - free pad await eda.pcb\_Drc.removePadPairFromPadPairGroup('test',\['e0','e1'\]) // 游离焊盘-游离焊盘 await eda.pcb\_Drc.removePadPairFromPadPairGroup('test',\['R1:1','R1:2'\]) // 器件焊盘 - 器件焊盘 await eda.pcb\_Drc.removePadPairFromPadPairGroup('test',\['R1:2','e1'\]) // 器件焊盘 - 游离焊盘
### renameruleconfiguration
# PCB\_Drc.renameRuleConfiguration() method
> 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.
Rename the design rule configuration
## Signature
```typescript
function renameRuleConfiguration(
originalConfigurationName: string,
configurationName: string,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
originalConfigurationName
</td><td>
string
</td><td>
Original design rule configuration name
</td></tr>
<tr><td>
configurationName
</td><td>
string
</td><td>
New design rule configuration name
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the rename was successful
## Remarks
Only custom configurations can be renamed. System configurations cannot be renamed
## Example
```javascript
// 1. 读取当前配置并保存为待改名的自定义配置(allowOverwrite=true 重复运行安全)
const current = await eda.pcb_Drc.getCurrentRuleConfiguration();
await eda.pcb_Drc.saveRuleConfiguration(current.config, '嘉立创示例_待改配置', true);
// 2. 静默清掉上次运行保留的目标名(首次运行时目标不存在,删除返回 false 属正常)
await eda.pcb_Drc.deleteRuleConfiguration('嘉立创示例_改名后配置');
// 3. 重命名(保留现场供观察)
const result = await eda.pcb_Drc.renameRuleConfiguration('嘉立创示例_待改配置', '嘉立创示例_改名后配置');
console.log('result:', result);
```
### saveruleconfiguration
# PCB\_Drc.saveRuleConfiguration() method
> 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.
Save Design rule configuration
## Signature
```typescript
function saveRuleConfiguration(
ruleConfiguration: Record<string, any>,
configurationName: string,
allowOverwrite?: boolean,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
ruleConfiguration
</td><td>
Record<string, any>
</td><td>
Design rule configuration
</td></tr>
<tr><td>
configurationName
</td><td>
string
</td><td>
Configuration name
</td></tr>
<tr><td>
allowOverwrite
</td><td>
boolean
</td><td>
_(Optional)_ Whether to allow overwriting a design rule configuration with the same name. If `false`<!-- -->, `false` will be returned when a configuration with the same name is encountered. Please note the possible risk of data loss
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Save Whether Successful
## Remarks
Only custom configurations can be overwritten and saved. System configurations cannot be modified or overwritten
## Example
```javascript
// 1. 读取当前设计规则配置作为数据源(规则数据在 config 字段里)
const current = await eda.pcb_Drc.getCurrentRuleConfiguration();
// 2. 另存为自定义配置,允许同名覆盖(保留现场供观察)
const saved = await eda.pcb_Drc.saveRuleConfiguration(current.config, '嘉立创示例_规则配置', true);
console.log('saved:', saved);
```
### setasdefaultruleconfiguration
# PCB\_Drc.setAsDefaultRuleConfiguration() method
> 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.
Set as the default design rule configuration for new PCBs
## Signature
```typescript
function setAsDefaultRuleConfiguration(configurationName: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
configurationName
</td><td>
string
</td><td>
Configuration name
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Set Whether Successful
## Remarks
The return value is result-oriented. Repeatedly setting the same design rule as the default will also return `true`
## Example
```javascript
// 1. 读取当前配置并保存为自定义配置(作为待指定的默认配置)
const current = await eda.pcb_Drc.getCurrentRuleConfiguration();
await eda.pcb_Drc.saveRuleConfiguration(current.config, '嘉立创示例_默认规则配置', true);
// 2. 把它设置为新建 PCB 的默认设计规则配置
const result = await eda.pcb_Drc.setAsDefaultRuleConfiguration('嘉立创示例_默认规则配置');
console.log('result:', result);
```
### startrealtimedrc
# PCB\_Drc.startRealTimeDrc() method
> 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.
Start real-time DRC check
## Signature
```typescript
function startRealTimeDrc(): Promise<boolean>;
```
## Returns
Promise<boolean>
Whether Successful enable real-time DRC check
## Remarks
The return value of this API is result-oriented. If real-time DRC check was already enabled before calling this API, `true` will also be returned ADD since EDA v4.2
### stoprealtimedrc
# PCB\_Drc.stopRealTimeDrc() method
> 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.
Stop real-time DRC check
## Signature
```typescript
function stopRealTimeDrc(): Promise<boolean>;
```
## Returns
Promise<boolean>
Whether real-time DRC check was successfully disabled
## Remarks
The return value of this API is result-oriented. If real-time DRC check was already disabled before calling this API, `true` will also be returned ADD since EDA v4.2
references/classes/PCB_ManufactureData.md
# PCB\_ManufactureData class
PCB & footprint / manufacture data class
## Signature
```typescript
class PCB_ManufactureData
```
## Remarks
Get the manufacture data files of the current PCB and quick ordering
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[deleteBomTemplate(template)](./PCB_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Delete BOM template
</td></tr>
<tr><td>
[get3DFile(fileName, fileType, element, modelMode, autoGenerateModels)](./PCB_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Get 3D model file
</td></tr>
<tr><td>
[get3DShellFile(fileName, fileType)](./PCB_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Get the 3D shell file
</td></tr>
<tr><td>
[getAltiumDesignerFile(fileName)](./PCB_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Get Altium Designer file
</td></tr>
<tr><td>
[getAutoLayoutJsonFile(fileName)](./PCB_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Get Auto layout file (JSON)
</td></tr>
<tr><td>
[getAutoRouteJsonFile(fileName)](./PCB_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Get Auto routing file (JSON)
</td></tr>
<tr><td>
[getAutoRouteJsonFileForJRouter(fileName)](./PCB_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Get the JRouter-specific auto routing file (JSON)
</td></tr>
<tr><td>
[getBomFile(fileName, fileType, template, filterOptions, statistics, property, columns)](./PCB_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Get BOM file
</td></tr>
<tr><td>
[getBomTemplateFile(template)](./PCB_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Get BOM template file
</td></tr>
<tr><td>
[getBomTemplates()](./PCB_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Get BOM template list
</td></tr>
<tr><td>
[getDsnFile(fileName)](./PCB_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Get Auto routing file (DSN)
</td></tr>
<tr><td>
[getDxfFile(fileName, layers, objects)](./PCB_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Get DXF file
</td></tr>
<tr><td>
[getFlyingProbeTestFile(fileName)](./PCB_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Get the flying probe test file
</td></tr>
<tr><td>
[getGerberFile(fileName, colorSilkscreen, unit, digitalFormat, other, layers, objects)](./PCB_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Get the PCB fabrication file (Gerber)
</td></tr>
<tr><td>
[getIdxFile(fileName)](./PCB_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Get IDX file
</td></tr>
<tr><td>
[getIpc2581CFile(fileName, fileType, unit, oemNumber)](./PCB_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Get IPC-2581C file
</td></tr>
<tr><td>
[getIpcD356AFile(fileName)](./PCB_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Get IPC-D-356A file
</td></tr>
<tr><td>
[getManufactureData()](./PCB_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Export the manufacture data
</td></tr>
<tr><td>
[getNetlistFile(fileName, netlistType)](./PCB_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Get the netlist file (Netlist)
</td></tr>
<tr><td>
[getOpenDatabaseDoublePlusFile(fileName, unit, otherData, layers, objects)](./PCB_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Get ODB++ file
</td></tr>
<tr><td>
[getPadsFile(fileName)](./PCB_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Get PADS file
</td></tr>
<tr><td>
[getPcbInfoFile(fileName)](./PCB_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Get PCB information file
</td></tr>
<tr><td>
[getPdfFile(fileName, outputMethod, contentConfig, watermark, graphPageConfig)](./PCB_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Get PDF file
</td></tr>
<tr><td>
[getPickAndPlaceFile(fileName, fileType, unit)](./PCB_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Get Coordinate file (PickAndPlace)
</td></tr>
<tr><td>
[getTestPointFile(fileName, fileType)](./PCB_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Get the test point report file
</td></tr>
<tr><td>
[place3DShellOrder(interactive, ignoreWarning)](./PCB_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** 3D shell ordering
</td></tr>
<tr><td>
[placeComponentsOrder(interactive, ignoreWarning)](./PCB_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Component ordering
</td></tr>
<tr><td>
[placePcbOrder(interactive, ignoreWarning)](./PCB_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** PCB ordering
</td></tr>
<tr><td>
[placeSmtComponentsOrder(interactive, ignoreWarning)](./PCB_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** SMT component ordering
</td></tr>
<tr><td>
[uploadBomTemplateFile(templateFile, template)](./PCB_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Upload a BOM template file
</td></tr>
</tbody></table>
---
## 方法详情
### deletebomtemplate
# PCB\_ManufactureData.deleteBomTemplate() method
> 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.
Delete BOM template
## Signature
```typescript
function deleteBomTemplate(template: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
template
</td><td>
string
</td><td>
BOM template name
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 删除指定的 BOM 模板
const success = await eda.pcb_ManufactureData.deleteBomTemplate('MyCustomTemplate');
if (success) {
console.log('BOM 模板删除成功');
}
else {
console.log('删除失败,可能是默认模板或模板不存在');
}
```
### get3dfile
# PCB\_ManufactureData.get3DFile() method
> 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.
Get 3D model file
## Signature
```typescript
function get3DFile(
fileName?: string,
fileType?: 'step' | 'obj',
element?: Array<'Component Model' | 'Via' | 'Silkscreen' | 'Wire In Signal Layer'>,
modelMode?: 'Outfit' | 'Parts',
autoGenerateModels?: boolean,
): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_ File name
</td></tr>
<tr><td>
fileType
</td><td>
'step' \| 'obj'
</td><td>
_(Optional)_ File type
</td></tr>
<tr><td>
element
</td><td>
Array<'Component Model' \| 'Via' \| 'Silkscreen' \| 'Wire In Signal Layer'>
</td><td>
_(Optional)_ Exported objects
</td></tr>
<tr><td>
modelMode
</td><td>
'Outfit' \| 'Parts'
</td><td>
_(Optional)_ Export mode. `Outfit` = assembly, `Parts` = parts
</td></tr>
<tr><td>
autoGenerateModels
</td><td>
boolean
</td><td>
_(Optional)_ Whether to automatically generate a 3D model for components not bound to a 3D model (based on the "height" property of the component)
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
3D model file data
## Remarks
Please note: only component models imported in STEP format can be reflected in the exported STEP file
You can use [SYS\_FileSystem.saveFile()](./SYS_FileSystem.md) API export the file to the local file system
## Example
```javascript
// 导出装配体模式的 STEP 文件(包含元件模型)
const stepFile = await eda.pcb_ManufactureData.get3DFile(
'MyBoard_3D',
'step',
['Component Model'],
'Outfit',
true
);
if (stepFile) {
await eda.sys_FileSystem.saveFile(stepFile);
}
// 导出包含多种对象的完整 3D 模型
const full3DFile = await eda.pcb_ManufactureData.get3DFile(
'Complete_3D_Model',
'step',
['Component Model', 'Via', 'Silkscreen', 'Wire In Signal Layer'],
'Outfit',
true
);
// 导出零件模式 OBJ 文件
const objFile = await eda.pcb_ManufactureData.get3DFile(
'MyBoard_OBJ',
'obj',
['Component Model'],
'Parts',
false
);
```
### get3dshellfile
# PCB\_ManufactureData.get3DShellFile() method
> 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.
Get the 3D shell file
## Signature
```typescript
function get3DShellFile(
fileName?: string,
fileType?: 'stl' | 'step' | 'obj',
): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_ File name
</td></tr>
<tr><td>
fileType
</td><td>
'stl' \| 'step' \| 'obj'
</td><td>
_(Optional)_ File type
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
3D shell file data
## Remarks
You can use [SYS\_FileSystem.saveFile()](./SYS_FileSystem.md) API export the file to the local file system
## Example
```javascript
// 导出 STL 格式 3D 外壳
const stlFile = await eda.pcb_ManufactureData.get3DShellFile('Board_Shell', 'stl');
if (stlFile) {
await eda.sys_FileSystem.saveFile(stlFile);
}
// 导出 STEP 格式 3D 外壳
const stepShellFile = await eda.pcb_ManufactureData.get3DShellFile('Board_Shell_STEP', 'step');
if (stepShellFile) {
await eda.sys_FileSystem.saveFile(stepShellFile);
}
```
### getaltiumdesignerfile
# PCB\_ManufactureData.getAltiumDesignerFile() method
> 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.
Get Altium Designer file
## Signature
```typescript
function getAltiumDesignerFile(fileName?: string): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_ File name
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
Altium Designer file data
## Remarks
You can use [SYS\_FileSystem.saveFile()](./SYS_FileSystem.md) API export the file to the local file system
## Example
```javascript
// 获取 Altium Designer 格式文件
const adFile = await eda.pcb_ManufactureData.getAltiumDesignerFile('Converted_To_AD');
if (adFile) {
await eda.sys_FileSystem.saveFile(adFile);
}
```
### getautolayoutjsonfile
# PCB\_ManufactureData.getAutoLayoutJsonFile() method
> 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.
Get Auto layout file (JSON)
## Signature
```typescript
function getAutoLayoutJsonFile(fileName?: string): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_ File name
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
Auto layout JSON file data
## Remarks
You can use [SYS\_FileSystem.saveFile()](./SYS_FileSystem.md) API export the file to the local file system
## Example
```javascript
const autoLayoutJson = await eda.pcb_ManufactureData.getAutoLayoutJsonFile('AutoLayout_Json');
if (autoLayoutJson) {
await eda.sys_FileSystem.saveFile(autoLayoutJson);
}
```
### getautoroutejsonfile
# PCB\_ManufactureData.getAutoRouteJsonFile() method
> 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.
Get Auto routing file (JSON)
## Signature
```typescript
function getAutoRouteJsonFile(fileName?: string): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_ File name
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
Auto routing JSON file data
## Remarks
You can use [SYS\_FileSystem.saveFile()](./SYS_FileSystem.md) API export the file to the local file system
## Example
```javascript
const autoRouteJson = await eda.pcb_ManufactureData.getAutoRouteJsonFile('AutoRoute_Json');
if (autoRouteJson) {
await eda.sys_FileSystem.saveFile(autoRouteJson);
}
```
### getautoroutejsonfileforjrouter
# PCB\_ManufactureData.getAutoRouteJsonFileForJRouter() method
> 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.
Get the JRouter-specific auto routing file (JSON)
## Signature
```typescript
function getAutoRouteJsonFileForJRouter(fileName?: string): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_ File name
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
Auto routing JSON file data
## Remarks
You can use [SYS\_FileSystem.saveFile()](./SYS_FileSystem.md) API export the file to the local file system
## Example
```javascript
// 1. 导出 JRouter 专用自动布线 JSON 文件(参数为目标文件名)
const jrouterFile = await eda.pcb_ManufactureData.getAutoRouteJsonFileForJRouter('嘉立创示例_JRouter');
// 2. 查看导出结果
console.log('导出文件名:', jrouterFile?.name);
console.log('文件大小:', jrouterFile?.size);
```
### getbomfile
# PCB\_ManufactureData.getBomFile() method
> 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.
Get BOM file
## Signature
```typescript
function getBomFile(
fileName?: string,
fileType?: 'xlsx' | 'csv',
template?: string,
filterOptions?: Array<{ property: string; includeValue: boolean | string }>,
statistics?: Array<string>,
property?: Array<string>,
columns?: Array<IPCB_BomPropertiesTableColumns>,
): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_ File name
</td></tr>
<tr><td>
fileType
</td><td>
'xlsx' \| 'csv'
</td><td>
_(Optional)_ File type
</td></tr>
<tr><td>
template
</td><td>
string
</td><td>
_(Optional)_ Template name
</td></tr>
<tr><td>
filterOptions
</td><td>
Array<{ property: string; includeValue: boolean \| string }>
</td><td>
_(Optional)_ Filter rules, which should only contain the rules to be enabled. `property` is the rule name, and `includeValue` is the matched value
</td></tr>
<tr><td>
statistics
</td><td>
Array<string>
</td><td>
_(Optional)_ Statistics, containing the names of all statistic items to be enabled
</td></tr>
<tr><td>
property
</td><td>
Array<string>
</td><td>
_(Optional)_ Properties, containing the names of all properties to be enabled
</td></tr>
<tr><td>
columns
</td><td>
Array<[IPCB\_BomPropertiesTableColumns](../interfaces/IPCB_BomPropertiesTableColumns.md)<!-- -->>
</td><td>
_(Optional)_ Column properties and sorting. If `title`<!-- -->, `sort`<!-- -->, `group`<!-- -->, and `orderWeight` are not passed in, default values are used. `null` means \*\*none\*\* or \*\*empty\*\*
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
BOM file data
## Remarks
You can use [SYS\_FileSystem.saveFile()](./SYS_FileSystem.md) API export the file to the local file system
## Example
```javascript
// 使用默认配置导出 BOM
const bomFile = await eda.pcb_ManufactureData.getBomFile('MyBOM', 'xlsx');
if (bomFile) {
await eda.sys_FileSystem.saveFile(bomFile);
}
// 自定义 BOM 过滤和列配置
const bomFile = await eda.pcb_ManufactureData.getBomFile(
'Custom_Production_BOM',
'xlsx',
undefined,
[
{ property: 'Add into BOM', includeValue: 'yes' },
{ property: 'Convert to PCB', includeValue: 'yes' }
],
['No.', 'Quantity', 'Comment'],
['Name', 'Device', 'Designator', 'Supplier'],
[
{ property: 'Designator', title: '位号', sort: 'asc', group: 'No', orderWeight: 10 },
{ property: 'Quantity', title: '数量', sort: 'desc', group: 'Yes', orderWeight: 9 }
]
);
// 导出 CSV 格式 BOM
const csvBomFile = await eda.pcb_ManufactureData.getBomFile(
'Simple_BOM',
'csv',
undefined,
[{ property: 'Add into BOM', includeValue: 'yes' }],
['No.', 'Quantity'],
['Designator', 'Footprint', 'Value']
);
```
### getbomtemplatefile
# PCB\_ManufactureData.getBomTemplateFile() method
> 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.
Get BOM template file
## Signature
```typescript
function getBomTemplateFile(template: string): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
template
</td><td>
string
</td><td>
BOM template name
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
BOM template file
## Example
```javascript
// 获取指定模板的文件
const templateFile = await eda.pcb_ManufactureData.getBomTemplateFile('MyCustomTemplate');
if (templateFile) {
await eda.sys_FileSystem.saveFile(templateFile);
}
```
### getbomtemplates
# PCB\_ManufactureData.getBomTemplates() method
> 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.
Get BOM template list
## Signature
```typescript
function getBomTemplates(): Promise<Array<string>>;
```
## Returns
Promise<Array<string>>
BOM template list
## Example
```javascript
// 获取所有可用的 BOM 模板
const templates = await eda.pcb_ManufactureData.getBomTemplates();
console.log('可用的 BOM 模板:', templates);
templates.forEach((template, index) => {
console.log(`${index + 1}. ${template}`);
});
```
### getdsnfile
# PCB\_ManufactureData.getDsnFile() method
> 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.
Get Auto routing file (DSN)
## Signature
```typescript
function getDsnFile(fileName?: string): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_ File name
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
Auto routing DSN file data
## Remarks
You can use [SYS\_FileSystem.saveFile()](./SYS_FileSystem.md) API export the file to the local file system
## Example
```javascript
const dsnFile = await eda.pcb_ManufactureData.getDsnFile('AutoRoute_DSN');
if (dsnFile) {
await eda.sys_FileSystem.saveFile(dsnFile);
}
```
### getdxffile
# PCB\_ManufactureData.getDxfFile() method
> 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.
Get DXF file
## Signature
```typescript
function getDxfFile(
fileName?: string,
layers?: Array<{ layerId: EPCB_LayerId; mirror: boolean }>,
objects?: Array<string>,
): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_ File name
</td></tr>
<tr><td>
layers
</td><td>
Array<{ layerId: [EPCB\_LayerId](../enums/EPCB_LayerId.md)<!-- -->; mirror: boolean }>
</td><td>
_(Optional)_ Exported layers
</td></tr>
<tr><td>
objects
</td><td>
Array<string>
</td><td>
_(Optional)_ Exported objects
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
DXF file data
## Remarks
You can use [SYS\_FileSystem.saveFile()](./SYS_FileSystem.md) API export the file to the local file system
## Example
```javascript
// 1. 指定导出层:顶层铜层(layerId 1)和板框层(layerId 11),不镜像
const layers = [
{ layerId: 1, mirror: false },
{ layerId: 11, mirror: false }
];
// 2. 发起导出,25 秒内完成就输出文件信息
const dxfFile = await Promise.race([
eda.pcb_ManufactureData.getDxfFile('嘉立创示例_DXF', layers),
new Promise(resolve => setTimeout(() => resolve(undefined), 25000))
]);
// 3. 查看导出结果
if (dxfFile) {
console.log('导出文件名:', dxfFile.name);
console.log('文件大小:', dxfFile.size);
}
else {
console.log('导出超过 25 秒仍在后台进行,真实使用直接 await 等待完成即可');
}
```
### getflyingprobetestfile
# PCB\_ManufactureData.getFlyingProbeTestFile() method
> 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.
Get the flying probe test file
## Signature
```typescript
function getFlyingProbeTestFile(fileName?: string): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_ File name
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
Flying probe test file data
## Example
```javascript
// 保存飞针测试文件到本地
const flyingProbeFile = await eda.pcb_ManufactureData.getFlyingProbeTestFile('FlyingProbe_Test');
if (flyingProbeFile) {
await eda.sys_FileSystem.saveFile(flyingProbeFile);
}
```
### getgerberfile
# PCB\_ManufactureData.getGerberFile() method
> 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.
Get the PCB fabrication file (Gerber)
## Signature
```typescript
function getGerberFile(
fileName?: string,
colorSilkscreen?: boolean,
unit?: ESYS_Unit.MILLIMETER | ESYS_Unit.INCH,
digitalFormat?: { integerNumber: number; decimalNumber: number },
other?: {
metallicDrillingInformation: boolean;
nonMetallicDrillingInformation: boolean;
drillTable: boolean;
flyingProbeTestingFile: boolean;
},
layers?: Array<{ layerId: EPCB_LayerId; isMirror: boolean }>,
objects?: Array<
| 'Pad'
| 'Via'
| 'Track'
| 'Text'
| 'Image'
| 'Dimension'
| 'BoardOutline'
| 'BoardCutout'
| 'CopperFilled'
| 'SolidRegion'
| 'FPCStiffener'
| 'Line'
| 'PlaneZone'
| 'ComponentProperty'
| 'ComponentSilkscreen'
| 'TearDrop'
>,
): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_ File name
</td></tr>
<tr><td>
colorSilkscreen
</td><td>
boolean
</td><td>
_(Optional)_ Whether to generate a color silkscreen fabrication file (EasyEDA-specific file)
</td></tr>
<tr><td>
unit
</td><td>
[ESYS\_Unit.MILLIMETER](../enums/ESYS_Unit.md) \| [ESYS\_Unit.INCH](../enums/ESYS_Unit.md)
</td><td>
_(Optional)_ Unit
</td></tr>
<tr><td>
digitalFormat
</td><td>
\{ integerNumber: number; decimalNumber: number \}
</td><td>
_(Optional)_ Digital format
</td></tr>
<tr><td>
other
</td><td>
\{ metallicDrillingInformation: boolean; nonMetallicDrillingInformation: boolean; drillTable: boolean; flyingProbeTestingFile: boolean \}
</td><td>
_(Optional)_ Other
</td></tr>
<tr><td>
layers
</td><td>
Array<{ layerId: [EPCB\_LayerId](../enums/EPCB_LayerId.md)<!-- -->; isMirror: boolean }>
</td><td>
_(Optional)_ Exported layers. By default, they are exported according to EasyEDA production requirements
</td></tr>
<tr><td>
objects
</td><td>
Array<'Pad' \| 'Via' \| 'Track' \| 'Text' \| 'Image' \| 'Dimension' \| 'BoardOutline' \| 'BoardCutout' \| 'CopperFilled' \| 'SolidRegion' \| 'FPCStiffener' \| 'Line' \| 'PlaneZone' \| 'ComponentProperty' \| 'ComponentSilkscreen' \| 'TearDrop'>
</td><td>
_(Optional)_ Exported objects. By default, they are exported according to EasyEDA production requirements
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
PCB fabrication file data
## Remarks
You can use [SYS\_FileSystem.saveFile()](./SYS_FileSystem.md) API export the file to the local file system
默认参数与编辑器「导出 PCB 制版文件」弹窗的 \*\*一键导出\*\* 选项保持一致(单位 `MM`<!-- -->、数字格式 `4:5`<!-- -->、导出板内真实使用的层及钻孔图层等)
## Example
```javascript
// 导出默认的 Gerber 文件
const gerberFile = await eda.pcb_ManufactureData.getGerberFile('MyBoard_Gerber');
if (gerberFile) {
console.log('Gerber 文件已生成:', gerberFile);
}
// 导出并保存到本地
const gerberFile = await eda.pcb_ManufactureData.getGerberFile(
'MyBoard_Gerber',
false,
ESYS_Unit.MILLIMETER,
{ integerNumber: 4, decimalNumber: 6 }
);
if (gerberFile) {
await eda.sys_FileSystem.saveFile(gerberFile,'Gerber.zip');
}
// 自定义导出层和对象
const gerberFile = await eda.pcb_ManufactureData.getGerberFile(
'Custom_Gerber',
false,
ESYS_Unit.INCH,
{ integerNumber: 3, decimalNumber: 5 },
{ metallicDrillingInformation: true, nonMetallicDrillingInformation: true, drillTable: false, flyingProbeTestingFile: false },
[{ layerId: EPCB_LayerId.TOP, isMirror: false }, { layerId: EPCB_LayerId.BOTTOM, isMirror: false }, { layerId: EPCB_LayerId.BOARD_OUTLINE, isMirror: false }],
['Pad', 'Via', 'Track', 'BoardOutline']
);
```
### getidxfile
# PCB\_ManufactureData.getIdxFile() method
> 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.
Get IDX file
## Signature
```typescript
function getIdxFile(fileName?: string): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
IDX file
## Remarks
You can use [SYS\_FileSystem.saveFile()](./SYS_FileSystem.md) API export the file to the local file system
## Example
```javascript
const idxFile = await eda.pcb_ManufactureData.getIdxFile('Design_Exchange');
if (idxFile) {
await eda.sys_FileSystem.saveFile(idxFile);
}
```
### getipc2581cfile
# PCB\_ManufactureData.getIpc2581CFile() method
> 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.
Get IPC-2581C file
## Signature
```typescript
function getIpc2581CFile(
fileName?: string,
fileType?: 'xml' | 'cvg' | '2581',
unit?: ESYS_Unit.INCH | ESYS_Unit.MILLIMETER,
oemNumber?: 'Device' | 'Manufacturer Part' | 'Supplier Part' | 'Comment',
): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_ File name
</td></tr>
<tr><td>
fileType
</td><td>
'xml' \| 'cvg' \| '2581'
</td><td>
_(Optional)_
</td></tr>
<tr><td>
unit
</td><td>
[ESYS\_Unit.INCH](../enums/ESYS_Unit.md) \| [ESYS\_Unit.MILLIMETER](../enums/ESYS_Unit.md)
</td><td>
_(Optional)_
</td></tr>
<tr><td>
oemNumber
</td><td>
'Device' \| 'Manufacturer Part' \| 'Supplier Part' \| 'Comment'
</td><td>
_(Optional)_
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
IPC-2581C file data
## Remarks
You can use [SYS\_FileSystem.saveFile()](./SYS_FileSystem.md) API export the file to the local file system
## Example
```javascript
// 1. 发起导出(XML 格式、毫米单位、OEM 编号取元件的 Device 属性),
// 25 秒内完成就输出文件信息
const ipcFile = await Promise.race([
eda.pcb_ManufactureData.getIpc2581CFile('嘉立创示例_IPC2581C', 'xml', 'mm', 'Device'),
new Promise(resolve => setTimeout(() => resolve(undefined), 25000))
]);
// 2. 查看导出结果
if (ipcFile) {
console.log('导出文件名:', ipcFile.name);
console.log('文件大小:', ipcFile.size);
}
else {
console.log('导出超过 25 秒仍在后台进行,真实使用直接 await 等待完成即可');
}
```
### getipcd356afile
# PCB\_ManufactureData.getIpcD356AFile() method
> 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.
Get IPC-D-356A file
## Signature
```typescript
function getIpcD356AFile(fileName?: string): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_ File name
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
IPC-D-356A file data
## Remarks
You can use [SYS\_FileSystem.saveFile()](./SYS_FileSystem.md) API export the file to the local file system
## Example
```javascript
const ipcFile = await eda.pcb_ManufactureData.getIpcD356AFile('IPC_D356A_Test');
if (ipcFile) {
await eda.sys_FileSystem.saveFile(ipcFile);
}
```
### getmanufacturedata
# PCB\_ManufactureData.getManufactureData() method
> 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.
Export the manufacture data
## Signature
```typescript
function getManufactureData(): Promise<File | undefined>;
```
## Returns
Promise<File \| undefined>
Manufacture data
## Remarks
This API corresponds to the one-click manufacture data export function of the private deployment edition
It will obtain the file data according to the configuration of the one-click manufacture data export popup on the front end
Note: This API is only valid for the private deployment edition. Calling it in other editions will always `throw Error`
## Example
```javascript
// 1. 按弹窗当前配置一键导出制造文件
try {
const manufactureFile = await eda.pcb_ManufactureData.getManufactureData();
console.log('制造文件大小:', manufactureFile?.size);
}
catch (e) {
// 非私有化部署版本调用会直接抛错,属预期行为
console.log('当前版本不支持一键导出制造文件(仅私有化部署版本有效)');
}
```
### getnetlistfile
# PCB\_ManufactureData.getNetlistFile() method
> 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.
Get the netlist file (Netlist)
## Signature
```typescript
function getNetlistFile(
fileName?: string,
netlistType?: ESYS_NetlistType,
): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_ File name
</td></tr>
<tr><td>
netlistType
</td><td>
[ESYS\_NetlistType](../enums/ESYS_NetlistType.md)
</td><td>
_(Optional)_ Netlist type
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
Netlist file data
## Remarks
You can use [SYS\_FileSystem.saveFile()](./SYS_FileSystem.md) API export the file to the local file system
## Example
```javascript
// 导出嘉立创 EDA 专业版格式网表
const netlistFile = await eda.pcb_ManufactureData.getNetlistFile(
'MyNetlist',
ESYS_NetlistType.JLCEDA_PRO
);
if (netlistFile) {
await eda.sys_FileSystem.saveFile(netlistFile);
}
// 导出 Altium Designer 格式
const altiumNetlist = await eda.pcb_ManufactureData.getNetlistFile(
'Netlist_Altium',
ESYS_NetlistType.ALTIUM_DESIGNER
);
// 导出 PADS 格式
const padsNetlist = await eda.pcb_ManufactureData.getNetlistFile(
'Netlist_PADS',
ESYS_NetlistType.PADS
);
```
### getopendatabasedoubleplusfile
# PCB\_ManufactureData.getOpenDatabaseDoublePlusFile() method
> 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.
Get ODB++ file
## Signature
```typescript
function getOpenDatabaseDoublePlusFile(
fileName?: string,
unit?: ESYS_Unit.INCH | ESYS_Unit.MILLIMETER,
otherData?: {
metallizedDrilledHoles?: boolean;
nonMetallizedDrilledHoles?: boolean;
drillTable?: boolean;
flyingProbeTestFile?: boolean;
},
layers?: Array<{ layerId: EPCB_LayerId; mirror: boolean }>,
objects?: Array<{ objectName: string }>,
): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_ File name
</td></tr>
<tr><td>
unit
</td><td>
[ESYS\_Unit.INCH](../enums/ESYS_Unit.md) \| [ESYS\_Unit.MILLIMETER](../enums/ESYS_Unit.md)
</td><td>
_(Optional)_ Unit
</td></tr>
<tr><td>
otherData
</td><td>
\{ metallizedDrilledHoles?: boolean; nonMetallizedDrilledHoles?: boolean; drillTable?: boolean; flyingProbeTestFile?: boolean \}
</td><td>
_(Optional)_ Other
</td></tr>
<tr><td>
layers
</td><td>
Array<{ layerId: [EPCB\_LayerId](../enums/EPCB_LayerId.md)<!-- -->; mirror: boolean }>
</td><td>
_(Optional)_ Exported layers. By default, they are exported according to EasyEDA production requirements
</td></tr>
<tr><td>
objects
</td><td>
Array<{ objectName: string }>
</td><td>
_(Optional)_ Exported objects. By default, they are exported according to EasyEDA production requirements
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
ODB++ file data
## Remarks
You can use [SYS\_FileSystem.saveFile()](./SYS_FileSystem.md) API export the file to the local file system
## Example
```javascript
// 导出 ODB++ 文件,自定义单位和选项
const odbFile = await eda.pcb_ManufactureData.getOpenDatabaseDoublePlusFile(
'MyBoard_ODB',
ESYS_Unit.INCH,
{
metallizedDrilledHoles: true,
nonMetallizedDrilledHoles: true,
drillTable: true,
flyingProbeTestFile: false
}
);
if (odbFile) {
await eda.sys_FileSystem.saveFile(odbFile);
}
```
### getpadsfile
# PCB\_ManufactureData.getPadsFile() method
> 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.
Get PADS file
## Signature
```typescript
function getPadsFile(fileName?: string): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_ File name
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
PADS file data
## Remarks
You can use [SYS\_FileSystem.saveFile()](./SYS_FileSystem.md) API export the file to the local file system
## Example
```javascript
// 获取 PADS 格式文件
const padsFile = await eda.pcb_ManufactureData.getPadsFile('Converted_To_PADS');
if (padsFile) {
await eda.sys_FileSystem.saveFile(padsFile);
}
```
### getpcbinfofile
# PCB\_ManufactureData.getPcbInfoFile() method
> 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.
Get PCB information file
## Signature
```typescript
function getPcbInfoFile(fileName?: string): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_ File name
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
PCB information file
## Remarks
You can use [SYS\_FileSystem.saveFile()](./SYS_FileSystem.md) API export the file to the local file system
## Example
```javascript
const pcbInfoFile = await eda.pcb_ManufactureData.getPcbInfoFile('Board_Information');
if (pcbInfoFile) {
await eda.sys_FileSystem.saveFile(pcbInfoFile);
}
```
### getpdffile
# PCB\_ManufactureData.getPdfFile() method
> 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.
Get PDF file
## Signature
```typescript
function getPdfFile(
fileName?: string,
outputMethod?: EPCB_PdfOutputMethod,
contentConfig?: { displayAttributesAsMenu: boolean; showOutlineOnly: boolean },
watermark?: {
show?: boolean;
content?: string;
styleConfig?: {
color: string;
transparency: 'Opaque' | '75%' | '50%' | '25%';
font: string;
fontSize: {
unit: ESYS_Unit.INCH | ESYS_Unit.MIL | ESYS_Unit.MILLIMETER;
value: number;
};
style: { bold: boolean; italic: boolean; underline: boolean };
slope: 0 | 45 | 90;
denseness: 'Single' | 'Sparse' | 'Std' | 'Dense';
};
},
graphPageConfig?: Array<{ checked: boolean; name: string }>,
): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_ File name
</td></tr>
<tr><td>
outputMethod
</td><td>
[EPCB\_PdfOutputMethod](../enums/EPCB_PdfOutputMethod.md)
</td><td>
_(Optional)_ Output method. ADD since EDA v4.2
</td></tr>
<tr><td>
contentConfig
</td><td>
\{ displayAttributesAsMenu: boolean; showOutlineOnly: boolean \}
</td><td>
_(Optional)_ Content configuration. ADD since EDA v4.2
</td></tr>
<tr><td>
watermark
</td><td>
{ show?: boolean; content?: string; styleConfig?: { color: string; transparency: 'Opaque' \| '75%' \| '50%' \| '25%'; font: string; fontSize: { unit: [ESYS\_Unit.INCH](../enums/ESYS_Unit.md) \| [ESYS\_Unit.MIL](../enums/ESYS_Unit.md) \| [ESYS\_Unit.MILLIMETER](../enums/ESYS_Unit.md)<!-- -->; value: number }; style: { bold: boolean; italic: boolean; underline: boolean }; slope: 0 \| 45 \| 90; denseness: 'Single' \| 'Sparse' \| 'Std' \| 'Dense' } }
</td><td>
_(Optional)_ Watermark. ADD since EDA v4.2
</td></tr>
<tr><td>
graphPageConfig
</td><td>
Array<{ checked: boolean; name: string }>
</td><td>
_(Optional)_ Graph page configuration. ADD since EDA v4.2
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
PDF file data (or archive)
## Remarks
You can use [SYS\_FileSystem.saveFile()](./SYS_FileSystem.md) API export the file to the local file system
REFACTOR since EDA v4.2
## Example
```javascript
// 导出多页 PDF(包含所有图层)
const pdfFile = await eda.pcb_ManufactureData.getPdfFile(
'PCB_Documentation',
EPCB_PdfOutputMethod.MULTI_PAGE_PDF
);
if (pdfFile) {
await eda.sys_FileSystem.saveFile(pdfFile);
}
```
### getpickandplacefile
# PCB\_ManufactureData.getPickAndPlaceFile() method
> 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.
Get Coordinate file (PickAndPlace)
## Signature
```typescript
function getPickAndPlaceFile(
fileName?: string,
fileType?: 'xlsx' | 'csv',
unit?: ESYS_Unit.MILLIMETER | ESYS_Unit.MIL,
): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_ File name
</td></tr>
<tr><td>
fileType
</td><td>
'xlsx' \| 'csv'
</td><td>
_(Optional)_ File type
</td></tr>
<tr><td>
unit
</td><td>
[ESYS\_Unit.MILLIMETER](../enums/ESYS_Unit.md) \| [ESYS\_Unit.MIL](../enums/ESYS_Unit.md)
</td><td>
_(Optional)_ Unit
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
Coordinate file data
## Remarks
You can use [SYS\_FileSystem.saveFile()](./SYS_FileSystem.md) API export the file to the local file system
## Example
```javascript
// 导出毫米单位的 Excel 格式坐标文件
const pnpFile = await eda.pcb_ManufactureData.getPickAndPlaceFile(
'PickAndPlace',
'xlsx',
ESYS_Unit.MILLIMETER
);
if (pnpFile) {
await eda.sys_FileSystem.saveFile(pnpFile);
}
```
### gettestpointfile
# PCB\_ManufactureData.getTestPointFile() method
> 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.
Get the test point report file
## Signature
```typescript
function getTestPointFile(fileName?: string, fileType?: 'xlsx' | 'csv'): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_ File name
</td></tr>
<tr><td>
fileType
</td><td>
'xlsx' \| 'csv'
</td><td>
_(Optional)_ File type
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
Test point report file data
## Remarks
You can use [SYS\_FileSystem.saveFile()](./SYS_FileSystem.md) API export the file to the local file system
## Example
```javascript
// 保存测试点报告文件到本地
const testPointFile = await eda.pcb_ManufactureData.getTestPointFile('Test_Point_Report', 'xlsx');
if (testPointFile) {
await eda.sys_FileSystem.saveFile(testPointFile);
}
```
### place3dshellorder
# PCB\_ManufactureData.place3DShellOrder() method
> 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.
3D shell ordering
## Signature
```typescript
function place3DShellOrder(interactive?: boolean, ignoreWarning?: boolean): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
interactive
</td><td>
boolean
</td><td>
_(Optional)_ Whether to enable interactive checking. If enabled, a popup will wait for user interaction, and the `ignoreWarning` parameter cannot be used to ignore warnings; that is, the `ignoreWarning` parameter will be ignored. If disabled, no EDA internal popup will appear after the call, and the program performs a silent check. If the ordering conditions are met, `true` will be returned and the ordering page will be opened in a new tab
</td></tr>
<tr><td>
ignoreWarning
</td><td>
boolean
</td><td>
_(Optional)_ Ignore warnings during non-interactive checking. If set to `true`<!-- -->, all check warning items will be ignored and the ordering data will be generated as much as possible; if set to `false`<!-- -->, any warning will interrupt execution and return `false`
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the ordering check passed. Until the input parameters are fully developed, the return value has no practical effect and does not wait for the execution result
## Remarks
This API currently only supports interactive checking. The input parameters have no effect for now and are reserved for future development
## Example
```javascript
// 1. 交互式下单检查:弹出检查弹窗等待确认,确认后打开下单页面
// const passed = await eda.pcb_ManufactureData.place3DShellOrder(true);
// 2. 静默检查:不弹任何弹窗,忽略警告并直接生成下单资料
// const passed = await eda.pcb_ManufactureData.place3DShellOrder(false, true);
// console.log('下单检查结果 ' + passed);
// 下单会真实打开订单页面并产生订单数据,案例中不实际执行
console.log('演示调用:place3DShellOrder(true) 交互式检查,或 place3DShellOrder(false, true) 静默下单');
```
### placecomponentsorder
# PCB\_ManufactureData.placeComponentsOrder() method
> 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.
Component ordering
## Signature
```typescript
function placeComponentsOrder(interactive?: boolean, ignoreWarning?: boolean): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
interactive
</td><td>
boolean
</td><td>
_(Optional)_ Whether to enable interactive checking. If enabled, a popup will wait for user interaction, and the `ignoreWarning` parameter cannot be used to ignore warnings; that is, the `ignoreWarning` parameter will be ignored. If disabled, no EDA internal popup will appear after the call, and the program performs a silent check. If the ordering conditions are met, `true` will be returned and the ordering page will be opened in a new tab
</td></tr>
<tr><td>
ignoreWarning
</td><td>
boolean
</td><td>
_(Optional)_ Ignore warnings during non-interactive checking. If set to `true`<!-- -->, all check warning items will be ignored and the ordering data will be generated as much as possible; if set to `false`<!-- -->, any warning will interrupt execution and return `false`
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the ordering check passed. Until the input parameters are fully developed, the return value has no practical effect and does not wait for the execution result
## Remarks
This API currently only supports interactive checking. The input parameters have no effect for now and are reserved for future development
## Example
```javascript
// 1. 交互式下单检查:弹出检查弹窗等待确认,确认后打开购买页面
// const passed = await eda.pcb_ManufactureData.placeComponentsOrder(true);
// 2. 静默检查:不弹任何弹窗,忽略警告并直接生成下单资料
// const passed = await eda.pcb_ManufactureData.placeComponentsOrder(false, true);
// console.log('下单检查结果 ' + passed);
// 下单会真实打开订单页面并产生订单数据,案例中不实际执行
console.log('演示调用:placeComponentsOrder(true) 交互式检查,或 placeComponentsOrder(false, true) 静默下单');
```
### placepcborder
# PCB\_ManufactureData.placePcbOrder() method
> 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.
PCB ordering
## Signature
```typescript
function placePcbOrder(interactive?: boolean, ignoreWarning?: boolean): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
interactive
</td><td>
boolean
</td><td>
_(Optional)_ Whether to enable interactive checking. If enabled, a popup will wait for user interaction, and the `ignoreWarning` parameter cannot be used to ignore warnings; that is, the `ignoreWarning` parameter will be ignored. If disabled, no EDA internal popup will appear after the call, and the program performs a silent check. If the ordering conditions are met, `true` will be returned and the ordering page will be opened in a new tab
</td></tr>
<tr><td>
ignoreWarning
</td><td>
boolean
</td><td>
_(Optional)_ Ignore warnings during non-interactive checking. If set to `true`<!-- -->, all check warning items will be ignored and the ordering data will be generated as much as possible; if set to `false`<!-- -->, any warning will interrupt execution and return `false`
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the ordering check passed. Until the input parameters are fully developed, the return value has no practical effect and does not wait for the execution result
## Remarks
This API currently only supports interactive checking. The input parameters have no effect for now and are reserved for future development
## Example
```javascript
// 1. 交互式下单检查:弹出检查弹窗等待确认,确认后打开下单页面
// const passed = await eda.pcb_ManufactureData.placePcbOrder(true);
// 2. 静默检查:不弹任何弹窗,忽略警告并直接生成下单资料
// const passed = await eda.pcb_ManufactureData.placePcbOrder(false, true);
// console.log('下单检查结果 ' + passed);
// 下单会真实打开订单页面并产生订单数据,案例中不实际执行
console.log('演示调用:placePcbOrder(true) 交互式检查,或 placePcbOrder(false, true) 静默下单');
```
### placesmtcomponentsorder
# PCB\_ManufactureData.placeSmtComponentsOrder() method
> 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.
SMT component ordering
## Signature
```typescript
function placeSmtComponentsOrder(interactive?: boolean, ignoreWarning?: boolean): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
interactive
</td><td>
boolean
</td><td>
_(Optional)_ Whether to enable interactive checking. If enabled, a popup will wait for user interaction, and the `ignoreWarning` parameter cannot be used to ignore warnings; that is, the `ignoreWarning` parameter will be ignored. If disabled, no EDA internal popup will appear after the call, and the program performs a silent check. If the ordering conditions are met, `true` will be returned and the ordering page will be opened in a new tab
</td></tr>
<tr><td>
ignoreWarning
</td><td>
boolean
</td><td>
_(Optional)_ Ignore warnings during non-interactive checking. If set to `true`<!-- -->, all check warning items will be ignored and the ordering data will be generated as much as possible; if set to `false`<!-- -->, any warning will interrupt execution and return `false`
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the ordering check passed. Until the input parameters are fully developed, the return value has no practical effect and does not wait for the execution result
## Remarks
This API currently only supports interactive checking. The input parameters have no effect for now and are reserved for future development
## Example
```javascript
// 1. 交互式下单检查:弹出检查弹窗等待确认,确认后打开下单页面
// const passed = await eda.pcb_ManufactureData.placeSmtComponentsOrder(true);
// 2. 静默检查:不弹任何弹窗,忽略警告并直接生成下单资料
// const passed = await eda.pcb_ManufactureData.placeSmtComponentsOrder(false, true);
// console.log('下单检查结果 ' + passed);
// 下单会真实打开订单页面并产生订单数据,案例中不实际执行
console.log('演示调用:placeSmtComponentsOrder(true) 交互式检查,或 placeSmtComponentsOrder(false, true) 静默下单');
```
### uploadbomtemplatefile
# PCB\_ManufactureData.uploadBomTemplateFile() method
> 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.
Upload a BOM template file
## Signature
```typescript
function uploadBomTemplateFile(templateFile: File, template?: string): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
templateFile
</td><td>
File
</td><td>
BOM template file
</td></tr>
<tr><td>
template
</td><td>
string
</td><td>
_(Optional)_ BOM template name. If it is `undefined`<!-- -->, the value is automatically taken from `templateFile`
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
BOM template name
## Example
```javascript
// 从文件选择器读取模板文件
const templateFile = await eda.sys_FileSystem.openReadFileDialog('.xlsx');
if (templateFile) {
const templateName = await eda.pcb_ManufactureData.uploadBomTemplateFile(
templateFile,
'MyCustomTemplate'
);
if (templateName) {
console.log('模板上传成功:', templateName);
}
}
```
references/classes/PCB_MathPolygon.md
# PCB\_MathPolygon class
PCB & footprint / polygon math class
## Signature
```typescript
class PCB_MathPolygon
```
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[calculateBBoxHeight(complexPolygon)](./PCB_MathPolygon.md)
</td><td>
</td><td>
计算多边形源数组的 BBox 高度
</td></tr>
<tr><td>
[calculateHeight(complexPolygon)](./PCB_MathPolygon.md)
</td><td>
</td><td>
**_(BETA)_** Calculate complex polygon BBox height
</td></tr>
<tr><td>
[calculateWidth(complexPolygon)](./PCB_MathPolygon.md)
</td><td>
</td><td>
**_(BETA)_** Calculate complex polygon BBox width
</td></tr>
<tr><td>
[convertImageToComplexPolygon(imageBlob, imageWidth, imageHeight, tolerance, simplification, smoothing, despeckling, whiteAsBackgroundColor, inversion)](./PCB_MathPolygon.md)
</td><td>
</td><td>
**_(BETA)_** Convert Image to Complex polygon object
</td></tr>
<tr><td>
[createComplexPolygon(complexPolygon)](./PCB_MathPolygon.md)
</td><td>
</td><td>
Create Complex polygon
</td></tr>
<tr><td>
[createPolygon(polygon)](./PCB_MathPolygon.md)
</td><td>
</td><td>
Create Single polygon
</td></tr>
<tr><td>
[discretize(polygon, options)](./PCB_MathPolygon.md)
</td><td>
</td><td>
**_(BETA)_** Discretize a single polygon into point data
</td></tr>
<tr><td>
[disposeTrace()](./PCB_MathPolygon.md)
</td><td>
</td><td>
释放描摹会话资源(worker + 像素缓存)
</td></tr>
<tr><td>
[splitPolygon(complexPolygons)](./PCB_MathPolygon.md)
</td><td>
</td><td>
Split single polygon
</td></tr>
<tr><td>
[traceImage(options)](./PCB_MathPolygon.md)
</td><td>
</td><td>
将图片描摹为矢量路径(SVG path),并导出预览图
</td></tr>
</tbody></table>
---
## 方法详情
### calculatebboxheight
# PCB\_MathPolygon.calculateBBoxHeight() method
计算多边形源数组的 BBox 高度
## Signature
```typescript
function calculateBBoxHeight(
complexPolygon: TPCB_PolygonSourceArray | Array<TPCB_PolygonSourceArray>,
): number;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
complexPolygon
</td><td>
[TPCB\_PolygonSourceArray](../types/TPCB_PolygonSourceArray.md) \| Array<[TPCB\_PolygonSourceArray](../types/TPCB_PolygonSourceArray.md)<!-- -->>
</td><td>
</td></tr>
</tbody></table>
## Returns
number
## Example
```javascript
// 1. 单个矩形源数组(宽 100、高 50),BBox 高度为 50
console.log('rectHeight:', eda.pcb_MathPolygon.calculateBBoxHeight(['R', 0, 0, 100, 50, 0, 0]));
// 2. 单个圆源数组(圆心在原点、半径 50),BBox 高度为直径 100
console.log('circleHeight:', eda.pcb_MathPolygon.calculateBBoxHeight(['CIRCLE', 0, 0, 50]));
// 3. 多块组合:矩形 Y 范围 0~50,圆 Y 范围 170~230,整体跨度 230
console.log('multiHeight:', eda.pcb_MathPolygon.calculateBBoxHeight([
['R', 0, 0, 100, 50, 0, 0],
['CIRCLE', 200, 200, 30],
]));
```
### calculateheight
# PCB\_MathPolygon.calculateHeight() method
> 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.
Calculate complex polygon BBox height
## Signature
```typescript
function calculateHeight(
complexPolygon:
| TPCB_PolygonSourceArray
| Array<TPCB_PolygonSourceArray>
| IPCB_Polygon
| IPCB_ComplexPolygon,
): number;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
complexPolygon
</td><td>
[TPCB\_PolygonSourceArray](../types/TPCB_PolygonSourceArray.md) \| Array<[TPCB\_PolygonSourceArray](../types/TPCB_PolygonSourceArray.md)<!-- -->> \| [IPCB\_Polygon](./IPCB_Polygon.md) \| [IPCB\_ComplexPolygon](./IPCB_ComplexPolygon.md)
</td><td>
Complex polygon
</td></tr>
</tbody></table>
## Returns
number
BBox height
## Example
```javascript
// 1. 矩形源数组(宽 100、高 50),BBox 高度为 50
console.log('rectHeight:', eda.pcb_MathPolygon.calculateHeight(['R', 0, 0, 100, 50, 0, 0]));
// 2. 圆心在原点、半径 50 的圆,BBox 高度为直径 100
console.log('circleHeight:', eda.pcb_MathPolygon.calculateHeight(['CIRCLE', 0, 0, 50]));
// 3. 传复杂多边形对象:矩形 Y 范围 0~50,圆 Y 范围 170~230,整体跨度 230
const complexPolygon = eda.pcb_MathPolygon.createComplexPolygon([
['R', 0, 0, 100, 50, 0, 0],
['CIRCLE', 200, 200, 30],
]);
console.log('complexHeight:', eda.pcb_MathPolygon.calculateHeight(complexPolygon));
```
### calculatewidth
# PCB\_MathPolygon.calculateWidth() method
> 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.
Calculate complex polygon BBox width
## Signature
```typescript
function calculateWidth(
complexPolygon:
| TPCB_PolygonSourceArray
| Array<TPCB_PolygonSourceArray>
| IPCB_Polygon
| IPCB_ComplexPolygon,
): number;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
complexPolygon
</td><td>
[TPCB\_PolygonSourceArray](../types/TPCB_PolygonSourceArray.md) \| Array<[TPCB\_PolygonSourceArray](../types/TPCB_PolygonSourceArray.md)<!-- -->> \| [IPCB\_Polygon](./IPCB_Polygon.md) \| [IPCB\_ComplexPolygon](./IPCB_ComplexPolygon.md)
</td><td>
Complex polygon
</td></tr>
</tbody></table>
## Returns
number
BBox width
## Example
```javascript
// 1. 矩形源数组(宽 100、高 50),BBox 宽度为 100
console.log('rectWidth:', eda.pcb_MathPolygon.calculateWidth(['R', 0, 0, 100, 50, 0, 0]));
// 2. 圆心在原点、半径 50 的圆,BBox 宽度为直径 100
console.log('circleWidth:', eda.pcb_MathPolygon.calculateWidth(['CIRCLE', 0, 0, 50]));
// 3. 传复杂多边形对象:矩形 X 范围 0~100,圆 X 范围 170~230,整体跨度 230
const complexPolygon = eda.pcb_MathPolygon.createComplexPolygon([
['R', 0, 0, 100, 50, 0, 0],
['CIRCLE', 200, 200, 30],
]);
console.log('complexWidth:', eda.pcb_MathPolygon.calculateWidth(complexPolygon));
```
### convertimagetocomplexpolygon
# PCB\_MathPolygon.convertImageToComplexPolygon() method
> 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.
Convert Image to Complex polygon object
## Signature
```typescript
function convertImageToComplexPolygon(
imageBlob: Blob,
imageWidth: number,
imageHeight: number,
tolerance?: number,
simplification?: number,
smoothing?: number,
despeckling?: number,
whiteAsBackgroundColor?: boolean,
inversion?: boolean,
): Promise<IPCB_ComplexPolygon | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
imageBlob
</td><td>
Blob
</td><td>
Image Blob file. You can use the method to read a file from the file system
</td></tr>
<tr><td>
imageWidth
</td><td>
number
</td><td>
Image width
</td></tr>
<tr><td>
imageHeight
</td><td>
number
</td><td>
Image height
</td></tr>
<tr><td>
tolerance
</td><td>
number
</td><td>
_(Optional)_ Tolerance, value range `0`<!-- -->-`1`
</td></tr>
<tr><td>
simplification
</td><td>
number
</td><td>
_(Optional)_ Simplification, value range `0`<!-- -->-`1`
</td></tr>
<tr><td>
smoothing
</td><td>
number
</td><td>
_(Optional)_ Smoothing, value range `0`<!-- -->-`1.33`
</td></tr>
<tr><td>
despeckling
</td><td>
number
</td><td>
_(Optional)_ Despeckling, value range `0`<!-- -->-`5`
</td></tr>
<tr><td>
whiteAsBackgroundColor
</td><td>
boolean
</td><td>
_(Optional)_ Whether to use white as the background color
</td></tr>
<tr><td>
inversion
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is inverted
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_ComplexPolygon](./IPCB_ComplexPolygon.md) \| undefined>
Complex polygon object
## Example
```javascript
// 1. 用 canvas 画一张测试图:白色背景,中间 10×10 像素的黑色方块
const canvas = document.createElement('canvas');
canvas.width = 20;
canvas.height = 20;
const ctx = canvas.getContext('2d');
ctx.fillStyle = '#ffffff';
ctx.fillRect(0, 0, 20, 20);
ctx.fillStyle = '#000000';
ctx.fillRect(5, 5, 10, 10);
// 2. 导出为 PNG Blob
const imageBlob = await new Promise(resolve => canvas.toBlob(resolve, 'image/png'));
// 3. 描摹为复杂多边形(全部可选参数走默认值)
const complexPolygon = await eda.pcb_MathPolygon.convertImageToComplexPolygon(imageBlob, 20, 20);
// 4. 读取描摹结果:分块数量与第一块的源数据(描摹出的轮廓点,坐标由算法生成)
const sources = complexPolygon.getSourceStrictComplex();
console.log('polygonCount:', sources.length);
console.log('firstSource:', JSON.stringify(sources[0]).slice(0, 120));
```
### createcomplexpolygon
# PCB\_MathPolygon.createComplexPolygon() method
Create Complex polygon
## Signature
```typescript
function createComplexPolygon(
complexPolygon:
| TPCB_PolygonSourceArray
| Array<TPCB_PolygonSourceArray>
| IPCB_Polygon
| Array<IPCB_Polygon>,
): IPCB_ComplexPolygon | undefined;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
complexPolygon
</td><td>
[TPCB\_PolygonSourceArray](../types/TPCB_PolygonSourceArray.md) \| Array<[TPCB\_PolygonSourceArray](../types/TPCB_PolygonSourceArray.md)<!-- -->> \| [IPCB\_Polygon](./IPCB_Polygon.md) \| Array<[IPCB\_Polygon](./IPCB_Polygon.md)<!-- -->>
</td><td>
Complex polygon data
</td></tr>
</tbody></table>
## Returns
[IPCB\_ComplexPolygon](./IPCB_ComplexPolygon.md) \| undefined
Complex polygon object. `undefined` indicates that the data is invalid
## Example
```javascript
// 1. 传入两个源数组的数组,创建矩形外框加圆形第二块的复杂多边形(纯数据对象,画布上还看不到)
const complexPolygon = eda.pcb_MathPolygon.createComplexPolygon([
['R', 1000, 1000, 500, 300, 0, 0],
['CIRCLE', 3000, 1150, 100],
]);
// 2. 读取复杂多边形的分块源数据,确认两块都被解析
const sources = complexPolygon.getSourceStrictComplex();
sources.forEach((source, index) => {
console.log(`source${index + 1}:`, JSON.stringify(source));
});
console.log('count:', sources.length);
```
### createpolygon
# PCB\_MathPolygon.createPolygon() method
Create Single polygon
## Signature
```typescript
function createPolygon(polygon: TPCB_PolygonSourceArray): IPCB_Polygon | undefined;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
polygon
</td><td>
[TPCB\_PolygonSourceArray](../types/TPCB_PolygonSourceArray.md)
</td><td>
Single polygon data
</td></tr>
</tbody></table>
## Returns
[IPCB\_Polygon](./IPCB_Polygon.md) \| undefined
Single polygon object. `undefined` indicates that the data is invalid
## Example
```javascript
// 1. 用矩形模式源数组创建单多边形对象(x、y、宽、高、旋转、圆角)
const rectPolygon = eda.pcb_MathPolygon.createPolygon(['R', 1000, 1000, 500, 300, 0, 0]);
// 2. 用圆形模式源数组再创建一个(圆心 x、y、半径)
const circlePolygon = eda.pcb_MathPolygon.createPolygon(['CIRCLE', 1250, 1150, 80]);
// 3. 读取单多边形的源数据,确认数据被完整解析
console.log('rectSource:', JSON.stringify(rectPolygon.getSource()));
console.log('circleSource:', JSON.stringify(circlePolygon.getSource()));
```
### discretize
# PCB\_MathPolygon.discretize() method
> 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.
Discretize a single polygon into point data
## Signature
```typescript
function discretize(
polygon: IPCB_Polygon | TPCB_PolygonSourceArray,
options?: IPCB_DiscretizeOptions,
): Promise<Array<IPCB_DiscretizedPoint> | null>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
polygon
</td><td>
[IPCB\_Polygon](./IPCB_Polygon.md) \| [TPCB\_PolygonSourceArray](../types/TPCB_PolygonSourceArray.md)
</td><td>
Single polygon object
</td></tr>
<tr><td>
options
</td><td>
[IPCB\_DiscretizeOptions](../interfaces/IPCB_DiscretizeOptions.md)
</td><td>
_(Optional)_ Discretization options
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_DiscretizedPoint](../interfaces/IPCB_DiscretizedPoint.md)<!-- -->> \| null>
Discretized point data
## Remarks
Discretize the boundary of a single polygon into a series of points
### disposetrace
# PCB\_MathPolygon.disposeTrace() method
释放描摹会话资源(worker + 像素缓存)
## Signature
```typescript
function disposeTrace(): Promise<void>;
```
## Returns
Promise<void>
## Remarks
描摹会话结束(如扩展弹窗关闭)时调用,释放 `traceImage` 服务端持有的 PotraceWorkerAPI 单例 worker 与 low/high 两档像素缓存(约 176MB)。幂等,可多次调用; 下次 `traceImage` 首次传 `imageBlob` 时自动重建。纯清理接口,无返回语义。
## Example
```javascript
// 弹窗关闭时释放描摹资源
await eda.pcb_MathPolygon.disposeTrace();
```
### splitpolygon
# PCB\_MathPolygon.splitPolygon() method
Split single polygon
## Signature
```typescript
function splitPolygon(...complexPolygons: Array<IPCB_ComplexPolygon>): Array<IPCB_Polygon>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
complexPolygons
</td><td>
Array<[IPCB\_ComplexPolygon](./IPCB_ComplexPolygon.md)<!-- -->>
</td><td>
Complex polygon
</td></tr>
</tbody></table>
## Returns
Array<[IPCB\_Polygon](./IPCB_Polygon.md)<!-- -->>
Single polygon array
## Example
```javascript
// 1. 构建一个两块的复杂多边形(矩形外框 + 圆形)
const complexPolygon = eda.pcb_MathPolygon.createComplexPolygon([
['R', 1000, 1000, 500, 300, 0, 0],
['CIRCLE', 3000, 1150, 100],
]);
// 2. 拆分为单多边形对象数组
const polygons = eda.pcb_MathPolygon.splitPolygon(complexPolygon);
// 3. 逐个读取单多边形的源数据
polygons.forEach((polygon, index) => {
console.log(`polygon${index + 1}:`, JSON.stringify(polygon.getSource()));
});
console.log('count:', polygons.length);
```
### traceimage
# PCB\_MathPolygon.traceImage() method
将图片描摹为矢量路径(SVG path),并导出预览图
## Signature
```typescript
function traceImage(options: {
imageBlob?: Blob;
imageWidth?: number;
imageHeight?: number;
quality?: 'low' | 'high';
tolerance?: number;
simplify?: number;
smoothness?: number;
despeckle?: number;
whiteAsTransparent?: boolean;
antiphase?: boolean;
}): Promise<
| { path: string; sourcePreviewUrl: string; previewUrl: string; width: number; height: number }
| undefined
>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
options
</td><td>
{ imageBlob?: Blob; imageWidth?: number; imageHeight?: number; quality?: 'low' \| 'high'; tolerance?: number; simplify?: number; smoothness?: number; despeckle?: number; whiteAsTransparent?: boolean; antiphase?: boolean }
</td><td>
.antiphase - 反相,默认 `false`
</td></tr>
</tbody></table>
## Returns
Promise<{ path: string; sourcePreviewUrl: string; previewUrl: string; width: number; height: number } \| undefined>
描摹结果:`path` = SVG D 字符串(放置时回传给临时接口);`sourcePreviewUrl` = 原图预览 dataURL(缩放居中 300×300,对应旧世界 SourceCanvasPreview);`previewUrl` = 描摹结果预览图 dataURL(尺寸 ≤300×300);`width`<!-- -->/`height` = 描摹 bbox 归一最长边 300 基准的尺寸(pixel 语义,与原图分辨率/缩放无关,作为放置尺寸默认值的换算基准);空描摹(没有可描摹的轮廓)返回 `undefined`
## Remarks
纯预览接口,\*\*不触发任何放置工具\*\*(放置由临时接口 `eda.pcb_ImageTool.startPlaceVectorImage` 单独承担)。服务端内置读原始图片尺寸(扩展沙盒无 `new Image()`<!-- -->/canvas,无法提供原始尺寸),返回的 `width`<!-- -->/`height` 为原始自然尺寸(非描摹 bbox 尺寸)。首次调用需传 `imageBlob`<!-- -->(服务端缓存像素),之后拖动只传参数 ADD since EDA v5
## Example
```javascript
// 1. 首次调用:传 imageBlob(服务端缓存像素并读原始尺寸)
const traced = await eda.pcb_MathPolygon.traceImage({ imageBlob, quality: 'low' });
// 2. 拖动滑块:只传参数,不传 imageBlob
const traced2 = await eda.pcb_MathPolygon.traceImage({ quality: 'high', tolerance: 0.5, simplify: 0.2 });
if (traced2) {
console.log('描摹成功:', traced2.path.slice(0, 80), '尺寸', traced2.width, traced2.height);
}
else {
console.log('空描摹:无图可放置');
}
```
references/classes/PCB_Primitive.md
# PCB\_Primitive class
PCB & footprint / primitive class
## Signature
```typescript
class PCB_Primitive
```
## Remarks
Unified operations on primitives
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[getPrimitiveBoardLine(primitiveId, layers)](./PCB_Primitive.md)
</td><td>
</td><td>
**_(BETA)_** Get the board line of the primitive
</td></tr>
<tr><td>
[getPrimitivesBBox(primitiveIds)](./PCB_Primitive.md)
</td><td>
</td><td>
**_(BETA)_** Get The BBox of the primitive
</td></tr>
</tbody></table>
---
## 方法详情
### getprimitiveboardline
# PCB\_Primitive.getPrimitiveBoardLine() method
> 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.
Get the board line of the primitive
## Signature
```typescript
function getPrimitiveBoardLine(
primitiveId: string,
layers?: Array<EPCB_LayerId>,
): Promise<IPCB_ComplexPolygon | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveId
</td><td>
string
</td><td>
Primitive ID
</td></tr>
<tr><td>
layers
</td><td>
Array<[EPCB\_LayerId](../enums/EPCB_LayerId.md)<!-- -->>
</td><td>
_(Optional)_ Layers to calculate. When calculating devices, pads, and vias, the union of the board lines of the specified multiple layers can be precisely calculated
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_ComplexPolygon](./IPCB_ComplexPolygon.md) \| undefined>
Complex polygon. If the primitive ID does not match or the primitive does not exist on the specified layer, `undefined` is returned
## Example
```javascript
// 1. 创建顶层圆形焊盘作为测试图元
const pad = await eda.pcb_PrimitivePad.create(1, '1', 2000, 2000, 0, ['ELLIPSE', 80, 80], '', null, 0, 0, 0, false, 0);
const primitiveId = pad.getState_PrimitiveId();
// 2. 计算边框线:文档签名为同步返回,实测返回 Promise(第二参数可指定参与计算的层)
const pending = eda.pcb_Primitive.getPrimitiveBoardLine(primitiveId, [1]);
// 3. 等待 3 秒观察结果状态(当前版本 Promise 不 settle,用超时保护避免卡住)
const settled = await Promise.race([
Promise.resolve(pending).then(() => 'fulfilled', () => 'rejected'),
new Promise(resolve => setTimeout(() => resolve('pending(3 秒内未返回)'), 3000)),
]);
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitivePad.delete([primitiveId]);
console.log('primitiveId:', primitiveId);
console.log('returns:', typeof pending.then === 'function' ? 'Promise' : typeof pending);
console.log('settled:', settled);
```
### getprimitivesbbox
# PCB\_Primitive.getPrimitivesBBox() method
> 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.
Get The BBox of the primitive
## Signature
```typescript
function getPrimitivesBBox(
primitiveIds: Array<string | IPCB_Primitive>,
): Promise<{ minX: number; minY: number; maxX: number; maxY: number } | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
Array<string \| [IPCB\_Primitive](../interfaces/IPCB_Primitive.md)<!-- -->>
</td><td>
Array of Primitive ID array or primitive objects
</td></tr>
</tbody></table>
## Returns
Promise<{ minX: number; minY: number; maxX: number; maxY: number } \| undefined>
The BBox of the primitive. If the primitive does not exist or has no BBox, `undefined` will be returned
## Example
```javascript
// 1. 创建两个顶层测试焊盘:一个 80x80 放在(2000,2000),一个 60x60 放在(3000,3000)
const pad1 = await eda.pcb_PrimitivePad.create(1, '1', 2000, 2000, 0, ['ELLIPSE', 80, 80], '', null, 0, 0, 0, false, 0);
const pad2 = await eda.pcb_PrimitivePad.create(1, '2', 3000, 3000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
// 2. 计算两个焊盘整体的 BBox(传图元 ID 数组,也支持直接传图元对象数组)
const bbox = await eda.pcb_Primitive.getPrimitivesBBox([pad1.getState_PrimitiveId(), pad2.getState_PrimitiveId()]);
// 3. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitivePad.delete([pad1.getState_PrimitiveId(), pad2.getState_PrimitiveId()]);
console.log('minX:', bbox.minX);
console.log('minY:', bbox.minY);
console.log('maxX:', bbox.maxX);
console.log('maxY:', bbox.maxY);
```
references/classes/PCB_Net.md
# PCB\_Net class
PCB & footprint / net class
## Signature
```typescript
class PCB_Net
```
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[getAllNetName()](./PCB_Net.md)
</td><td>
</td><td>
Get the net names of all nets
</td></tr>
<tr><td>
[getAllNets()](./PCB_Net.md)
</td><td>
</td><td>
**_(BETA)_** Get all Detailed information of the net
</td></tr>
<tr><td>
[getAllNetsName()](./PCB_Net.md)
</td><td>
</td><td>
Get the net names of all nets
</td></tr>
<tr><td>
[getAllPrimitivesByNet(net, primitiveTypes)](./PCB_Net.md)
</td><td>
</td><td>
**_(BETA)_** Get all primitives associated with the specified net
</td></tr>
<tr><td>
[getNet(net)](./PCB_Net.md)
</td><td>
</td><td>
**_(BETA)_** Get Specify detailed information of the net
</td></tr>
<tr><td>
[getNetColor(net)](./PCB_Net.md)
</td><td>
</td><td>
**_(BETA)_** Get the color of the specified net
</td></tr>
<tr><td>
[getNetLength(net)](./PCB_Net.md)
</td><td>
</td><td>
Get the length of the specified net
</td></tr>
<tr><td>
[getNetlist(type)](./PCB_Net.md)
</td><td>
</td><td>
Get the netlist
</td></tr>
<tr><td>
[highlightNet(net)](./PCB_Net.md)
</td><td>
</td><td>
**_(BETA)_** Highlight the net
</td></tr>
<tr><td>
[selectNet(net)](./PCB_Net.md)
</td><td>
</td><td>
**_(BETA)_** Select net
</td></tr>
<tr><td>
[setNetColor(net, color)](./PCB_Net.md)
</td><td>
</td><td>
**_(BETA)_** Set the color of the specified net
</td></tr>
<tr><td>
[setNetlist(type, netlist)](./PCB_Net.md)
</td><td>
</td><td>
Update the netlist
</td></tr>
<tr><td>
[unhighlightAllNets()](./PCB_Net.md)
</td><td>
</td><td>
**_(BETA)_** Unhighlight all nets
</td></tr>
<tr><td>
[unhighlightNet(net)](./PCB_Net.md)
</td><td>
</td><td>
**_(BETA)_** Unhighlight the net
</td></tr>
<tr><td>
[unselectAllNets()](./PCB_Net.md)
</td><td>
</td><td>
**_(BETA)_** Unselect all nets
</td></tr>
<tr><td>
[unselectNet(net)](./PCB_Net.md)
</td><td>
</td><td>
**_(BETA)_** Unselect the net
</td></tr>
</tbody></table>
---
## 方法详情
### getallnetname
# PCB\_Net.getAllNetName() method
> Warning: This API is now obsolete.
>
> Please use [getAllNetsName](./PCB_Net.md) instead
Get the net names of all nets
## Signature
```typescript
function getAllNetName(): Promise<Array<string>>;
```
## Returns
Promise<Array<string>>
Net name array
### getallnets
# PCB\_Net.getAllNets() method
> 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.
Get all Detailed information of the net
## Signature
```typescript
function getAllNets(): Promise<Array<IPCB_NetInfo>>;
```
## Returns
Promise<Array<[IPCB\_NetInfo](../interfaces/IPCB_NetInfo.md)<!-- -->>>
Detailed information of all nets
## Example
```javascript
// 1. 创建带网络名的过孔,让 PCB 中出现可查询的网络
const via = await eda.pcb_PrimitiveVia.create('嘉立创示例_NET1', 2000, 2000, 20, 40);
// 2. 一次性取回当前 PCB 的全部网络详情
const nets = await eda.pcb_Net.getAllNets();
// 3. 查看示例网络的典型属性
const target = nets.find(n => n.net === '嘉立创示例_NET1');
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveVia.delete([via.getState_PrimitiveId()]);
console.log('totalNetCount:', nets.length);
console.log('targetNetName:', target?.net);
console.log('targetNetColor:', target?.color);
console.log('targetNetLength:', target?.length);
```
### getallnetsname
# PCB\_Net.getAllNetsName() method
Get the net names of all nets
## Signature
```typescript
function getAllNetsName(): Promise<Array<string>>;
```
## Returns
Promise<Array<string>>
Net name array
## Example
```javascript
// 1. 创建带网络名的过孔,让 PCB 中出现可查询的网络
const via = await eda.pcb_PrimitiveVia.create('嘉立创示例_NET1', 2000, 2000, 20, 40);
// 2. 获取所有网络的名称数组
const names = await eda.pcb_Net.getAllNetsName();
// 3. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveVia.delete([via.getState_PrimitiveId()]);
console.log('totalNetCount:', names.length);
console.log('netNames:', names.slice(0, 5));
console.log('hasExampleNet:', names.includes('嘉立创示例_NET1'));
```
### getallprimitivesbynet
# PCB\_Net.getAllPrimitivesByNet() method
> 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.
Get all primitives associated with the specified net
## Signature
```typescript
function getAllPrimitivesByNet(
net: string,
primitiveTypes?: Array<EPCB_PrimitiveType>,
): Promise<Array<IPCB_Primitive>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string
</td><td>
Net name
</td></tr>
<tr><td>
primitiveTypes
</td><td>
Array<[EPCB\_PrimitiveType](../enums/EPCB_PrimitiveType.md)<!-- -->>
</td><td>
_(Optional)_ Array of primitive types. If the specified primitive type has no net property, the returned data will always be empty
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_Primitive](../interfaces/IPCB_Primitive.md)<!-- -->>>
Array of primitive objects
## Example
```javascript
// 1. 创建带网络名的过孔,让 PCB 中出现可查询的网络
const via = await eda.pcb_PrimitiveVia.create('嘉立创示例_NET1', 2000, 2000, 20, 40);
// 2. 获取该网络关联的全部图元
const primitives = await eda.pcb_Net.getAllPrimitivesByNet('嘉立创示例_NET1');
// 3. 查看图元数据对象的典型字段(pcbItemPrimitiveType 为图元类型名称)
const first = primitives[0];
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveVia.delete([via.getState_PrimitiveId()]);
console.log('primitiveCount:', primitives.length);
console.log('firstItemPrimitiveType:', first?.pcbItemPrimitiveType);
console.log('firstNet:', first?.net);
console.log('firstCenter:', first?.center);
```
### getnet
# PCB\_Net.getNet() method
> 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.
Get Specify detailed information of the net
## Signature
```typescript
function getNet(net: string): Promise<IPCB_NetInfo | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string
</td><td>
Net name
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_NetInfo](../interfaces/IPCB_NetInfo.md) \| undefined>
Detailed information of the net, `undefined` is does not exist this net
## Example
```javascript
// 1. 创建带网络名的过孔,让 PCB 中出现可查询的网络
const via = await eda.pcb_PrimitiveVia.create('嘉立创示例_NET1', 2000, 2000, 20, 40);
// 2. 查询指定网络的详细信息
const netInfo = await eda.pcb_Net.getNet('嘉立创示例_NET1');
// 3. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveVia.delete([via.getState_PrimitiveId()]);
console.log('netName:', netInfo?.net);
console.log('netColor:', netInfo?.color);
console.log('netLength:', netInfo?.length);
```
### getnetcolor
# PCB\_Net.getNetColor() method
> 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.
Get the color of the specified net
## Signature
```typescript
function getNetColor(net: string): Promise<IPCB_NetInfo['color'] | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string
</td><td>
Net name
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_NetInfo](../interfaces/IPCB_NetInfo.md)<!-- -->\['color'\] \| undefined>
Net color, `undefined` is does not exist this net
## Example
```javascript
// 1. 创建带网络名的过孔,让 PCB 中出现可查询的网络
const via = await eda.pcb_PrimitiveVia.create('嘉立创示例_NET1', 2000, 2000, 20, 40);
// 2. 读取该网络当前的颜色
const color = await eda.pcb_Net.getNetColor('嘉立创示例_NET1');
// 3. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveVia.delete([via.getState_PrimitiveId()]);
console.log('netColor:', color);
```
### getnetlength
# PCB\_Net.getNetLength() method
Get the length of the specified net
## Signature
```typescript
function getNetLength(net: string): Promise<number | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string
</td><td>
Net name
</td></tr>
</tbody></table>
## Returns
Promise<number \| undefined>
Net length. `undefined` means the net does not exist; `0` means the net has no length
## Example
```javascript
// 1. 创建带网络名的过孔和导线(导线长 1000mil,让网络有实际长度)
const via = await eda.pcb_PrimitiveVia.create('嘉立创示例_NET1', 2000, 2000, 20, 40);
const line = await eda.pcb_PrimitiveLine.create('嘉立创示例_NET1', 1, 2000, 2000, 3000, 2000, 10);
// 2. 获取该网络的布线总长
const netLength = await eda.pcb_Net.getNetLength('嘉立创示例_NET1');
// 3. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveVia.delete([via.getState_PrimitiveId()]);
await eda.pcb_PrimitiveLine.delete([line.getState_PrimitiveId()]);
console.log('netLength:', netLength);
```
### getnetlist
# PCB\_Net.getNetlist() method
Get the netlist
## Signature
```typescript
function getNetlist(type?: ESYS_NetlistType): Promise<string>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
type
</td><td>
[ESYS\_NetlistType](../enums/ESYS_NetlistType.md)
</td><td>
_(Optional)_ Netlist format
</td></tr>
</tbody></table>
## Returns
Promise<string>
Netlist data
### highlightnet
# PCB\_Net.highlightNet() method
> 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.
Highlight the net
## Signature
```typescript
function highlightNet(net: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string
</td><td>
Net name
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
The return value of this API is result-oriented. If the net was already highlighted, `true` will also be returned
## Example
```javascript
// 1. 创建带网络名的过孔,让 PCB 中出现可操作的网络
const via = await eda.pcb_PrimitiveVia.create('嘉立创示例_NET1', 2000, 2000, 20, 40);
// 2. 高亮该网络(画布上此网络的图元高亮显示)
const highlighted = await eda.pcb_Net.highlightNet('嘉立创示例_NET1');
// 3. 清理测试图元(操作类需要清理)
await eda.pcb_PrimitiveVia.delete([via.getState_PrimitiveId()]);
console.log('highlighted:', highlighted);
```
### selectnet
# PCB\_Net.selectNet() method
> 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.
Select net
## Signature
```typescript
function selectNet(net: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string
</td><td>
Net name
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 创建带网络名的过孔,让 PCB 中出现可操作的网络
const via = await eda.pcb_PrimitiveVia.create('嘉立创示例_NET1', 2000, 2000, 20, 40);
// 2. 选中该网络(该网络上的全部图元进入选中状态)
const selected = await eda.pcb_Net.selectNet('嘉立创示例_NET1');
// 3. 清理测试图元(操作类需要清理)
await eda.pcb_PrimitiveVia.delete([via.getState_PrimitiveId()]);
console.log('selected:', selected);
```
### setnetcolor
# PCB\_Net.setNetColor() method
> 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.
Set the color of the specified net
## Signature
```typescript
function setNetColor(net: string, color: IPCB_NetInfo['color']): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string
</td><td>
Net name
</td></tr>
<tr><td>
color
</td><td>
[IPCB\_NetInfo](../interfaces/IPCB_NetInfo.md)<!-- -->\['color'\]
</td><td>
Net color
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether Set Successful, `false` is does not exist this net
## Example
```javascript
// 1. 创建带网络名的过孔,让 PCB 中出现可操作的网络
const via = await eda.pcb_PrimitiveVia.create('嘉立创示例_NET1', 2000, 2000, 20, 40);
// 2. 记录修改前的颜色
const before = await eda.pcb_Net.getNetColor('嘉立创示例_NET1');
// 3. 将网络设置为红色(修改类保留现场,便于在画布上观察效果)
const colorSet = await eda.pcb_Net.setNetColor('嘉立创示例_NET1', { r: 255, g: 0, b: 0, alpha: 1 });
// 4. 重新读取颜色,验证修改已生效
const after = await eda.pcb_Net.getNetColor('嘉立创示例_NET1');
console.log('colorSet:', colorSet);
console.log('before:', before);
console.log('after:', after);
```
### setnetlist
# PCB\_Net.setNetlist() method
Update the netlist
## Signature
```typescript
function setNetlist(type: ESYS_NetlistType | undefined, netlist: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
type
</td><td>
[ESYS\_NetlistType](../enums/ESYS_NetlistType.md) \| undefined
</td><td>
Netlist format
</td></tr>
<tr><td>
netlist
</td><td>
string
</td><td>
Netlist data
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
### unhighlightallnets
# PCB\_Net.unhighlightAllNets() method
> 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.
Unhighlight all nets
## Signature
```typescript
function unhighlightAllNets(): Promise<boolean>;
```
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 创建带网络名的过孔并高亮,让画布存在高亮网络
const via = await eda.pcb_PrimitiveVia.create('嘉立创示例_NET1', 2000, 2000, 20, 40);
await eda.pcb_Net.highlightNet('嘉立创示例_NET1');
// 2. 取消所有网络的高亮
const cleared = await eda.pcb_Net.unhighlightAllNets();
// 3. 清理测试图元(操作类需要清理)
await eda.pcb_PrimitiveVia.delete([via.getState_PrimitiveId()]);
console.log('allHighlightsCleared:', cleared);
```
### unhighlightnet
# PCB\_Net.unhighlightNet() method
> 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.
Unhighlight the net
## Signature
```typescript
function unhighlightNet(net: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string
</td><td>
Net name
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
The return value of this API is result-oriented. If the net was not highlighted before, `true` will also be returned
## Example
```javascript
// 1. 创建带网络名的过孔,让 PCB 中出现可操作的网络
const via = await eda.pcb_PrimitiveVia.create('嘉立创示例_NET1', 2000, 2000, 20, 40);
// 2. 先高亮该网络
await eda.pcb_Net.highlightNet('嘉立创示例_NET1');
// 3. 取消该网络的高亮
const unhighlighted = await eda.pcb_Net.unhighlightNet('嘉立创示例_NET1');
// 4. 清理测试图元(操作类需要清理)
await eda.pcb_PrimitiveVia.delete([via.getState_PrimitiveId()]);
console.log('unhighlighted:', unhighlighted);
```
### unselectallnets
# PCB\_Net.unselectAllNets() method
> 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.
Unselect all nets
## Signature
```typescript
function unselectAllNets(): Promise<boolean>;
```
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
If you want to unselect all primitives, use the [PCB\_SelectControl.clearSelected()](./PCB_SelectControl.md) API
## Example
```javascript
// 1. 创建带网络名的过孔并选中,让画布存在选中的网络
const via = await eda.pcb_PrimitiveVia.create('嘉立创示例_NET1', 2000, 2000, 20, 40);
await eda.pcb_Net.selectNet('嘉立创示例_NET1');
// 2. 取消所有网络的选中
const cleared = await eda.pcb_Net.unselectAllNets();
// 3. 清理测试图元(操作类需要清理)
await eda.pcb_PrimitiveVia.delete([via.getState_PrimitiveId()]);
console.log('allSelectionsCleared:', cleared);
```
### unselectnet
# PCB\_Net.unselectNet() method
> 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.
Unselect the net
## Signature
```typescript
function unselectNet(net: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string
</td><td>
Net name
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 创建带网络名的过孔,让 PCB 中出现可操作的网络
const via = await eda.pcb_PrimitiveVia.create('嘉立创示例_NET1', 2000, 2000, 20, 40);
// 2. 先选中该网络
await eda.pcb_Net.selectNet('嘉立创示例_NET1');
// 3. 取消该网络的选中
const unselected = await eda.pcb_Net.unselectNet('嘉立创示例_NET1');
// 4. 清理测试图元(操作类需要清理)
await eda.pcb_PrimitiveVia.delete([via.getState_PrimitiveId()]);
console.log('unselected:', unselected);
```
references/classes/PCB_PrimitiveArc.md
# PCB\_PrimitiveArc class
PCB & footprint / arc line primitive class
## Signature
```typescript
class PCB_PrimitiveArc implements IPCB_PrimitiveAPI
```
**Implements:** [IPCB\_PrimitiveAPI](../interfaces/IPCB_PrimitiveAPI.md)
## Remarks
Both lines and arc lines are wires, corresponding to the line traces and arc traces on the canvas
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[create(net, layer, startX, startY, endX, endY, arcAngle, lineWidth, interactiveMode, primitiveLock)](./PCB_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Create Arc line
</td></tr>
<tr><td>
[delete(primitiveIds)](./PCB_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Delete Arc line
</td></tr>
<tr><td>
[get(primitiveIds)](./PCB_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Get Arc line
</td></tr>
<tr><td>
[get(primitiveIds)](./PCB_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Get Arc line
</td></tr>
<tr><td>
[getAll(net, layer, primitiveLock)](./PCB_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Get all Arc line
</td></tr>
<tr><td>
[getAllPrimitiveId(net, layer, primitiveLock)](./PCB_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Get all Arc line primitive IDs
</td></tr>
<tr><td>
[modify(primitiveId, property)](./PCB_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Modify Arc line
</td></tr>
</tbody></table>
---
## 方法详情
### create
# PCB\_PrimitiveArc.create() method
> 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.
Create Arc line
## Signature
```typescript
function create(
net: string,
layer: TPCB_LayersOfLine,
startX: number,
startY: number,
endX: number,
endY: number,
arcAngle: number,
lineWidth?: number,
interactiveMode?: EPCB_PrimitiveArcInteractiveMode,
primitiveLock?: boolean,
): Promise<IPCB_PrimitiveArc | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string
</td><td>
Net name
</td></tr>
<tr><td>
layer
</td><td>
[TPCB\_LayersOfLine](../types/TPCB_LayersOfLine.md)
</td><td>
Layer
</td></tr>
<tr><td>
startX
</td><td>
number
</td><td>
Start position X
</td></tr>
<tr><td>
startY
</td><td>
number
</td><td>
Start position Y
</td></tr>
<tr><td>
endX
</td><td>
number
</td><td>
End position X
</td></tr>
<tr><td>
endY
</td><td>
number
</td><td>
End position Y
</td></tr>
<tr><td>
arcAngle
</td><td>
number
</td><td>
Arc angle
</td></tr>
<tr><td>
lineWidth
</td><td>
number
</td><td>
_(Optional)_ Line width
</td></tr>
<tr><td>
interactiveMode
</td><td>
[EPCB\_PrimitiveArcInteractiveMode](../enums/EPCB_PrimitiveArcInteractiveMode.md)
</td><td>
_(Optional)_ Interaction mode
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveArc](./IPCB_PrimitiveArc.md) \| undefined>
Arc line primitive object
## Example
```javascript
// 1. 生成随机起点坐标,避免与画布上已有的圆弧重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 在顶层铜层创建一段 90° 圆弧:起点(x, y),终点(x+500, y+300),线宽 10mil,两点圆弧交互(1)
const arc = await eda.pcb_PrimitiveArc.create('', 1, x, y, x + 500, y + 300, 90, 10, 1, false);
// 3. 创建类保留现场,不删除图元
console.log('primitiveId:', arc.getState_PrimitiveId());
console.log('primitiveType:', arc.getState_PrimitiveType());
console.log('startX:', arc.getState_StartX(), 'startY:', arc.getState_StartY());
console.log('endX:', arc.getState_EndX(), 'endY:', arc.getState_EndY());
console.log('arcAngle:', arc.getState_ArcAngle());
console.log('lineWidth:', arc.getState_LineWidth());
```
### delete
# PCB\_PrimitiveArc.delete() method
> 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.
Delete Arc line
## Signature
```typescript
function delete(primitiveIds: string | IPCB_PrimitiveArc | Array<string> | Array<IPCB_PrimitiveArc>): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string \| [IPCB\_PrimitiveArc](./IPCB_PrimitiveArc.md) \| Array<string> \| Array<[IPCB\_PrimitiveArc](./IPCB_PrimitiveArc.md)<!-- -->>
</td><td>
Arc line primitive ID or Arc line primitive object
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Delete Whether the operation is successful
## Example
```javascript
// 1. 创建两段待删除的测试圆弧(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const arc1 = await eda.pcb_PrimitiveArc.create('', 1, x, y, x + 500, y + 300, 90, 10, 1, false);
const arc2 = await eda.pcb_PrimitiveArc.create('', 1, x, y + 500, x + 500, y + 800, 60, 10, 1, false);
// 2. 记录删除前的圆弧数量
const beforeCount = (await eda.pcb_PrimitiveArc.getAll()).length;
// 3. 以 ID 数组形式批量删除两段圆弧
const deleted = await eda.pcb_PrimitiveArc.delete([arc1.getState_PrimitiveId(), arc2.getState_PrimitiveId()]);
// 4. 删除类保留现场(图元已删除,不恢复)
const afterCount = (await eda.pcb_PrimitiveArc.getAll()).length;
console.log('deleted:', deleted);
console.log('beforeCount:', beforeCount, '→ afterCount:', afterCount);
```
### get
# PCB\_PrimitiveArc.get() method
> 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.
Get Arc line
## Signature
```typescript
function get(primitiveIds: string): Promise<IPCB_PrimitiveArc | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string
</td><td>
Arc line primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveArc](./IPCB_PrimitiveArc.md) \| undefined>
Arc line primitive object, `undefined` indicates that the retrieval failed
## Example
```javascript
// 1. 创建两段测试圆弧(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const arc1 = await eda.pcb_PrimitiveArc.create('', 1, x, y, x + 500, y + 300, 90, 10, 1, false);
const arc2 = await eda.pcb_PrimitiveArc.create('', 1, x, y + 500, x + 500, y + 800, 60, 10, 1, false);
// 2. 传单个 ID 字符串,返回单个圆弧对象
const single = await eda.pcb_PrimitiveArc.get(arc1.getState_PrimitiveId());
// 3. 传 ID 数组,返回圆弧对象数组
const arr = await eda.pcb_PrimitiveArc.get([arc1.getState_PrimitiveId(), arc2.getState_PrimitiveId()]);
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveArc.delete([arc1.getState_PrimitiveId(), arc2.getState_PrimitiveId()]);
console.log('single arcAngle:', single.getState_ArcAngle());
console.log('array length:', arr.length);
console.log('arc2 lineWidth:', arr[1].getState_LineWidth());
```
### get_1
# PCB\_PrimitiveArc.get() method
> 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.
Get Arc line
## Signature
```typescript
function get(primitiveIds: Array<string>): Promise<Array<IPCB_PrimitiveArc>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
Array<string>
</td><td>
Arc line primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitiveArc](./IPCB_PrimitiveArc.md)<!-- -->>>
Arc line primitive object; an empty array indicates that the retrieval failed
## Remarks
If multiple primitive IDs are passed in, a primitive ID that is not matched will not affect the return of other primitives; that is, fewer primitive objects than the number of primitive IDs passed in may be returned.
### getall
# PCB\_PrimitiveArc.getAll() method
> 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.
Get all Arc line
## Signature
```typescript
function getAll(
net?: string,
layer?: TPCB_LayersOfLine,
primitiveLock?: boolean,
): Promise<Array<IPCB_PrimitiveArc>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string
</td><td>
_(Optional)_ Net name
</td></tr>
<tr><td>
layer
</td><td>
[TPCB\_LayersOfLine](../types/TPCB_LayersOfLine.md)
</td><td>
_(Optional)_ Layer
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitiveArc](./IPCB_PrimitiveArc.md)<!-- -->>>
Array of Arc line primitive objects
## Example
```javascript
// 1. 创建一段顶层测试圆弧作为过滤目标(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const arc = await eda.pcb_PrimitiveArc.create('', 1, x, y, x + 500, y + 300, 90, 10, 1, false);
const arcId = arc.getState_PrimitiveId();
// 2. 不带参数:获取 PCB 上全部圆弧
const all = await eda.pcb_PrimitiveArc.getAll();
// 3. 按层过滤:只取顶层(1)的圆弧
const topLayer = await eda.pcb_PrimitiveArc.getAll('', 1);
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveArc.delete([arcId]);
console.log('total arcs:', all.length);
console.log('top layer arcs:', topLayer.length);
console.log('marker arc found in top layer:', topLayer.some(a => a.getState_PrimitiveId() === arcId));
```
### getallprimitiveid
# PCB\_PrimitiveArc.getAllPrimitiveId() method
> 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.
Get all Arc line primitive IDs
## Signature
```typescript
function getAllPrimitiveId(
net?: string,
layer?: TPCB_LayersOfLine,
primitiveLock?: boolean,
): Promise<Array<string>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string
</td><td>
_(Optional)_ Net name
</td></tr>
<tr><td>
layer
</td><td>
[TPCB\_LayersOfLine](../types/TPCB_LayersOfLine.md)
</td><td>
_(Optional)_ Layer
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<Array<string>>
Array of Arc line primitive IDs
## Example
```javascript
// 1. 创建一段顶层测试圆弧作为查找目标(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const arc = await eda.pcb_PrimitiveArc.create('', 1, x, y, x + 500, y + 300, 90, 10, 1, false);
const arcId = arc.getState_PrimitiveId();
// 2. 获取全部圆弧的图元 ID
const allIds = await eda.pcb_PrimitiveArc.getAllPrimitiveId();
// 3. 按层过滤:只取顶层(1)圆弧的图元 ID
const topLayerIds = await eda.pcb_PrimitiveArc.getAllPrimitiveId('', 1);
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveArc.delete([arcId]);
console.log('total arc ids:', allIds.length);
console.log('top layer arc ids:', topLayerIds.length);
console.log('marker id in top layer list:', topLayerIds.includes(arcId));
```
### modify
# PCB\_PrimitiveArc.modify() method
> 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.
Modify Arc line
## Signature
```typescript
function modify(
primitiveId: string | IPCB_PrimitiveArc,
property: {
net?: string;
layer?: TPCB_LayersOfLine;
startX?: number;
startY?: number;
endX?: number;
endY?: number;
arcAngle?: number;
lineWidth?: number;
interactiveMode?: EPCB_PrimitiveArcInteractiveMode;
primitiveLock?: boolean;
},
): Promise<IPCB_PrimitiveArc | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveId
</td><td>
string \| [IPCB\_PrimitiveArc](./IPCB_PrimitiveArc.md)
</td><td>
Primitive ID
</td></tr>
<tr><td>
property
</td><td>
{ net?: string; layer?: [TPCB\_LayersOfLine](../types/TPCB_LayersOfLine.md)<!-- -->; startX?: number; startY?: number; endX?: number; endY?: number; arcAngle?: number; lineWidth?: number; interactiveMode?: [EPCB\_PrimitiveArcInteractiveMode](../enums/EPCB_PrimitiveArcInteractiveMode.md)<!-- -->; primitiveLock?: boolean }
</td><td>
Modify Parameter
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveArc](./IPCB_PrimitiveArc.md) \| undefined>
Arc line primitive object
## Remarks
`property.arcAngle` 合法域为 `0 < |arcAngle| < 360`<!-- -->,不支持 0° 或 ±360° 整圆:两点式圆弧无法表达整圆,传入将抛错
## Example
```javascript
// 1. 创建待修改的测试圆弧(随机坐标避免与画布已有圆弧重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const arc = await eda.pcb_PrimitiveArc.create('', 1, x, y, x + 500, y + 300, 90, 10, 1, false);
const arcId = arc.getState_PrimitiveId();
// 2. 读取修改前的线宽与圆心角
const beforeWidth = arc.getState_LineWidth();
const beforeAngle = arc.getState_ArcAngle();
// 3. 批量修改:线宽 10 → 24,圆心角 90 → 120
await eda.pcb_PrimitiveArc.modify(arcId, { lineWidth: 24, arcAngle: 120 });
// 4. modify 返回后需要重新 get() 才能读到画布上的最新值
const refreshed = await eda.pcb_PrimitiveArc.get(arcId);
// 5. 修改类保留现场,供观察修改结果
console.log('primitiveId:', arcId);
console.log('lineWidth:', beforeWidth, '→', refreshed.getState_LineWidth());
console.log('arcAngle:', beforeAngle, '→', refreshed.getState_ArcAngle());
```
references/classes/PCB_PrimitiveAttribute.md
# PCB\_PrimitiveAttribute class
PCB & footprint / property primitive class
## Signature
```typescript
class PCB_PrimitiveAttribute implements IPCB_PrimitiveAPI
```
**Implements:** [IPCB\_PrimitiveAPI](../interfaces/IPCB_PrimitiveAPI.md)
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[delete(primitiveIds)](./PCB_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Delete Property
</td></tr>
<tr><td>
[get(primitiveIds)](./PCB_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Get Property
</td></tr>
<tr><td>
[get(primitiveIds)](./PCB_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Get Property
</td></tr>
<tr><td>
[getAll(parentPrimitiveId, layer, primitiveLock)](./PCB_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Get all Property
</td></tr>
<tr><td>
[getAllPrimitiveId(parentPrimitiveId, layer, primitiveLock)](./PCB_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Get all Property primitive IDs
</td></tr>
<tr><td>
[modify(primitiveId, property)](./PCB_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Modify Text
</td></tr>
</tbody></table>
---
## 方法详情
### delete
# PCB\_PrimitiveAttribute.delete() method
> 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.
Delete Property
## Signature
```typescript
function delete(primitiveIds: string | IPCB_PrimitiveAttribute | Array<string> | Array<IPCB_PrimitiveAttribute>): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string \| [IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md) \| Array<string> \| Array<[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)<!-- -->>
</td><td>
Property primitive ID or Text primitive object
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Delete Whether the operation is successful
## Example
```javascript
// 1. 放置测试器件(随机坐标避免与画布已有器件重合):
// 按立创编号从系统库精确反查器件,返回项不含 libraryUuid,需补上才能用于 create
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
const devices = await eda.lib_Device.searchByProperties({ supplierId: 'C1523' }, undefined, undefined, undefined, 5, 1);
const sysLibUuid = await eda.lib_LibrariesList.getSystemLibraryUuid();
const comp = await eda.pcb_PrimitiveComponent.create({ libraryUuid: sysLibUuid, uuid: devices[0].uuid }, 1, x, y);
const compId = comp.getState_PrimitiveId();
// 2. 给器件添加一条自定义属性作为删除目标
await comp.setAttribute('嘉立创示例_Tolerance', '1%', true, true);
// 3. 找到自定义属性的图元并记录删除前的属性数量
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const target = attrs.find(a => a.getState_Key() === '嘉立创示例_Tolerance');
const beforeCount = attrs.length;
// 4. 以 ID 字符串形式删除该属性
const deleted = await eda.pcb_PrimitiveAttribute.delete(target.getState_PrimitiveId());
// 5. 删除类保留现场(器件留在画布上,属性已删除)
const afterCount = (await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId)).length;
console.log('deleted:', deleted);
console.log('attribute count:', beforeCount, '→', afterCount);
```
### get
# PCB\_PrimitiveAttribute.get() method
> 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.
Get Property
## Signature
```typescript
function get(primitiveIds: string): Promise<IPCB_PrimitiveAttribute | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string
</td><td>
Property primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md) \| undefined>
Attribute primitive object, `undefined` indicates that the retrieval failed
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建):
// 按立创编号从系统库精确反查器件,返回项不含 libraryUuid,需补上才能用于 create
const devices = await eda.lib_Device.searchByProperties({ supplierId: 'C1523' }, undefined, undefined, undefined, 5, 1);
const sysLibUuid = await eda.lib_LibrariesList.getSystemLibraryUuid();
const comp = await eda.pcb_PrimitiveComponent.create({ libraryUuid: sysLibUuid, uuid: devices[0].uuid }, 1, 5000, 5000);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的全部属性图元 ID
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
// 3. 传 ID 数组,返回属性对象数组
const arr = await eda.pcb_PrimitiveAttribute.get(attrIds);
// 4. 传单个 ID 字符串,返回单个属性对象
const single = await eda.pcb_PrimitiveAttribute.get(attrIds[0]);
// 5. 清理测试器件(属性图元随器件一起删除)
await eda.pcb_PrimitiveComponent.delete([compId]);
console.log('array length:', arr.length);
console.log('keys:', arr.map(a => a.getState_Key()).join(', '));
console.log('single value:', single.getState_Value());
```
### get_1
# PCB\_PrimitiveAttribute.get() method
> 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.
Get Property
## Signature
```typescript
function get(primitiveIds: Array<string>): Promise<Array<IPCB_PrimitiveAttribute>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
Array<string>
</td><td>
Property primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)<!-- -->>>
Property primitive object; an empty array indicates that the retrieval failed
## Remarks
If multiple primitive IDs are passed in, a primitive ID that is not matched will not affect the return of other primitives; that is, fewer primitive objects than the number of primitive IDs passed in may be returned.
### getall
# PCB\_PrimitiveAttribute.getAll() method
> 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.
Get all Property
## Signature
```typescript
function getAll(
parentPrimitiveId?: string,
layer?: TPCB_LayersOfImage,
primitiveLock?: boolean,
): Promise<Array<IPCB_PrimitiveAttribute>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
parentPrimitiveId
</td><td>
string
</td><td>
_(Optional)_ Associated parent primitive ID
</td></tr>
<tr><td>
layer
</td><td>
[TPCB\_LayersOfImage](../types/TPCB_LayersOfImage.md)
</td><td>
_(Optional)_ Layer
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)<!-- -->>>
Array of Property primitive objects
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建):
// 按立创编号从系统库精确反查器件,返回项不含 libraryUuid,需补上才能用于 create
const devices = await eda.lib_Device.searchByProperties({ supplierId: 'C1523' }, undefined, undefined, undefined, 5, 1);
const sysLibUuid = await eda.lib_LibrariesList.getSystemLibraryUuid();
const comp = await eda.pcb_PrimitiveComponent.create({ libraryUuid: sysLibUuid, uuid: devices[0].uuid }, 1, 5000, 5000);
const compId = comp.getState_PrimitiveId();
// 2. 不带参数:获取 PCB 上全部属性
const all = await eda.pcb_PrimitiveAttribute.getAll();
// 3. 按父图元过滤:只取该器件的属性
const own = await eda.pcb_PrimitiveAttribute.getAll(compId);
// 4. 叠加层过滤:属性默认在顶层丝印(3)
const silkscreen = await eda.pcb_PrimitiveAttribute.getAll(compId, 3);
// 5. 清理测试器件(属性图元随器件一起删除)
await eda.pcb_PrimitiveComponent.delete([compId]);
console.log('total attributes:', all.length);
console.log('component attributes:', own.length);
console.log('top silkscreen attributes:', silkscreen.length);
console.log('keys:', own.map(a => a.getState_Key()).join(', '));
```
### getallprimitiveid
# PCB\_PrimitiveAttribute.getAllPrimitiveId() method
> 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.
Get all Property primitive IDs
## Signature
```typescript
function getAllPrimitiveId(
parentPrimitiveId?: string,
layer?: TPCB_LayersOfImage,
primitiveLock?: boolean,
): Promise<Array<string>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
parentPrimitiveId
</td><td>
string
</td><td>
_(Optional)_ Associated parent primitive ID
</td></tr>
<tr><td>
layer
</td><td>
[TPCB\_LayersOfImage](../types/TPCB_LayersOfImage.md)
</td><td>
_(Optional)_ Layer
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<Array<string>>
Array of Property primitive IDs
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建):
// 按立创编号从系统库精确反查器件,返回项不含 libraryUuid,需补上才能用于 create
const devices = await eda.lib_Device.searchByProperties({ supplierId: 'C1523' }, undefined, undefined, undefined, 5, 1);
const sysLibUuid = await eda.lib_LibrariesList.getSystemLibraryUuid();
const comp = await eda.pcb_PrimitiveComponent.create({ libraryUuid: sysLibUuid, uuid: devices[0].uuid }, 1, 5000, 5000);
const compId = comp.getState_PrimitiveId();
// 2. 获取 PCB 上全部属性的图元 ID
const allIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId();
// 3. 按父图元过滤:只取该器件的属性图元 ID
const ownIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.pcb_PrimitiveComponent.delete([compId]);
console.log('total attribute ids:', allIds.length);
console.log('component attribute ids:', ownIds.length);
console.log('component ids all in total list:', ownIds.every(id => allIds.includes(id)));
```
### modify
# PCB\_PrimitiveAttribute.modify() method
> 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.
Modify Text
## Signature
```typescript
function modify(
primitiveId: string | IPCB_PrimitiveAttribute,
property: {
layer?: TPCB_LayersOfImage;
x?: number;
y?: number;
key?: string;
value?: string;
keyVisible?: boolean;
valueVisible?: boolean;
fontFamily?: string;
fontSize?: number;
lineWidth?: number;
alignMode?: EPCB_PrimitiveStringAlignMode;
rotation?: number;
reverse?: boolean;
expansion?: number;
mirror?: boolean;
primitiveLock?: boolean;
},
): Promise<IPCB_PrimitiveAttribute | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveId
</td><td>
string \| [IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md)
</td><td>
Primitive ID
</td></tr>
<tr><td>
property
</td><td>
{ layer?: [TPCB\_LayersOfImage](../types/TPCB_LayersOfImage.md)<!-- -->; x?: number; y?: number; key?: string; value?: string; keyVisible?: boolean; valueVisible?: boolean; fontFamily?: string; fontSize?: number; lineWidth?: number; alignMode?: [EPCB\_PrimitiveStringAlignMode](../enums/EPCB_PrimitiveStringAlignMode.md)<!-- -->; rotation?: number; reverse?: boolean; expansion?: number; mirror?: boolean; primitiveLock?: boolean }
</td><td>
Modify Parameter
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveAttribute](./IPCB_PrimitiveAttribute.md) \| undefined>
Text primitive object
## Example
```javascript
// 1. 放置测试器件并添加自定义属性(随机坐标避免与画布已有器件重合):
// 按立创编号从系统库精确反查器件,返回项不含 libraryUuid,需补上才能用于 create
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
const devices = await eda.lib_Device.searchByProperties({ supplierId: 'C1523' }, undefined, undefined, undefined, 5, 1);
const sysLibUuid = await eda.lib_LibrariesList.getSystemLibraryUuid();
const comp = await eda.pcb_PrimitiveComponent.create({ libraryUuid: sysLibUuid, uuid: devices[0].uuid }, 1, x, y);
const compId = comp.getState_PrimitiveId();
await comp.setAttribute('嘉立创示例_Tolerance', '1%', true, true);
// 2. 找到自定义属性的图元并读取修改前的值
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const target = attrs.find(a => a.getState_Key() === '嘉立创示例_Tolerance');
const beforeValue = target.getState_Value();
const beforeFontSize = target.getState_FontSize();
// 3. 批量修改:属性值 1% → 5%,字号 45 → 60
await eda.pcb_PrimitiveAttribute.modify(target.getState_PrimitiveId(), { value: '5%', fontSize: 60 });
// 4. modify 返回后需要重新 get() 才能读到画布上的最新值
const refreshed = await eda.pcb_PrimitiveAttribute.get(target.getState_PrimitiveId());
// 5. 修改类保留现场,供观察修改结果
console.log('value:', beforeValue, '→', refreshed.getState_Value());
console.log('fontSize:', beforeFontSize, '→', refreshed.getState_FontSize());
```
references/classes/PCB_PrimitiveComponent.md
# PCB\_PrimitiveComponent class
PCB & footprint / device primitive class
## Signature
```typescript
class PCB_PrimitiveComponent implements IPCB_PrimitiveAPI
```
**Implements:** [IPCB\_PrimitiveAPI](../interfaces/IPCB_PrimitiveAPI.md)
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[create(component, layer, x, y, rotation, primitiveLock)](./PCB_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Create Device
</td></tr>
<tr><td>
[delete(primitiveIds)](./PCB_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Delete Device
</td></tr>
<tr><td>
[get(primitiveIds)](./PCB_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Get Device
</td></tr>
<tr><td>
[get(primitiveIds)](./PCB_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Get Device
</td></tr>
<tr><td>
[getAll(layer, primitiveLock)](./PCB_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Get all Device
</td></tr>
<tr><td>
[getAllPinsByPrimitiveId(primitiveId)](./PCB_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Get all pads associated with the device
</td></tr>
<tr><td>
[getAllPrimitiveId(layer, primitiveLock)](./PCB_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Get all Device primitive IDs
</td></tr>
<tr><td>
[getAllPropertyNames()](./PCB_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Get The set of all property names of all devices
</td></tr>
<tr><td>
[modify(primitiveId, property)](./PCB_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Modify Device
</td></tr>
<tr><td>
[placeComponentWithMouse(component)](./PCB_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Place with the mouse device
</td></tr>
<tr><td>
[placeFootprintWithMouse(footprint, properties)](./PCB_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Place with the mouse footprint
</td></tr>
</tbody></table>
---
## 方法详情
### create
# PCB\_PrimitiveComponent.create() method
> 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.
Create Device
## Signature
```typescript
function create(
component:
| { libraryUuid: string; uuid: string }
| ILIB_DeviceItem
| ILIB_DeviceSearchItem
| { libraryType: ELIB_LibraryType.FOOTPRINT; libraryUuid: string; uuid: string }
| ILIB_FootprintItem
| ILIB_FootprintSearchItem,
layer: TPCB_LayersOfComponent,
x: number,
y: number,
rotation?: number,
primitiveLock?: boolean,
): Promise<IPCB_PrimitiveComponent | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
component
</td><td>
{ libraryUuid: string; uuid: string } \| [ILIB\_DeviceItem](../interfaces/ILIB_DeviceItem.md) \| [ILIB\_DeviceSearchItem](../interfaces/ILIB_DeviceSearchItem.md) \| { libraryType: [ELIB\_LibraryType.FOOTPRINT](../enums/ELIB_LibraryType.md)<!-- -->; libraryUuid: string; uuid: string } \| [ILIB\_FootprintItem](../interfaces/ILIB_FootprintItem.md) \| [ILIB\_FootprintSearchItem](../interfaces/ILIB_FootprintSearchItem.md)
</td><td>
Associate library device
</td></tr>
<tr><td>
layer
</td><td>
[TPCB\_LayersOfComponent](../types/TPCB_LayersOfComponent.md)
</td><td>
Layer
</td></tr>
<tr><td>
x
</td><td>
number
</td><td>
X coordinate
</td></tr>
<tr><td>
y
</td><td>
number
</td><td>
Y coordinate
</td></tr>
<tr><td>
rotation
</td><td>
number
</td><td>
_(Optional)_ Rotation angle
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md) \| undefined>
Device primitive object
## Example
```javascript
// 1. 按立创编号从系统库精确反查器件,返回项不含 libraryUuid,需补上才能用于 create
// 坐标取随机值,避免与画布上已有的器件重合
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
const devices = await eda.lib_Device.searchByProperties({ supplierId: 'C1523' }, undefined, undefined, undefined, 5, 1);
const sysLibUuid = await eda.lib_LibrariesList.getSystemLibraryUuid();
// 2. 放置到顶层(1),旋转 90°,不锁定
const comp = await eda.pcb_PrimitiveComponent.create({ libraryUuid: sysLibUuid, uuid: devices[0].uuid }, 1, x, y, 90, false);
// 3. 创建类保留现场,不删除器件
console.log('primitiveId:', comp.getState_PrimitiveId());
console.log('designator:', comp.getState_Designator());
console.log('name:', comp.getState_Name());
console.log('footprint:', comp.getState_Footprint());
console.log('layer:', comp.getState_Layer());
console.log('x:', comp.getState_X(), 'y:', comp.getState_Y());
console.log('rotation:', comp.getState_Rotation());
```
### delete
# PCB\_PrimitiveComponent.delete() method
> 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.
Delete Device
## Signature
```typescript
function delete(primitiveIds: string | IPCB_PrimitiveComponent | Array<string> | Array<IPCB_PrimitiveComponent>): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string \| [IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md) \| Array<string> \| Array<[IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)<!-- -->>
</td><td>
Device primitive ID or Device primitive object
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Delete Whether the operation is successful
## Example
```javascript
// 1. 放置一个待删除的测试器件(随机坐标避免与画布已有器件重合):
// 按立创编号从系统库精确反查器件,返回项不含 libraryUuid,需补上才能用于 create
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
const devices = await eda.lib_Device.searchByProperties({ supplierId: 'C1523' }, undefined, undefined, undefined, 5, 1);
const sysLibUuid = await eda.lib_LibrariesList.getSystemLibraryUuid();
const comp = await eda.pcb_PrimitiveComponent.create({ libraryUuid: sysLibUuid, uuid: devices[0].uuid }, 1, x, y);
const compId = comp.getState_PrimitiveId();
// 2. 记录删除前的器件图元 ID 列表
const beforeIds = await eda.pcb_PrimitiveComponent.getAllPrimitiveId();
const beforeContains = beforeIds.includes(compId);
// 3. 以 ID 数组形式删除该器件
const deleted = await eda.pcb_PrimitiveComponent.delete([compId]);
// 4. 验证删除后 ID 列表不再包含该器件
const afterIds = await eda.pcb_PrimitiveComponent.getAllPrimitiveId();
console.log('deleted:', deleted);
console.log('beforeContains:', beforeContains);
console.log('afterContains:', afterIds.includes(compId));
console.log('component count:', beforeIds.length, '→', afterIds.length);
```
### get
# PCB\_PrimitiveComponent.get() method
> 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.
Get Device
## Signature
```typescript
function get(primitiveIds: string): Promise<IPCB_PrimitiveComponent | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string
</td><td>
Device primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md) \| undefined>
Device primitive object, `undefined` indicates that the retrieval failed
## Example
```javascript
// 1. 放置一个测试器件:
// 按立创编号从系统库精确反查器件,返回项不含 libraryUuid,需补上才能用于 create
const devices = await eda.lib_Device.searchByProperties({ supplierId: 'C1523' }, undefined, undefined, undefined, 5, 1);
const sysLibUuid = await eda.lib_LibrariesList.getSystemLibraryUuid();
const comp = await eda.pcb_PrimitiveComponent.create({ libraryUuid: sysLibUuid, uuid: devices[0].uuid }, 1, 5000, 5000);
const compId = comp.getState_PrimitiveId();
// 2. 传单个 ID 字符串,返回单个器件对象
const single = await eda.pcb_PrimitiveComponent.get(compId);
// 3. 传 ID 数组,返回器件对象数组
const arr = await eda.pcb_PrimitiveComponent.get([compId]);
// 4. 清理测试器件
await eda.pcb_PrimitiveComponent.delete([compId]);
console.log('designator:', single.getState_Designator());
console.log('footprint:', single.getState_Footprint());
console.log('x:', single.getState_X(), 'y:', single.getState_Y());
console.log('array length:', arr.length);
console.log('sameId:', arr[0].getState_PrimitiveId() === compId);
```
### get_1
# PCB\_PrimitiveComponent.get() method
> 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.
Get Device
## Signature
```typescript
function get(primitiveIds: Array<string>): Promise<Array<IPCB_PrimitiveComponent>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
Array<string>
</td><td>
Device primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)<!-- -->>>
Device primitive object; an empty array indicates that the retrieval failed
## Remarks
If multiple primitive IDs are passed in, a primitive ID that is not matched will not affect the return of other primitives; that is, fewer primitive objects than the number of primitive IDs passed in may be returned.
### getall
# PCB\_PrimitiveComponent.getAll() method
> 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.
Get all Device
## Signature
```typescript
function getAll(
layer?: TPCB_LayersOfComponent,
primitiveLock?: boolean,
): Promise<Array<IPCB_PrimitiveComponent>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfComponent](../types/TPCB_LayersOfComponent.md)
</td><td>
_(Optional)_ Layer
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)<!-- -->>>
Array of Device primitive objects
## Example
```javascript
// 1. 放置一个测试器件作为过滤参照:
// 按立创编号从系统库精确反查器件,返回项不含 libraryUuid,需补上才能用于 create
const devices = await eda.lib_Device.searchByProperties({ supplierId: 'C1523' }, undefined, undefined, undefined, 5, 1);
const sysLibUuid = await eda.lib_LibrariesList.getSystemLibraryUuid();
const comp = await eda.pcb_PrimitiveComponent.create({ libraryUuid: sysLibUuid, uuid: devices[0].uuid }, 1, 5000, 5000);
const compId = comp.getState_PrimitiveId();
// 2. 不带参数:获取 PCB 上全部器件
const all = await eda.pcb_PrimitiveComponent.getAll();
// 3. 按层过滤:只取顶层(1)器件
const topComps = await eda.pcb_PrimitiveComponent.getAll(1);
// 4. 清理测试器件
await eda.pcb_PrimitiveComponent.delete([compId]);
console.log('total components:', all.length);
console.log('top layer components:', topComps.length);
console.log('fixture included:', all.some(c => c.getState_PrimitiveId() === compId));
console.log('designators:', all.map(c => c.getState_Designator()).join(', '));
```
### getallpinsbyprimitiveid
# PCB\_PrimitiveComponent.getAllPinsByPrimitiveId() method
> 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.
Get all pads associated with the device
## Signature
```typescript
function getAllPinsByPrimitiveId(
primitiveId: string,
): Promise<Array<IPCB_PrimitiveComponentPad> | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveId
</td><td>
string
</td><td>
Device primitive ID
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitiveComponentPad](./IPCB_PrimitiveComponentPad.md)<!-- -->> \| undefined>
Device pad primitive array
## Example
```javascript
// 1. 放置一个测试器件:
// 按立创编号从系统库精确反查器件,返回项不含 libraryUuid,需补上才能用于 create
const devices = await eda.lib_Device.searchByProperties({ supplierId: 'C1523' }, undefined, undefined, undefined, 5, 1);
const sysLibUuid = await eda.lib_LibrariesList.getSystemLibraryUuid();
const comp = await eda.pcb_PrimitiveComponent.create({ libraryUuid: sysLibUuid, uuid: devices[0].uuid }, 1, 5000, 5000);
const compId = comp.getState_PrimitiveId();
// 2. 取出该器件的全部焊盘图元对象
const pins = await eda.pcb_PrimitiveComponent.getAllPinsByPrimitiveId(compId);
// 3. 读取每个焊盘的归属与坐标,确认都属于该器件
const parentIds = pins.map(pin => pin.getState_ParentComponentPrimitiveId());
// 4. 清理测试器件(焊盘随器件一起删除)
await eda.pcb_PrimitiveComponent.delete([compId]);
console.log('pinCount:', pins.length);
console.log('allBelongToComponent:', parentIds.every(id => id === compId));
console.log('firstPin:', 'x:', pins[0].getState_X(), 'y:', pins[0].getState_Y());
console.log('firstPinParentId:', parentIds[0]);
```
### getallprimitiveid
# PCB\_PrimitiveComponent.getAllPrimitiveId() method
> 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.
Get all Device primitive IDs
## Signature
```typescript
function getAllPrimitiveId(
layer?: TPCB_LayersOfComponent,
primitiveLock?: boolean,
): Promise<Array<string>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfComponent](../types/TPCB_LayersOfComponent.md)
</td><td>
_(Optional)_ Layer
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<Array<string>>
Array of Device primitive IDs
## Example
```javascript
// 1. 放置一个测试器件作为过滤参照:
// 按立创编号从系统库精确反查器件,返回项不含 libraryUuid,需补上才能用于 create
const devices = await eda.lib_Device.searchByProperties({ supplierId: 'C1523' }, undefined, undefined, undefined, 5, 1);
const sysLibUuid = await eda.lib_LibrariesList.getSystemLibraryUuid();
const comp = await eda.pcb_PrimitiveComponent.create({ libraryUuid: sysLibUuid, uuid: devices[0].uuid }, 1, 5000, 5000);
const compId = comp.getState_PrimitiveId();
// 2. 不带参数:获取全部器件的图元 ID
const allIds = await eda.pcb_PrimitiveComponent.getAllPrimitiveId();
// 3. 按层过滤:只取顶层(1)器件的图元 ID
const topIds = await eda.pcb_PrimitiveComponent.getAllPrimitiveId(1);
// 4. 清理测试器件
await eda.pcb_PrimitiveComponent.delete([compId]);
console.log('total ids:', allIds.length);
console.log('top layer ids:', topIds.length);
console.log('fixture included:', allIds.includes(compId));
console.log('firstId:', allIds[0]);
```
### getallpropertynames
# PCB\_PrimitiveComponent.getAllPropertyNames() method
> 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.
Get The set of all property names of all devices
## Signature
```typescript
function getAllPropertyNames(): Promise<Array<string>>;
```
## Returns
Promise<Array<string>>
The set of all property names of all devices
## Example
```javascript
// 1. 放置一个测试器件:
// 按立创编号从系统库精确反查器件,返回项不含 libraryUuid,需补上才能用于 create
const devices = await eda.lib_Device.searchByProperties({ supplierId: 'C1523' }, undefined, undefined, undefined, 5, 1);
const sysLibUuid = await eda.lib_LibrariesList.getSystemLibraryUuid();
const comp = await eda.pcb_PrimitiveComponent.create({ libraryUuid: sysLibUuid, uuid: devices[0].uuid }, 1, 5000, 5000);
const compId = comp.getState_PrimitiveId();
// 2. 获取 PCB 上所有器件的属性名称集合(无参数)
const names = await eda.pcb_PrimitiveComponent.getAllPropertyNames();
// 3. 清理测试器件
await eda.pcb_PrimitiveComponent.delete([compId]);
console.log('property name count:', names.length);
console.log('names:', names.join(', '));
```
### modify
# PCB\_PrimitiveComponent.modify() method
> 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.
Modify Device
## Signature
```typescript
function modify(
primitiveId: string | IPCB_PrimitiveComponent,
property: {
layer?: TPCB_LayersOfComponent;
x?: number;
y?: number;
rotation?: number;
primitiveLock?: boolean;
addIntoBom?: boolean;
designator?: string | null;
name?: string | null;
uniqueId?: string | null;
manufacturer?: string | null;
manufacturerId?: string | null;
supplier?: string | null;
supplierId?: string | null;
otherProperty?: Record<string, any>;
},
): Promise<IPCB_PrimitiveComponent | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveId
</td><td>
string \| [IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md)
</td><td>
Primitive ID
</td></tr>
<tr><td>
property
</td><td>
{ layer?: [TPCB\_LayersOfComponent](../types/TPCB_LayersOfComponent.md)<!-- -->; x?: number; y?: number; rotation?: number; primitiveLock?: boolean; addIntoBom?: boolean; designator?: string \| null; name?: string \| null; uniqueId?: string \| null; manufacturer?: string \| null; manufacturerId?: string \| null; supplier?: string \| null; supplierId?: string \| null; otherProperty?: Record<string, any> }
</td><td>
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveComponent](./IPCB_PrimitiveComponent.md) \| undefined>
Device primitive object
## Example
```javascript
// 1. 放置待修改的测试器件(随机坐标避免与画布已有器件重合):
// 按立创编号从系统库精确反查器件,返回项不含 libraryUuid,需补上才能用于 create
const x = 20000 + Math.floor(Math.random() * 80000);
const y = 20000 + Math.floor(Math.random() * 80000);
const devices = await eda.lib_Device.searchByProperties({ supplierId: 'C1523' }, undefined, undefined, undefined, 5, 1);
const sysLibUuid = await eda.lib_LibrariesList.getSystemLibraryUuid();
const comp = await eda.pcb_PrimitiveComponent.create({ libraryUuid: sysLibUuid, uuid: devices[0].uuid }, 1, x, y);
const compId = comp.getState_PrimitiveId();
// 2. 读取修改前的位置与旋转角度
const beforeX = comp.getState_X();
const beforeY = comp.getState_Y();
const beforeRotation = comp.getState_Rotation();
// 3. 批量修改:平移 500mil,旋转 0° → 90°
await eda.pcb_PrimitiveComponent.modify(compId, { x: beforeX + 500, y: beforeY + 500, rotation: 90 });
// 4. modify 返回后需要重新 get() 才能读到画布上的最新值
const refreshed = await eda.pcb_PrimitiveComponent.get(compId);
// 5. 修改类保留现场,供观察修改结果
console.log('primitiveId:', compId);
console.log('x:', beforeX, '→', refreshed.getState_X());
console.log('y:', beforeY, '→', refreshed.getState_Y());
console.log('rotation:', beforeRotation, '→', refreshed.getState_Rotation());
```
### placecomponentwithmouse
# PCB\_PrimitiveComponent.placeComponentWithMouse() method
> 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.
Place with the mouse device
## Signature
```typescript
function placeComponentWithMouse(
component: { libraryUuid: string; uuid: string } | ILIB_DeviceItem | ILIB_DeviceSearchItem,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
component
</td><td>
{ libraryUuid: string; uuid: string } \| [ILIB\_DeviceItem](../interfaces/ILIB_DeviceItem.md) \| [ILIB\_DeviceSearchItem](../interfaces/ILIB_DeviceSearchItem.md)
</td><td>
Associate library device
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the device was found
## Remarks
This API simulates clicking the placement button on the front end. The specified device will be bound to the current mouse and placed on the canvas when the user clicks subsequently
The return timing of this API does not wait for the user's placement operation. Once the device is bound to the mouse, this API will immediately return `true`
### placefootprintwithmouse
# PCB\_PrimitiveComponent.placeFootprintWithMouse() method
> 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.
Place with the mouse footprint
## Signature
```typescript
function placeFootprintWithMouse(
footprint:
{ libraryUuid: string; uuid: string } | ILIB_FootprintItem | ILIB_FootprintSearchItem,
properties?: Record<string, boolean | number | string | undefined>,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
footprint
</td><td>
{ libraryUuid: string; uuid: string } \| [ILIB\_FootprintItem](../interfaces/ILIB_FootprintItem.md) \| [ILIB\_FootprintSearchItem](../interfaces/ILIB_FootprintSearchItem.md)
</td><td>
Associate library footprint
</td></tr>
<tr><td>
properties
</td><td>
Record<string, boolean \| number \| string \| undefined>
</td><td>
_(Optional)_ Device property
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the footprint was found
## Remarks
This API simulates clicking the placement button on the front end. The specified footprint will be bound to the current mouse and placed on the canvas when the user clicks subsequently
The return timing of this API does not wait for the user's placement operation. Once the footprint is bound to the mouse, this API will immediately return `true` ADD since API v0.2.26
references/classes/PCB_PrimitiveDimension.md
# PCB\_PrimitiveDimension class
PCB & footprint / dimension primitive class
## Signature
```typescript
class PCB_PrimitiveDimension implements IPCB_PrimitiveAPI
```
**Implements:** [IPCB\_PrimitiveAPI](../interfaces/IPCB_PrimitiveAPI.md)
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[create(dimensionType, coordinateSet, layer, unit, lineWidth, precision, primitiveLock)](./PCB_PrimitiveDimension.md)
</td><td>
</td><td>
Create a dimension
</td></tr>
<tr><td>
[delete(primitiveIds)](./PCB_PrimitiveDimension.md)
</td><td>
</td><td>
**_(BETA)_** Delete the dimension
</td></tr>
<tr><td>
[get(primitiveIds)](./PCB_PrimitiveDimension.md)
</td><td>
</td><td>
**_(BETA)_** Get the dimension
</td></tr>
<tr><td>
[get(primitiveIds)](./PCB_PrimitiveDimension.md)
</td><td>
</td><td>
**_(BETA)_** Get the dimension
</td></tr>
<tr><td>
[getAll(layer, primitiveLock)](./PCB_PrimitiveDimension.md)
</td><td>
</td><td>
**_(BETA)_** Get all dimensions
</td></tr>
<tr><td>
[getAllPrimitiveId(layer, primitiveLock)](./PCB_PrimitiveDimension.md)
</td><td>
</td><td>
**_(BETA)_** Get the primitive IDs of all dimensions
</td></tr>
<tr><td>
[modify(primitiveId, property)](./PCB_PrimitiveDimension.md)
</td><td>
</td><td>
**_(BETA)_** Modify the dimension
</td></tr>
</tbody></table>
---
## 方法详情
### create
# PCB\_PrimitiveDimension.create() method
Create a dimension
## Signature
```typescript
function create(
dimensionType: EPCB_PrimitiveDimensionType,
coordinateSet: TPCB_PrimitiveDimensionCoordinateSet,
layer?: TPCB_LayersOfDimension,
unit?: ESYS_Unit.MILLIMETER | ESYS_Unit.CENTIMETER | ESYS_Unit.INCH | ESYS_Unit.MIL,
lineWidth?: number,
precision?: number,
primitiveLock?: boolean,
): Promise<IPCB_PrimitiveDimension | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
dimensionType
</td><td>
[EPCB\_PrimitiveDimensionType](../enums/EPCB_PrimitiveDimensionType.md)
</td><td>
Dimension type
</td></tr>
<tr><td>
coordinateSet
</td><td>
[TPCB\_PrimitiveDimensionCoordinateSet](../types/TPCB_PrimitiveDimensionCoordinateSet.md)
</td><td>
Dimension coordinate set
</td></tr>
<tr><td>
layer
</td><td>
[TPCB\_LayersOfDimension](../types/TPCB_LayersOfDimension.md)
</td><td>
_(Optional)_ Layer
</td></tr>
<tr><td>
unit
</td><td>
[ESYS\_Unit.MILLIMETER](../enums/ESYS_Unit.md) \| [ESYS\_Unit.CENTIMETER](../enums/ESYS_Unit.md) \| [ESYS\_Unit.INCH](../enums/ESYS_Unit.md) \| [ESYS\_Unit.MIL](../enums/ESYS_Unit.md)
</td><td>
_(Optional)_ Unit
</td></tr>
<tr><td>
lineWidth
</td><td>
number
</td><td>
_(Optional)_ Line width
</td></tr>
<tr><td>
precision
</td><td>
number
</td><td>
_(Optional)_ Precision, value range `0`<!-- -->-`4`
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveDimension](./IPCB_PrimitiveDimension.md) \| undefined>
Dimension primitive object
## Example
```javascript
// 1. 生成随机基准坐标,避免与画布上已有的标注重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 在顶层丝印(3)创建长度标注:测量 (x, y) 到 (x+2000, y) 的水平距离,
// 箭头端点向内收 200mil,单位毫米(mm),线宽 10mil,精度 2 位小数
const dim = await eda.pcb_PrimitiveDimension.create(
'Length Dimension',
[x, y, x, y - 200, x + 2000, y - 200, x + 2000, y],
3,
'mm',
10,
2,
false
);
// 3. 创建类保留现场,不删除图元
console.log('primitiveId:', dim.getState_PrimitiveId());
console.log('dimensionType:', dim.getState_DimensionType());
console.log('layer:', dim.getState_Layer());
console.log('unit:', dim.getState_Unit());
console.log('lineWidth:', dim.getState_LineWidth());
console.log('precision:', dim.getState_Precision());
```
### delete
# PCB\_PrimitiveDimension.delete() method
> 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.
Delete the dimension
## Signature
```typescript
function delete(primitiveIds: string | IPCB_PrimitiveDimension | Array<string> | Array<IPCB_PrimitiveDimension>): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string \| [IPCB\_PrimitiveDimension](./IPCB_PrimitiveDimension.md) \| Array<string> \| Array<[IPCB\_PrimitiveDimension](./IPCB_PrimitiveDimension.md)<!-- -->>
</td><td>
Primitive ID of the dimension or the dimension primitive object
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Delete Whether the operation is successful
## Example
```javascript
// 1. 创建两个待删除的测试标注(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const dim1 = await eda.pcb_PrimitiveDimension.create(
'Length Dimension',
[x, y, x, y - 200, x + 2000, y - 200, x + 2000, y],
3
);
const dim2 = await eda.pcb_PrimitiveDimension.create(
'Length Dimension',
[x, y + 1000, x, y + 800, x + 2000, y + 800, x + 2000, y + 1000],
3
);
// 2. 记录删除前的标注数量
const beforeCount = (await eda.pcb_PrimitiveDimension.getAll()).length;
// 3. 以 ID 数组形式批量删除两个标注
const deleted = await eda.pcb_PrimitiveDimension.delete([
dim1.getState_PrimitiveId(),
dim2.getState_PrimitiveId()
]);
// 4. 删除类保留现场(图元已删除,不恢复)
const afterCount = (await eda.pcb_PrimitiveDimension.getAll()).length;
console.log('deleted:', deleted);
console.log('beforeCount:', beforeCount, '→ afterCount:', afterCount);
```
### get
# PCB\_PrimitiveDimension.get() method
> 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.
Get the dimension
## Signature
```typescript
function get(primitiveIds: string): Promise<IPCB_PrimitiveDimension | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string
</td><td>
Primitive ID of the dimension, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveDimension](./IPCB_PrimitiveDimension.md) \| undefined>
Dimension primitive object, `undefined` indicates that the retrieval failed
## Example
```javascript
// 1. 创建两个测试标注(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const dim1 = await eda.pcb_PrimitiveDimension.create(
'Length Dimension',
[x, y, x, y - 200, x + 2000, y - 200, x + 2000, y],
3,
'mm'
);
const dim2 = await eda.pcb_PrimitiveDimension.create(
'Length Dimension',
[x, y + 1000, x, y + 800, x + 2000, y + 800, x + 2000, y + 1000],
3,
'mil'
);
// 2. 传单个 ID 字符串,返回单个标注对象
const single = await eda.pcb_PrimitiveDimension.get(dim1.getState_PrimitiveId());
// 3. 传 ID 数组,返回标注对象数组
const arr = await eda.pcb_PrimitiveDimension.get([
dim1.getState_PrimitiveId(),
dim2.getState_PrimitiveId()
]);
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveDimension.delete([
dim1.getState_PrimitiveId(),
dim2.getState_PrimitiveId()
]);
console.log('single dimensionType:', single.getState_DimensionType());
console.log('single unit:', single.getState_Unit());
console.log('array length:', arr.length);
console.log('dim2 unit:', arr[1].getState_Unit());
```
### get_1
# PCB\_PrimitiveDimension.get() method
> 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.
Get the dimension
## Signature
```typescript
function get(primitiveIds: Array<string>): Promise<Array<IPCB_PrimitiveDimension>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
Array<string>
</td><td>
Primitive ID of the dimension, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitiveDimension](./IPCB_PrimitiveDimension.md)<!-- -->>>
Dimension primitive object; an empty array indicates that the retrieval failed
## Remarks
If multiple primitive IDs are passed in, a primitive ID that is not matched will not affect the return of other primitives; that is, fewer primitive objects than the number of primitive IDs passed in may be returned.
### getall
# PCB\_PrimitiveDimension.getAll() method
> 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.
Get all dimensions
## Signature
```typescript
function getAll(
layer?: TPCB_LayersOfDimension,
primitiveLock?: boolean,
): Promise<Array<IPCB_PrimitiveDimension>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfDimension](../types/TPCB_LayersOfDimension.md)
</td><td>
_(Optional)_ Layer
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitiveDimension](./IPCB_PrimitiveDimension.md)<!-- -->>>
Dimension primitive object array
## Example
```javascript
// 1. 创建一个顶层丝印(3)测试标注作为过滤目标(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const dim = await eda.pcb_PrimitiveDimension.create(
'Length Dimension',
[x, y, x, y - 200, x + 2000, y - 200, x + 2000, y],
3
);
const dimId = dim.getState_PrimitiveId();
// 2. 不带参数:获取 PCB 上全部尺寸标注
const all = await eda.pcb_PrimitiveDimension.getAll();
// 3. 按层过滤:只取顶层丝印(3)的标注
const topSilk = await eda.pcb_PrimitiveDimension.getAll(3);
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveDimension.delete([dimId]);
console.log('total dimensions:', all.length);
console.log('top silkscreen dimensions:', topSilk.length);
console.log('marker dimension found:', topSilk.some(d => d.getState_PrimitiveId() === dimId));
```
### getallprimitiveid
# PCB\_PrimitiveDimension.getAllPrimitiveId() method
> 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.
Get the primitive IDs of all dimensions
## Signature
```typescript
function getAllPrimitiveId(
layer?: TPCB_LayersOfDimension,
primitiveLock?: boolean,
): Promise<Array<string>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfDimension](../types/TPCB_LayersOfDimension.md)
</td><td>
_(Optional)_ Layer
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<Array<string>>
Array of dimension primitive IDs
## Example
```javascript
// 1. 创建一个顶层丝印(3)测试标注作为查找目标(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const dim = await eda.pcb_PrimitiveDimension.create(
'Length Dimension',
[x, y, x, y - 200, x + 2000, y - 200, x + 2000, y],
3
);
const dimId = dim.getState_PrimitiveId();
// 2. 获取全部尺寸标注的图元 ID
const allIds = await eda.pcb_PrimitiveDimension.getAllPrimitiveId();
// 3. 按层过滤:只取顶层丝印(3)标注的图元 ID
const topSilkIds = await eda.pcb_PrimitiveDimension.getAllPrimitiveId(3);
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveDimension.delete([dimId]);
console.log('total dimension ids:', allIds.length);
console.log('top silkscreen dimension ids:', topSilkIds.length);
console.log('marker id in top silkscreen list:', topSilkIds.includes(dimId));
```
### modify
# PCB\_PrimitiveDimension.modify() method
> 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.
Modify the dimension
## Signature
```typescript
function modify(
primitiveId: string | IPCB_PrimitiveDimension,
property: {
dimensionType?: EPCB_PrimitiveDimensionType;
coordinateSet?: TPCB_PrimitiveDimensionCoordinateSet;
layer?: TPCB_LayersOfDimension;
unit?: ESYS_Unit.MILLIMETER | ESYS_Unit.CENTIMETER | ESYS_Unit.INCH | ESYS_Unit.MIL;
lineWidth?: number;
precision?: number;
primitiveLock?: boolean;
},
): Promise<IPCB_PrimitiveDimension | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveId
</td><td>
string \| [IPCB\_PrimitiveDimension](./IPCB_PrimitiveDimension.md)
</td><td>
Primitive ID
</td></tr>
<tr><td>
property
</td><td>
{ dimensionType?: [EPCB\_PrimitiveDimensionType](../enums/EPCB_PrimitiveDimensionType.md)<!-- -->; coordinateSet?: [TPCB\_PrimitiveDimensionCoordinateSet](../types/TPCB_PrimitiveDimensionCoordinateSet.md)<!-- -->; layer?: [TPCB\_LayersOfDimension](../types/TPCB_LayersOfDimension.md)<!-- -->; unit?: [ESYS\_Unit.MILLIMETER](../enums/ESYS_Unit.md) \| [ESYS\_Unit.CENTIMETER](../enums/ESYS_Unit.md) \| [ESYS\_Unit.INCH](../enums/ESYS_Unit.md) \| [ESYS\_Unit.MIL](../enums/ESYS_Unit.md)<!-- -->; lineWidth?: number; precision?: number; primitiveLock?: boolean }
</td><td>
Modify Parameter
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveDimension](./IPCB_PrimitiveDimension.md) \| undefined>
Dimension primitive object
## Example
```javascript
// 1. 创建待修改的测试标注(随机坐标避免与画布已有标注重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const dim = await eda.pcb_PrimitiveDimension.create(
'Length Dimension',
[x, y, x, y - 200, x + 2000, y - 200, x + 2000, y],
3,
'mm',
10,
2
);
const dimId = dim.getState_PrimitiveId();
// 2. 读取修改前的线宽与精度
const beforeWidth = dim.getState_LineWidth();
const beforePrecision = dim.getState_Precision();
// 3. 批量修改:线宽 10 → 20,精度 2 → 3
await eda.pcb_PrimitiveDimension.modify(dimId, { lineWidth: 20, precision: 3 });
// 4. modify 返回后需要重新 get() 才能读到画布上的最新值
const refreshed = await eda.pcb_PrimitiveDimension.get(dimId);
// 5. 修改类保留现场,供观察修改结果
console.log('primitiveId:', dimId);
console.log('lineWidth:', beforeWidth, '→', refreshed.getState_LineWidth());
console.log('precision:', beforePrecision, '→', refreshed.getState_Precision());
```
references/classes/PCB_PrimitiveFill.md
# PCB\_PrimitiveFill class
PCB & footprint / fill primitive class
## Signature
```typescript
class PCB_PrimitiveFill implements IPCB_PrimitiveAPI
```
**Implements:** [IPCB\_PrimitiveAPI](../interfaces/IPCB_PrimitiveAPI.md)
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[create(layer, complexPolygon, net, fillMode, lineWidth, primitiveLock)](./PCB_PrimitiveFill.md)
</td><td>
</td><td>
**_(BETA)_** Create a fill
</td></tr>
<tr><td>
[delete(primitiveIds)](./PCB_PrimitiveFill.md)
</td><td>
</td><td>
**_(BETA)_** Delete the fill
</td></tr>
<tr><td>
[get(primitiveIds)](./PCB_PrimitiveFill.md)
</td><td>
</td><td>
**_(BETA)_** Get the fill
</td></tr>
<tr><td>
[get(primitiveIds)](./PCB_PrimitiveFill.md)
</td><td>
</td><td>
**_(BETA)_** Get the fill
</td></tr>
<tr><td>
[getAll(layer, net, primitiveLock)](./PCB_PrimitiveFill.md)
</td><td>
</td><td>
**_(BETA)_** Get all fills
</td></tr>
<tr><td>
[getAllPrimitiveId(layer, net, primitiveLock)](./PCB_PrimitiveFill.md)
</td><td>
</td><td>
**_(BETA)_** Get the primitive IDs of all fills
</td></tr>
<tr><td>
[modify(primitiveId, property)](./PCB_PrimitiveFill.md)
</td><td>
</td><td>
**_(BETA)_** Modify the fill
</td></tr>
</tbody></table>
---
## 方法详情
### create
# PCB\_PrimitiveFill.create() method
> 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.
Create a fill
## Signature
```typescript
function create(
layer: TPCB_LayersOfFill,
complexPolygon: IPCB_Polygon,
net?: string,
fillMode?: EPCB_PrimitiveFillMode,
lineWidth?: number,
primitiveLock?: boolean,
): Promise<IPCB_PrimitiveFill | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfFill](../types/TPCB_LayersOfFill.md)
</td><td>
Layer
</td></tr>
<tr><td>
complexPolygon
</td><td>
[IPCB\_Polygon](./IPCB_Polygon.md)
</td><td>
Complex polygon object
</td></tr>
<tr><td>
net
</td><td>
string
</td><td>
_(Optional)_ Net name
</td></tr>
<tr><td>
fillMode
</td><td>
[EPCB\_PrimitiveFillMode](../enums/EPCB_PrimitiveFillMode.md)
</td><td>
_(Optional)_ Fill mode
</td></tr>
<tr><td>
lineWidth
</td><td>
number
</td><td>
_(Optional)_ Line width
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveFill](./IPCB_PrimitiveFill.md) \| undefined>
Fill primitive object
## Example
```javascript
// 1. 生成随机基准坐标,避免与画布上已有的填充重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 构造矩形轮廓(宽 500mil、高 300mil),填充轮廓必须是 MathPolygon 对象
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
// 3. 在顶层铜层(1)创建实心填充(SOLID=0),不挂网络,不锁定
const fill = await eda.pcb_PrimitiveFill.create(1, polygon, '', 0, 10, false);
// 4. 创建类保留现场,不删除图元
console.log('primitiveId:', fill.getState_PrimitiveId());
console.log('layer:', fill.getState_Layer());
console.log('fillMode:', fill.getState_FillMode());
console.log('net:', fill.getState_Net());
console.log('primitiveType:', fill.getState_PrimitiveType());
```
### delete
# PCB\_PrimitiveFill.delete() method
> 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.
Delete the fill
## Signature
```typescript
function delete(primitiveIds: string | IPCB_PrimitiveFill | Array<string> | Array<IPCB_PrimitiveFill>): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string \| [IPCB\_PrimitiveFill](./IPCB_PrimitiveFill.md) \| Array<string> \| Array<[IPCB\_PrimitiveFill](./IPCB_PrimitiveFill.md)<!-- -->>
</td><td>
Primitive ID of the fill or the fill primitive object
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Delete Whether the operation is successful
## Example
```javascript
// 1. 创建两个待删除的测试填充(随机坐标避免与画布已有填充重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon1 = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const polygon2 = eda.pcb_MathPolygon.createPolygon(['R', x, y + 1000, 500, 300, 0, 0]);
const fill1 = await eda.pcb_PrimitiveFill.create(1, polygon1, '', 0, 10, false);
const fill2 = await eda.pcb_PrimitiveFill.create(1, polygon2, '', 0, 10, false);
// 2. 记录删除前的填充数量
const beforeCount = (await eda.pcb_PrimitiveFill.getAll()).length;
// 3. 以 ID 数组形式批量删除两个填充
const deleted = await eda.pcb_PrimitiveFill.delete([
fill1.getState_PrimitiveId(),
fill2.getState_PrimitiveId()
]);
// 4. 删除类保留现场(图元已删除,不恢复)
const afterCount = (await eda.pcb_PrimitiveFill.getAll()).length;
console.log('deleted:', deleted);
console.log('beforeCount:', beforeCount, '→ afterCount:', afterCount);
```
### get
# PCB\_PrimitiveFill.get() method
> 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.
Get the fill
## Signature
```typescript
function get(primitiveIds: string): Promise<IPCB_PrimitiveFill | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string
</td><td>
Primitive ID of the fill, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveFill](./IPCB_PrimitiveFill.md) \| undefined>
Fill primitive object, `undefined` indicates that the retrieval failed
## Example
```javascript
// 1. 创建两个测试填充(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const fill1 = await eda.pcb_PrimitiveFill.create(
1,
eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]),
'',
0,
10,
false
);
const fill2 = await eda.pcb_PrimitiveFill.create(
2,
eda.pcb_MathPolygon.createPolygon(['R', x, y + 1000, 500, 300, 0, 0]),
'',
0,
10,
false
);
// 2. 传单个 ID 字符串,返回单个填充对象
const single = await eda.pcb_PrimitiveFill.get(fill1.getState_PrimitiveId());
// 3. 传 ID 数组,返回填充对象数组
const arr = await eda.pcb_PrimitiveFill.get([
fill1.getState_PrimitiveId(),
fill2.getState_PrimitiveId()
]);
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveFill.delete([
fill1.getState_PrimitiveId(),
fill2.getState_PrimitiveId()
]);
console.log('single layer:', single.getState_Layer());
console.log('single fillMode:', single.getState_FillMode());
console.log('array length:', arr.length);
console.log('fill2 layer:', arr[1].getState_Layer());
```
### get_1
# PCB\_PrimitiveFill.get() method
> 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.
Get the fill
## Signature
```typescript
function get(primitiveIds: Array<string>): Promise<Array<IPCB_PrimitiveFill>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
Array<string>
</td><td>
Primitive ID of the fill, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitiveFill](./IPCB_PrimitiveFill.md)<!-- -->>>
Fill primitive object; an empty array indicates that the retrieval failed
## Remarks
If multiple primitive IDs are passed in, a primitive ID that is not matched will not affect the return of other primitives; that is, fewer primitive objects than the number of primitive IDs passed in may be returned.
### getall
# PCB\_PrimitiveFill.getAll() method
> 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.
Get all fills
## Signature
```typescript
function getAll(
layer?: TPCB_LayersOfFill,
net?: string,
primitiveLock?: boolean,
): Promise<Array<IPCB_PrimitiveFill>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfFill](../types/TPCB_LayersOfFill.md)
</td><td>
_(Optional)_ Layer
</td></tr>
<tr><td>
net
</td><td>
string
</td><td>
_(Optional)_ Net name
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitiveFill](./IPCB_PrimitiveFill.md)<!-- -->>>
Fill primitive object array
## Example
```javascript
// 1. 创建一个顶层铜层(1)测试填充作为过滤目标(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const fill = await eda.pcb_PrimitiveFill.create(1, polygon, '', 0, 10, false);
const fillId = fill.getState_PrimitiveId();
// 2. 不带参数:获取 PCB 上全部填充
const all = await eda.pcb_PrimitiveFill.getAll();
// 3. 按层过滤:只取顶层铜层(1)的填充
const topCopper = await eda.pcb_PrimitiveFill.getAll(1);
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveFill.delete([fillId]);
console.log('total fills:', all.length);
console.log('top copper fills:', topCopper.length);
console.log('marker fill found:', topCopper.some(f => f.getState_PrimitiveId() === fillId));
```
### getallprimitiveid
# PCB\_PrimitiveFill.getAllPrimitiveId() method
> 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.
Get the primitive IDs of all fills
## Signature
```typescript
function getAllPrimitiveId(
layer?: TPCB_LayersOfFill,
net?: string,
primitiveLock?: boolean,
): Promise<Array<string>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfFill](../types/TPCB_LayersOfFill.md)
</td><td>
_(Optional)_ Layer
</td></tr>
<tr><td>
net
</td><td>
string
</td><td>
_(Optional)_ Net name
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<Array<string>>
Array of fill primitive IDs
## Example
```javascript
// 1. 创建一个顶层铜层(1)测试填充作为查找目标(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const fill = await eda.pcb_PrimitiveFill.create(1, polygon, '', 0, 10, false);
const fillId = fill.getState_PrimitiveId();
// 2. 获取全部填充的图元 ID
const allIds = await eda.pcb_PrimitiveFill.getAllPrimitiveId();
// 3. 按层过滤:只取顶层铜层(1)填充的图元 ID
const topCopperIds = await eda.pcb_PrimitiveFill.getAllPrimitiveId(1);
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveFill.delete([fillId]);
console.log('total fill ids:', allIds.length);
console.log('top copper fill ids:', topCopperIds.length);
console.log('marker id in top copper list:', topCopperIds.includes(fillId));
```
### modify
# PCB\_PrimitiveFill.modify() method
> 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.
Modify the fill
## Signature
```typescript
function modify(
primitiveId: string | IPCB_PrimitiveFill,
property: {
layer?: TPCB_LayersOfFill;
complexPolygon?: IPCB_Polygon;
net?: string;
fillMode?: EPCB_PrimitiveFillMode;
lineWidth?: number;
primitiveLock?: boolean;
},
): Promise<IPCB_PrimitiveFill | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveId
</td><td>
string \| [IPCB\_PrimitiveFill](./IPCB_PrimitiveFill.md)
</td><td>
Primitive ID
</td></tr>
<tr><td>
property
</td><td>
{ layer?: [TPCB\_LayersOfFill](../types/TPCB_LayersOfFill.md)<!-- -->; complexPolygon?: [IPCB\_Polygon](./IPCB_Polygon.md)<!-- -->; net?: string; fillMode?: [EPCB\_PrimitiveFillMode](../enums/EPCB_PrimitiveFillMode.md)<!-- -->; lineWidth?: number; primitiveLock?: boolean }
</td><td>
Modify Parameter
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveFill](./IPCB_PrimitiveFill.md) \| undefined>
Fill primitive object, `undefined` indicates that the modification failed
## Example
```javascript
// 1. 创建待修改的测试填充(随机坐标避免与画布已有填充重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const fill = await eda.pcb_PrimitiveFill.create(1, polygon, '', 0, 10, false);
const fillId = fill.getState_PrimitiveId();
// 2. 读取修改前的层与锁定状态
const beforeLayer = fill.getState_Layer();
const beforeLock = fill.getState_PrimitiveLock();
// 3. 批量修改:顶层铜层(1)→ 底层铜层(2),未锁定 → 锁定
await eda.pcb_PrimitiveFill.modify(fillId, { layer: 2, primitiveLock: true });
// 4. modify 返回后需要重新 get() 才能读到画布上的最新值
const refreshed = await eda.pcb_PrimitiveFill.get(fillId);
// 5. 修改类保留现场,供观察修改结果
console.log('primitiveId:', fillId);
console.log('layer:', beforeLayer, '→', refreshed.getState_Layer());
console.log('primitiveLock:', beforeLock, '→', refreshed.getState_PrimitiveLock());
```
references/classes/PCB_PrimitiveImage.md
# PCB\_PrimitiveImage class
PCB & footprint / image primitive class
## Signature
```typescript
class PCB_PrimitiveImage implements IPCB_PrimitiveAPI
```
**Implements:** [IPCB\_PrimitiveAPI](../interfaces/IPCB_PrimitiveAPI.md)
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[create(x, y, complexPolygon, layer, width, height, rotation, horizonMirror, primitiveLock)](./PCB_PrimitiveImage.md)
</td><td>
</td><td>
Create Image
</td></tr>
<tr><td>
[delete(primitiveIds)](./PCB_PrimitiveImage.md)
</td><td>
</td><td>
**_(BETA)_** Delete Image
</td></tr>
<tr><td>
[get(primitiveIds)](./PCB_PrimitiveImage.md)
</td><td>
</td><td>
**_(BETA)_** Get Image
</td></tr>
<tr><td>
[get(primitiveIds)](./PCB_PrimitiveImage.md)
</td><td>
</td><td>
**_(BETA)_** Get Image
</td></tr>
<tr><td>
[getAll(layer, primitiveLock)](./PCB_PrimitiveImage.md)
</td><td>
</td><td>
**_(BETA)_** Get all Image
</td></tr>
<tr><td>
[getAllPrimitiveId(layer, primitiveLock)](./PCB_PrimitiveImage.md)
</td><td>
</td><td>
**_(BETA)_** Get all Image primitive IDs
</td></tr>
<tr><td>
[modify(primitiveId, property)](./PCB_PrimitiveImage.md)
</td><td>
</td><td>
**_(BETA)_** Modify Image
</td></tr>
</tbody></table>
---
## 方法详情
### create
# PCB\_PrimitiveImage.create() method
Create Image
## Signature
```typescript
function create(
x: number,
y: number,
complexPolygon:
| TPCB_PolygonSourceArray
| Array<TPCB_PolygonSourceArray>
| IPCB_Polygon
| IPCB_ComplexPolygon,
layer: TPCB_LayersOfImage,
width?: number,
height?: number,
rotation?: number,
horizonMirror?: boolean,
primitiveLock?: boolean,
): Promise<IPCB_PrimitiveImage | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
x
</td><td>
number
</td><td>
BBox top-left point coordinates X
</td></tr>
<tr><td>
y
</td><td>
number
</td><td>
BBox top-left point coordinates Y
</td></tr>
<tr><td>
complexPolygon
</td><td>
[TPCB\_PolygonSourceArray](../types/TPCB_PolygonSourceArray.md) \| Array<[TPCB\_PolygonSourceArray](../types/TPCB_PolygonSourceArray.md)<!-- -->> \| [IPCB\_Polygon](./IPCB_Polygon.md) \| [IPCB\_ComplexPolygon](./IPCB_ComplexPolygon.md)
</td><td>
Image source data (complex polygon). You can use the [PCB\_MathPolygon.convertImageToComplexPolygon()](./PCB_MathPolygon.md) method to convert an image file into complex polygon data
</td></tr>
<tr><td>
layer
</td><td>
[TPCB\_LayersOfImage](../types/TPCB_LayersOfImage.md)
</td><td>
Layer
</td></tr>
<tr><td>
width
</td><td>
number
</td><td>
_(Optional)_ Width
</td></tr>
<tr><td>
height
</td><td>
number
</td><td>
_(Optional)_ Height
</td></tr>
<tr><td>
rotation
</td><td>
number
</td><td>
_(Optional)_ Rotation angle
</td></tr>
<tr><td>
horizonMirror
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is horizontally mirrored
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveImage](./IPCB_PrimitiveImage.md) \| undefined>
Image primitive object
## Remarks
To create a color silkscreen image, use the [binary embedded object primitive class](./PCB_PrimitiveObject.md)
## Example
```javascript
// 1. 生成随机基准坐标,避免与画布上已有的图像重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 构造折线多边形轮廓(局部坐标 200×150 的五边形),图像轮廓必须是 ComplexPolygon 对象
const complexPolygon = eda.pcb_MathPolygon.createComplexPolygon([
0,
0,
'L',
200,
0,
200,
150,
100,
220,
0,
150
]);
// 3. 在顶层铜层(1)创建图像,宽 400、高 300,不旋转、不镜像、不锁定
const image = await eda.pcb_PrimitiveImage.create(x, y, complexPolygon, 1, 400, 300, 0, false, false);
// 4. 创建类保留现场,不删除图元
console.log('primitiveId:', image.getState_PrimitiveId());
console.log('layer:', image.getState_Layer());
console.log('width:', image.getState_Width());
console.log('height:', image.getState_Height());
console.log('primitiveType:', image.getState_PrimitiveType());
```
### delete
# PCB\_PrimitiveImage.delete() method
> 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.
Delete Image
## Signature
```typescript
function delete(primitiveIds: string | IPCB_PrimitiveImage | Array<string> | Array<IPCB_PrimitiveImage>): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string \| [IPCB\_PrimitiveImage](./IPCB_PrimitiveImage.md) \| Array<string> \| Array<[IPCB\_PrimitiveImage](./IPCB_PrimitiveImage.md)<!-- -->>
</td><td>
Image primitive ID or Image primitive object
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Delete Whether the operation is successful
## Example
```javascript
// 1. 创建两个待删除的测试图像(随机坐标避免与画布已有图像重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const cp = eda.pcb_MathPolygon.createComplexPolygon([0, 0, 'L', 200, 0, 200, 150, 0, 150]);
const image1 = await eda.pcb_PrimitiveImage.create(x, y, cp, 1, 400, 300, 0, false, false);
const image2 = await eda.pcb_PrimitiveImage.create(x, y + 1000, cp, 1, 400, 300, 0, false, false);
// 2. 记录删除前的图像数量
const beforeCount = (await eda.pcb_PrimitiveImage.getAll()).length;
// 3. 以 ID 数组形式批量删除两个图像
const deleted = await eda.pcb_PrimitiveImage.delete([
image1.getState_PrimitiveId(),
image2.getState_PrimitiveId()
]);
// 4. 删除类保留现场(图元已删除,不恢复)
const afterCount = (await eda.pcb_PrimitiveImage.getAll()).length;
console.log('deleted:', deleted);
console.log('beforeCount:', beforeCount, '→ afterCount:', afterCount);
```
### get
# PCB\_PrimitiveImage.get() method
> 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.
Get Image
## Signature
```typescript
function get(primitiveIds: string): Promise<IPCB_PrimitiveImage | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string
</td><td>
Image primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveImage](./IPCB_PrimitiveImage.md) \| undefined>
Image primitive object, `undefined` indicates that the retrieval failed
## Example
```javascript
// 1. 创建两个测试图像(随机坐标避免重合,轮廓用折线多边形)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const cp = eda.pcb_MathPolygon.createComplexPolygon([0, 0, 'L', 200, 0, 200, 150, 0, 150]);
const image1 = await eda.pcb_PrimitiveImage.create(x, y, cp, 1, 400, 300, 0, false, false);
const image2 = await eda.pcb_PrimitiveImage.create(x, y + 1000, cp, 1, 400, 300, 0, false, false);
// 2. 传单个 ID 字符串,返回单个图像对象
const single = await eda.pcb_PrimitiveImage.get(image1.getState_PrimitiveId());
// 3. 传 ID 数组,返回图像对象数组
const arr = await eda.pcb_PrimitiveImage.get([
image1.getState_PrimitiveId(),
image2.getState_PrimitiveId()
]);
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveImage.delete([
image1.getState_PrimitiveId(),
image2.getState_PrimitiveId()
]);
console.log('single layer:', single.getState_Layer());
console.log('single width:', single.getState_Width());
console.log('array length:', arr.length);
console.log('image2 rotation:', arr[1].getState_Rotation());
```
### get_1
# PCB\_PrimitiveImage.get() method
> 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.
Get Image
## Signature
```typescript
function get(primitiveIds: Array<string>): Promise<Array<IPCB_PrimitiveImage>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
Array<string>
</td><td>
Image primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitiveImage](./IPCB_PrimitiveImage.md)<!-- -->>>
Image primitive object; an empty array indicates that the retrieval failed
## Remarks
If multiple primitive IDs are passed in, a primitive ID that is not matched will not affect the return of other primitives; that is, fewer primitive objects than the number of primitive IDs passed in may be returned.
### getall
# PCB\_PrimitiveImage.getAll() method
> 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.
Get all Image
## Signature
```typescript
function getAll(
layer?: TPCB_LayersOfImage,
primitiveLock?: boolean,
): Promise<Array<IPCB_PrimitiveImage>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfImage](../types/TPCB_LayersOfImage.md)
</td><td>
_(Optional)_ Layer
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitiveImage](./IPCB_PrimitiveImage.md)<!-- -->>>
Array of Image primitive objects
## Example
```javascript
// 1. 创建一个顶层铜层(1)测试图像作为过滤目标(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const cp = eda.pcb_MathPolygon.createComplexPolygon([0, 0, 'L', 200, 0, 200, 150, 0, 150]);
const image = await eda.pcb_PrimitiveImage.create(x, y, cp, 1, 400, 300, 0, false, false);
const imageId = image.getState_PrimitiveId();
// 2. 不带参数:获取 PCB 上全部图像
const all = await eda.pcb_PrimitiveImage.getAll();
// 3. 按层过滤:只取顶层铜层(1)的图像
const topCopper = await eda.pcb_PrimitiveImage.getAll(1);
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveImage.delete([imageId]);
console.log('total images:', all.length);
console.log('top copper images:', topCopper.length);
console.log('marker image found:', topCopper.some(i => i.getState_PrimitiveId() === imageId));
```
### getallprimitiveid
# PCB\_PrimitiveImage.getAllPrimitiveId() method
> 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.
Get all Image primitive IDs
## Signature
```typescript
function getAllPrimitiveId(
layer?: TPCB_LayersOfImage,
primitiveLock?: boolean,
): Promise<Array<string>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfImage](../types/TPCB_LayersOfImage.md)
</td><td>
_(Optional)_ Layer
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<Array<string>>
Array of Image primitive IDs
## Example
```javascript
// 1. 创建一个顶层铜层(1)测试图像作为查找目标(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const cp = eda.pcb_MathPolygon.createComplexPolygon([0, 0, 'L', 200, 0, 200, 150, 0, 150]);
const image = await eda.pcb_PrimitiveImage.create(x, y, cp, 1, 400, 300, 0, false, false);
const imageId = image.getState_PrimitiveId();
// 2. 获取全部图像的图元 ID
const allIds = await eda.pcb_PrimitiveImage.getAllPrimitiveId();
// 3. 按层过滤:只取顶层铜层(1)图像的图元 ID
const topCopperIds = await eda.pcb_PrimitiveImage.getAllPrimitiveId(1);
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveImage.delete([imageId]);
console.log('total image ids:', allIds.length);
console.log('top copper image ids:', topCopperIds.length);
console.log('marker id in top copper list:', topCopperIds.includes(imageId));
```
### modify
# PCB\_PrimitiveImage.modify() method
> 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.
Modify Image
## Signature
```typescript
function modify(
primitiveId: string | IPCB_PrimitiveImage,
property: {
x?: number;
y?: number;
layer?: TPCB_LayersOfImage;
width?: number;
height?: number;
rotation?: number;
horizonMirror?: boolean;
primitiveLock?: boolean;
},
): Promise<IPCB_PrimitiveImage | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveId
</td><td>
string \| [IPCB\_PrimitiveImage](./IPCB_PrimitiveImage.md)
</td><td>
Primitive ID
</td></tr>
<tr><td>
property
</td><td>
{ x?: number; y?: number; layer?: [TPCB\_LayersOfImage](../types/TPCB_LayersOfImage.md)<!-- -->; width?: number; height?: number; rotation?: number; horizonMirror?: boolean; primitiveLock?: boolean }
</td><td>
Modify Parameter
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveImage](./IPCB_PrimitiveImage.md) \| undefined>
Image primitive object
## Example
```javascript
// 1. 创建待修改的测试图像(随机坐标避免与画布已有图像重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const cp = eda.pcb_MathPolygon.createComplexPolygon([0, 0, 'L', 200, 0, 200, 150, 0, 150]);
const image = await eda.pcb_PrimitiveImage.create(x, y, cp, 1, 400, 300, 0, false, false);
const imageId = image.getState_PrimitiveId();
// 2. 读取修改前的层与旋转角度
const beforeLayer = image.getState_Layer();
const beforeRotation = image.getState_Rotation();
// 3. 批量修改:顶层铜层(1)→ 顶层丝印(3),旋转 0° → 90°
await eda.pcb_PrimitiveImage.modify(imageId, { layer: 3, rotation: 90 });
// 4. modify 返回后需要重新 get() 才能读到画布上的最新值
const refreshed = await eda.pcb_PrimitiveImage.get(imageId);
// 5. 修改类保留现场,供观察修改结果
console.log('primitiveId:', imageId);
console.log('layer:', beforeLayer, '→', refreshed.getState_Layer());
console.log('rotation:', beforeRotation, '→', refreshed.getState_Rotation());
```
references/classes/PCB_PrimitiveLine.md
# PCB\_PrimitiveLine class
PCB & footprint / line primitive class
## Signature
```typescript
class PCB_PrimitiveLine implements IPCB_PrimitiveAPI
```
**Implements:** [IPCB\_PrimitiveAPI](../interfaces/IPCB_PrimitiveAPI.md)
## Remarks
Both lines and arc lines are wires, corresponding to the line traces and arc traces on the canvas
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[create(net, layer, startX, startY, endX, endY, lineWidth, primitiveLock)](./PCB_PrimitiveLine.md)
</td><td>
</td><td>
Create a line
</td></tr>
<tr><td>
[delete(primitiveIds)](./PCB_PrimitiveLine.md)
</td><td>
</td><td>
**_(BETA)_** Delete the line
</td></tr>
<tr><td>
[get(primitiveIds)](./PCB_PrimitiveLine.md)
</td><td>
</td><td>
**_(BETA)_** Get the line
</td></tr>
<tr><td>
[get(primitiveIds)](./PCB_PrimitiveLine.md)
</td><td>
</td><td>
**_(BETA)_** Get the line
</td></tr>
<tr><td>
[getAll(net, layer, primitiveLock)](./PCB_PrimitiveLine.md)
</td><td>
</td><td>
**_(BETA)_** Get all lines
</td></tr>
<tr><td>
[getAllPrimitiveId(net, layer, primitiveLock)](./PCB_PrimitiveLine.md)
</td><td>
</td><td>
**_(BETA)_** Get the primitive IDs of all lines
</td></tr>
<tr><td>
[modify(primitiveId, property)](./PCB_PrimitiveLine.md)
</td><td>
</td><td>
**_(BETA)_** Modify the line
</td></tr>
</tbody></table>
---
## 方法详情
### create
# PCB\_PrimitiveLine.create() method
Create a line
## Signature
```typescript
function create(
net: string,
layer: TPCB_LayersOfLine,
startX: number,
startY: number,
endX: number,
endY: number,
lineWidth?: number,
primitiveLock?: boolean,
): Promise<IPCB_PrimitiveLine | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string
</td><td>
Net name
</td></tr>
<tr><td>
layer
</td><td>
[TPCB\_LayersOfLine](../types/TPCB_LayersOfLine.md)
</td><td>
Layer
</td></tr>
<tr><td>
startX
</td><td>
number
</td><td>
Start position X
</td></tr>
<tr><td>
startY
</td><td>
number
</td><td>
Start position Y
</td></tr>
<tr><td>
endX
</td><td>
number
</td><td>
End position X
</td></tr>
<tr><td>
endY
</td><td>
number
</td><td>
End position Y
</td></tr>
<tr><td>
lineWidth
</td><td>
number
</td><td>
_(Optional)_ Line width
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveLine](./IPCB_PrimitiveLine.md) \| undefined>
Line primitive object
## Example
```javascript
// 1. 生成随机起点坐标,避免与画布上已有的直线重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 在顶层铜层创建一条水平走线:起点(x, y)到终点(x+600, y),线宽 10mil,不锁定
const line = await eda.pcb_PrimitiveLine.create('', 1, x, y, x + 600, y, 10, false);
// 3. 创建类保留现场,不删除图元
console.log('primitiveId:', line.getState_PrimitiveId());
console.log('primitiveType:', line.getState_PrimitiveType());
console.log('startX:', line.getState_StartX(), 'startY:', line.getState_StartY());
console.log('endX:', line.getState_EndX(), 'endY:', line.getState_EndY());
console.log('lineWidth:', line.getState_LineWidth());
```
### delete
# PCB\_PrimitiveLine.delete() method
> 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.
Delete the line
## Signature
```typescript
function delete(primitiveIds: string | IPCB_PrimitiveLine | Array<string> | Array<IPCB_PrimitiveLine>): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string \| [IPCB\_PrimitiveLine](./IPCB_PrimitiveLine.md) \| Array<string> \| Array<[IPCB\_PrimitiveLine](./IPCB_PrimitiveLine.md)<!-- -->>
</td><td>
Primitive ID of the line or the line primitive object
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Delete Whether the operation is successful
## Example
```javascript
// 1. 创建两条待删除的测试直线(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const line1 = await eda.pcb_PrimitiveLine.create('', 1, x, y, x + 600, y, 10, false);
const line2 = await eda.pcb_PrimitiveLine.create('', 1, x, y + 500, x + 600, y + 500, 10, false);
// 2. 记录删除前的直线数量
const beforeCount = (await eda.pcb_PrimitiveLine.getAll()).length;
// 3. 以 ID 数组形式批量删除两条直线
const deleted = await eda.pcb_PrimitiveLine.delete([line1.getState_PrimitiveId(), line2.getState_PrimitiveId()]);
// 4. 删除类保留现场(图元已删除,不恢复)
const afterCount = (await eda.pcb_PrimitiveLine.getAll()).length;
console.log('deleted:', deleted);
console.log('beforeCount:', beforeCount, '→ afterCount:', afterCount);
```
### get
# PCB\_PrimitiveLine.get() method
> 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.
Get the line
## Signature
```typescript
function get(primitiveIds: string): Promise<IPCB_PrimitiveLine | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string
</td><td>
Primitive ID of the line, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveLine](./IPCB_PrimitiveLine.md) \| undefined>
Line primitive object, `undefined` indicates that the retrieval failed
## Example
```javascript
// 1. 创建两条测试直线(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const line1 = await eda.pcb_PrimitiveLine.create('', 1, x, y, x + 600, y, 10, false);
const line2 = await eda.pcb_PrimitiveLine.create('', 1, x, y + 500, x + 600, y + 500, 16, false);
// 2. 传单个 ID 字符串,返回单个直线对象
const single = await eda.pcb_PrimitiveLine.get(line1.getState_PrimitiveId());
// 3. 传 ID 数组,返回直线对象数组
const arr = await eda.pcb_PrimitiveLine.get([line1.getState_PrimitiveId(), line2.getState_PrimitiveId()]);
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveLine.delete([line1.getState_PrimitiveId(), line2.getState_PrimitiveId()]);
console.log('single lineWidth:', single.getState_LineWidth());
console.log('array length:', arr.length);
console.log('line2 lineWidth:', arr[1].getState_LineWidth());
```
### get_1
# PCB\_PrimitiveLine.get() method
> 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.
Get the line
## Signature
```typescript
function get(primitiveIds: Array<string>): Promise<Array<IPCB_PrimitiveLine>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
Array<string>
</td><td>
Primitive ID of the line, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitiveLine](./IPCB_PrimitiveLine.md)<!-- -->>>
Line primitive object; an empty array indicates that the retrieval failed
## Remarks
If multiple primitive IDs are passed in, a primitive ID that is not matched will not affect the return of other primitives; that is, fewer primitive objects than the number of primitive IDs passed in may be returned.
### getall
# PCB\_PrimitiveLine.getAll() method
> 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.
Get all lines
## Signature
```typescript
function getAll(
net?: string,
layer?: TPCB_LayersOfLine,
primitiveLock?: boolean,
): Promise<Array<IPCB_PrimitiveLine>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string
</td><td>
_(Optional)_ Net name
</td></tr>
<tr><td>
layer
</td><td>
[TPCB\_LayersOfLine](../types/TPCB_LayersOfLine.md)
</td><td>
_(Optional)_ Layer
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitiveLine](./IPCB_PrimitiveLine.md)<!-- -->>>
Line primitive object array
## Example
```javascript
// 1. 创建一条顶层测试直线作为过滤目标(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const line = await eda.pcb_PrimitiveLine.create('', 1, x, y, x + 600, y, 10, false);
const lineId = line.getState_PrimitiveId();
// 2. 不带参数:获取 PCB 上全部直线
const all = await eda.pcb_PrimitiveLine.getAll();
// 3. 按层过滤:只取顶层(1)的直线
const topLayer = await eda.pcb_PrimitiveLine.getAll('', 1);
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveLine.delete([lineId]);
console.log('total lines:', all.length);
console.log('top layer lines:', topLayer.length);
console.log('marker line found in top layer:', topLayer.some(l => l.getState_PrimitiveId() === lineId));
```
### getallprimitiveid
# PCB\_PrimitiveLine.getAllPrimitiveId() method
> 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.
Get the primitive IDs of all lines
## Signature
```typescript
function getAllPrimitiveId(
net?: string,
layer?: TPCB_LayersOfLine,
primitiveLock?: boolean,
): Promise<Array<string>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string
</td><td>
_(Optional)_ Net name
</td></tr>
<tr><td>
layer
</td><td>
[TPCB\_LayersOfLine](../types/TPCB_LayersOfLine.md)
</td><td>
_(Optional)_ Layer
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<Array<string>>
Array of polyline primitive IDs
## Example
```javascript
// 1. 创建一条顶层测试直线作为查找目标(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const line = await eda.pcb_PrimitiveLine.create('', 1, x, y, x + 600, y, 10, false);
const lineId = line.getState_PrimitiveId();
// 2. 获取全部直线的图元 ID
const allIds = await eda.pcb_PrimitiveLine.getAllPrimitiveId();
// 3. 按层过滤:只取顶层(1)直线的图元 ID
const topLayerIds = await eda.pcb_PrimitiveLine.getAllPrimitiveId('', 1);
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveLine.delete([lineId]);
console.log('total line ids:', allIds.length);
console.log('top layer line ids:', topLayerIds.length);
console.log('marker id in top layer list:', topLayerIds.includes(lineId));
```
### modify
# PCB\_PrimitiveLine.modify() method
> 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.
Modify the line
## Signature
```typescript
function modify(
primitiveId: string | IPCB_PrimitiveLine,
property: {
net?: string;
layer?: TPCB_LayersOfLine;
startX?: number;
startY?: number;
endX?: number;
endY?: number;
lineWidth?: number;
primitiveLock?: boolean;
},
): Promise<IPCB_PrimitiveLine | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveId
</td><td>
string \| [IPCB\_PrimitiveLine](./IPCB_PrimitiveLine.md)
</td><td>
Primitive ID
</td></tr>
<tr><td>
property
</td><td>
{ net?: string; layer?: [TPCB\_LayersOfLine](../types/TPCB_LayersOfLine.md)<!-- -->; startX?: number; startY?: number; endX?: number; endY?: number; lineWidth?: number; primitiveLock?: boolean }
</td><td>
Modify Parameter
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveLine](./IPCB_PrimitiveLine.md) \| undefined>
Line primitive object
## Example
```javascript
// 1. 创建待修改的测试直线(随机坐标避免与画布已有直线重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const line = await eda.pcb_PrimitiveLine.create('', 1, x, y, x + 600, y, 10, false);
const lineId = line.getState_PrimitiveId();
// 2. 读取修改前的线宽与终点 X
const beforeWidth = line.getState_LineWidth();
const beforeEndX = line.getState_EndX();
// 3. 批量修改:线宽 10 → 24,终点右移 400mil
await eda.pcb_PrimitiveLine.modify(lineId, { lineWidth: 24, endX: x + 1000 });
// 4. modify 返回后需要重新 get() 才能读到画布上的最新值
const refreshed = await eda.pcb_PrimitiveLine.get(lineId);
// 5. 修改类保留现场,供观察修改结果
console.log('primitiveId:', lineId);
console.log('lineWidth:', beforeWidth, '→', refreshed.getState_LineWidth());
console.log('endX:', beforeEndX, '→', refreshed.getState_EndX());
```
references/classes/PCB_PrimitiveObject.md
# PCB\_PrimitiveObject class
PCB & footprint / binary embedded object primitive class
## Signature
```typescript
class PCB_PrimitiveObject implements IPCB_PrimitiveAPI
```
**Implements:** [IPCB\_PrimitiveAPI](../interfaces/IPCB_PrimitiveAPI.md)
## Remarks
Color silkscreen images are binary embedded objects. They must be created and modified using the methods of binary embedded objects
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[create(layer, topLeftX, topLeftY, binaryData, width, height, rotation, mirror, fileName, primitiveLock)](./PCB_PrimitiveObject.md)
</td><td>
</td><td>
**_(BETA)_** Create Binary embedded object
</td></tr>
<tr><td>
[delete(primitiveIds)](./PCB_PrimitiveObject.md)
</td><td>
</td><td>
**_(BETA)_** Delete Binary embedded object
</td></tr>
<tr><td>
[get(primitiveIds)](./PCB_PrimitiveObject.md)
</td><td>
</td><td>
**_(BETA)_** Get Binary embedded object
</td></tr>
<tr><td>
[get(primitiveIds)](./PCB_PrimitiveObject.md)
</td><td>
</td><td>
**_(BETA)_** Get Binary embedded object
</td></tr>
<tr><td>
[getAll(layer, primitiveLock)](./PCB_PrimitiveObject.md)
</td><td>
</td><td>
**_(BETA)_** Get all Binary embedded object
</td></tr>
<tr><td>
[getAllPrimitiveId(layer, primitiveLock)](./PCB_PrimitiveObject.md)
</td><td>
</td><td>
**_(BETA)_** Get all Binary embedded object primitive IDs
</td></tr>
<tr><td>
[modify(primitiveId, property)](./PCB_PrimitiveObject.md)
</td><td>
</td><td>
**_(BETA)_** Modify Binary embedded object
</td></tr>
</tbody></table>
---
## 方法详情
### create
# PCB\_PrimitiveObject.create() method
> 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.
Create Binary embedded object
## Signature
```typescript
function create(
layer: TPCB_LayersOfObject,
topLeftX: number,
topLeftY: number,
binaryData: string,
width: number,
height: number,
rotation?: number,
mirror?: boolean,
fileName?: string,
primitiveLock?: boolean,
): Promise<IPCB_PrimitiveObject | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfObject](../types/TPCB_LayersOfObject.md)
</td><td>
Layer
</td></tr>
<tr><td>
topLeftX
</td><td>
number
</td><td>
Top-left point X
</td></tr>
<tr><td>
topLeftY
</td><td>
number
</td><td>
Top-left point Y
</td></tr>
<tr><td>
binaryData
</td><td>
string
</td><td>
Binary data
</td></tr>
<tr><td>
width
</td><td>
number
</td><td>
Width
</td></tr>
<tr><td>
height
</td><td>
number
</td><td>
Height
</td></tr>
<tr><td>
rotation
</td><td>
number
</td><td>
_(Optional)_ Rotation angle
</td></tr>
<tr><td>
mirror
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is horizontally mirrored
</td></tr>
<tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_ File name
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md) \| undefined>
- binary embedded object primitive object
## Example
```javascript
// 1. 生成随机放置坐标,避免与画布上已有的内嵌对象重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 准备 4x4 像素 PNG 的 data URI(binaryData 必须是 data URI 格式,裸 base64 会创建失败)
const binaryData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
// 3. 在顶层丝印(3)放置图片:左上角(x, y),宽 400、高 300,不旋转、不镜像、不锁定
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, binaryData, 400, 300, 0, false, 'logo.png', false);
// 4. 创建类保留现场,不删除图元(getState_BinaryData 返回数据 hash,用长度表示)
console.log('primitiveId:', obj.getState_PrimitiveId());
console.log('primitiveType:', obj.getState_PrimitiveType());
console.log('layer:', obj.getState_Layer());
console.log('width:', obj.getState_Width(), 'height:', obj.getState_Height());
console.log('fileName:', obj.getState_FileName());
console.log('binaryData hash length:', obj.getState_BinaryData().length);
```
### delete
# PCB\_PrimitiveObject.delete() method
> 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.
Delete Binary embedded object
## Signature
```typescript
function delete(primitiveIds: string | IPCB_PrimitiveObject | Array<string> | Array<IPCB_PrimitiveObject>): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string \| [IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md) \| Array<string> \| Array<[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)<!-- -->>
</td><td>
Binary embedded object primitive ID or Binary embedded object primitive object
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Delete Whether the operation is successful
## Example
```javascript
// 1. 创建两个待删除的测试内嵌对象(随机坐标避免重合),使用 4x4 像素 PNG 的 data URI
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const binaryData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj1 = await eda.pcb_PrimitiveObject.create(3, x, y, binaryData, 400, 300, 0, false, 'logo1.png', false);
const obj2 = await eda.pcb_PrimitiveObject.create(3, x, y + 500, binaryData, 400, 300, 0, false, 'logo2.png', false);
// 2. 记录删除前的内嵌对象数量
const beforeCount = (await eda.pcb_PrimitiveObject.getAll()).length;
// 3. 以 ID 数组形式批量删除两个内嵌对象
const deleted = await eda.pcb_PrimitiveObject.delete([obj1.getState_PrimitiveId(), obj2.getState_PrimitiveId()]);
// 4. 删除类保留现场(图元已删除,不恢复)
const afterCount = (await eda.pcb_PrimitiveObject.getAll()).length;
console.log('deleted:', deleted);
console.log('beforeCount:', beforeCount, '→ afterCount:', afterCount);
```
### get
# PCB\_PrimitiveObject.get() method
> 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.
Get Binary embedded object
## Signature
```typescript
function get(primitiveIds: string): Promise<IPCB_PrimitiveObject | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string
</td><td>
Binary embedded object primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md) \| undefined>
Binary embedded object primitive object, `undefined` indicates that the retrieval failed
## Example
```javascript
// 1. 创建两个测试内嵌对象(随机坐标避免重合),使用 4x4 像素 PNG 的 data URI
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const binaryData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj1 = await eda.pcb_PrimitiveObject.create(3, x, y, binaryData, 400, 300, 0, false, 'logo1.png', false);
const obj2 = await eda.pcb_PrimitiveObject.create(3, x, y + 500, binaryData, 200, 150, 0, false, 'logo2.png', false);
// 2. 传单个 ID 字符串,返回单个内嵌对象
const single = await eda.pcb_PrimitiveObject.get(obj1.getState_PrimitiveId());
// 3. 传 ID 数组,返回内嵌对象数组(混入未匹配的 ID 不影响其它图元返回)
const arr = await eda.pcb_PrimitiveObject.get([obj1.getState_PrimitiveId(), obj2.getState_PrimitiveId()]);
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveObject.delete([obj1.getState_PrimitiveId(), obj2.getState_PrimitiveId()]);
console.log('single width:', single.getState_Width());
console.log('array length:', arr.length);
console.log('obj2 fileName:', arr[1].getState_FileName());
```
### get_1
# PCB\_PrimitiveObject.get() method
> 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.
Get Binary embedded object
## Signature
```typescript
function get(primitiveIds: Array<string>): Promise<Array<IPCB_PrimitiveObject>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
Array<string>
</td><td>
Binary embedded object primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)<!-- -->>>
Binary embedded object primitive object; an empty array indicates that the retrieval failed
## Remarks
If multiple primitive IDs are passed in, a primitive ID that is not matched will not affect the return of other primitives; that is, fewer primitive objects than the number of primitive IDs passed in may be returned.
### getall
# PCB\_PrimitiveObject.getAll() method
> 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.
Get all Binary embedded object
## Signature
```typescript
function getAll(
layer?: TPCB_LayersOfObject,
primitiveLock?: boolean,
): Promise<Array<IPCB_PrimitiveObject>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfObject](../types/TPCB_LayersOfObject.md)
</td><td>
_(Optional)_ Layer
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)<!-- -->>>
Array of Binary embedded object primitive objects
## Example
```javascript
// 1. 创建一个顶层丝印(3)测试对象作为过滤目标(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const binaryData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, binaryData, 400, 300, 0, false, 'logo.png', false);
const objId = obj.getState_PrimitiveId();
// 2. 不带参数:获取 PCB 上全部内嵌对象
const all = await eda.pcb_PrimitiveObject.getAll();
// 3. 按层过滤:只取顶层丝印(3)的内嵌对象
const topSilk = await eda.pcb_PrimitiveObject.getAll(3);
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveObject.delete([objId]);
console.log('total objects:', all.length);
console.log('top silkscreen objects:', topSilk.length);
console.log('marker found in top silkscreen:', topSilk.some(o => o.getState_PrimitiveId() === objId));
```
### getallprimitiveid
# PCB\_PrimitiveObject.getAllPrimitiveId() method
> 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.
Get all Binary embedded object primitive IDs
## Signature
```typescript
function getAllPrimitiveId(
layer?: TPCB_LayersOfObject,
primitiveLock?: boolean,
): Promise<Array<string>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfObject](../types/TPCB_LayersOfObject.md)
</td><td>
_(Optional)_ Layer
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<Array<string>>
Array of Binary embedded object primitive IDs
## Example
```javascript
// 1. 创建一个顶层丝印(3)测试对象作为查找目标(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const binaryData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, binaryData, 400, 300, 0, false, 'logo.png', false);
const objId = obj.getState_PrimitiveId();
// 2. 获取全部内嵌对象的图元 ID
const allIds = await eda.pcb_PrimitiveObject.getAllPrimitiveId();
// 3. 按层过滤:只取顶层丝印(3)内嵌对象的图元 ID
const topSilkIds = await eda.pcb_PrimitiveObject.getAllPrimitiveId(3);
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveObject.delete([objId]);
console.log('total object ids:', allIds.length);
console.log('top silkscreen object ids:', topSilkIds.length);
console.log('marker id in top silkscreen list:', topSilkIds.includes(objId));
```
### modify
# PCB\_PrimitiveObject.modify() method
> 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.
Modify Binary embedded object
## Signature
```typescript
function modify(
primitiveId: string | IPCB_PrimitiveObject,
property: {
layer?: TPCB_LayersOfObject;
topLeftX?: number;
topLeftY?: number;
binaryData?: string;
width?: number;
height?: number;
rotation?: number;
mirror?: boolean;
fileName?: string;
primitiveLock?: boolean;
},
): Promise<IPCB_PrimitiveObject | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveId
</td><td>
string \| [IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md)
</td><td>
Primitive ID
</td></tr>
<tr><td>
property
</td><td>
{ layer?: [TPCB\_LayersOfObject](../types/TPCB_LayersOfObject.md)<!-- -->; topLeftX?: number; topLeftY?: number; binaryData?: string; width?: number; height?: number; rotation?: number; mirror?: boolean; fileName?: string; primitiveLock?: boolean }
</td><td>
Modify Parameter
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveObject](./IPCB_PrimitiveObject.md) \| undefined>
Binary embedded object primitive object, `undefined` indicates that the modification failed
## Example
```javascript
// 1. 创建待修改的测试内嵌对象(随机坐标避免重合),使用 4x4 像素 PNG 的 data URI
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const binaryData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj = await eda.pcb_PrimitiveObject.create(3, x, y, binaryData, 400, 300, 0, false, 'logo.png', false);
const objId = obj.getState_PrimitiveId();
// 2. 读取修改前的宽与旋转角
const beforeWidth = obj.getState_Width();
const beforeRotation = obj.getState_Rotation();
// 3. 批量修改:宽 400 → 500,旋转 0 → 90 度
await eda.pcb_PrimitiveObject.modify(objId, { width: 500, rotation: 90 });
// 4. modify 返回后需要重新 get() 才能读到画布上的最新值
const refreshed = await eda.pcb_PrimitiveObject.get(objId);
// 5. 修改类保留现场,供观察修改结果
console.log('primitiveId:', objId);
console.log('width:', beforeWidth, '→', refreshed.getState_Width());
console.log('rotation:', beforeRotation, '→', refreshed.getState_Rotation());
```
references/classes/PCB_PrimitivePolyline.md
# PCB\_PrimitivePolyline class
PCB & footprint / polyline primitive class
## Signature
```typescript
class PCB_PrimitivePolyline implements IPCB_PrimitiveAPI
```
**Implements:** [IPCB\_PrimitiveAPI](../interfaces/IPCB_PrimitiveAPI.md)
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[create(net, layer, polygon, lineWidth, primitiveLock)](./PCB_PrimitivePolyline.md)
</td><td>
</td><td>
Create a polyline
</td></tr>
<tr><td>
[delete(primitiveIds)](./PCB_PrimitivePolyline.md)
</td><td>
</td><td>
**_(BETA)_** Delete the polyline
</td></tr>
<tr><td>
[get(primitiveIds)](./PCB_PrimitivePolyline.md)
</td><td>
</td><td>
**_(BETA)_** Get the polyline
</td></tr>
<tr><td>
[get(primitiveIds)](./PCB_PrimitivePolyline.md)
</td><td>
</td><td>
**_(BETA)_** Get the polyline
</td></tr>
<tr><td>
[getAll(net, layer, primitiveLock)](./PCB_PrimitivePolyline.md)
</td><td>
</td><td>
**_(BETA)_** Get all polylines
</td></tr>
<tr><td>
[getAllPrimitiveId(net, layer, primitiveLock)](./PCB_PrimitivePolyline.md)
</td><td>
</td><td>
**_(BETA)_** Get the primitive IDs of all polylines
</td></tr>
<tr><td>
[modify(primitiveId, property)](./PCB_PrimitivePolyline.md)
</td><td>
</td><td>
**_(BETA)_** Modify the polyline
</td></tr>
</tbody></table>
---
## 方法详情
### create
# PCB\_PrimitivePolyline.create() method
Create a polyline
## Signature
```typescript
function create(
net: string,
layer: TPCB_LayersOfLine,
polygon: IPCB_Polygon,
lineWidth?: number,
primitiveLock?: boolean,
): Promise<IPCB_PrimitivePolyline | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string
</td><td>
Net name
</td></tr>
<tr><td>
layer
</td><td>
[TPCB\_LayersOfLine](../types/TPCB_LayersOfLine.md)
</td><td>
Layer
</td></tr>
<tr><td>
polygon
</td><td>
[IPCB\_Polygon](./IPCB_Polygon.md)
</td><td>
Single polygon object
</td></tr>
<tr><td>
lineWidth
</td><td>
number
</td><td>
_(Optional)_ Line width
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md) \| undefined>
Polyline primitive object
## Example
```javascript
// 1. 生成随机起点坐标,避免与画布上已有的折线重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 用 pcb_MathPolygon.createPolygon 构造折线路径:起点 → 右移 500 → 上移 300 的 L 形三顶点折线
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
// 3. 在顶层铜层创建折线:空网络,线宽 10mil,不锁定
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
// 4. 创建类保留现场,不删除图元
console.log('primitiveId:', polyline.getState_PrimitiveId());
console.log('primitiveType:', polyline.getState_PrimitiveType());
console.log('lineWidth:', polyline.getState_LineWidth());
console.log('layer:', polyline.getState_Layer());
console.log('polygon source:', polyline.getState_Polygon().getSource().join(', '));
```
### delete
# PCB\_PrimitivePolyline.delete() method
> 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.
Delete the polyline
## Signature
```typescript
function delete(primitiveIds: string | IPCB_PrimitivePolyline | Array<string> | Array<IPCB_PrimitivePolyline>): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string \| [IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md) \| Array<string> \| Array<[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)<!-- -->>
</td><td>
Primitive ID of the polyline or the polyline primitive object
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Delete Whether the operation is successful
## Example
```javascript
// 1. 创建两条待删除的测试折线(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon1 = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
const polygon2 = eda.pcb_MathPolygon.createPolygon([x, y + 500, 'L', x + 500, y + 500, x + 500, y + 800]);
const polyline1 = await eda.pcb_PrimitivePolyline.create('', 1, polygon1, 10, false);
const polyline2 = await eda.pcb_PrimitivePolyline.create('', 1, polygon2, 10, false);
// 2. 记录删除前的折线数量
const beforeCount = (await eda.pcb_PrimitivePolyline.getAll()).length;
// 3. 以 ID 数组形式批量删除两条折线
const deleted = await eda.pcb_PrimitivePolyline.delete([polyline1.getState_PrimitiveId(), polyline2.getState_PrimitiveId()]);
// 4. 删除类保留现场(图元已删除,不恢复)
const afterCount = (await eda.pcb_PrimitivePolyline.getAll()).length;
console.log('deleted:', deleted);
console.log('beforeCount:', beforeCount, '→ afterCount:', afterCount);
```
### get
# PCB\_PrimitivePolyline.get() method
> 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.
Get the polyline
## Signature
```typescript
function get(primitiveIds: string): Promise<IPCB_PrimitivePolyline | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string
</td><td>
Primitive ID of the polyline, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md) \| undefined>
Polyline primitive object, `undefined` indicates that the retrieval failed
## Example
```javascript
// 1. 创建两条测试折线(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon1 = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
const polygon2 = eda.pcb_MathPolygon.createPolygon([x, y + 500, 'L', x + 500, y + 500, x + 500, y + 800, x, y + 800]);
const polyline1 = await eda.pcb_PrimitivePolyline.create('', 1, polygon1, 10, false);
const polyline2 = await eda.pcb_PrimitivePolyline.create('', 1, polygon2, 16, false);
// 2. 传单个 ID 字符串,返回单个折线对象
const single = await eda.pcb_PrimitivePolyline.get(polyline1.getState_PrimitiveId());
// 3. 传 ID 数组,返回折线对象数组
const arr = await eda.pcb_PrimitivePolyline.get([polyline1.getState_PrimitiveId(), polyline2.getState_PrimitiveId()]);
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitivePolyline.delete([polyline1.getState_PrimitiveId(), polyline2.getState_PrimitiveId()]);
console.log('single lineWidth:', single.getState_LineWidth());
console.log('array length:', arr.length);
console.log('polyline2 lineWidth:', arr[1].getState_LineWidth());
```
### get_1
# PCB\_PrimitivePolyline.get() method
> 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.
Get the polyline
## Signature
```typescript
function get(primitiveIds: Array<string>): Promise<Array<IPCB_PrimitivePolyline>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
Array<string>
</td><td>
Primitive ID of the polyline, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)<!-- -->>>
Polyline primitive object; an empty array indicates that the retrieval failed
## Remarks
If multiple primitive IDs are passed in, a primitive ID that is not matched will not affect the return of other primitives; that is, fewer primitive objects than the number of primitive IDs passed in may be returned.
### getall
# PCB\_PrimitivePolyline.getAll() method
> 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.
Get all polylines
## Signature
```typescript
function getAll(
net?: string,
layer?: TPCB_LayersOfLine,
primitiveLock?: boolean,
): Promise<Array<IPCB_PrimitivePolyline>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string
</td><td>
_(Optional)_ Net name
</td></tr>
<tr><td>
layer
</td><td>
[TPCB\_LayersOfLine](../types/TPCB_LayersOfLine.md)
</td><td>
_(Optional)_ Layer
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)<!-- -->>>
Polyline primitive object array
## Example
```javascript
// 1. 创建一条顶层测试折线作为过滤目标(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
const polylineId = polyline.getState_PrimitiveId();
// 2. 不带参数:获取 PCB 上全部折线
const all = await eda.pcb_PrimitivePolyline.getAll();
// 3. 按层过滤:只取顶层(1)的折线
const topLayer = await eda.pcb_PrimitivePolyline.getAll('', 1);
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitivePolyline.delete([polylineId]);
console.log('total polylines:', all.length);
console.log('top layer polylines:', topLayer.length);
console.log('marker polyline found in top layer:', topLayer.some(p => p.getState_PrimitiveId() === polylineId));
```
### getallprimitiveid
# PCB\_PrimitivePolyline.getAllPrimitiveId() method
> 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.
Get the primitive IDs of all polylines
## Signature
```typescript
function getAllPrimitiveId(
net?: string,
layer?: TPCB_LayersOfLine,
primitiveLock?: boolean,
): Promise<Array<string>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string
</td><td>
_(Optional)_ Net name
</td></tr>
<tr><td>
layer
</td><td>
[TPCB\_LayersOfLine](../types/TPCB_LayersOfLine.md)
</td><td>
_(Optional)_ Layer
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<Array<string>>
Array of polyline primitive IDs
## Example
```javascript
// 1. 创建一条顶层测试折线作为查找目标(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
const polylineId = polyline.getState_PrimitiveId();
// 2. 获取全部折线的图元 ID
const allIds = await eda.pcb_PrimitivePolyline.getAllPrimitiveId();
// 3. 按层过滤:只取顶层(1)折线的图元 ID
const topLayerIds = await eda.pcb_PrimitivePolyline.getAllPrimitiveId('', 1);
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitivePolyline.delete([polylineId]);
console.log('total polyline ids:', allIds.length);
console.log('top layer polyline ids:', topLayerIds.length);
console.log('marker id in top layer list:', topLayerIds.includes(polylineId));
```
### modify
# PCB\_PrimitivePolyline.modify() method
> 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.
Modify the polyline
## Signature
```typescript
function modify(
primitiveId: string | IPCB_PrimitivePolyline,
property: {
net?: string;
layer?: TPCB_LayersOfLine;
polygon?: IPCB_Polygon;
lineWidth?: number;
primitiveLock?: boolean;
},
): Promise<IPCB_PrimitivePolyline | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveId
</td><td>
string \| [IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md)
</td><td>
Primitive ID
</td></tr>
<tr><td>
property
</td><td>
{ net?: string; layer?: [TPCB\_LayersOfLine](../types/TPCB_LayersOfLine.md)<!-- -->; polygon?: [IPCB\_Polygon](./IPCB_Polygon.md)<!-- -->; lineWidth?: number; primitiveLock?: boolean }
</td><td>
Modify Parameter
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitivePolyline](./IPCB_PrimitivePolyline.md) \| undefined>
Polyline primitive object
## Example
```javascript
// 1. 创建待修改的测试折线(随机坐标避免与画布已有折线重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
const polylineId = polyline.getState_PrimitiveId();
// 2. 读取修改前的线宽与层
const beforeWidth = polyline.getState_LineWidth();
const beforeLayer = polyline.getState_Layer();
// 3. 批量修改:线宽 10 → 24,层从顶层(1)换到底层(2)
await eda.pcb_PrimitivePolyline.modify(polylineId, { lineWidth: 24, layer: 2 });
// 4. modify 返回后需要重新 get() 才能读到画布上的最新值
const refreshed = await eda.pcb_PrimitivePolyline.get(polylineId);
// 5. 修改类保留现场,供观察修改结果
console.log('primitiveId:', polylineId);
console.log('lineWidth:', beforeWidth, '→', refreshed.getState_LineWidth());
console.log('layer:', beforeLayer, '→', refreshed.getState_Layer());
```
references/classes/PCB_PrimitivePour.md
# PCB\_PrimitivePour class
PCB & footprint / copper border primitive class
## Signature
```typescript
class PCB_PrimitivePour implements IPCB_PrimitiveAPI
```
**Implements:** [IPCB\_PrimitiveAPI](../interfaces/IPCB_PrimitiveAPI.md)
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[create(net, layer, complexPolygon, pourFillMethod, preserveSilos, pourName, pourPriority, lineWidth, primitiveLock)](./PCB_PrimitivePour.md)
</td><td>
</td><td>
**_(BETA)_** Create Copper border
</td></tr>
<tr><td>
[delete(primitiveIds)](./PCB_PrimitivePour.md)
</td><td>
</td><td>
**_(BETA)_** Delete Copper border
</td></tr>
<tr><td>
[get(primitiveIds)](./PCB_PrimitivePour.md)
</td><td>
</td><td>
**_(BETA)_** Get Copper border
</td></tr>
<tr><td>
[get(primitiveIds)](./PCB_PrimitivePour.md)
</td><td>
</td><td>
**_(BETA)_** Get Copper border
</td></tr>
<tr><td>
[getAll(net, layer, primitiveLock)](./PCB_PrimitivePour.md)
</td><td>
</td><td>
**_(BETA)_** Get all Copper border primitive
</td></tr>
<tr><td>
[getAllPrimitiveId(net, layer, primitiveLock)](./PCB_PrimitivePour.md)
</td><td>
</td><td>
**_(BETA)_** Get all Copper border primitive IDs
</td></tr>
<tr><td>
[modify(primitiveId, property)](./PCB_PrimitivePour.md)
</td><td>
</td><td>
**_(BETA)_** Modify Copper border
</td></tr>
</tbody></table>
---
## 方法详情
### create
# PCB\_PrimitivePour.create() method
> 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.
Create Copper border
## Signature
```typescript
function create(
net: string,
layer: TPCB_LayersOfCopper,
complexPolygon: IPCB_Polygon,
pourFillMethod?: EPCB_PrimitivePourFillMethod,
preserveSilos?: boolean,
pourName?: string,
pourPriority?: number,
lineWidth?: number,
primitiveLock?: boolean,
): Promise<IPCB_PrimitivePour | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string
</td><td>
Net name
</td></tr>
<tr><td>
layer
</td><td>
[TPCB\_LayersOfCopper](../types/TPCB_LayersOfCopper.md)
</td><td>
Layer
</td></tr>
<tr><td>
complexPolygon
</td><td>
[IPCB\_Polygon](./IPCB_Polygon.md)
</td><td>
Complex polygon object
</td></tr>
<tr><td>
pourFillMethod
</td><td>
[EPCB\_PrimitivePourFillMethod](../enums/EPCB_PrimitivePourFillMethod.md)
</td><td>
_(Optional)_ Copper fill method
</td></tr>
<tr><td>
preserveSilos
</td><td>
boolean
</td><td>
_(Optional)_ Whether to keep islands
</td></tr>
<tr><td>
pourName
</td><td>
string
</td><td>
_(Optional)_ Copper name
</td></tr>
<tr><td>
pourPriority
</td><td>
number
</td><td>
_(Optional)_ Copper priority
</td></tr>
<tr><td>
lineWidth
</td><td>
number
</td><td>
_(Optional)_ Line width
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitivePour](./IPCB_PrimitivePour.md) \| undefined>
Copper border primitive object
## Example
```javascript
// 1. 生成随机起点坐标,避免与画布上已有的覆铜边框重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 用 pcb_MathPolygon.createPolygon 构造覆铜轮廓:500×300 的矩形区域
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
// 3. 在顶层铜层创建覆铜边框:挂 GND 网络、实心填充、不保留孤岛、优先级 5、线宽 10mil、不锁定
// 注意:net 不能传空字符串(会报参数不正确),需传已有网络名
const pour = await eda.pcb_PrimitivePour.create('GND', 1, polygon, 'solid', false, '嘉立创示例_覆铜', 5, 10, false);
// 4. 创建类保留现场,不删除图元
console.log('primitiveId:', pour.getState_PrimitiveId());
console.log('primitiveType:', pour.getState_PrimitiveType());
console.log('pourName:', pour.getState_PourName());
console.log('pourFillMethod:', pour.getState_PourFillMethod());
console.log('pourPriority:', pour.getState_PourPriority());
console.log('layer:', pour.getState_Layer());
```
### delete
# PCB\_PrimitivePour.delete() method
> 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.
Delete Copper border
## Signature
```typescript
function delete(primitiveIds: string | IPCB_PrimitivePour | Array<string> | Array<IPCB_PrimitivePour>): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string \| [IPCB\_PrimitivePour](./IPCB_PrimitivePour.md) \| Array<string> \| Array<[IPCB\_PrimitivePour](./IPCB_PrimitivePour.md)<!-- -->>
</td><td>
Copper border primitive ID or Copper border primitive object
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Delete Whether the operation is successful
## Example
```javascript
// 1. 创建两条待删除的测试覆铜边框(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon1 = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const polygon2 = eda.pcb_MathPolygon.createPolygon(['R', x, y + 500, 500, 300, 0, 0]);
const pour1 = await eda.pcb_PrimitivePour.create('GND', 1, polygon1, 'solid', false, '嘉立创示例_覆铜1', 5, 10, false);
const pour2 = await eda.pcb_PrimitivePour.create('GND', 1, polygon2, 'solid', false, '嘉立创示例_覆铜2', 5, 10, false);
// 2. 记录删除前的覆铜边框数量
const beforeCount = (await eda.pcb_PrimitivePour.getAll()).length;
// 3. 以 ID 数组形式批量删除两条覆铜边框
const deleted = await eda.pcb_PrimitivePour.delete([pour1.getState_PrimitiveId(), pour2.getState_PrimitiveId()]);
// 4. 删除类保留现场(图元已删除,不恢复)
const afterCount = (await eda.pcb_PrimitivePour.getAll()).length;
console.log('deleted:', deleted);
console.log('beforeCount:', beforeCount, '→ afterCount:', afterCount);
```
### get
# PCB\_PrimitivePour.get() method
> 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.
Get Copper border
## Signature
```typescript
function get(primitiveIds: string): Promise<IPCB_PrimitivePour | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string
</td><td>
Copper border primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitivePour](./IPCB_PrimitivePour.md) \| undefined>
Copper border primitive object, `undefined` indicates that the retrieval failed
## Example
```javascript
// 1. 创建两条测试覆铜边框(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon1 = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const polygon2 = eda.pcb_MathPolygon.createPolygon(['R', x, y + 500, 500, 300, 0, 0]);
const pour1 = await eda.pcb_PrimitivePour.create('GND', 1, polygon1, 'solid', false, '嘉立创示例_覆铜1', 5, 10, false);
const pour2 = await eda.pcb_PrimitivePour.create('GND', 1, polygon2, '90grid', false, '嘉立创示例_覆铜2', 6, 10, false);
// 2. 传单个 ID 字符串,返回单个覆铜边框对象
const single = await eda.pcb_PrimitivePour.get(pour1.getState_PrimitiveId());
// 3. 传 ID 数组,返回覆铜边框对象数组
const arr = await eda.pcb_PrimitivePour.get([pour1.getState_PrimitiveId(), pour2.getState_PrimitiveId()]);
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitivePour.delete([pour1.getState_PrimitiveId(), pour2.getState_PrimitiveId()]);
console.log('single pourName:', single.getState_PourName());
console.log('array length:', arr.length);
console.log('pour2 fillMethod:', arr[1].getState_PourFillMethod());
```
### get_1
# PCB\_PrimitivePour.get() method
> 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.
Get Copper border
## Signature
```typescript
function get(primitiveIds: Array<string>): Promise<Array<IPCB_PrimitivePour>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
Array<string>
</td><td>
Copper border primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitivePour](./IPCB_PrimitivePour.md)<!-- -->>>
Copper border primitive object; an empty array indicates that the retrieval failed
## Remarks
If multiple primitive IDs are passed in, a primitive ID that is not matched will not affect the return of other primitives; that is, fewer primitive objects than the number of primitive IDs passed in may be returned.
### getall
# PCB\_PrimitivePour.getAll() method
> 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.
Get all Copper border primitive
## Signature
```typescript
function getAll(
net?: string,
layer?: TPCB_LayersOfCopper,
primitiveLock?: boolean,
): Promise<Array<IPCB_PrimitivePour>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string
</td><td>
_(Optional)_ Net name
</td></tr>
<tr><td>
layer
</td><td>
[TPCB\_LayersOfCopper](../types/TPCB_LayersOfCopper.md)
</td><td>
_(Optional)_ Layer
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitivePour](./IPCB_PrimitivePour.md)<!-- -->>>
Array of Copper border primitive objects
## Example
```javascript
// 1. 创建一条顶层测试覆铜边框作为过滤目标(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('GND', 1, polygon, 'solid', false, '嘉立创示例_覆铜', 5, 10, false);
const pourId = pour.getState_PrimitiveId();
// 2. 不带参数:获取 PCB 上全部覆铜边框
const all = await eda.pcb_PrimitivePour.getAll();
// 3. 按网络和层过滤:只取 GND 网络顶层(1)的覆铜边框
const gndTop = await eda.pcb_PrimitivePour.getAll('GND', 1);
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitivePour.delete([pourId]);
console.log('total pours:', all.length);
console.log('GND top layer pours:', gndTop.length);
console.log('marker pour found in GND top layer:', gndTop.some(p => p.getState_PrimitiveId() === pourId));
```
### getallprimitiveid
# PCB\_PrimitivePour.getAllPrimitiveId() method
> 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.
Get all Copper border primitive IDs
## Signature
```typescript
function getAllPrimitiveId(
net?: string,
layer?: TPCB_LayersOfCopper,
primitiveLock?: boolean,
): Promise<Array<string>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string
</td><td>
_(Optional)_ Net name
</td></tr>
<tr><td>
layer
</td><td>
[TPCB\_LayersOfCopper](../types/TPCB_LayersOfCopper.md)
</td><td>
_(Optional)_ Layer
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<Array<string>>
Array of Copper border primitive IDs
## Example
```javascript
// 1. 创建一条顶层测试覆铜边框作为查找目标(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('GND', 1, polygon, 'solid', false, '嘉立创示例_覆铜', 5, 10, false);
const pourId = pour.getState_PrimitiveId();
// 2. 获取全部覆铜边框的图元 ID
const allIds = await eda.pcb_PrimitivePour.getAllPrimitiveId();
// 3. 按网络和层过滤:只取 GND 网络顶层(1)覆铜边框的图元 ID
const gndTopIds = await eda.pcb_PrimitivePour.getAllPrimitiveId('GND', 1);
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitivePour.delete([pourId]);
console.log('total pour ids:', allIds.length);
console.log('GND top layer pour ids:', gndTopIds.length);
console.log('marker id in GND top layer list:', gndTopIds.includes(pourId));
```
### modify
# PCB\_PrimitivePour.modify() method
> 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.
Modify Copper border
## Signature
```typescript
function modify(
primitiveId: string | IPCB_PrimitivePour,
property: {
net?: string;
layer?: TPCB_LayersOfCopper;
complexPolygon?: IPCB_Polygon;
pourFillMethod?: EPCB_PrimitivePourFillMethod;
preserveSilos?: boolean;
pourName?: string;
pourPriority?: number;
lineWidth?: number;
primitiveLock?: boolean;
},
): Promise<IPCB_PrimitivePour | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveId
</td><td>
string \| [IPCB\_PrimitivePour](./IPCB_PrimitivePour.md)
</td><td>
Primitive ID
</td></tr>
<tr><td>
property
</td><td>
{ net?: string; layer?: [TPCB\_LayersOfCopper](../types/TPCB_LayersOfCopper.md)<!-- -->; complexPolygon?: [IPCB\_Polygon](./IPCB_Polygon.md)<!-- -->; pourFillMethod?: [EPCB\_PrimitivePourFillMethod](../enums/EPCB_PrimitivePourFillMethod.md)<!-- -->; preserveSilos?: boolean; pourName?: string; pourPriority?: number; lineWidth?: number; primitiveLock?: boolean }
</td><td>
Modify Parameter
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitivePour](./IPCB_PrimitivePour.md) \| undefined>
Copper border primitive object, `undefined` indicates that the modification failed
## Example
```javascript
// 1. 创建待修改的测试覆铜边框(随机坐标避免与画布已有覆铜重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('GND', 1, polygon, 'solid', false, '嘉立创示例_覆铜', 5, 10, false);
const pourId = pour.getState_PrimitiveId();
// 2. 读取修改前的层与优先级
const beforeLayer = pour.getState_Layer();
const beforePriority = pour.getState_PourPriority();
// 3. 批量修改:层从顶层(1)换到底层(2),优先级 5 → 6
await eda.pcb_PrimitivePour.modify(pourId, { layer: 2, pourPriority: 6 });
// 4. modify 返回后需要重新 get() 才能读到画布上的最新值
const refreshed = await eda.pcb_PrimitivePour.get(pourId);
// 5. 修改类保留现场,供观察修改结果
console.log('primitiveId:', pourId);
console.log('layer:', beforeLayer, '→', refreshed.getState_Layer());
console.log('pourPriority:', beforePriority, '→', refreshed.getState_PourPriority());
```
references/classes/PCB_PrimitivePad.md
# PCB\_PrimitivePad class
PCB & footprint / pad primitive class
## Signature
```typescript
class PCB_PrimitivePad implements IPCB_PrimitiveAPI
```
**Implements:** [IPCB\_PrimitiveAPI](../interfaces/IPCB_PrimitiveAPI.md)
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[create(layer, padNumber, x, y, rotation, pad, net, hole, holeOffsetX, holeOffsetY, holeRotation, metallization, padType, specialPad, solderMaskAndPasteMaskExpansion, heatWelding, primitiveLock)](./PCB_PrimitivePad.md)
</td><td>
</td><td>
Create Pad
</td></tr>
<tr><td>
[delete(primitiveIds)](./PCB_PrimitivePad.md)
</td><td>
</td><td>
**_(BETA)_** Delete Pad
</td></tr>
<tr><td>
[get(primitiveIds)](./PCB_PrimitivePad.md)
</td><td>
</td><td>
**_(BETA)_** Get Pad
</td></tr>
<tr><td>
[get(primitiveIds)](./PCB_PrimitivePad.md)
</td><td>
</td><td>
**_(BETA)_** Get Pad
</td></tr>
<tr><td>
[getAll(layer, net, primitiveLock, padType)](./PCB_PrimitivePad.md)
</td><td>
</td><td>
**_(BETA)_** Get all Pad
</td></tr>
<tr><td>
[getAllPrimitiveId(layer, net, primitiveLock, padType)](./PCB_PrimitivePad.md)
</td><td>
</td><td>
**_(BETA)_** Get all Pad primitive IDs
</td></tr>
<tr><td>
[modify(primitiveId, property)](./PCB_PrimitivePad.md)
</td><td>
</td><td>
**_(BETA)_** Modify Pad
</td></tr>
</tbody></table>
---
## 方法详情
### create
# PCB\_PrimitivePad.create() method
Create Pad
## Signature
```typescript
function create(
layer: TPCB_LayersOfPad,
padNumber: string,
x: number,
y: number,
rotation?: number,
pad?: TPCB_PrimitivePadShape,
net?: string,
hole?: TPCB_PrimitivePadHole | null,
holeOffsetX?: number,
holeOffsetY?: number,
holeRotation?: number,
metallization?: boolean,
padType?: EPCB_PrimitivePadType,
specialPad?: TPCB_PrimitiveSpecialPadShape,
solderMaskAndPasteMaskExpansion?: IPCB_PrimitiveSolderMaskAndPasteMaskExpansion | null,
heatWelding?: IPCB_PrimitivePadHeatWelding | null,
primitiveLock?: boolean,
): Promise<IPCB_PrimitivePad | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfPad](../types/TPCB_LayersOfPad.md)
</td><td>
Layer
</td></tr>
<tr><td>
padNumber
</td><td>
string
</td><td>
Pad number
</td></tr>
<tr><td>
x
</td><td>
number
</td><td>
X position
</td></tr>
<tr><td>
y
</td><td>
number
</td><td>
Y position
</td></tr>
<tr><td>
rotation
</td><td>
number
</td><td>
_(Optional)_ Rotation angle
</td></tr>
<tr><td>
pad
</td><td>
[TPCB\_PrimitivePadShape](../types/TPCB_PrimitivePadShape.md)
</td><td>
_(Optional)_ Pad shape. This parameter is required before the special pad shape is implemented
</td></tr>
<tr><td>
net
</td><td>
string
</td><td>
_(Optional)_ Net name
</td></tr>
<tr><td>
hole
</td><td>
[TPCB\_PrimitivePadHole](../types/TPCB_PrimitivePadHole.md) \| null
</td><td>
_(Optional)_ Hole. `null` indicates no hole
</td></tr>
<tr><td>
holeOffsetX
</td><td>
number
</td><td>
_(Optional)_ Hole offset X
</td></tr>
<tr><td>
holeOffsetY
</td><td>
number
</td><td>
_(Optional)_ Hole offset Y
</td></tr>
<tr><td>
holeRotation
</td><td>
number
</td><td>
_(Optional)_ Rotation angle of the hole relative to the pad
</td></tr>
<tr><td>
metallization
</td><td>
boolean
</td><td>
_(Optional)_ Whether the hole wall is plated
</td></tr>
<tr><td>
padType
</td><td>
[EPCB\_PrimitivePadType](../enums/EPCB_PrimitivePadType.md)
</td><td>
_(Optional)_ Pad type
</td></tr>
<tr><td>
specialPad
</td><td>
[TPCB\_PrimitiveSpecialPadShape](../types/TPCB_PrimitiveSpecialPadShape.md)
</td><td>
_(Optional)_ Special pad shape. Currently not implemented; please do not use it
</td></tr>
<tr><td>
solderMaskAndPasteMaskExpansion
</td><td>
[IPCB\_PrimitiveSolderMaskAndPasteMaskExpansion](../interfaces/IPCB_PrimitiveSolderMaskAndPasteMaskExpansion.md) \| null
</td><td>
_(Optional)_ Solder mask/paste mask expansion. `null` means following the rules
</td></tr>
<tr><td>
heatWelding
</td><td>
[IPCB\_PrimitivePadHeatWelding](../interfaces/IPCB_PrimitivePadHeatWelding.md) \| null
</td><td>
_(Optional)_ Thermal relief optimization parameters
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitivePad](./IPCB_PrimitivePad.md) \| undefined>
Pad primitive object
## Example
```javascript
// 1. 生成随机坐标,避免与画布上已有的焊盘重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 在顶层(1)创建一个 60x60 圆形贴片焊盘:外形用 ['ELLIPSE', 宽, 高],无孔传 null
const smd = await eda.pcb_PrimitivePad.create(1, '1', x, y, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
// 3. 在多层(12)创建一个 80x80 通孔焊盘:圆孔直径 35mil,金属化孔壁(沉铜)
const thru = await eda.pcb_PrimitivePad.create(12, '2', x, y + 500, 0, ['ELLIPSE', 80, 80], '', ['ROUND', 35], 0, 0, 0, true, 0);
// 4. 创建类保留现场,不删除图元
console.log('smd padId:', smd.getState_PrimitiveId());
console.log('smd layer:', smd.getState_Layer());
console.log('thru padId:', thru.getState_PrimitiveId());
console.log('thru layer:', thru.getState_Layer());
```
### delete
# PCB\_PrimitivePad.delete() method
> 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.
Delete Pad
## Signature
```typescript
function delete(primitiveIds: string | IPCB_PrimitivePad | Array<string> | Array<IPCB_PrimitivePad>): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string \| [IPCB\_PrimitivePad](./IPCB_PrimitivePad.md) \| Array<string> \| Array<[IPCB\_PrimitivePad](./IPCB_PrimitivePad.md)<!-- -->>
</td><td>
Pad primitive ID or Pad primitive object
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Delete Whether the operation is successful
## Example
```javascript
// 1. 创建两个待删除的测试焊盘(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const pad1 = await eda.pcb_PrimitivePad.create(1, '1', x, y, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
const pad2 = await eda.pcb_PrimitivePad.create(1, '2', x, y + 500, 0, ['OVAL', 80, 50], '', null, 0, 0, 0, false, 0);
// 2. 记录删除前的焊盘数量
const beforeCount = (await eda.pcb_PrimitivePad.getAll()).length;
// 3. 以 ID 数组形式批量删除两个焊盘
const deleted = await eda.pcb_PrimitivePad.delete([pad1.getState_PrimitiveId(), pad2.getState_PrimitiveId()]);
// 4. 删除类保留现场(图元已删除,不恢复)
const afterCount = (await eda.pcb_PrimitivePad.getAll()).length;
console.log('deleted:', deleted);
console.log('beforeCount:', beforeCount, '→ afterCount:', afterCount);
```
### get
# PCB\_PrimitivePad.get() method
> 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.
Get Pad
## Signature
```typescript
function get(primitiveIds: string): Promise<IPCB_PrimitivePad | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string
</td><td>
Pad primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitivePad](./IPCB_PrimitivePad.md) \| undefined>
Pad primitive object, `undefined` indicates that the retrieval failed
## Example
```javascript
// 1. 创建两个测试焊盘(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const pad1 = await eda.pcb_PrimitivePad.create(1, '1', x, y, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
const pad2 = await eda.pcb_PrimitivePad.create(1, '2', x, y + 500, 0, ['RECT', 80, 40, 0], '', null, 0, 0, 0, false, 0);
// 2. 传单个 ID 字符串,返回单个焊盘对象
const single = await eda.pcb_PrimitivePad.get(pad1.getState_PrimitiveId());
// 3. 传 ID 数组,返回焊盘对象数组(任一 ID 未匹配不影响其它项返回)
const arr = await eda.pcb_PrimitivePad.get([pad1.getState_PrimitiveId(), pad2.getState_PrimitiveId()]);
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitivePad.delete([pad1.getState_PrimitiveId(), pad2.getState_PrimitiveId()]);
console.log('single padNumber:', single.getState_PadNumber());
console.log('array length:', arr.length);
console.log('pad2 layer:', arr[1].getState_Layer());
```
### get_1
# PCB\_PrimitivePad.get() method
> 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.
Get Pad
## Signature
```typescript
function get(primitiveIds: Array<string>): Promise<Array<IPCB_PrimitivePad>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
Array<string>
</td><td>
Pad primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitivePad](./IPCB_PrimitivePad.md)<!-- -->>>
Pad primitive object; an empty array indicates that the retrieval failed
## Remarks
If multiple primitive IDs are passed in, a primitive ID that is not matched will not affect the return of other primitives; that is, fewer primitive objects than the number of primitive IDs passed in may be returned.
### getall
# PCB\_PrimitivePad.getAll() method
> 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.
Get all Pad
## Signature
```typescript
function getAll(
layer?: TPCB_LayersOfPad,
net?: string,
primitiveLock?: boolean,
padType?: EPCB_PrimitivePadType,
): Promise<Array<IPCB_PrimitivePad>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfPad](../types/TPCB_LayersOfPad.md)
</td><td>
_(Optional)_ Layer
</td></tr>
<tr><td>
net
</td><td>
string
</td><td>
_(Optional)_ Net name
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
<tr><td>
padType
</td><td>
[EPCB\_PrimitivePadType](../enums/EPCB_PrimitivePadType.md)
</td><td>
_(Optional)_
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitivePad](./IPCB_PrimitivePad.md)<!-- -->>>
Array of Pad primitive objects
## Example
```javascript
// 1. 创建一个顶层测试焊盘作为过滤目标(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(1, '1', x, y, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
const padId = pad.getState_PrimitiveId();
// 2. 不带参数:获取 PCB 上全部焊盘
const all = await eda.pcb_PrimitivePad.getAll();
// 3. 按层过滤:只取顶层(1)的焊盘
const topLayer = await eda.pcb_PrimitivePad.getAll(1);
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitivePad.delete([padId]);
console.log('total pads:', all.length);
console.log('top layer pads:', topLayer.length);
console.log('marker pad found in top layer:', topLayer.some(p => p.getState_PrimitiveId() === padId));
```
### getallprimitiveid
# PCB\_PrimitivePad.getAllPrimitiveId() method
> 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.
Get all Pad primitive IDs
## Signature
```typescript
function getAllPrimitiveId(
layer?: TPCB_LayersOfPad,
net?: string,
primitiveLock?: boolean,
padType?: EPCB_PrimitivePadType,
): Promise<Array<string>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfPad](../types/TPCB_LayersOfPad.md)
</td><td>
_(Optional)_ Layer
</td></tr>
<tr><td>
net
</td><td>
string
</td><td>
_(Optional)_ Net name
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
<tr><td>
padType
</td><td>
[EPCB\_PrimitivePadType](../enums/EPCB_PrimitivePadType.md)
</td><td>
_(Optional)_
</td></tr>
</tbody></table>
## Returns
Promise<Array<string>>
Array of Pad primitive IDs
## Example
```javascript
// 1. 创建一个顶层测试焊盘作为查找目标(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(1, '1', x, y, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
const padId = pad.getState_PrimitiveId();
// 2. 获取全部焊盘的图元 ID
const allIds = await eda.pcb_PrimitivePad.getAllPrimitiveId();
// 3. 按层过滤:只取顶层(1)焊盘的图元 ID
const topLayerIds = await eda.pcb_PrimitivePad.getAllPrimitiveId(1);
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitivePad.delete([padId]);
console.log('total pad ids:', allIds.length);
console.log('top layer pad ids:', topLayerIds.length);
console.log('marker id in top layer list:', topLayerIds.includes(padId));
```
### modify
# PCB\_PrimitivePad.modify() method
> 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.
Modify Pad
## Signature
```typescript
function modify(
primitiveId: string | IPCB_PrimitivePad,
property: {
layer?: TPCB_LayersOfPad;
padNumber?: string;
x?: number;
y?: number;
rotation?: number;
pad?: TPCB_PrimitivePadShape;
net?: string;
hole?: TPCB_PrimitivePadHole | null;
holeOffsetX?: number;
holeOffsetY?: number;
holeRotation?: number;
metallization?: boolean;
specialPad?: TPCB_PrimitiveSpecialPadShape;
solderMaskAndPasteMaskExpansion?: IPCB_PrimitiveSolderMaskAndPasteMaskExpansion | null;
heatWelding?: IPCB_PrimitivePadHeatWelding | null;
primitiveLock?: boolean;
},
): Promise<IPCB_PrimitivePad | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveId
</td><td>
string \| [IPCB\_PrimitivePad](./IPCB_PrimitivePad.md)
</td><td>
Primitive ID
</td></tr>
<tr><td>
property
</td><td>
{ layer?: [TPCB\_LayersOfPad](../types/TPCB_LayersOfPad.md)<!-- -->; padNumber?: string; x?: number; y?: number; rotation?: number; pad?: [TPCB\_PrimitivePadShape](../types/TPCB_PrimitivePadShape.md)<!-- -->; net?: string; hole?: [TPCB\_PrimitivePadHole](../types/TPCB_PrimitivePadHole.md) \| null; holeOffsetX?: number; holeOffsetY?: number; holeRotation?: number; metallization?: boolean; specialPad?: [TPCB\_PrimitiveSpecialPadShape](../types/TPCB_PrimitiveSpecialPadShape.md)<!-- -->; solderMaskAndPasteMaskExpansion?: [IPCB\_PrimitiveSolderMaskAndPasteMaskExpansion](../interfaces/IPCB_PrimitiveSolderMaskAndPasteMaskExpansion.md) \| null; heatWelding?: [IPCB\_PrimitivePadHeatWelding](../interfaces/IPCB_PrimitivePadHeatWelding.md) \| null; primitiveLock?: boolean }
</td><td>
Modify Parameter
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitivePad](./IPCB_PrimitivePad.md) \| undefined>
Pad primitive object
## Example
```javascript
// 1. 创建待修改的测试焊盘(随机坐标避免与画布已有焊盘重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const pad = await eda.pcb_PrimitivePad.create(1, '1', x, y, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
const padId = pad.getState_PrimitiveId();
// 2. 读取修改前的编号与旋转
const beforeNumber = pad.getState_PadNumber();
const beforeRotation = pad.getState_Rotation();
// 3. 批量修改:编号 '1' → 'A1',旋转 0 → 45 度
await eda.pcb_PrimitivePad.modify(padId, { padNumber: 'A1', rotation: 45 });
// 4. modify 返回后需要重新 get() 才能读到画布上的最新值
const refreshed = await eda.pcb_PrimitivePad.get(padId);
// 5. 修改类保留现场,供观察修改结果
console.log('primitiveId:', padId);
console.log('padNumber:', beforeNumber, '→', refreshed.getState_PadNumber());
console.log('rotation:', beforeRotation, '→', refreshed.getState_Rotation());
```
references/classes/PCB_PrimitivePoured.md
# PCB\_PrimitivePoured class
PCB & footprint / copper fill primitive class
## Signature
```typescript
class PCB_PrimitivePoured implements IPCB_PrimitiveAPI
```
**Implements:** [IPCB\_PrimitiveAPI](../interfaces/IPCB_PrimitiveAPI.md)
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[delete(primitiveIds)](./PCB_PrimitivePoured.md)
</td><td>
</td><td>
**_(BETA)_** Delete Copper fill
</td></tr>
<tr><td>
[get(primitiveIds)](./PCB_PrimitivePoured.md)
</td><td>
</td><td>
**_(BETA)_** Get Copper fill
</td></tr>
<tr><td>
[get(primitiveIds)](./PCB_PrimitivePoured.md)
</td><td>
</td><td>
**_(BETA)_** Get Copper fill
</td></tr>
<tr><td>
[getAll()](./PCB_PrimitivePoured.md)
</td><td>
</td><td>
**_(BETA)_** Get all Copper fill primitive
</td></tr>
<tr><td>
[getAllPrimitiveId()](./PCB_PrimitivePoured.md)
</td><td>
</td><td>
**_(BETA)_** Get all Copper fill primitive IDs
</td></tr>
</tbody></table>
---
## 方法详情
### delete
# PCB\_PrimitivePoured.delete() method
> 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.
Delete Copper fill
## Signature
```typescript
function delete(primitiveIds: string | IPCB_PrimitivePoured | Array<string> | Array<IPCB_PrimitivePoured>): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string \| [IPCB\_PrimitivePoured](./IPCB_PrimitivePoured.md) \| Array<string> \| Array<[IPCB\_PrimitivePoured](./IPCB_PrimitivePoured.md)<!-- -->>
</td><td>
Copper fill primitive ID or Copper fill primitive object
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Delete Whether the operation is successful
## Example
```javascript
// 1. 获取画布上已有的覆铜填充图元
const pouredList = await eda.pcb_PrimitivePoured.getAll();
if (!pouredList || pouredList.length === 0) {
console.log('说明:PCB 上没有覆铜填充,请先手动绘制覆铜并重建(设计 → 覆铜)');
return;
}
// 2. 记录删除前的覆铜填充数量
const beforeCount = (await eda.pcb_PrimitivePoured.getAll()).length;
// 3. 以 ID 数组形式删除第一个覆铜填充(也可以传图元对象)
const deleted = await eda.pcb_PrimitivePoured.delete([pouredList[0].getState_PrimitiveId()]);
// 4. 删除类保留现场(图元已删除,不恢复),从画布确认数量变化
const afterCount = (await eda.pcb_PrimitivePoured.getAll()).length;
console.log('deleted:', deleted);
console.log('beforeCount:', beforeCount, '→ afterCount:', afterCount);
```
### get
# PCB\_PrimitivePoured.get() method
> 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.
Get Copper fill
## Signature
```typescript
function get(primitiveIds: string): Promise<IPCB_PrimitivePoured | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string
</td><td>
Copper fill primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitivePoured](./IPCB_PrimitivePoured.md) \| undefined>
Copper fill primitive object, `undefined` indicates that the retrieval failed
## Example
```javascript
// 1. 获取画布上已有的覆铜填充图元
const pouredList = await eda.pcb_PrimitivePoured.getAll();
if (!pouredList || pouredList.length === 0) {
console.log('说明:PCB 上没有覆铜填充,请先手动绘制覆铜并重建(设计 → 覆铜)');
return;
}
const ids = pouredList.slice(0, 2).map(p => p.getState_PrimitiveId());
// 2. 传单个 ID 字符串,返回单个覆铜填充对象
const single = await eda.pcb_PrimitivePoured.get(ids[0]);
// 3. 传 ID 数组,返回覆铜填充对象数组(未匹配到的 ID 不影响其它项返回)
const arr = await eda.pcb_PrimitivePoured.get(ids);
const partial = await eda.pcb_PrimitivePoured.get([ids[0], 'unknown-id']);
console.log('single primitiveType:', single.getState_PrimitiveType());
console.log('array length:', arr.length);
console.log('含未匹配 ID 时返回数量:', partial.length);
console.log('关联覆铜边框 ID:', single.getState_PourPrimitiveId());
```
### get_1
# PCB\_PrimitivePoured.get() method
> 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.
Get Copper fill
## Signature
```typescript
function get(primitiveIds: Array<string>): Promise<Array<IPCB_PrimitivePoured>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
Array<string>
</td><td>
Copper fill primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitivePoured](./IPCB_PrimitivePoured.md)<!-- -->>>
Copper fill primitive object; an empty array indicates that the retrieval failed
## Remarks
If multiple primitive IDs are passed in, a primitive ID that is not matched will not affect the return of other primitives; that is, fewer primitive objects than the number of primitive IDs passed in may be returned.
### getall
# PCB\_PrimitivePoured.getAll() method
> 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.
Get all Copper fill primitive
## Signature
```typescript
function getAll(): Promise<Array<IPCB_PrimitivePoured>>;
```
## Returns
Promise<Array<[IPCB\_PrimitivePoured](./IPCB_PrimitivePoured.md)<!-- -->>>
Array of Copper fill primitive objects
## Example
```javascript
// 1. 获取画布上全部覆铜填充图元
const pouredList = await eda.pcb_PrimitivePoured.getAll();
if (!pouredList || pouredList.length === 0) {
console.log('说明:PCB 上没有覆铜填充,请先手动绘制覆铜并重建(设计 → 覆铜)');
return;
}
// 2. 读取第一个覆铜填充的关键状态
const first = pouredList[0];
console.log('total poured:', pouredList.length);
console.log('first primitiveType:', first.getState_PrimitiveType());
console.log('first 关联覆铜边框 ID:', first.getState_PourPrimitiveId());
console.log('first 子区域数量:', first.getState_PourFills().length);
```
### getallprimitiveid
# PCB\_PrimitivePoured.getAllPrimitiveId() method
> 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.
Get all Copper fill primitive IDs
## Signature
```typescript
function getAllPrimitiveId(): Promise<Array<string>>;
```
## Returns
Promise<Array<string>>
Array of Copper fill primitive IDs
## Example
```javascript
// 1. 获取画布上全部覆铜填充的图元 ID
const ids = await eda.pcb_PrimitivePoured.getAllPrimitiveId();
if (!ids || ids.length === 0) {
console.log('说明:PCB 上没有覆铜填充,请先手动绘制覆铜并重建(设计 → 覆铜)');
return;
}
// 2. 任取一个 ID 反查覆铜填充对象,验证列表有效
const poured = await eda.pcb_PrimitivePoured.get(ids[0]);
console.log('total poured ids:', ids.length);
console.log('refetched primitiveType:', poured.getState_PrimitiveType());
```
references/classes/PCB_PrimitiveVia.md
# PCB\_PrimitiveVia class
PCB & footprint / via primitive class
## Signature
```typescript
class PCB_PrimitiveVia implements IPCB_PrimitiveAPI
```
**Implements:** [IPCB\_PrimitiveAPI](../interfaces/IPCB_PrimitiveAPI.md)
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[create(net, x, y, holeDiameter, diameter, viaType, designRuleBlindViaName, solderMaskExpansion, primitiveLock)](./PCB_PrimitiveVia.md)
</td><td>
</td><td>
Create Via
</td></tr>
<tr><td>
[delete(primitiveIds)](./PCB_PrimitiveVia.md)
</td><td>
</td><td>
**_(BETA)_** Delete Via
</td></tr>
<tr><td>
[get(primitiveIds)](./PCB_PrimitiveVia.md)
</td><td>
</td><td>
**_(BETA)_** Get Via
</td></tr>
<tr><td>
[get(primitiveIds)](./PCB_PrimitiveVia.md)
</td><td>
</td><td>
**_(BETA)_** Get Via
</td></tr>
<tr><td>
[getAll(net, primitiveLock)](./PCB_PrimitiveVia.md)
</td><td>
</td><td>
**_(BETA)_** Get all Via
</td></tr>
<tr><td>
[getAllPrimitiveId(net, primitiveLock)](./PCB_PrimitiveVia.md)
</td><td>
</td><td>
**_(BETA)_** Get all Via primitive ID
</td></tr>
<tr><td>
[modify(primitiveId, property)](./PCB_PrimitiveVia.md)
</td><td>
</td><td>
**_(BETA)_** Modify Via
</td></tr>
</tbody></table>
---
## 方法详情
### create
# PCB\_PrimitiveVia.create() method
Create Via
## Signature
```typescript
function create(
net: string,
x: number,
y: number,
holeDiameter: number,
diameter: number,
viaType?: EPCB_PrimitiveViaType,
designRuleBlindViaName?: string | null,
solderMaskExpansion?: IPCB_PrimitiveSolderMaskAndPasteMaskExpansion | null,
primitiveLock?: boolean,
): Promise<IPCB_PrimitiveVia | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string
</td><td>
Net name
</td></tr>
<tr><td>
x
</td><td>
number
</td><td>
X coordinate
</td></tr>
<tr><td>
y
</td><td>
number
</td><td>
Y coordinate
</td></tr>
<tr><td>
holeDiameter
</td><td>
number
</td><td>
Hole diameter
</td></tr>
<tr><td>
diameter
</td><td>
number
</td><td>
Outer diameter
</td></tr>
<tr><td>
viaType
</td><td>
[EPCB\_PrimitiveViaType](../enums/EPCB_PrimitiveViaType.md)
</td><td>
_(Optional)_ Via type
</td></tr>
<tr><td>
designRuleBlindViaName
</td><td>
string \| null
</td><td>
_(Optional)_ Blind/buried via design rule item name, which defines the start and end layers of the via. `null` means it is not a blind/buried via
</td></tr>
<tr><td>
solderMaskExpansion
</td><td>
[IPCB\_PrimitiveSolderMaskAndPasteMaskExpansion](../interfaces/IPCB_PrimitiveSolderMaskAndPasteMaskExpansion.md) \| null
</td><td>
_(Optional)_ Solder mask/paste mask expansion. `null` means following the rules
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveVia](./IPCB_PrimitiveVia.md) \| undefined>
Via primitive object
## Example
```javascript
// 1. 生成随机放置坐标,避免与画布上已有的过孔重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建通孔:孔径 20mil、外径 40mil,不挂网络、不锁定(viaType 省略时默认通孔 0)
const via = await eda.pcb_PrimitiveVia.create('', x, y, 20, 40);
// 3. 创建类保留现场,不删除图元
console.log('primitiveId:', via.getState_PrimitiveId());
console.log('primitiveType:', via.getState_PrimitiveType());
console.log('net:', via.getState_Net());
console.log('holeDiameter:', via.getState_HoleDiameter());
console.log('diameter:', via.getState_Diameter());
console.log('x:', via.getState_X(), 'y:', via.getState_Y());
```
### delete
# PCB\_PrimitiveVia.delete() method
> 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.
Delete Via
## Signature
```typescript
function delete(primitiveIds: string | IPCB_PrimitiveVia | Array<string> | Array<IPCB_PrimitiveVia>): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string \| [IPCB\_PrimitiveVia](./IPCB_PrimitiveVia.md) \| Array<string> \| Array<[IPCB\_PrimitiveVia](./IPCB_PrimitiveVia.md)<!-- -->>
</td><td>
Via primitive ID or Via primitive object
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Delete Whether the operation is successful
## Example
```javascript
// 1. 创建两个待删除的测试过孔(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const via1 = await eda.pcb_PrimitiveVia.create('', x, y, 20, 40);
const via2 = await eda.pcb_PrimitiveVia.create('', x, y + 500, 20, 40);
// 2. 记录删除前的过孔数量
const beforeCount = (await eda.pcb_PrimitiveVia.getAll()).length;
// 3. 以 ID 数组形式批量删除两个过孔
const deleted = await eda.pcb_PrimitiveVia.delete([via1.getState_PrimitiveId(), via2.getState_PrimitiveId()]);
// 4. 删除类保留现场(图元已删除,不恢复)
const afterCount = (await eda.pcb_PrimitiveVia.getAll()).length;
console.log('deleted:', deleted);
console.log('beforeCount:', beforeCount, '→ afterCount:', afterCount);
```
### get
# PCB\_PrimitiveVia.get() method
> 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.
Get Via
## Signature
```typescript
function get(primitiveIds: string): Promise<IPCB_PrimitiveVia | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string
</td><td>
Via primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveVia](./IPCB_PrimitiveVia.md) \| undefined>
Via primitive object, `undefined` indicates that the retrieval failed
## Example
```javascript
// 1. 创建两个测试过孔(随机坐标避免重合),尺寸不同便于区分
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const via1 = await eda.pcb_PrimitiveVia.create('', x, y, 20, 40);
const via2 = await eda.pcb_PrimitiveVia.create('', x, y + 500, 30, 60);
// 2. 传单个 ID 字符串,返回单个过孔对象
const single = await eda.pcb_PrimitiveVia.get(via1.getState_PrimitiveId());
// 3. 传 ID 数组,返回过孔对象数组
const arr = await eda.pcb_PrimitiveVia.get([via1.getState_PrimitiveId(), via2.getState_PrimitiveId()]);
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveVia.delete([via1.getState_PrimitiveId(), via2.getState_PrimitiveId()]);
console.log('single holeDiameter:', single.getState_HoleDiameter());
console.log('array length:', arr.length);
console.log('via2 diameter:', arr[1].getState_Diameter());
```
### get_1
# PCB\_PrimitiveVia.get() method
> 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.
Get Via
## Signature
```typescript
function get(primitiveIds: Array<string>): Promise<Array<IPCB_PrimitiveVia>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
Array<string>
</td><td>
Via primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitiveVia](./IPCB_PrimitiveVia.md)<!-- -->>>
Via primitive object; an empty array indicates that the retrieval failed
## Remarks
If multiple primitive IDs are passed in, a primitive ID that is not matched will not affect the return of other primitives; that is, fewer primitive objects than the number of primitive IDs passed in may be returned.
### getall
# PCB\_PrimitiveVia.getAll() method
> 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.
Get all Via
## Signature
```typescript
function getAll(net?: string, primitiveLock?: boolean): Promise<Array<IPCB_PrimitiveVia>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string
</td><td>
_(Optional)_ Net name
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitiveVia](./IPCB_PrimitiveVia.md)<!-- -->>>
Array of Via primitive objects
## Example
```javascript
// 1. 创建一个挂网络的测试过孔作为过滤目标(网络不存在会自动创建,随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const via = await eda.pcb_PrimitiveVia.create('嘉立创示例_NET1', x, y, 20, 40);
const viaId = via.getState_PrimitiveId();
// 2. 不带参数:获取 PCB 上全部过孔
const all = await eda.pcb_PrimitiveVia.getAll();
// 3. 按网络过滤:只取挂在该网络下的过孔
const netVias = await eda.pcb_PrimitiveVia.getAll('嘉立创示例_NET1');
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveVia.delete([viaId]);
console.log('total vias:', all.length);
console.log('vias on demo net:', netVias.length);
console.log('marker via found:', netVias.some(v => v.getState_PrimitiveId() === viaId));
```
### getallprimitiveid
# PCB\_PrimitiveVia.getAllPrimitiveId() method
> 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.
Get all Via primitive ID
## Signature
```typescript
function getAllPrimitiveId(net?: string, primitiveLock?: boolean): Promise<Array<string>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string
</td><td>
_(Optional)_ Net name
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<Array<string>>
Array of Via primitive IDs
## Example
```javascript
// 1. 创建一个挂网络的测试过孔作为查找目标(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const via = await eda.pcb_PrimitiveVia.create('嘉立创示例_NET1', x, y, 20, 40);
const viaId = via.getState_PrimitiveId();
// 2. 获取全部过孔的图元 ID
const allIds = await eda.pcb_PrimitiveVia.getAllPrimitiveId();
// 3. 按网络过滤:只取挂在该网络下过孔的图元 ID
const netIds = await eda.pcb_PrimitiveVia.getAllPrimitiveId('嘉立创示例_NET1');
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveVia.delete([viaId]);
console.log('total via ids:', allIds.length);
console.log('demo net via ids:', netIds.length);
console.log('marker id in filtered list:', netIds.includes(viaId));
```
### modify
# PCB\_PrimitiveVia.modify() method
> 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.
Modify Via
## Signature
```typescript
function modify(
primitiveId: string | IPCB_PrimitiveVia,
property: {
net?: string;
x?: number;
y?: number;
holeDiameter?: number;
diameter?: number;
viaType?: EPCB_PrimitiveViaType;
designRuleBlindViaName?: string | null;
solderMaskExpansion?: IPCB_PrimitiveSolderMaskAndPasteMaskExpansion | null;
primitiveLock?: boolean;
},
): Promise<IPCB_PrimitiveVia | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveId
</td><td>
string \| [IPCB\_PrimitiveVia](./IPCB_PrimitiveVia.md)
</td><td>
Primitive ID
</td></tr>
<tr><td>
property
</td><td>
{ net?: string; x?: number; y?: number; holeDiameter?: number; diameter?: number; viaType?: [EPCB\_PrimitiveViaType](../enums/EPCB_PrimitiveViaType.md)<!-- -->; designRuleBlindViaName?: string \| null; solderMaskExpansion?: [IPCB\_PrimitiveSolderMaskAndPasteMaskExpansion](../interfaces/IPCB_PrimitiveSolderMaskAndPasteMaskExpansion.md) \| null; primitiveLock?: boolean }
</td><td>
Modify Parameter
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveVia](./IPCB_PrimitiveVia.md) \| undefined>
Via primitive object
## Example
```javascript
// 1. 创建待修改的测试过孔:孔径 20mil、外径 40mil(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const via = await eda.pcb_PrimitiveVia.create('', x, y, 20, 40);
const viaId = via.getState_PrimitiveId();
// 2. 读取修改前的孔径与外径
const beforeHole = via.getState_HoleDiameter();
const beforeDiameter = via.getState_Diameter();
// 3. 批量修改:孔径从 20 调大到 30,外径从 40 调大到 60
await eda.pcb_PrimitiveVia.modify(viaId, { holeDiameter: 30, diameter: 60 });
// 4. modify 返回后需要重新 get() 才能读到画布上的最新值
const refreshed = await eda.pcb_PrimitiveVia.get(viaId);
// 5. 修改类保留现场,供观察修改结果
console.log('primitiveId:', viaId);
console.log('holeDiameter:', beforeHole, '→', refreshed.getState_HoleDiameter());
console.log('diameter:', beforeDiameter, '→', refreshed.getState_Diameter());
```
references/classes/PCB_PrimitiveRegion.md
# PCB\_PrimitiveRegion class
PCB & footprint / forbidden region and constrained region primitive class
## Signature
```typescript
class PCB_PrimitiveRegion implements IPCB_PrimitiveAPI
```
**Implements:** [IPCB\_PrimitiveAPI](../interfaces/IPCB_PrimitiveAPI.md)
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[create(layer, complexPolygon, ruleType, regionName, lineWidth, primitiveLock)](./PCB_PrimitiveRegion.md)
</td><td>
</td><td>
**_(BETA)_** Create Region
</td></tr>
<tr><td>
[delete(primitiveIds)](./PCB_PrimitiveRegion.md)
</td><td>
</td><td>
**_(BETA)_** Delete Region
</td></tr>
<tr><td>
[get(primitiveIds)](./PCB_PrimitiveRegion.md)
</td><td>
</td><td>
**_(BETA)_** Get Region
</td></tr>
<tr><td>
[get(primitiveIds)](./PCB_PrimitiveRegion.md)
</td><td>
</td><td>
**_(BETA)_** Get Region
</td></tr>
<tr><td>
[getAll(layer, ruleType, primitiveLock)](./PCB_PrimitiveRegion.md)
</td><td>
</td><td>
**_(BETA)_** Get all Region
</td></tr>
<tr><td>
[getAllPrimitiveId(layer, ruleType, primitiveLock)](./PCB_PrimitiveRegion.md)
</td><td>
</td><td>
**_(BETA)_** Get all Region primitive IDs
</td></tr>
<tr><td>
[modify(primitiveId, property)](./PCB_PrimitiveRegion.md)
</td><td>
</td><td>
**_(BETA)_** Modify Region
</td></tr>
</tbody></table>
---
## 方法详情
### create
# PCB\_PrimitiveRegion.create() method
> 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.
Create Region
## Signature
```typescript
function create(
layer: TPCB_LayersOfRegion,
complexPolygon: IPCB_Polygon,
ruleType?: Array<EPCB_PrimitiveRegionRuleType>,
regionName?: string,
lineWidth?: number,
primitiveLock?: boolean,
): Promise<IPCB_PrimitiveRegion | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfRegion](../types/TPCB_LayersOfRegion.md)
</td><td>
Layer
</td></tr>
<tr><td>
complexPolygon
</td><td>
[IPCB\_Polygon](./IPCB_Polygon.md)
</td><td>
Complex polygon object
</td></tr>
<tr><td>
ruleType
</td><td>
Array<[EPCB\_PrimitiveRegionRuleType](../enums/EPCB_PrimitiveRegionRuleType.md)<!-- -->>
</td><td>
_(Optional)_ Region rule type
</td></tr>
<tr><td>
regionName
</td><td>
string
</td><td>
_(Optional)_ Region name
</td></tr>
<tr><td>
lineWidth
</td><td>
number
</td><td>
_(Optional)_ Line width
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md) \| undefined>
Region primitive object
## Example
```javascript
// 1. 生成随机起点坐标,避免与画布上已有的区域重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 用 pcb_MathPolygon.createPolygon 构造矩形边界:宽 500、高 300
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
// 3. 在顶层铜层创建禁止区域:规则 [2, 5] 即禁止元件 + 禁止布线,线宽 10mil,不锁定
const region = await eda.pcb_PrimitiveRegion.create(1, polygon, [2, 5], '嘉立创示例_禁布区', 10, false);
// 4. 创建类保留现场,不删除图元
console.log('primitiveId:', region.getState_PrimitiveId());
console.log('primitiveType:', region.getState_PrimitiveType());
console.log('layer:', region.getState_Layer());
console.log('ruleType:', region.getState_RuleType());
console.log('regionName:', region.getState_RegionName());
```
### delete
# PCB\_PrimitiveRegion.delete() method
> 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.
Delete Region
## Signature
```typescript
function delete(primitiveIds: string | IPCB_PrimitiveRegion | Array<string> | Array<IPCB_PrimitiveRegion>): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string \| [IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md) \| Array<string> \| Array<[IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)<!-- -->>
</td><td>
Region primitive ID or Region primitive object
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Delete Whether the operation is successful
## Example
```javascript
// 1. 创建两个待删除的测试区域(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon1 = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const polygon2 = eda.pcb_MathPolygon.createPolygon(['R', x, y + 500, 500, 300, 0, 0]);
const region1 = await eda.pcb_PrimitiveRegion.create(1, polygon1, [2], '嘉立创示例_删除A');
const region2 = await eda.pcb_PrimitiveRegion.create(1, polygon2, [5], '嘉立创示例_删除B');
// 2. 记录删除前的区域数量
const beforeCount = (await eda.pcb_PrimitiveRegion.getAll()).length;
// 3. 以 ID 数组形式批量删除两个区域
const deleted = await eda.pcb_PrimitiveRegion.delete([region1.getState_PrimitiveId(), region2.getState_PrimitiveId()]);
// 4. 删除类保留现场(图元已删除,不恢复)
const afterCount = (await eda.pcb_PrimitiveRegion.getAll()).length;
console.log('deleted:', deleted);
console.log('beforeCount:', beforeCount, '→ afterCount:', afterCount);
```
### get
# PCB\_PrimitiveRegion.get() method
> 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.
Get Region
## Signature
```typescript
function get(primitiveIds: string): Promise<IPCB_PrimitiveRegion | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string
</td><td>
Region primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md) \| undefined>
Region primitive object, `undefined` indicates that the retrieval failed
## Example
```javascript
// 1. 创建两个测试区域(随机坐标避免重合),分别用不同规则便于区分
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon1 = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const polygon2 = eda.pcb_MathPolygon.createPolygon(['R', x, y + 500, 500, 300, 0, 0]);
const region1 = await eda.pcb_PrimitiveRegion.create(1, polygon1, [2], '嘉立创示例_区域A');
const region2 = await eda.pcb_PrimitiveRegion.create(1, polygon2, [5], '嘉立创示例_区域B');
// 2. 传单个 ID 字符串,返回单个区域对象
const single = await eda.pcb_PrimitiveRegion.get(region1.getState_PrimitiveId());
// 3. 传 ID 数组,返回区域对象数组
const arr = await eda.pcb_PrimitiveRegion.get([region1.getState_PrimitiveId(), region2.getState_PrimitiveId()]);
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveRegion.delete([region1.getState_PrimitiveId(), region2.getState_PrimitiveId()]);
console.log('single ruleType:', single.getState_RuleType());
console.log('array length:', arr.length);
console.log('region2 ruleType:', arr[1].getState_RuleType());
```
### get_1
# PCB\_PrimitiveRegion.get() method
> 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.
Get Region
## Signature
```typescript
function get(primitiveIds: Array<string>): Promise<Array<IPCB_PrimitiveRegion>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
Array<string>
</td><td>
Region primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)<!-- -->>>
Region primitive object; an empty array indicates that the retrieval failed
## Remarks
If multiple primitive IDs are passed in, a primitive ID that is not matched will not affect the return of other primitives; that is, fewer primitive objects than the number of primitive IDs passed in may be returned.
### getall
# PCB\_PrimitiveRegion.getAll() method
> 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.
Get all Region
## Signature
```typescript
function getAll(
layer?: TPCB_LayersOfRegion,
ruleType?: Array<EPCB_PrimitiveRegionRuleType>,
primitiveLock?: boolean,
): Promise<Array<IPCB_PrimitiveRegion>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfRegion](../types/TPCB_LayersOfRegion.md)
</td><td>
_(Optional)_ Layer
</td></tr>
<tr><td>
ruleType
</td><td>
Array<[EPCB\_PrimitiveRegionRuleType](../enums/EPCB_PrimitiveRegionRuleType.md)<!-- -->>
</td><td>
_(Optional)_ Region rule type. Only primitives whose rule types are all consistent will be matched
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)<!-- -->>>
Array of Region primitive objects
## Example
```javascript
// 1. 创建一个顶层测试区域作为过滤目标:规则 [2] 即禁止元件(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const region = await eda.pcb_PrimitiveRegion.create(1, polygon, [2], '嘉立创示例_过滤目标');
const regionId = region.getState_PrimitiveId();
// 2. 不带参数:获取 PCB 上全部区域
const all = await eda.pcb_PrimitiveRegion.getAll();
// 3. 按层过滤:只取顶层(1)的区域
const topLayer = await eda.pcb_PrimitiveRegion.getAll(1);
// 4. 按规则类型过滤:只取规则为 [2](禁止元件)的区域,要求规则完全一致
const noComponents = await eda.pcb_PrimitiveRegion.getAll(undefined, [2]);
// 5. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveRegion.delete([regionId]);
console.log('total regions:', all.length);
console.log('top layer regions:', topLayer.length);
console.log('no-component regions:', noComponents.length);
console.log('marker region found:', noComponents.some(r => r.getState_PrimitiveId() === regionId));
```
### getallprimitiveid
# PCB\_PrimitiveRegion.getAllPrimitiveId() method
> 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.
Get all Region primitive IDs
## Signature
```typescript
function getAllPrimitiveId(
layer?: TPCB_LayersOfRegion,
ruleType?: Array<EPCB_PrimitiveRegionRuleType>,
primitiveLock?: boolean,
): Promise<Array<string>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfRegion](../types/TPCB_LayersOfRegion.md)
</td><td>
_(Optional)_ Layer
</td></tr>
<tr><td>
ruleType
</td><td>
Array<[EPCB\_PrimitiveRegionRuleType](../enums/EPCB_PrimitiveRegionRuleType.md)<!-- -->>
</td><td>
_(Optional)_ Region rule type. Only primitives whose rule types are all consistent will be matched
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<Array<string>>
Array of Region primitive IDs
## Example
```javascript
// 1. 创建一个顶层测试区域作为查找目标:规则 [2] 即禁止元件(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const region = await eda.pcb_PrimitiveRegion.create(1, polygon, [2], '嘉立创示例_ID查找目标');
const regionId = region.getState_PrimitiveId();
// 2. 获取全部区域的图元 ID
const allIds = await eda.pcb_PrimitiveRegion.getAllPrimitiveId();
// 3. 按层 + 规则类型过滤:只取顶层(1)禁止元件([2])区域的图元 ID
const filteredIds = await eda.pcb_PrimitiveRegion.getAllPrimitiveId(1, [2]);
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveRegion.delete([regionId]);
console.log('total region ids:', allIds.length);
console.log('filtered region ids:', filteredIds.length);
console.log('marker id in filtered list:', filteredIds.includes(regionId));
```
### modify
# PCB\_PrimitiveRegion.modify() method
> 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.
Modify Region
## Signature
```typescript
function modify(
primitiveId: string | IPCB_PrimitiveRegion,
property: {
layer?: TPCB_LayersOfRegion;
complexPolygon?: IPCB_Polygon;
ruleType?: Array<EPCB_PrimitiveRegionRuleType>;
regionName?: string;
lineWidth?: number;
primitiveLock?: boolean;
},
): Promise<IPCB_PrimitiveRegion | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveId
</td><td>
string \| [IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md)
</td><td>
Primitive ID
</td></tr>
<tr><td>
property
</td><td>
{ layer?: [TPCB\_LayersOfRegion](../types/TPCB_LayersOfRegion.md)<!-- -->; complexPolygon?: [IPCB\_Polygon](./IPCB_Polygon.md)<!-- -->; ruleType?: Array<[EPCB\_PrimitiveRegionRuleType](../enums/EPCB_PrimitiveRegionRuleType.md)<!-- -->>; regionName?: string; lineWidth?: number; primitiveLock?: boolean }
</td><td>
Modify Parameter
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveRegion](./IPCB_PrimitiveRegion.md) \| undefined>
Region primitive object, `undefined` indicates that the modification failed
## Example
```javascript
// 1. 创建待修改的测试区域:顶层,规则 [2] 即禁止元件(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const region = await eda.pcb_PrimitiveRegion.create(1, polygon, [2], '嘉立创示例_待修改');
const regionId = region.getState_PrimitiveId();
// 2. 读取修改前的层与规则类型
const beforeLayer = region.getState_Layer();
const beforeRuleType = region.getState_RuleType();
// 3. 批量修改:层从顶层(1)换到底层(2),规则 [2] 禁止元件扩展为 [2, 5] 禁止元件 + 禁止布线
await eda.pcb_PrimitiveRegion.modify(regionId, { layer: 2, ruleType: [2, 5] });
// 4. modify 返回后需要重新 get() 才能读到画布上的最新值
const refreshed = await eda.pcb_PrimitiveRegion.get(regionId);
// 5. 修改类保留现场,供观察修改结果
console.log('primitiveId:', regionId);
console.log('layer:', beforeLayer, '→', refreshed.getState_Layer());
console.log('ruleType:', JSON.stringify(beforeRuleType), '→', JSON.stringify(refreshed.getState_RuleType()));
```
references/classes/PCB_PrimitiveString.md
# PCB\_PrimitiveString class
PCB & footprint / text primitive class
## Signature
```typescript
class PCB_PrimitiveString implements IPCB_PrimitiveAPI
```
**Implements:** [IPCB\_PrimitiveAPI](../interfaces/IPCB_PrimitiveAPI.md)
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[create(layer, x, y, text, fontFamily, fontSize, lineWidth, alignMode, rotation, reverse, expansion, mirror, primitiveLock)](./PCB_PrimitiveString.md)
</td><td>
</td><td>
**_(BETA)_** Create Text
</td></tr>
<tr><td>
[delete(primitiveIds)](./PCB_PrimitiveString.md)
</td><td>
</td><td>
**_(BETA)_** Delete Text
</td></tr>
<tr><td>
[get(primitiveIds)](./PCB_PrimitiveString.md)
</td><td>
</td><td>
**_(BETA)_** Get Text
</td></tr>
<tr><td>
[get(primitiveIds)](./PCB_PrimitiveString.md)
</td><td>
</td><td>
**_(BETA)_** Get Text
</td></tr>
<tr><td>
[getAll(layer, primitiveLock)](./PCB_PrimitiveString.md)
</td><td>
</td><td>
**_(BETA)_** Get all Text
</td></tr>
<tr><td>
[getAllPrimitiveId(layer, primitiveLock)](./PCB_PrimitiveString.md)
</td><td>
</td><td>
**_(BETA)_** Get all Text primitive IDs
</td></tr>
<tr><td>
[modify(primitiveId, property)](./PCB_PrimitiveString.md)
</td><td>
</td><td>
**_(BETA)_** Modify Text
</td></tr>
</tbody></table>
---
## 方法详情
### create
# PCB\_PrimitiveString.create() method
> 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.
Create Text
## Signature
```typescript
function create(
layer: TPCB_LayersOfImage,
x: number,
y: number,
text: string,
fontFamily: string,
fontSize: number,
lineWidth: number,
alignMode: EPCB_PrimitiveStringAlignMode,
rotation: number,
reverse: boolean,
expansion: number,
mirror: boolean,
primitiveLock: boolean,
): Promise<IPCB_PrimitiveString | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfImage](../types/TPCB_LayersOfImage.md)
</td><td>
Layer
</td></tr>
<tr><td>
x
</td><td>
number
</td><td>
X coordinate
</td></tr>
<tr><td>
y
</td><td>
number
</td><td>
Y coordinate
</td></tr>
<tr><td>
text
</td><td>
string
</td><td>
Text content
</td></tr>
<tr><td>
fontFamily
</td><td>
string
</td><td>
Font. It needs to be imported into EasyEDA in advance
</td></tr>
<tr><td>
fontSize
</td><td>
number
</td><td>
Font size
</td></tr>
<tr><td>
lineWidth
</td><td>
number
</td><td>
Line width
</td></tr>
<tr><td>
alignMode
</td><td>
[EPCB\_PrimitiveStringAlignMode](../enums/EPCB_PrimitiveStringAlignMode.md)
</td><td>
Alignment mode
</td></tr>
<tr><td>
rotation
</td><td>
number
</td><td>
Rotation angle
</td></tr>
<tr><td>
reverse
</td><td>
boolean
</td><td>
Whether it is inverted
</td></tr>
<tr><td>
expansion
</td><td>
number
</td><td>
Inverted expansion
</td></tr>
<tr><td>
mirror
</td><td>
boolean
</td><td>
Whether it is mirrored
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveString](./IPCB_PrimitiveString.md) \| undefined>
Text primitive object
## Example
```javascript
// 1. 生成随机放置坐标,避免与画布上已有的文本重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 在顶层丝印层(3)创建文本:默认字体、字号 45、线宽 6、左下对齐(3)、不旋转、不反相、不镜像、不锁定
const text = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_版本V1.0', 'default', 45, 6, 3, 0, false, 0, false, false);
// 3. 创建类保留现场,不删除图元
console.log('primitiveId:', text.getState_PrimitiveId());
console.log('primitiveType:', text.getState_PrimitiveType());
console.log('layer:', text.getState_Layer());
console.log('text:', text.getState_Text());
console.log('fontSize:', text.getState_FontSize());
```
### delete
# PCB\_PrimitiveString.delete() method
> 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.
Delete Text
## Signature
```typescript
function delete(primitiveIds: string | IPCB_PrimitiveString | Array<string> | Array<IPCB_PrimitiveString>): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string \| [IPCB\_PrimitiveString](./IPCB_PrimitiveString.md) \| Array<string> \| Array<[IPCB\_PrimitiveString](./IPCB_PrimitiveString.md)<!-- -->>
</td><td>
Text primitive ID or Text primitive object
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Delete Whether the operation is successful
## Example
```javascript
// 1. 创建两个待删除的测试文本(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const text1 = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_删除A', 'default', 45, 6, 3, 0, false, 0, false, false);
const text2 = await eda.pcb_PrimitiveString.create(3, x, y + 500, '嘉立创示例_删除B', 'default', 45, 6, 3, 0, false, 0, false, false);
// 2. 记录删除前的文本数量
const beforeCount = (await eda.pcb_PrimitiveString.getAll()).length;
// 3. 以 ID 数组形式批量删除两个文本
const deleted = await eda.pcb_PrimitiveString.delete([text1.getState_PrimitiveId(), text2.getState_PrimitiveId()]);
// 4. 删除类保留现场(图元已删除,不恢复)
const afterCount = (await eda.pcb_PrimitiveString.getAll()).length;
console.log('deleted:', deleted);
console.log('beforeCount:', beforeCount, '→ afterCount:', afterCount);
```
### get
# PCB\_PrimitiveString.get() method
> 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.
Get Text
## Signature
```typescript
function get(primitiveIds: string): Promise<IPCB_PrimitiveString | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string
</td><td>
Text primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveString](./IPCB_PrimitiveString.md) \| undefined>
Text primitive object, `undefined` indicates that the retrieval failed
## Example
```javascript
// 1. 创建两个测试文本(随机坐标避免重合),内容不同便于区分
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const text1 = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_文本A', 'default', 45, 6, 3, 0, false, 0, false, false);
const text2 = await eda.pcb_PrimitiveString.create(3, x, y + 500, '嘉立创示例_文本B', 'default', 60, 6, 3, 0, false, 0, false, false);
// 2. 传单个 ID 字符串,返回单个文本对象
const single = await eda.pcb_PrimitiveString.get(text1.getState_PrimitiveId());
// 3. 传 ID 数组,返回文本对象数组
const arr = await eda.pcb_PrimitiveString.get([text1.getState_PrimitiveId(), text2.getState_PrimitiveId()]);
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveString.delete([text1.getState_PrimitiveId(), text2.getState_PrimitiveId()]);
console.log('single text:', single.getState_Text());
console.log('array length:', arr.length);
console.log('text2 fontSize:', arr[1].getState_FontSize());
```
### get_1
# PCB\_PrimitiveString.get() method
> 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.
Get Text
## Signature
```typescript
function get(primitiveIds: Array<string>): Promise<Array<IPCB_PrimitiveString>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
Array<string>
</td><td>
Text primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitiveString](./IPCB_PrimitiveString.md)<!-- -->>>
Text primitive object; an empty array indicates that the retrieval failed
## Remarks
If multiple primitive IDs are passed in, a primitive ID that is not matched will not affect the return of other primitives; that is, fewer primitive objects than the number of primitive IDs passed in may be returned.
### getall
# PCB\_PrimitiveString.getAll() method
> 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.
Get all Text
## Signature
```typescript
function getAll(
layer?: TPCB_LayersOfImage,
primitiveLock?: boolean,
): Promise<Array<IPCB_PrimitiveString>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfImage](../types/TPCB_LayersOfImage.md)
</td><td>
_(Optional)_ Layer
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<Array<[IPCB\_PrimitiveString](./IPCB_PrimitiveString.md)<!-- -->>>
Array of Text primitive objects
## Example
```javascript
// 1. 创建一个顶层丝印(3)测试文本作为过滤目标(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const text = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_过滤目标', 'default', 45, 6, 3, 0, false, 0, false, false);
const textId = text.getState_PrimitiveId();
// 2. 不带参数:获取 PCB 上全部文本
const all = await eda.pcb_PrimitiveString.getAll();
// 3. 按层过滤:只取顶层丝印(3)的文本
const topSilk = await eda.pcb_PrimitiveString.getAll(3);
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveString.delete([textId]);
console.log('total strings:', all.length);
console.log('top silkscreen strings:', topSilk.length);
console.log('marker string found:', topSilk.some(s => s.getState_PrimitiveId() === textId));
```
### getallprimitiveid
# PCB\_PrimitiveString.getAllPrimitiveId() method
> 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.
Get all Text primitive IDs
## Signature
```typescript
function getAllPrimitiveId(
layer?: TPCB_LayersOfImage,
primitiveLock?: boolean,
): Promise<Array<string>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
layer
</td><td>
[TPCB\_LayersOfImage](../types/TPCB_LayersOfImage.md)
</td><td>
_(Optional)_ Layer
</td></tr>
<tr><td>
primitiveLock
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is locked
</td></tr>
</tbody></table>
## Returns
Promise<Array<string>>
Array of Text primitive IDs
## Example
```javascript
// 1. 创建一个顶层丝印(3)测试文本作为查找目标(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const text = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_ID查找目标', 'default', 45, 6, 3, 0, false, 0, false, false);
const textId = text.getState_PrimitiveId();
// 2. 获取全部文本的图元 ID
const allIds = await eda.pcb_PrimitiveString.getAllPrimitiveId();
// 3. 按层过滤:只取顶层丝印(3)文本的图元 ID
const silkIds = await eda.pcb_PrimitiveString.getAllPrimitiveId(3);
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveString.delete([textId]);
console.log('total string ids:', allIds.length);
console.log('top silkscreen string ids:', silkIds.length);
console.log('marker id in filtered list:', silkIds.includes(textId));
```
### modify
# PCB\_PrimitiveString.modify() method
> 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.
Modify Text
## Signature
```typescript
function modify(
primitiveId: string | IPCB_PrimitiveString,
property: {
layer?: TPCB_LayersOfImage;
x?: number;
y?: number;
text?: string;
fontFamily?: string;
fontSize?: number;
lineWidth?: number;
alignMode?: EPCB_PrimitiveStringAlignMode;
rotation?: number;
reverse?: boolean;
expansion?: number;
mirror?: boolean;
primitiveLock?: boolean;
},
): Promise<IPCB_PrimitiveString | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveId
</td><td>
string \| [IPCB\_PrimitiveString](./IPCB_PrimitiveString.md)
</td><td>
Primitive ID
</td></tr>
<tr><td>
property
</td><td>
{ layer?: [TPCB\_LayersOfImage](../types/TPCB_LayersOfImage.md)<!-- -->; x?: number; y?: number; text?: string; fontFamily?: string; fontSize?: number; lineWidth?: number; alignMode?: [EPCB\_PrimitiveStringAlignMode](../enums/EPCB_PrimitiveStringAlignMode.md)<!-- -->; rotation?: number; reverse?: boolean; expansion?: number; mirror?: boolean; primitiveLock?: boolean }
</td><td>
Modify Parameter
</td></tr>
</tbody></table>
## Returns
Promise<[IPCB\_PrimitiveString](./IPCB_PrimitiveString.md) \| undefined>
Text primitive object
## Example
```javascript
// 1. 创建待修改的测试文本:顶层丝印(3),字号 45(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const text = await eda.pcb_PrimitiveString.create(3, x, y, '嘉立创示例_待修改', 'default', 45, 6, 3, 0, false, 0, false, false);
const textId = text.getState_PrimitiveId();
// 2. 读取修改前的内容与字号
const beforeText = text.getState_Text();
const beforeSize = text.getState_FontSize();
// 3. 批量修改:更换文字内容并把字号从 45 调大到 60
await eda.pcb_PrimitiveString.modify(textId, { text: '嘉立创示例_已更新', fontSize: 60 });
// 4. modify 返回后需要重新 get() 才能读到画布上的最新值
const refreshed = await eda.pcb_PrimitiveString.get(textId);
// 5. 修改类保留现场,供观察修改结果
console.log('primitiveId:', textId);
console.log('text:', beforeText, '→', refreshed.getState_Text());
console.log('fontSize:', beforeSize, '→', refreshed.getState_FontSize());
```
references/classes/PCB_SelectControl.md
# PCB\_SelectControl class
PCB & footprint / selection control class
## Signature
```typescript
class PCB_SelectControl
```
## Remarks
Get or operate the selected elements
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[clearSelected()](./PCB_SelectControl.md)
</td><td>
</td><td>
**_(BETA)_** Clear the selection
</td></tr>
<tr><td>
[doCrossProbeSelect(components, pins, nets, highlight, select)](./PCB_SelectControl.md)
</td><td>
</td><td>
**_(BETA)_** Perform cross-probe selection
</td></tr>
<tr><td>
[doSelectPrimitives(primitiveIds)](./PCB_SelectControl.md)
</td><td>
</td><td>
**_(BETA)_** Select primitives using primitive IDs
</td></tr>
<tr><td>
[getAllSelectedPrimitives\_PrimitiveId()](./PCB_SelectControl.md)
</td><td>
</td><td>
**_(BETA)_** Query the primitive IDs of all selected primitives
</td></tr>
<tr><td>
[getAllSelectedPrimitives()](./PCB_SelectControl.md)
</td><td>
</td><td>
**_(BETA)_** Query the primitive objects of all selected primitives
</td></tr>
<tr><td>
[getCurrentMousePosition()](./PCB_SelectControl.md)
</td><td>
</td><td>
**_(BETA)_** Get Current the mouse position on the canvas
</td></tr>
<tr><td>
[getSelectedPrimitives()](./PCB_SelectControl.md)
</td><td>
</td><td>
**_(BETA)_** Query all parameters of the selected primitives
</td></tr>
</tbody></table>
---
## 方法详情
### clearselected
# PCB\_SelectControl.clearSelected() method
> 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.
Clear the selection
## Signature
```typescript
function clearSelected(): Promise<boolean>;
```
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 创建测试焊盘并选中它
const pad = await eda.pcb_PrimitivePad.create(1, '1', 2000, 2000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
const padId = pad.getState_PrimitiveId();
await eda.pcb_SelectControl.doSelectPrimitives([padId]);
// 2. 确认清除前有选中图元
const beforeIds = await eda.pcb_SelectControl.getAllSelectedPrimitives_PrimitiveId();
console.log('清除前选中数量:', beforeIds.length);
// 3. 清除选中
const cleared = await eda.pcb_SelectControl.clearSelected();
console.log('cleared:', cleared);
// 4. 确认选中集已清空
const afterIds = await eda.pcb_SelectControl.getAllSelectedPrimitives_PrimitiveId();
console.log('清除后选中数量:', afterIds.length);
// 5. 清理测试图元
await eda.pcb_PrimitivePad.delete([padId]);
```
### docrossprobeselect
# PCB\_SelectControl.doCrossProbeSelect() method
> 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.
Perform cross-probe selection
## Signature
```typescript
function doCrossProbeSelect(
components?: Array<string>,
pins?: Array<string>,
nets?: Array<string>,
highlight?: boolean,
select?: boolean,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
components
</td><td>
Array<string>
</td><td>
_(Optional)_ Device designator
</td></tr>
<tr><td>
pins
</td><td>
Array<string>
</td><td>
_(Optional)_ Device designator \_ pin number, format is \['U1\_1', 'U1\_2'\]
</td></tr>
<tr><td>
nets
</td><td>
Array<string>
</td><td>
_(Optional)_ Net name
</td></tr>
<tr><td>
highlight
</td><td>
boolean
</td><td>
_(Optional)_ Whether to highlight
</td></tr>
<tr><td>
select
</td><td>
boolean
</td><td>
_(Optional)_ Whether the operation is successful
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
## Example
```javascript
// 1. 创建 2 个挂同一网络的测试焊盘,作为交叉选择的目标
const netName = '嘉立创示例_NET';
const pad1 = await eda.pcb_PrimitivePad.create(1, '1', 2000, 2000, 0, ['ELLIPSE', 60, 60], netName, null, 0, 0, 0, false, 0);
const pad2 = await eda.pcb_PrimitivePad.create(1, '2', 3000, 2000, 0, ['ELLIPSE', 60, 60], netName, null, 0, 0, 0, false, 0);
const padIds = [pad1.getState_PrimitiveId(), pad2.getState_PrimitiveId()];
// 2. 按网络名交叉选择(highlight=true 高亮,select=true 选中)
const crossProbed = await eda.pcb_SelectControl.doCrossProbeSelect(undefined, undefined, [netName], true, true);
console.log('crossProbed:', crossProbed);
// 3. 确认该网络上的焊盘已进入选中集
const selectedIds = await eda.pcb_SelectControl.getAllSelectedPrimitives_PrimitiveId();
console.log('选中图元数量:', selectedIds.length);
// 4. 清理选中状态和测试图元
await eda.pcb_SelectControl.clearSelected();
await eda.pcb_PrimitivePad.delete(padIds);
```
### doselectprimitives
# PCB\_SelectControl.doSelectPrimitives() method
> 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.
Select primitives using primitive IDs
## Signature
```typescript
function doSelectPrimitives(primitiveIds: string | Array<string>): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string \| Array<string>
</td><td>
Primitive ID
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 创建测试焊盘
const pad = await eda.pcb_PrimitivePad.create(1, '1', 2000, 2000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
const padId = pad.getState_PrimitiveId();
// 2. 用图元 ID 选中焊盘
const selected = await eda.pcb_SelectControl.doSelectPrimitives([padId]);
console.log('selected:', selected);
// 3. 确认焊盘已在选中集里
const selectedIds = await eda.pcb_SelectControl.getAllSelectedPrimitives_PrimitiveId();
console.log('选中数量:', selectedIds.length);
console.log('包含测试焊盘:', selectedIds.includes(padId));
// 4. 清理:清除选中并删除测试图元
await eda.pcb_SelectControl.clearSelected();
await eda.pcb_PrimitivePad.delete([padId]);
```
### getallselectedprimitives
# PCB\_SelectControl.getAllSelectedPrimitives() method
> 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.
Query the primitive objects of all selected primitives
## Signature
```typescript
function getAllSelectedPrimitives(): Promise<Array<IPCB_Primitive>>;
```
## Returns
Promise<Array<[IPCB\_Primitive](../interfaces/IPCB_Primitive.md)<!-- -->>>
Primitive objects of all selected primitives
## Example
```javascript
// 1. 创建测试焊盘并选中
const pad = await eda.pcb_PrimitivePad.create(1, '1', 2000, 2000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
const padId = pad.getState_PrimitiveId();
await eda.pcb_SelectControl.doSelectPrimitives([padId]);
// 2. 获取所有已选中图元的图元对象
const primitives = await eda.pcb_SelectControl.getAllSelectedPrimitives();
console.log('选中图元数量:', primitives.length);
// 3. 图元对象可直接调用图元方法读取属性
const first = primitives[0];
console.log('primitiveId:', first.getState_PrimitiveId());
console.log('layer:', first.getState_Layer());
// 4. 清理:清除选中并删除测试图元
await eda.pcb_SelectControl.clearSelected();
await eda.pcb_PrimitivePad.delete([padId]);
```
### getallselectedprimitives_primitiveid
# PCB\_SelectControl.getAllSelectedPrimitives\_PrimitiveId() method
> 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.
Query the primitive IDs of all selected primitives
## Signature
```typescript
function getAllSelectedPrimitives_PrimitiveId(): Promise<Array<string>>;
```
## Returns
Promise<Array<string>>
Primitive IDs of all selected primitives
## Example
```javascript
// 1. 创建 2 个测试焊盘并选中
const pad1 = await eda.pcb_PrimitivePad.create(1, '1', 2000, 2000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
const pad2 = await eda.pcb_PrimitivePad.create(1, '2', 3000, 2000, 0, ['ELLIPSE', 60, 60], '', null, 0, 0, 0, false, 0);
const padIds = [pad1.getState_PrimitiveId(), pad2.getState_PrimitiveId()];
await eda.pcb_SelectControl.doSelectPrimitives(padIds);
// 2. 查询所有已选中图元的图元 ID
const selectedIds = await eda.pcb_SelectControl.getAllSelectedPrimitives_PrimitiveId();
console.log('选中图元数量:', selectedIds.length);
console.log('包含全部测试焊盘:', padIds.every(id => selectedIds.includes(id)));
// 3. 清理:清除选中并删除测试图元
await eda.pcb_SelectControl.clearSelected();
await eda.pcb_PrimitivePad.delete(padIds);
```
### getcurrentmouseposition
# PCB\_SelectControl.getCurrentMousePosition() method
> 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.
Get Current the mouse position on the canvas
## Signature
```typescript
function getCurrentMousePosition(): Promise<{ x: number; y: number } | undefined>;
```
## Returns
Promise<{ x: number; y: number } \| undefined>
The mouse position on the canvas. `undefined` means the current mouse is not on the canvas
## Example
```javascript
// 1. 查询鼠标当前位置
const position = await eda.pcb_SelectControl.getCurrentMousePosition();
// 2. 鼠标在画布上时输出坐标,不在画布上时返回 undefined
if (position) {
console.log('x:', position.x);
console.log('y:', position.y);
}
else {
console.log('鼠标当前不在画布上');
}
```
### getselectedprimitives
# PCB\_SelectControl.getSelectedPrimitives() method
> 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.
> Warning: This API is now obsolete.
>
> Please use [getAllSelectedPrimitives](./PCB_SelectControl.md) instead
Query all parameters of the selected primitives
## Signature
```typescript
function getSelectedPrimitives(): Promise<Array<object>>;
```
## Returns
Promise<Array<object>>
All parameters of the selected primitives
references/classes/PCB_Tool.md
# PCB\_Tool class
PCB / 设计工具类
## Signature
```typescript
class PCB_Tool
```
references/classes/PCB_RayTracerEngine.md
# PCB\_RayTracerEngine class
PCB & footprint / ray tracer engine class
## Signature
```typescript
class PCB_RayTracerEngine
```
## Remarks
Controls the docking and interaction of the ray tracer engine
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[dispose()](./PCB_RayTracerEngine.md)
</td><td>
</td><td>
**_(BETA)_** Stop the ray tracer engine
</td></tr>
<tr><td>
[getLightConfigurations(lightName)](./PCB_RayTracerEngine.md)
</td><td>
</td><td>
**_(BETA)_** Get the ray tracer light configurations
</td></tr>
<tr><td>
[getRenderConfigurations()](./PCB_RayTracerEngine.md)
</td><td>
</td><td>
**_(BETA)_** Get the ray tracer render configurations
</td></tr>
<tr><td>
[init()](./PCB_RayTracerEngine.md)
</td><td>
</td><td>
**_(BETA)_** Initialize the ray tracer engine
</td></tr>
<tr><td>
[setRenderConfigurations(configurations)](./PCB_RayTracerEngine.md)
</td><td>
</td><td>
**_(BETA)_** Set the ray tracer render configurations
</td></tr>
</tbody></table>
---
## 方法详情
### dispose
# PCB\_RayTracerEngine.dispose() method
> 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.
Stop the ray tracer engine
## Signature
```typescript
function dispose(): Promise<void>;
```
## Returns
Promise<void>
## Remarks
ADD since EDA v4
### getlightconfigurations
# PCB\_RayTracerEngine.getLightConfigurations() method
> 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.
Get the ray tracer light configurations
## Signature
```typescript
function getLightConfigurations(lightName: string): Promise<any>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
lightName
</td><td>
string
</td><td>
</td></tr>
</tbody></table>
## Returns
Promise<any>
Light configuration
## Remarks
The [get ray tracer render configurations](./PCB_RayTracerEngine.md) API contains a light configuration. This API is used to get different light configurations
The configuration definition of this API is still in progress ADD since EDA v4
### getrenderconfigurations
# PCB\_RayTracerEngine.getRenderConfigurations() method
> 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.
Get the ray tracer render configurations
## Signature
```typescript
function getRenderConfigurations(): Promise<any>;
```
## Returns
Promise<any>
Render configuration
## Remarks
The configuration definition of this API is still in progress ADD since EDA v4
### init
# PCB\_RayTracerEngine.init() method
> 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.
Initialize the ray tracer engine
## Signature
```typescript
function init(): Promise<void>;
```
## Returns
Promise<void>
## Remarks
ADD since EDA v4
### setrenderconfigurations
# PCB\_RayTracerEngine.setRenderConfigurations() method
> 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.
Set the ray tracer render configurations
## Signature
```typescript
function setRenderConfigurations(configurations: any): Promise<void>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
configurations
</td><td>
any
</td><td>
Render configuration
</td></tr>
</tbody></table>
## Returns
Promise<void>
## Remarks
The configuration definition of this API is still in progress ADD since EDA v4
references/classes/SCH_Event.md
# SCH\_Event class
Schematic & symbol / event class
## Signature
```typescript
class SCH_Event
```
## Remarks
Register an event callback
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[addMouseEventListener(id, eventType, callFn, onlyOnce)](./SCH_Event.md)
</td><td>
</td><td>
Add a mouse event listener
</td></tr>
<tr><td>
[addPrimitiveEventListener(id, eventType, callFn, onlyOnce)](./SCH_Event.md)
</td><td>
</td><td>
**_(BETA)_** Add a primitive event listener
</td></tr>
<tr><td>
[addSimulationEnginePullEventListener(id, eventType, callFn)](./SCH_Event.md)
</td><td>
</td><td>
**_(BETA)_** Register a simulation engine pull event listener
</td></tr>
<tr><td>
[isEventListenerAlreadyExist(id)](./SCH_Event.md)
</td><td>
</td><td>
Query whether the event listener exists
</td></tr>
<tr><td>
[removeEventListener(id)](./SCH_Event.md)
</td><td>
</td><td>
Remove Event listener
</td></tr>
</tbody></table>
---
## 方法详情
### addmouseeventlistener
# SCH\_Event.addMouseEventListener() method
Add a mouse event listener
## Signature
```typescript
function addMouseEventListener(
id: string,
eventType: 'all' | ESCH_MouseEventType,
callFn: (eventType: ESCH_MouseEventType) => void | Promise<void>,
onlyOnce?: boolean,
): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
Event ID, used to prevent duplicate event registration
</td></tr>
<tr><td>
eventType
</td><td>
'all' \| [ESCH\_MouseEventType](../enums/ESCH_MouseEventType.md)
</td><td>
Event type
</td></tr>
<tr><td>
callFn
</td><td>
(eventType: [ESCH\_MouseEventType](../enums/ESCH_MouseEventType.md)<!-- -->) => void \| Promise<void>
</td><td>
The callback function triggered when the event fires
</td></tr>
<tr><td>
onlyOnce
</td><td>
boolean
</td><td>
_(Optional)_ Whether to listen only once
</td></tr>
</tbody></table>
## Returns
void
## Remarks
Note: This API is only valid for extensions. Calling it in a standalone script environment will always `throw Error`
## Example
```javascript
const listenerId = '嘉立创示例_sch_mouse_event';
// 1. 注册鼠标事件监听,eventType 用 'all' 接收全部鼠标事件,onlyOnce 为 false 持续监听
eda.sch_Event.addMouseEventListener(
listenerId,
'all',
(eventType) => {
// 回调在用户画布操作时触发
console.log('mouseEvent:', eventType);
},
false
);
// 2. 回读确认注册成功
const registered = eda.sch_Event.isEventListenerAlreadyExist(listenerId);
console.log('registered:', registered);
// 3. 清理监听
const removed = eda.sch_Event.removeEventListener(listenerId);
console.log('removed:', removed);
```
### addprimitiveeventlistener
# SCH\_Event.addPrimitiveEventListener() method
> 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.
Add a primitive event listener
## Signature
```typescript
function addPrimitiveEventListener(
id: string,
eventType: 'all' | ESCH_PrimitiveEventType,
callFn: (
eventType: ESCH_PrimitiveEventType,
props: { primitiveIds: Array<string> },
) => void | Promise<void>,
onlyOnce?: boolean,
): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
Event ID, used to prevent duplicate event registration
</td></tr>
<tr><td>
eventType
</td><td>
'all' \| [ESCH\_PrimitiveEventType](../enums/ESCH_PrimitiveEventType.md)
</td><td>
Event type
</td></tr>
<tr><td>
callFn
</td><td>
(eventType: [ESCH\_PrimitiveEventType](../enums/ESCH_PrimitiveEventType.md)<!-- -->, props: { primitiveIds: Array<string> }) => void \| Promise<void>
</td><td>
The callback function triggered when the event fires
</td></tr>
<tr><td>
onlyOnce
</td><td>
boolean
</td><td>
_(Optional)_ Whether to listen only once
</td></tr>
</tbody></table>
## Returns
void
## Remarks
Note: This API is only valid for extensions. Calling it in a standalone script environment will always `throw Error`
## Example
```javascript
const listenerId = '嘉立创示例_sch_primitive_event';
// 1. 注册图元事件监听,eventType 用 'all' 接收全部图元事件
eda.sch_Event.addPrimitiveEventListener(
listenerId,
'all',
(eventType, props) => {
// 回调在画布图元变化时触发
console.log('primitiveEvent:', eventType, JSON.stringify(props?.primitiveIds));
},
false
);
// 2. 回读确认注册成功
const registered = eda.sch_Event.isEventListenerAlreadyExist(listenerId);
console.log('registered:', registered);
// 3. 清理监听
const removed = eda.sch_Event.removeEventListener(listenerId);
console.log('removed:', removed);
```
### addsimulationenginepulleventlistener
# SCH\_Event.addSimulationEnginePullEventListener() method
> 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.
Register a simulation engine pull event listener
## Signature
```typescript
function addSimulationEnginePullEventListener(
id: string,
eventType: 'all',
callFn: (
eventType:
ESCH_DynamicSimulationEnginePullEventType | ESCH_SpiceSimulationEnginePullEventType,
props: Record<string, any>,
) => void | Promise<void>,
): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
Event ID, used to prevent duplicate event registration
</td></tr>
<tr><td>
eventType
</td><td>
'all'
</td><td>
Event type
</td></tr>
<tr><td>
callFn
</td><td>
(eventType: [ESCH\_DynamicSimulationEnginePullEventType](../enums/ESCH_DynamicSimulationEnginePullEventType.md) \| [ESCH\_SpiceSimulationEnginePullEventType](../enums/ESCH_SpiceSimulationEnginePullEventType.md)<!-- -->, props: Record<string, any>) => void \| Promise<void>
</td><td>
The callback function triggered when the event fires
</td></tr>
</tbody></table>
## Returns
void
## Remarks
Note: This API is only valid for extensions. Calling it in a standalone script environment will always `throw Error`
## Example
```javascript
const listenerId = '嘉立创示例_sch_simulation_pull_event';
// 1. 注册仿真引擎拉取事件监听,eventType 固定传 'all'
eda.sch_Event.addSimulationEnginePullEventListener(
listenerId,
'all',
(eventType, props) => {
// 回调在仿真引擎拉取数据时触发
console.log('pullEvent:', eventType, JSON.stringify(props));
}
);
// 2. 回读确认注册成功
const registered = eda.sch_Event.isEventListenerAlreadyExist(listenerId);
console.log('registered:', registered);
// 3. 清理监听
const removed = eda.sch_Event.removeEventListener(listenerId);
console.log('removed:', removed);
```
### iseventlisteneralreadyexist
# SCH\_Event.isEventListenerAlreadyExist() method
Query whether the event listener exists
## Signature
```typescript
function isEventListenerAlreadyExist(id: string): boolean;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
Event ID
</td></tr>
</tbody></table>
## Returns
boolean
Whether the event listener exists
## Example
```javascript
const listenerId = '嘉立创示例_sch_event_exist';
// 1. 注册前查询:应为 false
const before = eda.sch_Event.isEventListenerAlreadyExist(listenerId);
console.log('before:', before);
// 2. 注册一个鼠标事件监听使 id 生效
eda.sch_Event.addMouseEventListener(listenerId, 'all', () => {}, false);
// 3. 注册后查询:应为 true
const after = eda.sch_Event.isEventListenerAlreadyExist(listenerId);
console.log('after:', after);
// 4. 移除后查询:应回到 false
eda.sch_Event.removeEventListener(listenerId);
const afterRemove = eda.sch_Event.isEventListenerAlreadyExist(listenerId);
console.log('afterRemove:', afterRemove);
```
### removeeventlistener
# SCH\_Event.removeEventListener() method
Remove Event listener
## Signature
```typescript
function removeEventListener(id: string): boolean;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
Event ID
</td></tr>
</tbody></table>
## Returns
boolean
Whether Remove Specify event listener
## Example
```javascript
const listenerId = '嘉立创示例_sch_event_remove';
// 1. 先注册一个鼠标事件监听作为移除目标
eda.sch_Event.addMouseEventListener(listenerId, 'all', () => {}, false);
const registered = eda.sch_Event.isEventListenerAlreadyExist(listenerId);
console.log('registered:', registered);
// 2. 移除该监听
const removed = eda.sch_Event.removeEventListener(listenerId);
console.log('removed:', removed);
// 3. 回读确认已不存在
const existAfter = eda.sch_Event.isEventListenerAlreadyExist(listenerId);
console.log('existAfter:', existAfter);
// 4. 重复移除同一 id:返回 false(本就未注册)
const removedAgain = eda.sch_Event.removeEventListener(listenerId);
console.log('removedAgain:', removedAgain);
```
references/classes/PNL_Document.md
# PNL\_Document class
Panel / document operation class
## Signature
```typescript
class PNL_Document
```
## Remarks
Operations performed on the design document as a whole
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[save()](./PNL_Document.md)
</td><td>
</td><td>
**_(BETA)_** Save Document
</td></tr>
</tbody></table>
---
## 方法详情
### save
# PNL\_Document.save() method
> 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.
Save Document
## Signature
```typescript
function save(): Promise<boolean>;
```
## Returns
Promise<boolean>
Whether the save operation was successful. Errors such as save failure and upload failure all return `false`
## Example
```javascript
// 1. 创建测试面板并打开(save 只对已打开的面板生效)
const panelUuid = await eda.dmt_Panel.createPanel();
await new Promise(r => setTimeout(r, 1500));
await eda.dmt_EditorControl.openDocument(panelUuid);
await new Promise(r => setTimeout(r, 1000));
// 2. 保存面板文档
const saved = await eda.pnl_Document.save();
console.log('saved:', saved);
// 3. 删除本例创建的测试面板,保持工程整洁
const deleted = await eda.dmt_Panel.deletePanel(panelUuid);
console.log('deleted:', deleted);
```
references/classes/SCH_Document.md
# SCH\_Document class
Schematic & symbol / document operation class
## Signature
```typescript
class SCH_Document
```
## Remarks
Operations performed on the design document as a whole
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[autoLayout(props)](./SCH_Document.md)
</td><td>
</td><td>
**_(BETA)_** Auto layout
</td></tr>
<tr><td>
[autoRouting(props)](./SCH_Document.md)
</td><td>
</td><td>
**_(BETA)_** Auto routing
</td></tr>
<tr><td>
[getCurrentFilterConfiguration()](./SCH_Document.md)
</td><td>
</td><td>
**_(BETA)_** Get Current canvas filter configuration
</td></tr>
<tr><td>
[getPrimitiveAtPoint(x, y)](./SCH_Document.md)
</td><td>
</td><td>
**_(BETA)_** Get The primitive at the coordinate point
</td></tr>
<tr><td>
[getPrimitivesInRegion(left, right, top, bottom)](./SCH_Document.md)
</td><td>
</td><td>
**_(BETA)_** Get All primitives in the region
</td></tr>
<tr><td>
[importChanges()](./SCH_Document.md)
</td><td>
</td><td>
Import changes from the PCB
</td></tr>
<tr><td>
[navigateToCoordinates(x, y)](./SCH_Document.md)
</td><td>
</td><td>
**_(BETA)_** Locate to canvas coordinate
</td></tr>
<tr><td>
[navigateToRegion(left, right, top, bottom)](./SCH_Document.md)
</td><td>
</td><td>
**_(BETA)_** Locate to canvas region
</td></tr>
<tr><td>
[save()](./SCH_Document.md)
</td><td>
</td><td>
Save Document
</td></tr>
</tbody></table>
---
## 方法详情
### autolayout
# SCH\_Document.autoLayout() method
> 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.
Auto layout
## Signature
```typescript
function autoLayout(props?: {
uuids?: Array<string>;
netlist?: {
component: Record<
string,
{
pinInfoMap: Record<
string,
{ name: string; number: string; net: string; props: { 'Pin Number': string } }
>;
}
>;
};
designatorDeviceTypeMap?: Record<
string,
| 'resistor'
| 'capacitor'
| 'inductive'
| 'diode'
| 'triode'
| 'oscillator'
| 'chip'
| 'otherDevice'
>;
}): Promise<any>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
props
</td><td>
{ uuids?: Array<string>; netlist?: { component: Record<string, { pinInfoMap: Record<string, { name: string; number: string; net: string; props: { 'Pin Number': string } }> }> }; designatorDeviceTypeMap?: Record<string, 'resistor' \| 'capacitor' \| 'inductive' \| 'diode' \| 'triode' \| 'oscillator' \| 'chip' \| 'otherDevice'> }
</td><td>
_(Optional)_ Auto layout parameter
</td></tr>
</tbody></table>
## Returns
Promise<any>
Auto layout result
## Remarks
If no parameters are passed in, auto layout will be performed for all devices
## Example
```javascript
// 1. 创建测试原理图并打开(文档级 API 作用于当前激活的原理图)
const schematicUuid = await eda.dmt_Schematic.createSchematic();
await new Promise(r => setTimeout(r, 1500));
const schInfo = await eda.dmt_Schematic.getSchematicInfo(schematicUuid);
await eda.dmt_EditorControl.openDocument(schInfo.page[0].uuid);
await new Promise(r => setTimeout(r, 1000));
// 2. 对所有器件执行自动布局(空原理图无器件,立即返回结果对象)
const result = await eda.sch_Document.autoLayout();
console.log('result:', result);
// 3. 清理测试原理图
await new Promise(r => setTimeout(r, 1500));
await eda.dmt_Schematic.deleteSchematic(schematicUuid);
```
### autorouting
# SCH\_Document.autoRouting() method
> 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.
Auto routing
## Signature
```typescript
function autoRouting(props?: {
uuids?: Array<string>;
netlist?: {
component: Record<
string,
{
pinInfoMap: Record<
string,
{ name: string; number: string; net: string; props: { 'Pin Number': string } }
>;
}
>;
};
designatorDeviceTypeMap?: Record<
string,
| 'resistor'
| 'capacitor'
| 'inductive'
| 'diode'
| 'triode'
| 'oscillator'
| 'chip'
| 'otherDevice'
>;
}): Promise<any>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
props
</td><td>
{ uuids?: Array<string>; netlist?: { component: Record<string, { pinInfoMap: Record<string, { name: string; number: string; net: string; props: { 'Pin Number': string } }> }> }; designatorDeviceTypeMap?: Record<string, 'resistor' \| 'capacitor' \| 'inductive' \| 'diode' \| 'triode' \| 'oscillator' \| 'chip' \| 'otherDevice'> }
</td><td>
_(Optional)_ Auto routing parameter
</td></tr>
</tbody></table>
## Returns
Promise<any>
Auto routing result
## Remarks
If no parameters are passed in, auto routing will be performed for all unrouted nets
## Example
```javascript
// 1. 创建测试原理图并打开
const schematicUuid = await eda.dmt_Schematic.createSchematic();
await new Promise(r => setTimeout(r, 1000));
const schInfo = await eda.dmt_Schematic.getSchematicInfo(schematicUuid);
await eda.dmt_EditorControl.openDocument(schInfo.page[0].uuid);
await new Promise(r => setTimeout(r, 800));
// 2. 放置两个测试器件并取第一个引脚的坐标(关键字搜索当前版本异常,按 C 编号反查器件)
const devices = await eda.lib_Device.searchByProperties({ supplierId: 'C1523' }, undefined, undefined, undefined, 5, 1);
const sysLibUuid = await eda.lib_LibrariesList.getSystemLibraryUuid();
const device = { libraryUuid: sysLibUuid, uuid: devices[0].uuid };
const comp1 = await eda.sch_PrimitiveComponent.create(device, 800, 800);
const comp2 = await eda.sch_PrimitiveComponent.create(device, 1600, 800);
const pin1 = (await comp1.getAllPins())[0];
const pin2 = (await comp2.getAllPins())[0];
// 3. 在两个引脚上放同名接地标志,构成一个跨器件的 GND 网络
const flag1 = await eda.sch_PrimitiveComponent.createNetFlag('Ground', 'GND', pin1.getState_X(), pin1.getState_Y());
const flag2 = await eda.sch_PrimitiveComponent.createNetFlag('Ground', 'GND', pin2.getState_X(), pin2.getState_Y());
console.log('netFlagIds:', flag1.getState_PrimitiveId(), flag2.getState_PrimitiveId());
// 4. 统计布线前导线数,执行自动布线后再统计一次
const wiresBefore = (await eda.sch_PrimitiveWire.getAllPrimitiveId()).length;
const result = await eda.sch_Document.autoRouting();
const wiresAfter = (await eda.sch_PrimitiveWire.getAllPrimitiveId()).length;
console.log('result:', result);
console.log('wiresBefore:', wiresBefore, 'wiresAfter:', wiresAfter);
// 5. 清理测试原理图(器件与网络标志随文档一起删除)
await new Promise(r => setTimeout(r, 1500));
await eda.dmt_Schematic.deleteSchematic(schematicUuid);
```
### getcurrentfilterconfiguration
# SCH\_Document.getCurrentFilterConfiguration() method
> 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.
Get Current canvas filter configuration
## Signature
```typescript
function getCurrentFilterConfiguration(): Promise<Record<string, boolean> | undefined>;
```
## Returns
Promise<Record<string, boolean> \| undefined>
Current canvas filter configuration; `undefined` indicates that the retrieval failed
## Remarks
ADD since EDA v4.2
### getprimitiveatpoint
# SCH\_Document.getPrimitiveAtPoint() method
> 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.
Get The primitive at the coordinate point
## Signature
```typescript
function getPrimitiveAtPoint(x: number, y: number): Promise<ISCH_Primitive | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
x
</td><td>
number
</td><td>
Coordinate point X
</td></tr>
<tr><td>
y
</td><td>
number
</td><td>
Coordinate point Y
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_Primitive](../interfaces/ISCH_Primitive.md) \| undefined>
The primitive at the coordinate point. If no primitive can be found at the coordinate point, `undefined` will be returned
## Remarks
This operation is similar to clicking with the mouse on the front end; it will get the primitive at the specified coordinate point ADD since EDA v4.2
### getprimitivesinregion
# SCH\_Document.getPrimitivesInRegion() method
> 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.
Get All primitives in the region
## Signature
```typescript
function getPrimitivesInRegion(
left: number,
right: number,
top: number,
bottom: number,
): Promise<Array<ISCH_Primitive>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
left
</td><td>
number
</td><td>
First X coordinate of the rectangle
</td></tr>
<tr><td>
right
</td><td>
number
</td><td>
Second X coordinate of the rectangle
</td></tr>
<tr><td>
top
</td><td>
number
</td><td>
First Y coordinate of the rectangle
</td></tr>
<tr><td>
bottom
</td><td>
number
</td><td>
Second Y coordinate of the rectangle
</td></tr>
</tbody></table>
## Returns
Promise<Array<[ISCH\_Primitive](../interfaces/ISCH_Primitive.md)<!-- -->>>
All primitives in the region
## Remarks
This API only returns primitives that are completely contained in the region. If a primitive is partially outside the region, it will be ignored ADD since EDA v4.2
### importchanges
# SCH\_Document.importChanges() method
Import changes from the PCB
## Signature
```typescript
function importChanges(): Promise<boolean>;
```
## Returns
Promise<boolean>
Whether the import operation is successful, import failed or a free schematic return `false`
## Example
```javascript
// 1. 创建测试原理图和测试 PCB
const schematicUuid = await eda.dmt_Schematic.createSchematic();
await new Promise(r => setTimeout(r, 1500));
const pcbUuid = await eda.dmt_Pcb.createPcb();
await new Promise(r => setTimeout(r, 1500));
// 2. 创建板子把原理图与 PCB 关联起来(返回板子名称)
const boardName = await eda.dmt_Board.createBoard(schematicUuid, pcbUuid);
await new Promise(r => setTimeout(r, 1500));
console.log('boardName:', boardName);
// 3. 打开原理图(图页级 UUID),从关联 PCB 导入变更
const schInfo = await eda.dmt_Schematic.getSchematicInfo(schematicUuid);
await eda.dmt_EditorControl.openDocument(schInfo.page[0].uuid);
await new Promise(r => setTimeout(r, 1000));
const imported = await eda.sch_Document.importChanges();
console.log('imported:', imported);
// 4. 清理:删板子、删 PCB、删原理图
await new Promise(r => setTimeout(r, 1500));
await eda.dmt_Board.deleteBoard(boardName);
await new Promise(r => setTimeout(r, 1000));
await eda.dmt_Pcb.deletePcb(pcbUuid);
await new Promise(r => setTimeout(r, 500));
await eda.dmt_Schematic.deleteSchematic(schematicUuid);
```
### navigatetocoordinates
# SCH\_Document.navigateToCoordinates() method
> 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.
Locate to canvas coordinate
## Signature
```typescript
function navigateToCoordinates(x: number, y: number): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
x
</td><td>
number
</td><td>
X coordinate
</td></tr>
<tr><td>
y
</td><td>
number
</td><td>
Y coordinate
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
This API positions on the front-end canvas to the specified coordinate;
The unit span here is 0.01inch ADD since EDA v4.2
### navigatetoregion
# SCH\_Document.navigateToRegion() method
> 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.
Locate to canvas region
## Signature
```typescript
function navigateToRegion(
left: number,
right: number,
top: number,
bottom: number,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
left
</td><td>
number
</td><td>
First X coordinate of the rectangle
</td></tr>
<tr><td>
right
</td><td>
number
</td><td>
Second X coordinate of the rectangle
</td></tr>
<tr><td>
top
</td><td>
number
</td><td>
First Y coordinate of the rectangle
</td></tr>
<tr><td>
bottom
</td><td>
number
</td><td>
Second Y coordinate of the rectangle
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
This API positions on the front-end canvas to the specified region;
For example: the passed-in data is `{left: 0, right: 60, top: 100, bottom: -20}` =<!-- -->> `navigateToRegion(0, 60, 100, -20)`<!-- -->, then the canvas will be positioned to a rectangular range centered at `[30, 40]` with a length of `60` in the x-axis direction and `120` in the y-axis direction;
This API does not perform zooming, but it will generate a rectangle frame indicating the positioning center and the region range;
The unit span here is 0.01inch ADD since EDA v4.2
### save
# SCH\_Document.save() method
Save Document
## Signature
```typescript
function save(): Promise<boolean>;
```
## Returns
Promise<boolean>
Whether the save operation was successful. Errors such as save failure and upload failure all return `false`
## Example
```javascript
// 1. 创建测试原理图并打开(保存作用于当前激活的原理图,openDocument 传图页级 UUID)
const schematicUuid = await eda.dmt_Schematic.createSchematic();
await new Promise(r => setTimeout(r, 1500));
const schInfo = await eda.dmt_Schematic.getSchematicInfo(schematicUuid);
await eda.dmt_EditorControl.openDocument(schInfo.page[0].uuid);
await new Promise(r => setTimeout(r, 1000));
// 2. 保存当前原理图
const saved = await eda.sch_Document.save();
console.log('saved:', saved);
// 3. 清理测试原理图(删除前等 1.5s 让保存变更同步落地)
await new Promise(r => setTimeout(r, 1500));
await eda.dmt_Schematic.deleteSchematic(schematicUuid);
```
references/classes/SCH_ManufactureData.md
# SCH\_ManufactureData class
Schematic & symbol / manufacture data class
## Signature
```typescript
class SCH_ManufactureData
```
## Remarks
Get the manufacture data files of the current schematic sheet and quick ordering
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[deleteBomTemplate(template)](./SCH_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Delete BOM template
</td></tr>
<tr><td>
[getAssemblyVariantsConfigs()](./SCH_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Get the assembly variants configuration list
</td></tr>
<tr><td>
[getBomFile(fileName, fileType, template, filterOptions, statistics, property, columns, assemblyVariantsConfig)](./SCH_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Get BOM file
</td></tr>
<tr><td>
[getBomTemplateFile(template)](./SCH_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Get BOM template file
</td></tr>
<tr><td>
[getBomTemplates()](./SCH_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Get BOM template list
</td></tr>
<tr><td>
[getExportDocumentFile(fileName, fileType, typeSpecificParams, object, objectSpecificParams)](./SCH_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Get Export document file
</td></tr>
<tr><td>
[getNetlistFile(fileName, netlistType)](./SCH_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Get the netlist file (Netlist)
</td></tr>
<tr><td>
[getPngFile(fileName, resolution)](./SCH_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** 获取 PNG 文件
</td></tr>
<tr><td>
[getSimulationNetlistFile(fileName, netlistType)](./SCH_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Get the simulation netlist file
</td></tr>
<tr><td>
[getSvgFile(fileName)](./SCH_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** 获取 SVG 文件
</td></tr>
<tr><td>
[placeComponentsOrder(interactive, ignoreWarning)](./SCH_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Component ordering
</td></tr>
<tr><td>
[placeSmtComponentsOrder(interactive, ignoreWarning)](./SCH_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** SMT component ordering
</td></tr>
<tr><td>
[uploadBomTemplateFile(templateFile, template)](./SCH_ManufactureData.md)
</td><td>
</td><td>
**_(BETA)_** Upload a BOM template file
</td></tr>
</tbody></table>
---
## 方法详情
### deletebomtemplate
# SCH\_ManufactureData.deleteBomTemplate() method
> 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.
Delete BOM template
## Signature
```typescript
function deleteBomTemplate(template: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
template
</td><td>
string
</td><td>
BOM template name
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 查看当前账号下的 BOM 模板
const templates = await eda.sch_ManufactureData.getBomTemplates();
console.log('当前模板:', templates.join('、'));
// 2. 删除一个不存在的模板名,验证 API 的返回行为(不影响任何已有模板)
const success = await eda.sch_ManufactureData.deleteBomTemplate('嘉立创示例_不存在的模板');
console.log('删除不存在模板的返回值:', success);
```
### getassemblyvariantsconfigs
# SCH\_ManufactureData.getAssemblyVariantsConfigs() method
> 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.
Get the assembly variants configuration list
## Signature
```typescript
function getAssemblyVariantsConfigs(): Promise<Array<{ text: string; value: string }>>;
```
## Returns
Promise<Array<{ text: string; value: string }>>
Assembly variants configuration list
## Example
```javascript
// 1. 获取全部装配体变量配置
const variantsConfigs = await eda.sch_ManufactureData.getAssemblyVariantsConfigs();
// 2. 逐个查看
console.log('配置数量:', variantsConfigs.length);
variantsConfigs.forEach((config, index) => console.log(`配置 ${index + 1}:`, config.text, config.value));
```
### getbomfile
# SCH\_ManufactureData.getBomFile() method
> 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.
Get BOM file
## Signature
```typescript
function getBomFile(
fileName?: string,
fileType?: 'xlsx' | 'csv',
template?: string,
filterOptions?: Array<{ property: string; includeValue: boolean | string }>,
statistics?: Array<string>,
property?: Array<string>,
columns?: Array<IPCB_BomPropertiesTableColumns>,
assemblyVariantsConfig?: { text: string; value: string },
): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_ File name
</td></tr>
<tr><td>
fileType
</td><td>
'xlsx' \| 'csv'
</td><td>
_(Optional)_ File type
</td></tr>
<tr><td>
template
</td><td>
string
</td><td>
_(Optional)_ Template name
</td></tr>
<tr><td>
filterOptions
</td><td>
Array<{ property: string; includeValue: boolean \| string }>
</td><td>
_(Optional)_ Filter rules, which should only contain the rules to be enabled. `property` is the rule name, and `includeValue` is the matched value
</td></tr>
<tr><td>
statistics
</td><td>
Array<string>
</td><td>
_(Optional)_ Statistics, containing the names of all statistic items to be enabled
</td></tr>
<tr><td>
property
</td><td>
Array<string>
</td><td>
_(Optional)_ Properties, containing the names of all properties to be enabled
</td></tr>
<tr><td>
columns
</td><td>
Array<[IPCB\_BomPropertiesTableColumns](../interfaces/IPCB_BomPropertiesTableColumns.md)<!-- -->>
</td><td>
_(Optional)_ Column properties and sorting. If `title`<!-- -->, `sort`<!-- -->, `group`<!-- -->, and `orderWeight` are not passed in, default values are used. `null` means \*\*none\*\* or \*\*empty\*\*
</td></tr>
<tr><td>
assemblyVariantsConfig
</td><td>
\{ text: string; value: string \}
</td><td>
_(Optional)_ Assembly variants configuration
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
BOM file data
## Remarks
You can use [SYS\_FileSystem.saveFile()](./SYS_FileSystem.md) API export the file to the local file system
## Example
```javascript
// 1. 导出 xlsx 格式 BOM,只包含标记了加入 BOM 的元件
const bomFile = await eda.sch_ManufactureData.getBomFile(
'嘉立创示例_BOM',
'xlsx',
undefined,
[{ property: 'Add into BOM', includeValue: 'yes' }]
);
// 2. 查看导出结果
console.log('导出文件名:', bomFile?.name);
console.log('文件大小:', bomFile?.size);
```
### getbomtemplatefile
# SCH\_ManufactureData.getBomTemplateFile() method
> 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.
Get BOM template file
## Signature
```typescript
function getBomTemplateFile(template: string): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
template
</td><td>
string
</td><td>
BOM template name
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
BOM template file
## Example
```javascript
// 1. 先拿到账号下可用的 BOM 模板列表
const templates = await eda.sch_ManufactureData.getBomTemplates();
console.log('可用模板:', templates.join('、'));
// 2. 导出第一个模板的文件
const templateFile = await eda.sch_ManufactureData.getBomTemplateFile(templates[0]);
// 3. 查看导出结果
console.log('模板文件大小:', templateFile?.size);
```
### getbomtemplates
# SCH\_ManufactureData.getBomTemplates() method
> 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.
Get BOM template list
## Signature
```typescript
function getBomTemplates(): Promise<Array<string>>;
```
## Returns
Promise<Array<string>>
BOM template list
## Example
```javascript
// 1. 获取全部 BOM 模板名
const templates = await eda.sch_ManufactureData.getBomTemplates();
// 2. 逐个查看
console.log('模板数量:', templates.length);
templates.forEach((name, index) => console.log(`模板 ${index + 1}:`, name));
```
### getexportdocumentfile
# SCH\_ManufactureData.getExportDocumentFile() method
> 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.
> Warning: This API is now obsolete.
>
> - DEPRECATED since EDA v4.1
Get Export document file
## Signature
```typescript
function getExportDocumentFile(
fileName?: string,
fileType?: ESCH_ExportDocumentFileType,
typeSpecificParams?: {
theme?: 'Default' | 'White on Black' | 'Black on White';
lineWidth?: 'Default' | 'Always 1px' | 'Follow the Zoom Change';
displayAttributesAsMenu?: boolean;
size?:
| 'Original Size'
| string
| { width: number; height: number; unit: ESYS_Unit.INCH | ESYS_Unit.MILLIMETER };
},
object?: 'All Schematic' | 'Current Schematic' | 'Current Schematic Page' | string,
objectSpecificParams?: {
range?: 'All' | [number, number];
outputMethod?: 'Merged sheet' | 'Separated sheet';
},
): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_ File name
</td></tr>
<tr><td>
fileType
</td><td>
[ESCH\_ExportDocumentFileType](../enums/ESCH_ExportDocumentFileType.md)
</td><td>
_(Optional)_ File type
</td></tr>
<tr><td>
typeSpecificParams
</td><td>
{ theme?: 'Default' \| 'White on Black' \| 'Black on White'; lineWidth?: 'Default' \| 'Always 1px' \| 'Follow the Zoom Change'; displayAttributesAsMenu?: boolean; size?: 'Original Size' \| string \| { width: number; height: number; unit: [ESYS\_Unit.INCH](../enums/ESYS_Unit.md) \| [ESYS\_Unit.MILLIMETER](../enums/ESYS_Unit.md) } }
</td><td>
_(Optional)_ Type-specific parameters
</td></tr>
<tr><td>
object
</td><td>
'All Schematic' \| 'Current Schematic' \| 'Current Schematic Page' \| string
</td><td>
_(Optional)_ Object
</td></tr>
<tr><td>
objectSpecificParams
</td><td>
{ range?: 'All' \| \[number, number\]; outputMethod?: 'Merged sheet' \| 'Separated sheet' }
</td><td>
_(Optional)_ Object-specific parameters
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
Exported document file data (or archive)
## Remarks
You can use [SYS\_FileSystem.saveFile()](./SYS_FileSystem.md) API export the file to the local file system
## Example
```javascript
// 1. 把当前图页导出为 PDF('PDF' 对应 ESCH_ExportDocumentFileType.PDF)
// const pdfFile = await eda.sch_ManufactureData.getExportDocumentFile(
// '嘉立创示例_原理图',
// 'PDF',
// undefined,
// 'Current Schematic Page'
// );
// console.log('导出文件名:', pdfFile?.name);
// 2. 也可以导出 PNG 位图,并通过类型特定参数控制主题和线宽
// const pngFile = await eda.sch_ManufactureData.getExportDocumentFile(
// '嘉立创示例_原理图',
// 'PNG',
// { theme: 'Black on White', lineWidth: 'Always 1px' },
// 'All Schematic',
// { outputMethod: 'Separated sheet' } // 多图页时逐页分张输出
// );
// console.log('导出文件名:', pngFile?.name);
// 3. 拿到文件后用 sys_FileSystem.saveFile() 保存到本地
console.log('演示调用:getExportDocumentFile(文件名, 文件类型, 显示参数, 导出范围, 多页参数)');
```
### getnetlistfile
# SCH\_ManufactureData.getNetlistFile() method
> 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.
Get the netlist file (Netlist)
## Signature
```typescript
function getNetlistFile(
fileName?: string,
netlistType?: ESYS_NetlistType,
): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_ File name
</td></tr>
<tr><td>
netlistType
</td><td>
[ESYS\_NetlistType](../enums/ESYS_NetlistType.md)
</td><td>
_(Optional)_ Netlist type
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
Netlist file data
## Remarks
You can use [SYS\_FileSystem.saveFile()](./SYS_FileSystem.md) API export the file to the local file system
## Example
```javascript
// 1. 导出 Altium Designer 格式的网表('Protel2' 对应 ESYS_NetlistType.ALTIUM_DESIGNER)
try {
const netlistFile = await eda.sch_ManufactureData.getNetlistFile('嘉立创示例_网表', 'Protel2');
console.log('导出文件名:', netlistFile?.name);
console.log('文件大小:', netlistFile?.size);
}
catch (e) {
// 原理图数据不满足网表校验(如引脚编号重复)时会抛错
console.log('当前原理图数据不满足网表导出要求,导出未完成');
}
```
### getpngfile
# SCH\_ManufactureData.getPngFile() method
> 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.
获取 PNG 文件
## Signature
```typescript
function getPngFile(
fileName?: string,
resolution?: ISCH_ExportPngResolution,
): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_ 文件名
</td></tr>
<tr><td>
resolution
</td><td>
[ISCH\_ExportPngResolution](../interfaces/ISCH_ExportPngResolution.md)
</td><td>
_(Optional)_ 导出图片分辨率,见 [ISCH\_ExportPngResolution](../interfaces/ISCH_ExportPngResolution.md)
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
PNG 文件数据(或压缩包)
## Remarks
ADD since EDA v3.2.183 支持按长宽分辨率导出高清图片(最大 4096); 支持只传入 `width` 或 `height` 中的任意一个,另一侧将按原始比例自动拉伸输出; `width` 与 `height` 均不传时,按当前一倍分辨率输出
/ EDA v4.1.23
### getsimulationnetlistfile
# SCH\_ManufactureData.getSimulationNetlistFile() method
> 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.
Get the simulation netlist file
## Signature
```typescript
function getSimulationNetlistFile(
fileName?: string,
netlistType?: ESCH_SimulationNetlistType,
): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_ File name
</td></tr>
<tr><td>
netlistType
</td><td>
[ESCH\_SimulationNetlistType](../enums/ESCH_SimulationNetlistType.md)
</td><td>
_(Optional)_ Netlist type
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
Simulation netlist file data
## Remarks
You can use [SYS\_FileSystem.saveFile()](./SYS_FileSystem.md) API export the file to the local file system
## Example
```javascript
// 1. 导出 Ngspice 仿真网表('Ngspice' 对应 ESCH_SimulationNetlistType.NGSPICE)
// const simNetlistFile = await eda.sch_ManufactureData.getSimulationNetlistFile('嘉立创示例_仿真网表', 'Ngspice');
// console.log('导出文件名:', simNetlistFile?.name);
// console.log('文件大小:', simNetlistFile?.size);
// 2. 拿到文件后用 sys_FileSystem.saveFile() 保存到本地,或交给仿真工具直接使用
console.log('演示调用:getSimulationNetlistFile(文件名, 网表类型)');
```
### getsvgfile
# SCH\_ManufactureData.getSvgFile() method
> 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.
获取 SVG 文件
## Signature
```typescript
function getSvgFile(fileName?: string): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_ 文件名
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
SVG 文件数据(或压缩包)
## Remarks
ADD since EDA v3.2.183 多图页时会导出为压缩包(zip)
/ EDA v4.1.23
### placecomponentsorder
# SCH\_ManufactureData.placeComponentsOrder() method
> 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.
Component ordering
## Signature
```typescript
function placeComponentsOrder(interactive?: boolean, ignoreWarning?: boolean): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
interactive
</td><td>
boolean
</td><td>
_(Optional)_ Whether to enable interactive checking. If enabled, a popup will wait for user interaction, and the `ignoreWarning` parameter cannot be used to ignore warnings; that is, the `ignoreWarning` parameter will be ignored. If disabled, no EDA internal popup will appear after the call, and the program performs a silent check. If the ordering conditions are met, `true` will be returned and the ordering page will be opened in a new tab
</td></tr>
<tr><td>
ignoreWarning
</td><td>
boolean
</td><td>
_(Optional)_ Ignore warnings during non-interactive checking. If set to `true`<!-- -->, all check warning items will be ignored and the ordering data will be generated as much as possible; if set to `false`<!-- -->, any warning will interrupt execution and return `false`
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the ordering check passed
## Example
```javascript
// 1. 交互式下单检查:弹出检查弹窗等待确认,确认后打开购买页面
// const passed = await eda.sch_ManufactureData.placeComponentsOrder(true);
// 2. 静默检查:不弹任何弹窗,忽略警告并直接生成下单资料
// const passed = await eda.sch_ManufactureData.placeComponentsOrder(false, true);
// console.log('下单检查结果 ' + passed);
// 下单会真实打开订单页面并产生订单数据,案例中不实际执行
console.log('演示调用:placeComponentsOrder(true) 交互式检查,或 placeComponentsOrder(false, true) 静默下单');
```
### placesmtcomponentsorder
# SCH\_ManufactureData.placeSmtComponentsOrder() method
> 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.
SMT component ordering
## Signature
```typescript
function placeSmtComponentsOrder(interactive?: boolean, ignoreWarning?: boolean): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
interactive
</td><td>
boolean
</td><td>
_(Optional)_ Whether to enable interactive checking. If enabled, a popup will wait for user interaction, and the `ignoreWarning` parameter cannot be used to ignore warnings; that is, the `ignoreWarning` parameter will be ignored. If disabled, no EDA internal popup will appear after the call, and the program performs a silent check. If the ordering conditions are met, `true` will be returned and the ordering page will be opened in a new tab
</td></tr>
<tr><td>
ignoreWarning
</td><td>
boolean
</td><td>
_(Optional)_ Ignore warnings during non-interactive checking. If set to `true`<!-- -->, all check warning items will be ignored and the ordering data will be generated as much as possible; if set to `false`<!-- -->, any warning will interrupt execution and return `false`
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the ordering check passed
## Example
```javascript
// 1. 交互式下单检查:弹出检查弹窗等待确认,确认后打开下单页面
// const passed = await eda.sch_ManufactureData.placeSmtComponentsOrder(true);
// 2. 静默检查:不弹任何弹窗,忽略警告并直接生成下单资料
// const passed = await eda.sch_ManufactureData.placeSmtComponentsOrder(false, true);
// console.log('下单检查结果 ' + passed);
// 下单会真实打开订单页面并产生订单数据,案例中不实际执行
console.log('演示调用:placeSmtComponentsOrder(true) 交互式检查,或 placeSmtComponentsOrder(false, true) 静默下单');
```
### uploadbomtemplatefile
# SCH\_ManufactureData.uploadBomTemplateFile() method
> 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.
Upload a BOM template file
## Signature
```typescript
function uploadBomTemplateFile(templateFile: File, template?: string): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
templateFile
</td><td>
File
</td><td>
BOM template file
</td></tr>
<tr><td>
template
</td><td>
string
</td><td>
_(Optional)_ BOM template name. If it is `undefined`<!-- -->, the value is automatically taken from `templateFile`
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
BOM template name
## Example
```javascript
// 1. 从本地选择模板文件(弹窗需要用户交互)
// const templateFile = await eda.sys_FileSystem.openReadFileDialog('.xlsx');
// 2. 上传为新的 BOM 模板(第二参数指定模板名,不传则从文件名取)
// const templateName = await eda.sch_ManufactureData.uploadBomTemplateFile(templateFile, '嘉立创示例_模板');
// console.log('上传后的模板名 ' + templateName);
// 3. 上传后用 getBomTemplates 查看列表确认,不再需要时用 deleteBomTemplate 删除
console.log('演示流程:openReadFileDialog 读取 xlsx → uploadBomTemplateFile 上传 → getBomTemplates 确认');
```
references/classes/SCH_Net.md
# SCH\_Net class
Schematic & symbol / net class
## Signature
```typescript
class SCH_Net
```
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[getAllNets()](./SCH_Net.md)
</td><td>
</td><td>
**_(BETA)_** Get all Detailed information of the net
</td></tr>
<tr><td>
[getAllNetsName()](./SCH_Net.md)
</td><td>
</td><td>
**_(BETA)_** Get the net names of all nets
</td></tr>
<tr><td>
[getCurrentProjectAllNets()](./SCH_Net.md)
</td><td>
</td><td>
**_(BETA)_** Get the detailed information of all nets under the current project
</td></tr>
<tr><td>
[getNet(net)](./SCH_Net.md)
</td><td>
</td><td>
**_(BETA)_** Get Specify detailed information of the net
</td></tr>
</tbody></table>
---
## 方法详情
### getallnets
# SCH\_Net.getAllNets() method
> 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.
Get all Detailed information of the net
## Signature
```typescript
function getAllNets(): Promise<Array<ISCH_NetInfo>>;
```
## Returns
Promise<Array<[ISCH\_NetInfo](../interfaces/ISCH_NetInfo.md)<!-- -->>>
Detailed information of all nets
## Remarks
ADD since EDA v4.2
### getallnetsname
# SCH\_Net.getAllNetsName() method
> 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.
Get the net names of all nets
## Signature
```typescript
function getAllNetsName(): Promise<Array<string>>;
```
## Returns
Promise<Array<string>>
Net name array
## Remarks
ADD since EDA v4.2
### getcurrentprojectallnets
# SCH\_Net.getCurrentProjectAllNets() method
> 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.
Get the detailed information of all nets under the current project
## Signature
```typescript
function getCurrentProjectAllNets(): Promise<Array<ISCH_ProjectNetInfo>>;
```
## Returns
Promise<Array<[ISCH\_ProjectNetInfo](../interfaces/ISCH_ProjectNetInfo.md)<!-- -->>>
Detailed information of all nets under the current project
## Remarks
ADD since EDA v4.2
### getnet
# SCH\_Net.getNet() method
> 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.
Get Specify detailed information of the net
## Signature
```typescript
function getNet(net: string): Promise<ISCH_NetInfo | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string
</td><td>
Net name
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_NetInfo](../interfaces/ISCH_NetInfo.md) \| undefined>
Detailed information of the net, `undefined` is does not exist this net
## Remarks
ADD since EDA v4.2
references/classes/SCH_Drc.md
# SCH\_Drc class
Schematic & symbol / design rule check (DRC) class
## Signature
```typescript
class SCH_Drc
```
## Remarks
Check and set DRC rules
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[check(strict, userInterface, includeVerboseError)](./SCH_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Check DRC
</td></tr>
<tr><td>
[check(strict, userInterface, includeVerboseError)](./SCH_Drc.md)
</td><td>
</td><td>
**_(BETA)_** Check DRC
</td></tr>
</tbody></table>
---
## 方法详情
### check
# SCH\_Drc.check() method
> 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.
Check DRC
## Signature
```typescript
function check(
strict: boolean,
userInterface: boolean,
includeVerboseError: false,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
strict
</td><td>
boolean
</td><td>
Whether strict checking is enabled. The current schematic is uniformly in strict checking mode
</td></tr>
<tr><td>
userInterface
</td><td>
boolean
</td><td>
Whether to show the UI (open the bottom DRC window)
</td></tr>
<tr><td>
includeVerboseError
</td><td>
false
</td><td>
Whether to include detailed error information in the return value. If it is `true`<!-- -->, the return value will always be an array
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the DRC check passed
## Example
```javascript
// 1. 创建测试原理图并打开(DRC 作用于当前激活的原理图)
const schematicUuid = await eda.dmt_Schematic.createSchematic();
await new Promise(r => setTimeout(r, 1500));
const schInfo = await eda.dmt_Schematic.getSchematicInfo(schematicUuid);
await eda.dmt_EditorControl.openDocument(schInfo.page[0].uuid);
await new Promise(r => setTimeout(r, 1000));
// 2. 详细模式:返回全部违规项,无违规则为空数组
const violations = await eda.sch_Drc.check(true, false, true);
console.log('violationCount:', violations.length);
violations.forEach((v, i) => {
console.log(`[${i}]`, typeof v === 'string' ? v : JSON.stringify(v));
});
// 3. 布尔模式:只返回是否全部通过
const passed = await eda.sch_Drc.check(true, false, false);
console.log('allPassed:', passed);
// 4. 清理测试原理图
await new Promise(r => setTimeout(r, 1500));
await eda.dmt_Schematic.deleteSchematic(schematicUuid);
```
### check_1
# SCH\_Drc.check() method
> 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.
Check DRC
## Signature
```typescript
function check(
strict: boolean,
userInterface: boolean,
includeVerboseError: true,
): Promise<Array<ISCH_DrcError>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
strict
</td><td>
boolean
</td><td>
Whether strict checking is enabled. The current schematic is uniformly in strict checking mode
</td></tr>
<tr><td>
userInterface
</td><td>
boolean
</td><td>
Whether to show the UI (open the bottom DRC window)
</td></tr>
<tr><td>
includeVerboseError
</td><td>
true
</td><td>
Whether to include detailed error information in the return value. If it is `true`<!-- -->, the return value will always be an array. ADD since EDA v4.2
</td></tr>
</tbody></table>
## Returns
Promise<Array<[ISCH\_DrcError](../interfaces/ISCH_DrcError.md)<!-- -->>>
Detailed results of the DRC check
references/classes/SCH_PrimitiveAttribute.md
# SCH\_PrimitiveAttribute class
Schematic & symbol / property primitive class
## Signature
```typescript
class SCH_PrimitiveAttribute implements ISCH_PrimitiveAPI
```
**Implements:** [ISCH\_PrimitiveAPI](../interfaces/ISCH_PrimitiveAPI.md)
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[createNetLabel(x, y, net)](./SCH_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Create a net label
</td></tr>
<tr><td>
[get(primitiveIds)](./SCH_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Get Property
</td></tr>
<tr><td>
[get(primitiveIds)](./SCH_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Get Property
</td></tr>
<tr><td>
[getAll(parentPrimitiveId)](./SCH_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Get all Property
</td></tr>
<tr><td>
[getAllPrimitiveId(parentPrimitiveId)](./SCH_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Get all Property primitive IDs
</td></tr>
<tr><td>
[modify(primitiveId, property)](./SCH_PrimitiveAttribute.md)
</td><td>
</td><td>
**_(BETA)_** Modify Property
</td></tr>
</tbody></table>
---
## 方法详情
### createnetlabel
# SCH\_PrimitiveAttribute.createNetLabel() method
> 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.
Create a net label
## Signature
```typescript
function createNetLabel(
x: number,
y: number,
net: string,
): Promise<ISCH_PrimitiveAttribute | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
x
</td><td>
number
</td><td>
X coordinate
</td></tr>
<tr><td>
y
</td><td>
number
</td><td>
Y coordinate
</td></tr>
<tr><td>
net
</td><td>
string
</td><td>
Net name
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitiveAttribute](./ISCH_PrimitiveAttribute.md) \| undefined>
Net label attribute primitive
## Remarks
ADD since EDA v4
### get
# SCH\_PrimitiveAttribute.get() method
> 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.
Get Property
## Signature
```typescript
function get(primitiveIds: string): Promise<ISCH_PrimitiveAttribute | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string
</td><td>
Property primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitiveAttribute](./ISCH_PrimitiveAttribute.md) \| undefined>
Attribute primitive object, `undefined` indicates that the retrieval failed
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('');
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const compId = comp.getState_PrimitiveId();
// 2. 取出器件的属性图元 ID
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(compId);
// 3. 传单个 ID 字符串,返回单个属性对象
const single = await eda.sch_PrimitiveAttribute.get(attrIds[0]);
// 4. 传 ID 数组,返回属性对象数组(任一 ID 未匹配不影响其它图元的返回)
const arr = await eda.sch_PrimitiveAttribute.get([attrIds[0], attrIds[1]]);
// 5. 清理测试器件(属性图元随器件一起删除)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('single key:', single.getState_Key());
console.log('array length:', arr.length);
console.log('second key:', arr[1].getState_Key());
```
### get_1
# SCH\_PrimitiveAttribute.get() method
> 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.
Get Property
## Signature
```typescript
function get(primitiveIds: Array<string>): Promise<Array<ISCH_PrimitiveAttribute>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
Array<string>
</td><td>
Property primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<Array<[ISCH\_PrimitiveAttribute](./ISCH_PrimitiveAttribute.md)<!-- -->>>
Property primitive object; an empty array indicates that the retrieval failed
## Remarks
If multiple primitive IDs are passed in, a primitive ID that is not matched will not affect the return of other primitives; that is, fewer primitive objects than the number of primitive IDs passed in may be returned.
### getall
# SCH\_PrimitiveAttribute.getAll() method
> 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.
Get all Property
## Signature
```typescript
function getAll(parentPrimitiveId?: string): Promise<Array<ISCH_PrimitiveAttribute>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
parentPrimitiveId
</td><td>
string
</td><td>
_(Optional)_ Parent primitive ID
</td></tr>
</tbody></table>
## Returns
Promise<Array<[ISCH\_PrimitiveAttribute](./ISCH_PrimitiveAttribute.md)<!-- -->>>
Array of Property primitive objects
## Remarks
If no parent primitive ID is passed, all attribute primitives in the sheet will be obtained
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('');
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const compId = comp.getState_PrimitiveId();
// 2. 传父图元 ID,拿到该器件的全部属性
const compAttrs = await eda.sch_PrimitiveAttribute.getAll(compId);
const keys = compAttrs.map(a => a.getState_Key());
// 3. 不传参数,拿到当前图页上的所有属性图元
const allAttrs = await eda.sch_PrimitiveAttribute.getAll();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('component attr count:', compAttrs.length);
console.log('keys:', keys.join(', '));
console.log('page total attrs:', allAttrs.length);
```
### getallprimitiveid
# SCH\_PrimitiveAttribute.getAllPrimitiveId() method
> 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.
Get all Property primitive IDs
## Signature
```typescript
function getAllPrimitiveId(parentPrimitiveId?: string): Promise<Array<string>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
parentPrimitiveId
</td><td>
string
</td><td>
_(Optional)_ Parent primitive ID
</td></tr>
</tbody></table>
## Returns
Promise<Array<string>>
Array of Property primitive IDs
## Remarks
If no parent primitive ID is passed, all attribute primitives in the sheet will be obtained
## Example
```javascript
// 1. 放置一个测试器件(属性图元随器件生成,无法单独创建)
const devices = await eda.lib_Device.search('');
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const compId = comp.getState_PrimitiveId();
// 2. 传父图元 ID,只拿该器件的属性图元 ID
const compAttrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(compId);
// 3. 不传参数,拿当前图页全部属性图元 ID(含器件属性与独立网络标签等)
const allIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('component attr ids:', compAttrIds.length);
console.log('page total attr ids:', allIds.length);
console.log('component ids all in page list:', compAttrIds.every(id => allIds.includes(id)));
```
### modify
# SCH\_PrimitiveAttribute.modify() method
> 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.
Modify Property
## Signature
```typescript
function modify(
primitiveId: string | ISCH_PrimitiveAttribute,
property: {
x?: number | null;
y?: number | null;
rotation?: number | null;
color?: string | null;
fontName?: string | null;
fontSize?: number | null;
bold?: boolean | null;
italic?: boolean | null;
underLine?: boolean | null;
alignMode?: ESCH_PrimitiveTextAlignMode | null;
fillColor?: string | null;
key?: string;
value?: string;
keyVisible?: boolean | null;
valueVisible?: boolean | null;
},
): Promise<ISCH_PrimitiveAttribute | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveId
</td><td>
string \| [ISCH\_PrimitiveAttribute](./ISCH_PrimitiveAttribute.md)
</td><td>
Primitive ID
</td></tr>
<tr><td>
property
</td><td>
{ x?: number \| null; y?: number \| null; rotation?: number \| null; color?: string \| null; fontName?: string \| null; fontSize?: number \| null; bold?: boolean \| null; italic?: boolean \| null; underLine?: boolean \| null; alignMode?: [ESCH\_PrimitiveTextAlignMode](../enums/ESCH_PrimitiveTextAlignMode.md) \| null; fillColor?: string \| null; key?: string; value?: string; keyVisible?: boolean \| null; valueVisible?: boolean \| null }
</td><td>
Modify Parameter
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitiveAttribute](./ISCH_PrimitiveAttribute.md) \| undefined>
Attribute primitive object
## Example
```javascript
// 1. 放置一个测试器件并定位 Designator(编号)属性
const devices = await eda.lib_Device.search('');
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const compId = comp.getState_PrimitiveId();
const attrIds = await eda.sch_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.sch_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 2. 读取修改前的位号
const before = designator.getState_Value();
// 3. 批量修改:位号改为 C900,同时加粗显示
await eda.sch_PrimitiveAttribute.modify(designator.getState_PrimitiveId(), { value: 'C900', bold: true });
// 4. modify 返回后需要重新 get() 才能读到画布上的最新值
const refreshed = (await eda.sch_PrimitiveAttribute.get(attrIds)).find(a => a.getState_Key() === 'Designator');
// 5. 修改类保留现场,供观察修改结果
console.log('primitiveId:', designator.getState_PrimitiveId());
console.log('value:', before, '→', refreshed.getState_Value());
console.log('bold:', refreshed.getState_Bold());
```
references/classes/SCH_Netlist.md
# SCH\_Netlist class
Schematic & symbol / netlist class
## Signature
```typescript
class SCH_Netlist
```
## Remarks
Get, update the netlist
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[getNetlist(type)](./SCH_Netlist.md)
</td><td>
</td><td>
Get the netlist
</td></tr>
<tr><td>
[setNetlist(type, netlist)](./SCH_Netlist.md)
</td><td>
</td><td>
**_(BETA)_** Update the netlist
</td></tr>
</tbody></table>
---
## 方法详情
### getnetlist
# SCH\_Netlist.getNetlist() method
> Warning: This API is now obsolete.
>
> Please use [SCH\_ManufactureData.getNetlistFile()](./SCH_ManufactureData.md) instead
Get the netlist
## Signature
```typescript
function getNetlist(type?: ESYS_NetlistType): Promise<string>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
type
</td><td>
[ESYS\_NetlistType](../enums/ESYS_NetlistType.md)
</td><td>
_(Optional)_ Netlist format
</td></tr>
</tbody></table>
## Returns
Promise<string>
Netlist data
### setnetlist
# SCH\_Netlist.setNetlist() method
> 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.
Update the netlist
## Signature
```typescript
function setNetlist(type: ESYS_NetlistType | undefined, netlist: string): Promise<void>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
type
</td><td>
[ESYS\_NetlistType](../enums/ESYS_NetlistType.md) \| undefined
</td><td>
Netlist format
</td></tr>
<tr><td>
netlist
</td><td>
string
</td><td>
Netlist data
</td></tr>
</tbody></table>
## Returns
Promise<void>
## Example
```javascript
try {
// 1. 取出当前网表字符串('Protel2' 对应 ESYS_NetlistType.ALTIUM_DESIGNER)
const netlist = await eda.sch_Netlist.getNetlist('Protel2');
console.log('写回前网表长度:', netlist.length);
// 2. 原样写回当前网表(返回 void,不抛错即表示写回成功)
await eda.sch_Netlist.setNetlist('Protel2', netlist);
// 3. 重新读取,确认网表内容未被破坏
const after = await eda.sch_Netlist.getNetlist('Protel2');
console.log('写回后网表长度:', after.length);
console.log('写回前后一致:', after === netlist);
}
catch (e) {
// 原理图数据不满足网表校验(如引脚编号重复)时会抛错
console.log('当前原理图数据不满足网表校验,写回未完成');
}
```
references/classes/SCH_Primitive.md
# SCH\_Primitive class
Schematic & symbol / primitive class
## Signature
```typescript
class SCH_Primitive
```
## Remarks
Unified operations on primitives
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[getPrimitiveByPrimitiveId(id)](./SCH_Primitive.md)
</td><td>
</td><td>
Get all properties of the primitive with the specified ID
</td></tr>
<tr><td>
[getPrimitivesBBox(primitiveIds)](./SCH_Primitive.md)
</td><td>
</td><td>
**_(BETA)_** Get The BBox of the primitive
</td></tr>
<tr><td>
[getPrimitivesByPrimitiveId(ids)](./SCH_Primitive.md)
</td><td>
</td><td>
**_(BETA)_** Get all properties of the primitives with the specified IDs
</td></tr>
<tr><td>
[getPrimitiveTypeByPrimitiveId(id)](./SCH_Primitive.md)
</td><td>
</td><td>
**_(BETA)_** Get the primitive type of the primitive with the specified ID
</td></tr>
</tbody></table>
---
## 方法详情
### getprimitivebyprimitiveid
# SCH\_Primitive.getPrimitiveByPrimitiveId() method
Get all properties of the primitive with the specified ID
## Signature
```typescript
function getPrimitiveByPrimitiveId(id: string): Promise<ISCH_Primitive | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
Primitive ID
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_Primitive](../interfaces/ISCH_Primitive.md) \| undefined>
All properties of the primitive
## Example
```javascript
// 1. 创建一个测试矩形作为查询目标(SCH 坐标单位 10mil)
const rect = await eda.sch_PrimitiveRectangle.create(1000, 1000, 200, 100);
const id = rect.getState_PrimitiveId();
// 2. 用图元 ID 反查,返回该图元的完整属性对象(图元实例)
const primitive = await eda.sch_Primitive.getPrimitiveByPrimitiveId(id);
// 3. 清理测试图元(查询类需要清理)
await eda.sch_PrimitiveRectangle.delete([id]);
console.log('primitiveType:', primitive.getState_PrimitiveType());
console.log('width:', primitive.getState_Width());
console.log('height:', primitive.getState_Height());
console.log('id match:', primitive.getState_PrimitiveId() === id);
```
### getprimitivesbbox
# SCH\_Primitive.getPrimitivesBBox() method
> 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.
Get The BBox of the primitive
## Signature
```typescript
function getPrimitivesBBox(
primitiveIds: Array<string | ISCH_Primitive>,
): Promise<{ minX: number; minY: number; maxX: number; maxY: number } | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
Array<string \| [ISCH\_Primitive](../interfaces/ISCH_Primitive.md)<!-- -->>
</td><td>
Array of Primitive ID array or primitive objects
</td></tr>
</tbody></table>
## Returns
Promise<{ minX: number; minY: number; maxX: number; maxY: number } \| undefined>
The BBox of the primitive. If the primitive does not exist or has no BBox, `undefined` will be returned
## Example
```javascript
// 1. 创建两个测试矩形:左上角(1000,1000)尺寸 200x100,左上角(1600,1400)尺寸 150x80
const rect1 = await eda.sch_PrimitiveRectangle.create(1000, 1000, 200, 100);
const rect2 = await eda.sch_PrimitiveRectangle.create(1600, 1400, 150, 80);
// 2. 计算两个矩形整体的 BBox(传图元 ID 数组,也支持直接传图元对象数组)
const bbox = await eda.sch_Primitive.getPrimitivesBBox([
rect1.getState_PrimitiveId(),
rect2.getState_PrimitiveId(),
]);
// 3. 清理测试图元(查询类需要清理)
await eda.sch_PrimitiveRectangle.delete([
rect1.getState_PrimitiveId(),
rect2.getState_PrimitiveId(),
]);
console.log('minX:', bbox.minX);
console.log('minY:', bbox.minY);
console.log('maxX:', bbox.maxX);
console.log('maxY:', bbox.maxY);
```
### getprimitivesbyprimitiveid
# SCH\_Primitive.getPrimitivesByPrimitiveId() method
> 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.
Get all properties of the primitives with the specified IDs
## Signature
```typescript
function getPrimitivesByPrimitiveId(ids: Array<string>): Promise<Array<ISCH_Primitive>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
ids
</td><td>
Array<string>
</td><td>
Primitive ID array
</td></tr>
</tbody></table>
## Returns
Promise<Array<[ISCH\_Primitive](../interfaces/ISCH_Primitive.md)<!-- -->>>
All properties of all primitives
### getprimitivetypebyprimitiveid
# SCH\_Primitive.getPrimitiveTypeByPrimitiveId() method
> 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.
Get the primitive type of the primitive with the specified ID
## Signature
```typescript
function getPrimitiveTypeByPrimitiveId(id: string): Promise<ESCH_PrimitiveType | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
Primitive ID
</td></tr>
</tbody></table>
## Returns
Promise<[ESCH\_PrimitiveType](../enums/ESCH_PrimitiveType.md) \| undefined>
Primitive type
## Example
```javascript
// 1. 创建一条测试导线作为查询目标(SCH 坐标单位 10mil)
const wire = await eda.sch_PrimitiveWire.create([1000, 1000, 1400, 1000], 'SIG_A');
// 2. 用图元 ID 查询类型
const type = await eda.sch_Primitive.getPrimitiveTypeByPrimitiveId(wire.getState_PrimitiveId());
// 3. 清理测试图元(查询类需要清理)
await eda.sch_PrimitiveWire.delete([wire.getState_PrimitiveId()]);
console.log('primitiveType:', type);
```
references/classes/SCH_PrimitiveCircle.md
# SCH\_PrimitiveCircle class
Schematic & symbol / circle primitive class
## Signature
```typescript
class SCH_PrimitiveCircle implements ISCH_PrimitiveAPI
```
**Implements:** [ISCH\_PrimitiveAPI](../interfaces/ISCH_PrimitiveAPI.md)
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[create(centerX, centerY, radius, color, fillColor, lineWidth, lineType, fillStyle)](./SCH_PrimitiveCircle.md)
</td><td>
</td><td>
**_(BETA)_** Create a circle
</td></tr>
<tr><td>
[delete(primitiveIds)](./SCH_PrimitiveCircle.md)
</td><td>
</td><td>
**_(BETA)_** Delete the circle
</td></tr>
<tr><td>
[get(primitiveIds)](./SCH_PrimitiveCircle.md)
</td><td>
</td><td>
**_(BETA)_** Get the circle
</td></tr>
<tr><td>
[get(primitiveIds)](./SCH_PrimitiveCircle.md)
</td><td>
</td><td>
**_(BETA)_** Get the circle
</td></tr>
<tr><td>
[getAll()](./SCH_PrimitiveCircle.md)
</td><td>
</td><td>
**_(BETA)_** Get all circles
</td></tr>
<tr><td>
[getAllPrimitiveId()](./SCH_PrimitiveCircle.md)
</td><td>
</td><td>
**_(BETA)_** Get the primitive IDs of all circles
</td></tr>
<tr><td>
[modify(primitiveId, property)](./SCH_PrimitiveCircle.md)
</td><td>
</td><td>
**_(BETA)_** Modify the circle
</td></tr>
</tbody></table>
---
## 方法详情
### create
# SCH\_PrimitiveCircle.create() method
> 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.
Create a circle
## Signature
```typescript
function create(
centerX: number,
centerY: number,
radius: number,
color?: string | null,
fillColor?: string | null,
lineWidth?: number | null,
lineType?: ESCH_PrimitiveLineType | null,
fillStyle?: ESCH_PrimitiveFillStyle | null,
): Promise<ISCH_PrimitiveCircle | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
centerX
</td><td>
number
</td><td>
Center of the circle X
</td></tr>
<tr><td>
centerY
</td><td>
number
</td><td>
Center of the circle Y
</td></tr>
<tr><td>
radius
</td><td>
number
</td><td>
Radius
</td></tr>
<tr><td>
color
</td><td>
string \| null
</td><td>
_(Optional)_ Color, `null` indicates the default
</td></tr>
<tr><td>
fillColor
</td><td>
string \| null
</td><td>
_(Optional)_ Fill color. `none` indicates no fill, `null` indicates the default
</td></tr>
<tr><td>
lineWidth
</td><td>
number \| null
</td><td>
_(Optional)_ Line width, range `1-10`<!-- -->. `null` indicates the default
</td></tr>
<tr><td>
lineType
</td><td>
[ESCH\_PrimitiveLineType](../enums/ESCH_PrimitiveLineType.md) \| null
</td><td>
_(Optional)_ Line type. `null` indicates the default
</td></tr>
<tr><td>
fillStyle
</td><td>
[ESCH\_PrimitiveFillStyle](../enums/ESCH_PrimitiveFillStyle.md) \| null
</td><td>
_(Optional)_ Fill style, `null` indicates the default
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitiveCircle](./ISCH_PrimitiveCircle.md) \| undefined>
Circle primitive object
## Example
```javascript
// 1. 生成随机圆心坐标,避免与画布上已有的圆重合(SCH 坐标单位 10mil)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个红色虚线边框、绿色网格填充的圆
const circle = await eda.sch_PrimitiveCircle.create(
x, // 圆心 X
y, // 圆心 Y
150, // 半径
'#FF0000', // 边框颜色
'#00FF00', // 填充颜色('none' 表示无填充)
6, // 线宽(范围 1-10)
1, // 线型:1 = DASHED(虚线)
'Grid' // 填充样式('Solid'/'Grid' 等字符串枚举)
);
// 3. 创建类保留现场,不删除图元
console.log('primitiveId:', circle.getState_PrimitiveId());
console.log('primitiveType:', circle.getState_PrimitiveType());
console.log('center:', circle.getState_CenterX(), ',', circle.getState_CenterY());
console.log('radius:', circle.getState_Radius());
console.log('color:', circle.getState_Color());
console.log('fillStyle:', circle.getState_FillStyle());
```
### delete
# SCH\_PrimitiveCircle.delete() method
> 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.
Delete the circle
## Signature
```typescript
function delete(primitiveIds: string | ISCH_PrimitiveCircle | Array<string> | Array<ISCH_PrimitiveCircle>): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string \| [ISCH\_PrimitiveCircle](./ISCH_PrimitiveCircle.md) \| Array<string> \| Array<[ISCH\_PrimitiveCircle](./ISCH_PrimitiveCircle.md)<!-- -->>
</td><td>
Primitive ID of the circle or the circle primitive object
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Delete Whether the operation is successful
## Example
```javascript
// 1. 创建两个待删除的测试圆(随机坐标避免重合,SCH 坐标单位 10mil)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const circle1 = await eda.sch_PrimitiveCircle.create(x, y, 100);
const circle2 = await eda.sch_PrimitiveCircle.create(x + 400, y, 150);
// 2. 记录删除前的圆数量
const beforeCount = (await eda.sch_PrimitiveCircle.getAll()).length;
// 3. 分别以 ID 字符串和图元对象两种形式删除两个圆
const deleted1 = await eda.sch_PrimitiveCircle.delete(circle1.getState_PrimitiveId());
const deleted2 = await eda.sch_PrimitiveCircle.delete(circle2);
// 4. 删除类保留现场(图元已删除,不恢复)
const afterCount = (await eda.sch_PrimitiveCircle.getAll()).length;
console.log('deleted by id:', deleted1);
console.log('deleted by object:', deleted2);
console.log('beforeCount:', beforeCount, '→ afterCount:', afterCount);
```
### get
# SCH\_PrimitiveCircle.get() method
> 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.
Get the circle
## Signature
```typescript
function get(primitiveIds: string): Promise<ISCH_PrimitiveCircle | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string
</td><td>
Primitive ID of the circle, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitiveCircle](./ISCH_PrimitiveCircle.md) \| undefined>
Circle primitive object, `undefined` indicates that the retrieval failed
## Example
```javascript
// 1. 创建两个测试圆(随机坐标避免重合,SCH 坐标单位 10mil)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const circle1 = await eda.sch_PrimitiveCircle.create(x, y, 100);
const circle2 = await eda.sch_PrimitiveCircle.create(x + 400, y, 150);
// 2. 传单个 ID 字符串,返回单个圆对象
const single = await eda.sch_PrimitiveCircle.get(circle1.getState_PrimitiveId());
// 3. 传 ID 数组,返回圆对象数组(任一 ID 未匹配不影响其它图元的返回)
const arr = await eda.sch_PrimitiveCircle.get([circle1.getState_PrimitiveId(), circle2.getState_PrimitiveId()]);
// 4. 清理测试图元(查询类需要清理)
await eda.sch_PrimitiveCircle.delete([circle1.getState_PrimitiveId(), circle2.getState_PrimitiveId()]);
console.log('single radius:', single.getState_Radius());
console.log('array length:', arr.length);
console.log('circle2 radius:', arr[1].getState_Radius());
```
### get_1
# SCH\_PrimitiveCircle.get() method
> 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.
Get the circle
## Signature
```typescript
function get(primitiveIds: Array<string>): Promise<Array<ISCH_PrimitiveCircle>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
Array<string>
</td><td>
Primitive ID of the circle, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<Array<[ISCH\_PrimitiveCircle](./ISCH_PrimitiveCircle.md)<!-- -->>>
Circle primitive object; an empty array indicates that the retrieval failed
## Remarks
If multiple primitive IDs are passed in, a primitive ID that is not matched will not affect the return of other primitives; that is, fewer primitive objects than the number of primitive IDs passed in may be returned.
### getall
# SCH\_PrimitiveCircle.getAll() method
> 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.
Get all circles
## Signature
```typescript
function getAll(): Promise<Array<ISCH_PrimitiveCircle>>;
```
## Returns
Promise<Array<[ISCH\_PrimitiveCircle](./ISCH_PrimitiveCircle.md)<!-- -->>>
Array of circle primitive objects
## Example
```javascript
// 1. 创建一个测试圆作为查找目标(随机坐标避免重合,SCH 坐标单位 10mil)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const circle = await eda.sch_PrimitiveCircle.create(x, y, 120, '#FF0000');
const circleId = circle.getState_PrimitiveId();
// 2. 获取当前原理图页上的全部圆
const all = await eda.sch_PrimitiveCircle.getAll();
// 3. 清理测试图元(查询类需要清理)
await eda.sch_PrimitiveCircle.delete([circleId]);
console.log('total circles:', all.length);
console.log('marker circle found:', all.some(c => c.getState_PrimitiveId() === circleId));
```
### getallprimitiveid
# SCH\_PrimitiveCircle.getAllPrimitiveId() method
> 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.
Get the primitive IDs of all circles
## Signature
```typescript
function getAllPrimitiveId(): Promise<Array<string>>;
```
## Returns
Promise<Array<string>>
Array of circle primitive IDs
## Example
```javascript
// 1. 创建一个测试圆作为查找目标(随机坐标避免重合,SCH 坐标单位 10mil)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const circle = await eda.sch_PrimitiveCircle.create(x, y, 120, '#FF0000');
const circleId = circle.getState_PrimitiveId();
// 2. 获取全部圆的图元 ID
const allIds = await eda.sch_PrimitiveCircle.getAllPrimitiveId();
// 3. 清理测试图元(查询类需要清理)
await eda.sch_PrimitiveCircle.delete([circleId]);
console.log('total circle ids:', allIds.length);
console.log('marker id in list:', allIds.includes(circleId));
```
### modify
# SCH\_PrimitiveCircle.modify() method
> 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.
Modify the circle
## Signature
```typescript
function modify(
primitiveId: string | ISCH_PrimitiveCircle,
property: {
centerX?: number;
centerY?: number;
radius?: number;
color?: string | null;
fillColor?: string | null;
lineWidth?: number | null;
lineType?: ESCH_PrimitiveLineType | null;
fillStyle?: ESCH_PrimitiveFillStyle | null;
},
): Promise<ISCH_PrimitiveCircle | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveId
</td><td>
string \| [ISCH\_PrimitiveCircle](./ISCH_PrimitiveCircle.md)
</td><td>
Primitive ID
</td></tr>
<tr><td>
property
</td><td>
{ centerX?: number; centerY?: number; radius?: number; color?: string \| null; fillColor?: string \| null; lineWidth?: number \| null; lineType?: [ESCH\_PrimitiveLineType](../enums/ESCH_PrimitiveLineType.md) \| null; fillStyle?: [ESCH\_PrimitiveFillStyle](../enums/ESCH_PrimitiveFillStyle.md) \| null }
</td><td>
Modify Parameter
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitiveCircle](./ISCH_PrimitiveCircle.md) \| undefined>
Circle primitive object
## Example
```javascript
// 1. 创建待修改的测试圆(随机坐标避免与画布已有圆重合)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const circle = await eda.sch_PrimitiveCircle.create(x, y, 100, '#FF0000', 'none', 6, 1);
const circleId = circle.getState_PrimitiveId();
// 2. 读取修改前的半径、线宽与填充样式
const beforeRadius = circle.getState_Radius();
const beforeWidth = circle.getState_LineWidth();
const beforeFillStyle = circle.getState_FillStyle();
// 3. 批量修改:半径 100 → 200、线宽 6 → 10、填充样式改为实心
await eda.sch_PrimitiveCircle.modify(circleId, { radius: 200, lineWidth: 10, fillStyle: 'Solid' });
// 4. modify 返回后需要重新 get() 才能读到画布上的最新值
const refreshed = await eda.sch_PrimitiveCircle.get(circleId);
// 5. 修改类保留现场,供观察修改结果
console.log('primitiveId:', circleId);
console.log('radius:', beforeRadius, '→', refreshed.getState_Radius());
console.log('lineWidth:', beforeWidth, '→', refreshed.getState_LineWidth());
console.log('fillStyle:', beforeFillStyle, '→', refreshed.getState_FillStyle());
```
references/classes/SCH_PrimitiveArc.md
# SCH\_PrimitiveArc class
Schematic & symbol / arc primitive class
## Signature
```typescript
class SCH_PrimitiveArc implements ISCH_PrimitiveAPI
```
**Implements:** [ISCH\_PrimitiveAPI](../interfaces/ISCH_PrimitiveAPI.md)
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[create(startX, startY, referenceX, referenceY, endX, endY, color, fillColor, lineWidth, lineType)](./SCH_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Create Arc
</td></tr>
<tr><td>
[delete(primitiveIds)](./SCH_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Delete Arc
</td></tr>
<tr><td>
[get(primitiveIds)](./SCH_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Get Arc
</td></tr>
<tr><td>
[get(primitiveIds)](./SCH_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Get Arc
</td></tr>
<tr><td>
[getAll()](./SCH_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Get all Arc
</td></tr>
<tr><td>
[getAllPrimitiveId()](./SCH_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Get all Arc primitive IDs
</td></tr>
<tr><td>
[modify(primitiveId, property)](./SCH_PrimitiveArc.md)
</td><td>
</td><td>
**_(BETA)_** Modify Arc
</td></tr>
</tbody></table>
---
## 方法详情
### create
# SCH\_PrimitiveArc.create() method
> 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.
Create Arc
## Signature
```typescript
function create(
startX: number,
startY: number,
referenceX: number,
referenceY: number,
endX: number,
endY: number,
color?: string | null,
fillColor?: string | null,
lineWidth?: number | null,
lineType?: ESCH_PrimitiveLineType | null,
): Promise<ISCH_PrimitiveArc | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
startX
</td><td>
number
</td><td>
Start point X
</td></tr>
<tr><td>
startY
</td><td>
number
</td><td>
Start point Y
</td></tr>
<tr><td>
referenceX
</td><td>
number
</td><td>
Reference point X
</td></tr>
<tr><td>
referenceY
</td><td>
number
</td><td>
Reference point Y
</td></tr>
<tr><td>
endX
</td><td>
number
</td><td>
End point X
</td></tr>
<tr><td>
endY
</td><td>
number
</td><td>
End point Y
</td></tr>
<tr><td>
color
</td><td>
string \| null
</td><td>
_(Optional)_ Color, `null` indicates the default
</td></tr>
<tr><td>
fillColor
</td><td>
string \| null
</td><td>
_(Optional)_ Fill color. `none` indicates no fill, `null` indicates the default
</td></tr>
<tr><td>
lineWidth
</td><td>
number \| null
</td><td>
_(Optional)_ Line width, range `1-10`<!-- -->. `null` indicates the default
</td></tr>
<tr><td>
lineType
</td><td>
[ESCH\_PrimitiveLineType](../enums/ESCH_PrimitiveLineType.md) \| null
</td><td>
_(Optional)_ Line type. `null` indicates the default
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitiveArc](./ISCH_PrimitiveArc.md) \| undefined>
Arc primitive object
## Example
```javascript
// 1. 生成随机起点坐标,避免与画布上已有的圆弧重合(SCH 坐标单位 10mil)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一段红色虚线圆弧:起点(x, y),参考点(x+100, y+100),终点(x+200, y),线宽 6
const arc = await eda.sch_PrimitiveArc.create(x, y, x + 100, y + 100, x + 200, y, '#FF0000', null, 6, 1);
// 3. 创建类保留现场,不删除图元
console.log('primitiveId:', arc.getState_PrimitiveId());
console.log('primitiveType:', arc.getState_PrimitiveType());
console.log('startX:', arc.getState_StartX(), 'startY:', arc.getState_StartY());
console.log('referenceX:', arc.getState_ReferenceX(), 'referenceY:', arc.getState_ReferenceY());
console.log('endX:', arc.getState_EndX(), 'endY:', arc.getState_EndY());
console.log('color:', arc.getState_Color());
console.log('lineWidth:', arc.getState_LineWidth());
```
### delete
# SCH\_PrimitiveArc.delete() method
> 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.
Delete Arc
## Signature
```typescript
function delete(primitiveIds: string | ISCH_PrimitiveArc | Array<string> | Array<ISCH_PrimitiveArc>): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string \| [ISCH\_PrimitiveArc](./ISCH_PrimitiveArc.md) \| Array<string> \| Array<[ISCH\_PrimitiveArc](./ISCH_PrimitiveArc.md)<!-- -->>
</td><td>
Arc primitive ID or Arc primitive object
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Delete Whether the operation is successful
## Example
```javascript
// 1. 创建两段待删除的测试圆弧(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const arc1 = await eda.sch_PrimitiveArc.create(x, y, x + 100, y + 100, x + 200, y);
const arc2 = await eda.sch_PrimitiveArc.create(x, y + 200, x + 100, y + 300, x + 200, y + 200);
// 2. 记录删除前的圆弧数量
const beforeCount = (await eda.sch_PrimitiveArc.getAll()).length;
// 3. 以 ID 数组形式批量删除两段圆弧
const deleted = await eda.sch_PrimitiveArc.delete([arc1.getState_PrimitiveId(), arc2.getState_PrimitiveId()]);
// 4. 删除类保留现场(图元已删除,不恢复)
const afterCount = (await eda.sch_PrimitiveArc.getAll()).length;
console.log('deleted:', deleted);
console.log('beforeCount:', beforeCount, '→ afterCount:', afterCount);
```
### get
# SCH\_PrimitiveArc.get() method
> 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.
Get Arc
## Signature
```typescript
function get(primitiveIds: string): Promise<ISCH_PrimitiveArc | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string
</td><td>
Arc primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitiveArc](./ISCH_PrimitiveArc.md) \| undefined>
Arc primitive object, `undefined` indicates that the retrieval failed
## Example
```javascript
// 1. 创建两段测试圆弧(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const arc1 = await eda.sch_PrimitiveArc.create(x, y, x + 100, y + 100, x + 200, y);
const arc2 = await eda.sch_PrimitiveArc.create(x, y + 200, x + 100, y + 300, x + 200, y + 200);
// 2. 传单个 ID 字符串,返回单个圆弧对象
const single = await eda.sch_PrimitiveArc.get(arc1.getState_PrimitiveId());
// 3. 传 ID 数组,返回圆弧对象数组(任一 ID 未匹配不影响其它图元的返回)
const arr = await eda.sch_PrimitiveArc.get([arc1.getState_PrimitiveId(), arc2.getState_PrimitiveId()]);
// 4. 清理测试图元(查询类需要清理)
await eda.sch_PrimitiveArc.delete([arc1.getState_PrimitiveId(), arc2.getState_PrimitiveId()]);
console.log('single startX:', single.getState_StartX());
console.log('array length:', arr.length);
console.log('arc2 endX:', arr[1].getState_EndX());
```
### get_1
# SCH\_PrimitiveArc.get() method
> 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.
Get Arc
## Signature
```typescript
function get(primitiveIds: Array<string>): Promise<Array<ISCH_PrimitiveArc>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
Array<string>
</td><td>
Arc primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<Array<[ISCH\_PrimitiveArc](./ISCH_PrimitiveArc.md)<!-- -->>>
Arc primitive object; an empty array indicates that the retrieval failed
## Remarks
If multiple primitive IDs are passed in, a primitive ID that is not matched will not affect the return of other primitives; that is, fewer primitive objects than the number of primitive IDs passed in may be returned.
### getall
# SCH\_PrimitiveArc.getAll() method
> 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.
Get all Arc
## Signature
```typescript
function getAll(): Promise<Array<ISCH_PrimitiveArc>>;
```
## Returns
Promise<Array<[ISCH\_PrimitiveArc](./ISCH_PrimitiveArc.md)<!-- -->>>
Array of Arc primitive objects
## Example
```javascript
// 1. 创建一段测试圆弧作为查找目标(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const arc = await eda.sch_PrimitiveArc.create(x, y, x + 100, y + 100, x + 200, y);
const arcId = arc.getState_PrimitiveId();
// 2. 获取当前原理图页上的全部圆弧
const all = await eda.sch_PrimitiveArc.getAll();
// 3. 清理测试图元(查询类需要清理)
await eda.sch_PrimitiveArc.delete([arcId]);
console.log('total arcs:', all.length);
console.log('marker arc found:', all.some(a => a.getState_PrimitiveId() === arcId));
```
### getallprimitiveid
# SCH\_PrimitiveArc.getAllPrimitiveId() method
> 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.
Get all Arc primitive IDs
## Signature
```typescript
function getAllPrimitiveId(): Promise<Array<string>>;
```
## Returns
Promise<Array<string>>
Array of Arc primitive IDs
## Example
```javascript
// 1. 创建一段测试圆弧作为查找目标(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const arc = await eda.sch_PrimitiveArc.create(x, y, x + 100, y + 100, x + 200, y);
const arcId = arc.getState_PrimitiveId();
// 2. 获取全部圆弧的图元 ID
const allIds = await eda.sch_PrimitiveArc.getAllPrimitiveId();
// 3. 清理测试图元(查询类需要清理)
await eda.sch_PrimitiveArc.delete([arcId]);
console.log('total arc ids:', allIds.length);
console.log('marker id in list:', allIds.includes(arcId));
```
### modify
# SCH\_PrimitiveArc.modify() method
> 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.
Modify Arc
## Signature
```typescript
function modify(
primitiveId: string | ISCH_PrimitiveArc,
property: {
startX?: number;
startY?: number;
referenceX?: number;
referenceY?: number;
endX?: number;
endY?: number;
color?: string | null;
fillColor?: string | null;
lineWidth?: number | null;
lineType?: ESCH_PrimitiveLineType | null;
},
): Promise<ISCH_PrimitiveArc | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveId
</td><td>
string \| [ISCH\_PrimitiveArc](./ISCH_PrimitiveArc.md)
</td><td>
Primitive ID
</td></tr>
<tr><td>
property
</td><td>
{ startX?: number; startY?: number; referenceX?: number; referenceY?: number; endX?: number; endY?: number; color?: string \| null; fillColor?: string \| null; lineWidth?: number \| null; lineType?: [ESCH\_PrimitiveLineType](../enums/ESCH_PrimitiveLineType.md) \| null }
</td><td>
Modify Parameter
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitiveArc](./ISCH_PrimitiveArc.md) \| undefined>
Arc primitive object
## Example
```javascript
// 1. 创建待修改的测试圆弧(随机坐标避免与画布已有圆弧重合)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const arc = await eda.sch_PrimitiveArc.create(x, y, x + 100, y + 100, x + 200, y, '#FF0000', null, 6, 1);
const arcId = arc.getState_PrimitiveId();
// 2. 读取修改前的线宽与颜色
const beforeWidth = arc.getState_LineWidth();
const beforeColor = arc.getState_Color();
// 3. 批量修改:终点右移、线宽 6 → 10、颜色改为绿色
await eda.sch_PrimitiveArc.modify(arcId, { endX: x + 400, lineWidth: 10, color: '#00AA00' });
// 4. modify 返回后需要重新 get() 才能读到画布上的最新值
const refreshed = await eda.sch_PrimitiveArc.get(arcId);
// 5. 修改类保留现场,供观察修改结果
console.log('primitiveId:', arcId);
console.log('lineWidth:', beforeWidth, '→', refreshed.getState_LineWidth());
console.log('color:', beforeColor, '→', refreshed.getState_Color());
console.log('endX:', x + 200, '→', refreshed.getState_EndX());
```
references/classes/SCH_PrimitiveComponent.md
# SCH\_PrimitiveComponent class
Schematic & symbol / device primitive class
## Signature
```typescript
class SCH_PrimitiveComponent implements ISCH_PrimitiveAPI
```
**Implements:** [ISCH\_PrimitiveAPI](../interfaces/ISCH_PrimitiveAPI.md)
## Remarks
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[create(component, x, y, subPartName, rotation, mirror, addIntoBom, addIntoPcb)](./SCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Create Device
</td></tr>
<tr><td>
[createCbbSymbol(cbbSymbol, x, y, rotation, mirror)](./SCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Create Reuse block symbol
</td></tr>
<tr><td>
[createNetFlag(identification, net, x, y, rotation, mirror)](./SCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Create Net flag
</td></tr>
<tr><td>
[createNetPort(direction, net, x, y, rotation, mirror)](./SCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Create Net port
</td></tr>
<tr><td>
[createShortCircuitFlag(x, y, rotation, mirror)](./SCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Create a short circuit flag
</td></tr>
<tr><td>
[delete(primitiveIds)](./SCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Delete Device
</td></tr>
<tr><td>
[get(primitiveIds)](./SCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Get Device
</td></tr>
<tr><td>
[get(primitiveIds)](./SCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Get Device
</td></tr>
<tr><td>
[getAll(componentType, allSchematicPages)](./SCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Get all Device
</td></tr>
<tr><td>
[getAllPinsByPrimitiveId(primitiveId)](./SCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Get all pins associated with the device
</td></tr>
<tr><td>
[getAllPrimitiveId(componentType, allSchematicPages)](./SCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Get all Device primitive IDs
</td></tr>
<tr><td>
[getAllPropertyNames()](./SCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Get The set of all property names of all devices
</td></tr>
<tr><td>
[modify(primitiveId, property)](./SCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Modify Device
</td></tr>
<tr><td>
[placeCbbSchematicPage(cbbSchematicPage, x, y, props)](./SCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Place reuse block schematic sheet
</td></tr>
<tr><td>
[placeComponentWithMouse(component, subPartName)](./SCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Place with the mouse device
</td></tr>
<tr><td>
[placeSymbolWithMouse(symbol, subPartName, properties)](./SCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Place with the mouse symbol
</td></tr>
<tr><td>
[setNetFlagComponentUuid\_AnalogGround(component)](./SCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the device UUID associated with the AnalogGround net flag in the extension API
</td></tr>
<tr><td>
[setNetFlagComponentUuid\_Ground(component)](./SCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the device UUID associated with the Ground net flag in the extension API
</td></tr>
<tr><td>
[setNetFlagComponentUuid\_Power(component)](./SCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the device UUID associated with the Power net flag in the extension API
</td></tr>
<tr><td>
[setNetFlagComponentUuid\_ProtectGround(component)](./SCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the device UUID associated with the ProtectGround net flag in the extension API
</td></tr>
<tr><td>
[setNetPortComponentUuid\_BI(component)](./SCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the device UUID associated with the BI net port in the extension API
</td></tr>
<tr><td>
[setNetPortComponentUuid\_IN(component)](./SCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the device UUID associated with the IN net port in the extension API
</td></tr>
<tr><td>
[setNetPortComponentUuid\_OUT(component)](./SCH_PrimitiveComponent.md)
</td><td>
</td><td>
**_(BETA)_** Set the device UUID associated with the OUT net port in the extension API
</td></tr>
</tbody></table>
---
## 方法详情
### create
# SCH\_PrimitiveComponent.create() method
> 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.
Create Device
## Signature
```typescript
function create(
component:
| { libraryType?: ELIB_LibraryType.DEVICE; libraryUuid: string; uuid: string }
| ILIB_DeviceItem
| ILIB_DeviceSearchItem
| { libraryType: ELIB_LibraryType.SYMBOL; libraryUuid: string; uuid: string }
| ILIB_SymbolItem
| ILIB_SymbolSearchItem,
x: number,
y: number,
subPartName?: string,
rotation?: number,
mirror?: boolean,
addIntoBom?: boolean,
addIntoPcb?: boolean,
): Promise<ISCH_PrimitiveComponent | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
component
</td><td>
{ libraryType?: [ELIB\_LibraryType.DEVICE](../enums/ELIB_LibraryType.md)<!-- -->; libraryUuid: string; uuid: string } \| [ILIB\_DeviceItem](../interfaces/ILIB_DeviceItem.md) \| [ILIB\_DeviceSearchItem](../interfaces/ILIB_DeviceSearchItem.md) \| { libraryType: [ELIB\_LibraryType.SYMBOL](../enums/ELIB_LibraryType.md)<!-- -->; libraryUuid: string; uuid: string } \| [ILIB\_SymbolItem](../interfaces/ILIB_SymbolItem.md) \| [ILIB\_SymbolSearchItem](../interfaces/ILIB_SymbolSearchItem.md)
</td><td>
Associate library device
</td></tr>
<tr><td>
x
</td><td>
number
</td><td>
X coordinate
</td></tr>
<tr><td>
y
</td><td>
number
</td><td>
Y coordinate
</td></tr>
<tr><td>
subPartName
</td><td>
string
</td><td>
_(Optional)_ Sub-part name
</td></tr>
<tr><td>
rotation
</td><td>
number
</td><td>
_(Optional)_ Rotation angle
</td></tr>
<tr><td>
mirror
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is mirrored
</td></tr>
<tr><td>
addIntoBom
</td><td>
boolean
</td><td>
_(Optional)_ Whether Add to BOM
</td></tr>
<tr><td>
addIntoPcb
</td><td>
boolean
</td><td>
_(Optional)_ Whether Transfer to PCB
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitiveComponent](./ISCH_PrimitiveComponent.md) \| undefined>
Device primitive object
## Example
```javascript
// 1. 从系统库搜索器件,随机坐标避免与画布已有器件重合(SCH 坐标单位 10mil)
const devices = await eda.lib_Device.search('');
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建器件:搜索结果直接作为关联库器件传入,加入 BOM 并转到 PCB
const comp = await eda.sch_PrimitiveComponent.create(
devices[0], // 关联库器件
x, // 坐标 X
y, // 坐标 Y
undefined, // 子部件名称(多子部件器件才需要指定)
0, // 旋转角度
false, // 是否镜像
true, // 是否加入 BOM
true // 是否转到 PCB
);
// 3. 创建类保留现场,供在画布上观察摆放结果
console.log('primitiveId:', comp.getState_PrimitiveId());
console.log('designator:', comp.getState_Designator());
console.log('position:', comp.getState_X(), ',', comp.getState_Y());
console.log('addIntoBom:', comp.getState_AddIntoBom());
```
### createcbbsymbol
# SCH\_PrimitiveComponent.createCbbSymbol() method
> 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.
Create Reuse block symbol
## Signature
```typescript
function createCbbSymbol(
cbbSymbol: { libraryUuid: string; cbbUuid: string; uuid?: string },
x: number,
y: number,
rotation?: number,
mirror?: boolean,
): Promise<ISCH_PrimitiveCbbSymbolComponent | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
cbbSymbol
</td><td>
\{ libraryUuid: string; cbbUuid: string; uuid?: string \}
</td><td>
Associated library reuse block symbol. `libraryUuid` is the UUID of the library where the CBB project is located, `cbbUuid` is the UUID of the CBB project, and `uuid` is the UUID of the symbol in the CBB project
</td></tr>
<tr><td>
x
</td><td>
number
</td><td>
X coordinate
</td></tr>
<tr><td>
y
</td><td>
number
</td><td>
Y coordinate
</td></tr>
<tr><td>
rotation
</td><td>
number
</td><td>
_(Optional)_ Rotation angle
</td></tr>
<tr><td>
mirror
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is mirrored
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitiveCbbSymbolComponent](./ISCH_PrimitiveCbbSymbolComponent.md) \| undefined>
Reuse block symbol primitive object
## Example
```javascript
// 1. 从系统库搜索可用的复用模块
const cbbList = await eda.lib_Cbb.search('');
const cbb = cbbList[0];
// 2. 随机坐标避免与画布已有图元重合(SCH 坐标单位 10mil)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 3. 创建复用模块符号(cbbUuid 传模块工程 UUID,符号 uuid 可省略由模块默认提供)
const symbol = await eda.sch_PrimitiveComponent.createCbbSymbol(
{
libraryUuid: cbb.libraryUuid, // CBB 工程所在库的 UUID
cbbUuid: cbb.uuid // CBB 工程的 UUID
},
x, // 坐标 X
y, // 坐标 Y
0, // 旋转角度
false // 是否镜像
);
// 4. 创建类保留现场,供在画布上观察模块符号
console.log('primitiveId:', symbol.getState_PrimitiveId());
console.log('primitiveType:', symbol.getState_PrimitiveType());
console.log('position:', symbol.getState_X(), ',', symbol.getState_Y());
```
### createnetflag
# SCH\_PrimitiveComponent.createNetFlag() method
> 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.
Create Net flag
## Signature
```typescript
function createNetFlag(
identification: 'Power' | 'Ground' | 'AnalogGround' | 'ProtectGround',
net: string,
x: number,
y: number,
rotation?: number,
mirror?: boolean,
): Promise<ISCH_PrimitiveComponent | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
identification
</td><td>
'Power' \| 'Ground' \| 'AnalogGround' \| 'ProtectGround'
</td><td>
Identification type
</td></tr>
<tr><td>
net
</td><td>
string
</td><td>
Net name
</td></tr>
<tr><td>
x
</td><td>
number
</td><td>
X coordinate
</td></tr>
<tr><td>
y
</td><td>
number
</td><td>
Y coordinate
</td></tr>
<tr><td>
rotation
</td><td>
number
</td><td>
_(Optional)_ Rotation angle
</td></tr>
<tr><td>
mirror
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is mirrored
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitiveComponent](./ISCH_PrimitiveComponent.md) \| undefined>
Device primitive object
## Example
```javascript
// 1. 随机坐标避免与画布已有图元重合(SCH 坐标单位 10mil)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建 Power 类型的网络标识,网络名为 VCC
const flag = await eda.sch_PrimitiveComponent.createNetFlag(
'Power', // 标识类型:'Power' / 'Ground' / 'AnalogGround' / 'ProtectGround'
'嘉立创示例_VCC', // 网络名称
x, // 坐标 X
y, // 坐标 Y
0, // 旋转角度
false // 是否镜像
);
// 3. 创建类保留现场,供在画布上观察标识样式
console.log('primitiveId:', flag.getState_PrimitiveId());
console.log('net:', flag.getState_Net());
console.log('componentType:', flag.getState_ComponentType());
```
### createnetport
# SCH\_PrimitiveComponent.createNetPort() method
> 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.
Create Net port
## Signature
```typescript
function createNetPort(
direction: 'IN' | 'OUT' | 'BI',
net: string,
x: number,
y: number,
rotation?: number,
mirror?: boolean,
): Promise<ISCH_PrimitiveComponent | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
direction
</td><td>
'IN' \| 'OUT' \| 'BI'
</td><td>
Port direction
</td></tr>
<tr><td>
net
</td><td>
string
</td><td>
Net name
</td></tr>
<tr><td>
x
</td><td>
number
</td><td>
X coordinate
</td></tr>
<tr><td>
y
</td><td>
number
</td><td>
Y coordinate
</td></tr>
<tr><td>
rotation
</td><td>
number
</td><td>
_(Optional)_ Rotation angle
</td></tr>
<tr><td>
mirror
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is mirrored
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitiveComponent](./ISCH_PrimitiveComponent.md) \| undefined>
Device primitive object
## Example
```javascript
// 1. 随机坐标避免与画布已有图元重合(SCH 坐标单位 10mil)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建输入方向的端口,网络名为 SIG_IN
const port = await eda.sch_PrimitiveComponent.createNetPort(
'IN', // 端口方向:'IN' / 'OUT' / 'BI'
'嘉立创示例_SIG', // 网络名称
x, // 坐标 X
y, // 坐标 Y
0, // 旋转角度
false // 是否镜像
);
// 3. 创建类保留现场,供在画布上观察端口样式
console.log('primitiveId:', port.getState_PrimitiveId());
console.log('net:', port.getState_Net());
console.log('componentType:', port.getState_ComponentType());
```
### createshortcircuitflag
# SCH\_PrimitiveComponent.createShortCircuitFlag() method
> 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.
Create a short circuit flag
## Signature
```typescript
function createShortCircuitFlag(
x: number,
y: number,
rotation?: number,
mirror?: boolean,
): Promise<ISCH_PrimitiveComponent | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
x
</td><td>
number
</td><td>
X coordinate
</td></tr>
<tr><td>
y
</td><td>
number
</td><td>
Y coordinate
</td></tr>
<tr><td>
rotation
</td><td>
number
</td><td>
_(Optional)_ Rotation angle
</td></tr>
<tr><td>
mirror
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is mirrored
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitiveComponent](./ISCH_PrimitiveComponent.md) \| undefined>
Device primitive object
## Example
```javascript
// 1. 随机坐标避免与画布已有图元重合(SCH 坐标单位 10mil)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建短接标识(无网络名参数,仅位置与姿态)
const flag = await eda.sch_PrimitiveComponent.createShortCircuitFlag(
x, // 坐标 X
y, // 坐标 Y
0, // 旋转角度
false // 是否镜像
);
// 3. 创建类保留现场,供在画布上观察标识样式
console.log('primitiveId:', flag.getState_PrimitiveId());
console.log('componentType:', flag.getState_ComponentType());
console.log('position:', flag.getState_X(), ',', flag.getState_Y());
```
### delete
# SCH\_PrimitiveComponent.delete() method
> 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.
Delete Device
## Signature
```typescript
function delete(primitiveIds: string | ISCH_PrimitiveComponent | Array<string> | Array<ISCH_PrimitiveComponent>): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string \| [ISCH\_PrimitiveComponent](./ISCH_PrimitiveComponent.md) \| Array<string> \| Array<[ISCH\_PrimitiveComponent](./ISCH_PrimitiveComponent.md)<!-- -->>
</td><td>
Device primitive ID or Device primitive object
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Delete Whether the operation is successful
## Example
```javascript
// 1. 创建两个待删除的测试器件(随机坐标避免重合,SCH 坐标单位 10mil)
const devices = await eda.lib_Device.search('');
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const comp1 = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const comp2 = await eda.sch_PrimitiveComponent.create(devices[0], x + 400, y);
// 2. 记录删除前的器件数量
const beforeCount = (await eda.sch_PrimitiveComponent.getAll()).length;
// 3. 分别以 ID 字符串和图元对象两种形式删除两个器件
const deleted1 = await eda.sch_PrimitiveComponent.delete(comp1.getState_PrimitiveId());
const deleted2 = await eda.sch_PrimitiveComponent.delete(comp2);
// 4. 删除类保留现场(图元已删除,不恢复)
const afterCount = (await eda.sch_PrimitiveComponent.getAll()).length;
console.log('deleted by id:', deleted1);
console.log('deleted by object:', deleted2);
console.log('beforeCount:', beforeCount, '→ afterCount:', afterCount);
```
### get
# SCH\_PrimitiveComponent.get() method
> 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.
Get Device
## Signature
```typescript
function get(primitiveIds: string): Promise<ISCH_PrimitiveComponent | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string
</td><td>
Device primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitiveComponent](./ISCH_PrimitiveComponent.md) \| undefined>
Device primitive object, `undefined` indicates that the retrieval failed
## Example
```javascript
// 1. 创建两个测试器件(随机坐标避免重合,SCH 坐标单位 10mil)
const devices = await eda.lib_Device.search('');
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const comp1 = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const comp2 = await eda.sch_PrimitiveComponent.create(devices[0], x + 400, y);
// 2. 传单个 ID 字符串,返回单个器件对象
const single = await eda.sch_PrimitiveComponent.get(comp1.getState_PrimitiveId());
// 3. 传 ID 数组,返回器件对象数组(任一 ID 未匹配不影响其它图元的返回)
const arr = await eda.sch_PrimitiveComponent.get([
comp1.getState_PrimitiveId(),
comp2.getState_PrimitiveId()
]);
// 4. 清理测试图元(查询类需要清理)
await eda.sch_PrimitiveComponent.delete([comp1.getState_PrimitiveId(), comp2.getState_PrimitiveId()]);
console.log('single designator:', single.getState_Designator());
console.log('array length:', arr.length);
console.log('comp2 designator:', arr[1].getState_Designator());
```
### get_1
# SCH\_PrimitiveComponent.get() method
> 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.
Get Device
## Signature
```typescript
function get(primitiveIds: Array<string>): Promise<Array<ISCH_PrimitiveComponent>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
Array<string>
</td><td>
Device primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<Array<[ISCH\_PrimitiveComponent](./ISCH_PrimitiveComponent.md)<!-- -->>>
Device primitive object; an empty array indicates that the retrieval failed
## Remarks
If multiple primitive IDs are passed in, a primitive ID that is not matched will not affect the return of other primitives; that is, fewer primitive objects than the number of primitive IDs passed in may be returned.
### getall
# SCH\_PrimitiveComponent.getAll() method
> 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.
Get all Device
## Signature
```typescript
function getAll(
componentType?: ESCH_PrimitiveComponentType,
allSchematicPages?: boolean,
): Promise<Array<ISCH_PrimitiveComponent>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
componentType
</td><td>
[ESCH\_PrimitiveComponentType](../enums/ESCH_PrimitiveComponentType.md)
</td><td>
_(Optional)_ Device type
</td></tr>
<tr><td>
allSchematicPages
</td><td>
boolean
</td><td>
_(Optional)_ Whether to get the devices of all schematic sheets
</td></tr>
</tbody></table>
## Returns
Promise<Array<[ISCH\_PrimitiveComponent](./ISCH_PrimitiveComponent.md)<!-- -->>>
Array of Device primitive objects
## Example
```javascript
// 1. 创建一个普通元件和一个网络标识作为查找目标(随机坐标避免重合)
const devices = await eda.lib_Device.search('');
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const flag = await eda.sch_PrimitiveComponent.createNetFlag('Power', '嘉立创示例_VCC', x + 600, y);
const compId = comp.getState_PrimitiveId();
// 2. 不传参数,取当前图页全部器件
const all = await eda.sch_PrimitiveComponent.getAll();
// 3. 传入类型 'netflag' 只取网络标识(ESCH_PrimitiveComponentType 值)
const flags = await eda.sch_PrimitiveComponent.getAll('netflag');
// 4. 清理测试图元(查询类需要清理)
await eda.sch_PrimitiveComponent.delete([compId, flag.getState_PrimitiveId()]);
console.log('total components:', all.length);
console.log('marker comp found:', all.some(c => c.getState_PrimitiveId() === compId));
console.log('netflag count:', flags.length);
```
### getallpinsbyprimitiveid
# SCH\_PrimitiveComponent.getAllPinsByPrimitiveId() method
> 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.
Get all pins associated with the device
## Signature
```typescript
function getAllPinsByPrimitiveId(
primitiveId: string,
): Promise<Array<ISCH_PrimitiveComponentPin> | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveId
</td><td>
string
</td><td>
Device primitive ID
</td></tr>
</tbody></table>
## Returns
Promise<Array<[ISCH\_PrimitiveComponentPin](./ISCH_PrimitiveComponentPin.md)<!-- -->> \| undefined>
Device pin primitive array
## Example
```javascript
// 1. 创建一个带引脚的测试器件(随机坐标避免重合,SCH 坐标单位 10mil)
const devices = await eda.lib_Device.search('');
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const compId = comp.getState_PrimitiveId();
// 2. 按图元 ID 取出该器件的全部引脚(返回纯数据对象,字段直接可读)
const pins = await eda.sch_PrimitiveComponent.getAllPinsByPrimitiveId(compId);
// 3. 清理测试图元(查询类需要清理)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('pin count:', pins.length);
console.log('first pin number:', pins[0].pinNumber);
console.log('first pin type:', pins[0].pinType);
```
### getallprimitiveid
# SCH\_PrimitiveComponent.getAllPrimitiveId() method
> 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.
Get all Device primitive IDs
## Signature
```typescript
function getAllPrimitiveId(
componentType?: ESCH_PrimitiveComponentType,
allSchematicPages?: boolean,
): Promise<Array<string>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
componentType
</td><td>
[ESCH\_PrimitiveComponentType](../enums/ESCH_PrimitiveComponentType.md)
</td><td>
_(Optional)_ Device type
</td></tr>
<tr><td>
allSchematicPages
</td><td>
boolean
</td><td>
_(Optional)_ Whether to get the devices of all schematic sheets
</td></tr>
</tbody></table>
## Returns
Promise<Array<string>>
Array of Device primitive IDs
## Example
```javascript
// 1. 创建一个网络标识作为查找目标(随机坐标避免重合,SCH 坐标单位 10mil)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const flag = await eda.sch_PrimitiveComponent.createNetFlag('Power', '嘉立创示例_VCC', x, y);
const flagId = flag.getState_PrimitiveId();
// 2. 不传参数,取当前图页全部器件的图元 ID
const allIds = await eda.sch_PrimitiveComponent.getAllPrimitiveId();
// 3. 传入类型 'netflag' 只取网络标识的图元 ID
const flagIds = await eda.sch_PrimitiveComponent.getAllPrimitiveId('netflag');
// 4. 清理测试图元(查询类需要清理)
await eda.sch_PrimitiveComponent.delete([flagId]);
console.log('total ids:', allIds.length);
console.log('netflag ids:', flagIds.length);
console.log('marker flag found:', flagIds.includes(flagId));
```
### getallpropertynames
# SCH\_PrimitiveComponent.getAllPropertyNames() method
> 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.
Get The set of all property names of all devices
## Signature
```typescript
function getAllPropertyNames(): Promise<Array<string>>;
```
## Returns
Promise<Array<string>>
The set of all property names of all devices
## Example
```javascript
// 1. 创建一个测试器件,保证画布上有带属性的器件(随机坐标避免重合)
const devices = await eda.lib_Device.search('');
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
// 2. 取所有器件出现过的属性名称集合
const names = await eda.sch_PrimitiveComponent.getAllPropertyNames();
// 3. 清理测试图元(查询类需要清理)
await eda.sch_PrimitiveComponent.delete([comp.getState_PrimitiveId()]);
console.log('property name count:', names.length);
console.log('names:', names.join(', '));
```
### modify
# SCH\_PrimitiveComponent.modify() method
> 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.
Modify Device
## Signature
```typescript
function modify(
primitiveId: string | ISCH_PrimitiveComponent,
property: {
x?: number;
y?: number;
rotation?: number;
mirror?: boolean;
addIntoBom?: boolean;
addIntoPcb?: boolean;
designator?: string | null;
name?: string | null;
uniqueId?: string | null;
manufacturer?: string | null;
manufacturerId?: string | null;
supplier?: string | null;
supplierId?: string | null;
otherProperty?: Record<string, string | number | boolean>;
},
): Promise<ISCH_PrimitiveComponent | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveId
</td><td>
string \| [ISCH\_PrimitiveComponent](./ISCH_PrimitiveComponent.md)
</td><td>
Primitive ID
</td></tr>
<tr><td>
property
</td><td>
{ x?: number; y?: number; rotation?: number; mirror?: boolean; addIntoBom?: boolean; addIntoPcb?: boolean; designator?: string \| null; name?: string \| null; uniqueId?: string \| null; manufacturer?: string \| null; manufacturerId?: string \| null; supplier?: string \| null; supplierId?: string \| null; otherProperty?: Record<string, string \| number \| boolean> }
</td><td>
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitiveComponent](./ISCH_PrimitiveComponent.md) \| undefined>
Device primitive object
## Remarks
This method can only be used for modification when the device type is [COMPONENT](../enums/ESCH_PrimitiveComponentType.md)
## Example
```javascript
// 1. 创建待修改的测试器件(随机坐标避免与画布已有器件重合)
const devices = await eda.lib_Device.search('');
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const compId = comp.getState_PrimitiveId();
// 2. 读取修改前的位号、旋转与 X 坐标
const beforeDesignator = comp.getState_Designator();
const beforeRotation = comp.getState_Rotation();
const beforeX = comp.getState_X();
// 3. 批量修改:右移 400(约 101.6mm)、旋转 90 度、位号改为 U100
await eda.sch_PrimitiveComponent.modify(compId, {
x: x + 400,
rotation: 90,
designator: '嘉立创示例_U100'
});
// 4. modify 返回后需要重新 get() 才能读到画布上的最新值
const refreshed = await eda.sch_PrimitiveComponent.get(compId);
// 5. 修改类保留现场,供观察修改结果
console.log('primitiveId:', compId);
console.log('designator:', beforeDesignator, '→', refreshed.getState_Designator());
console.log('rotation:', beforeRotation, '→', refreshed.getState_Rotation());
console.log('x:', beforeX, '→', refreshed.getState_X());
```
### placecbbschematicpage
# SCH\_PrimitiveComponent.placeCbbSchematicPage() method
> 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.
Place reuse block schematic sheet
## Signature
```typescript
function placeCbbSchematicPage(
cbbSchematicPage: { libraryUuid: string; cbbUuid: string; uuid: string },
x: number,
y: number,
props?: { reimportWhenNameRepeated?: boolean },
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
cbbSchematicPage
</td><td>
\{ libraryUuid: string; cbbUuid: string; uuid: string \}
</td><td>
Reuse block schematic sheet. `libraryUuid` is the UUID of the library where the CBB project is located, `cbbUuid` is the UUID of the CBB project, and `uuid` is the UUID of the schematic sheet in the CBB project
</td></tr>
<tr><td>
x
</td><td>
number
</td><td>
X coordinate
</td></tr>
<tr><td>
y
</td><td>
number
</td><td>
Y coordinate
</td></tr>
<tr><td>
props
</td><td>
\{ reimportWhenNameRepeated?: boolean \}
</td><td>
_(Optional)_ 放置参数:`reimportWhenNameRepeated` 当存在重名模块时是否重新引入,默认 `true` ADD since EDA v4.2
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Place whether the operation is successful
### placecomponentwithmouse
# SCH\_PrimitiveComponent.placeComponentWithMouse() method
> 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.
Place with the mouse device
## Signature
```typescript
function placeComponentWithMouse(
component: { libraryUuid: string; uuid: string } | ILIB_DeviceItem | ILIB_DeviceSearchItem,
subPartName?: string,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
component
</td><td>
{ libraryUuid: string; uuid: string } \| [ILIB\_DeviceItem](../interfaces/ILIB_DeviceItem.md) \| [ILIB\_DeviceSearchItem](../interfaces/ILIB_DeviceSearchItem.md)
</td><td>
Associate library device
</td></tr>
<tr><td>
subPartName
</td><td>
string
</td><td>
_(Optional)_ Sub-part name
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the device was found
## Remarks
This API simulates clicking the placement button on the front end. The specified device will be bound to the current mouse and placed on the canvas when the user clicks subsequently
The return timing of this API does not wait for the user's placement operation. Once the device is bound to the mouse, this API will immediately return `true`
### placesymbolwithmouse
# SCH\_PrimitiveComponent.placeSymbolWithMouse() method
> 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.
Place with the mouse symbol
## Signature
```typescript
function placeSymbolWithMouse(
symbol: { libraryUuid: string; uuid: string } | ILIB_SymbolItem | ILIB_SymbolSearchItem,
subPartName?: string,
properties?: Record<string, boolean | number | string | undefined>,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
symbol
</td><td>
{ libraryUuid: string; uuid: string } \| [ILIB\_SymbolItem](../interfaces/ILIB_SymbolItem.md) \| [ILIB\_SymbolSearchItem](../interfaces/ILIB_SymbolSearchItem.md)
</td><td>
Associate library symbol
</td></tr>
<tr><td>
subPartName
</td><td>
string
</td><td>
_(Optional)_ Sub-part name
</td></tr>
<tr><td>
properties
</td><td>
Record<string, boolean \| number \| string \| undefined>
</td><td>
_(Optional)_ Device property
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the symbol was found
## Remarks
This API simulates clicking the placement button on the front end. The specified symbol will be bound to the current mouse and placed on the canvas when the user clicks subsequently
The return timing of this API does not wait for the user's placement operation. Once the symbol is bound to the mouse, this API will immediately return `true` ADD since API v0.2.26
### setnetflagcomponentuuid_analogground
# SCH\_PrimitiveComponent.setNetFlagComponentUuid\_AnalogGround() method
> 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.
Set the device UUID associated with the AnalogGround net flag in the extension API
## Signature
```typescript
function setNetFlagComponentUuid_AnalogGround(
component: { libraryUuid: string; uuid: string } | ILIB_DeviceItem | ILIB_DeviceSearchItem,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
component
</td><td>
{ libraryUuid: string; uuid: string } \| [ILIB\_DeviceItem](../interfaces/ILIB_DeviceItem.md) \| [ILIB\_DeviceSearchItem](../interfaces/ILIB_DeviceSearchItem.md)
</td><td>
Associate library device
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
### setnetflagcomponentuuid_ground
# SCH\_PrimitiveComponent.setNetFlagComponentUuid\_Ground() method
> 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.
Set the device UUID associated with the Ground net flag in the extension API
## Signature
```typescript
function setNetFlagComponentUuid_Ground(
component: { libraryUuid: string; uuid: string } | ILIB_DeviceItem | ILIB_DeviceSearchItem,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
component
</td><td>
{ libraryUuid: string; uuid: string } \| [ILIB\_DeviceItem](../interfaces/ILIB_DeviceItem.md) \| [ILIB\_DeviceSearchItem](../interfaces/ILIB_DeviceSearchItem.md)
</td><td>
Associate library device
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
### setnetflagcomponentuuid_power
# SCH\_PrimitiveComponent.setNetFlagComponentUuid\_Power() method
> 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.
Set the device UUID associated with the Power net flag in the extension API
## Signature
```typescript
function setNetFlagComponentUuid_Power(
component: { libraryUuid: string; uuid: string } | ILIB_DeviceItem | ILIB_DeviceSearchItem,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
component
</td><td>
{ libraryUuid: string; uuid: string } \| [ILIB\_DeviceItem](../interfaces/ILIB_DeviceItem.md) \| [ILIB\_DeviceSearchItem](../interfaces/ILIB_DeviceSearchItem.md)
</td><td>
Associate library device
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
### setnetflagcomponentuuid_protectground
# SCH\_PrimitiveComponent.setNetFlagComponentUuid\_ProtectGround() method
> 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.
Set the device UUID associated with the ProtectGround net flag in the extension API
## Signature
```typescript
function setNetFlagComponentUuid_ProtectGround(
component: { libraryUuid: string; uuid: string } | ILIB_DeviceItem | ILIB_DeviceSearchItem,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
component
</td><td>
{ libraryUuid: string; uuid: string } \| [ILIB\_DeviceItem](../interfaces/ILIB_DeviceItem.md) \| [ILIB\_DeviceSearchItem](../interfaces/ILIB_DeviceSearchItem.md)
</td><td>
Associate library device
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
### setnetportcomponentuuid_bi
# SCH\_PrimitiveComponent.setNetPortComponentUuid\_BI() method
> 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.
Set the device UUID associated with the BI net port in the extension API
## Signature
```typescript
function setNetPortComponentUuid_BI(
component: { libraryUuid: string; uuid: string } | ILIB_DeviceItem | ILIB_DeviceSearchItem,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
component
</td><td>
{ libraryUuid: string; uuid: string } \| [ILIB\_DeviceItem](../interfaces/ILIB_DeviceItem.md) \| [ILIB\_DeviceSearchItem](../interfaces/ILIB_DeviceSearchItem.md)
</td><td>
Associate library device
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
### setnetportcomponentuuid_in
# SCH\_PrimitiveComponent.setNetPortComponentUuid\_IN() method
> 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.
Set the device UUID associated with the IN net port in the extension API
## Signature
```typescript
function setNetPortComponentUuid_IN(
component: { libraryUuid: string; uuid: string } | ILIB_DeviceItem | ILIB_DeviceSearchItem,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
component
</td><td>
{ libraryUuid: string; uuid: string } \| [ILIB\_DeviceItem](../interfaces/ILIB_DeviceItem.md) \| [ILIB\_DeviceSearchItem](../interfaces/ILIB_DeviceSearchItem.md)
</td><td>
Associate library device
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
### setnetportcomponentuuid_out
# SCH\_PrimitiveComponent.setNetPortComponentUuid\_OUT() method
> 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.
Set the device UUID associated with the OUT net port in the extension API
## Signature
```typescript
function setNetPortComponentUuid_OUT(
component: { libraryUuid: string; uuid: string } | ILIB_DeviceItem | ILIB_DeviceSearchItem,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
component
</td><td>
{ libraryUuid: string; uuid: string } \| [ILIB\_DeviceItem](../interfaces/ILIB_DeviceItem.md) \| [ILIB\_DeviceSearchItem](../interfaces/ILIB_DeviceSearchItem.md)
</td><td>
Associate library device
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
references/classes/SCH_PrimitiveText.md
# SCH\_PrimitiveText class
Schematic & symbol / text primitive class
## Signature
```typescript
class SCH_PrimitiveText implements ISCH_PrimitiveAPI
```
**Implements:** [ISCH\_PrimitiveAPI](../interfaces/ISCH_PrimitiveAPI.md)
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[create(x, y, content, rotation, textColor, fontName, fontSize, bold, italic, underLine, alignMode)](./SCH_PrimitiveText.md)
</td><td>
</td><td>
**_(BETA)_** Create Text
</td></tr>
<tr><td>
[delete(primitiveIds)](./SCH_PrimitiveText.md)
</td><td>
</td><td>
**_(BETA)_** Delete Text
</td></tr>
<tr><td>
[get(primitiveIds)](./SCH_PrimitiveText.md)
</td><td>
</td><td>
**_(BETA)_** Get Text
</td></tr>
<tr><td>
[get(primitiveIds)](./SCH_PrimitiveText.md)
</td><td>
</td><td>
**_(BETA)_** Get Text
</td></tr>
<tr><td>
[getAll()](./SCH_PrimitiveText.md)
</td><td>
</td><td>
**_(BETA)_** Get all Text
</td></tr>
<tr><td>
[getAllPrimitiveId()](./SCH_PrimitiveText.md)
</td><td>
</td><td>
**_(BETA)_** Get all Text primitive IDs
</td></tr>
<tr><td>
[modify(primitiveId, property)](./SCH_PrimitiveText.md)
</td><td>
</td><td>
**_(BETA)_** Modify Text
</td></tr>
</tbody></table>
---
## 方法详情
### create
# SCH\_PrimitiveText.create() method
> 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.
Create Text
## Signature
```typescript
function create(
x: number,
y: number,
content: string,
rotation?: number,
textColor?: string | null,
fontName?: string | null,
fontSize?: number | null,
bold?: boolean,
italic?: boolean,
underLine?: boolean,
alignMode?: ESCH_PrimitiveTextAlignMode,
): Promise<ISCH_PrimitiveText | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
x
</td><td>
number
</td><td>
X coordinate
</td></tr>
<tr><td>
y
</td><td>
number
</td><td>
Y coordinate
</td></tr>
<tr><td>
content
</td><td>
string
</td><td>
Text content
</td></tr>
<tr><td>
rotation
</td><td>
number
</td><td>
_(Optional)_ Rotation angle. Options: `0` `90` `180` `270`
</td></tr>
<tr><td>
textColor
</td><td>
string \| null
</td><td>
_(Optional)_ Text color, `null` indicates the default
</td></tr>
<tr><td>
fontName
</td><td>
string \| null
</td><td>
_(Optional)_ Font name, `null` indicates the default
</td></tr>
<tr><td>
fontSize
</td><td>
number \| null
</td><td>
_(Optional)_ Font size. `null` indicates the default
</td></tr>
<tr><td>
bold
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is bold
</td></tr>
<tr><td>
italic
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is italic
</td></tr>
<tr><td>
underLine
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is underlined
</td></tr>
<tr><td>
alignMode
</td><td>
[ESCH\_PrimitiveTextAlignMode](../enums/ESCH_PrimitiveTextAlignMode.md)
</td><td>
_(Optional)_ Alignment mode
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitiveText](./ISCH_PrimitiveText.md) \| undefined>
Text primitive object
## Example
```javascript
// 1. 生成随机坐标,避免与画布上已有的文本重合(SCH 坐标单位 10mil)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一段完整样式的文本:旋转 90 度、红色、Arial 字体、字号 20、加粗、带下划线、居中对齐(CENTER = 5)
const text = await eda.sch_PrimitiveText.create(
x,
y,
'嘉立创示例_设计说明',
90,
'#FF0000',
'Arial',
20,
true,
false,
true,
5
);
// 3. 创建类保留现场,不删除图元;读回各属性确认样式已生效
console.log('primitiveId:', text.getState_PrimitiveId());
console.log('primitiveType:', text.getState_PrimitiveType());
console.log('position:', text.getState_X(), text.getState_Y());
console.log('content:', text.getState_Content());
console.log('rotation:', text.getState_Rotation());
console.log('textColor:', text.getState_TextColor());
console.log('fontName:', text.getState_FontName());
console.log('fontSize:', text.getState_FontSize());
console.log('bold:', text.getState_Bold());
console.log('italic:', text.getState_Italic());
console.log('underLine:', text.getState_UnderLine());
console.log('alignMode:', text.getState_AlignMode());
```
### delete
# SCH\_PrimitiveText.delete() method
> 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.
Delete Text
## Signature
```typescript
function delete(primitiveIds: string | ISCH_PrimitiveText | Array<string> | Array<ISCH_PrimitiveText>): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string \| [ISCH\_PrimitiveText](./ISCH_PrimitiveText.md) \| Array<string> \| Array<[ISCH\_PrimitiveText](./ISCH_PrimitiveText.md)<!-- -->>
</td><td>
Text primitive ID or Text primitive object
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Delete Whether the operation is successful
## Example
```javascript
// 1. 创建两个待删除的测试文本(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const text1 = await eda.sch_PrimitiveText.create(x, y, '嘉立创示例_待删除A');
const text2 = await eda.sch_PrimitiveText.create(x, y + 300, '嘉立创示例_待删除B');
// 2. 记录删除前的文本数量
const beforeCount = (await eda.sch_PrimitiveText.getAll()).length;
// 3. 分别以 ID 字符串和图元对象两种形式删除两个文本
const deleted1 = await eda.sch_PrimitiveText.delete(text1.getState_PrimitiveId());
const deleted2 = await eda.sch_PrimitiveText.delete(text2);
// 4. 删除类保留现场(图元已删除,不恢复)
const afterCount = (await eda.sch_PrimitiveText.getAll()).length;
console.log('deleted by id:', deleted1);
console.log('deleted by object:', deleted2);
console.log('beforeCount:', beforeCount, '→ afterCount:', afterCount);
```
### get
# SCH\_PrimitiveText.get() method
> 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.
Get Text
## Signature
```typescript
function get(primitiveIds: string): Promise<ISCH_PrimitiveText | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string
</td><td>
Text primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitiveText](./ISCH_PrimitiveText.md) \| undefined>
Text primitive object, `undefined` indicates that the retrieval failed
## Example
```javascript
// 1. 在画布空白处创建两个测试文本(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const text1 = await eda.sch_PrimitiveText.create(x, y, '嘉立创示例_文本A', 0, '#FF0000');
const text2 = await eda.sch_PrimitiveText.create(x, y + 300, '嘉立创示例_文本B', 0, '#0000FF');
const id1 = text1.getState_PrimitiveId();
const id2 = text2.getState_PrimitiveId();
// 2. 传单个 ID 字符串,返回单个文本对象
const single = await eda.sch_PrimitiveText.get(id1);
// 3. 传 ID 数组,返回文本对象数组(任一 ID 未匹配不影响其它图元的返回)
const arr = await eda.sch_PrimitiveText.get([id1, id2]);
// 4. 清理测试文本(查询类需要清理)
await eda.sch_PrimitiveText.delete([id1, id2]);
console.log('single content:', single.getState_Content());
console.log('single color:', single.getState_TextColor());
console.log('array length:', arr.length);
console.log('textB content:', arr[1].getState_Content());
console.log('textB color:', arr[1].getState_TextColor());
```
### get_1
# SCH\_PrimitiveText.get() method
> 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.
Get Text
## Signature
```typescript
function get(primitiveIds: Array<string>): Promise<Array<ISCH_PrimitiveText>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
Array<string>
</td><td>
Text primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<Array<[ISCH\_PrimitiveText](./ISCH_PrimitiveText.md)<!-- -->>>
Text primitive object; an empty array indicates that the retrieval failed
## Remarks
If multiple primitive IDs are passed in, a primitive ID that is not matched will not affect the return of other primitives; that is, fewer primitive objects than the number of primitive IDs passed in may be returned.
### getall
# SCH\_PrimitiveText.getAll() method
> 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.
Get all Text
## Signature
```typescript
function getAll(): Promise<Array<ISCH_PrimitiveText>>;
```
## Returns
Promise<Array<[ISCH\_PrimitiveText](./ISCH_PrimitiveText.md)<!-- -->>>
Array of Text primitive objects
## Example
```javascript
// 1. 创建一个测试文本作为查找目标(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const text = await eda.sch_PrimitiveText.create(x, y, '嘉立创示例_查找目标', 0, '#FF0000');
const textId = text.getState_PrimitiveId();
// 2. 获取当前原理图页的全部文本
const all = await eda.sch_PrimitiveText.getAll();
// 3. 清理测试文本(查询类需要清理)
await eda.sch_PrimitiveText.delete([textId]);
console.log('total texts:', all.length);
console.log('marker text found:', all.some(t => t.getState_PrimitiveId() === textId));
console.log('marker content:', all.find(t => t.getState_PrimitiveId() === textId).getState_Content());
console.log('marker color:', all.find(t => t.getState_PrimitiveId() === textId).getState_TextColor());
```
### getallprimitiveid
# SCH\_PrimitiveText.getAllPrimitiveId() method
> 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.
Get all Text primitive IDs
## Signature
```typescript
function getAllPrimitiveId(): Promise<Array<string>>;
```
## Returns
Promise<Array<string>>
Array of Text primitive IDs
## Example
```javascript
// 1. 创建一个测试文本作为查找目标(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const text = await eda.sch_PrimitiveText.create(x, y, '嘉立创示例_ID查找目标');
const textId = text.getState_PrimitiveId();
// 2. 获取全部文本的图元 ID
const allIds = await eda.sch_PrimitiveText.getAllPrimitiveId();
// 3. 清理测试文本(查询类需要清理)
await eda.sch_PrimitiveText.delete([textId]);
console.log('total text ids:', allIds.length);
console.log('marker id in list:', allIds.includes(textId));
```
### modify
# SCH\_PrimitiveText.modify() method
> 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.
Modify Text
## Signature
```typescript
function modify(
primitiveId: string | ISCH_PrimitiveText,
property: {
x?: number;
y?: number;
content?: string;
rotation?: number;
textColor?: string | null;
fontName?: string | null;
fontSize?: number | null;
bold?: boolean;
italic?: boolean;
underLine?: boolean;
alignMode?: ESCH_PrimitiveTextAlignMode;
},
): Promise<ISCH_PrimitiveText | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveId
</td><td>
string \| [ISCH\_PrimitiveText](./ISCH_PrimitiveText.md)
</td><td>
Primitive ID
</td></tr>
<tr><td>
property
</td><td>
{ x?: number; y?: number; content?: string; rotation?: number; textColor?: string \| null; fontName?: string \| null; fontSize?: number \| null; bold?: boolean; italic?: boolean; underLine?: boolean; alignMode?: [ESCH\_PrimitiveTextAlignMode](../enums/ESCH_PrimitiveTextAlignMode.md) }
</td><td>
Modify Parameter
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitiveText](./ISCH_PrimitiveText.md) \| undefined>
Text primitive object
## Example
```javascript
// 1. 创建待修改的测试文本:默认样式(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const text = await eda.sch_PrimitiveText.create(x, y, '嘉立创示例_原始文本');
const textId = text.getState_PrimitiveId();
// 2. 记录修改前的内容、颜色与字号
const beforeContent = text.getState_Content();
const beforeColor = text.getState_TextColor();
const beforeFontSize = text.getState_FontSize();
// 3. 批量修改:平移位置、内容更新、颜色改蓝、字号 20、加粗
await eda.sch_PrimitiveText.modify(textId, {
x: x + 200,
y: y + 100,
content: '嘉立创示例_修改后的文本',
textColor: '#0000FF',
fontSize: 20,
bold: true,
});
// 4. modify 返回后需要重新 get() 才能读到画布上的最新值
const refreshed = await eda.sch_PrimitiveText.get(textId);
// 5. 修改类保留现场,供观察修改结果
console.log('primitiveId:', textId);
console.log('content:', beforeContent, '→', refreshed.getState_Content());
console.log('textColor:', beforeColor, '→', refreshed.getState_TextColor());
console.log('fontSize:', beforeFontSize, '→', refreshed.getState_FontSize());
console.log('bold:', refreshed.getState_Bold());
console.log('position:', x, y, '→', refreshed.getState_X(), refreshed.getState_Y());
```
references/classes/SCH_PrimitiveObject.md
# SCH\_PrimitiveObject class
Schematic & symbol / binary embedded object primitive class
## Signature
```typescript
class SCH_PrimitiveObject implements ISCH_PrimitiveAPI
```
**Implements:** [ISCH\_PrimitiveAPI](../interfaces/ISCH_PrimitiveAPI.md)
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[create(content, startX, startY, width, height, rotation, mirror, fileName)](./SCH_PrimitiveObject.md)
</td><td>
</td><td>
**_(BETA)_** Create Binary embedded object
</td></tr>
<tr><td>
[delete(primitiveIds)](./SCH_PrimitiveObject.md)
</td><td>
</td><td>
**_(BETA)_** Delete Binary embedded object
</td></tr>
<tr><td>
[get(primitiveIds)](./SCH_PrimitiveObject.md)
</td><td>
</td><td>
**_(BETA)_** Get Binary embedded object
</td></tr>
<tr><td>
[get(primitiveIds)](./SCH_PrimitiveObject.md)
</td><td>
</td><td>
**_(BETA)_** Get Binary embedded object
</td></tr>
<tr><td>
[getAll()](./SCH_PrimitiveObject.md)
</td><td>
</td><td>
**_(BETA)_** Get all Binary embedded object
</td></tr>
<tr><td>
[getAllPrimitiveId()](./SCH_PrimitiveObject.md)
</td><td>
</td><td>
**_(BETA)_** Get all Binary embedded object primitive IDs
</td></tr>
<tr><td>
[modify(primitiveId, property)](./SCH_PrimitiveObject.md)
</td><td>
</td><td>
**_(BETA)_** Modify Binary embedded object
</td></tr>
</tbody></table>
---
## 方法详情
### create
# SCH\_PrimitiveObject.create() method
> 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.
Create Binary embedded object
## Signature
```typescript
function create(
content: File | string,
startX: number,
startY: number,
width?: number,
height?: number,
rotation?: number,
mirror?: boolean,
fileName?: string,
): Promise<ISCH_PrimitiveObject | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
content
</td><td>
File \| string
</td><td>
Object content
</td></tr>
<tr><td>
startX
</td><td>
number
</td><td>
Start point coordinates X
</td></tr>
<tr><td>
startY
</td><td>
number
</td><td>
Start point coordinates Y
</td></tr>
<tr><td>
width
</td><td>
number
</td><td>
_(Optional)_ Width
</td></tr>
<tr><td>
height
</td><td>
number
</td><td>
_(Optional)_ Height
</td></tr>
<tr><td>
rotation
</td><td>
number
</td><td>
_(Optional)_ Rotation angle
</td></tr>
<tr><td>
mirror
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is mirrored
</td></tr>
<tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_ File name
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitiveObject](./ISCH_PrimitiveObject.md) \| undefined>
Binary embedded object primitive object
## Example
```javascript
// 1. 生成随机放置坐标,避免与画布上已有的内嵌对象重合(SCH 坐标单位 10mil)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 准备 4x4 像素 PNG 的 data URI(content 实测也接受裸 base64,data URI 带格式头更易读)
const png = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
// 3. 在起点(x, y)放置图片:宽 400、高 300,不旋转、不镜像,文件名 logo.png
const obj = await eda.sch_PrimitiveObject.create(png, x, y, 400, 300, 0, false, 'logo.png');
// 4. 创建类保留现场,不删除图元(getState_Content 返回数据内容,用长度表示)
console.log('primitiveId:', obj.getState_PrimitiveId());
console.log('primitiveType:', obj.getState_PrimitiveType());
console.log('startX:', obj.getState_StartX(), 'startY:', obj.getState_StartY());
console.log('width:', obj.getState_Width(), 'height:', obj.getState_Height());
console.log('fileName:', obj.getState_FileName());
console.log('content length:', obj.getState_Content().length);
```
### delete
# SCH\_PrimitiveObject.delete() method
> 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.
Delete Binary embedded object
## Signature
```typescript
function delete(primitiveIds: string | ISCH_PrimitiveObject | Array<string> | Array<ISCH_PrimitiveObject>): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string \| [ISCH\_PrimitiveObject](./ISCH_PrimitiveObject.md) \| Array<string> \| Array<[ISCH\_PrimitiveObject](./ISCH_PrimitiveObject.md)<!-- -->>
</td><td>
Binary embedded object primitive ID or Binary embedded object primitive object
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Delete Whether the operation is successful
## Example
```javascript
// 1. 创建两个待删除的测试对象(随机坐标避免重合,SCH 坐标单位 10mil)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const png = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj1 = await eda.sch_PrimitiveObject.create(png, x, y, 400, 300, 0, false, 'del1.png');
const obj2 = await eda.sch_PrimitiveObject.create(png, x + 400, y, 200, 150, 0, false, 'del2.png');
// 2. 记录删除前的对象数量
const beforeCount = (await eda.sch_PrimitiveObject.getAll()).length;
// 3. 分别以 ID 字符串和图元对象两种形式删除两个对象
const deleted1 = await eda.sch_PrimitiveObject.delete(obj1.getState_PrimitiveId());
const deleted2 = await eda.sch_PrimitiveObject.delete(obj2);
// 4. 删除类保留现场(图元已删除,不恢复)
const afterCount = (await eda.sch_PrimitiveObject.getAll()).length;
console.log('deleted by id:', deleted1);
console.log('deleted by object:', deleted2);
console.log('beforeCount:', beforeCount, '→ afterCount:', afterCount);
```
### get
# SCH\_PrimitiveObject.get() method
> 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.
Get Binary embedded object
## Signature
```typescript
function get(primitiveIds: string): Promise<ISCH_PrimitiveObject | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string
</td><td>
Binary embedded object primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitiveObject](./ISCH_PrimitiveObject.md) \| undefined>
Binary embedded object primitive object, `undefined` indicates that the retrieval failed
## Example
```javascript
// 1. 创建两个测试对象(随机坐标避免重合,SCH 坐标单位 10mil)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const png = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj1 = await eda.sch_PrimitiveObject.create(png, x, y, 400, 300, 0, false, 'get1.png');
const obj2 = await eda.sch_PrimitiveObject.create(png, x + 400, y, 200, 150, 0, false, 'get2.png');
// 2. 传单个 ID 字符串,返回单个内嵌对象
const single = await eda.sch_PrimitiveObject.get(obj1.getState_PrimitiveId());
// 3. 传 ID 数组,返回内嵌对象数组(任一 ID 未匹配不影响其它图元的返回)
const arr = await eda.sch_PrimitiveObject.get([obj1.getState_PrimitiveId(), obj2.getState_PrimitiveId()]);
// 4. 清理测试图元(查询类需要清理)
await eda.sch_PrimitiveObject.delete([obj1.getState_PrimitiveId(), obj2.getState_PrimitiveId()]);
console.log('single type:', single.getState_PrimitiveType());
console.log('single width:', single.getState_Width());
console.log('array length:', arr.length);
console.log('obj2 fileName:', arr[1].getState_FileName());
```
### get_1
# SCH\_PrimitiveObject.get() method
> 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.
Get Binary embedded object
## Signature
```typescript
function get(primitiveIds: Array<string>): Promise<Array<ISCH_PrimitiveObject>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
Array<string>
</td><td>
Binary embedded object primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<Array<[ISCH\_PrimitiveObject](./ISCH_PrimitiveObject.md)<!-- -->>>
Binary embedded object primitive object; an empty array indicates that the retrieval failed
## Remarks
If multiple primitive IDs are passed in, a primitive ID that is not matched will not affect the return of other primitives; that is, fewer primitive objects than the number of primitive IDs passed in may be returned.
### getall
# SCH\_PrimitiveObject.getAll() method
> 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.
Get all Binary embedded object
## Signature
```typescript
function getAll(): Promise<Array<ISCH_PrimitiveObject>>;
```
## Returns
Promise<Array<[ISCH\_PrimitiveObject](./ISCH_PrimitiveObject.md)<!-- -->>>
Array of Binary embedded object primitive objects
## Example
```javascript
// 1. 创建一个测试对象作为查找目标(随机坐标避免重合,SCH 坐标单位 10mil)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const png = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj = await eda.sch_PrimitiveObject.create(png, x, y, 300, 200, 0, false, 'find.png');
const objId = obj.getState_PrimitiveId();
// 2. 获取当前原理图页上的全部内嵌对象
const all = await eda.sch_PrimitiveObject.getAll();
// 3. 清理测试图元(查询类需要清理)
await eda.sch_PrimitiveObject.delete([objId]);
console.log('total objects:', all.length);
console.log('marker object found:', all.some(o => o.getState_PrimitiveId() === objId));
console.log('marker fileName:', all.find(o => o.getState_PrimitiveId() === objId).getState_FileName());
```
### getallprimitiveid
# SCH\_PrimitiveObject.getAllPrimitiveId() method
> 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.
Get all Binary embedded object primitive IDs
## Signature
```typescript
function getAllPrimitiveId(): Promise<Array<string>>;
```
## Returns
Promise<Array<string>>
Array of Binary embedded object primitive IDs
## Example
```javascript
// 1. 创建一个测试对象作为查找目标(随机坐标避免重合,SCH 坐标单位 10mil)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const png = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj = await eda.sch_PrimitiveObject.create(png, x, y, 300, 200, 0, false, 'ids.png');
const objId = obj.getState_PrimitiveId();
// 2. 获取全部内嵌对象的图元 ID
const allIds = await eda.sch_PrimitiveObject.getAllPrimitiveId();
// 3. 清理测试图元(查询类需要清理)
await eda.sch_PrimitiveObject.delete([objId]);
console.log('total object ids:', allIds.length);
console.log('marker id in list:', allIds.includes(objId));
```
### modify
# SCH\_PrimitiveObject.modify() method
> 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.
Modify Binary embedded object
## Signature
```typescript
function modify(
primitiveId: string | ISCH_PrimitiveObject,
property: {
content?: File | string;
startX?: number;
startY?: number;
width?: number;
height?: number;
rotation?: number;
mirror?: boolean;
fileName?: string;
},
): Promise<ISCH_PrimitiveObject | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveId
</td><td>
string \| [ISCH\_PrimitiveObject](./ISCH_PrimitiveObject.md)
</td><td>
Primitive ID
</td></tr>
<tr><td>
property
</td><td>
\{ content?: File \| string; startX?: number; startY?: number; width?: number; height?: number; rotation?: number; mirror?: boolean; fileName?: string \}
</td><td>
Modify Parameter
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitiveObject](./ISCH_PrimitiveObject.md) \| undefined>
Binary embedded object primitive object, `undefined` indicates that the modification failed
## Example
```javascript
// 1. 创建待修改的测试对象(随机坐标避免重合,SCH 坐标单位 10mil)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const png = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAEElEQVR4nGP4z8AARwzEcQCukw/x0F8jngAAAABJRU5ErkJggg==';
const obj = await eda.sch_PrimitiveObject.create(png, x, y, 400, 300, 0, false, 'edit.png');
const objId = obj.getState_PrimitiveId();
// 2. 读取修改前的宽与旋转角
const beforeWidth = obj.getState_Width();
const beforeRotation = obj.getState_Rotation();
// 3. 批量修改:宽 400 → 500,旋转 0 → 90 度
await eda.sch_PrimitiveObject.modify(objId, { width: 500, rotation: 90 });
// 4. modify 返回后需要重新 get() 才能读到画布上的最新值
const refreshed = await eda.sch_PrimitiveObject.get(objId);
// 5. 修改类保留现场,供观察修改结果
console.log('primitiveId:', objId);
console.log('width:', beforeWidth, '→', refreshed.getState_Width());
console.log('rotation:', beforeRotation, '→', refreshed.getState_Rotation());
```
references/classes/SCH_PrimitiveBus.md
# SCH\_PrimitiveBus class
Schematic & symbol / bus primitive class
## Signature
```typescript
class SCH_PrimitiveBus implements ISCH_PrimitiveAPI
```
**Implements:** [ISCH\_PrimitiveAPI](../interfaces/ISCH_PrimitiveAPI.md)
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[create(busName, line, color, lineWidth, lineType)](./SCH_PrimitiveBus.md)
</td><td>
</td><td>
**_(BETA)_** Create a bus
</td></tr>
<tr><td>
[delete(primitiveIds)](./SCH_PrimitiveBus.md)
</td><td>
</td><td>
**_(BETA)_** Delete the bus
</td></tr>
<tr><td>
[get(primitiveIds)](./SCH_PrimitiveBus.md)
</td><td>
</td><td>
**_(BETA)_** Get the bus
</td></tr>
<tr><td>
[get(primitiveIds)](./SCH_PrimitiveBus.md)
</td><td>
</td><td>
**_(BETA)_** Get the bus
</td></tr>
<tr><td>
[getAll()](./SCH_PrimitiveBus.md)
</td><td>
</td><td>
**_(BETA)_** Get all buses
</td></tr>
<tr><td>
[getAllPrimitiveId()](./SCH_PrimitiveBus.md)
</td><td>
</td><td>
**_(BETA)_** Get the primitive IDs of all buses
</td></tr>
<tr><td>
[modify(primitiveId, property)](./SCH_PrimitiveBus.md)
</td><td>
</td><td>
**_(BETA)_** Modify the bus
</td></tr>
</tbody></table>
---
## 方法详情
### create
# SCH\_PrimitiveBus.create() method
> 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.
Create a bus
## Signature
```typescript
function create(
busName: string,
line: Array<number> | Array<Array<number>>,
color?: string | null,
lineWidth?: number | null,
lineType?: ESCH_PrimitiveLineType | null,
): Promise<ISCH_PrimitiveBus | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
busName
</td><td>
string
</td><td>
Bus name
</td></tr>
<tr><td>
line
</td><td>
Array<number> \| Array<Array<number>>
</td><td>
Polyline coordinate group. Each segment is a continuous line described by `[x1, y1, x2, y2, x3, y3]`<!-- -->. If the polylines have no connection to each other, the creation will fail. Examples for the type `Array<Array<number>>`<!-- -->: 1. `[[], [0, 0, 0, 1]]` - segment 1 has no path, invalid; 2. `[[1], [0, 0, 0, 1]]` - segment 1 only has x, missing y, invalid; 3. `[[0, 0, -1, 0], [0, 0, 1, 1]]` - segment 1 is a horizontal line but segment 2 is a diagonal line, invalid; 4. `[[0, 0, -1, 0, -1, 1], [0, 1, 1, 1]]` - the two segments have no connection, invalid; 5. `[[1, 1], [1, 2, 2, 2]]` - segment 1 has only one point, ignored; segment 2 is a horizontal segment, and the final path keeps only segment 2, valid; 6. `[[1, 1], [1, 2]]` - segment 1 has only one point, ignored; segment 2 is also ignored, and the final path is empty, invalid
</td></tr>
<tr><td>
color
</td><td>
string \| null
</td><td>
_(Optional)_ Bus color. `null` indicates the default
</td></tr>
<tr><td>
lineWidth
</td><td>
number \| null
</td><td>
_(Optional)_ Line width, range `1-10`<!-- -->. `null` indicates the default
</td></tr>
<tr><td>
lineType
</td><td>
[ESCH\_PrimitiveLineType](../enums/ESCH_PrimitiveLineType.md) \| null
</td><td>
_(Optional)_ Line type. `null` indicates the default
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitiveBus](./ISCH_PrimitiveBus.md) \| undefined>
Bus primitive object
## Example
```javascript
// 1. 生成随机起点坐标,避免与画布上已有的总线重合(SCH 坐标单位 10mil)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一条两段相连的 L 形总线:先向右再向上,段与段必须首尾相连且各自水平或垂直
const bus = await eda.sch_PrimitiveBus.create(
'DATA[0..7]',
[[x, y, x + 400, y], [x + 400, y, x + 400, y + 200]],
'#FF0000', // 总线颜色
6, // 线宽(范围 1-10)
1 // 线型:1 = DASHED(虚线)
);
// 3. 创建类保留现场,不删除图元
console.log('primitiveId:', bus.getState_PrimitiveId());
console.log('primitiveType:', bus.getState_PrimitiveType());
console.log('busName:', bus.getState_BusName());
console.log('color:', bus.getState_Color());
console.log('lineWidth:', bus.getState_LineWidth());
```
### delete
# SCH\_PrimitiveBus.delete() method
> 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.
Delete the bus
## Signature
```typescript
function delete(primitiveIds: string | ISCH_PrimitiveBus | Array<string> | Array<ISCH_PrimitiveBus>): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string \| [ISCH\_PrimitiveBus](./ISCH_PrimitiveBus.md) \| Array<string> \| Array<[ISCH\_PrimitiveBus](./ISCH_PrimitiveBus.md)<!-- -->>
</td><td>
Primitive ID of the bus or the bus primitive object
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Delete Whether the operation is successful
## Example
```javascript
// 1. 创建两条待删除的测试总线(随机坐标避免重合,SCH 坐标单位 10mil)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const bus1 = await eda.sch_PrimitiveBus.create('DATA[0..7]', [x, y, x + 400, y]);
const bus2 = await eda.sch_PrimitiveBus.create('ADDR[0..15]', [x, y + 200, x + 400, y + 200]);
// 2. 记录删除前的总线数量
const beforeCount = (await eda.sch_PrimitiveBus.getAll()).length;
// 3. 分别以 ID 字符串和图元对象两种形式删除两条总线
const deleted1 = await eda.sch_PrimitiveBus.delete(bus1.getState_PrimitiveId());
const deleted2 = await eda.sch_PrimitiveBus.delete(bus2);
// 4. 删除类保留现场(图元已删除,不恢复)
const afterCount = (await eda.sch_PrimitiveBus.getAll()).length;
console.log('deleted by id:', deleted1);
console.log('deleted by object:', deleted2);
console.log('beforeCount:', beforeCount, '→ afterCount:', afterCount);
```
### get
# SCH\_PrimitiveBus.get() method
> 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.
Get the bus
## Signature
```typescript
function get(primitiveIds: string): Promise<ISCH_PrimitiveBus | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string
</td><td>
Primitive ID of the bus, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitiveBus](./ISCH_PrimitiveBus.md) \| undefined>
Bus primitive object, `undefined` indicates that the retrieval failed
## Example
```javascript
// 1. 创建两条测试总线(随机坐标避免重合,SCH 坐标单位 10mil)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const bus1 = await eda.sch_PrimitiveBus.create('DATA[0..7]', [x, y, x + 400, y]);
const bus2 = await eda.sch_PrimitiveBus.create('ADDR[0..15]', [x, y + 200, x + 400, y + 200]);
// 2. 传单个 ID 字符串,返回单条总线对象
const single = await eda.sch_PrimitiveBus.get(bus1.getState_PrimitiveId());
// 3. 传 ID 数组,返回总线对象数组(任一 ID 未匹配不影响其它图元的返回)
const arr = await eda.sch_PrimitiveBus.get([bus1.getState_PrimitiveId(), bus2.getState_PrimitiveId()]);
// 4. 清理测试图元(查询类需要清理)
await eda.sch_PrimitiveBus.delete([bus1.getState_PrimitiveId(), bus2.getState_PrimitiveId()]);
console.log('single busName:', single.getState_BusName());
console.log('array length:', arr.length);
console.log('bus2 busName:', arr[1].getState_BusName());
```
### get_1
# SCH\_PrimitiveBus.get() method
> 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.
Get the bus
## Signature
```typescript
function get(primitiveIds: Array<string>): Promise<Array<ISCH_PrimitiveBus>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
Array<string>
</td><td>
Primitive ID of the bus, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<Array<[ISCH\_PrimitiveBus](./ISCH_PrimitiveBus.md)<!-- -->>>
Bus primitive object; an empty array indicates that the retrieval failed
## Remarks
If multiple primitive IDs are passed in, a primitive ID that is not matched will not affect the return of other primitives; that is, fewer primitive objects than the number of primitive IDs passed in may be returned.
### getall
# SCH\_PrimitiveBus.getAll() method
> 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.
Get all buses
## Signature
```typescript
function getAll(): Promise<Array<ISCH_PrimitiveBus>>;
```
## Returns
Promise<Array<[ISCH\_PrimitiveBus](./ISCH_PrimitiveBus.md)<!-- -->>>
Bus primitive object array
## Example
```javascript
// 1. 创建一条测试总线作为查找目标(随机坐标避免重合,SCH 坐标单位 10mil)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const bus = await eda.sch_PrimitiveBus.create('DATA[0..7]', [x, y, x + 400, y]);
const busId = bus.getState_PrimitiveId();
// 2. 获取当前原理图页上的全部总线
const all = await eda.sch_PrimitiveBus.getAll();
// 3. 清理测试图元(查询类需要清理)
await eda.sch_PrimitiveBus.delete([busId]);
console.log('total buses:', all.length);
console.log('marker bus found:', all.some(b => b.getState_PrimitiveId() === busId));
```
### getallprimitiveid
# SCH\_PrimitiveBus.getAllPrimitiveId() method
> 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.
Get the primitive IDs of all buses
## Signature
```typescript
function getAllPrimitiveId(): Promise<Array<string>>;
```
## Returns
Promise<Array<string>>
Array of bus primitive IDs
## Example
```javascript
// 1. 创建一条测试总线作为查找目标(随机坐标避免重合,SCH 坐标单位 10mil)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const bus = await eda.sch_PrimitiveBus.create('DATA[0..7]', [x, y, x + 400, y]);
const busId = bus.getState_PrimitiveId();
// 2. 获取全部总线的图元 ID
const allIds = await eda.sch_PrimitiveBus.getAllPrimitiveId();
// 3. 清理测试图元(查询类需要清理)
await eda.sch_PrimitiveBus.delete([busId]);
console.log('total bus ids:', allIds.length);
console.log('marker id in list:', allIds.includes(busId));
```
### modify
# SCH\_PrimitiveBus.modify() method
> 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.
Modify the bus
## Signature
```typescript
function modify(
primitiveId: string | ISCH_PrimitiveBus,
property: {
busName?: string;
line?: Array<number> | Array<Array<number>>;
color?: string | null;
lineWidth?: number | null;
lineType?: ESCH_PrimitiveLineType | null;
},
): Promise<ISCH_PrimitiveBus | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveId
</td><td>
string \| [ISCH\_PrimitiveBus](./ISCH_PrimitiveBus.md)
</td><td>
Primitive ID of the bus or the bus primitive object
</td></tr>
<tr><td>
property
</td><td>
{ busName?: string; line?: Array<number> \| Array<Array<number>>; color?: string \| null; lineWidth?: number \| null; lineType?: [ESCH\_PrimitiveLineType](../enums/ESCH_PrimitiveLineType.md) \| null }
</td><td>
Modify Parameter
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitiveBus](./ISCH_PrimitiveBus.md) \| undefined>
Bus primitive object
## Example
```javascript
// 1. 创建待修改的测试总线(随机坐标避免与画布已有总线重合)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const bus = await eda.sch_PrimitiveBus.create('DATA[0..7]', [x, y, x + 400, y], '#FF0000', 6, 1);
const busId = bus.getState_PrimitiveId();
// 2. 读取修改前的名称、线宽与颜色
const beforeName = bus.getState_BusName();
const beforeWidth = bus.getState_LineWidth();
const beforeColor = bus.getState_Color();
// 3. 批量修改:名称 DATA[0..7] → ADDR[0..15]、线宽 6 → 10、颜色改为绿色
await eda.sch_PrimitiveBus.modify(busId, { busName: 'ADDR[0..15]', lineWidth: 10, color: '#00AA00' });
// 4. modify 返回后需要重新 get() 才能读到画布上的最新值
const refreshed = await eda.sch_PrimitiveBus.get(busId);
// 5. 修改类保留现场,供观察修改结果
console.log('primitiveId:', busId);
console.log('busName:', beforeName, '→', refreshed.getState_BusName());
console.log('lineWidth:', beforeWidth, '→', refreshed.getState_LineWidth());
console.log('color:', beforeColor, '→', refreshed.getState_Color());
```
references/classes/SCH_PrimitivePolygon.md
# SCH\_PrimitivePolygon class
Schematic & symbol / polygon (polyline) primitive class
## Signature
```typescript
class SCH_PrimitivePolygon implements ISCH_PrimitiveAPI
```
**Implements:** [ISCH\_PrimitiveAPI](../interfaces/ISCH_PrimitiveAPI.md)
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[create(line, color, fillColor, lineWidth, lineType)](./SCH_PrimitivePolygon.md)
</td><td>
</td><td>
**_(BETA)_** Create Polygon
</td></tr>
<tr><td>
[delete(primitiveIds)](./SCH_PrimitivePolygon.md)
</td><td>
</td><td>
**_(BETA)_** Delete Polygon
</td></tr>
<tr><td>
[get(primitiveIds)](./SCH_PrimitivePolygon.md)
</td><td>
</td><td>
**_(BETA)_** Get Polygon
</td></tr>
<tr><td>
[get(primitiveIds)](./SCH_PrimitivePolygon.md)
</td><td>
</td><td>
**_(BETA)_** Get Polygon
</td></tr>
<tr><td>
[getAll()](./SCH_PrimitivePolygon.md)
</td><td>
</td><td>
**_(BETA)_** Get all Polygon
</td></tr>
<tr><td>
[getAllPrimitiveId()](./SCH_PrimitivePolygon.md)
</td><td>
</td><td>
**_(BETA)_** Get all Polygon primitive IDs
</td></tr>
<tr><td>
[modify(primitiveId, property)](./SCH_PrimitivePolygon.md)
</td><td>
</td><td>
**_(BETA)_** Modify Polygon
</td></tr>
</tbody></table>
---
## 方法详情
### create
# SCH\_PrimitivePolygon.create() method
> 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.
Create Polygon
## Signature
```typescript
function create(
line: Array<number>,
color?: string | null,
fillColor?: string | null,
lineWidth?: number | null,
lineType?: ESCH_PrimitiveLineType | null,
): Promise<ISCH_PrimitivePolygon | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
line
</td><td>
Array<number>
</td><td>
Coordinate group, a continuous set of lines described by `[x1, y1, x2, y2, x3, y3]`
</td></tr>
<tr><td>
color
</td><td>
string \| null
</td><td>
_(Optional)_ Color, `null` indicates the default
</td></tr>
<tr><td>
fillColor
</td><td>
string \| null
</td><td>
_(Optional)_ Fill color. `none` indicates no fill, `null` indicates the default
</td></tr>
<tr><td>
lineWidth
</td><td>
number \| null
</td><td>
_(Optional)_ Line width, range `1-10`<!-- -->. `null` indicates the default
</td></tr>
<tr><td>
lineType
</td><td>
[ESCH\_PrimitiveLineType](../enums/ESCH_PrimitiveLineType.md) \| null
</td><td>
_(Optional)_ Line type. `null` indicates the default
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitivePolygon](./ISCH_PrimitivePolygon.md) \| undefined>
Polygon primitive object
## Example
```javascript
// 1. 生成随机起点坐标,避免与画布上已有的多边形重合(SCH 坐标单位 10mil)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个 4 顶点矩形多边形:顶点依次为左下、右下、右上、左上,红色虚线边线、黄色填充、线宽 6
const line = [x, y, x + 400, y, x + 400, y + 300, x, y + 300];
const polygon = await eda.sch_PrimitivePolygon.create(line, '#FF0000', '#FFFF00', 6, 1);
// 3. 创建类保留现场,不删除图元
console.log('primitiveId:', polygon.getState_PrimitiveId());
console.log('primitiveType:', polygon.getState_PrimitiveType());
console.log('line:', JSON.stringify(polygon.getState_Line()));
console.log('color:', polygon.getState_Color());
console.log('fillColor:', polygon.getState_FillColor());
console.log('lineWidth:', polygon.getState_LineWidth());
```
### delete
# SCH\_PrimitivePolygon.delete() method
> 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.
Delete Polygon
## Signature
```typescript
function delete(primitiveIds: string | ISCH_PrimitivePolygon | Array<string> | Array<ISCH_PrimitivePolygon>): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string \| [ISCH\_PrimitivePolygon](./ISCH_PrimitivePolygon.md) \| Array<string> \| Array<[ISCH\_PrimitivePolygon](./ISCH_PrimitivePolygon.md)<!-- -->>
</td><td>
Polygon primitive ID or Polygon primitive object
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Delete Whether the operation is successful
## Example
```javascript
// 1. 创建两个待删除的测试多边形(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const poly1 = await eda.sch_PrimitivePolygon.create([x, y, x + 400, y, x + 400, y + 300], '#FF0000');
const poly2 = await eda.sch_PrimitivePolygon.create([x, y + 400, x + 400, y + 400, x + 200, y + 700], '#0000FF');
// 2. 记录删除前的多边形数量
const beforeCount = (await eda.sch_PrimitivePolygon.getAll()).length;
// 3. 分别以 ID 字符串和图元对象两种形式删除两个多边形
const deleted1 = await eda.sch_PrimitivePolygon.delete(poly1.getState_PrimitiveId());
const deleted2 = await eda.sch_PrimitivePolygon.delete(poly2);
// 4. 删除类保留现场(图元已删除,不恢复)
const afterCount = (await eda.sch_PrimitivePolygon.getAll()).length;
console.log('deleted by id:', deleted1);
console.log('deleted by object:', deleted2);
console.log('beforeCount:', beforeCount, '→ afterCount:', afterCount);
```
### get
# SCH\_PrimitivePolygon.get() method
> 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.
Get Polygon
## Signature
```typescript
function get(primitiveIds: string): Promise<ISCH_PrimitivePolygon | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string
</td><td>
Polygon primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitivePolygon](./ISCH_PrimitivePolygon.md) \| undefined>
Polygon primitive object, `undefined` indicates that the retrieval failed
## Example
```javascript
// 1. 在画布空白处创建两个测试多边形(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const poly1 = await eda.sch_PrimitivePolygon.create([x, y, x + 400, y, x + 400, y + 300], '#FF0000');
const poly2 = await eda.sch_PrimitivePolygon.create([x, y + 400, x + 400, y + 400, x + 200, y + 700], '#0000FF');
const id1 = poly1.getState_PrimitiveId();
const id2 = poly2.getState_PrimitiveId();
// 2. 传单个 ID 字符串,返回单个多边形对象
const single = await eda.sch_PrimitivePolygon.get(id1);
// 3. 传 ID 数组,返回多边形对象数组(任一 ID 未匹配不影响其它图元的返回)
const arr = await eda.sch_PrimitivePolygon.get([id1, id2]);
// 4. 清理测试多边形(查询类需要清理)
await eda.sch_PrimitivePolygon.delete([id1, id2]);
console.log('single primitiveType:', single.getState_PrimitiveType());
console.log('single line:', JSON.stringify(single.getState_Line()));
console.log('array length:', arr.length);
console.log('poly2 color:', arr[1].getState_Color());
```
### get_1
# SCH\_PrimitivePolygon.get() method
> 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.
Get Polygon
## Signature
```typescript
function get(primitiveIds: Array<string>): Promise<Array<ISCH_PrimitivePolygon>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
Array<string>
</td><td>
Polygon primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<Array<[ISCH\_PrimitivePolygon](./ISCH_PrimitivePolygon.md)<!-- -->>>
Polygon primitive object; an empty array indicates that the retrieval failed
## Remarks
If multiple primitive IDs are passed in, a primitive ID that is not matched will not affect the return of other primitives; that is, fewer primitive objects than the number of primitive IDs passed in may be returned.
### getall
# SCH\_PrimitivePolygon.getAll() method
> 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.
Get all Polygon
## Signature
```typescript
function getAll(): Promise<Array<ISCH_PrimitivePolygon>>;
```
## Returns
Promise<Array<[ISCH\_PrimitivePolygon](./ISCH_PrimitivePolygon.md)<!-- -->>>
Array of Polygon primitive objects
## Example
```javascript
// 1. 创建一个测试多边形作为查找目标(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const polygon = await eda.sch_PrimitivePolygon.create([x, y, x + 400, y, x + 400, y + 300, x, y + 300], '#FF0000');
const polygonId = polygon.getState_PrimitiveId();
// 2. 获取当前原理图页的全部多边形
const all = await eda.sch_PrimitivePolygon.getAll();
// 3. 清理测试多边形(查询类需要清理)
await eda.sch_PrimitivePolygon.delete([polygonId]);
console.log('total polygons:', all.length);
console.log('marker polygon found:', all.some(p => p.getState_PrimitiveId() === polygonId));
console.log('marker color:', all.find(p => p.getState_PrimitiveId() === polygonId).getState_Color());
```
### getallprimitiveid
# SCH\_PrimitivePolygon.getAllPrimitiveId() method
> 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.
Get all Polygon primitive IDs
## Signature
```typescript
function getAllPrimitiveId(): Promise<Array<string>>;
```
## Returns
Promise<Array<string>>
Array of Polygon primitive IDs
## Example
```javascript
// 1. 创建一个测试多边形作为查找目标(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const polygon = await eda.sch_PrimitivePolygon.create([x, y, x + 400, y, x + 200, y + 300], '#FF0000');
const polygonId = polygon.getState_PrimitiveId();
// 2. 获取全部多边形的图元 ID
const allIds = await eda.sch_PrimitivePolygon.getAllPrimitiveId();
// 3. 清理测试多边形(查询类需要清理)
await eda.sch_PrimitivePolygon.delete([polygonId]);
console.log('total polygon ids:', allIds.length);
console.log('marker id in list:', allIds.includes(polygonId));
```
### modify
# SCH\_PrimitivePolygon.modify() method
> 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.
Modify Polygon
## Signature
```typescript
function modify(
primitiveId: string | ISCH_PrimitivePolygon,
property: {
line?: Array<number>;
color?: string | null;
fillColor?: string | null;
lineWidth?: number | null;
lineType?: ESCH_PrimitiveLineType | null;
},
): Promise<ISCH_PrimitivePolygon | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveId
</td><td>
string \| [ISCH\_PrimitivePolygon](./ISCH_PrimitivePolygon.md)
</td><td>
Primitive ID
</td></tr>
<tr><td>
property
</td><td>
{ line?: Array<number>; color?: string \| null; fillColor?: string \| null; lineWidth?: number \| null; lineType?: [ESCH\_PrimitiveLineType](../enums/ESCH_PrimitiveLineType.md) \| null }
</td><td>
Modify Parameter
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitivePolygon](./ISCH_PrimitivePolygon.md) \| undefined>
Polygon primitive object
## Example
```javascript
// 1. 创建待修改的测试多边形:4 顶点矩形、红色边线、黄色填充(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const rect = [x, y, x + 400, y, x + 400, y + 300, x, y + 300];
const polygon = await eda.sch_PrimitivePolygon.create(rect, '#FF0000', '#FFFF00', 6, 1);
const polygonId = polygon.getState_PrimitiveId();
// 2. 记录修改前的线宽、颜色与填充色
const beforeWidth = polygon.getState_LineWidth();
const beforeColor = polygon.getState_Color();
const beforeFill = polygon.getState_FillColor();
// 3. 批量修改:形状整体替换为 3 顶点三角形、线宽 6 → 10、边线改绿色、填充改无色
const triangle = [x, y, x + 400, y, x + 200, y + 350];
await eda.sch_PrimitivePolygon.modify(polygonId, { line: triangle, lineWidth: 10, color: '#00AA00', fillColor: 'none' });
// 4. modify 返回后需要重新 get() 才能读到画布上的最新值
const refreshed = await eda.sch_PrimitivePolygon.get(polygonId);
// 5. 修改类保留现场,供观察修改结果
console.log('primitiveId:', polygonId);
console.log('lineWidth:', beforeWidth, '→', refreshed.getState_LineWidth());
console.log('color:', beforeColor, '→', refreshed.getState_Color());
console.log('fillColor:', beforeFill, '→', refreshed.getState_FillColor());
console.log('line:', JSON.stringify(rect), '→', JSON.stringify(refreshed.getState_Line()));
```
references/classes/SCH_PrimitiveRectangle.md
# SCH\_PrimitiveRectangle class
Schematic & symbol / rectangle primitive class
## Signature
```typescript
class SCH_PrimitiveRectangle implements ISCH_PrimitiveAPI
```
**Implements:** [ISCH\_PrimitiveAPI](../interfaces/ISCH_PrimitiveAPI.md)
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[create(topLeftX, topLeftY, width, height, cornerRadius, rotation, color, fillColor, lineWidth, lineType, fillStyle)](./SCH_PrimitiveRectangle.md)
</td><td>
</td><td>
Create Rectangle
</td></tr>
<tr><td>
[delete(primitiveIds)](./SCH_PrimitiveRectangle.md)
</td><td>
</td><td>
Delete Rectangle
</td></tr>
<tr><td>
[get(primitiveIds)](./SCH_PrimitiveRectangle.md)
</td><td>
</td><td>
**_(BETA)_** Get Rectangle
</td></tr>
<tr><td>
[get(primitiveIds)](./SCH_PrimitiveRectangle.md)
</td><td>
</td><td>
**_(BETA)_** Get Rectangle
</td></tr>
<tr><td>
[getAll()](./SCH_PrimitiveRectangle.md)
</td><td>
</td><td>
Get all Rectangle
</td></tr>
<tr><td>
[getAllPrimitiveId()](./SCH_PrimitiveRectangle.md)
</td><td>
</td><td>
Get all Rectangle primitive IDs
</td></tr>
<tr><td>
[modify(primitiveId, property)](./SCH_PrimitiveRectangle.md)
</td><td>
</td><td>
**_(BETA)_** Modify Rectangle
</td></tr>
</tbody></table>
---
## 方法详情
### create
# SCH\_PrimitiveRectangle.create() method
Create Rectangle
## Signature
```typescript
function create(
topLeftX: number,
topLeftY: number,
width: number,
height: number,
cornerRadius?: number,
rotation?: number,
color?: string | null,
fillColor?: string | null,
lineWidth?: number | null,
lineType?: ESCH_PrimitiveLineType | null,
fillStyle?: ESCH_PrimitiveFillStyle | null,
): Promise<ISCH_PrimitiveRectangle | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
topLeftX
</td><td>
number
</td><td>
Top-left point X
</td></tr>
<tr><td>
topLeftY
</td><td>
number
</td><td>
Top-left point Y
</td></tr>
<tr><td>
width
</td><td>
number
</td><td>
Width
</td></tr>
<tr><td>
height
</td><td>
number
</td><td>
Height
</td></tr>
<tr><td>
cornerRadius
</td><td>
number
</td><td>
_(Optional)_ Corner radius
</td></tr>
<tr><td>
rotation
</td><td>
number
</td><td>
_(Optional)_ Rotation angle, rotating around the top-left point. Options: `0` `90` `180` `270`
</td></tr>
<tr><td>
color
</td><td>
string \| null
</td><td>
_(Optional)_ Color, `null` indicates the default
</td></tr>
<tr><td>
fillColor
</td><td>
string \| null
</td><td>
_(Optional)_ Fill color. `none` indicates no fill, `null` indicates the default
</td></tr>
<tr><td>
lineWidth
</td><td>
number \| null
</td><td>
_(Optional)_ Line width, range `1-10`<!-- -->. `null` indicates the default
</td></tr>
<tr><td>
lineType
</td><td>
[ESCH\_PrimitiveLineType](../enums/ESCH_PrimitiveLineType.md) \| null
</td><td>
_(Optional)_ Line type. `null` indicates the default
</td></tr>
<tr><td>
fillStyle
</td><td>
[ESCH\_PrimitiveFillStyle](../enums/ESCH_PrimitiveFillStyle.md) \| null
</td><td>
_(Optional)_ Fill style, `null` indicates the default
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitiveRectangle](./ISCH_PrimitiveRectangle.md) \| undefined>
Rectangle primitive object
## Example
```javascript
// 1. 生成随机左上角坐标,避免与画布上已有的矩形重合(SCH 坐标单位 10mil)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一个宽 400 高 300 的圆角矩形:圆角 20、旋转 90 度(绕左上点)、红色虚线边线、黄色网格填充、线宽 6
const rect = await eda.sch_PrimitiveRectangle.create(x, y, 400, 300, 20, 90, '#FF0000', '#FFFF00', 6, 1, 'Grid');
// 3. 创建类保留现场,不删除图元
console.log('primitiveId:', rect.getState_PrimitiveId());
console.log('primitiveType:', rect.getState_PrimitiveType());
console.log('topLeft:', rect.getState_TopLeftX(), rect.getState_TopLeftY());
console.log('size:', rect.getState_Width(), 'x', rect.getState_Height());
console.log('cornerRadius:', rect.getState_CornerRadius());
console.log('rotation:', rect.getState_Rotation());
console.log('color:', rect.getState_Color());
console.log('fillColor:', rect.getState_FillColor());
console.log('fillStyle:', rect.getState_FillStyle());
console.log('lineWidth:', rect.getState_LineWidth());
console.log('lineType:', rect.getState_LineType());
```
### delete
# SCH\_PrimitiveRectangle.delete() method
Delete Rectangle
## Signature
```typescript
function delete(primitiveIds: string | ISCH_PrimitiveRectangle | Array<string> | Array<ISCH_PrimitiveRectangle>): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string \| [ISCH\_PrimitiveRectangle](./ISCH_PrimitiveRectangle.md) \| Array<string> \| Array<[ISCH\_PrimitiveRectangle](./ISCH_PrimitiveRectangle.md)<!-- -->>
</td><td>
Rectangle primitive ID or Rectangle primitive object
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Delete Whether the operation is successful
## Example
```javascript
// 1. 创建两个待删除的测试矩形(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const rect1 = await eda.sch_PrimitiveRectangle.create(x, y, 400, 300, 0, 0, '#FF0000');
const rect2 = await eda.sch_PrimitiveRectangle.create(x, y + 400, 500, 200, 0, 0, '#0000FF');
// 2. 记录删除前的矩形数量
const beforeCount = (await eda.sch_PrimitiveRectangle.getAll()).length;
// 3. 分别以 ID 字符串和图元对象两种形式删除两个矩形
const deleted1 = await eda.sch_PrimitiveRectangle.delete(rect1.getState_PrimitiveId());
const deleted2 = await eda.sch_PrimitiveRectangle.delete(rect2);
// 4. 删除类保留现场(图元已删除,不恢复)
const afterCount = (await eda.sch_PrimitiveRectangle.getAll()).length;
console.log('deleted by id:', deleted1);
console.log('deleted by object:', deleted2);
console.log('beforeCount:', beforeCount, '→ afterCount:', afterCount);
```
### get
# SCH\_PrimitiveRectangle.get() method
> 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.
Get Rectangle
## Signature
```typescript
function get(primitiveIds: string): Promise<ISCH_PrimitiveRectangle | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string
</td><td>
Rectangle primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitiveRectangle](./ISCH_PrimitiveRectangle.md) \| undefined>
Rectangle primitive object, `undefined` indicates that the retrieval failed
## Example
```javascript
// 1. 在画布空白处创建两个测试矩形(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const rect1 = await eda.sch_PrimitiveRectangle.create(x, y, 400, 300, 0, 0, '#FF0000');
const rect2 = await eda.sch_PrimitiveRectangle.create(x, y + 400, 500, 200, 30, 0, '#0000FF');
const id1 = rect1.getState_PrimitiveId();
const id2 = rect2.getState_PrimitiveId();
// 2. 传单个 ID 字符串,返回单个矩形对象
const single = await eda.sch_PrimitiveRectangle.get(id1);
// 3. 传 ID 数组,返回矩形对象数组(任一 ID 未匹配不影响其它图元的返回)
const arr = await eda.sch_PrimitiveRectangle.get([id1, id2]);
// 4. 清理测试矩形(查询类需要清理)
await eda.sch_PrimitiveRectangle.delete([id1, id2]);
console.log('single primitiveType:', single.getState_PrimitiveType());
console.log('single size:', single.getState_Width(), 'x', single.getState_Height());
console.log('array length:', arr.length);
console.log('rect2 color:', arr[1].getState_Color());
console.log('rect2 cornerRadius:', arr[1].getState_CornerRadius());
```
### get_1
# SCH\_PrimitiveRectangle.get() method
> 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.
Get Rectangle
## Signature
```typescript
function get(primitiveIds: Array<string>): Promise<Array<ISCH_PrimitiveRectangle>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
Array<string>
</td><td>
Rectangle primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<Array<[ISCH\_PrimitiveRectangle](./ISCH_PrimitiveRectangle.md)<!-- -->>>
Rectangle primitive object; an empty array indicates that the retrieval failed
## Remarks
If multiple primitive IDs are passed in, a primitive ID that is not matched will not affect the return of other primitives; that is, fewer primitive objects than the number of primitive IDs passed in may be returned.
### getall
# SCH\_PrimitiveRectangle.getAll() method
Get all Rectangle
## Signature
```typescript
function getAll(): Promise<Array<ISCH_PrimitiveRectangle>>;
```
## Returns
Promise<Array<[ISCH\_PrimitiveRectangle](./ISCH_PrimitiveRectangle.md)<!-- -->>>
Array of Rectangle primitive objects
## Example
```javascript
// 1. 创建一个测试矩形作为查找目标(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const rect = await eda.sch_PrimitiveRectangle.create(x, y, 400, 300, 0, 0, '#FF0000');
const rectId = rect.getState_PrimitiveId();
// 2. 获取当前原理图页的全部矩形
const all = await eda.sch_PrimitiveRectangle.getAll();
// 3. 清理测试矩形(查询类需要清理)
await eda.sch_PrimitiveRectangle.delete([rectId]);
console.log('total rectangles:', all.length);
console.log('marker rectangle found:', all.some(r => r.getState_PrimitiveId() === rectId));
console.log('marker color:', all.find(r => r.getState_PrimitiveId() === rectId).getState_Color());
```
### getallprimitiveid
# SCH\_PrimitiveRectangle.getAllPrimitiveId() method
Get all Rectangle primitive IDs
## Signature
```typescript
function getAllPrimitiveId(): Promise<Array<string>>;
```
## Returns
Promise<Array<string>>
Array of Rectangle primitive IDs
## Example
```javascript
// 1. 创建一个测试矩形作为查找目标(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const rect = await eda.sch_PrimitiveRectangle.create(x, y, 400, 300, 0, 0, '#FF0000');
const rectId = rect.getState_PrimitiveId();
// 2. 获取全部矩形的图元 ID
const allIds = await eda.sch_PrimitiveRectangle.getAllPrimitiveId();
// 3. 清理测试矩形(查询类需要清理)
await eda.sch_PrimitiveRectangle.delete([rectId]);
console.log('total rectangle ids:', allIds.length);
console.log('marker id in list:', allIds.includes(rectId));
```
### modify
# SCH\_PrimitiveRectangle.modify() method
> 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.
Modify Rectangle
## Signature
```typescript
function modify(
primitiveId: string | ISCH_PrimitiveRectangle,
property: {
topLeftX?: number;
topLeftY?: number;
width?: number;
height?: number;
cornerRadius?: number;
rotation?: number;
color?: string | null;
fillColor?: string | null;
lineWidth?: number | null;
lineType?: ESCH_PrimitiveLineType | null;
fillStyle?: ESCH_PrimitiveFillStyle | null;
},
): Promise<ISCH_PrimitiveRectangle | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveId
</td><td>
string \| [ISCH\_PrimitiveRectangle](./ISCH_PrimitiveRectangle.md)
</td><td>
Primitive ID
</td></tr>
<tr><td>
property
</td><td>
{ topLeftX?: number; topLeftY?: number; width?: number; height?: number; cornerRadius?: number; rotation?: number; color?: string \| null; fillColor?: string \| null; lineWidth?: number \| null; lineType?: [ESCH\_PrimitiveLineType](../enums/ESCH_PrimitiveLineType.md) \| null; fillStyle?: [ESCH\_PrimitiveFillStyle](../enums/ESCH_PrimitiveFillStyle.md) \| null }
</td><td>
Modify Parameter
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitiveRectangle](./ISCH_PrimitiveRectangle.md) \| undefined>
Rectangle primitive object
## Example
```javascript
// 1. 创建待修改的测试矩形:宽 400 高 300 直角、红色边线(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const rect = await eda.sch_PrimitiveRectangle.create(x, y, 400, 300, 0, 0, '#FF0000');
const rectId = rect.getState_PrimitiveId();
// 2. 记录修改前的尺寸、圆角与颜色
const beforeWidth = rect.getState_Width();
const beforeRadius = rect.getState_CornerRadius();
const beforeColor = rect.getState_Color();
// 3. 批量修改:左上角平移、宽 400 → 600、直角 → 圆角 40、边线改绿色、填充改蓝色实心
await eda.sch_PrimitiveRectangle.modify(rectId, {
topLeftX: x + 200,
topLeftY: y + 100,
width: 600,
cornerRadius: 40,
color: '#00AA00',
fillColor: '#0000FF',
fillStyle: 'Solid',
});
// 4. modify 返回后需要重新 get() 才能读到画布上的最新值
const refreshed = await eda.sch_PrimitiveRectangle.get(rectId);
// 5. 修改类保留现场,供观察修改结果
console.log('primitiveId:', rectId);
console.log('width:', beforeWidth, '→', refreshed.getState_Width());
console.log('cornerRadius:', beforeRadius, '→', refreshed.getState_CornerRadius());
console.log('color:', beforeColor, '→', refreshed.getState_Color());
console.log('topLeft:', x, y, '→', refreshed.getState_TopLeftX(), refreshed.getState_TopLeftY());
console.log('fillStyle:', refreshed.getState_FillStyle());
```
references/classes/SCH_SelectControl.md
# SCH\_SelectControl class
Schematic & symbol / selection control class
## Signature
```typescript
class SCH_SelectControl
```
## Remarks
Get or operate the selected elements
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[clearSelected()](./SCH_SelectControl.md)
</td><td>
</td><td>
Clear the selection
</td></tr>
<tr><td>
[doCrossProbeSelect(components, pins, nets, highlight, select)](./SCH_SelectControl.md)
</td><td>
</td><td>
Perform cross-probe selection
</td></tr>
<tr><td>
[doSelectPrimitives(primitiveIds)](./SCH_SelectControl.md)
</td><td>
</td><td>
Select primitives using primitive IDs
</td></tr>
<tr><td>
[getAllSelectedPrimitives\_PrimitiveId()](./SCH_SelectControl.md)
</td><td>
</td><td>
**_(BETA)_** Query the primitive IDs of all selected primitives
</td></tr>
<tr><td>
[getAllSelectedPrimitives()](./SCH_SelectControl.md)
</td><td>
</td><td>
**_(BETA)_** Query the primitive objects of all selected primitives
</td></tr>
<tr><td>
[getCurrentMousePosition()](./SCH_SelectControl.md)
</td><td>
</td><td>
**_(BETA)_** Get Current the mouse position on the canvas
</td></tr>
<tr><td>
[getSelectedPrimitives\_PrimitiveId()](./SCH_SelectControl.md)
</td><td>
</td><td>
Query the primitive IDs of the selected primitives
</td></tr>
<tr><td>
[getSelectedPrimitives()](./SCH_SelectControl.md)
</td><td>
</td><td>
**_(BETA)_** Query all parameters of the selected primitives
</td></tr>
</tbody></table>
---
## 方法详情
### clearselected
# SCH\_SelectControl.clearSelected() method
Clear the selection
## Signature
```typescript
function clearSelected(): boolean;
```
## Returns
boolean
Whether the operation is successful
## Example
```javascript
// 1. 创建测试矩形并选中它
const rect = await eda.sch_PrimitiveRectangle.create(400, 300, 200, 100);
const rectId = rect.getState_PrimitiveId();
await eda.sch_SelectControl.doSelectPrimitives([rectId]);
// 2. 确认清除前有选中图元
const beforeIds = await eda.sch_SelectControl.getAllSelectedPrimitives_PrimitiveId();
console.log('清除前选中数量:', beforeIds.length);
// 3. 清除选中(同步方法,直接返回结果)
const cleared = eda.sch_SelectControl.clearSelected();
console.log('cleared:', cleared);
// 4. 确认选中集已清空
const afterIds = await eda.sch_SelectControl.getAllSelectedPrimitives_PrimitiveId();
console.log('清除后选中数量:', afterIds.length);
// 5. 清理测试图元
await eda.sch_PrimitiveRectangle.delete([rectId]);
```
### docrossprobeselect
# SCH\_SelectControl.doCrossProbeSelect() method
Perform cross-probe selection
## Signature
```typescript
function doCrossProbeSelect(
components?: Array<string>,
pins?: Array<string>,
nets?: Array<string>,
highlight?: boolean,
select?: boolean,
): boolean;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
components
</td><td>
Array<string>
</td><td>
_(Optional)_ Device designator
</td></tr>
<tr><td>
pins
</td><td>
Array<string>
</td><td>
_(Optional)_ Device designator \_ pin number, format is \['U1\_1', 'U1\_2'\]
</td></tr>
<tr><td>
nets
</td><td>
Array<string>
</td><td>
_(Optional)_ Net name
</td></tr>
<tr><td>
highlight
</td><td>
boolean
</td><td>
_(Optional)_ Whether to highlight
</td></tr>
<tr><td>
select
</td><td>
boolean
</td><td>
_(Optional)_ Whether Select
</td></tr>
</tbody></table>
## Returns
boolean
Whether the operation is successful
## Example
```javascript
// 1. 创建挂测试网络的导线,作为交叉选择的目标
const netName = '嘉立创示例_NET';
const wire = await eda.sch_PrimitiveWire.create([800, 300, 1200, 300], netName);
const wireId = wire.getState_PrimitiveId();
// 2. 按网络名交叉选择(highlight=true 高亮,select=true 选中;同步方法直接返回结果)
const crossProbed = eda.sch_SelectControl.doCrossProbeSelect(undefined, undefined, [netName], true, true);
console.log('crossProbed:', crossProbed);
// 3. 交叉探针作用于原理图与 PCB 的联动定位,返回 true 表示已触发;
// 需要选中当前文档图元时改用 doSelectPrimitives
eda.sch_SelectControl.clearSelected();
await eda.sch_PrimitiveWire.delete([wireId]);
```
### doselectprimitives
# SCH\_SelectControl.doSelectPrimitives() method
Select primitives using primitive IDs
## Signature
```typescript
function doSelectPrimitives(primitiveIds: string | Array<string>): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string \| Array<string>
</td><td>
Primitive ID
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Example
```javascript
// 1. 创建测试矩形
const rect = await eda.sch_PrimitiveRectangle.create(400, 300, 200, 100);
const rectId = rect.getState_PrimitiveId();
// 2. 用图元 ID 选中矩形
const selected = await eda.sch_SelectControl.doSelectPrimitives([rectId]);
console.log('selected:', selected);
// 3. 确认矩形已在选中集里
const selectedIds = await eda.sch_SelectControl.getAllSelectedPrimitives_PrimitiveId();
console.log('选中数量:', selectedIds.length);
console.log('包含测试矩形:', selectedIds.includes(rectId));
// 4. 清理:清除选中并删除测试图元
eda.sch_SelectControl.clearSelected();
await eda.sch_PrimitiveRectangle.delete([rectId]);
```
### getallselectedprimitives
# SCH\_SelectControl.getAllSelectedPrimitives() method
> 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.
Query the primitive objects of all selected primitives
## Signature
```typescript
function getAllSelectedPrimitives(): Promise<Array<ISCH_Primitive>>;
```
## Returns
Promise<Array<[ISCH\_Primitive](../interfaces/ISCH_Primitive.md)<!-- -->>>
Primitive objects of all selected primitives
## Example
```javascript
// 1. 创建测试矩形并选中
const rect = await eda.sch_PrimitiveRectangle.create(400, 300, 200, 100);
const rectId = rect.getState_PrimitiveId();
await eda.sch_SelectControl.doSelectPrimitives([rectId]);
// 2. 获取所有已选中图元的图元对象
const primitives = await eda.sch_SelectControl.getAllSelectedPrimitives();
console.log('选中图元数量:', primitives.length);
// 3. 图元对象可直接调用图元方法读取属性
const first = primitives[0];
console.log('primitiveId:', first.getState_PrimitiveId());
console.log('primitiveType:', first.getState_PrimitiveType());
// 4. 清理:清除选中并删除测试图元
eda.sch_SelectControl.clearSelected();
await eda.sch_PrimitiveRectangle.delete([rectId]);
```
### getallselectedprimitives_primitiveid
# SCH\_SelectControl.getAllSelectedPrimitives\_PrimitiveId() method
> 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.
Query the primitive IDs of all selected primitives
## Signature
```typescript
function getAllSelectedPrimitives_PrimitiveId(): Promise<Array<string>>;
```
## Returns
Promise<Array<string>>
Primitive IDs of all selected primitives
## Example
```javascript
// 1. 创建 2 个测试矩形并选中
const rect1 = await eda.sch_PrimitiveRectangle.create(400, 300, 200, 100);
const rect2 = await eda.sch_PrimitiveRectangle.create(700, 300, 200, 100);
const rectIds = [rect1.getState_PrimitiveId(), rect2.getState_PrimitiveId()];
await eda.sch_SelectControl.doSelectPrimitives(rectIds);
// 2. 查询所有已选中图元的图元 ID
const selectedIds = await eda.sch_SelectControl.getAllSelectedPrimitives_PrimitiveId();
console.log('选中图元数量:', selectedIds.length);
console.log('包含全部测试矩形:', rectIds.every(id => selectedIds.includes(id)));
// 3. 清理:清除选中并删除测试图元
eda.sch_SelectControl.clearSelected();
await eda.sch_PrimitiveRectangle.delete(rectIds);
```
### getcurrentmouseposition
# SCH\_SelectControl.getCurrentMousePosition() method
> 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.
Get Current the mouse position on the canvas
## Signature
```typescript
function getCurrentMousePosition(): Promise<{ x: number; y: number } | undefined>;
```
## Returns
Promise<{ x: number; y: number } \| undefined>
The mouse position on the canvas. `undefined` means the current mouse is not on the canvas
## Example
```javascript
// 1. 查询鼠标当前位置
const position = await eda.sch_SelectControl.getCurrentMousePosition();
// 2. 鼠标在画布上时输出坐标,不在画布上时返回 undefined
if (position) {
console.log('x:', position.x);
console.log('y:', position.y);
}
else {
console.log('鼠标当前不在画布上');
}
```
### getselectedprimitives
# SCH\_SelectControl.getSelectedPrimitives() method
> 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.
> Warning: This API is now obsolete.
>
> Please use [getAllSelectedPrimitives](./SCH_SelectControl.md) instead
Query all parameters of the selected primitives
## Signature
```typescript
function getSelectedPrimitives(): Promise<Array<object>>;
```
## Returns
Promise<Array<object>>
All parameters of the selected primitives
### getselectedprimitives_primitiveid
# SCH\_SelectControl.getSelectedPrimitives\_PrimitiveId() method
> Warning: This API is now obsolete.
>
> Please use [getAllSelectedPrimitives\_PrimitiveId](./SCH_SelectControl.md) instead
Query the primitive IDs of the selected primitives
## Signature
```typescript
function getSelectedPrimitives_PrimitiveId(): Promise<Array<string>>;
```
## Returns
Promise<Array<string>>
Primitive IDs of the selected primitives
references/classes/SCH_SimulationEngine.md
# SCH\_SimulationEngine class
Schematic & symbol / simulation engine class
## Signature
```typescript
class SCH_SimulationEngine
```
## Remarks
Controls the docking and interaction of the simulation engine
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[pushData(eventType, props)](./SCH_SimulationEngine.md)
</td><td>
</td><td>
Send data to the simulation kernel
</td></tr>
</tbody></table>
---
## 方法详情
### pushdata
# SCH\_SimulationEngine.pushData() method
Send data to the simulation kernel
## Signature
```typescript
function pushData(
eventType: ESCH_DynamicSimulationEnginePushEventType | ESCH_SpiceSimulationEnginePushEventType,
props: Record<string, any>,
): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
eventType
</td><td>
[ESCH\_DynamicSimulationEnginePushEventType](../enums/ESCH_DynamicSimulationEnginePushEventType.md) \| [ESCH\_SpiceSimulationEnginePushEventType](../enums/ESCH_SpiceSimulationEnginePushEventType.md)
</td><td>
Event type
</td></tr>
<tr><td>
props
</td><td>
Record<string, any>
</td><td>
Data
</td></tr>
</tbody></table>
## Returns
void
## Example
```javascript
// 1. 推送动态仿真的会话状态(SESSION_STATE:RUNNING/PAUSED/STOPPED 等)
eda.sch_SimulationEngine.pushData('SESSION_STATE', {
state: 'RUNNING',
});
// 2. 推送动态仿真的实时数据帧(STREAM_DATA:波形点/节点电压等内部量)
eda.sch_SimulationEngine.pushData('STREAM_DATA', {
time: 0.001,
signals: { VOUT: 3.3, ILOAD: 0.02 },
});
// 3. 推送 SPICE 仿真的仿真结果(SIMULATION_RESULT:分析类型 + 数据点)
eda.sch_SimulationEngine.pushData('SIMULATION_RESULT', {
analysis: 'tran',
points: [
{ t: 0, v: 0 },
{ t: 0.001, v: 3.3 },
],
});
console.log('已向仿真内核推送 3 组数据:SESSION_STATE、STREAM_DATA、SIMULATION_RESULT');
```
references/classes/SCH_PrimitiveWire.md
# SCH\_PrimitiveWire class
Schematic & symbol / wire primitive class
## Signature
```typescript
class SCH_PrimitiveWire implements ISCH_PrimitiveAPI
```
**Implements:** [ISCH\_PrimitiveAPI](../interfaces/ISCH_PrimitiveAPI.md)
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[create(line, net, color, lineWidth, lineType)](./SCH_PrimitiveWire.md)
</td><td>
</td><td>
**_(BETA)_** Create Wire
</td></tr>
<tr><td>
[delete(primitiveIds)](./SCH_PrimitiveWire.md)
</td><td>
</td><td>
**_(BETA)_** Delete Wire
</td></tr>
<tr><td>
[get(primitiveIds)](./SCH_PrimitiveWire.md)
</td><td>
</td><td>
**_(BETA)_** Get Wire
</td></tr>
<tr><td>
[get(primitiveIds)](./SCH_PrimitiveWire.md)
</td><td>
</td><td>
**_(BETA)_** Get Wire
</td></tr>
<tr><td>
[getAll(net)](./SCH_PrimitiveWire.md)
</td><td>
</td><td>
**_(BETA)_** Get all Wire
</td></tr>
<tr><td>
[getAllPrimitiveId(net)](./SCH_PrimitiveWire.md)
</td><td>
</td><td>
**_(BETA)_** Get all Wire primitive IDs
</td></tr>
<tr><td>
[modify(primitiveId, property)](./SCH_PrimitiveWire.md)
</td><td>
</td><td>
**_(BETA)_** Modify Wire
</td></tr>
</tbody></table>
---
## 方法详情
### create
# SCH\_PrimitiveWire.create() method
> 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.
Create Wire
## Signature
```typescript
function create(
line: Array<number> | Array<Array<number>>,
net?: string,
color?: string | null,
lineWidth?: number | null,
lineType?: ESCH_PrimitiveLineType | null,
): Promise<ISCH_PrimitiveWire | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
line
</td><td>
Array<number> \| Array<Array<number>>
</td><td>
Polyline coordinate group. Each segment is a continuous line described by `[x1, y1, x2, y2, x3, y3]`<!-- -->. If the polylines have no connection to each other, the creation will fail. Examples for the type `Array<Array<number>>`<!-- -->: 1. `[[], [0, 0, 0, 1]]` - segment 1 has no path, invalid; 2. `[[1], [0, 0, 0, 1]]` - segment 1 only has x, missing y, invalid; 3. `[[0, 0, -1, 0], [0, 0, 1, 1]]` - segment 1 is a horizontal line but segment 2 is a diagonal line, invalid; 4. `[[0, 0, -1, 0, -1, 1], [0, 1, 1, 1]]` - the two segments have no connection, invalid; 5. `[[1, 1], [1, 2, 2, 2]]` - segment 1 has only one point, ignored; segment 2 is a horizontal segment, and the final path keeps only segment 2, valid; 6. `[[1, 1], [1, 2]]` - segment 1 has only one point, ignored; segment 2 is also ignored, and the final path is empty, invalid
</td></tr>
<tr><td>
net
</td><td>
string
</td><td>
_(Optional)_ Net name. If not specified, the following rules apply: 1. If no coordinate falls on any primitive, the empty net is used by default; 2. If one coordinate point is on a primitive of a net, the net of that primitive is followed; 3. If multiple coordinate points are on primitives of different nets, the creation fails. If specified, the following rules apply: 1. If one or more coordinate points are on primitives of other nets, and those other primitives do not explicitly (usually via net labels or net ports) specify a net, they follow the specified net; 2. If other primitives have specified a net, the creation fails
</td></tr>
<tr><td>
color
</td><td>
string \| null
</td><td>
_(Optional)_ Wire color, `null` indicates the default
</td></tr>
<tr><td>
lineWidth
</td><td>
number \| null
</td><td>
_(Optional)_ Line width, range `1-10`<!-- -->. `null` indicates the default
</td></tr>
<tr><td>
lineType
</td><td>
[ESCH\_PrimitiveLineType](../enums/ESCH_PrimitiveLineType.md) \| null
</td><td>
_(Optional)_ Line type. `null` indicates the default
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitiveWire](./ISCH_PrimitiveWire.md) \| undefined>
Wire primitive object
## Example
```javascript
// 1. 生成随机起点坐标,避免与画布上已有的导线重合(SCH 坐标单位 10mil)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一条两段相连的 L 形导线:先向右再向上,段与段必须首尾相连且各自水平或垂直
const wire = await eda.sch_PrimitiveWire.create(
[[x, y, x + 400, y], [x + 400, y, x + 400, y + 200]],
'SIG_A', // 网络名称(自由字符串,未指定时按落点自动推断)
'#FF0000', // 导线颜色
6, // 线宽(范围 1-10)
1 // 线型:1 = DASHED(虚线)
);
// 3. 创建类保留现场,不删除图元;Line 读回是画布规格化坐标(端点顺序可能与传入相反),只打印不做断言
console.log('primitiveId:', wire.getState_PrimitiveId());
console.log('primitiveType:', wire.getState_PrimitiveType());
console.log('net:', wire.getState_Net());
console.log('color:', wire.getState_Color());
console.log('lineWidth:', wire.getState_LineWidth());
console.log('line:', JSON.stringify(wire.getState_Line()));
```
### delete
# SCH\_PrimitiveWire.delete() method
> 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.
Delete Wire
## Signature
```typescript
function delete(primitiveIds: string | ISCH_PrimitiveWire | Array<string> | Array<ISCH_PrimitiveWire>): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string \| [ISCH\_PrimitiveWire](./ISCH_PrimitiveWire.md) \| Array<string> \| Array<[ISCH\_PrimitiveWire](./ISCH_PrimitiveWire.md)<!-- -->>
</td><td>
Wire primitive ID or Wire primitive object
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Delete Whether the operation is successful
## Example
```javascript
// 1. 创建两条待删除的测试导线(随机坐标避免重合,SCH 坐标单位 10mil)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const wire1 = await eda.sch_PrimitiveWire.create([x, y, x + 400, y], 'SIG_A');
const wire2 = await eda.sch_PrimitiveWire.create([x, y + 200, x + 400, y + 200], 'SIG_B');
// 2. 记录删除前的导线数量
const beforeCount = (await eda.sch_PrimitiveWire.getAll()).length;
// 3. 分别以 ID 字符串和图元对象两种形式删除两条导线
const deleted1 = await eda.sch_PrimitiveWire.delete(wire1.getState_PrimitiveId());
const deleted2 = await eda.sch_PrimitiveWire.delete(wire2);
// 4. 删除类保留现场(图元已删除,不恢复)
const afterCount = (await eda.sch_PrimitiveWire.getAll()).length;
console.log('deleted by id:', deleted1);
console.log('deleted by object:', deleted2);
console.log('beforeCount:', beforeCount, '→ afterCount:', afterCount);
```
### get
# SCH\_PrimitiveWire.get() method
> 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.
Get Wire
## Signature
```typescript
function get(primitiveIds: string): Promise<ISCH_PrimitiveWire | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string
</td><td>
Wire primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitiveWire](./ISCH_PrimitiveWire.md) \| undefined>
Wire primitive object, `undefined` indicates that the retrieval failed
## Example
```javascript
// 1. 创建两条测试导线,分别属于不同网络(随机坐标避免重合,SCH 坐标单位 10mil)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const wire1 = await eda.sch_PrimitiveWire.create([x, y, x + 400, y], 'SIG_A');
const wire2 = await eda.sch_PrimitiveWire.create([x, y + 200, x + 400, y + 200], 'SIG_B');
// 2. 传单个 ID 字符串,返回单条导线对象
const single = await eda.sch_PrimitiveWire.get(wire1.getState_PrimitiveId());
// 3. 传 ID 数组,返回导线对象数组(任一 ID 未匹配不影响其它图元的返回)
const arr = await eda.sch_PrimitiveWire.get([wire1.getState_PrimitiveId(), wire2.getState_PrimitiveId()]);
// 4. 清理测试图元(查询类需要清理)
await eda.sch_PrimitiveWire.delete([wire1.getState_PrimitiveId(), wire2.getState_PrimitiveId()]);
console.log('single net:', single.getState_Net());
console.log('array length:', arr.length);
console.log('wire2 net:', arr[1].getState_Net());
```
### get_1
# SCH\_PrimitiveWire.get() method
> 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.
Get Wire
## Signature
```typescript
function get(primitiveIds: Array<string>): Promise<Array<ISCH_PrimitiveWire>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
Array<string>
</td><td>
Wire primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<Array<[ISCH\_PrimitiveWire](./ISCH_PrimitiveWire.md)<!-- -->>>
Wire primitive object; an empty array indicates that the retrieval failed
## Remarks
If multiple primitive IDs are passed in, a primitive ID that is not matched will not affect the return of other primitives; that is, fewer primitive objects than the number of primitive IDs passed in may be returned.
### getall
# SCH\_PrimitiveWire.getAll() method
> 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.
Get all Wire
## Signature
```typescript
function getAll(net?: string | Array<string>): Promise<Array<ISCH_PrimitiveWire>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string \| Array<string>
</td><td>
_(Optional)_ Net name
</td></tr>
</tbody></table>
## Returns
Promise<Array<[ISCH\_PrimitiveWire](./ISCH_PrimitiveWire.md)<!-- -->>>
Array of Wire primitive objects
## Example
```javascript
// 1. 创建两条测试导线,分别属于不同网络(随机坐标避免重合,SCH 坐标单位 10mil)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const wire1 = await eda.sch_PrimitiveWire.create([x, y, x + 400, y], 'SIG_A');
const wire2 = await eda.sch_PrimitiveWire.create([x, y + 200, x + 400, y + 200], 'SIG_B');
const wire1Id = wire1.getState_PrimitiveId();
// 2. 不传参数,获取当前原理图页上的全部导线
const all = await eda.sch_PrimitiveWire.getAll();
// 3. 传网络名称,只获取该网络的导线
const onlyA = await eda.sch_PrimitiveWire.getAll('SIG_A');
// 4. 清理测试图元(查询类需要清理)
await eda.sch_PrimitiveWire.delete([wire1.getState_PrimitiveId(), wire2.getState_PrimitiveId()]);
console.log('total wires:', all.length);
console.log('marker wire found:', all.some(w => w.getState_PrimitiveId() === wire1Id));
console.log('SIG_A wires:', onlyA.length);
console.log('SIG_A all same net:', onlyA.every(w => w.getState_Net() === 'SIG_A'));
```
### getallprimitiveid
# SCH\_PrimitiveWire.getAllPrimitiveId() method
> 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.
Get all Wire primitive IDs
## Signature
```typescript
function getAllPrimitiveId(net?: string | Array<string>): Promise<Array<string>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
net
</td><td>
string \| Array<string>
</td><td>
_(Optional)_ Net name
</td></tr>
</tbody></table>
## Returns
Promise<Array<string>>
Array of Wire primitive IDs
## Example
```javascript
// 1. 创建两条测试导线,分别属于不同网络(随机坐标避免重合,SCH 坐标单位 10mil)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const wire1 = await eda.sch_PrimitiveWire.create([x, y, x + 400, y], 'SIG_A');
const wire2 = await eda.sch_PrimitiveWire.create([x, y + 200, x + 400, y + 200], 'SIG_B');
const wire1Id = wire1.getState_PrimitiveId();
// 2. 不传参数,获取全部导线的图元 ID
const allIds = await eda.sch_PrimitiveWire.getAllPrimitiveId();
// 3. 传网络名称,只获取该网络导线的图元 ID
const onlyAIds = await eda.sch_PrimitiveWire.getAllPrimitiveId('SIG_A');
// 4. 清理测试图元(查询类需要清理)
await eda.sch_PrimitiveWire.delete([wire1.getState_PrimitiveId(), wire2.getState_PrimitiveId()]);
console.log('total wire ids:', allIds.length);
console.log('marker id in list:', allIds.includes(wire1Id));
console.log('SIG_A id count:', onlyAIds.length);
console.log('SIG_A contains marker:', onlyAIds.includes(wire1Id));
```
### modify
# SCH\_PrimitiveWire.modify() method
> 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.
Modify Wire
## Signature
```typescript
function modify(
primitiveId: string | ISCH_PrimitiveWire,
property: {
line?: Array<number> | Array<Array<number>>;
net?: string;
color?: string | null;
lineWidth?: number | null;
lineType?: ESCH_PrimitiveLineType | null;
},
): Promise<ISCH_PrimitiveWire | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveId
</td><td>
string \| [ISCH\_PrimitiveWire](./ISCH_PrimitiveWire.md)
</td><td>
Wire primitive ID or Wire primitive object
</td></tr>
<tr><td>
property
</td><td>
{ line?: Array<number> \| Array<Array<number>>; net?: string; color?: string \| null; lineWidth?: number \| null; lineType?: [ESCH\_PrimitiveLineType](../enums/ESCH_PrimitiveLineType.md) \| null }
</td><td>
Modify Parameter
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitiveWire](./ISCH_PrimitiveWire.md) \| undefined>
Wire primitive object
## Example
```javascript
// 1. 创建待修改的测试导线(随机坐标避免与画布已有导线重合)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const wire = await eda.sch_PrimitiveWire.create([x, y, x + 400, y], 'SIG_A', '#FF0000', 6, 1);
const wireId = wire.getState_PrimitiveId();
// 2. 读取修改前的网络、线宽与颜色
const beforeNet = wire.getState_Net();
const beforeWidth = wire.getState_LineWidth();
const beforeColor = wire.getState_Color();
// 3. 批量修改:网络 SIG_A → SIG_B、线宽 6 → 10、颜色改为绿色,路径改为向右再向上的 L 形
await eda.sch_PrimitiveWire.modify(wireId, {
line: [[x, y, x + 400, y], [x + 400, y, x + 400, y + 200]],
net: 'SIG_B',
lineWidth: 10,
color: '#00AA00',
});
// 4. modify 返回后需要重新 get() 才能读到画布上的最新值(Line 是规格化坐标,只打印不断言)
const refreshed = await eda.sch_PrimitiveWire.get(wireId);
// 5. 修改类保留现场,供观察修改结果
console.log('primitiveId:', wireId);
console.log('net:', beforeNet, '→', refreshed.getState_Net());
console.log('lineWidth:', beforeWidth, '→', refreshed.getState_LineWidth());
console.log('color:', beforeColor, '→', refreshed.getState_Color());
console.log('line:', JSON.stringify(refreshed.getState_Line()));
```
references/classes/SCH_PrimitivePin.md
# SCH\_PrimitivePin class
Schematic & symbol / pin primitive class
## Signature
```typescript
class SCH_PrimitivePin implements ISCH_PrimitiveAPI
```
**Implements:** [ISCH\_PrimitiveAPI](../interfaces/ISCH_PrimitiveAPI.md)
## Remarks
Pin primitives are only available in the symbol editor. In a schematic sheet, the pin associated with a symbol is called [a device pin primitive](./ISCH_PrimitiveComponentPin.md)
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[create(x, y, pinNumber, pinName, rotation, pinLength, pinColor, pinShape, pinType)](./SCH_PrimitivePin.md)
</td><td>
</td><td>
**_(BETA)_** Create Pin
</td></tr>
<tr><td>
[delete(primitiveIds)](./SCH_PrimitivePin.md)
</td><td>
</td><td>
**_(BETA)_** Delete Pin
</td></tr>
<tr><td>
[get(primitiveIds)](./SCH_PrimitivePin.md)
</td><td>
</td><td>
**_(BETA)_** Get Pin
</td></tr>
<tr><td>
[get(primitiveIds)](./SCH_PrimitivePin.md)
</td><td>
</td><td>
**_(BETA)_** Get Pin
</td></tr>
<tr><td>
[getAll()](./SCH_PrimitivePin.md)
</td><td>
</td><td>
**_(BETA)_** Get all Pin
</td></tr>
<tr><td>
[getAllPrimitiveId()](./SCH_PrimitivePin.md)
</td><td>
</td><td>
**_(BETA)_** Get all Pin primitive IDs
</td></tr>
<tr><td>
[modify(primitiveId, property)](./SCH_PrimitivePin.md)
</td><td>
</td><td>
**_(BETA)_** Modify Pin
</td></tr>
</tbody></table>
---
## 方法详情
### create
# SCH\_PrimitivePin.create() method
> 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.
Create Pin
## Signature
```typescript
function create(
x: number,
y: number,
pinNumber: string,
pinName?: string,
rotation?: number,
pinLength?: number,
pinColor?: string | null,
pinShape?: ESCH_PrimitivePinShape,
pinType?: ESCH_PrimitivePinType,
): Promise<ISCH_PrimitivePin | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
x
</td><td>
number
</td><td>
X coordinate
</td></tr>
<tr><td>
y
</td><td>
number
</td><td>
Y coordinate
</td></tr>
<tr><td>
pinNumber
</td><td>
string
</td><td>
Pin number
</td></tr>
<tr><td>
pinName
</td><td>
string
</td><td>
_(Optional)_ Pin name
</td></tr>
<tr><td>
rotation
</td><td>
number
</td><td>
_(Optional)_ Rotation angle. Options: `0` `90` `180` `270`
</td></tr>
<tr><td>
pinLength
</td><td>
number
</td><td>
_(Optional)_ Pin length
</td></tr>
<tr><td>
pinColor
</td><td>
string \| null
</td><td>
_(Optional)_ Pin color, `null` indicates the default
</td></tr>
<tr><td>
pinShape
</td><td>
[ESCH\_PrimitivePinShape](../enums/ESCH_PrimitivePinShape.md)
</td><td>
_(Optional)_ Pin shape
</td></tr>
<tr><td>
pinType
</td><td>
[ESCH\_PrimitivePinType](../enums/ESCH_PrimitivePinType.md)
</td><td>
_(Optional)_ Pin type
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitivePin](./ISCH_PrimitivePin.md) \| undefined>
Pin primitive object
## Example
```javascript
// 0. 引脚图元仅符号编辑器可用:优先复用测试符号,没有则新建后打开
// (当前版本非空关键字 search 会抛错,用空关键字列出后按名称过滤)
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('', libUuid, [], undefined, 100, 1);
const hit = found.find(s => s.name === '嘉立创示例_Pin测试符号');
const symUuid = hit ? hit.uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 随机放置坐标,避免与符号上已有引脚重合(SCH 坐标单位 10mil)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建编号 1、名为 CLK 的引脚:朝向 90 度、长 20、红色、时钟形状、输入类型
const pin = await eda.sch_PrimitivePin.create(x, y, '1', 'CLK', 90, 20, '#FF0000', 'Clock', 'IN');
// 3. 创建类保留现场,不删除图元
console.log('primitiveId:', pin.getState_PrimitiveId());
console.log('primitiveType:', pin.getState_PrimitiveType());
console.log('pinNumber:', pin.getState_PinNumber(), 'pinName:', pin.getState_PinName());
console.log('x:', pin.getState_X(), 'y:', pin.getState_Y());
console.log('pinLength:', pin.getState_PinLength());
console.log('pinColor:', pin.getState_PinColor());
console.log('pinShape:', pin.getState_PinShape(), 'pinType:', pin.getState_pinType());
```
### delete
# SCH\_PrimitivePin.delete() method
> 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.
Delete Pin
## Signature
```typescript
function delete(primitiveIds: string | ISCH_PrimitivePin | Array<string> | Array<ISCH_PrimitivePin>): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string \| [ISCH\_PrimitivePin](./ISCH_PrimitivePin.md) \| Array<string> \| Array<[ISCH\_PrimitivePin](./ISCH_PrimitivePin.md)<!-- -->>
</td><td>
Pin primitive ID or Pin primitive object
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Delete Whether the operation is successful
## Example
```javascript
// 0. 引脚图元仅符号编辑器可用:优先复用测试符号,没有则新建后打开
// (当前版本非空关键字 search 会抛错,用空关键字列出后按名称过滤)
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('', libUuid, [], undefined, 100, 1);
const hit = found.find(s => s.name === '嘉立创示例_Pin测试符号');
const symUuid = hit ? hit.uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 创建两个待删除的测试引脚(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const pin1 = await eda.sch_PrimitivePin.create(x, y, '1', 'DEL1', 0, 10, null, 'None', 'Passive');
const pin2 = await eda.sch_PrimitivePin.create(x, y + 200, '2', 'DEL2', 0, 10, null, 'None', 'Passive');
// 2. 记录删除前的引脚数量
const beforeCount = (await eda.sch_PrimitivePin.getAll()).length;
// 3. 分别以 ID 字符串和图元对象两种形式删除两个引脚
const deleted1 = await eda.sch_PrimitivePin.delete(pin1.getState_PrimitiveId());
const deleted2 = await eda.sch_PrimitivePin.delete(pin2);
// 4. 删除类保留现场(图元已删除,不恢复)
const afterCount = (await eda.sch_PrimitivePin.getAll()).length;
console.log('deleted by id:', deleted1);
console.log('deleted by object:', deleted2);
console.log('beforeCount:', beforeCount, '→ afterCount:', afterCount);
```
### get
# SCH\_PrimitivePin.get() method
> 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.
Get Pin
## Signature
```typescript
function get(
primitiveIds: string,
): Promise<ISCH_PrimitivePin | ISCH_PrimitiveComponentPin | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
string
</td><td>
Pin primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitivePin](./ISCH_PrimitivePin.md) \| [ISCH\_PrimitiveComponentPin](./ISCH_PrimitiveComponentPin.md) \| undefined>
Pin primitive object, `undefined` indicates that the retrieval failed
## Example
```javascript
// 0. 引脚图元仅符号编辑器可用:优先复用测试符号,没有则新建后打开
// (当前版本非空关键字 search 会抛错,用空关键字列出后按名称过滤)
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('', libUuid, [], undefined, 100, 1);
const hit = found.find(s => s.name === '嘉立创示例_Pin测试符号');
const symUuid = hit ? hit.uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 在符号画布上创建两个测试引脚(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const pin1 = await eda.sch_PrimitivePin.create(x, y, '1', 'INA', 0, 10, null, 'None', 'IN');
const pin2 = await eda.sch_PrimitivePin.create(x, y + 200, '2', 'INB', 0, 10, null, 'None', 'OUT');
const id1 = pin1.getState_PrimitiveId();
const id2 = pin2.getState_PrimitiveId();
// 2. 传单个 ID 字符串,返回单个引脚对象
const single = await eda.sch_PrimitivePin.get(id1);
// 3. 传 ID 数组,返回引脚对象数组(任一 ID 未匹配不影响其它图元的返回)
const arr = await eda.sch_PrimitivePin.get([id1, id2]);
// 4. 清理测试引脚(查询类需要清理)
await eda.sch_PrimitivePin.delete([id1, id2]);
console.log('single pinNumber:', single.getState_PinNumber());
console.log('array length:', arr.length);
console.log('pin2 name:', arr[1].getState_PinName());
console.log('pin2 type:', arr[1].getState_pinType());
```
### get_1
# SCH\_PrimitivePin.get() method
> 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.
Get Pin
## Signature
```typescript
function get(
primitiveIds: Array<string>,
): Promise<Array<ISCH_PrimitivePin | ISCH_PrimitiveComponentPin>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveIds
</td><td>
Array<string>
</td><td>
Pin primitive ID, which can be a string or an array of strings. If it is an array, an array is also returned
</td></tr>
</tbody></table>
## Returns
Promise<Array<[ISCH\_PrimitivePin](./ISCH_PrimitivePin.md) \| [ISCH\_PrimitiveComponentPin](./ISCH_PrimitiveComponentPin.md)<!-- -->>>
Pin primitive object; an empty array indicates that the retrieval failed
## Remarks
If multiple primitive IDs are passed in, a primitive ID that is not matched will not affect the return of other primitives; that is, fewer primitive objects than the number of primitive IDs passed in may be returned.
### getall
# SCH\_PrimitivePin.getAll() method
> 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.
Get all Pin
## Signature
```typescript
function getAll(): Promise<Array<ISCH_PrimitivePin>>;
```
## Returns
Promise<Array<[ISCH\_PrimitivePin](./ISCH_PrimitivePin.md)<!-- -->>>
Array of Pin primitive objects
## Example
```javascript
// 0. 引脚图元仅符号编辑器可用:优先复用测试符号,没有则新建后打开
// (当前版本非空关键字 search 会抛错,用空关键字列出后按名称过滤)
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('', libUuid, [], undefined, 100, 1);
const hit = found.find(s => s.name === '嘉立创示例_Pin测试符号');
const symUuid = hit ? hit.uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 创建一个测试引脚作为查找目标(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const pin = await eda.sch_PrimitivePin.create(x, y, '9', 'MARK', 0, 10, null, 'None', 'Passive');
const pinId = pin.getState_PrimitiveId();
// 2. 获取当前符号上的全部引脚
const all = await eda.sch_PrimitivePin.getAll();
// 3. 清理测试引脚(查询类需要清理)
await eda.sch_PrimitivePin.delete([pinId]);
console.log('total pins:', all.length);
console.log('marker pin found:', all.some(p => p.getState_PrimitiveId() === pinId));
console.log('marker pinName:', all.find(p => p.getState_PrimitiveId() === pinId).getState_PinName());
```
### getallprimitiveid
# SCH\_PrimitivePin.getAllPrimitiveId() method
> 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.
Get all Pin primitive IDs
## Signature
```typescript
function getAllPrimitiveId(): Promise<Array<string>>;
```
## Returns
Promise<Array<string>>
Array of Pin primitive IDs
## Example
```javascript
// 0. 引脚图元仅符号编辑器可用:优先复用测试符号,没有则新建后打开
// (当前版本非空关键字 search 会抛错,用空关键字列出后按名称过滤)
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('', libUuid, [], undefined, 100, 1);
const hit = found.find(s => s.name === '嘉立创示例_Pin测试符号');
const symUuid = hit ? hit.uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 创建一个测试引脚作为查找目标(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const pin = await eda.sch_PrimitivePin.create(x, y, '8', 'IDS', 0, 10, null, 'None', 'Passive');
const pinId = pin.getState_PrimitiveId();
// 2. 获取全部引脚的图元 ID
const allIds = await eda.sch_PrimitivePin.getAllPrimitiveId();
// 3. 清理测试引脚(查询类需要清理)
await eda.sch_PrimitivePin.delete([pinId]);
console.log('total pin ids:', allIds.length);
console.log('marker id in list:', allIds.includes(pinId));
```
### modify
# SCH\_PrimitivePin.modify() method
> 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.
Modify Pin
## Signature
```typescript
function modify(
primitiveId: string | ISCH_PrimitivePin | ISCH_PrimitiveComponentPin,
property: {
x?: number;
y?: number;
pinNumber?: string;
pinName?: string;
rotation?: number;
pinLength?: number;
pinColor?: string | null;
pinShape?: ESCH_PrimitivePinShape;
pinType?: ESCH_PrimitivePinType;
noConnected?: boolean;
otherProperty?: Record<string, string | number | boolean>;
},
): Promise<ISCH_PrimitivePin | ISCH_PrimitiveComponentPin | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
primitiveId
</td><td>
string \| [ISCH\_PrimitivePin](./ISCH_PrimitivePin.md) \| [ISCH\_PrimitiveComponentPin](./ISCH_PrimitiveComponentPin.md)
</td><td>
Primitive ID
</td></tr>
<tr><td>
property
</td><td>
{ x?: number; y?: number; pinNumber?: string; pinName?: string; rotation?: number; pinLength?: number; pinColor?: string \| null; pinShape?: [ESCH\_PrimitivePinShape](../enums/ESCH_PrimitivePinShape.md)<!-- -->; pinType?: [ESCH\_PrimitivePinType](../enums/ESCH_PrimitivePinType.md)<!-- -->; noConnected?: boolean; otherProperty?: Record<string, string \| number \| boolean> }
</td><td>
Modify Parameter
</td></tr>
</tbody></table>
## Returns
Promise<[ISCH\_PrimitivePin](./ISCH_PrimitivePin.md) \| [ISCH\_PrimitiveComponentPin](./ISCH_PrimitiveComponentPin.md) \| undefined>
Pin primitive object
## Example
```javascript
// 0. 引脚图元仅符号编辑器可用:优先复用测试符号,没有则新建后打开
// (当前版本非空关键字 search 会抛错,用空关键字列出后按名称过滤)
const libUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const found = await eda.lib_Symbol.search('', libUuid, [], undefined, 100, 1);
const hit = found.find(s => s.name === '嘉立创示例_Pin测试符号');
const symUuid = hit ? hit.uuid : await eda.lib_Symbol.create(libUuid, '嘉立创示例_Pin测试符号');
await eda.lib_Symbol.openInEditor(symUuid, libUuid);
// 1. 创建待修改的测试引脚(随机坐标避免重合)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const pin = await eda.sch_PrimitivePin.create(x, y, '1', 'CLK', 0, 10, null, 'None', 'IN');
const pinId = pin.getState_PrimitiveId();
// 2. 记录修改前的编号、名称与长度
const beforeNumber = pin.getState_PinNumber();
const beforeName = pin.getState_PinName();
const beforeLength = pin.getState_PinLength();
// 3. 批量修改:编号 1 → 7、名称 CLK → XTAL、长度 10 → 20、朝向 0 → 90 度
await eda.sch_PrimitivePin.modify(pinId, { pinNumber: '7', pinName: 'XTAL', pinLength: 20, rotation: 90 });
// 4. modify 返回后需要重新 get() 才能读到画布上的最新值
const refreshed = await eda.sch_PrimitivePin.get(pinId);
// 5. 修改类保留现场,供观察修改结果
console.log('primitiveId:', pinId);
console.log('pinNumber:', beforeNumber, '→', refreshed.getState_PinNumber());
console.log('pinName:', beforeName, '→', refreshed.getState_PinName());
console.log('pinLength:', beforeLength, '→', refreshed.getState_PinLength());
console.log('rotation:', pin.getState_Rotation(), '→', refreshed.getState_Rotation());
```
references/classes/SCH_Utils.md
# SCH\_Utils class
Schematic & symbol / utility class
## Signature
```typescript
class SCH_Utils
```
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[splitLines(lines)](./SCH_Utils.md)
</td><td>
</td><td>
**_(BETA)_** Split polyline
</td></tr>
</tbody></table>
---
## 方法详情
### splitlines
# SCH\_Utils.splitLines() method
> 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.
Split polyline
## Signature
```typescript
function splitLines(
lines: Array<number | Array<number>>,
): Array<Array<number | Array<number>>> | undefined;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
lines
</td><td>
Array<number \| Array<number>>
</td><td>
Polyline coordinate group. Each segment is a continuous line described by `[x1, y1, x2, y2, x3, y3]`
</td></tr>
</tbody></table>
## Returns
Array<Array<number \| Array<number>>> \| undefined
## Remarks
Splits polyline coordinate groups that have no connections to each other into multiple polylines. Regardless of whether there are multiple polylines, this function wraps an extra layer of array around the input data; it is recommended for scenarios containing polylines such as [ISCH\_PrimitiveBus](./ISCH_PrimitiveBus.md) and [ISCH\_PrimitiveWire](./ISCH_PrimitiveWire.md)
## Example
```javascript
// 1. 一条连续线的扁平坐标(SCH 坐标单位是 10mil,100 ≈ 25.4mm)
const flatLine = [100, 100, 400, 100, 400, 300];
const single = eda.sch_Utils.splitLines(flatLine);
console.log('单条连续线:', JSON.stringify(single), ',多段线条数:', single.length);
// 2. 相互断开的两条线——各自保留为列表中的独立条目
const separated = eda.sch_Utils.splitLines([
[100, 100, 300, 100],
[500, 100, 700, 100, 700, 300],
]);
console.log('断开的两条线:', JSON.stringify(separated), ',多段线条数:', separated.length);
// 3. 实际场景:读取画布上导线的坐标数据(嵌套段数组)并归一化
const wire = await eda.sch_PrimitiveWire.create([800, 300, 1200, 300, 1200, 500]);
const lineData = wire.getState_Line();
console.log('导线原始坐标:', JSON.stringify(lineData));
const polylines = eda.sch_Utils.splitLines(lineData);
console.log('导线归一化结果:', JSON.stringify(polylines), ',多段线条数:', polylines.length);
// 4. 清理测试图元(查询演示,保持画布干净)
await eda.sch_PrimitiveWire.delete([wire.getState_PrimitiveId()]);
```
references/classes/SYS_ClientUrl.md
# SYS\_ClientUrl class
System / external request class
## Signature
```typescript
class SYS_ClientUrl
```
## Remarks
Make secure cURL requests to external servers
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[request(url, method, data, options, succeedCallFn)](./SYS_ClientUrl.md)
</td><td>
</td><td>
Make an immediate request
</td></tr>
</tbody></table>
---
## 方法详情
### request
# SYS\_ClientUrl.request() method
Make an immediate request
## Signature
```typescript
function request(
url: string,
method?: 'GET' | 'POST' | 'HEAD' | 'PUT' | 'DELETE' | 'PATCH',
data?: string | Blob | FormData | URLSearchParams,
options?: { headers?: { [header: string]: any }; integrity?: string },
succeedCallFn?: (data: Response) => void | Promise<void>,
): Promise<Response>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
url
</td><td>
string
</td><td>
Request URL
</td></tr>
<tr><td>
method
</td><td>
'GET' \| 'POST' \| 'HEAD' \| 'PUT' \| 'DELETE' \| 'PATCH'
</td><td>
_(Optional)_ Request method
</td></tr>
<tr><td>
data
</td><td>
string \| Blob \| FormData \| URLSearchParams
</td><td>
_(Optional)_ Data to be sent with the request, which can be direct data or a [URLSearchParams](https://developer.mozilla.org/docs/Web/API/URLSearchParams) object. If the method is `HEAD` or `GET`<!-- -->, this parameter will be ignored
</td></tr>
<tr><td>
options
</td><td>
\{ headers?: \{ \[header: string\]: any \}; integrity?: string \}
</td><td>
_(Optional)_ Request options
</td></tr>
<tr><td>
succeedCallFn
</td><td>
(data: Response) => void \| Promise<void>
</td><td>
_(Optional)_ Function to call back after the request succeeds
</td></tr>
</tbody></table>
## Returns
Promise<Response>
The return result of Fetch
## Remarks
Please note that the requested site must allow cross-origin resource sharing (CORS); otherwise, the API will always return an error result.
developer.mozilla.org/docs/Web/HTTP/CORS \| Cross-Origin Resource Sharing (CORS) - MDN<!-- -->}<!-- -->.
Note: This API requires the user to enable the extension external interaction permission, if not enabled, it will always `throw Error`
## Example
```javascript
// 1. 发起 GET 请求(本例用本机桥接地址演示,实际使用时换成自己的服务地址)
const response = await eda.sys_ClientUrl.request('http://localhost:49620/health', 'GET');
// 2. 读取响应状态码
console.log('状态码:', response.status);
// 3. 读取响应内容(Response 是标准 fetch 返回值,用法与浏览器一致)
const body = await response.text();
console.log('响应内容:', body);
```
references/classes/SYS_Environment.md
# SYS\_Environment class
System / runtime environment class
## Signature
```typescript
class SYS_Environment
```
## Remarks
Get the runtime environment parameters of EasyEDA Pro
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[getEditorCompliedDate()](./SYS_Environment.md)
</td><td>
</td><td>
Get the editor compiled date
</td></tr>
<tr><td>
[getEditorCurrentVersion(onlySemantic)](./SYS_Environment.md)
</td><td>
</td><td>
Get the current version of the editor
</td></tr>
<tr><td>
[getUserInfo()](./SYS_Environment.md)
</td><td>
</td><td>
Get user information
</td></tr>
<tr><td>
[isClient()](./SYS_Environment.md)
</td><td>
</td><td>
Whether it is in the client environment
</td></tr>
<tr><td>
[isEasyEDAProEdition()](./SYS_Environment.md)
</td><td>
</td><td>
Whether it is the EasyEDA Pro edition
</td></tr>
<tr><td>
[isEditorCurrentVersionGreaterThanOrEqual(version)](./SYS_Environment.md)
</td><td>
</td><td>
判断传入版本是否高于或等于编辑器当前版本
</td></tr>
<tr><td>
[isEditorCurrentVersionLessThanOrEqual(version)](./SYS_Environment.md)
</td><td>
</td><td>
判断传入版本是否低于或等于编辑器当前版本
</td></tr>
<tr><td>
[isHalfOfflineMode()](./SYS_Environment.md)
</td><td>
</td><td>
Whether it is half-offline mode
</td></tr>
<tr><td>
[isJLCEDAProEdition()](./SYS_Environment.md)
</td><td>
</td><td>
Whether it is the EasyEDA Pro edition
</td></tr>
<tr><td>
[isOfflineMode()](./SYS_Environment.md)
</td><td>
</td><td>
Whether it is fully-offline mode
</td></tr>
<tr><td>
[isOnlineMode()](./SYS_Environment.md)
</td><td>
</td><td>
Whether it is online mode
</td></tr>
<tr><td>
[isProPrivateEdition()](./SYS_Environment.md)
</td><td>
</td><td>
Whether it is the private deployment edition
</td></tr>
<tr><td>
[isWeb()](./SYS_Environment.md)
</td><td>
</td><td>
Whether it is in the browser environment
</td></tr>
</tbody></table>
---
## 方法详情
### geteditorcomplieddate
# SYS\_Environment.getEditorCompliedDate() method
Get the editor compiled date
## Signature
```typescript
function getEditorCompliedDate(): string;
```
## Returns
string
Editor compiled date
## Example
```javascript
// 1. 读取编辑器编译日期(同步返回字符串)
const compliedDate = eda.sys_Environment.getEditorCompliedDate();
// 2. 输出编译日期(如 2024-06-01,具体以当前环境为准)
console.log('编辑器编译日期:', compliedDate);
```
### geteditorcurrentversion
# SYS\_Environment.getEditorCurrentVersion() method
Get the current version of the editor
## Signature
```typescript
function getEditorCurrentVersion(onlySemantic?: boolean): string;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
onlySemantic
</td><td>
boolean
</td><td>
_(Optional)_ Whether to only return the semantic version number. ADD since EDA v3.2.176, ADD since EDA v4.1.13
</td></tr>
</tbody></table>
## Returns
string
Current version of the editor
## Example
```javascript
// 1. 读取编辑器版本号(同步返回字符串)
const version = eda.sys_Environment.getEditorCurrentVersion();
// 2. 输出版本号(如 2.2.36,具体以当前环境为准)
console.log('编辑器当前版本:', version);
```
### getuserinfo
# SYS\_Environment.getUserInfo() method
Get user information
## Signature
```typescript
function getUserInfo(): {
username?: string;
nickname?: string;
avatar?: string;
uuid?: string;
customerCode?: string;
};
```
## Returns
\{ username?: string; nickname?: string; avatar?: string; uuid?: string; customerCode?: string \}
User information
## Example
```javascript
// 1. 读取当前用户信息(同步返回对象)
const userInfo = eda.sys_Environment.getUserInfo();
// 2. 输出用户信息(uuid 是账号的唯一标识,可作为业务数据的关联键)
console.log('用户名:', userInfo?.username);
console.log('昵称:', userInfo?.nickname);
console.log('用户 uuid:', userInfo?.uuid);
console.log('客户编号:', userInfo?.customerCode);
```
### isclient
# SYS\_Environment.isClient() method
Whether it is in the client environment
## Signature
```typescript
function isClient(): boolean;
```
## Returns
boolean
Whether it is in the client environment
## Example
```javascript
// 1. 判断当前是否为客户端环境(同步返回布尔值)
const isClient = eda.sys_Environment.isClient();
// 2. 输出判断结果(桌面客户端为 true,网页版为 false)
console.log('是否客户端环境:', isClient);
```
### iseasyedaproedition
# SYS\_Environment.isEasyEDAProEdition() method
Whether it is the EasyEDA Pro edition
## Signature
```typescript
function isEasyEDAProEdition(): boolean;
```
## Returns
boolean
Whether it is the EasyEDA Pro edition
## Example
```javascript
// 1. 判断是否为 EasyEDA Pro 国际版(同步返回布尔值)
const isEasyEDAPro = eda.sys_Environment.isEasyEDAProEdition();
// 2. 输出判断结果(国际版为 true,嘉立创 EDA 专业版为 false)
console.log('是否 EasyEDA Pro 国际版:', isEasyEDAPro);
```
### iseditorcurrentversiongreaterthanorequal
# SYS\_Environment.isEditorCurrentVersionGreaterThanOrEqual() method
判断传入版本是否高于或等于编辑器当前版本
## Signature
```typescript
function isEditorCurrentVersionGreaterThanOrEqual(version: string): boolean;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
version
</td><td>
string
</td><td>
传入的版本
</td></tr>
</tbody></table>
## Returns
boolean
传入版本是否高于或等于编辑器当前版本
## Example
```javascript
// 1. 判断传入版本是否高于或等于当前编辑器版本(同步返回布尔值)
const isGe = eda.sys_Environment.isEditorCurrentVersionGreaterThanOrEqual('4.1.13');
// 2. 输出判断结果
console.log('传入版本是否高于或等于当前版本:', isGe);
```
### iseditorcurrentversionlessthanorequal
# SYS\_Environment.isEditorCurrentVersionLessThanOrEqual() method
判断传入版本是否低于或等于编辑器当前版本
## Signature
```typescript
function isEditorCurrentVersionLessThanOrEqual(version: string): boolean;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
version
</td><td>
string
</td><td>
传入的版本
</td></tr>
</tbody></table>
## Returns
boolean
传入版本是否低于或等于编辑器当前版本
## Example
```javascript
// 1. 判断传入版本是否低于或等于当前编辑器版本(同步返回布尔值)
const isLe = eda.sys_Environment.isEditorCurrentVersionLessThanOrEqual('4.1.13');
// 2. 输出判断结果
console.log('传入版本是否低于或等于当前版本:', isLe);
```
### ishalfofflinemode
# SYS\_Environment.isHalfOfflineMode() method
Whether it is half-offline mode
## Signature
```typescript
function isHalfOfflineMode(): boolean;
```
## Returns
boolean
Whether it is half-offline mode
## Example
```javascript
// 1. 判断是否为半离线模式(同步返回布尔值)
const isHalfOffline = eda.sys_Environment.isHalfOfflineMode();
// 2. 输出判断结果(半离线模式为 true)
console.log('是否半离线模式:', isHalfOffline);
```
### isjlcedaproedition
# SYS\_Environment.isJLCEDAProEdition() method
Whether it is the EasyEDA Pro edition
## Signature
```typescript
function isJLCEDAProEdition(): boolean;
```
## Returns
boolean
Whether it is the EasyEDA Pro edition
## Example
```javascript
// 1. 判断是否为嘉立创 EDA 专业版(同步返回布尔值)
const isJLCEDAPro = eda.sys_Environment.isJLCEDAProEdition();
// 2. 输出判断结果(嘉立创 EDA 专业版为 true)
console.log('是否嘉立创 EDA 专业版:', isJLCEDAPro);
```
### isofflinemode
# SYS\_Environment.isOfflineMode() method
Whether it is fully-offline mode
## Signature
```typescript
function isOfflineMode(): boolean;
```
## Returns
boolean
Whether it is fully-offline mode
## Example
```javascript
// 1. 判断是否为全离线模式(同步返回布尔值)
const isOffline = eda.sys_Environment.isOfflineMode();
// 2. 输出判断结果(全离线模式为 true)
console.log('是否全离线模式:', isOffline);
```
### isonlinemode
# SYS\_Environment.isOnlineMode() method
Whether it is online mode
## Signature
```typescript
function isOnlineMode(): boolean;
```
## Returns
boolean
Whether it is online mode
## Example
```javascript
// 1. 判断是否为在线模式(同步返回布尔值)
const isOnline = eda.sys_Environment.isOnlineMode();
// 2. 输出判断结果(在线模式为 true)
console.log('是否在线模式:', isOnline);
```
### isproprivateedition
# SYS\_Environment.isProPrivateEdition() method
Whether it is the private deployment edition
## Signature
```typescript
function isProPrivateEdition(): boolean;
```
## Returns
boolean
Whether it is the private deployment edition
## Example
```javascript
// 1. 判断是否为私有化部署版本(同步返回布尔值)
const isPrivateEdition = eda.sys_Environment.isProPrivateEdition();
// 2. 输出判断结果(私有化部署版为 true)
console.log('是否私有化部署版本:', isPrivateEdition);
```
### isweb
# SYS\_Environment.isWeb() method
Whether it is in the browser environment
## Signature
```typescript
function isWeb(): boolean;
```
## Returns
boolean
Whether it is in the browser environment
## Example
```javascript
// 1. 判断当前是否为浏览器环境(同步返回布尔值)
const isWeb = eda.sys_Environment.isWeb();
// 2. 输出判断结果(网页版为 true,桌面客户端为 false)
console.log('是否浏览器环境:', isWeb);
```
references/classes/SYS_Dialog.md
# SYS\_Dialog class
System / dialog class
## Signature
```typescript
class SYS_Dialog
```
## Remarks
Generate dialog windows
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[createDesignPortal()](./SYS_Dialog.md)
</td><td>
</td><td>
Create a communication entry for a componentized popup window
</td></tr>
<tr><td>
[showConfirmationMessage(content, title, mainButtonTitle, buttonTitle, callbackFn)](./SYS_Dialog.md)
</td><td>
</td><td>
Show a confirmation dialog
</td></tr>
<tr><td>
[showInformationMessage(content, title, buttonTitle)](./SYS_Dialog.md)
</td><td>
</td><td>
Show an information dialog
</td></tr>
<tr><td>
[showInputDialog(beforeContent, afterContent, title, type, value, otherProperty, callbackFn)](./SYS_Dialog.md)
</td><td>
</td><td>
**_(BETA)_** Show an input dialog
</td></tr>
<tr><td>
[showSelectDialog(options, beforeContent, afterContent, title, defaultOption, multiple, callbackFn)](./SYS_Dialog.md)
</td><td>
</td><td>
**_(BETA)_** Show a select dialog
</td></tr>
<tr><td>
[showSelectDialog(options, beforeContent, afterContent, title, defaultOption, multiple, callbackFn)](./SYS_Dialog.md)
</td><td>
</td><td>
**_(BETA)_** Show a multi-select dialog
</td></tr>
</tbody></table>
---
## 方法详情
### createdesignportal
# SYS\_Dialog.createDesignPortal() method
Create a communication entry for a componentized popup window
## Signature
```typescript
function createDesignPortal(): IDesignPortal;
```
## Returns
[IDesignPortal](../interfaces/IDesignPortal.md)
A communication object implementing IDesignPortal
## Remarks
Returns an IDesignPortal object, used by extensions in conjunction with the VirtualRender / virtual machine component of lc-editor-design-react. All communication (sending messages + receiving events) is encapsulated inside the object.
### showconfirmationmessage
# SYS\_Dialog.showConfirmationMessage() method
Show a confirmation dialog
## Signature
```typescript
function showConfirmationMessage(
content: string,
title?: string,
mainButtonTitle?: string,
buttonTitle?: string,
callbackFn?: (mainButtonClicked: boolean) => void,
): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
content
</td><td>
string
</td><td>
Message text. Line breaks can be used with `\n`
</td></tr>
<tr><td>
title
</td><td>
string
</td><td>
_(Optional)_ Popup window title
</td></tr>
<tr><td>
mainButtonTitle
</td><td>
string
</td><td>
_(Optional)_ Primary button title
</td></tr>
<tr><td>
buttonTitle
</td><td>
string
</td><td>
_(Optional)_ Primary button title
</td></tr>
<tr><td>
callbackFn
</td><td>
(mainButtonClicked: boolean) => void
</td><td>
_(Optional)_ Callback function
</td></tr>
</tbody></table>
## Returns
void
## Remarks
Show a window with confirmation and cancel buttons
## Example
```javascript
// 1. 弹出确认窗口,等待用户点击
eda.sys_Dialog.showConfirmationMessage(
'即将删除选中的 3 个图元,是否继续?',
'删除确认', // 窗口标题
'删除', // 主按钮(确认)
'取消', // 次按钮(取消)
(mainButtonClicked) => {
if (mainButtonClicked) {
console.log('用户点击了主按钮(删除)');
}
else {
console.log('用户点击了次按钮(取消)');
}
}
);
// 2. 窗口已弹出,本方法无返回值;回调需用户点击按钮后才会触发
console.log('已弹出确认窗口');
```
### showinformationmessage
# SYS\_Dialog.showInformationMessage() method
Show an information dialog
## Signature
```typescript
function showInformationMessage(content: string, title?: string, buttonTitle?: string): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
content
</td><td>
string
</td><td>
Message text. Line breaks can be used with `\n`
</td></tr>
<tr><td>
title
</td><td>
string
</td><td>
_(Optional)_ Popup window title
</td></tr>
<tr><td>
buttonTitle
</td><td>
string
</td><td>
_(Optional)_ Button title. If empty, the button is not displayed
</td></tr>
</tbody></table>
## Returns
void
## Remarks
Show a text message window
## Example
```javascript
// 1. 弹出消息窗口(content 用 \n 换行展示两行内容)
eda.sys_Dialog.showInformationMessage('DRC 检查完成\n 共检查 128 个图元,未发现违规', '检查结果', '知道了');
// 2. 窗口立即弹出;本方法无返回值,也不阻塞后续代码
console.log('已弹出消息窗口');
```
### showinputdialog
# SYS\_Dialog.showInputDialog() method
> 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.
Show an input dialog
## Signature
```typescript
function showInputDialog(
beforeContent?: string,
afterContent?: string,
title?: string,
type?:
| 'color'
| 'date'
| 'datetime-local'
| 'email'
| 'mouth'
| 'number'
| 'password'
| 'tel'
| 'text'
| 'time'
| 'url'
| 'week',
value?: string | number,
otherProperty?: {
max?: number;
maxlength?: number;
min?: number;
minlength?: number;
multiple?: boolean;
pattern?: RegExp;
placeholder?: string;
readonly?: boolean;
step?: number;
},
callbackFn?: (value: any) => void,
): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
beforeContent
</td><td>
string
</td><td>
_(Optional)_ Text above the input box
</td></tr>
<tr><td>
afterContent
</td><td>
string
</td><td>
_(Optional)_ Text below the input box
</td></tr>
<tr><td>
title
</td><td>
string
</td><td>
_(Optional)_ Popup window title
</td></tr>
<tr><td>
type
</td><td>
'color' \| 'date' \| 'datetime-local' \| 'email' \| 'mouth' \| 'number' \| 'password' \| 'tel' \| 'text' \| 'time' \| 'url' \| 'week'
</td><td>
_(Optional)_ Input box type
</td></tr>
<tr><td>
value
</td><td>
string \| number
</td><td>
_(Optional)_ Default value of the input box
</td></tr>
<tr><td>
otherProperty
</td><td>
\{ max?: number; maxlength?: number; min?: number; minlength?: number; multiple?: boolean; pattern?: RegExp; placeholder?: string; readonly?: boolean; step?: number \}
</td><td>
_(Optional)_ Other parameters. Refer to [The HTML Input element](https://developer.mozilla.org/docs/Web/HTML/Element/input#attributes)
</td></tr>
<tr><td>
callbackFn
</td><td>
(value: any) => void
</td><td>
_(Optional)_ Callback function
</td></tr>
</tbody></table>
## Returns
void
The value entered by the user, always of type `string`<!-- -->, unless the user clicks the \*\*Cancel\*\* button
## Example
```javascript
// 1. 弹出数字输入窗口(默认值 5,范围 1~100)
eda.sys_Dialog.showInputDialog(
'请输入铺铜间距', // 输入框上方文字
'输入 1~100 之间的整数(单位 mil)', // 输入框下方文字
'铺铜设置', // 窗口标题
'number', // 输入类型(同 HTML input 的 type)
5, // 默认值
{ min: 1, max: 100, step: 1 }, // 其它输入属性(min、max、step 等)
(value) => {
console.log('用户输入的间距:', value);
}
);
// 2. 窗口已弹出;回调需用户点击确认后才会触发
console.log('已弹出输入窗口');
```
### showselectdialog
# SYS\_Dialog.showSelectDialog() method
> 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.
Show a select dialog
## Signature
```typescript
function showSelectDialog(
options: Array<string> | Array<{ value: string; displayContent: string }>,
beforeContent?: string,
afterContent?: string,
title?: string,
defaultOption?: string,
multiple?: false,
callbackFn?: (value: string) => void | Promise<void>,
): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
options
</td><td>
Array<string> \| Array<{ value: string; displayContent: string }>
</td><td>
Option list, which can be an array of strings or an array of objects. When `defaultOption` is not specified, the default value is the first item of the list. If it is an array of strings, the value and display content of the option remain the same. If it is an array of objects, `value` represents the value of the option, and `displayContent` represents the display content of the option
</td></tr>
<tr><td>
beforeContent
</td><td>
string
</td><td>
_(Optional)_ Text above the select box
</td></tr>
<tr><td>
afterContent
</td><td>
string
</td><td>
_(Optional)_ Text below the select box
</td></tr>
<tr><td>
title
</td><td>
string
</td><td>
_(Optional)_ Select box title
</td></tr>
<tr><td>
defaultOption
</td><td>
string
</td><td>
_(Optional)_ Default option, using the option value as the matching parameter. If the `multiple` parameter is `true`<!-- -->, an array of strings needs to be passed here
</td></tr>
<tr><td>
multiple
</td><td>
false
</td><td>
_(Optional)_ Whether multiple selection is supported. By default, it is a single-select box
</td></tr>
<tr><td>
callbackFn
</td><td>
(value: string) => void \| Promise<void>
</td><td>
_(Optional)_ Callback function
</td></tr>
</tbody></table>
## Returns
void
The value selected by the user, corresponding to the `value` field in the passed-in `options`
## Example
```javascript
// 1. 单选:对象数组让 value 与展示文案分离,默认选中 TOP
eda.sys_Dialog.showSelectDialog(
[
{ value: 'TOP', displayContent: '顶层' },
{ value: 'BOTTOM', displayContent: '底层' }
],
'请选择丝印放置的层', // 选择框上方文字
'设置会应用到全部丝印', // 选择框下方文字
'丝印层设置', // 窗口标题
'TOP', // 默认选项(匹配选项的 value)
false, // 单选
(value) => {
console.log('单选结果:', value);
}
);
// 2. 多选:字符串数组作选项,multiple 传 true,默认选中两项
eda.sys_Dialog.showSelectDialog(
['DRC', 'BOM', 'Gerber'],
'请选择需要导出的内容', // 多选框上方文字
'', // 多选框下方文字
'导出设置', // 窗口标题
['DRC', 'BOM'], // 默认选项数组
true, // 多选
(values) => {
console.log('多选结果:', values);
}
);
// 3. 两个窗口已弹出;回调需用户点击确认后才会触发
console.log('已弹出选择窗口(单选 + 多选)');
```
### showselectdialog_1
# SYS\_Dialog.showSelectDialog() method
> 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.
Show a multi-select dialog
## Signature
```typescript
function showSelectDialog(
options: Array<string> | Array<{ value: string; displayContent: string }>,
beforeContent?: string,
afterContent?: string,
title?: string,
defaultOption?: Array<string>,
multiple?: true,
callbackFn?: (value: Array<string>) => void | Promise<void>,
): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
options
</td><td>
Array<string> \| Array<{ value: string; displayContent: string }>
</td><td>
Option list, which can be an array of strings or an array of objects. When `defaultOption` is not specified, the default value is the first item of the list. If it is an array of strings, the value and display content of the option remain the same. If it is an array of objects, `value` represents the value of the option, and `displayContent` represents the display content of the option
</td></tr>
<tr><td>
beforeContent
</td><td>
string
</td><td>
_(Optional)_ Text above the multi-select box
</td></tr>
<tr><td>
afterContent
</td><td>
string
</td><td>
_(Optional)_ Text below the multi-select box
</td></tr>
<tr><td>
title
</td><td>
string
</td><td>
_(Optional)_ Multi-select box title
</td></tr>
<tr><td>
defaultOption
</td><td>
Array<string>
</td><td>
_(Optional)_ Default option array, using the option values as matching parameters
</td></tr>
<tr><td>
multiple
</td><td>
true
</td><td>
_(Optional)_ Whether multiple selection is supported
</td></tr>
<tr><td>
callbackFn
</td><td>
(value: Array<string>) => void \| Promise<void>
</td><td>
_(Optional)_ Callback function
</td></tr>
</tbody></table>
## Returns
void
Array of the set of values selected by the user, corresponding to the `value` fields in the passed-in `options`
references/classes/SYS_ExternalApi.md
# SYS\_ExternalApi class
外部接口注入管理类
## Signature
```typescript
class SYS_ExternalApi
```
## Remarks
提供扩展注入自己开发的上层接口的能力,供其他扩展、独立脚本与 runApi 调用;
- 支持命名冲突检测:多个扩展注册同名接口时,输出冲突警告日志,调用时默认走最早注册的那个; - 支持生命周期管理:扩展卸载时自动注销其注册的接口,其他扩展再次调用该接口将报错; - 支持注入 Help 元数据:注册时附带说明、参数、返回值、示例,供 [SYS\_Help](./SYS_Help.md) 渐进式披露
调用入口为沙盒内的 `external` 对象(Proxy 动态调用),注册 / 注销统一通过本类的 `register` / `unregister`
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[register(namespace, apiName, callFn, help)](./SYS_ExternalApi.md)
</td><td>
</td><td>
注册一个上层接口
</td></tr>
<tr><td>
[unregister(namespace, apiName)](./SYS_ExternalApi.md)
</td><td>
</td><td>
注销指定接口
</td></tr>
</tbody></table>
---
## 方法详情
### register
# SYS\_ExternalApi.register() method
注册一个上层接口
## Signature
```typescript
function register(
namespace: string,
apiName: string,
callFn: (...args: any[]) => any | Promise<any>,
help?: ISYS_ExternalApiHelp,
): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
namespace
</td><td>
string
</td><td>
命名空间(如 `'component'`<!-- -->)
</td></tr>
<tr><td>
apiName
</td><td>
string
</td><td>
接口名(如 `'placeComponent'`<!-- -->)
</td></tr>
<tr><td>
callFn
</td><td>
(...args: any\[\]) => any \| Promise<any>
</td><td>
调用函数,接收任意参数,返回任意值或 Promise
</td></tr>
<tr><td>
help
</td><td>
[ISYS\_ExternalApiHelp](../interfaces/ISYS_ExternalApiHelp.md)
</td><td>
_(Optional)_ 可选 Help 元数据,供 `eda.sys_Help.help('external', namespace, apiName)` 查询
</td></tr>
</tbody></table>
## Returns
void
## Example
```javascript
// 注册一个「一键放置器件」的上层接口
eda.sys_ExternalApi.register(
'component',
'placeComponent',
async (props) => {
const device = await eda.lib_Device.search({ name: props.deviceName });
await eda.sch_PrimitiveComponent.place(device[0].uuid, props.x, props.y);
return { success: true, deviceUuid: device[0].uuid };
},
{
title: '放置器件(一步完成)',
description: '按器件名称查询并放置到原理图指定坐标',
params: [
{ name: 'deviceName', type: 'string', description: '器件名称', required: true },
{ name: 'x', type: 'number', description: 'X 坐标', required: true },
{ name: 'y', type: 'number', description: 'Y 坐标', required: true },
],
returns: { type: 'Promise<{success, deviceUuid}>', description: '放置结果与器件 UUID' },
},
);
// 调用
await external.component.placeComponent({ deviceName: 'R0402', x: 100, y: 100 });
```
### unregister
# SYS\_ExternalApi.unregister() method
注销指定接口
## Signature
```typescript
function unregister(namespace: string, apiName: string): boolean;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
namespace
</td><td>
string
</td><td>
命名空间
</td></tr>
<tr><td>
apiName
</td><td>
string
</td><td>
接口名
</td></tr>
</tbody></table>
## Returns
boolean
是否成功注销
## Example
```javascript
// 注销此前注册的接口
const removed = eda.sys_ExternalApi.unregister('component', 'placeComponent');
```
references/classes/SYS_FileSystem.md
# SYS\_FileSystem class
System / file system interaction class
## Signature
```typescript
class SYS_FileSystem
```
## Remarks
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[createDirectoryInFileSystem(folderPath)](./SYS_FileSystem.md)
</td><td>
</td><td>
**_(BETA)_** In file system in create folder
</td></tr>
<tr><td>
[createObjectURL(blob)](./SYS_FileSystem.md)
</td><td>
</td><td>
Create ObjectURL
</td></tr>
<tr><td>
[deleteFileInFileSystem(uri, force)](./SYS_FileSystem.md)
</td><td>
</td><td>
**_(BETA)_** Delete a file in the file system
</td></tr>
<tr><td>
[existsPathInFileSystem(uri)](./SYS_FileSystem.md)
</td><td>
</td><td>
**_(BETA)_** Check whether a file or directory exists in the file system
</td></tr>
<tr><td>
[getDocumentsPath()](./SYS_FileSystem.md)
</td><td>
</td><td>
**_(BETA)_** Get the document directory path
</td></tr>
<tr><td>
[getEdaPath()](./SYS_FileSystem.md)
</td><td>
</td><td>
**_(BETA)_** Get the EDA document directory path
</td></tr>
<tr><td>
[getExtensionFile(uri)](./SYS_FileSystem.md)
</td><td>
</td><td>
Get a file from the extension
</td></tr>
<tr><td>
[getLibrariesPaths()](./SYS_FileSystem.md)
</td><td>
</td><td>
**_(BETA)_** Get the library directory paths
</td></tr>
<tr><td>
[getProjectsPaths()](./SYS_FileSystem.md)
</td><td>
</td><td>
**_(BETA)_** Get the project directory paths
</td></tr>
<tr><td>
[listFilesOfFileSystem(folderPath, recursive)](./SYS_FileSystem.md)
</td><td>
</td><td>
**_(BETA)_** View the file list under a file system path
</td></tr>
<tr><td>
[openReadFileDialog(filenameExtensions, multiFiles)](./SYS_FileSystem.md)
</td><td>
</td><td>
**_(BETA)_** Open the read-file dialog
</td></tr>
<tr><td>
[openReadFileDialog(filenameExtensions, multiFiles)](./SYS_FileSystem.md)
</td><td>
</td><td>
**_(BETA)_** Open the read-file dialog
</td></tr>
<tr><td>
[openReadFilePathDialog(filenameExtensions, multiFiles)](./SYS_FileSystem.md)
</td><td>
</td><td>
**_(BETA)_** 打开读取文件路径窗口
</td></tr>
<tr><td>
[openReadFilePathDialog(filenameExtensions, multiFiles)](./SYS_FileSystem.md)
</td><td>
</td><td>
**_(BETA)_** 打开读取文件路径窗口
</td></tr>
<tr><td>
[openReadFolderDialog()](./SYS_FileSystem.md)
</td><td>
</td><td>
**_(BETA)_** Open the read-folder dialog
</td></tr>
<tr><td>
[openReadFolderPathDialog()](./SYS_FileSystem.md)
</td><td>
</td><td>
**_(BETA)_** 打开读取目录路径窗口
</td></tr>
<tr><td>
[readFileFromFileSystem(uri)](./SYS_FileSystem.md)
</td><td>
</td><td>
**_(BETA)_** Read a file from the file system
</td></tr>
<tr><td>
[revokeObjectURL(url)](./SYS_FileSystem.md)
</td><td>
</td><td>
Revoke the ObjectURL
</td></tr>
<tr><td>
[saveFile(fileData, fileName)](./SYS_FileSystem.md)
</td><td>
</td><td>
Save File
</td></tr>
<tr><td>
[saveFileToFileSystem(uri, fileData, fileName, force)](./SYS_FileSystem.md)
</td><td>
</td><td>
**_(BETA)_** Write a file to the file system
</td></tr>
</tbody></table>
---
## 方法详情
### createdirectoryinfilesystem
# SYS\_FileSystem.createDirectoryInFileSystem() method
> 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.
In file system in create folder
## Signature
```typescript
function createDirectoryInFileSystem(folderPath: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
folderPath
</td><td>
string
</td><td>
Folder path
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Create Whether the operation is successful
## Remarks
Supports recursively creating multi-level directories
Note 1: This API is only valid for clients. Calling it in a browser environment will always `throw Error`
Note 2: This API requires the user to enable the extension external interaction permission, if not enabled, it will always `throw Error` ADD since EDA v3.2.166
### createobjecturl
# SYS\_FileSystem.createObjectURL() method
Create ObjectURL
## Signature
```typescript
function createObjectURL(blob: Blob | File): string;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
blob
</td><td>
Blob \| File
</td><td>
Blob or File object
</td></tr>
</tbody></table>
## Returns
string
ObjectURL string
## Remarks
Create an ObjectURL pointing to the passed-in Blob / File object ADD since EDA v3.2.162
## Example
```javascript
// 1. 构造一段文本数据
const blob = new Blob(['嘉立创示例数据'], { type: 'text/plain' });
// 2. 创建 ObjectURL(同步方法,直接返回字符串)
const url = eda.sys_FileSystem.createObjectURL(blob);
console.log('ObjectURL:', url);
```
### deletefileinfilesystem
# SYS\_FileSystem.deleteFileInFileSystem() method
> 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.
Delete a file in the file system
## Signature
```typescript
function deleteFileInFileSystem(uri: string, force?: boolean): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
uri
</td><td>
string
</td><td>
File resource locator. If it ends with a slash `/` (a backslash `\` on Windows), it is recognized as a folder; if it does not end with a slash, it is recognized as a complete file name, in which case the `fileName` parameter is ignored
</td></tr>
<tr><td>
force
</td><td>
boolean
</td><td>
_(Optional)_ Force delete the folder (whether to force delete the folder when the target is a folder containing files)
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Delete Whether the operation is successful
## Remarks
Note 1: This API is only valid for clients. Calling it in a browser environment will always `throw Error`
Note 2: This API requires the user to enable the extension external interaction permission, if not enabled, it will always `throw Error`
### existspathinfilesystem
# SYS\_FileSystem.existsPathInFileSystem() method
> 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.
Check whether a file or directory exists in the file system
## Signature
```typescript
function existsPathInFileSystem(uri: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
uri
</td><td>
string
</td><td>
File resource locator. An absolute path containing the complete file name is required
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the file or directory exists
## Remarks
Note 1: This API is only valid for clients. Calling it in a browser environment will always `throw Error`
Note 2: This API requires the user to enable the extension external interaction permission, if not enabled, it will always `throw Error` ADD since EDA v3.2.167
### getdocumentspath
# SYS\_FileSystem.getDocumentsPath() method
> 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.
Get the document directory path
## Signature
```typescript
function getDocumentsPath(): Promise<string>;
```
## Returns
Promise<string>
Document directory path
## Remarks
In the returned path, the end does not contain a slash `/` (or a backslash `\`<!-- -->)
Note 1: This API is only valid for clients. Calling it in a browser environment will always `throw Error`
Note 2: This API requires the user to enable the extension external interaction permission, if not enabled, it will always `throw Error`
### getedapath
# SYS\_FileSystem.getEdaPath() method
> 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.
Get the EDA document directory path
## Signature
```typescript
function getEdaPath(): Promise<string>;
```
## Returns
Promise<string>
EDA document directory path
## Remarks
In the returned path, the end does not contain a slash `/` (or a backslash `\`<!-- -->)
Note 1: This API is only valid for clients. Calling it in a browser environment will always `throw Error`
Note 2: This API requires the user to enable the extension external interaction permission, if not enabled, it will always `throw Error`
### getextensionfile
# SYS\_FileSystem.getExtensionFile() method
Get a file from the extension
## Signature
```typescript
function getExtensionFile(uri: string): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
uri
</td><td>
string
</td><td>
File path
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
File format file
## Example
```javascript
// 1. 读取扩展安装目录下的 extension.json
const file = await eda.sys_FileSystem.getExtensionFile('extension.json');
// 2. 输出文件信息(size 单位为字节,内容可用 file.text() 读取)
console.log('文件名:', file.name);
console.log('文件大小:', file.size);
```
### getlibrariespaths
# SYS\_FileSystem.getLibrariesPaths() method
> 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.
Get the library directory paths
## Signature
```typescript
function getLibrariesPaths(): Promise<Array<string>>;
```
## Returns
Promise<Array<string>>
Array of library directory paths
## Remarks
Note 1: This API is only valid for fully offline clients. Calling it in a browser environment will always `throw Error`
Note 2: This API requires the user to enable the extension external interaction permission, if not enabled, it will always `throw Error`
### getprojectspaths
# SYS\_FileSystem.getProjectsPaths() method
> 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.
Get the project directory paths
## Signature
```typescript
function getProjectsPaths(): Promise<Array<string>>;
```
## Returns
Promise<Array<string>>
Array of project directory paths
## Remarks
Note 1: This API is only valid for semi-offline and fully offline clients. Calling it in a browser environment will always `throw Error`
Note 2: This API requires the user to enable the extension external interaction permission, if not enabled, it will always `throw Error`
### listfilesoffilesystem
# SYS\_FileSystem.listFilesOfFileSystem() method
> 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.
View the file list under a file system path
## Signature
```typescript
function listFilesOfFileSystem(
folderPath: string,
recursive?: boolean,
): Promise<Array<ISYS_FileSystemFileList>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
folderPath
</td><td>
string
</td><td>
Directory path
</td></tr>
<tr><td>
recursive
</td><td>
boolean
</td><td>
_(Optional)_ Whether to recursively get all sub-files
</td></tr>
</tbody></table>
## Returns
Promise<Array<[ISYS\_FileSystemFileList](../interfaces/ISYS_FileSystemFileList.md)<!-- -->>>
File list in the current directory
## Remarks
Note 1: This API is only valid for clients. Calling it in a browser environment will always `throw Error`
Note 2: This API requires the user to enable the extension external interaction permission, if not enabled, it will always `throw Error`
### openreadfiledialog
# SYS\_FileSystem.openReadFileDialog() method
> 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.
Open the read-file dialog
## Signature
```typescript
function openReadFileDialog(
filenameExtensions?: string | Array<string>,
multiFiles?: true,
): Promise<Array<File> | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
filenameExtensions
</td><td>
string \| Array<string>
</td><td>
_(Optional)_ File extension
</td></tr>
<tr><td>
multiFiles
</td><td>
true
</td><td>
_(Optional)_ Whether multiple files are allowed to be read
</td></tr>
</tbody></table>
## Returns
Promise<Array<File> \| undefined>
File format file array
## Remarks
本接口需要打开浏览器模态窗口,在用户于页面上进行最后一次操作的时间节点开始计算, 达到 5000ms(部分浏览器时效)后将无法使用 JavaScript 脚本唤起窗口,这是浏览器的限制
## Example
```javascript
// 1. 打开选择窗口(限定 .json 文件,单选;用户选择前 Promise 一直挂起)
eda.sys_FileSystem.openReadFileDialog('.json').then((file) => {
// 用户完成选择后触发;直接关闭窗口时 file 为 undefined
if (file) {
console.log('已选择文件:', file.name);
}
});
// 2. 窗口已弹出,主流程不等待用户操作
console.log('已打开文件选择窗口');
```
### openreadfiledialog_1
# SYS\_FileSystem.openReadFileDialog() method
> 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.
Open the read-file dialog
## Signature
```typescript
function openReadFileDialog(
filenameExtensions?: string | Array<string>,
multiFiles?: false,
): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
filenameExtensions
</td><td>
string \| Array<string>
</td><td>
_(Optional)_ File extension
</td></tr>
<tr><td>
multiFiles
</td><td>
false
</td><td>
_(Optional)_ Whether multiple files are allowed to be read
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
File format file
### openreadfilepathdialog
# SYS\_FileSystem.openReadFilePathDialog() method
> 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.
打开读取文件路径窗口
## Signature
```typescript
function openReadFilePathDialog(
filenameExtensions?: string | Array<string>,
multiFiles?: true,
): Promise<Array<string>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
filenameExtensions
</td><td>
string \| Array<string>
</td><td>
_(Optional)_ 文件扩展名
</td></tr>
<tr><td>
multiFiles
</td><td>
true
</td><td>
_(Optional)_ 是否允许读取多文件;受客户端协议限制,当前仅支持单选,`multiFiles=true` 时将返回单元素数组
</td></tr>
</tbody></table>
## Returns
Promise<Array<string>>
文件路径数组
## Remarks
ADD since EDA v3.2.201 注意:本接口仅客户端有效,在浏览器环境内调用将始终 `throw Error`
/ EDA v4.1.54
### openreadfilepathdialog_1
# SYS\_FileSystem.openReadFilePathDialog() method
> 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.
打开读取文件路径窗口
## Signature
```typescript
function openReadFilePathDialog(
filenameExtensions?: string | Array<string>,
multiFiles?: false,
): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
filenameExtensions
</td><td>
string \| Array<string>
</td><td>
_(Optional)_ 文件扩展名
</td></tr>
<tr><td>
multiFiles
</td><td>
false
</td><td>
_(Optional)_ 是否允许读取多文件;受客户端协议限制,当前仅支持单选,`multiFiles=true` 时将返回单元素数组
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
文件路径
## Remarks
ADD since EDA v3.2.201 注意:本接口仅客户端有效,在浏览器环境内调用将始终 `throw Error`
/ EDA v4.1.54
### openreadfolderdialog
# SYS\_FileSystem.openReadFolderDialog() method
> 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.
Open the read-folder dialog
## Signature
```typescript
function openReadFolderDialog(): Promise<Array<{ relativePath: string; file: File }>>;
```
## Returns
Promise<Array<{ relativePath: string; file: File }>>
All read files and their path information
## Remarks
developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory \| MDN<!-- -->} ADD since EDA v4.2
### openreadfolderpathdialog
# SYS\_FileSystem.openReadFolderPathDialog() method
> 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.
打开读取目录路径窗口
## Signature
```typescript
function openReadFolderPathDialog(): Promise<string | undefined>;
```
## Returns
Promise<string \| undefined>
目录路径
## Remarks
ADD since EDA v3.2.201 注意:本接口仅客户端有效,在浏览器环境内调用将始终 `throw Error`
/ EDA v4.1.54
### readfilefromfilesystem
# SYS\_FileSystem.readFileFromFileSystem() method
> 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.
Read a file from the file system
## Signature
```typescript
function readFileFromFileSystem(uri: string): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
uri
</td><td>
string
</td><td>
File resource locator. An absolute path containing the complete file name is required
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
File format file
## Remarks
Note 1: This API is only valid for clients. Calling it in a browser environment will always `throw Error`
Note 2: This API requires the user to enable the extension external interaction permission, if not enabled, it will always `throw Error`
### revokeobjecturl
# SYS\_FileSystem.revokeObjectURL() method
Revoke the ObjectURL
## Signature
```typescript
function revokeObjectURL(url: string): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
url
</td><td>
string
</td><td>
ObjectURL string
</td></tr>
</tbody></table>
## Returns
void
## Remarks
Revoke the specified ObjectURL ADD since EDA v3.2.162
## Example
```javascript
// 1. 先创建一个 ObjectURL
const blob = new Blob(['嘉立创示例数据']);
const url = eda.sys_FileSystem.createObjectURL(blob);
console.log('创建的 ObjectURL:', url);
// 2. 用完后吊销(同步方法,无返回值)
eda.sys_FileSystem.revokeObjectURL(url);
console.log('已吊销');
```
### savefile
# SYS\_FileSystem.saveFile() method
Save File
## Signature
```typescript
function saveFile(fileData: File | Blob, fileName?: string): Promise<void>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fileData
</td><td>
File \| Blob
</td><td>
File data
</td></tr>
<tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_ File name
</td></tr>
</tbody></table>
## Returns
Promise<void>
## Remarks
Calls the browser download API or the Electron save-file API to save the passed-in file stream locally
## Example
```javascript
// 1. 构造要保存的 CSV 内容
const content = '编号,器件,数量\n1,C0402,10\n2,C0603,20';
const blob = new Blob([content], { type: 'text/csv' });
// 2. 保存到本地(完成后 Promise 才结束)
await eda.sys_FileSystem.saveFile(blob, '嘉立创示例_BOM导出.csv');
console.log('已保存文件:', '嘉立创示例_BOM导出.csv', blob.size, '字节');
```
### savefiletofilesystem
# SYS\_FileSystem.saveFileToFileSystem() method
> 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.
Write a file to the file system
## Signature
```typescript
function saveFileToFileSystem(
uri: string,
fileData: File | Blob,
fileName?: string,
force?: boolean,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
uri
</td><td>
string
</td><td>
File resource locator. If it ends with a slash `/` (a backslash `\` on Windows), it is recognized as a folder; if it does not end with a slash, it is recognized as a complete file name, in which case the `fileName` parameter is ignored
</td></tr>
<tr><td>
fileData
</td><td>
File \| Blob
</td><td>
File data
</td></tr>
<tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_ File name
</td></tr>
<tr><td>
force
</td><td>
boolean
</td><td>
_(Optional)_ Force write (overwrite the file if it exists)
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the write operation was successful. If overwriting is not allowed but the file already exists, `false` is returned
## Remarks
Note 1: This API is only valid for clients. Calling it in a browser environment will always `throw Error`
Note 2: This API requires the user to enable the extension external interaction permission, if not enabled, it will always `throw Error`
references/classes/SYS_FormatConversion.md
# SYS\_FormatConversion class
System / format conversion (Chameleon) class
## Signature
```typescript
class SYS_FormatConversion
```
## Remarks
Perform cross file format conversion with other board-level EDA software
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[convertAltiumDesignerLibrariesToEasyEDAMultiFiles(file)](./SYS_FormatConversion.md)
</td><td>
</td><td>
**_(BETA)_** Convert Altium Designer libraries to multiple EasyEDA library files (one file per device)
</td></tr>
<tr><td>
[convertAltiumDesignerLibrariesToEasyEDASingleFile(file)](./SYS_FormatConversion.md)
</td><td>
</td><td>
**_(BETA)_** Convert Altium Designer libraries to a single EasyEDA library file
</td></tr>
<tr><td>
[convertDisaLibrariesToEasyEDAMultiFiles(file)](./SYS_FormatConversion.md)
</td><td>
</td><td>
**_(BETA)_** Convert T/DISA 4001 libraries to multiple EasyEDA library files (one file per device)
</td></tr>
<tr><td>
[convertDisaLibrariesToEasyEDASingleFile(file)](./SYS_FormatConversion.md)
</td><td>
</td><td>
**_(BETA)_** Convert T/DISA 4001 libraries to a single EasyEDA library file
</td></tr>
</tbody></table>
---
## 方法详情
### convertaltiumdesignerlibrariestoeasyedamultifiles
# SYS\_FormatConversion.convertAltiumDesignerLibrariesToEasyEDAMultiFiles() method
> 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.
Convert Altium Designer libraries to multiple EasyEDA library files (one file per device)
## Signature
```typescript
function convertAltiumDesignerLibrariesToEasyEDAMultiFiles(
file: File | Array<File>,
): Promise<Array<File>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
file
</td><td>
File \| Array<File>
</td><td>
Altium Designer library file
</td></tr>
</tbody></table>
## Returns
Promise<Array<File>>
Multiple EasyEDA library files
## Example
```javascript
// 1. 准备 Altium Designer 库文件(真实场景用 sys_FileSystem.openReadFileDialog
// 选取用户文件,此处直接构造 File 对象演示调用)
const schLib = new File(['占位内容,真实场景为 .SchLib 文件内容'], '嘉立创示例_元件库.SchLib');
const pcbLib = new File(['占位内容,真实场景为 .PcbLib 文件内容'], '嘉立创示例_封装库.PcbLib');
// 2. 转换为多个嘉立创库文件(每个器件一个文件)
const libFiles = await eda.sys_FormatConversion.convertAltiumDesignerLibrariesToEasyEDAMultiFiles([schLib, pcbLib]);
// 3. 输出转换得到的库文件列表
console.log('转换得到库文件数:', libFiles.length);
libFiles.forEach((file, index) => {
console.log(`第 ${index + 1} 个文件:`, file.name);
});
```
### convertaltiumdesignerlibrariestoeasyedasinglefile
# SYS\_FormatConversion.convertAltiumDesignerLibrariesToEasyEDASingleFile() method
> 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.
Convert Altium Designer libraries to a single EasyEDA library file
## Signature
```typescript
function convertAltiumDesignerLibrariesToEasyEDASingleFile(
file: File | Array<File>,
): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
file
</td><td>
File \| Array<File>
</td><td>
Altium Designer library file
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
EasyEDA library file
## Example
```javascript
// 1. 准备 Altium Designer 库文件(真实场景用 sys_FileSystem.openReadFileDialog
// 选取用户文件,此处直接构造 File 对象演示调用)
const schLib = new File(['占位内容,真实场景为 .SchLib 文件内容'], '嘉立创示例_元件库.SchLib');
// 2. 转换为单个嘉立创库文件
const easyedaLib = await eda.sys_FormatConversion.convertAltiumDesignerLibrariesToEasyEDASingleFile(schLib);
// 3. 输出转换得到的库文件信息
console.log('库文件名:', easyedaLib.name);
console.log('文件大小:', easyedaLib.size, '字节');
```
### convertdisalibrariestoeasyedamultifiles
# SYS\_FormatConversion.convertDisaLibrariesToEasyEDAMultiFiles() method
> 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.
Convert T/DISA 4001 libraries to multiple EasyEDA library files (one file per device)
## Signature
```typescript
function convertDisaLibrariesToEasyEDAMultiFiles(file: File | Array<File>): Promise<Array<File>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
file
</td><td>
File \| Array<File>
</td><td>
T/DISA 4001 library file
</td></tr>
</tbody></table>
## Returns
Promise<Array<File>>
Multiple EasyEDA library files
## Example
```javascript
// 1. 准备 T/DISA 4001 库文件(真实场景用 sys_FileSystem.openReadFileDialog
// 选取用户文件,此处直接构造 File 对象演示调用)
const disaLib = new File(['占位内容,真实场景为 T/DISA 4001 库文件内容'], '嘉立创示例_旧版器件库.lib');
// 2. 转换为多个嘉立创库文件(每个器件一个文件)
const libFiles = await eda.sys_FormatConversion.convertDisaLibrariesToEasyEDAMultiFiles(disaLib);
// 3. 输出转换得到的库文件列表(空数组表示没有可转换的器件)
console.log('转换得到库文件数:', libFiles.length);
libFiles.forEach((file, index) => {
console.log(`第 ${index + 1} 个文件:`, file.name);
});
```
### convertdisalibrariestoeasyedasinglefile
# SYS\_FormatConversion.convertDisaLibrariesToEasyEDASingleFile() method
> 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.
Convert T/DISA 4001 libraries to a single EasyEDA library file
## Signature
```typescript
function convertDisaLibrariesToEasyEDASingleFile(
file: File | Array<File>,
): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
file
</td><td>
File \| Array<File>
</td><td>
T/DISA 4001 library file
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
EasyEDA library file
## Example
```javascript
// 1. 准备 T/DISA 4001 库文件(真实场景用 sys_FileSystem.openReadFileDialog
// 选取用户文件,此处直接构造 File 对象演示调用)
const disaLib = new File(['占位内容,真实场景为 T/DISA 4001 库文件内容'], '嘉立创示例_旧版器件库.lib');
// 2. 转换为单个嘉立创库文件
const easyedaLib = await eda.sys_FormatConversion.convertDisaLibrariesToEasyEDASingleFile(disaLib);
// 3. 输出转换得到的库文件信息
console.log('库文件名:', easyedaLib.name);
console.log('文件大小:', easyedaLib.size, '字节');
```
references/classes/SYS_FontManager.md
# SYS\_FontManager class
System / font manager class
## Signature
```typescript
class SYS_FontManager
```
## Remarks
Configure the list of system fonts that EasyEDA Pro is allowed to use
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[addFont(fontName)](./SYS_FontManager.md)
</td><td>
</td><td>
Add Font to font list
</td></tr>
<tr><td>
[deleteFont(fontName)](./SYS_FontManager.md)
</td><td>
</td><td>
Delete the specified font from the font list
</td></tr>
<tr><td>
[getFontsList()](./SYS_FontManager.md)
</td><td>
</td><td>
Get the currently configured font list
</td></tr>
</tbody></table>
---
## 方法详情
### addfont
# SYS\_FontManager.addFont() method
Add Font to font list
## Signature
```typescript
function addFont(fontName: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fontName
</td><td>
string
</td><td>
Font name
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Add Whether the operation is successful
## Example
```javascript
// 1. 添加一个字体到字体列表
const added = await eda.sys_FontManager.addFont('嘉立创示例_测试字体');
// 2. 确认字体已进入列表
const fonts = await eda.sys_FontManager.getFontsList();
// 3. 清理测试字体,恢复原有配置
await eda.sys_FontManager.deleteFont('嘉立创示例_测试字体');
console.log('添加结果:', added);
console.log('已进入字体列表:', fonts.includes('嘉立创示例_测试字体'));
```
### deletefont
# SYS\_FontManager.deleteFont() method
Delete the specified font from the font list
## Signature
```typescript
function deleteFont(fontName: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fontName
</td><td>
string
</td><td>
Font name
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Delete Whether the operation is successful
## Example
```javascript
// 1. 准备一个待删除的测试字体
await eda.sys_FontManager.addFont('嘉立创示例_测试字体');
// 2. 从字体列表删除该字体
const deleted = await eda.sys_FontManager.deleteFont('嘉立创示例_测试字体');
// 3. 确认字体已不在列表中
const fonts = await eda.sys_FontManager.getFontsList();
console.log('删除结果:', deleted);
console.log('已不在字体列表:', !fonts.includes('嘉立创示例_测试字体'));
```
### getfontslist
# SYS\_FontManager.getFontsList() method
Get the currently configured font list
## Signature
```typescript
function getFontsList(): Promise<Array<string>>;
```
## Returns
Promise<Array<string>>
Font list
## Example
```javascript
// 1. 获取当前已配置的字体列表
const fonts = await eda.sys_FontManager.getFontsList();
// 2. 输出字体数量与全部字体名
console.log('字体数量:', fonts.length);
console.log('字体列表:', fonts.join('、'));
```
references/classes/SYS_HeaderMenu.md
# SYS\_HeaderMenu class
System / header menu class
## Signature
```typescript
class SYS_HeaderMenu
```
## Remarks
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[insertHeaderMenus(headerMenus)](./SYS_HeaderMenu.md)
</td><td>
</td><td>
Import top menu data
</td></tr>
<tr><td>
[insertSystemHeaderMenuItem(env, id, props)](./SYS_HeaderMenu.md)
</td><td>
</td><td>
**_(BETA)_** Insert a system header menu item at the specified position
</td></tr>
<tr><td>
[removeHeaderMenus()](./SYS_HeaderMenu.md)
</td><td>
</td><td>
Remove Top menu data
</td></tr>
<tr><td>
[removeSystemHeaderMenuItem(id, props)](./SYS_HeaderMenu.md)
</td><td>
</td><td>
**_(BETA)_** Remove a system header menu item
</td></tr>
<tr><td>
[replaceHeaderMenus(headerMenus)](./SYS_HeaderMenu.md)
</td><td>
</td><td>
Replace top menu data
</td></tr>
</tbody></table>
---
## 方法详情
### insertheadermenus
# SYS\_HeaderMenu.insertHeaderMenus() method
Import top menu data
## Signature
```typescript
function insertHeaderMenus(headerMenus: ISYS_HeaderMenus): Promise<void>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
headerMenus
</td><td>
[ISYS\_HeaderMenus](../interfaces/ISYS_HeaderMenus.md)
</td><td>
Top menu data
</td></tr>
</tbody></table>
## Returns
Promise<void>
## Example
```javascript
// 1. 组装菜单数据:环境键 → 一级菜单数组(title / id / menuItems)
const headerMenus = {
blank: [
{
id: '嘉立创示例_菜单',
title: '嘉立创示例',
menuItems: [{ id: '嘉立创示例_子项', title: '打开示例面板' }],
},
],
};
// 2. 导入顶部菜单数据(blank 环境的顶部菜单被替换为上述内容)
await eda.sys_HeaderMenu.insertHeaderMenus(headerMenus);
console.log('已导入 blank 环境的顶部菜单数据');
// 3. 还原:移除导入的数据,恢复系统默认菜单
eda.sys_HeaderMenu.removeHeaderMenus();
console.log('已还原系统默认菜单');
```
### insertsystemheadermenuitem
# SYS\_HeaderMenu.insertSystemHeaderMenuItem() method
> 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.
Insert a system header menu item at the specified position
## Signature
```typescript
function insertSystemHeaderMenuItem(
env: ESYS_HeaderMenuEnvironment,
id: Array<string>,
props: {
title: string;
registerFn?: string;
icon?: string;
shortcutKey?: TSYS_ShortcutKeys;
menuItems?: Array<ISYS_HeaderMenuSub1MenuItem | ISYS_HeaderMenuSub2MenuItem | null>;
insertDividerBefore?: boolean;
insertDividerAfter?: boolean;
insertBefore?: string;
crossDividerWhenInsert?: boolean;
},
): Promise<string | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
env
</td><td>
[ESYS\_HeaderMenuEnvironment](../enums/ESYS_HeaderMenuEnvironment.md)
</td><td>
Environment
</td></tr>
<tr><td>
id
</td><td>
Array<string>
</td><td>
Menu item ID tree. It will match menu items by hierarchy in array order and use the last element of the array as the ID of the menu item to insert
</td></tr>
<tr><td>
props
</td><td>
{ title: string; registerFn?: string; icon?: string; shortcutKey?: [TSYS\_ShortcutKeys](../types/TSYS_ShortcutKeys.md)<!-- -->; menuItems?: Array<[ISYS\_HeaderMenuSub1MenuItem](../interfaces/ISYS_HeaderMenuSub1MenuItem.md) \| [ISYS\_HeaderMenuSub2MenuItem](../interfaces/ISYS_HeaderMenuSub2MenuItem.md) \| null>; insertDividerBefore?: boolean; insertDividerAfter?: boolean; insertBefore?: string; crossDividerWhenInsert?: boolean; }
</td><td>
Other parameters
</td></tr>
</tbody></table>
## Returns
Promise<string \| undefined>
The ID of the header menu item. Whether a separator is inserted does not affect the return value of the operation. The IDs of sub-items in menuItems are not included
## Remarks
This API adds a sub-menu under an existing system first-level menu. First-level menus cannot be added or modified. The `id` array should contain at least `2` values
This API forces the ID of the newly created system header menu to include the extension UUID. For example, an input `id = 'example'` will be automatically rewritten to `e143d88179874e7f851cc890cd22fc71|example`<!-- -->. To remove this menu later, enter the rewritten name
This API cannot add any sub-menu under the \*\*Advanced\*\* menu
Sub-menus added by this API are placed at the end of the original menu by default, unless the `props.insertBefore` parameter is specified
Note: This API requires the user to enable the extension external interaction permission, if not enabled, it will always `throw Error`
Non-public API usage notice: This API is provided as-is without additional documentation for parameters. Parameters may be changed in a breaking manner in any version without notice.
## Example
```javascript
// 1. 在 PCB 环境的 工具(Tools)菜单下插入子菜单项,并带上两个三级菜单项
const menuId = await eda.sys_HeaderMenu.insertSystemHeaderMenuItem('pcb', ['Tools', '嘉立创示例_扩展工具'], {
title: '嘉立创示例 扩展工具',
menuItems: [
{ id: '嘉立创示例_打开面板', title: '打开扩展面板' },
{ id: '嘉立创示例_扩展设置', title: '扩展设置' },
],
});
// 2. 输出重写后的菜单 ID(真实扩展中通过 registerFn 指定点击回调)
console.log('插入的菜单 ID:', menuId);
// 3. 移除刚插入的菜单项还原菜单栏(同一 ID 重复插入会返回 undefined,
// 自建自删保证案例可重复运行)
const removed = await eda.sys_HeaderMenu.removeSystemHeaderMenuItem(['Tools', menuId]);
console.log('移除结果:', removed);
```
### removeheadermenus
# SYS\_HeaderMenu.removeHeaderMenus() method
Remove Top menu data
## Signature
```typescript
function removeHeaderMenus(): void;
```
## Returns
void
## Example
```javascript
// 1. 先导入一份菜单数据,让移除操作有实际对象
await eda.sys_HeaderMenu.insertHeaderMenus({
blank: [{ id: '嘉立创示例_菜单', title: '嘉立创示例', menuItems: [{ id: '嘉立创示例_子项', title: '示例子项' }] }],
});
console.log('已导入菜单数据');
// 2. 移除全部已导入的顶部菜单数据(同步方法,无需 await)
eda.sys_HeaderMenu.removeHeaderMenus();
console.log('已移除导入的顶部菜单数据');
```
### removesystemheadermenuitem
# SYS\_HeaderMenu.removeSystemHeaderMenuItem() method
> 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.
Remove a system header menu item
## Signature
```typescript
function removeSystemHeaderMenuItem(
id: Array<string>,
props?: {
removeTheBeforeDivider?: boolean;
removeTheAfterDivider?: boolean;
},
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
Array<string>
</td><td>
Menu item ID tree. It will match menu items by hierarchy in array order and remove the menu item corresponding to the last element; when only one element is passed, the corresponding first-level menu is removed
</td></tr>
<tr><td>
props
</td><td>
\{ removeTheBeforeDivider?: boolean; removeTheAfterDivider?: boolean; \}
</td><td>
_(Optional)_ Other parameters. Whether to remove the separators before and after the menu item (only takes effect when removing a sub-menu item)
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the removal operation was successful. If the menu is removed but the separator is not found, `true` is also returned
## Remarks
Once a menu is removed, restarting the EasyEDA software is required to restore it
This API cannot remove the system header menu items imported by the API
When the `id` array contains only one element, the corresponding first-level menu is removed; when it contains multiple elements, the menu items are matched by hierarchy in array order, and the sub-menu item corresponding to the last element is removed
This API cannot remove the \*\*Advanced\*\* menu itself or any sub-menu under it
Note 1: This API requires the user to enable the extension external interaction permission, if not enabled, it will always `throw Error`
Note 2: The \*\*remove first-level menu\*\* function of this API is exclusive to the private deployment edition. Calling it in other editions will always `throw Error`
Non-public API usage notice: This API is provided as-is without additional documentation for parameters. Parameters may be changed in a breaking manner in any version without notice.
## Example
```javascript
// 1. 先插入一个待移除的子菜单项(id 树:[一级菜单 ID, 新项 ID])
const menuId = await eda.sys_HeaderMenu.insertSystemHeaderMenuItem('pcb', ['Tools', '嘉立创示例_待移除项'], {
title: '嘉立创示例 待移除项',
});
console.log('待移除的菜单 ID:', menuId);
// 2. 移除该菜单项(id 树:[一级菜单 ID, insert 返回的重写 ID])
const removed = await eda.sys_HeaderMenu.removeSystemHeaderMenuItem(['Tools', menuId]);
console.log('移除结果:', removed);
```
### replaceheadermenus
# SYS\_HeaderMenu.replaceHeaderMenus() method
Replace top menu data
## Signature
```typescript
function replaceHeaderMenus(headerMenus: ISYS_HeaderMenus): Promise<void>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
headerMenus
</td><td>
[ISYS\_HeaderMenus](../interfaces/ISYS_HeaderMenus.md)
</td><td>
Top menu data
</td></tr>
</tbody></table>
## Returns
Promise<void>
## Remarks
This API is equivalent to executing the [remove](./SYS_HeaderMenu.md) and [insert](./SYS_HeaderMenu.md) operations at the same time
## Example
```javascript
// 1. 先导入一版菜单数据作为被替换对象(blank 空白页环境)
await eda.sys_HeaderMenu.insertHeaderMenus({
blank: [{ id: '嘉立创示例_菜单A', title: '菜单 A', menuItems: [{ id: '嘉立创示例_子A', title: '子项 A' }] }],
});
console.log('已导入第一版菜单');
// 2. 整体替换为第二版菜单数据
await eda.sys_HeaderMenu.replaceHeaderMenus({
blank: [{ id: '嘉立创示例_菜单B', title: '菜单 B', menuItems: [{ id: '嘉立创示例_子B', title: '子项 B' }] }],
});
console.log('已替换为第二版菜单');
// 3. 还原系统默认菜单
eda.sys_HeaderMenu.removeHeaderMenus();
console.log('已还原系统默认菜单');
```
references/classes/SYS_FileManager.md
# SYS\_FileManager class
System / file manager class
## Signature
```typescript
class SYS_FileManager
```
## Remarks
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[extractLibInfo(data)](./SYS_FileManager.md)
</td><td>
</td><td>
Extract the library configuration information from the file
</td></tr>
<tr><td>
[extractProjectInfo(data)](./SYS_FileManager.md)
</td><td>
</td><td>
Extract the project configuration information from the file
</td></tr>
<tr><td>
[getCbbFileByCbbUuid(cbbUuid, libraryUuid, props)](./SYS_FileManager.md)
</td><td>
</td><td>
**_(BETA)_** Use reuse block UUID get reuse block file
</td></tr>
<tr><td>
[getDeviceFileByDeviceUuid(deviceUuid, libraryUuid, fileType)](./SYS_FileManager.md)
</td><td>
</td><td>
Use device UUID get device file
</td></tr>
<tr><td>
[getDocumentFile(fileName, password, fileType)](./SYS_FileManager.md)
</td><td>
</td><td>
Get Document file
</td></tr>
<tr><td>
[getDocumentFootprintSources()](./SYS_FileManager.md)
</td><td>
</td><td>
**_(BETA)_** Get the document footprint source code
</td></tr>
<tr><td>
[getDocumentSource()](./SYS_FileManager.md)
</td><td>
</td><td>
**_(BETA)_** Get Document source code
</td></tr>
<tr><td>
[getFootprintFileByFootprintUuid(footprintUuid, libraryUuid, fileType)](./SYS_FileManager.md)
</td><td>
</td><td>
**_(BETA)_** Use footprint UUID get footprint file
</td></tr>
<tr><td>
[getPanelLibraryFileByPanelLibraryUuid(panelLibraryUuid, libraryUuid, fileType)](./SYS_FileManager.md)
</td><td>
</td><td>
**_(BETA)_** Use panel library UUID get panel library file
</td></tr>
<tr><td>
[getProjectFile(fileName, password, fileType)](./SYS_FileManager.md)
</td><td>
</td><td>
Get Project file
</td></tr>
<tr><td>
[getProjectFileByProjectUuid(projectUuid, fileName, password, fileType)](./SYS_FileManager.md)
</td><td>
</td><td>
**_(BETA)_** Use project UUID get project file
</td></tr>
<tr><td>
[getSchematicFile(fileName, password, fileType)](./SYS_FileManager.md)
</td><td>
</td><td>
**_(BETA)_** 获取原理图文件
</td></tr>
<tr><td>
[getSymbolFileBySymbolUuid(symbolUuid, libraryUuid, fileType)](./SYS_FileManager.md)
</td><td>
</td><td>
**_(BETA)_** Use symbol UUID get symbol file
</td></tr>
<tr><td>
[importProjectByProjectFile(projectFile, fileType, props, saveTo, librariesImportSetting)](./SYS_FileManager.md)
</td><td>
</td><td>
**_(BETA)_** Use project file import project
</td></tr>
<tr><td>
[importProjectByProjectFile(projectFile, fileType, props, saveTo, librariesImportSetting)](./SYS_FileManager.md)
</td><td>
</td><td>
**_(BETA)_** Use project file import project
</td></tr>
<tr><td>
[setDocumentSource(source)](./SYS_FileManager.md)
</td><td>
</td><td>
**_(BETA)_** Modify Document source code
</td></tr>
</tbody></table>
---
## 方法详情
### extractlibinfo
# SYS\_FileManager.extractLibInfo() method
Extract the library configuration information from the file
## Signature
```typescript
function extractLibInfo(data: File | Array<File>): Promise<any>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
data
</td><td>
File \| Array<File>
</td><td>
Library file
</td></tr>
</tbody></table>
## Returns
Promise<any>
Library configuration information
## Example
```javascript
// 1. 导出当前工程为文件
const projectFile = await eda.sys_FileManager.getProjectFile();
// 2. 从工程文件中提取库配置信息
const libInfo = await eda.sys_FileManager.extractLibInfo(projectFile);
// 3. 输出各类型库的引用数量(字段:devices / symbols / footprints / panelLibs)
console.log('器件数:', libInfo.devices.length);
console.log('符号数:', libInfo.symbols.length);
console.log('封装数:', libInfo.footprints.length);
console.log('面板库数:', libInfo.panelLibs.length);
// 4. 列出第一个封装的库信息(uuid 可用于后续按 UUID 下载封装文件)
const firstFootprint = libInfo.footprints[0];
console.log('首个封装标题:', firstFootprint?.title);
console.log('首个封装 uuid:', firstFootprint?.uuid);
```
### extractprojectinfo
# SYS\_FileManager.extractProjectInfo() method
Extract the project configuration information from the file
## Signature
```typescript
function extractProjectInfo(data: File): Promise<any>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
data
</td><td>
File
</td><td>
Project file
</td></tr>
</tbody></table>
## Returns
Promise<any>
Project configuration information
## Example
```javascript
// 1. 导出当前工程为文件
const projectFile = await eda.sys_FileManager.getProjectFile();
// 2. 从工程文件中提取工程配置信息
const projectInfo = await eda.sys_FileManager.extractProjectInfo(projectFile);
// 3. 输出工程配置(title 是工程标题,editorVersion 是导出时的编辑器版本)
console.log('工程标题:', projectInfo.title);
console.log('编辑器版本:', projectInfo.editorVersion);
console.log('是否复用模块工程:', projectInfo.cbbProject);
// 4. 输出标签(工程未设置标签时 tags 为 undefined,兜底为空数组)
console.log('标签:', (projectInfo.tags ?? []).join('、'));
```
### getcbbfilebycbbuuid
# SYS\_FileManager.getCbbFileByCbbUuid() method
> 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.
Use reuse block UUID get reuse block file
## Signature
```typescript
function getCbbFileByCbbUuid(
cbbUuid: string,
libraryUuid?: string,
props?: {
fileName?: string;
password?: string;
fileType?: 'epro' | 'epro2';
templateSchematicUuid?: string;
templatePcbUuid?: string;
},
): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
cbbUuid
</td><td>
string
</td><td>
Reuse block UUID
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
_(Optional)_ Library UUID. It can be obtained using the APIs in [LIB\_LibrariesList](./LIB_LibrariesList.md)<!-- -->. If not passed in, it is the system library
</td></tr>
<tr><td>
props
</td><td>
{ fileName?: string; password?: string; fileType?: 'epro' \| 'epro2'; templateSchematicUuid?: string; templatePcbUuid?: string }
</td><td>
_(Optional)_
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
Reuse block file data, `undefined` indicates that the data retrieval failed
## Remarks
You can use [SYS\_FileSystem.saveFile()](./SYS_FileSystem.md) API export the file to the local file system
Note: This API requires the \*\*Team Module > Download Module\*\* permission. Calling it without permission will always `throw Error`
## Example
```javascript
// 1. 列出系统库中的复用模块,取第一个的 UUID
const cbbList = await eda.lib_Cbb.search('', undefined, undefined, 5);
const cbb = cbbList[0];
// 2. 按复用模块 UUID 获取文件,props.fileName 指定导出文件名
const cbbFile = await eda.sys_FileManager.getCbbFileByCbbUuid(cbb.uuid, undefined, {
fileName: '嘉立创示例_复用模块',
});
// 3. 输出复用模块与文件信息(size 单位为字节)
console.log('复用模块名:', cbb.name);
console.log('文件名:', cbbFile.name);
console.log('文件大小:', cbbFile.size);
```
### getdevicefilebydeviceuuid
# SYS\_FileManager.getDeviceFileByDeviceUuid() method
Use device UUID get device file
## Signature
```typescript
function getDeviceFileByDeviceUuid(
deviceUuid: string | Array<string>,
libraryUuid?: string,
fileType?: 'elibz' | 'elibz2',
): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
deviceUuid
</td><td>
string \| Array<string>
</td><td>
Device UUID or device UUID list
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
_(Optional)_ Library UUID. It can be obtained using the APIs in [LIB\_LibrariesList](./LIB_LibrariesList.md)<!-- -->. If not passed in, it is the system library
</td></tr>
<tr><td>
fileType
</td><td>
'elibz' \| 'elibz2'
</td><td>
_(Optional)_
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
Device file data, `undefined` indicates that the data retrieval failed
## Remarks
You can use [SYS\_FileSystem.saveFile()](./SYS_FileSystem.md) API export the file to the local file system
Note: This API requires the \*\*Team Library > Download Library\*\* permission. Calling it without permission will always `throw Error`
## Example
```javascript
// 1. 按立创编号精确搜索系统库器件,取第一个的 UUID
const deviceList = await eda.lib_Device.searchByProperties({ supplierId: 'C1523' }, undefined, undefined, undefined, 5, 1);
const device = deviceList[0];
// 2. 按器件 UUID 获取器件文件
const deviceFile = await eda.sys_FileManager.getDeviceFileByDeviceUuid(device.uuid);
// 3. 输出器件与文件信息(size 单位为字节)
console.log('器件名:', device.name);
console.log('文件名:', deviceFile.name);
console.log('文件大小:', deviceFile.size);
```
### getdocumentfile
# SYS\_FileManager.getDocumentFile() method
Get Document file
## Signature
```typescript
function getDocumentFile(
fileName?: string,
password?: string,
fileType?: 'epro' | 'epro2',
): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_ File name
</td></tr>
<tr><td>
password
</td><td>
string
</td><td>
_(Optional)_ Encrypted password
</td></tr>
<tr><td>
fileType
</td><td>
'epro' \| 'epro2'
</td><td>
_(Optional)_ File format
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
Document file data, `undefined` indicates that it is currently not open document or data retrieval failed
## Remarks
You can use [SYS\_FileSystem.saveFile()](./SYS_FileSystem.md) API export the file to the local file system
Note: This API requires the \*\*Engineering Design > File Export\*\* permission. Calling it without permission will always `throw Error`
## Example
```javascript
// 1. 导出当前文档为文件(文件名自动带上 epro2 扩展名)
const documentFile = await eda.sys_FileManager.getDocumentFile('嘉立创示例_文档导出');
// 2. 输出文件信息(size 单位为字节)
console.log('文件名:', documentFile.name);
console.log('文件大小:', documentFile.size);
```
### getdocumentfootprintsources
# SYS\_FileManager.getDocumentFootprintSources() method
> 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.
Get the document footprint source code
## Signature
```typescript
function getDocumentFootprintSources(): Promise<
Array<{ footprintUuid: string; documentSource: string }>
>;
```
## Returns
Promise<Array<{ footprintUuid: string; documentSource: string }>>
Document footprint source code data. An empty array is returned if the data retrieval fails
## Example
```javascript
// 1. 获取当前文档全部封装源码
const sources = await eda.sys_FileManager.getDocumentFootprintSources();
// 2. 输出封装数量与每个封装的源码长度
console.log('封装数量:', sources.length);
sources.forEach((item, i) => {
console.log(`[${i}] footprintUuid:`, item.footprintUuid, '源码长度:', item.documentSource.length);
});
```
### getdocumentsource
# SYS\_FileManager.getDocumentSource() method
> 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.
Get Document source code
## Signature
```typescript
function getDocumentSource(): Promise<string | undefined>;
```
## Returns
Promise<string \| undefined>
Document source code data, `undefined` indicates that it is currently not open document or data retrieval failed
## Example
```javascript
// 1. 读取当前文档源码
const source = await eda.sys_FileManager.getDocumentSource();
// 2. 输出源码长度与前 60 字符预览(DOCHEAD 开头的 JSON 分段结构)
console.log('源码长度:', source.length);
console.log('源码预览:', source.slice(0, 60));
```
### getfootprintfilebyfootprintuuid
# SYS\_FileManager.getFootprintFileByFootprintUuid() method
> 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.
Use footprint UUID get footprint file
## Signature
```typescript
function getFootprintFileByFootprintUuid(
footprintUuid: string | Array<string>,
libraryUuid?: string,
fileType?: 'elibz' | 'elibz2',
): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
footprintUuid
</td><td>
string \| Array<string>
</td><td>
Footprint UUID or footprint UUID list
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
_(Optional)_ Library UUID. It can be obtained using the APIs in [LIB\_LibrariesList](./LIB_LibrariesList.md)<!-- -->. If not passed in, it is the system library
</td></tr>
<tr><td>
fileType
</td><td>
'elibz' \| 'elibz2'
</td><td>
_(Optional)_
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
Footprint file data, `undefined` indicates that the data retrieval failed
## Remarks
You can use [SYS\_FileSystem.saveFile()](./SYS_FileSystem.md) API export the file to the local file system
Note: This API requires the \*\*Team Library > Download Library\*\* permission. Calling it without permission will always `throw Error`
## Example
```javascript
// 1. 列出系统库封装,取第一个的 UUID
const footprintList = await eda.lib_Footprint.search('', undefined, [], undefined, 5, 1);
const footprint = footprintList[0];
// 2. 按封装 UUID 获取封装文件
const footprintFile = await eda.sys_FileManager.getFootprintFileByFootprintUuid(footprint.uuid);
// 3. 输出封装与文件信息(size 单位为字节)
console.log('封装名:', footprint.name);
console.log('文件名:', footprintFile.name);
console.log('文件大小:', footprintFile.size);
```
### getpanellibraryfilebypanellibraryuuid
# SYS\_FileManager.getPanelLibraryFileByPanelLibraryUuid() method
> 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.
Use panel library UUID get panel library file
## Signature
```typescript
function getPanelLibraryFileByPanelLibraryUuid(
panelLibraryUuid: string | Array<string>,
libraryUuid?: string,
fileType?: 'elibz' | 'elibz2',
): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
panelLibraryUuid
</td><td>
string \| Array<string>
</td><td>
Panel library UUID or panel library UUID list
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
_(Optional)_ Library UUID. It can be obtained using the APIs in [LIB\_LibrariesList](./LIB_LibrariesList.md)<!-- -->. If not passed in, it is the system library
</td></tr>
<tr><td>
fileType
</td><td>
'elibz' \| 'elibz2'
</td><td>
_(Optional)_
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
Panel library file data, `undefined` indicates that the data retrieval failed
## Remarks
You can use [SYS\_FileSystem.saveFile()](./SYS_FileSystem.md) API export the file to the local file system
Note: This API requires the \*\*Team Library > Download Library\*\* permission. Calling it without permission will always `throw Error`
## Example
```javascript
// 1. 列出系统库面板库,取第一个的 UUID
const panelList = await eda.lib_PanelLibrary.search('', undefined, undefined, 5);
const panel = panelList[0];
// 2. 按面板库 UUID 获取面板库文件
const panelFile = await eda.sys_FileManager.getPanelLibraryFileByPanelLibraryUuid(panel.uuid);
// 3. 输出面板库与文件信息(size 单位为字节)
console.log('面板库名:', panel.name);
console.log('文件名:', panelFile.name);
console.log('文件大小:', panelFile.size);
```
### getprojectfile
# SYS\_FileManager.getProjectFile() method
Get Project file
## Signature
```typescript
function getProjectFile(
fileName?: string,
password?: string,
fileType?: 'epro' | 'epro2',
): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_ File name
</td></tr>
<tr><td>
password
</td><td>
string
</td><td>
_(Optional)_ Encrypted password
</td></tr>
<tr><td>
fileType
</td><td>
'epro' \| 'epro2'
</td><td>
_(Optional)_ File format
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
Project file data, `undefined` indicates that it is currently not open project or data retrieval failed
## Remarks
You can use [SYS\_FileSystem.saveFile()](./SYS_FileSystem.md) API export the file to the local file system
Note: This API requires the \*\*Project Management > Download Project\*\* permission. Calling it without permission will always `throw Error`
## Example
```javascript
// 1. 导出当前工程为文件(文件名自动带上 epro2 扩展名)
const projectFile = await eda.sys_FileManager.getProjectFile('嘉立创示例_工程导出');
// 2. 输出文件信息(size 单位为字节)
console.log('文件名:', projectFile.name);
console.log('文件大小:', projectFile.size);
```
### getprojectfilebyprojectuuid
# SYS\_FileManager.getProjectFileByProjectUuid() method
> 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.
Use project UUID get project file
## Signature
```typescript
function getProjectFileByProjectUuid(
projectUuid: string,
fileName?: string,
password?: string,
fileType?: 'epro' | 'epro2',
): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
projectUuid
</td><td>
string
</td><td>
Project UUID
</td></tr>
<tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_ File name
</td></tr>
<tr><td>
password
</td><td>
string
</td><td>
_(Optional)_ Encrypted password
</td></tr>
<tr><td>
fileType
</td><td>
'epro' \| 'epro2'
</td><td>
_(Optional)_ File format
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
Project file data, `undefined` indicates that it is currently not open project or data retrieval failed
## Remarks
You can use [SYS\_FileSystem.saveFile()](./SYS_FileSystem.md) API export the file to the local file system
Note: This API requires the \*\*Project Management > Download Project\*\* permission. Calling it without permission will always `throw Error`
## Example
```javascript
// 1. 获取当前工程的 UUID
const projectInfo = await eda.dmt_Project.getCurrentProjectInfo();
// 2. 按工程 UUID 下载工程文件(文件名自动带上 epro2 扩展名)
const projectFile = await eda.sys_FileManager.getProjectFileByProjectUuid(projectInfo.uuid, '嘉立创示例_按UUID导出');
// 3. 输出文件信息(size 单位为字节)
console.log('文件名:', projectFile.name);
console.log('文件大小:', projectFile.size);
```
### getschematicfile
# SYS\_FileManager.getSchematicFile() method
> 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.
获取原理图文件
## Signature
```typescript
function getSchematicFile(
fileName?: string,
password?: string,
fileType?: 'epro' | 'epro2',
): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
fileName
</td><td>
string
</td><td>
_(Optional)_ 文件名
</td></tr>
<tr><td>
password
</td><td>
string
</td><td>
_(Optional)_ 加密密码
</td></tr>
<tr><td>
fileType
</td><td>
'epro' \| 'epro2'
</td><td>
_(Optional)_ 文件格式
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
原理图文件数据,`undefined` 表示当前未打开原理图图页或数据获取失败
## Remarks
ADD since EDA v3.2.183 可以使用 [SYS\_FileSystem.saveFile()](./SYS_FileSystem.md) 接口将文件导出到本地文件系统
注意:本接口需要启用 \*\*工程设计图 > 文件导出\*\* 权限,没有权限调用将始终 `throw Error`
/ EDA v4.1.23
### getsymbolfilebysymboluuid
# SYS\_FileManager.getSymbolFileBySymbolUuid() method
> 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.
Use symbol UUID get symbol file
## Signature
```typescript
function getSymbolFileBySymbolUuid(
symbolUuid: string | Array<string>,
libraryUuid?: string,
fileType?: 'elibz' | 'elibz2',
): Promise<File | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
symbolUuid
</td><td>
string \| Array<string>
</td><td>
Symbol UUID or symbol UUID list
</td></tr>
<tr><td>
libraryUuid
</td><td>
string
</td><td>
_(Optional)_ Library UUID. It can be obtained using the APIs in [LIB\_LibrariesList](./LIB_LibrariesList.md)<!-- -->. If not passed in, it is the system library
</td></tr>
<tr><td>
fileType
</td><td>
'elibz' \| 'elibz2'
</td><td>
_(Optional)_
</td></tr>
</tbody></table>
## Returns
Promise<File \| undefined>
Symbol file data, `undefined` indicates that the data retrieval failed
## Remarks
You can use [SYS\_FileSystem.saveFile()](./SYS_FileSystem.md) API export the file to the local file system
Note: This API requires the \*\*Team Library > Download Library\*\* permission. Calling it without permission will always `throw Error`
## Example
```javascript
// 1. 列出系统库符号,取第一个的 UUID
const symbolList = await eda.lib_Symbol.search('', undefined, [], undefined, 5, 1);
const symbol = symbolList[0];
// 2. 按符号 UUID 获取符号文件
const symbolFile = await eda.sys_FileManager.getSymbolFileBySymbolUuid(symbol.uuid);
// 3. 输出符号与文件信息(size 单位为字节)
console.log('符号名:', symbol.name);
console.log('文件名:', symbolFile.name);
console.log('文件大小:', symbolFile.size);
```
### importprojectbyprojectfile
# SYS\_FileManager.importProjectByProjectFile() method
> 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.
Use project file import project
## Signature
```typescript
function importProjectByProjectFile(
projectFile: File,
fileType?:
| 'JLCEDA'
| 'JLCEDA Pro'
| 'EasyEDA'
| 'EasyEDA Pro'
| 'Allegro'
| 'OrCAD'
| 'EAGLE'
| 'KiCad'
| 'PADS'
| 'LTspice',
props?: {
importOption?: ESYS_ImportProjectImportOption;
schematicObjectStyle?: ESYS_ImportProjectSchematicObjectStyle;
associateFootprint?: boolean;
associate3DModel?: boolean;
importFootprintNotesLayer?: boolean;
},
saveTo?:
| {
operation: 'New Project';
newProjectOwnerTeamUuid: IDMT_TeamItem['uuid'];
newProjectOwnerFolderUuid?: IDMT_FolderItem['uuid'];
newProjectName?: string;
newProjectFriendlyName?: string;
newProjectDescription?: string;
newProjectCollaborationMode?: EDMT_ProjectCollaborationMode;
}
| { operation: 'Existing Project'; existingProjectUuid: IDMT_BriefProjectItem['uuid'] }
| { operation: 'Offline Client Local Path'; folderPath: string },
librariesImportSetting?: {
ownerTeamUuid: IDMT_TeamItem['uuid'];
deviceClassification?: Array<string>;
symbolClassification?: Array<string>;
footprintClassification?: Array<string>;
createDeviceForSingleSymbol?: boolean;
updateExistingLibrariesWithTheSameName?: boolean;
},
): Promise<IDMT_BriefProjectItem | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
projectFile
</td><td>
File
</td><td>
Project file
</td></tr>
<tr><td>
fileType
</td><td>
'JLCEDA' \| 'JLCEDA Pro' \| 'EasyEDA' \| 'EasyEDA Pro' \| 'Allegro' \| 'OrCAD' \| 'EAGLE' \| 'KiCad' \| 'PADS' \| 'LTspice'
</td><td>
_(Optional)_ File type
</td></tr>
<tr><td>
props
</td><td>
{ importOption?: [ESYS\_ImportProjectImportOption](../enums/ESYS_ImportProjectImportOption.md)<!-- -->; schematicObjectStyle?: [ESYS\_ImportProjectSchematicObjectStyle](../enums/ESYS_ImportProjectSchematicObjectStyle.md)<!-- -->; associateFootprint?: boolean; associate3DModel?: boolean; importFootprintNotesLayer?: boolean }
</td><td>
_(Optional)_ Import parameters. Refer to the configuration items in the \*\*Import\*\* window of the EDA front end
</td></tr>
<tr><td>
saveTo
</td><td>
{ operation: 'New Project'; newProjectOwnerTeamUuid: [IDMT\_TeamItem](../interfaces/IDMT_TeamItem.md)<!-- -->\['uuid'\]; newProjectOwnerFolderUuid?: [IDMT\_FolderItem](../interfaces/IDMT_FolderItem.md)<!-- -->\['uuid'\]; newProjectName?: string; newProjectFriendlyName?: string; newProjectDescription?: string; newProjectCollaborationMode?: [EDMT\_ProjectCollaborationMode](../enums/EDMT_ProjectCollaborationMode.md) } \| { operation: 'Existing Project'; existingProjectUuid: [IDMT\_BriefProjectItem](../interfaces/IDMT_BriefProjectItem.md)<!-- -->\['uuid'\] } \| { operation: 'Offline Client Local Path'; folderPath: string }
</td><td>
_(Optional)_ Save To project parameter
</td></tr>
<tr><td>
librariesImportSetting
</td><td>
{ ownerTeamUuid: [IDMT\_TeamItem](../interfaces/IDMT_TeamItem.md)<!-- -->\['uuid'\]; deviceClassification?: Array<string>; symbolClassification?: Array<string>; footprintClassification?: Array<string>; createDeviceForSingleSymbol?: boolean; updateExistingLibrariesWithTheSameName?: boolean }
</td><td>
_(Optional)_ 库导入配置
</td></tr>
</tbody></table>
## Returns
Promise<[IDMT\_BriefProjectItem](../interfaces/IDMT_BriefProjectItem.md) \| undefined>
Brief project properties of the imported project
## Remarks
Extracting library-related configurations is not supported yet. If the library needs to be extracted, it will be extracted according to the default configuration
### importprojectbyprojectfile_1
# SYS\_FileManager.importProjectByProjectFile() method
> 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.
Use project file import project
## Signature
```typescript
function importProjectByProjectFile(
projectFile: File,
fileType?: 'Altium Designer' | 'Protel',
props?: {
importOption?: ESYS_ImportProjectImportOption;
viaSolderMaskExpansion?: ESYS_ImportProjectViaSolderMaskExpansion;
boardOutlineSource?: ESYS_ImportProjectBoardOutlineSource;
schematicObjectStyle?: ESYS_ImportProjectSchematicObjectStyle;
associateFootprint?: boolean;
associate3DModel?: boolean;
importFootprintNotesLayer?: boolean;
},
saveTo?:
| {
operation: 'New Project';
newProjectOwnerTeamUuid: IDMT_TeamItem['uuid'];
newProjectOwnerFolderUuid?: IDMT_FolderItem['uuid'];
newProjectName?: string;
newProjectFriendlyName?: string;
newProjectDescription?: string;
newProjectCollaborationMode?: EDMT_ProjectCollaborationMode;
}
| { operation: 'Existing Project'; existingProjectUuid: IDMT_BriefProjectItem['uuid'] }
| { operation: 'Offline Client Local Path'; folderPath: string },
librariesImportSetting?: {
ownerTeamUuid: IDMT_TeamItem['uuid'];
deviceClassification?: Array<string>;
symbolClassification?: Array<string>;
footprintClassification?: Array<string>;
createDeviceForSingleSymbol?: boolean;
updateExistingLibrariesWithTheSameName?: boolean;
},
): Promise<IDMT_BriefProjectItem | undefined>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
projectFile
</td><td>
File
</td><td>
Project file
</td></tr>
<tr><td>
fileType
</td><td>
'Altium Designer' \| 'Protel'
</td><td>
_(Optional)_ File type
</td></tr>
<tr><td>
props
</td><td>
{ importOption?: [ESYS\_ImportProjectImportOption](../enums/ESYS_ImportProjectImportOption.md)<!-- -->; viaSolderMaskExpansion?: [ESYS\_ImportProjectViaSolderMaskExpansion](../enums/ESYS_ImportProjectViaSolderMaskExpansion.md)<!-- -->; boardOutlineSource?: [ESYS\_ImportProjectBoardOutlineSource](../enums/ESYS_ImportProjectBoardOutlineSource.md)<!-- -->; schematicObjectStyle?: [ESYS\_ImportProjectSchematicObjectStyle](../enums/ESYS_ImportProjectSchematicObjectStyle.md)<!-- -->; associateFootprint?: boolean; associate3DModel?: boolean; importFootprintNotesLayer?: boolean }
</td><td>
_(Optional)_ Import parameters. Refer to the configuration items in the \*\*Import\*\* window of the EDA front end
</td></tr>
<tr><td>
saveTo
</td><td>
{ operation: 'New Project'; newProjectOwnerTeamUuid: [IDMT\_TeamItem](../interfaces/IDMT_TeamItem.md)<!-- -->\['uuid'\]; newProjectOwnerFolderUuid?: [IDMT\_FolderItem](../interfaces/IDMT_FolderItem.md)<!-- -->\['uuid'\]; newProjectName?: string; newProjectFriendlyName?: string; newProjectDescription?: string; newProjectCollaborationMode?: [EDMT\_ProjectCollaborationMode](../enums/EDMT_ProjectCollaborationMode.md) } \| { operation: 'Existing Project'; existingProjectUuid: [IDMT\_BriefProjectItem](../interfaces/IDMT_BriefProjectItem.md)<!-- -->\['uuid'\] } \| { operation: 'Offline Client Local Path'; folderPath: string }
</td><td>
_(Optional)_ Save To project parameter
</td></tr>
<tr><td>
librariesImportSetting
</td><td>
{ ownerTeamUuid: [IDMT\_TeamItem](../interfaces/IDMT_TeamItem.md)<!-- -->\['uuid'\]; deviceClassification?: Array<string>; symbolClassification?: Array<string>; footprintClassification?: Array<string>; createDeviceForSingleSymbol?: boolean; updateExistingLibrariesWithTheSameName?: boolean }
</td><td>
_(Optional)_ 库导入配置
</td></tr>
</tbody></table>
## Returns
Promise<[IDMT\_BriefProjectItem](../interfaces/IDMT_BriefProjectItem.md) \| undefined>
Brief project properties of the imported project
## Remarks
Extracting library-related configurations is not supported yet. If the library needs to be extracted, it will be extracted according to the default configuration
### setdocumentsource
# SYS\_FileManager.setDocumentSource() method
> 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.
Modify Document source code
## Signature
```typescript
function setDocumentSource(source: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
source
</td><td>
string
</td><td>
Document source code
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the modification was successful. If the input document source code format is incorrect, `false` is returned
## Example
```javascript
// 1. 读取当前文档源码
const source = await eda.sys_FileManager.getDocumentSource();
// 2. 把源码原样写回文档(源码格式合法,返回 true 表示修改成功)
const modified = await eda.sys_FileManager.setDocumentSource(source);
// 3. 输出修改结果
console.log('修改结果:', modified);
```
references/classes/SYS_I18n.md
# SYS\_I18n class
System / multilingual class
## Signature
```typescript
class SYS_I18n
```
## Remarks
Use the multilingual system to display multilingual text
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[addLanguageChangedEventListener(id, callFn, onlyOnce)](./SYS_I18n.md)
</td><td>
</td><td>
Add a language change event listener
</td></tr>
<tr><td>
[getAllSupportedLanguages()](./SYS_I18n.md)
</td><td>
</td><td>
Query all supported languages
</td></tr>
<tr><td>
[getCurrentLanguage()](./SYS_I18n.md)
</td><td>
</td><td>
Get Current language environment
</td></tr>
<tr><td>
[importMultilingual(language, source)](./SYS_I18n.md)
</td><td>
</td><td>
Import multilingual
</td></tr>
<tr><td>
[importMultilingualLanguage(namespace, language, source)](./SYS_I18n.md)
</td><td>
</td><td>
Import multilingual: specify namespace and language
</td></tr>
<tr><td>
[importMultilingualNamespace(namespace, source)](./SYS_I18n.md)
</td><td>
</td><td>
Import multilingual: specify namespace
</td></tr>
<tr><td>
[isEventListenerAlreadyExist(id)](./SYS_I18n.md)
</td><td>
</td><td>
Query whether the event listener exists
</td></tr>
<tr><td>
[isLanguageSupported(language)](./SYS_I18n.md)
</td><td>
</td><td>
Check whether the language is supported
</td></tr>
<tr><td>
[removeEventListener(id)](./SYS_I18n.md)
</td><td>
</td><td>
Remove Event listener
</td></tr>
<tr><td>
[text(tag, namespace, language, args)](./SYS_I18n.md)
</td><td>
</td><td>
Output language text
</td></tr>
</tbody></table>
---
## 方法详情
### addlanguagechangedeventlistener
# SYS\_I18n.addLanguageChangedEventListener() method
Add a language change event listener
## Signature
```typescript
function addLanguageChangedEventListener(
id: string,
callFn: (newLanguage: string, lastLanguage: string) => void | Promise<void>,
onlyOnce: boolean,
): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
Event ID, used to prevent duplicate event registration
</td></tr>
<tr><td>
callFn
</td><td>
(newLanguage: string, lastLanguage: string) => void \| Promise<void>
</td><td>
The callback function triggered when the event fires
</td></tr>
<tr><td>
onlyOnce
</td><td>
boolean
</td><td>
</td></tr>
</tbody></table>
## Returns
void
## Example
```javascript
// 1. 注册语言切换监听(回调要等用户真实切换语言时才会触发)
eda.sys_I18n.addLanguageChangedEventListener(
'嘉立创示例_语言监听',
(newLanguage, lastLanguage) => {
console.log('语言已切换:', lastLanguage, '→', newLanguage);
},
false,
);
// 2. 确认监听已注册
console.log('监听已注册:', eda.sys_I18n.isEventListenerAlreadyExist('嘉立创示例_语言监听'));
// 3. 移除监听,恢复原状(保证案例可重复运行)
console.log('已移除监听:', eda.sys_I18n.removeEventListener('嘉立创示例_语言监听'));
```
### getallsupportedlanguages
# SYS\_I18n.getAllSupportedLanguages() method
Query all supported languages
## Signature
```typescript
function getAllSupportedLanguages(): Array<string>;
```
## Returns
Array<string>
List of all supported languages
## Example
```javascript
// 1. 获取所有支持的语言代码
const languages = eda.sys_I18n.getAllSupportedLanguages();
// 2. 输出语言总数,并确认常用语言在列表中
console.log('支持的语言数量:', languages.length);
console.log(
'常用语言受支持:',
['zh-Hans', 'zh-Hant', 'en', 'ja'].every(lang => languages.includes(lang)),
);
```
### getcurrentlanguage
# SYS\_I18n.getCurrentLanguage() method
Get Current language environment
## Signature
```typescript
function getCurrentLanguage(): Promise<string>;
```
## Returns
Promise<string>
Language
## Remarks
The languages that can be obtained are limited by the languages currently supported by EDA. Languages supported by other APIs need to explicitly specify the `language` parameter to be used
## Example
```javascript
// 1. 获取当前显示语言
const current = await eda.sys_I18n.getCurrentLanguage();
// 2. 判断当前是否中文环境
console.log('当前语言:', current);
console.log('是否中文环境:', current.startsWith('zh'));
```
### importmultilingual
# SYS\_I18n.importMultilingual() method
Import multilingual
## Signature
```typescript
function importMultilingual(language: string, source: TSYS_LanguageKeyValuePairs): boolean;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
language
</td><td>
string
</td><td>
Language
</td></tr>
<tr><td>
source
</td><td>
[TSYS\_LanguageKeyValuePairs](../types/TSYS_LanguageKeyValuePairs.md)
</td><td>
The multilingual data object to import
</td></tr>
</tbody></table>
## Returns
boolean
Import whether it is successful
## Remarks
Note: This API is only valid for extensions. Calling it in a standalone script environment will always `throw Error`
## Example
```javascript
// 1. 向默认命名空间导入简体中文文案(${1} 是占位符,取文案时传实际参数)
const imported = eda.sys_I18n.importMultilingual('zh-Hans', {
嘉立创示例_问候: '你好,${1}!欢迎回来',
});
// 2. 用 text() 按标签取回文案,占位符由参数替换
const message = eda.sys_I18n.text('嘉立创示例_问候', undefined, 'zh-Hans', '工程师');
console.log('导入结果:', imported);
console.log('取回文案:', message);
```
### importmultilinguallanguage
# SYS\_I18n.importMultilingualLanguage() method
Import multilingual: specify namespace and language
## Signature
```typescript
function importMultilingualLanguage(
namespace: string,
language: string,
source: TSYS_LanguageKeyValuePairs,
): boolean;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
namespace
</td><td>
string
</td><td>
Namespace
</td></tr>
<tr><td>
language
</td><td>
string
</td><td>
Language
</td></tr>
<tr><td>
source
</td><td>
[TSYS\_LanguageKeyValuePairs](../types/TSYS_LanguageKeyValuePairs.md)
</td><td>
The multilingual data object to import
</td></tr>
</tbody></table>
## Returns
boolean
Import whether it is successful
## Example
```javascript
// 1. 向命名空间导入繁体中文文案
const imported = eda.sys_I18n.importMultilingualLanguage('嘉立创示例_语言包', 'zh-Hant', {
示例_问候: '妳好,${1}',
});
// 2. 用 text() 指定命名空间和语言取回文案
const message = eda.sys_I18n.text('示例_问候', '嘉立创示例_语言包', 'zh-Hant', '用戶');
console.log('导入结果:', imported);
console.log('繁体文案:', message);
```
### importmultilingualnamespace
# SYS\_I18n.importMultilingualNamespace() method
Import multilingual: specify namespace
## Signature
```typescript
function importMultilingualNamespace(
namespace: string,
source: ISYS_MultilingualLanguagesData,
): boolean;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
namespace
</td><td>
string
</td><td>
Namespace
</td></tr>
<tr><td>
source
</td><td>
[ISYS\_MultilingualLanguagesData](../interfaces/ISYS_MultilingualLanguagesData.md)
</td><td>
The multilingual data object to import
</td></tr>
</tbody></table>
## Returns
boolean
Import whether it is successful
## Example
```javascript
// 1. 组装多语言数据:语言代码 → 键值对
const languagesData = {
'zh-Hans': { 示例_问候: '你好,${1}' },
'en': { 示例_问候: 'Hello, ${1}' },
};
// 2. 一次性导入整个命名空间
const imported = eda.sys_I18n.importMultilingualNamespace('嘉立创示例_多语言', languagesData);
// 3. 同一标签分别取中英文文案
const zhText = eda.sys_I18n.text('示例_问候', '嘉立创示例_多语言', 'zh-Hans', '工程师');
const enText = eda.sys_I18n.text('示例_问候', '嘉立创示例_多语言', 'en', 'engineer');
console.log('导入结果:', imported);
console.log('中文文案:', zhText);
console.log('英文文案:', enText);
```
### iseventlisteneralreadyexist
# SYS\_I18n.isEventListenerAlreadyExist() method
Query whether the event listener exists
## Signature
```typescript
function isEventListenerAlreadyExist(id: string): boolean;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
Event ID
</td></tr>
</tbody></table>
## Returns
boolean
Whether the event listener exists
## Example
```javascript
// 1. 注册一个测试监听作为查询对象
eda.sys_I18n.addLanguageChangedEventListener('嘉立创示例_查询监听', () => {}, false);
// 2. 查询已注册与未注册的 ID
console.log('已注册的 ID 存在:', eda.sys_I18n.isEventListenerAlreadyExist('嘉立创示例_查询监听'));
console.log('未注册的 ID 存在:', eda.sys_I18n.isEventListenerAlreadyExist('嘉立创示例_未注册'));
// 3. 清理测试监听
eda.sys_I18n.removeEventListener('嘉立创示例_查询监听');
console.log('已清理测试监听');
```
### islanguagesupported
# SYS\_I18n.isLanguageSupported() method
Check whether the language is supported
## Signature
```typescript
function isLanguageSupported(language: string): boolean;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
language
</td><td>
string
</td><td>
Language
</td></tr>
</tbody></table>
## Returns
boolean
Whether it is supported
## Example
```javascript
// 1. 检查受支持的语言代码
console.log('en 是否受支持:', eda.sys_I18n.isLanguageSupported('en'));
console.log('zh-Hans 是否受支持:', eda.sys_I18n.isLanguageSupported('zh-Hans'));
// 2. 检查不受支持的写法(zh-CN 不是 EDA 的语言代码风格)
console.log('zh-CN 是否受支持:', eda.sys_I18n.isLanguageSupported('zh-CN'));
```
### removeeventlistener
# SYS\_I18n.removeEventListener() method
Remove Event listener
## Signature
```typescript
function removeEventListener(id: string): boolean;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
Event ID
</td></tr>
</tbody></table>
## Returns
boolean
Whether Remove Specify event listener
## Example
```javascript
// 1. 先注册一个测试监听作为移除对象
eda.sys_I18n.addLanguageChangedEventListener('嘉立创示例_移除监听', () => {}, false);
// 2. 第一次移除:ID 存在,返回 true
console.log('第一次移除成功:', eda.sys_I18n.removeEventListener('嘉立创示例_移除监听'));
// 3. 第二次移除:ID 已不存在,返回 false
console.log('第二次移除成功:', eda.sys_I18n.removeEventListener('嘉立创示例_移除监听'));
```
### text
# SYS\_I18n.text() method
Output language text
## Signature
```typescript
function text(tag: string, namespace?: string, language?: string, ...args: Array<any>): string;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
tag
</td><td>
string
</td><td>
Text tag, corresponding to the key in the multilingual file key-value pairs
</td></tr>
<tr><td>
namespace
</td><td>
string
</td><td>
_(Optional)_ Text namespace. In the extension runtime environment, it defaults to the extension UUID; otherwise, it is the system default namespace
</td></tr>
<tr><td>
language
</td><td>
string
</td><td>
_(Optional)_ Language. `undefined` is the current display language of EDA
</td></tr>
<tr><td>
args
</td><td>
Array<any>
</td><td>
Arguments for replacing placeholders in the language text
</td></tr>
</tbody></table>
## Returns
string
Language text
## Remarks
Placeholders in the `${1}` format can be used to represent parameters;
Language priority: current display language > system default language > the first language in the data set that contains the text tag > the text tag
## Example
```javascript
// 1. 先导入一份多语言数据作为取文本的数据源
eda.sys_I18n.importMultilingualNamespace('嘉立创示例_取文本', {
'zh-Hans': { 示例_问候: '你好,${1}!今天是${2}' },
'en': { 示例_问候: 'Hello, ${1}! Today is ${2}' },
});
// 2. 指定语言取文案,占位符按参数顺序替换
const greeting = eda.sys_I18n.text('示例_问候', '嘉立创示例_取文本', 'en', 'Tom', 'Monday');
// 3. 不传语言则用 EDA 当前显示语言;缺参的占位符原样保留
const current = await eda.sys_I18n.getCurrentLanguage();
const localized = eda.sys_I18n.text('示例_问候', '嘉立创示例_取文本', undefined, '嘉立创');
// 4. 标签不存在时回退为标签本身
const missing = eda.sys_I18n.text('示例_不存在的标签', '嘉立创示例_取文本');
console.log('当前语言:', current);
console.log('英文文案:', greeting);
console.log('当前语言文案:', localized);
console.log('缺失标签回退:', missing);
```
references/classes/SYS_Help.md
# SYS\_Help class
Help 渐进式披露类
## Signature
```typescript
class SYS_Help
```
## Remarks
用于渐进式披露外部 API(`eda`<!-- -->)、lc-protocol 格式类型(`format`<!-- -->)与扩展注入接口(`external`<!-- -->)的信息;
AI 可先获取 API 总览(各命名空间下全部类型条目 `{ name, comment }`<!-- -->), 再按需查询单个命名空间、单个类 / 类型、单个方法的详细用法(入参、出参、返回值), 无需翻阅大量外部文档
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[help(namespace, className, methodName)](./SYS_Help.md)
</td><td>
</td><td>
查询 Help 信息(渐进式)
</td></tr>
</tbody></table>
---
## 方法详情
### help
# SYS\_Help.help() method
查询 Help 信息(渐进式)
## Signature
```typescript
function help(
namespace?: string,
className?: string,
methodName?: string,
): Promise<ISYS_HelpData | Record<string, any> | ISYS_HelpClassSummary | ISYS_HelpMethodDetail>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
namespace
</td><td>
string
</td><td>
_(Optional)_ 命名空间:`'eda'`<!-- -->(静态外部 API)、`'format'`<!-- -->(lc-protocol 格式类型)或 `'external'`<!-- -->(扩展注入接口),缺省返回总览
</td></tr>
<tr><td>
className
</td><td>
string
</td><td>
_(Optional)_ 类名 / 类型名 / 命名空间下的分组名(external 场景为注册时的 namespace)
</td></tr>
<tr><td>
methodName
</td><td>
string
</td><td>
_(Optional)_ 方法名 / 接口名
</td></tr>
</tbody></table>
## Returns
Promise<[ISYS\_HelpData](../interfaces/ISYS_HelpData.md) \| Record<string, any> \| [ISYS\_HelpClassSummary](../interfaces/ISYS_HelpClassSummary.md) \| [ISYS\_HelpMethodDetail](../interfaces/ISYS_HelpMethodDetail.md)<!-- -->>
渐进式查询结果: - 无参:返回总览 `{ eda: [{ name, comment } 全部类型条目], external: { namespace: { apiName: 标题 } } }`<!-- -->; - 仅 `namespace`<!-- -->(`'eda'` / `'format'`<!-- -->):返回该命名空间下全部类型条目 `[{ name, comment }]`<!-- -->(类 / 枚举 / 接口 / 类型); - `namespace` + `className`<!-- -->:类返回 `{ title, methods: [{ name, comment }] }` 方法摘要, 枚举 / 接口 / 类型返回类型详情(`{ name, comment, values }` 枚举值列表或 `{ name, comment, fields }` 字段列表); - 三个参数齐全(`'eda'` 场景):返回单方法的完整详情(入参、出参、返回值); - `'format'` 场景:仅 `namespace` 返回类型条目列表,`namespace` + `className` 返回该类型的详情(无 `methodName` 层级)
## Example
```javascript
// 1. 总览
const overview = await eda.sys_Help.help();
// 2. 查看 eda 下 lib_Device 类的方法
const deviceMethods = await eda.sys_Help.help('eda', 'lib_Device');
// 3. 查看 create 方法的完整用法
const createDoc = await eda.sys_Help.help('eda', 'lib_Device', 'create');
// 4. 查看外部注入接口
const externalInfo = await eda.sys_Help.help('external', 'component', 'placeComponent');
```
references/classes/SYS_LoadingAndProgressBar.md
# SYS\_LoadingAndProgressBar class
System / loading and progress bar class
## Signature
```typescript
class SYS_LoadingAndProgressBar
```
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[destroyLoading()](./SYS_LoadingAndProgressBar.md)
</td><td>
</td><td>
Destroy the no-progress loading overlay
</td></tr>
<tr><td>
[destroyProgressBar()](./SYS_LoadingAndProgressBar.md)
</td><td>
</td><td>
Destroy the progress bar
</td></tr>
<tr><td>
[showLoading()](./SYS_LoadingAndProgressBar.md)
</td><td>
</td><td>
Show the no-progress loading overlay
</td></tr>
<tr><td>
[showProgressBar(progress, title)](./SYS_LoadingAndProgressBar.md)
</td><td>
</td><td>
Show the progress bar or set its progress
</td></tr>
</tbody></table>
---
## 方法详情
### destroyloading
# SYS\_LoadingAndProgressBar.destroyLoading() method
Destroy the no-progress loading overlay
## Signature
```typescript
function destroyLoading(): void;
```
## Returns
void
## Example
```javascript
// 1. 先显示加载覆盖作为销毁对象(与 showLoading 成对演示)
eda.sys_LoadingAndProgressBar.showLoading();
console.log('加载覆盖已显示');
await new Promise(r => setTimeout(r, 800));
// 2. 销毁覆盖,编辑器恢复可操作(同步调用,无返回值)
eda.sys_LoadingAndProgressBar.destroyLoading();
console.log('加载覆盖已销毁,编辑器恢复可操作');
```
### destroyprogressbar
# SYS\_LoadingAndProgressBar.destroyProgressBar() method
Destroy the progress bar
## Signature
```typescript
function destroyProgressBar(): void;
```
## Returns
void
## Example
```javascript
// 1. 先显示一个进度未满的进度条作为销毁对象
eda.sys_LoadingAndProgressBar.showProgressBar(50, '嘉立创示例 正在处理');
console.log('进度条已显示,当前进度 50%');
await new Promise(r => setTimeout(r, 800));
// 2. 销毁进度条(同步调用,无返回值)
eda.sys_LoadingAndProgressBar.destroyProgressBar();
console.log('进度条已销毁');
```
### showloading
# SYS\_LoadingAndProgressBar.showLoading() method
Show the no-progress loading overlay
## Signature
```typescript
function showLoading(): void;
```
## Returns
void
## Remarks
There is no progress indicator, but a gray overlay consistent with the progress bar will appear to prevent further user operations
## Example
```javascript
// 1. 显示无进度加载覆盖(同步调用,无返回值)
eda.sys_LoadingAndProgressBar.showLoading();
console.log('加载覆盖已显示,编辑器被灰色覆盖锁定');
// 2. 停留片刻便于观察,随后销毁覆盖还原界面(自建自删,保证案例可重复运行)
await new Promise(r => setTimeout(r, 1000));
eda.sys_LoadingAndProgressBar.destroyLoading();
console.log('加载覆盖已销毁,编辑器恢复可操作');
```
### showprogressbar
# SYS\_LoadingAndProgressBar.showProgressBar() method
Show the progress bar or set its progress
## Signature
```typescript
function showProgressBar(progress?: number, title?: string): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
progress
</td><td>
number
</td><td>
_(Optional)_ Progress value, value range `0-100`
</td></tr>
<tr><td>
title
</td><td>
string
</td><td>
_(Optional)_ Progress bar title
</td></tr>
</tbody></table>
## Returns
void
## Remarks
When the progress reaches `100`<!-- -->, the progress bar will be automatically destroyed
## Example
```javascript
// 1. 显示进度条并指定标题(同步调用,无返回值)
eda.sys_LoadingAndProgressBar.showProgressBar(30, '嘉立创示例 正在处理');
console.log('进度条已显示,当前进度 30%');
// 2. 重复调用刷新进度(分批任务逐步推进的典型方式)
await new Promise(r => setTimeout(r, 800));
eda.sys_LoadingAndProgressBar.showProgressBar(70, '嘉立创示例 正在处理');
console.log('进度已更新到 70%');
// 3. 进度达到 100,进度条自动销毁(自清理,无需手动 destroy)
await new Promise(r => setTimeout(r, 800));
eda.sys_LoadingAndProgressBar.showProgressBar(100, '嘉立创示例 正在处理');
console.log('进度达到 100%,进度条已自动销毁');
```
references/classes/SYS_IFrame.md
# SYS\_IFrame class
System / iframe window class
## Signature
```typescript
class SYS_IFrame
```
## Remarks
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[closeIFrame(id)](./SYS_IFrame.md)
</td><td>
</td><td>
**_(BETA)_** Close iframe window
</td></tr>
<tr><td>
[hideIFrame(id)](./SYS_IFrame.md)
</td><td>
</td><td>
**_(BETA)_** Hide iframe window
</td></tr>
<tr><td>
[isIFrameAlreadyExist(id)](./SYS_IFrame.md)
</td><td>
</td><td>
**_(BETA)_** Whether the iframe already exists
</td></tr>
<tr><td>
[openIFrame(htmlFileName, width, height, id, props)](./SYS_IFrame.md)
</td><td>
</td><td>
**_(BETA)_** Open iframe window
</td></tr>
<tr><td>
[showIFrame(id)](./SYS_IFrame.md)
</td><td>
</td><td>
**_(BETA)_** Show iframe window
</td></tr>
</tbody></table>
---
## 方法详情
### closeiframe
# SYS\_IFrame.closeIFrame() method
> 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.
Close iframe window
## Signature
```typescript
function closeIFrame(id?: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
_(Optional)_ Iframe window ID. If not passed in, all iframe windows opened by this extension will be closed
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
Close the iframe window with the specified ID
Note: This API is only valid for extensions. Calling it in a standalone script environment will always `throw Error`
控制其它扩展打开的内联框架窗口时,`id` 需传入完整 ID 格式:`<其它扩展UUID>.<窗口ID>`<!-- -->(点分隔,窗口 ID 为打开时传入的 `id` 参数)
## Example
```javascript
// 1. 打开两个内联框架窗口(自建 fixture,演示按 ID 定向关闭)
await eda.sys_IFrame.openIFrame('/extension.json', 300, 200, '嘉立创示例_窗口A', { title: '嘉立创示例 窗口A' });
await eda.sys_IFrame.openIFrame('/extension.json', 300, 200, '嘉立创示例_窗口B', { title: '嘉立创示例 窗口B' });
console.log('已打开两个窗口:嘉立创示例_窗口A / 嘉立创示例_窗口B');
// 2. 按 ID 关闭指定窗口
const closedById = await eda.sys_IFrame.closeIFrame('嘉立创示例_窗口A');
console.log('按 ID 关闭窗口 A 结果:', closedById);
// 3. 不传 id,关闭本扩展打开的全部剩余窗口(清理窗口 B,还原界面)
const closedAll = await eda.sys_IFrame.closeIFrame();
console.log('关闭全部剩余窗口结果:', closedAll);
// 4. 对已不存在的窗口再关闭一次,验证幂等语义(返回 true 而非 false)
const closedAgain = await eda.sys_IFrame.closeIFrame('嘉立创示例_窗口A');
console.log('重复关闭已关窗口结果:', closedAgain);
```
### hideiframe
# SYS\_IFrame.hideIFrame() method
> 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.
Hide iframe window
## Signature
```typescript
function hideIFrame(id?: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
_(Optional)_ Iframe window ID. If not passed in, all iframe windows associated with the extension will be hidden
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
This API is result-oriented: If the specified iframe window is not found, the API returns `false`<!-- -->; if the iframe window was already hidden before the operation, the API returns `true`
Note: This API is only valid for extensions. Calling it in a standalone script environment will always `throw Error`
控制其它扩展打开的内联框架窗口时,`id` 需传入完整 ID 格式:`<其它扩展UUID>.<窗口ID>`<!-- -->(点分隔,窗口 ID 为打开时传入的 `id` 参数)
## Example
```javascript
// 1. 打开一个内联框架窗口(自建 fixture)
const opened = await eda.sys_IFrame.openIFrame('/extension.json', 320, 200, '嘉立创示例_隐藏演示', {
title: '嘉立创示例 隐藏演示窗口',
});
console.log('打开结果:', opened);
// 2. 隐藏该窗口(窗口从界面消失,但未被销毁)
const hidden = await eda.sys_IFrame.hideIFrame('嘉立创示例_隐藏演示');
console.log('隐藏结果:', hidden);
// 3. 对已隐藏的窗口再次隐藏,验证幂等语义(返回 true)
const hideAgain = await eda.sys_IFrame.hideIFrame('嘉立创示例_隐藏演示');
console.log('重复隐藏结果:', hideAgain);
// 4. 对不存在的窗口 ID 隐藏,结果导向返回 false(不抛错)
const hideMissing = await eda.sys_IFrame.hideIFrame('嘉立创示例_不存在的窗口');
console.log('不存在的窗口 ID →', hideMissing);
// 5. 关闭隐藏状态的窗口还原界面(隐藏的窗口可直接关闭)
const closed = await eda.sys_IFrame.closeIFrame('嘉立创示例_隐藏演示');
console.log('关闭隐藏窗口结果:', closed);
```
### isiframealreadyexist
# SYS\_IFrame.isIFrameAlreadyExist() method
> 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.
Whether the iframe already exists
## Signature
```typescript
function isIFrameAlreadyExist(id: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
Iframe ID
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether Exists
## Remarks
Note: This API is only valid for extensions. Calling it in a standalone script environment will always `throw Error`
控制其它扩展打开的内联框架窗口时,`id` 需传入完整 ID 格式:`<其它扩展UUID>.<窗口ID>`<!-- -->(点分隔,窗口 ID 为打开时传入的 `id` 参数) ADD since EDA v4.2
### openiframe
# SYS\_IFrame.openIFrame() method
> 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.
Open iframe window
## Signature
```typescript
function openIFrame(
htmlFileName: string,
width?: number,
height?: number,
id?: string,
props?: {
maximizeButton?: boolean;
minimizeButton?: boolean;
minimizeStyle?: 'collapsed' | 'constricted';
buttonCallbackFn?: (button: 'close' | 'minimize' | 'maximize') => void | Promise<void>;
onBeforeCloseCallFn?: () => boolean | undefined | Promise<boolean | undefined>;
grayscaleMask?: boolean;
title?: string;
x?: number;
y?: number;
},
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
htmlFileName
</td><td>
string
</td><td>
The path of the HTML file to load within the extension package, starting from the extension root directory, e.g. `/iframe/index.html`
</td></tr>
<tr><td>
width
</td><td>
number
</td><td>
_(Optional)_ Width of the iframe window
</td></tr>
<tr><td>
height
</td><td>
number
</td><td>
_(Optional)_ Height of the iframe window
</td></tr>
<tr><td>
id
</td><td>
string
</td><td>
_(Optional)_ Iframe window ID, used to close the iframe window
</td></tr>
<tr><td>
props
</td><td>
{ maximizeButton?: boolean; minimizeButton?: boolean; minimizeStyle?: 'collapsed' \| 'constricted'; buttonCallbackFn?: (button: 'close' \| 'minimize' \| 'maximize') => void \| Promise<void>; onBeforeCloseCallFn?: () => boolean \| undefined \| Promise<boolean \| undefined>; grayscaleMask?: boolean; title?: string; x?: number; y?: number; }
</td><td>
_(Optional)_ Other parameters
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
This API can only be called by extension packages. Users need to include an HTML file for embedding in the extension package;
After this API is called, a Dialog window will open. The title of the Dialog window is the `<title>` of the HTML file, and the title bar has a close button;
The body is an iframe. `width` and `height` are the width and height of the iframe in the body;
The iframe needs to display the content of `htmlFileName`<!-- -->. This HTML is obtained from the extension package and has been stored in IndexedDB during installation
Note: This API is only valid for extensions. Calling it in a standalone script environment will always `throw Error`
## Example
```javascript
// 1. 打开一个带标题和最大化/最小化按钮的内联框架窗口(自建 ID 便于后续定位)
const opened = await eda.sys_IFrame.openIFrame('/extension.json', 360, 240, '嘉立创示例_窗口', {
title: '嘉立创示例 内联框架窗口',
minimizeButton: true,
maximizeButton: true,
grayscaleMask: false,
});
console.log('打开结果:', opened);
// 2. 关闭刚才打开的窗口还原界面(自建自删,保证案例可重复运行)
const closed = await eda.sys_IFrame.closeIFrame('嘉立创示例_窗口');
console.log('关闭结果:', closed);
```
### showiframe
# SYS\_IFrame.showIFrame() method
> 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.
Show iframe window
## Signature
```typescript
function showIFrame(id?: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
_(Optional)_ Iframe window ID. If not passed in, all iframe windows associated with the extension will be shown
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
This API is result-oriented: If the specified iframe window is not found, the API returns `false`<!-- -->; if the iframe window was already in the shown state before the operation, the API returns `true`
Note: This API is only valid for extensions. Calling it in a standalone script environment will always `throw Error`
控制其它扩展打开的内联框架窗口时,`id` 需传入完整 ID 格式:`<其它扩展UUID>.<窗口ID>`<!-- -->(点分隔,窗口 ID 为打开时传入的 `id` 参数)
## Example
```javascript
// 1. 打开一个内联框架窗口(自建 fixture)
const opened = await eda.sys_IFrame.openIFrame('/extension.json', 320, 200, '嘉立创示例_显示演示', {
title: '嘉立创示例 显示演示窗口',
});
console.log('打开结果:', opened);
// 2. 先隐藏窗口,制造"待恢复"状态
await eda.sys_IFrame.hideIFrame('嘉立创示例_显示演示');
console.log('已隐藏窗口,准备恢复显示');
// 3. 显示该窗口(从隐藏状态恢复,界面重新可见)
const shown = await eda.sys_IFrame.showIFrame('嘉立创示例_显示演示');
console.log('显示结果:', shown);
// 4. 对已显示的窗口再次显示,验证幂等语义(返回 true)
const showAgain = await eda.sys_IFrame.showIFrame('嘉立创示例_显示演示');
console.log('重复显示结果:', showAgain);
// 5. 对不存在的窗口 ID 显示,结果导向返回 false(不抛错)
const showMissing = await eda.sys_IFrame.showIFrame('嘉立创示例_不存在的窗口');
console.log('不存在的窗口 ID →', showMissing);
// 6. 关闭窗口还原界面
const closed = await eda.sys_IFrame.closeIFrame('嘉立创示例_显示演示');
console.log('关闭结果:', closed);
```
references/classes/SYS_Log.md
# SYS\_Log class
System / log class
## Signature
```typescript
class SYS_Log
```
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[add(message, type)](./SYS_Log.md)
</td><td>
</td><td>
Add a log entry
</td></tr>
<tr><td>
[clear()](./SYS_Log.md)
</td><td>
</td><td>
Clear the log
</td></tr>
<tr><td>
[export(types)](./SYS_Log.md)
</td><td>
</td><td>
Export the log
</td></tr>
<tr><td>
[find(message, types)](./SYS_Log.md)
</td><td>
</td><td>
Find entries
</td></tr>
<tr><td>
[sort(types)](./SYS_Log.md)
</td><td>
</td><td>
Filter and get log entries
</td></tr>
</tbody></table>
---
## 方法详情
### add
# SYS\_Log.add() method
Add a log entry
## Signature
```typescript
function add(message: string, type?: ESYS_LogType): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
message
</td><td>
string
</td><td>
Log content
</td></tr>
<tr><td>
type
</td><td>
[ESYS\_LogType](../enums/ESYS_LogType.md)
</td><td>
_(Optional)_ Log type
</td></tr>
</tbody></table>
## Returns
void
## Example
```javascript
// 1. 写入三条不同类型的日志(同步调用,立即生效)
eda.sys_Log.add('嘉立创示例_插件启动,开始处理任务');
eda.sys_Log.add('嘉立创示例_检测到网络波动,将自动重试', 'warn');
eda.sys_Log.add('嘉立创示例_文件解析失败', 'error');
// 2. 查询日志面板,确认条目已写入(find 返回 Promise,需要 await)
const found = await eda.sys_Log.find('嘉立创示例_');
console.log('写入的日志条目数:', found.length);
console.log('其中一条:', found[0].message, '(类型:', `${found[0].type})`);
```
### clear
# SYS\_Log.clear() method
Clear the log
## Signature
```typescript
function clear(): void;
```
## Returns
void
## Example
```javascript
// 1. 先写入几条示例日志,让清空效果可见
eda.sys_Log.add('嘉立创示例_清空前日志 1');
eda.sys_Log.add('嘉立创示例_清空前日志 2', 'warn');
const before = await eda.sys_Log.sort();
console.log('清空前的日志条目数:', before.length);
// 2. 清空日志面板(同步调用,立即生效)
eda.sys_Log.clear();
// 3. 再次查询,确认面板已清空
const after = await eda.sys_Log.sort();
console.log('清空后的日志条目数:', after.length);
```
### export
# SYS\_Log.export() method
Export the log
## Signature
```typescript
function export(types?: ESYS_LogType | Array<ESYS_LogType>): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
types
</td><td>
[ESYS\_LogType](../enums/ESYS_LogType.md) \| Array<[ESYS\_LogType](../enums/ESYS_LogType.md)<!-- -->>
</td><td>
_(Optional)_ Log type
</td></tr>
</tbody></table>
## Returns
void
## Example
```javascript
// 1. 先写入几条不同类型的日志,保证导出内容可辨识
eda.sys_Log.add('嘉立创示例_导出演示:信息条目');
eda.sys_Log.add('嘉立创示例_导出演示:警告条目', 'warn');
// 2. 导出全部日志(同步调用,触发一次文件保存)
eda.sys_Log.export();
console.log('已导出全部日志');
// 3. 按类型筛选导出,只导出警告和错误级别(数组可同时指定多种类型)
eda.sys_Log.export(['warn', 'error']);
console.log('已导出 warn 和 error 类型的日志');
```
### find
# SYS\_Log.find() method
Find entries
## Signature
```typescript
function find(
message:
| string
| Array<
| string
| {
text: string;
attr?: {
id?: string;
path?: string;
sheet?: string;
pcbid?: string;
type?: string;
};
}
>,
types?: ESYS_LogType | Array<ESYS_LogType>,
): Promise<Array<ISYS_LogLine>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
message
</td><td>
string \| Array<string \| { text: string; attr?: { id?: string; path?: string; sheet?: string; pcbid?: string; type?: string } }>
</td><td>
Find content
</td></tr>
<tr><td>
types
</td><td>
[ESYS\_LogType](../enums/ESYS_LogType.md) \| Array<[ESYS\_LogType](../enums/ESYS_LogType.md)<!-- -->>
</td><td>
_(Optional)_ Array of log types. The search can be performed within the specified log types
</td></tr>
</tbody></table>
## Returns
Promise<Array<[ISYS\_LogLine](../interfaces/ISYS_LogLine.md)<!-- -->>>
Array of log entries matching the find criteria
## Remarks
If the log panel is open, the find operation will also be displayed on the front end
## Example
```javascript
// 1. 写入待查找的示例日志(一条 info、一条 error)
eda.sys_Log.add('嘉立创示例_查找演示:任务开始');
eda.sys_Log.add('嘉立创示例_查找演示:网络请求失败', 'error');
// 2. 按关键字查找全部匹配条目(返回 Promise,需要 await)
const all = await eda.sys_Log.find('嘉立创示例_查找演示');
console.log('关键字匹配条目数:', all.length);
// 3. 限定只在 error 类型中查找,缩小搜索范围
const errors = await eda.sys_Log.find('嘉立创示例_查找演示', 'error');
console.log('error 类型匹配条目数:', errors.length);
console.log('匹配内容:', errors.map(line => line.message).join(';'));
```
### sort
# SYS\_Log.sort() method
Filter and get log entries
## Signature
```typescript
function sort(types?: ESYS_LogType | Array<ESYS_LogType>): Promise<Array<ISYS_LogLine>>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
types
</td><td>
[ESYS\_LogType](../enums/ESYS_LogType.md) \| Array<[ESYS\_LogType](../enums/ESYS_LogType.md)<!-- -->>
</td><td>
_(Optional)_ Array of log types. Multiple log types can be specified at the same time. If not specified, all types are used
</td></tr>
</tbody></table>
## Returns
Promise<Array<[ISYS\_LogLine](../interfaces/ISYS_LogLine.md)<!-- -->>>
Array of log entries matching the filter criteria
## Remarks
If the log panel is open, the filter operation will also be displayed on the front end
## Example
```javascript
// 1. 写入三种不同类型的示例日志,便于观察筛选效果
eda.sys_Log.add('嘉立创示例_筛选演示:常规信息');
eda.sys_Log.add('嘉立创示例_筛选演示:电压偏高', 'warn');
eda.sys_Log.add('嘉立创示例_筛选演示:铺铜失败', 'error');
// 2. 不传参数,获取全部类型的日志(返回 Promise,需要 await)
const all = await eda.sys_Log.sort();
console.log('全部日志条目数:', all.length);
// 3. 传入类型数组,只筛选警告和错误两类
const problems = await eda.sys_Log.sort(['warn', 'error']);
console.log('警告和错误条目数:', problems.length);
console.log('问题明细:', problems.map(line => `[${line.type}] ${line.message}`).join(';'));
```
references/classes/SYS_Message.md
# SYS\_Message class
System / message notification class
## Signature
```typescript
class SYS_Message
```
## Remarks
Generate various non-intrusive reminders for users
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[removeFollowMouseTip(tip)](./SYS_Message.md)
</td><td>
</td><td>
**_(BETA)_** Remove the follow-mouse tip
</td></tr>
<tr><td>
[showFollowMouseTip(tip, msTimeout)](./SYS_Message.md)
</td><td>
</td><td>
**_(BETA)_** Show the follow-mouse tip
</td></tr>
<tr><td>
[showToastMessage(message, messageType, timer, bottomPanel, buttonTitle, buttonCallbackFn)](./SYS_Message.md)
</td><td>
</td><td>
Show a toast message
</td></tr>
</tbody></table>
---
## 方法详情
### removefollowmousetip
# SYS\_Message.removeFollowMouseTip() method
> 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.
Remove the follow-mouse tip
## Signature
```typescript
function removeFollowMouseTip(tip?: string): Promise<void>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
tip
</td><td>
string
</td><td>
_(Optional)_ Tip content. If passed in, the tip is only removed when the current tip matches the specified content
</td></tr>
</tbody></table>
## Returns
Promise<void>
## Remarks
Remove the current or specified follow-mouse tip
## Example
```javascript
// 1. 展示一条持续提示(不传时间参数,不会自动消失)
eda.sys_Message.showFollowMouseTip('嘉立创示例_待移除的提示');
console.log('鼠标提示已显示');
// 2. 传入不匹配的内容:当前提示内容不同,不会被移除
eda.sys_Message.removeFollowMouseTip('嘉立创示例_另一条提示');
console.log('传入内容与当前提示不匹配,提示仍在显示');
// 3. 传入匹配的内容:内容一致时移除
eda.sys_Message.removeFollowMouseTip('嘉立创示例_待移除的提示');
console.log('传入内容与当前提示一致,提示已移除');
// 4. 不传参数:无论内容直接移除当前提示
eda.sys_Message.showFollowMouseTip('嘉立创示例_新的提示');
eda.sys_Message.removeFollowMouseTip();
console.log('不传参数已直接移除当前提示');
```
### showfollowmousetip
# SYS\_Message.showFollowMouseTip() method
> 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.
Show the follow-mouse tip
## Signature
```typescript
function showFollowMouseTip(tip: string, msTimeout?: number): Promise<void>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
tip
</td><td>
string
</td><td>
Tip content
</td></tr>
<tr><td>
msTimeout
</td><td>
number
</td><td>
_(Optional)_ Display duration in milliseconds (ms). If not passed in, the tip is displayed continuously until [removeFollowMouseTip](./SYS_Message.md) is called or it is covered by another tip
</td></tr>
</tbody></table>
## Returns
Promise<void>
## Remarks
Only one tip can be shown at a time. If a new tip is shown, the previous tip will be automatically removed
## Example
```javascript
// 1. 限时提示:2000 毫秒后自动消失,无需手动清理
eda.sys_Message.showFollowMouseTip('嘉立创示例_这条提示 2 秒后自动消失', 2000);
console.log('限时鼠标提示已显示,2 秒后自动消失');
// 2. 持续提示:不传时间参数则一直展示,直到被移除或被新提示覆盖
eda.sys_Message.showFollowMouseTip('嘉立创示例_这条提示会一直跟随鼠标');
console.log('持续鼠标提示已显示(新提示覆盖了上一条)');
// 3. 持续提示必须手动收尾,避免遗留(自建自删,保证案例可重复运行)
await new Promise(r => setTimeout(r, 1000));
eda.sys_Message.removeFollowMouseTip();
console.log('持续鼠标提示已手动移除');
```
### showtoastmessage
# SYS\_Message.showToastMessage() method
Show a toast message
## Signature
```typescript
function showToastMessage(
message: string,
messageType?: ESYS_ToastMessageType,
timer?: number,
bottomPanel?: ESYS_BottomPanelTab,
buttonTitle?: string,
buttonCallbackFn?: string,
): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
message
</td><td>
string
</td><td>
Message content
</td></tr>
<tr><td>
messageType
</td><td>
[ESYS\_ToastMessageType](../enums/ESYS_ToastMessageType.md)
</td><td>
_(Optional)_ Message type
</td></tr>
<tr><td>
timer
</td><td>
number
</td><td>
_(Optional)_ Auto-close countdown in seconds. `0` means it will not auto-close
</td></tr>
<tr><td>
bottomPanel
</td><td>
[ESYS\_BottomPanelTab](../enums/ESYS_BottomPanelTab.md)
</td><td>
_(Optional)_ Expand the bottom information panel
</td></tr>
<tr><td>
buttonTitle
</td><td>
string
</td><td>
_(Optional)_ Callback button title
</td></tr>
<tr><td>
buttonCallbackFn
</td><td>
string
</td><td>
_(Optional)_ Callback function content, in string form. It will be automatically parsed and executed
</td></tr>
</tbody></table>
## Returns
void
## Example
```javascript
// 1. 最简调用:默认信息类型,默认 3 秒后自动关闭
eda.sys_Message.showToastMessage('嘉立创示例 工程已自动保存');
console.log('信息吐司已显示,3 秒后自动关闭');
// 2. 指定消息类型与倒计时秒数:成功图标,2 秒后自动关闭
eda.sys_Message.showToastMessage('嘉立创示例 导出完成', 'success', 2);
console.log('成功吐司已显示,2 秒后自动关闭');
// 3. 带回调按钮与底部面板联动:点击按钮执行回调并展开日志面板
eda.sys_Message.showToastMessage(
'嘉立创示例 检查完成,详见日志面板',
'warn',
5,
'log',
'查看日志',
'console.log("嘉立创示例 按钮回调被执行")'
);
console.log('警告吐司已显示,附带查看日志按钮,5 秒后自动关闭');
```
references/classes/SYS_Math.md
# SYS\_Math class
System / math class
## Signature
```typescript
class SYS_Math
```
## Remarks
Provides polygon geometry calculation methods, supporting discrete point coordinates and [TPCB\_PolygonSourceArray](../types/TPCB_PolygonSourceArray.md) polygon data
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[bboxIntersects(bbox1, bbox2)](./SYS_Math.md)
</td><td>
</td><td>
Quickly determine whether two BBoxes intersect
</td></tr>
<tr><td>
[calculateArea(polygon)](./SYS_Math.md)
</td><td>
</td><td>
Calculate the area of a polygon
</td></tr>
<tr><td>
[calculatePerimeter(polygon)](./SYS_Math.md)
</td><td>
</td><td>
Calculate the perimeter of a polygon
</td></tr>
<tr><td>
[contains(polygon1, polygon2)](./SYS_Math.md)
</td><td>
</td><td>
Determine whether polygon1 completely contains polygon2
</td></tr>
<tr><td>
[containsPoint(polygon, point)](./SYS_Math.md)
</td><td>
</td><td>
Determine whether the point is inside the polygon
</td></tr>
<tr><td>
[distanceToPoint(polygon, point)](./SYS_Math.md)
</td><td>
</td><td>
Calculate the shortest distance from a point to the polygon boundary
</td></tr>
<tr><td>
[getBBox(polygon)](./SYS_Math.md)
</td><td>
</td><td>
Get the minimum bounding rectangle (BBox) of the polygon
</td></tr>
<tr><td>
[getCentroid(polygon)](./SYS_Math.md)
</td><td>
</td><td>
Calculate the centroid of the polygon
</td></tr>
<tr><td>
[intersection(polygon1, polygon2)](./SYS_Math.md)
</td><td>
</td><td>
Calculate the intersection of two polygons
</td></tr>
<tr><td>
[intersects(polygon1, polygon2)](./SYS_Math.md)
</td><td>
</td><td>
Determine whether two polygons intersect
</td></tr>
<tr><td>
[rotate(polygon, angle, centerX, centerY)](./SYS_Math.md)
</td><td>
</td><td>
Rotate the polygon
</td></tr>
<tr><td>
[scale(polygon, scaleX, scaleY, centerX, centerY)](./SYS_Math.md)
</td><td>
</td><td>
Scale the polygon
</td></tr>
<tr><td>
[subtract(polygon1, polygon2)](./SYS_Math.md)
</td><td>
</td><td>
Calculate the difference of two polygons (polygon1 - polygon2)
</td></tr>
<tr><td>
[translate(polygon, dx, dy)](./SYS_Math.md)
</td><td>
</td><td>
Translate the polygon
</td></tr>
<tr><td>
[union(polygon1, polygon2)](./SYS_Math.md)
</td><td>
</td><td>
Calculate the union of two polygons
</td></tr>
<tr><td>
[xor(polygon1, polygon2)](./SYS_Math.md)
</td><td>
</td><td>
Calculate the symmetric difference (XOR) of two polygons
</td></tr>
</tbody></table>
---
## 方法详情
### bboxintersects
# SYS\_Math.bboxIntersects() method
Quickly determine whether two BBoxes intersect
## Signature
```typescript
function bboxIntersects(bbox1: ISYS_MathBBox, bbox2: ISYS_MathBBox): boolean;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
bbox1
</td><td>
[ISYS\_MathBBox](../interfaces/ISYS_MathBBox.md)
</td><td>
BBox 1
</td></tr>
<tr><td>
bbox2
</td><td>
[ISYS\_MathBBox](../interfaces/ISYS_MathBBox.md)
</td><td>
BBox 2
</td></tr>
</tbody></table>
## Returns
boolean
Whether they intersect
## Example
```javascript
// 1. 两块铺铜区域的外接矩形(部分重叠)
const zoneA = { minX: 0, minY: 0, maxX: 100, maxY: 80 };
const zoneB = { minX: 50, minY: 20, maxX: 150, maxY: 60 };
console.log('区域 A 与区域 B 相交:', eda.sys_Math.bboxIntersects(zoneA, zoneB));
// 2. 完全分离的两个矩形(不相交,粗筛即可排除)
const zoneC = { minX: 200, minY: 200, maxX: 300, maxY: 280 };
console.log('区域 A 与区域 C 相交:', eda.sys_Math.bboxIntersects(zoneA, zoneC));
// 3. 仅有边界接触也算相交(贴合的两个矩形)
const zoneD = { minX: 100, minY: 0, maxX: 180, maxY: 40 };
console.log('区域 A 与区域 D 相交:', eda.sys_Math.bboxIntersects(zoneA, zoneD));
```
### calculatearea
# SYS\_Math.calculateArea() method
Calculate the area of a polygon
## Signature
```typescript
function calculateArea(polygon: TSYS_MathPolygonInput): number;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
polygon
</td><td>
[TSYS\_MathPolygonInput](../types/TSYS_MathPolygonInput.md)
</td><td>
Polygon or polygon group
</td></tr>
</tbody></table>
## Returns
number
Area (absolute area for a single polygon, net area for a polygon group)
## Remarks
Calculated using the Shoelace formula: - When a single polygon is passed in, the absolute area of the polygon is returned - When a polygon group ([TSYS\_MathPolygonGroup](../types/TSYS_MathPolygonGroup.md)<!-- -->, such as the return value of Boolean operations) is passed in, the net area is obtained by subtracting the sum of all hole areas from the sum of all outer ring areas
## Example
```javascript
// 1. 单个矩形 100 x 80(单位随输入坐标系,PCB 场景下通常是 mil)
const rect = [{ x: 0, y: 0 }, { x: 100, y: 0 }, { x: 100, y: 80 }, { x: 0, y: 80 }];
console.log('矩形面积:', eda.sys_Math.calculateArea(rect));
// 2. 单个三角形(底 100 高 60,面积应为 3000)
const triangle = [{ x: 0, y: 0 }, { x: 100, y: 0 }, { x: 50, y: 60 }];
console.log('三角形面积:', eda.sys_Math.calculateArea(triangle));
// 3. 布尔运算返回的多边形组直接作为输入,得到净面积(含孔洞时自动扣除)
const overlap = [{ x: 50, y: 20 }, { x: 150, y: 20 }, { x: 150, y: 60 }, { x: 50, y: 60 }];
const merged = eda.sys_Math.union(rect, overlap);
console.log('两矩形合并后的净面积:', eda.sys_Math.calculateArea(merged));
```
### calculateperimeter
# SYS\_Math.calculatePerimeter() method
Calculate the perimeter of a polygon
## Signature
```typescript
function calculatePerimeter(polygon: TSYS_MathPolygonInput): number;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
polygon
</td><td>
[TSYS\_MathPolygonInput](../types/TSYS_MathPolygonInput.md)
</td><td>
Polygon
</td></tr>
</tbody></table>
## Returns
number
Perimeter
## Example
```javascript
// 1. 矩形 100 x 80,周长应为 360
const rect = [{ x: 0, y: 0 }, { x: 100, y: 0 }, { x: 100, y: 80 }, { x: 0, y: 80 }];
console.log('矩形周长:', eda.sys_Math.calculatePerimeter(rect));
// 2. L 形轮廓(缺口裁掉一个角,周长按实际边界累加)
const lShape = [
{ x: 0, y: 0 },
{ x: 100, y: 0 },
{ x: 100, y: 40 },
{ x: 40, y: 40 },
{ x: 40, y: 80 },
{ x: 0, y: 80 },
];
console.log('L 形轮廓周长:', eda.sys_Math.calculatePerimeter(lShape));
// 3. 布尔运算返回的多边形组同样可以作为输入
const hole = [{ x: 30, y: 20 }, { x: 70, y: 20 }, { x: 70, y: 60 }, { x: 30, y: 60 }];
const cut = eda.sys_Math.subtract(rect, hole);
console.log('挖孔后多边形组的周长:', eda.sys_Math.calculatePerimeter(cut));
```
### contains
# SYS\_Math.contains() method
Determine whether polygon1 completely contains polygon2
## Signature
```typescript
function contains(polygon1: TSYS_MathPolygonInput, polygon2: TSYS_MathPolygonInput): boolean;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
polygon1
</td><td>
[TSYS\_MathPolygonInput](../types/TSYS_MathPolygonInput.md)
</td><td>
Outer polygon
</td></tr>
<tr><td>
polygon2
</td><td>
[TSYS\_MathPolygonInput](../types/TSYS_MathPolygonInput.md)
</td><td>
Internal polygon
</td></tr>
</tbody></table>
## Returns
boolean
Whether polygon1 completely contains polygon2
## Example
```javascript
// 1. 小矩形完全落在大矩形内部 → true
const board = [{ x: 0, y: 0 }, { x: 200, y: 0 }, { x: 200, y: 120 }, { x: 0, y: 120 }];
const device = [{ x: 50, y: 40 }, { x: 90, y: 40 }, { x: 90, y: 70 }, { x: 50, y: 70 }];
console.log('板框完全包含器件:', eda.sys_Math.contains(board, device));
// 2. 器件跨越板框边界(部分重叠,不是完全包含)→ false
const overhang = [{ x: 150, y: 40 }, { x: 250, y: 40 }, { x: 250, y: 70 }, { x: 150, y: 70 }];
console.log('板框完全包含越界器件:', eda.sys_Math.contains(board, overhang));
// 3. 只关心区域重叠不关心完全包含时,配合 intersects 使用
console.log('两器件区域有重叠:', eda.sys_Math.intersects(device, overhang));
```
### containspoint
# SYS\_Math.containsPoint() method
Determine whether the point is inside the polygon
## Signature
```typescript
function containsPoint(polygon: TSYS_MathPolygonInput, point: ISYS_MathPoint): boolean;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
polygon
</td><td>
[TSYS\_MathPolygonInput](../types/TSYS_MathPolygonInput.md)
</td><td>
Polygon
</td></tr>
<tr><td>
point
</td><td>
[ISYS\_MathPoint](../interfaces/ISYS_MathPoint.md)
</td><td>
The point to determine
</td></tr>
</tbody></table>
## Returns
boolean
Whether In polygon internal
## Remarks
Use the ray casting method to determine whether the point is inside the polygon
Due to the characteristics of the ray casting method, points on the boundary behave inconsistently: some boundary points may return `true`<!-- -->, and some may return `false`<!-- -->, depending on the geometric relationship between the ray direction and the boundary
To strictly determine whether the point is on the boundary, combine [SYS\_Math.distanceToPoint()](./SYS_Math.md) to check whether the distance is `0`
## Example
```javascript
// 1. 定义一块禁布区,测试三个典型位置的点
const keepout = [{ x: 0, y: 0 }, { x: 100, y: 0 }, { x: 100, y: 80 }, { x: 0, y: 80 }];
const inside = { x: 50, y: 40 }; // 区域中心,明显在内部
const outside = { x: 150, y: 40 }; // 区域右侧,明显在外部
const corner = { x: 0, y: 0 }; // 顶点,落在边界上
console.log('中心点在禁布区内:', eda.sys_Math.containsPoint(keepout, inside));
console.log('外部点在禁布区内:', eda.sys_Math.containsPoint(keepout, outside));
console.log('顶点在禁布区内:', eda.sys_Math.containsPoint(keepout, corner));
// 2. 严格判断边界点:距离为 0 说明点恰好在边界上
console.log('顶点到边界的距离:', eda.sys_Math.distanceToPoint(keepout, corner));
```
### distancetopoint
# SYS\_Math.distanceToPoint() method
Calculate the shortest distance from a point to the polygon boundary
## Signature
```typescript
function distanceToPoint(polygon: TSYS_MathPolygonInput, point: ISYS_MathPoint): number;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
polygon
</td><td>
[TSYS\_MathPolygonInput](../types/TSYS_MathPolygonInput.md)
</td><td>
Polygon
</td></tr>
<tr><td>
point
</td><td>
[ISYS\_MathPoint](../interfaces/ISYS_MathPoint.md)
</td><td>
The point to calculate
</td></tr>
</tbody></table>
## Returns
number
Shortest distance. If the point is inside the polygon, `0` is returned
## Example
```javascript
// 1. 定义矩形区域(右边界在 x = 100)
const zone = [{ x: 0, y: 0 }, { x: 100, y: 0 }, { x: 100, y: 80 }, { x: 0, y: 80 }];
// 2. 外部点:到右边界的水平距离为 50
const outsidePoint = { x: 150, y: 40 };
console.log('外部点到边界的最短距离:', eda.sys_Math.distanceToPoint(zone, outsidePoint));
// 3. 内部点:在多边形内部时返回 0
const insidePoint = { x: 50, y: 40 };
console.log('内部点到边界的最短距离:', eda.sys_Math.distanceToPoint(zone, insidePoint));
// 4. 斜向最近边不是正对的那条边时,结果取真实垂线距离
const diagonalPoint = { x: 130, y: 110 };
console.log('斜向点到边界的最短距离:', eda.sys_Math.distanceToPoint(zone, diagonalPoint));
```
### getbbox
# SYS\_Math.getBBox() method
Get the minimum bounding rectangle (BBox) of the polygon
## Signature
```typescript
function getBBox(polygon: TSYS_MathPolygonInput): ISYS_MathBBox;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
polygon
</td><td>
[TSYS\_MathPolygonInput](../types/TSYS_MathPolygonInput.md)
</td><td>
Polygon
</td></tr>
</tbody></table>
## Returns
[ISYS\_MathBBox](../interfaces/ISYS_MathBBox.md)
BBox
## Example
```javascript
// 1. 斜置的三角形,外接矩形由三个顶点的极值决定
const triangle = [{ x: 30, y: 10 }, { x: 120, y: 50 }, { x: 60, y: 90 }];
const bbox = eda.sys_Math.getBBox(triangle);
console.log('三角形的最小外接矩形:', JSON.stringify(bbox));
// 2. 布尔运算得到的多边形组同样可以求 BBox(取整组的外包范围)
const rectA = [{ x: 0, y: 0 }, { x: 100, y: 0 }, { x: 100, y: 80 }, { x: 0, y: 80 }];
const rectB = [{ x: 50, y: 20 }, { x: 150, y: 20 }, { x: 150, y: 60 }, { x: 50, y: 60 }];
const merged = eda.sys_Math.union(rectA, rectB);
console.log('合并区域的最小外接矩形:', JSON.stringify(eda.sys_Math.getBBox(merged)));
// 3. BBox 直接作为 bboxIntersects() 的输入做快速相交预检
const other = { minX: 200, minY: 0, maxX: 280, maxY: 40 };
console.log('两区域外接矩形相交:', eda.sys_Math.bboxIntersects(bbox, other));
```
### getcentroid
# SYS\_Math.getCentroid() method
Calculate the centroid of the polygon
## Signature
```typescript
function getCentroid(polygon: TSYS_MathPolygonInput): ISYS_MathPoint;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
polygon
</td><td>
[TSYS\_MathPolygonInput](../types/TSYS_MathPolygonInput.md)
</td><td>
Polygon
</td></tr>
</tbody></table>
## Returns
[ISYS\_MathPoint](../interfaces/ISYS_MathPoint.md)
Centroid coordinate
## Example
```javascript
// 1. 规则矩形:质心就是几何中心 (50, 40)
const rect = [{ x: 0, y: 0 }, { x: 100, y: 0 }, { x: 100, y: 80 }, { x: 0, y: 80 }];
console.log('矩形质心:', JSON.stringify(eda.sys_Math.getCentroid(rect)));
// 2. L 形轮廓:质心向材料厚的一侧偏移,不再等于外接矩形中心 (50, 40)
const lShape = [
{ x: 0, y: 0 },
{ x: 100, y: 0 },
{ x: 100, y: 40 },
{ x: 40, y: 40 },
{ x: 40, y: 80 },
{ x: 0, y: 80 },
];
const centroid = eda.sys_Math.getCentroid(lShape);
console.log('L 形质心:', JSON.stringify(centroid));
// 3. 以质心为中心做旋转,图形绕自身几何中心原地转动
const rotated = eda.sys_Math.rotate(rect, 90);
console.log('绕质心旋转 90 度后的第一个点:', JSON.stringify(rotated[0]));
```
### intersection
# SYS\_Math.intersection() method
Calculate the intersection of two polygons
## Signature
```typescript
function intersection(
polygon1: TSYS_MathPolygonInput,
polygon2: TSYS_MathPolygonInput,
): TSYS_MathPolygonGroup;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
polygon1
</td><td>
[TSYS\_MathPolygonInput](../types/TSYS_MathPolygonInput.md)
</td><td>
Polygon 1
</td></tr>
<tr><td>
polygon2
</td><td>
[TSYS\_MathPolygonInput](../types/TSYS_MathPolygonInput.md)
</td><td>
Polygon 2
</td></tr>
</tbody></table>
## Returns
[TSYS\_MathPolygonGroup](../types/TSYS_MathPolygonGroup.md)
Polygon group of the intersection result. An empty array means no intersection
## Example
```javascript
// 1. 两块部分重叠的矩形区域
const copperA = [{ x: 0, y: 0 }, { x: 100, y: 0 }, { x: 100, y: 80 }, { x: 0, y: 80 }];
const copperB = [{ x: 50, y: 20 }, { x: 150, y: 20 }, { x: 150, y: 60 }, { x: 50, y: 60 }];
// 2. 求交集,结果为一个新的多边形组
const overlap = eda.sys_Math.intersection(copperA, copperB);
console.log('重叠区域个数:', overlap.length);
console.log('重叠区域外环顶点:', overlap[0].outer.length, '个');
console.log('重叠区域孔洞数:', overlap[0].holes.length);
// 3. 交集面积:100 x 100 与 100 x 80 的重叠部分为 50 x 40 = 2000
console.log('重叠区域面积:', eda.sys_Math.calculateArea(overlap));
// 4. 完全分离的两个多边形没有交集,返回空数组
const far = [{ x: 200, y: 0 }, { x: 280, y: 0 }, { x: 280, y: 40 }, { x: 200, y: 40 }];
console.log('分离区域的交集个数:', eda.sys_Math.intersection(copperA, far).length);
```
### intersects
# SYS\_Math.intersects() method
Determine whether two polygons intersect
## Signature
```typescript
function intersects(polygon1: TSYS_MathPolygonInput, polygon2: TSYS_MathPolygonInput): boolean;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
polygon1
</td><td>
[TSYS\_MathPolygonInput](../types/TSYS_MathPolygonInput.md)
</td><td>
Polygon 1
</td></tr>
<tr><td>
polygon2
</td><td>
[TSYS\_MathPolygonInput](../types/TSYS_MathPolygonInput.md)
</td><td>
Polygon 2
</td></tr>
</tbody></table>
## Returns
boolean
Whether they intersect
## Remarks
Determine whether the regions of two polygons have any overlap (including containment, partial intersection, and boundary contact)
## Example
```javascript
// 1. 部分重叠的两个矩形 → true
const trace = [{ x: 0, y: 0 }, { x: 100, y: 0 }, { x: 100, y: 80 }, { x: 0, y: 80 }];
const keepout = [{ x: 50, y: 20 }, { x: 150, y: 20 }, { x: 150, y: 60 }, { x: 50, y: 60 }];
console.log('走线闯入禁布区:', eda.sys_Math.intersects(trace, keepout));
// 2. 完全分离 → false
const far = [{ x: 200, y: 0 }, { x: 280, y: 0 }, { x: 280, y: 40 }, { x: 200, y: 40 }];
console.log('走线远离另一区域:', eda.sys_Math.intersects(trace, far));
// 3. 完全包含也是相交的一种 → true
const small = [{ x: 20, y: 20 }, { x: 60, y: 20 }, { x: 60, y: 50 }, { x: 20, y: 50 }];
console.log('小区域整体在走线范围内:', eda.sys_Math.intersects(trace, small));
// 4. 仅边界贴合同样算相交 → true
const touching = [{ x: 100, y: 0 }, { x: 180, y: 0 }, { x: 180, y: 40 }, { x: 100, y: 40 }];
console.log('两区域边界贴合:', eda.sys_Math.intersects(trace, touching));
```
### rotate
# SYS\_Math.rotate() method
Rotate the polygon
## Signature
```typescript
function rotate(
polygon: TSYS_MathPolygonInput,
angle: number,
centerX?: number,
centerY?: number,
): Array<ISYS_MathPoint>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
polygon
</td><td>
[TSYS\_MathPolygonInput](../types/TSYS_MathPolygonInput.md)
</td><td>
Polygon
</td></tr>
<tr><td>
angle
</td><td>
number
</td><td>
Rotation angle (in degrees, positive values are counterclockwise)
</td></tr>
<tr><td>
centerX
</td><td>
number
</td><td>
_(Optional)_ X coordinate of the rotation center, defaulting to the centroid
</td></tr>
<tr><td>
centerY
</td><td>
number
</td><td>
_(Optional)_ Y coordinate of the rotation center, defaulting to the centroid
</td></tr>
</tbody></table>
## Returns
Array<[ISYS\_MathPoint](../interfaces/ISYS_MathPoint.md)<!-- -->>
Array of discrete points after rotation
## Example
```javascript
// 1. 定义一个矩形安装座
const mount = [{ x: 0, y: 0 }, { x: 100, y: 0 }, { x: 100, y: 80 }, { x: 0, y: 80 }];
// 2. 不传中心:绕质心 (50, 40) 逆时针旋转 90 度,占位原地转身
const selfRotated = eda.sys_Math.rotate(mount, 90);
console.log('绕质心旋转后的顶点:', JSON.stringify(selfRotated));
// 3. 传中心参数:绕坐标原点 (0, 0) 旋转 90 度,图形整体公转
// 逆时针 90 度把 (x, y) 映射为 (-y, x)
const originRotated = eda.sys_Math.rotate(mount, 90, 0, 0);
console.log('绕原点旋转后的顶点:', JSON.stringify(originRotated));
// 4. 负角度顺时针旋转,与正角度互为逆变换
const back = eda.sys_Math.rotate(originRotated, -90, 0, 0);
console.log('再顺时针转回后的第一个点:', JSON.stringify(back[0]));
```
### scale
# SYS\_Math.scale() method
Scale the polygon
## Signature
```typescript
function scale(
polygon: TSYS_MathPolygonInput,
scaleX: number,
scaleY?: number,
centerX?: number,
centerY?: number,
): Array<ISYS_MathPoint>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
polygon
</td><td>
[TSYS\_MathPolygonInput](../types/TSYS_MathPolygonInput.md)
</td><td>
Polygon
</td></tr>
<tr><td>
scaleX
</td><td>
number
</td><td>
X direction scale ratio
</td></tr>
<tr><td>
scaleY
</td><td>
number
</td><td>
_(Optional)_ Y direction scale ratio, defaulting to the same as scaleX
</td></tr>
<tr><td>
centerX
</td><td>
number
</td><td>
_(Optional)_ X coordinate of the scaling center, defaulting to the centroid
</td></tr>
<tr><td>
centerY
</td><td>
number
</td><td>
_(Optional)_ Y coordinate of the scaling center, defaulting to the centroid
</td></tr>
</tbody></table>
## Returns
Array<[ISYS\_MathPoint](../interfaces/ISYS_MathPoint.md)<!-- -->>
Array of discrete points after scaling
## Example
```javascript
// 1. 定义一个矩形焊区
const pad = [{ x: 0, y: 0 }, { x: 100, y: 0 }, { x: 100, y: 80 }, { x: 0, y: 80 }];
// 2. 等比放大 1.5 倍:绕质心原地放大,面积变为 2.25 倍
const enlarged = eda.sys_Math.scale(pad, 1.5);
console.log('放大 1.5 倍后的顶点:', JSON.stringify(enlarged));
console.log('放大后的面积:', eda.sys_Math.calculateArea(enlarged));
// 3. X、Y 采用不同比例:只在 X 方向拉宽 2 倍(绕质心,Y 不变)
const stretched = eda.sys_Math.scale(pad, 2, 1);
console.log('仅 X 方向放大 2 倍后的顶点:', JSON.stringify(stretched));
// 4. 指定缩放中心 (0, 0):各点坐标直接乘以比例
const fromOrigin = eda.sys_Math.scale(pad, 2, 2, 0, 0);
console.log('绕原点放大后的第一个点:', JSON.stringify(fromOrigin[0]));
```
### subtract
# SYS\_Math.subtract() method
Calculate the difference of two polygons (polygon1 - polygon2)
## Signature
```typescript
function subtract(
polygon1: TSYS_MathPolygonInput,
polygon2: TSYS_MathPolygonInput,
): TSYS_MathPolygonGroup;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
polygon1
</td><td>
[TSYS\_MathPolygonInput](../types/TSYS_MathPolygonInput.md)
</td><td>
Minuend polygon
</td></tr>
<tr><td>
polygon2
</td><td>
[TSYS\_MathPolygonInput](../types/TSYS_MathPolygonInput.md)
</td><td>
Subtrahend polygon
</td></tr>
</tbody></table>
## Returns
[TSYS\_MathPolygonGroup](../types/TSYS_MathPolygonGroup.md)
Polygon group of the difference result, preserving the association between outer rings and holes
## Example
```javascript
// 1. 大矩形铺铜区域与一个完全落在其内部的矩形开孔区
const copper = [{ x: 0, y: 0 }, { x: 100, y: 0 }, { x: 100, y: 80 }, { x: 0, y: 80 }];
const hole = [{ x: 30, y: 20 }, { x: 70, y: 20 }, { x: 70, y: 60 }, { x: 30, y: 60 }];
// 2. 挖孔:差集结果的多边形组里,开孔区被记为孔洞
const cut = eda.sys_Math.subtract(copper, hole);
console.log('差集结果多边形个数:', cut.length);
console.log('孔洞数:', cut[0].holes.length);
// 3. 挖孔后的净面积:100 x 80 - 40 x 40 = 6400
console.log('挖孔后的净面积:', eda.sys_Math.calculateArea(cut));
// 4. 减去完全分离的多边形不产生任何变化(结果仍是原形状的等价组)
const far = [{ x: 200, y: 0 }, { x: 280, y: 0 }, { x: 280, y: 40 }, { x: 200, y: 40 }];
const untouched = eda.sys_Math.subtract(copper, far);
console.log('减去分离区域后的面积:', eda.sys_Math.calculateArea(untouched));
```
### translate
# SYS\_Math.translate() method
Translate the polygon
## Signature
```typescript
function translate(polygon: TSYS_MathPolygonInput, dx: number, dy: number): Array<ISYS_MathPoint>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
polygon
</td><td>
[TSYS\_MathPolygonInput](../types/TSYS_MathPolygonInput.md)
</td><td>
Polygon
</td></tr>
<tr><td>
dx
</td><td>
number
</td><td>
X direction offset
</td></tr>
<tr><td>
dy
</td><td>
number
</td><td>
Y direction offset
</td></tr>
</tbody></table>
## Returns
Array<[ISYS\_MathPoint](../interfaces/ISYS_MathPoint.md)<!-- -->>
Array of discrete points after translation
## Example
```javascript
// 1. 定义一个器件占位轮廓
const footprint = [{ x: 0, y: 0 }, { x: 100, y: 0 }, { x: 100, y: 80 }, { x: 0, y: 80 }];
// 2. 向右平移 200、向上平移 150(得到排布到新位置的轮廓)
const placed = eda.sys_Math.translate(footprint, 200, 150);
console.log('平移后的顶点:', JSON.stringify(placed));
// 3. 负偏移向左下方平移
const back = eda.sys_Math.translate(placed, -200, -150);
console.log('再平移回原位后的第一个点:', JSON.stringify(back[0]));
// 4. 平移前后形状不变,周长与面积保持一致
console.log('平移前后周长:', eda.sys_Math.calculatePerimeter(footprint), '/', eda.sys_Math.calculatePerimeter(placed));
```
### union
# SYS\_Math.union() method
Calculate the union of two polygons
## Signature
```typescript
function union(
polygon1: TSYS_MathPolygonInput,
polygon2: TSYS_MathPolygonInput,
): TSYS_MathPolygonGroup;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
polygon1
</td><td>
[TSYS\_MathPolygonInput](../types/TSYS_MathPolygonInput.md)
</td><td>
Polygon 1
</td></tr>
<tr><td>
polygon2
</td><td>
[TSYS\_MathPolygonInput](../types/TSYS_MathPolygonInput.md)
</td><td>
Polygon 2
</td></tr>
</tbody></table>
## Returns
[TSYS\_MathPolygonGroup](../types/TSYS_MathPolygonGroup.md)
Polygon group of the union result, preserving the association between outer rings and holes
## Example
```javascript
// 1. 两块部分重叠的铺铜区域
const copperA = [{ x: 0, y: 0 }, { x: 100, y: 0 }, { x: 100, y: 80 }, { x: 0, y: 80 }];
const copperB = [{ x: 50, y: 20 }, { x: 150, y: 20 }, { x: 150, y: 60 }, { x: 50, y: 60 }];
// 2. 合并:结果是一个多边形组(重叠区域融合成单一外环,无孔洞)
const merged = eda.sys_Math.union(copperA, copperB);
console.log('合并后多边形个数:', merged.length);
console.log('合并后外环顶点数:', merged[0].outer.length);
console.log('合并后孔洞数:', merged[0].holes.length);
// 3. 合并后的净面积:8000 + 4000 - 重叠的 2000 = 10000(重叠只算一次)
console.log('合并后面积:', eda.sys_Math.calculateArea(merged));
// 4. 完全分离的两个多边形合并时仍是两个独立多边形
const far = [{ x: 200, y: 0 }, { x: 280, y: 0 }, { x: 280, y: 40 }, { x: 200, y: 40 }];
console.log('分离区域合并后个数:', eda.sys_Math.union(copperA, far).length);
```
### xor
# SYS\_Math.xor() method
Calculate the symmetric difference (XOR) of two polygons
## Signature
```typescript
function xor(
polygon1: TSYS_MathPolygonInput,
polygon2: TSYS_MathPolygonInput,
): TSYS_MathPolygonGroup;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
polygon1
</td><td>
[TSYS\_MathPolygonInput](../types/TSYS_MathPolygonInput.md)
</td><td>
Polygon 1
</td></tr>
<tr><td>
polygon2
</td><td>
[TSYS\_MathPolygonInput](../types/TSYS_MathPolygonInput.md)
</td><td>
Polygon 2
</td></tr>
</tbody></table>
## Returns
[TSYS\_MathPolygonGroup](../types/TSYS_MathPolygonGroup.md)
Polygon group of the symmetric difference result, preserving the association between outer rings and holes
## Example
```javascript
// 1. 新旧两版部分重叠的板框轮廓
const oldOutline = [{ x: 0, y: 0 }, { x: 100, y: 0 }, { x: 100, y: 80 }, { x: 0, y: 80 }];
const newOutline = [{ x: 50, y: 20 }, { x: 150, y: 20 }, { x: 150, y: 60 }, { x: 50, y: 60 }];
// 2. 异或:重叠的中间区域被扣除,剩下两侧不重叠的部分
const diff = eda.sys_Math.xor(oldOutline, newOutline);
console.log('差异区域多边形个数:', diff.length);
// 3. 异或面积:8000 + 4000 - 2 x 重叠 2000 = 8000(重叠部分两次都不算)
console.log('差异区域总面积:', eda.sys_Math.calculateArea(diff));
// 4. 完全相同的两个多边形异或结果为空数组(无差异;空组不能再传给
// calculateArea,空输入会抛『无法识别的多边形输入格式』)
console.log('自身与自身异或的差异区域个数:', eda.sys_Math.xor(oldOutline, oldOutline).length);
```
references/classes/SYS_MessageBox.md
# SYS\_MessageBox class
> Warning: This API is now obsolete.
>
> Renamed to [SYS\_Dialog](./SYS_Dialog.md)
System / message box class
## Signature
```typescript
class SYS_MessageBox
```
## Remarks
Generate message boxes
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[showConfirmationMessage(content, title, mainButtonTitle, buttonTitle, callbackFn)](./SYS_MessageBox.md)
</td><td>
</td><td>
Show a confirmation box
</td></tr>
<tr><td>
[showInformationMessage(content, title, buttonTitle)](./SYS_MessageBox.md)
</td><td>
</td><td>
Show a message box
</td></tr>
</tbody></table>
---
## 方法详情
### showconfirmationmessage
# SYS\_MessageBox.showConfirmationMessage() method
> Warning: This API is now obsolete.
>
> Please use [SYS\_Dialog.showConfirmationMessage()](./SYS_Dialog.md) instead
Show a confirmation box
## Signature
```typescript
function showConfirmationMessage(
content: string,
title?: string,
mainButtonTitle?: string,
buttonTitle?: string,
callbackFn?: (mainButtonClicked: boolean) => void,
): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
content
</td><td>
string
</td><td>
Message text. Line breaks can be used with `\n`
</td></tr>
<tr><td>
title
</td><td>
string
</td><td>
_(Optional)_ Confirmation box title
</td></tr>
<tr><td>
mainButtonTitle
</td><td>
string
</td><td>
_(Optional)_ Primary button title
</td></tr>
<tr><td>
buttonTitle
</td><td>
string
</td><td>
_(Optional)_ Primary button title
</td></tr>
<tr><td>
callbackFn
</td><td>
(mainButtonClicked: boolean) => void
</td><td>
_(Optional)_ Callback function. To call a function inside the extension, prefix the function name with the extension's unique ID, separated by a Western period `.`
</td></tr>
</tbody></table>
## Returns
void
## Remarks
Show a confirmation box with confirm and cancel buttons
## Example
```javascript
// 1. 弹出确认窗口,等待用户点击
eda.sys_MessageBox.showConfirmationMessage(
'即将删除选中的 3 个图元,是否继续?',
'删除确认', // 窗口标题
'删除', // 主按钮(确认)
'取消', // 次按钮(取消)
(mainButtonClicked) => {
if (mainButtonClicked) {
console.log('用户点击了主按钮(删除)');
}
else {
console.log('用户点击了次按钮(取消)');
}
}
);
// 2. 窗口已弹出,本方法无返回值;回调需用户点击按钮后才会触发
console.log('已弹出确认窗口');
```
### showinformationmessage
# SYS\_MessageBox.showInformationMessage() method
> Warning: This API is now obsolete.
>
> Please use [SYS\_Dialog.showInformationMessage()](./SYS_Dialog.md) instead
Show a message box
## Signature
```typescript
function showInformationMessage(content: string, title?: string, buttonTitle?: string): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
content
</td><td>
string
</td><td>
Message text. Line breaks can be used with `\n`
</td></tr>
<tr><td>
title
</td><td>
string
</td><td>
_(Optional)_ Message box title
</td></tr>
<tr><td>
buttonTitle
</td><td>
string
</td><td>
_(Optional)_ Button title. If empty, the button is not displayed
</td></tr>
</tbody></table>
## Returns
void
## Remarks
Show a text message box
## Example
```javascript
// 1. 弹出消息窗口(content 用 \n 换行展示两行内容)
eda.sys_MessageBox.showInformationMessage('DRC 检查完成\n 共检查 128 个图元,未发现违规', '检查结果', '知道了');
// 2. 窗口立即弹出;本方法无返回值,也不阻塞后续代码
console.log('已弹出消息窗口');
```
references/classes/SYS_RightClickMenu.md
# SYS\_RightClickMenu class
System / right-click menu class
## Signature
```typescript
class SYS_RightClickMenu
```
## Remarks
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[changeMenu(menuId, menuItems)](./SYS_RightClickMenu.md)
</td><td>
</td><td>
**_(BETA)_** Modify the right-click menu
</td></tr>
</tbody></table>
---
## 方法详情
### changemenu
# SYS\_RightClickMenu.changeMenu() method
> 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.
Modify the right-click menu
## Signature
```typescript
function changeMenu(
menuId: string,
menuItems: Array<ISYS_RightClickMenuItem | null>,
): Promise<void>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
menuId
</td><td>
string
</td><td>
Menu ID
</td></tr>
<tr><td>
menuItems
</td><td>
Array<[ISYS\_RightClickMenuItem](../interfaces/ISYS_RightClickMenuItem.md) \| null>
</td><td>
Menu items. `null` represents a separator
</td></tr>
</tbody></table>
## Returns
Promise<void>
## Remarks
Currently, only right-click menu modifications for \*\*bottom menu device list item right-click\*\*, \*\*bottom menu symbol list item right-click\*\*, \*\*bottom menu footprint list item right-click\*\*, and \*\*bottom menu reuse block list item right-click\*\* are supported
If you want to reorder or remove some menu items, only the menu item IDs need to be passed in `menuItems`<!-- -->; other properties will remain unchanged automatically
To register a new right-click menu, the complete [ISYS\_RightClickMenuItem](../interfaces/ISYS_RightClickMenuItem.md) data needs to be passed in
This API forces the ID of the newly created right-click menu to include the extension UUID. For example, an input `id = 'example'` will be automatically rewritten to `e143d88179874e7f851cc890cd22fc71|example`
Note: This API requires the user to enable the extension external interaction permission, if not enabled, it will always `throw Error`
Non-public API usage notice: This API is provided as-is without additional documentation for parameters. Parameters may be changed in a breaking manner in any version without notice.
## Example
```javascript
// 1. 打开底部库面板,便于右击列表项观察菜单变化
eda.sys_PanelControl.openBottomPanel('library');
// 2. 组合新的菜单项列表:内置项只传 id(保持原属性、原图标与快捷键),
// 末尾追加扩展自定义菜单项(完整数据,含二级菜单与点击回调)
const menuItems = [
{ id: 'refresh' },
null,
{ id: 'editDevice' },
{ id: 'easyEditDevice' },
{ id: 'editSymbol' },
{ id: 'linkSymbol' },
{ id: 'editFootprint' },
{ id: 'linkFootprint' },
{ id: 'link3DModel' },
null,
{ id: 'modifyCategory' },
null,
{ id: 'libDelete' },
null,
{ id: 'saveAs' },
{ id: 'symbolSaveAs' },
{ id: 'footprintSaveAs' },
{ id: 'saveAsLocal' },
{ id: 'model3DSaveAs' },
null,
{ id: 'viewProductDetail' },
{ id: 'viewDatasheet' },
null,
{ id: 'addOrRemoveFavorite' },
{ id: 'addIntoBasicLibrary' },
null,
{
id: '嘉立创示例_器件批量处理',
title: '器件批量处理',
menuItems: [
{ id: '嘉立创示例_发送校验', title: '发送校验', registerFn: 'onDeviceCheck' },
{ id: '嘉立创示例_导出BOM', title: '导出 BOM', registerFn: 'onDeviceExport' },
],
},
];
// 3. 注册到个人器件列表的右键菜单(真实扩展在入口文件导出
// onDeviceCheck / onDeviceExport 两个方法即可收到点击回调)
await eda.sys_RightClickMenu.changeMenu('componentLidTableContextMenuIdMenu_device_personal', menuItems);
// 4. 输出结果:在底部库面板右击个人器件列表的任意器件即可看到新菜单
console.log('右键菜单已修改,菜单项数量:', menuItems.length);
console.log('请在底部库面板右击个人器件列表的器件查看效果');
```
references/classes/SYS_PanelControl.md
# SYS\_PanelControl class
System / panel control class
## Signature
```typescript
class SYS_PanelControl
```
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[closeBottomPanel()](./SYS_PanelControl.md)
</td><td>
</td><td>
Close the bottom panel
</td></tr>
<tr><td>
[closeLeftPanel()](./SYS_PanelControl.md)
</td><td>
</td><td>
Close the left panel
</td></tr>
<tr><td>
[closeRightPanel()](./SYS_PanelControl.md)
</td><td>
</td><td>
Close the right panel
</td></tr>
<tr><td>
[isBottomPanelLocked()](./SYS_PanelControl.md)
</td><td>
</td><td>
Query whether the bottom panel is locked
</td></tr>
<tr><td>
[isLeftPanelLocked()](./SYS_PanelControl.md)
</td><td>
</td><td>
Query whether the left panel is locked
</td></tr>
<tr><td>
[isRightPanelLocked()](./SYS_PanelControl.md)
</td><td>
</td><td>
Query whether the right panel is locked
</td></tr>
<tr><td>
[openBottomPanel(tab)](./SYS_PanelControl.md)
</td><td>
</td><td>
Open the bottom panel
</td></tr>
<tr><td>
[openLeftPanel(tab)](./SYS_PanelControl.md)
</td><td>
</td><td>
Open the left panel
</td></tr>
<tr><td>
[openRightPanel(tab)](./SYS_PanelControl.md)
</td><td>
</td><td>
Open the right panel
</td></tr>
<tr><td>
[toggleBottomPanelLockState(state)](./SYS_PanelControl.md)
</td><td>
</td><td>
Toggle the lock state of the bottom panel
</td></tr>
<tr><td>
[toggleLeftPanelLockState(state)](./SYS_PanelControl.md)
</td><td>
</td><td>
Toggle the lock state of the left panel
</td></tr>
<tr><td>
[toggleRightPanelLockState(state)](./SYS_PanelControl.md)
</td><td>
</td><td>
Toggle the lock state of the right panel
</td></tr>
</tbody></table>
---
## 方法详情
### closebottompanel
# SYS\_PanelControl.closeBottomPanel() method
Close the bottom panel
## Signature
```typescript
function closeBottomPanel(): void;
```
## Returns
void
## Example
```javascript
// 1. 先展开底部面板制造“已打开”状态,便于观察关闭效果
eda.sys_PanelControl.openBottomPanel('log');
console.log('底部面板已展开');
// 2. 收起底部面板(同步调用,无返回值)
eda.sys_PanelControl.closeBottomPanel();
console.log('底部面板已收起');
```
### closeleftpanel
# SYS\_PanelControl.closeLeftPanel() method
Close the left panel
## Signature
```typescript
function closeLeftPanel(): void;
```
## Returns
void
## Example
```javascript
// 1. 先展开左侧面板制造“已打开”状态(不传 tab 则保持当前标签页)
eda.sys_PanelControl.openLeftPanel();
console.log('左侧面板已展开');
// 2. 收起左侧面板(同步调用,无返回值)
eda.sys_PanelControl.closeLeftPanel();
console.log('左侧面板已收起');
```
### closerightpanel
# SYS\_PanelControl.closeRightPanel() method
Close the right panel
## Signature
```typescript
function closeRightPanel(): void;
```
## Returns
void
## Example
```javascript
// 1. 先展开右侧面板制造“已打开”状态(不传 tab 则保持当前标签页)
eda.sys_PanelControl.openRightPanel();
console.log('右侧面板已展开');
// 2. 收起右侧面板(同步调用,无返回值)
eda.sys_PanelControl.closeRightPanel();
console.log('右侧面板已收起');
```
### isbottompanellocked
# SYS\_PanelControl.isBottomPanelLocked() method
Query whether the bottom panel is locked
## Signature
```typescript
function isBottomPanelLocked(): Promise<boolean>;
```
## Returns
Promise<boolean>
Whether Already lock
## Example
```javascript
// 1. 查询底部面板当前锁定状态(异步方法,需要 await)
const locked = await eda.sys_PanelControl.isBottomPanelLocked();
// 2. 输出查询结果(true 表示已锁定,false 表示未锁定)
console.log('底部面板锁定状态:', locked);
```
### isleftpanellocked
# SYS\_PanelControl.isLeftPanelLocked() method
Query whether the left panel is locked
## Signature
```typescript
function isLeftPanelLocked(): Promise<boolean>;
```
## Returns
Promise<boolean>
Whether Already lock
## Example
```javascript
// 1. 查询左侧面板当前锁定状态(异步方法,需要 await)
const locked = await eda.sys_PanelControl.isLeftPanelLocked();
// 2. 输出查询结果(true 表示已锁定,false 表示未锁定)
console.log('左侧面板锁定状态:', locked);
```
### isrightpanellocked
# SYS\_PanelControl.isRightPanelLocked() method
Query whether the right panel is locked
## Signature
```typescript
function isRightPanelLocked(): Promise<boolean>;
```
## Returns
Promise<boolean>
Whether Already lock
## Example
```javascript
// 1. 查询右侧面板当前锁定状态(异步方法,需要 await)
const locked = await eda.sys_PanelControl.isRightPanelLocked();
// 2. 输出查询结果(true 表示已锁定,false 表示未锁定)
console.log('右侧面板锁定状态:', locked);
```
### openbottompanel
# SYS\_PanelControl.openBottomPanel() method
Open the bottom panel
## Signature
```typescript
function openBottomPanel(tab?: ESYS_BottomPanelTab): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
tab
</td><td>
[ESYS\_BottomPanelTab](../enums/ESYS_BottomPanelTab.md)
</td><td>
_(Optional)_ Tab. If not specified, the tab will not be switched
</td></tr>
</tbody></table>
## Returns
void
## Example
```javascript
// 1. 打开底部面板并切换到日志标签页('log' 不依赖文档类型,最通用)
eda.sys_PanelControl.openBottomPanel('log');
console.log('底部面板已展开,并切换到日志标签页');
// 2. 收起面板还原界面(自建自删,保证案例可重复运行)
eda.sys_PanelControl.closeBottomPanel();
console.log('底部面板已收起,界面还原');
```
### openleftpanel
# SYS\_PanelControl.openLeftPanel() method
Open the left panel
## Signature
```typescript
function openLeftPanel(tab?: ESYS_LeftPanelTab): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
tab
</td><td>
[ESYS\_LeftPanelTab](../enums/ESYS_LeftPanelTab.md)
</td><td>
_(Optional)_ Tab. If not specified, the tab will not be switched
</td></tr>
</tbody></table>
## Returns
void
## Example
```javascript
// 1. 打开左侧面板并切换到工程设计标签页
eda.sys_PanelControl.openLeftPanel('projectDesign');
console.log('左侧面板已展开,并切换到工程设计标签页');
// 2. 收起面板还原界面(自建自删,保证案例可重复运行)
eda.sys_PanelControl.closeLeftPanel();
console.log('左侧面板已收起,界面还原');
```
### openrightpanel
# SYS\_PanelControl.openRightPanel() method
Open the right panel
## Signature
```typescript
function openRightPanel(tab?: ESYS_RightPanelTab): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
tab
</td><td>
[ESYS\_RightPanelTab](../enums/ESYS_RightPanelTab.md)
</td><td>
_(Optional)_ Tab. If not specified, the tab will not be switched
</td></tr>
</tbody></table>
## Returns
void
## Example
```javascript
// 1. 打开右侧面板并切换到批注标签页('annotation' 不依赖文档类型)
eda.sys_PanelControl.openRightPanel('annotation');
console.log('右侧面板已展开,并切换到批注标签页');
// 2. 收起面板还原界面(自建自删,保证案例可重复运行)
eda.sys_PanelControl.closeRightPanel();
console.log('右侧面板已收起,界面还原');
```
### togglebottompanellockstate
# SYS\_PanelControl.toggleBottomPanelLockState() method
Toggle the lock state of the bottom panel
## Signature
```typescript
function toggleBottomPanelLockState(state?: boolean): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
state
</td><td>
boolean
</td><td>
_(Optional)_ Whether to lock. If not specified, the current state is inverted
</td></tr>
</tbody></table>
## Returns
void
## Example
```javascript
// 1. 记录当前锁定状态(异步查询,需要 await)
const before = await eda.sys_PanelControl.isBottomPanelLocked();
// 2. 切换到相反状态(显式传目标值;不传参数则直接反转当前状态)
eda.sys_PanelControl.toggleBottomPanelLockState(!before);
// 3. 验证切换已生效
const after = await eda.sys_PanelControl.isBottomPanelLocked();
console.log('切换前:', before, '切换后:', after);
// 4. 恢复原始锁定状态(不留痕迹,保证案例可重复运行)
eda.sys_PanelControl.toggleBottomPanelLockState(before);
console.log('已恢复原锁定状态:', before);
```
### toggleleftpanellockstate
# SYS\_PanelControl.toggleLeftPanelLockState() method
Toggle the lock state of the left panel
## Signature
```typescript
function toggleLeftPanelLockState(state?: boolean): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
state
</td><td>
boolean
</td><td>
_(Optional)_ Whether to lock. If not specified, the current state is inverted
</td></tr>
</tbody></table>
## Returns
void
## Example
```javascript
// 1. 记录当前锁定状态(异步查询,需要 await)
const before = await eda.sys_PanelControl.isLeftPanelLocked();
// 2. 切换到相反状态(显式传目标值;不传参数则直接反转当前状态)
eda.sys_PanelControl.toggleLeftPanelLockState(!before);
// 3. 验证切换已生效
const after = await eda.sys_PanelControl.isLeftPanelLocked();
console.log('切换前:', before, '切换后:', after);
// 4. 恢复原始锁定状态(不留痕迹,保证案例可重复运行)
eda.sys_PanelControl.toggleLeftPanelLockState(before);
console.log('已恢复原锁定状态:', before);
```
### togglerightpanellockstate
# SYS\_PanelControl.toggleRightPanelLockState() method
Toggle the lock state of the right panel
## Signature
```typescript
function toggleRightPanelLockState(state?: boolean): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
state
</td><td>
boolean
</td><td>
_(Optional)_ Whether to lock. If not specified, the current state is inverted
</td></tr>
</tbody></table>
## Returns
void
## Example
```javascript
// 1. 记录当前锁定状态(异步查询,需要 await)
const before = await eda.sys_PanelControl.isRightPanelLocked();
// 2. 切换到相反状态(显式传目标值;不传参数则直接反转当前状态)
eda.sys_PanelControl.toggleRightPanelLockState(!before);
// 3. 验证切换已生效
const after = await eda.sys_PanelControl.isRightPanelLocked();
console.log('切换前:', before, '切换后:', after);
// 4. 恢复原始锁定状态(不留痕迹,保证案例可重复运行)
eda.sys_PanelControl.toggleRightPanelLockState(before);
console.log('已恢复原锁定状态:', before);
```
references/classes/SYS_MessageBus.md
# SYS\_MessageBus class
System / message bus class
## Signature
```typescript
class SYS_MessageBus
```
## Remarks
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[createPrivateMessageBus()](./SYS_MessageBus.md)
</td><td>
</td><td>
Create Private message bus
</td></tr>
<tr><td>
[publish(topic, message)](./SYS_MessageBus.md)
</td><td>
</td><td>
Private message bus: publish a message
</td></tr>
<tr><td>
[publishPublic(topic, message)](./SYS_MessageBus.md)
</td><td>
</td><td>
Public message bus: publish a message
</td></tr>
<tr><td>
[pull(topic, callbackFn)](./SYS_MessageBus.md)
</td><td>
</td><td>
Private message bus: pull a message
</td></tr>
<tr><td>
[pullAsync(topic)](./SYS_MessageBus.md)
</td><td>
</td><td>
Private message bus: pull a message (Promise version)
</td></tr>
<tr><td>
[pullAsyncPublic(topic)](./SYS_MessageBus.md)
</td><td>
</td><td>
Public message bus: pull a message (Promise version)
</td></tr>
<tr><td>
[pullPublic(topic, callbackFn)](./SYS_MessageBus.md)
</td><td>
</td><td>
Public message bus: pull a message
</td></tr>
<tr><td>
[push(topic, message)](./SYS_MessageBus.md)
</td><td>
</td><td>
Private message bus: push a message
</td></tr>
<tr><td>
[pushPublic(topic, message)](./SYS_MessageBus.md)
</td><td>
</td><td>
Public message bus: push a message
</td></tr>
<tr><td>
[removePrivateMessageBus()](./SYS_MessageBus.md)
</td><td>
</td><td>
Remove Private message bus
</td></tr>
<tr><td>
[rpcCall(topic, message, timeout)](./SYS_MessageBus.md)
</td><td>
</td><td>
Private message bus: call RPC service
</td></tr>
<tr><td>
[rpcCallPublic(topic, message, timeout)](./SYS_MessageBus.md)
</td><td>
</td><td>
Public message bus: call RPC service
</td></tr>
<tr><td>
[rpcService(topic, callbackFn)](./SYS_MessageBus.md)
</td><td>
</td><td>
Private message bus: register RPC service
</td></tr>
<tr><td>
[rpcServicePublic(topic, callbackFn)](./SYS_MessageBus.md)
</td><td>
</td><td>
Public message bus: register RPC service
</td></tr>
<tr><td>
[subscribe(topic, callbackFn)](./SYS_MessageBus.md)
</td><td>
</td><td>
Private message bus: subscribe to a message
</td></tr>
<tr><td>
[subscribeOnce(topic, callbackFn)](./SYS_MessageBus.md)
</td><td>
</td><td>
Private message bus: subscribe to a message once
</td></tr>
<tr><td>
[subscribeOncePublic(topic, callbackFn)](./SYS_MessageBus.md)
</td><td>
</td><td>
Public message bus: subscribe to a message once
</td></tr>
<tr><td>
[subscribePublic(topic, callbackFn)](./SYS_MessageBus.md)
</td><td>
</td><td>
Public message bus: subscribe to a message
</td></tr>
</tbody></table>
---
## 方法详情
### createprivatemessagebus
# SYS\_MessageBus.createPrivateMessageBus() method
Create Private message bus
## Signature
```typescript
function createPrivateMessageBus(): void;
```
## Returns
void
## Remarks
Generally, there is no need to call this method. The private message bus is automatically created when listening or sending messages
## Example
```javascript
// 1. 手动创建私有消息总线(重复调用无副作用)
eda.sys_MessageBus.createPrivateMessageBus();
// 2. 订阅一个主题,验证总线已就绪
const task = eda.sys_MessageBus.subscribe('嘉立创示例_创建总线', (message) => {
console.log('订阅者收到:', message);
});
// 3. 发布消息,回调立即触发
eda.sys_MessageBus.publish('嘉立创示例_创建总线', '总线已创建并可用');
// 4. 取消订阅,恢复原状
task.cancel();
console.log('已取消订阅');
```
### publish
# SYS\_MessageBus.publish() method
Private message bus: publish a message
## Signature
```typescript
function publish(topic: string, message: any): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
topic
</td><td>
string
</td><td>
Theme
</td></tr>
<tr><td>
message
</td><td>
any
</td><td>
Message
</td></tr>
</tbody></table>
## Returns
void
## Remarks
Broadcast the message to every Subscriber
## Example
```javascript
// 1. 两个不同模块订阅同一主题
const panelTask = eda.sys_MessageBus.subscribe('嘉立创示例_发布', (message) => {
console.log('面板模块收到:', message);
});
const cacheTask = eda.sys_MessageBus.subscribe('嘉立创示例_发布', (message) => {
console.log('缓存模块收到:', message);
});
// 2. 发布一条广播消息,两个订阅者都会收到
eda.sys_MessageBus.publish('嘉立创示例_发布', { source: '工程检查', result: '通过' });
// 3. 取消订阅,恢复原状
panelTask.cancel();
cacheTask.cancel();
console.log('已取消全部订阅');
```
### publishpublic
# SYS\_MessageBus.publishPublic() method
Public message bus: publish a message
## Signature
```typescript
function publishPublic(topic: string, message: any): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
topic
</td><td>
string
</td><td>
Theme
</td></tr>
<tr><td>
message
</td><td>
any
</td><td>
Message
</td></tr>
</tbody></table>
## Returns
void
## Remarks
Broadcast the message to every Subscriber
## Example
```javascript
// 1. 两个公共订阅者 + 一个私有订阅者(用于对照隔离性)
const publicTaskA = eda.sys_MessageBus.subscribePublic('嘉立创示例_公共发布', (message) => {
console.log('公共订阅者 A 收到:', message);
});
const publicTaskB = eda.sys_MessageBus.subscribePublic('嘉立创示例_公共发布', (message) => {
console.log('公共订阅者 B 收到:', message);
});
const privateTask = eda.sys_MessageBus.subscribe('嘉立创示例_公共发布', (message) => {
console.log('私有订阅者收到:', message);
});
// 2. 在公共总线发布广播,只有公共订阅者会收到
eda.sys_MessageBus.publishPublic('嘉立创示例_公共发布', '工程已保存');
// 3. 取消订阅,恢复原状
publicTaskA.cancel();
publicTaskB.cancel();
privateTask.cancel();
console.log('已取消全部订阅');
```
### pull
# SYS\_MessageBus.pull() method
Private message bus: pull a message
## Signature
```typescript
function pull(topic: string, callbackFn: (message: any) => void): ISYS_MessageBusTask;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
topic
</td><td>
string
</td><td>
Theme
</td></tr>
<tr><td>
callbackFn
</td><td>
(message: any) => void
</td><td>
Callback after a message is pulled
</td></tr>
</tbody></table>
## Returns
[ISYS\_MessageBusTask](../interfaces/ISYS_MessageBusTask.md)
Message bus task
## Remarks
Only one message can be pulled at a time
## Example
```javascript
// 1. 注册拉取回调(每次只能拉一个消息)
let count = 0;
const task = eda.sys_MessageBus.pull('嘉立创示例_拉取', (message) => {
count++;
console.log('第', count, '次拉到:', message);
});
// 2. 推送两条消息:只有第一条会被这个 Puller 收到
eda.sys_MessageBus.push('嘉立创示例_拉取', '任务甲');
eda.sys_MessageBus.push('嘉立创示例_拉取', '任务乙');
console.log('拉取次数:', count);
// 3. 取消任务(未消费完的排队消息一并放弃)
task.cancel();
console.log('已取消拉取任务');
```
### pullasync
# SYS\_MessageBus.pullAsync() method
Private message bus: pull a message (Promise version)
## Signature
```typescript
function pullAsync(topic: string): Promise<any>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
topic
</td><td>
string
</td><td>
Theme
</td></tr>
</tbody></table>
## Returns
Promise<any>
The pulled message
## Remarks
Only one message can be pulled at a time. You can use `await` to wait for the message to be pulled
## Example
```javascript
// 1. 先发起拉取(Promise 挂起等待消息)
const pending = eda.sys_MessageBus.pullAsync('嘉立创示例_异步拉取');
// 2. 推送消息,挂起的 Promise 随即满足
eda.sys_MessageBus.push('嘉立创示例_异步拉取', { task: '导出 BOM', done: true });
// 3. await 直接拿到拉到的消息
const message = await pending;
console.log('拉到的消息:', message);
```
### pullasyncpublic
# SYS\_MessageBus.pullAsyncPublic() method
Public message bus: pull a message (Promise version)
## Signature
```typescript
function pullAsyncPublic(topic: string): Promise<any>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
topic
</td><td>
string
</td><td>
Theme
</td></tr>
</tbody></table>
## Returns
Promise<any>
The pulled message
## Remarks
Only one message can be pulled at a time. You can use `await` to wait for the message to be pulled
## Example
```javascript
// 1. 在公共总线发起拉取(Promise 挂起等待消息)
const pending = eda.sys_MessageBus.pullAsyncPublic('嘉立创示例_公共异步拉取');
// 2. 用 pushPublic 投递消息(私有总线的 push 到不了这里)
eda.sys_MessageBus.pushPublic('嘉立创示例_公共异步拉取', '跨扩展结果已就绪');
// 3. await 直接拿到拉到的消息
const message = await pending;
console.log('拉到的公共消息:', message);
```
### pullpublic
# SYS\_MessageBus.pullPublic() method
Public message bus: pull a message
## Signature
```typescript
function pullPublic(topic: string, callbackFn: (message: any) => void): ISYS_MessageBusTask;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
topic
</td><td>
string
</td><td>
Theme
</td></tr>
<tr><td>
callbackFn
</td><td>
(message: any) => void
</td><td>
Callback after a message is pulled
</td></tr>
</tbody></table>
## Returns
[ISYS\_MessageBusTask](../interfaces/ISYS_MessageBusTask.md)
Message bus task
## Remarks
Only one message can be pulled at a time
## Example
```javascript
// 1. 在公共总线注册拉取回调(一次性)
const task = eda.sys_MessageBus.pullPublic('嘉立创示例_公共拉取', (message) => {
console.log('公共总线拉到:', message);
});
// 2. 用 pushPublic 投递消息,回调立即触发
eda.sys_MessageBus.pushPublic('嘉立创示例_公共拉取', '公共任务甲');
// 3. 取消任务,恢复原状
task.cancel();
console.log('已取消公共拉取任务');
```
### push
# SYS\_MessageBus.push() method
Private message bus: push a message
## Signature
```typescript
function push(topic: string, message: any): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
topic
</td><td>
string
</td><td>
Theme
</td></tr>
<tr><td>
message
</td><td>
any
</td><td>
Message
</td></tr>
</tbody></table>
## Returns
void
## Remarks
Each message can only be received by one Puller
## Example
```javascript
// 1. 先推送消息(此时还没有 Puller,消息排队保留)
eda.sys_MessageBus.push('嘉立创示例_推送', '先推后拉的消息');
// 2. 再注册拉取回调,排队的消息立即交付
const task = eda.sys_MessageBus.pull('嘉立创示例_推送', (message) => {
console.log('拉到排队消息:', message);
});
// 3. 常规顺序演示:先注册再推送
const task2 = eda.sys_MessageBus.pull('嘉立创示例_推送', (message) => {
console.log('拉到实时消息:', message);
});
eda.sys_MessageBus.push('嘉立创示例_推送', '先拉后推的消息');
// 4. 取消任务,恢复原状
task.cancel();
task2.cancel();
console.log('已取消拉取任务');
```
### pushpublic
# SYS\_MessageBus.pushPublic() method
Public message bus: push a message
## Signature
```typescript
function pushPublic(topic: string, message: any): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
topic
</td><td>
string
</td><td>
Theme
</td></tr>
<tr><td>
message
</td><td>
any
</td><td>
Message
</td></tr>
</tbody></table>
## Returns
void
## Remarks
Each message can only be received by one Puller
## Example
```javascript
// 1. 在公共总线注册两个取件方(竞争关系)
let receivedByA = false;
const taskA = eda.sys_MessageBus.pullPublic('嘉立创示例_公共推送', () => {
receivedByA = true;
});
const taskB = eda.sys_MessageBus.pullPublic('嘉立创示例_公共推送', (message) => {
console.log('取件方 B 拉到:', message);
});
// 2. 推送一条消息:先注册的取件方 A 拿走,B 收不到
eda.sys_MessageBus.pushPublic('嘉立创示例_公共推送', '跨扩展任务');
console.log('取件方 A 是否收到:', receivedByA);
// 3. 取消任务,恢复原状
taskA.cancel();
taskB.cancel();
console.log('已取消公共拉取任务');
```
### removeprivatemessagebus
# SYS\_MessageBus.removePrivateMessageBus() method
Remove Private message bus
## Signature
```typescript
function removePrivateMessageBus(): void;
```
## Returns
void
## Remarks
Generally, there is no need to call this method unless you know what you are doing
## Example
```javascript
// 1. 订阅一个主题并验证能收到消息
let received = null;
eda.sys_MessageBus.subscribe('嘉立创示例_移除总线', (message) => {
received = message;
});
eda.sys_MessageBus.publish('嘉立创示例_移除总线', '移除前的消息');
console.log('移除前收到:', received);
// 2. 移除私有消息总线,原有订阅全部失效
eda.sys_MessageBus.removePrivateMessageBus();
eda.sys_MessageBus.publish('嘉立创示例_移除总线', '移除后的消息');
console.log('移除后订阅者是否还收到:', received);
// 3. 再次订阅,总线自动重建恢复正常
eda.sys_MessageBus.subscribe('嘉立创示例_移除总线', (message) => {
received = message;
});
eda.sys_MessageBus.publish('嘉立创示例_移除总线', '重建后的消息');
console.log('重建后收到:', received);
```
### rpccall
# SYS\_MessageBus.rpcCall() method
Private message bus: call RPC service
## Signature
```typescript
function rpcCall(topic: string, message?: any, timeout?: number): Promise<any>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
topic
</td><td>
string
</td><td>
Theme
</td></tr>
<tr><td>
message
</td><td>
any
</td><td>
_(Optional)_ Message
</td></tr>
<tr><td>
timeout
</td><td>
number
</td><td>
_(Optional)_ Timeout
</td></tr>
</tbody></table>
## Returns
Promise<any>
RPC service return
## Example
```javascript
// 1. 注册一个 DRC 检查服务(message 是单个参数,用对象打包请求字段)
eda.sys_MessageBus.rpcService('嘉立创示例_RPC调用', (message) => {
return `检查完成:${message.rule},发现 ${message.count} 处问题`;
});
// 2. 发起 RPC 调用,await 直接拿到服务返回值
const reply = await eda.sys_MessageBus.rpcCall('嘉立创示例_RPC调用', {
rule: '间距约束',
count: 2,
});
console.log('服务返回:', reply);
```
### rpccallpublic
# SYS\_MessageBus.rpcCallPublic() method
Public message bus: call RPC service
## Signature
```typescript
function rpcCallPublic(topic: string, message?: any, timeout?: number): Promise<any>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
topic
</td><td>
string
</td><td>
Theme
</td></tr>
<tr><td>
message
</td><td>
any
</td><td>
_(Optional)_ Message
</td></tr>
<tr><td>
timeout
</td><td>
number
</td><td>
_(Optional)_ Timeout
</td></tr>
</tbody></table>
## Returns
Promise<any>
RPC service return
## Example
```javascript
// 1. 在公共总线注册一个库查询服务
eda.sys_MessageBus.rpcServicePublic('嘉立创示例_公共RPC调用', (message) => {
return { name: message, stock: 1200 };
});
// 2. 调用公共 RPC 服务,await 拿到返回值
const reply = await eda.sys_MessageBus.rpcCallPublic('嘉立创示例_公共RPC调用', '0402 电阻');
console.log('查询结果:', reply.name, '库存', reply.stock);
```
### rpcservice
# SYS\_MessageBus.rpcService() method
Private message bus: register RPC service
## Signature
```typescript
function rpcService(topic: string, callbackFn: (...args: Array<any>) => any | Promise<any>): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
topic
</td><td>
string
</td><td>
Theme
</td></tr>
<tr><td>
callbackFn
</td><td>
(...args: Array<any>) => any \| Promise<any>
</td><td>
Callback after receiving the message
</td></tr>
</tbody></table>
## Returns
void
## Example
```javascript
// 1. 注册同步服务:直接返回计算结果
eda.sys_MessageBus.rpcService('嘉立创示例_RPC服务_同步', (message) => {
return `同步响应:${message}`;
});
// 2. 注册异步服务:返回 Promise,处理完才响应
eda.sys_MessageBus.rpcService('嘉立创示例_RPC服务_异步', async (message) => {
await new Promise(resolve => setTimeout(resolve, 200));
return `异步响应:${message}`;
});
// 3. 分别调用两种服务验证
console.log(await eda.sys_MessageBus.rpcCall('嘉立创示例_RPC服务_同步', '参数甲'));
console.log(await eda.sys_MessageBus.rpcCall('嘉立创示例_RPC服务_异步', '参数乙'));
```
### rpcservicepublic
# SYS\_MessageBus.rpcServicePublic() method
Public message bus: register RPC service
## Signature
```typescript
function rpcServicePublic(
topic: string,
callbackFn: (...args: Array<any>) => any | Promise<any>,
): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
topic
</td><td>
string
</td><td>
Theme
</td></tr>
<tr><td>
callbackFn
</td><td>
(...args: Array<any>) => any \| Promise<any>
</td><td>
Callback after receiving the message
</td></tr>
</tbody></table>
## Returns
void
## Example
```javascript
// 1. 在公共总线注册一个工程信息服务
eda.sys_MessageBus.rpcServicePublic('嘉立创示例_公共RPC服务', (message) => {
return `当前工程《示例工程》的${message}已就绪`;
});
// 2. 用 rpcCallPublic 调用自己注册的公共服务(跨扩展调用同理)
const reply = await eda.sys_MessageBus.rpcCallPublic('嘉立创示例_公共RPC服务', '原理图数据');
console.log('公共服务返回:', reply);
```
### subscribe
# SYS\_MessageBus.subscribe() method
Private message bus: subscribe to a message
## Signature
```typescript
function subscribe(topic: string, callbackFn: (message: any) => void): ISYS_MessageBusTask;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
topic
</td><td>
string
</td><td>
Theme
</td></tr>
<tr><td>
callbackFn
</td><td>
(message: any) => void
</td><td>
Callback after receiving the message
</td></tr>
</tbody></table>
## Returns
[ISYS\_MessageBusTask](../interfaces/ISYS_MessageBusTask.md)
Message bus task
## Remarks
Persistent subscription message
## Example
```javascript
// 1. 持久订阅主题
const received = [];
const task = eda.sys_MessageBus.subscribe('嘉立创示例_订阅', (message) => {
received.push(message);
});
// 2. 连续发布多条消息,每条都能收到
eda.sys_MessageBus.publish('嘉立创示例_订阅', '第一条');
eda.sys_MessageBus.publish('嘉立创示例_订阅', '第二条');
console.log('已收到:', received.join('、'));
// 3. cancel 之后不再接收
task.cancel();
eda.sys_MessageBus.publish('嘉立创示例_订阅', '取消后的消息');
console.log('cancel 后仍停留在:', received.join('、'));
```
### subscribeonce
# SYS\_MessageBus.subscribeOnce() method
Private message bus: subscribe to a message once
## Signature
```typescript
function subscribeOnce(topic: string, callbackFn: (message: any) => void): ISYS_MessageBusTask;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
topic
</td><td>
string
</td><td>
Theme
</td></tr>
<tr><td>
callbackFn
</td><td>
(message: any) => void
</td><td>
Callback after receiving the message
</td></tr>
</tbody></table>
## Returns
[ISYS\_MessageBusTask](../interfaces/ISYS_MessageBusTask.md)
Message bus task
## Example
```javascript
// 1. 注册单次订阅
let received = null;
const task = eda.sys_MessageBus.subscribeOnce('嘉立创示例_单次订阅', (message) => {
received = message;
});
// 2. 发布两条消息:只有第一条触发回调
eda.sys_MessageBus.publish('嘉立创示例_单次订阅', '首次触发');
eda.sys_MessageBus.publish('嘉立创示例_单次订阅', '第二次发布');
console.log('实际收到:', received);
// 3. 消息未到时也可以主动 cancel 放弃等待
task.cancel();
console.log('已清理单次订阅任务');
```
### subscribeoncepublic
# SYS\_MessageBus.subscribeOncePublic() method
Public message bus: subscribe to a message once
## Signature
```typescript
function subscribeOncePublic(
topic: string,
callbackFn: (message: any) => void,
): ISYS_MessageBusTask;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
topic
</td><td>
string
</td><td>
Theme
</td></tr>
<tr><td>
callbackFn
</td><td>
(message: any) => void
</td><td>
Callback after receiving the message
</td></tr>
</tbody></table>
## Returns
[ISYS\_MessageBusTask](../interfaces/ISYS_MessageBusTask.md)
Message bus task
## Example
```javascript
// 1. 在公共总线注册单次订阅
let received = null;
eda.sys_MessageBus.subscribeOncePublic('嘉立创示例_公共单次订阅', (message) => {
received = message;
});
// 2. 连续两条公共广播:只有第一条触发
eda.sys_MessageBus.publishPublic('嘉立创示例_公共单次订阅', '首次广播');
eda.sys_MessageBus.publishPublic('嘉立创示例_公共单次订阅', '第二次广播');
console.log('实际收到:', received);
// 3. 私有总线的 publish 与公共订阅互不相通(隔离验证)
eda.sys_MessageBus.publish('嘉立创示例_公共单次订阅', '私有消息');
console.log('私有消息到达后仍停留在:', received);
```
### subscribepublic
# SYS\_MessageBus.subscribePublic() method
Public message bus: subscribe to a message
## Signature
```typescript
function subscribePublic(topic: string, callbackFn: (message: any) => void): ISYS_MessageBusTask;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
topic
</td><td>
string
</td><td>
Theme
</td></tr>
<tr><td>
callbackFn
</td><td>
(message: any) => void
</td><td>
Callback after receiving the message
</td></tr>
</tbody></table>
## Returns
[ISYS\_MessageBusTask](../interfaces/ISYS_MessageBusTask.md)
Message bus task
## Remarks
Persistent subscription message
## Example
```javascript
// 1. 在公共总线持久订阅主题
const received = [];
const task = eda.sys_MessageBus.subscribePublic('嘉立创示例_公共订阅', (message) => {
received.push(message);
});
// 2. 公共广播两条都能收到;私有 publish 不会到达
eda.sys_MessageBus.publishPublic('嘉立创示例_公共订阅', '公共甲');
eda.sys_MessageBus.publishPublic('嘉立创示例_公共订阅', '公共乙');
eda.sys_MessageBus.publish('嘉立创示例_公共订阅', '私有丙');
console.log('已收到:', received.join('、'));
// 3. cancel 之后不再接收
task.cancel();
eda.sys_MessageBus.publishPublic('嘉立创示例_公共订阅', '取消后广播');
console.log('cancel 后仍停留在:', received.join('、'));
```
references/classes/SYS_Storage.md
# SYS\_Storage class
System / storage class
## Signature
```typescript
class SYS_Storage
```
## Remarks
APIs that can perform extension user configuration storage and browser local storage operations
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[clearExtensionAllUserConfigs()](./SYS_Storage.md)
</td><td>
</td><td>
Clear all user configurations of the extension
</td></tr>
<tr><td>
[deleteExtensionUserConfig(key)](./SYS_Storage.md)
</td><td>
</td><td>
Delete Extension user configuration
</td></tr>
<tr><td>
[getExtensionAllUserConfigs()](./SYS_Storage.md)
</td><td>
</td><td>
Get all user configurations of the extension
</td></tr>
<tr><td>
[getExtensionUserConfig(key)](./SYS_Storage.md)
</td><td>
</td><td>
Get Extension user configuration
</td></tr>
<tr><td>
[setExtensionAllUserConfigs(configs)](./SYS_Storage.md)
</td><td>
</td><td>
Set all user configurations of the extension
</td></tr>
<tr><td>
[setExtensionUserConfig(key, value)](./SYS_Storage.md)
</td><td>
</td><td>
Set Extension user configuration
</td></tr>
</tbody></table>
---
## 方法详情
### clearextensionalluserconfigs
# SYS\_Storage.clearExtensionAllUserConfigs() method
Clear all user configurations of the extension
## Signature
```typescript
function clearExtensionAllUserConfigs(): Promise<boolean>;
```
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
This will delete all user configuration information of the current extension. Please operate with caution
Note: This API is only valid for extensions. Calling it in a standalone script environment will always `throw Error`
## Example
```javascript
// 1. 备份当前全部配置(清空前必做)
const backup = eda.sys_Storage.getExtensionAllUserConfigs();
// 2. 写入一条演示配置,让清空操作有效果可见
await eda.sys_Storage.setExtensionUserConfig('嘉立创示例_待清除', '演示数据');
// 3. 清空全部配置
const cleared = await eda.sys_Storage.clearExtensionAllUserConfigs();
// 4. 复查:清空后配置条数应为 0
const after = eda.sys_Storage.getExtensionAllUserConfigs();
// 5. 把备份的原配置写回,还原存储现场
const restored = await eda.sys_Storage.setExtensionAllUserConfigs(backup);
console.log('清空结果:', cleared);
console.log('清空后配置条数:', Object.keys(after).length);
console.log('恢复备份结果:', restored);
```
### deleteextensionuserconfig
# SYS\_Storage.deleteExtensionUserConfig() method
Delete Extension user configuration
## Signature
```typescript
function deleteExtensionUserConfig(key: string): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
key
</td><td>
string
</td><td>
Configuration item
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
Note: This API is only valid for extensions. Calling it in a standalone script environment will always `throw Error`
## Example
```javascript
// 1. 写入一条待删除的演示配置
await eda.sys_Storage.setExtensionUserConfig('嘉立创示例_临时项', '待删除数据');
// 2. 删除该配置
const deleted = await eda.sys_Storage.deleteExtensionUserConfig('嘉立创示例_临时项');
// 3. 复查:删除后再读取该 key,应为 undefined
const after = eda.sys_Storage.getExtensionUserConfig('嘉立创示例_临时项');
console.log('删除结果:', deleted);
console.log('删除后再读取:', after);
```
### getextensionalluserconfigs
# SYS\_Storage.getExtensionAllUserConfigs() method
Get all user configurations of the extension
## Signature
```typescript
function getExtensionAllUserConfigs(): Record<string, any>;
```
## Returns
Record<string, any>
All user configuration information of the extension
## Remarks
Note: This API is only valid for extensions. Calling it in a standalone script environment will always `throw Error`
## Example
```javascript
// 1. 写入两条演示配置
await eda.sys_Storage.setExtensionUserConfig('嘉立创示例_单位', 'mil');
await eda.sys_Storage.setExtensionUserConfig('嘉立创示例_自动保存', true);
// 2. 读取全部用户配置
const configs = eda.sys_Storage.getExtensionAllUserConfigs();
// 3. 清理演示配置,还原存储现场
await eda.sys_Storage.deleteExtensionUserConfig('嘉立创示例_单位');
await eda.sys_Storage.deleteExtensionUserConfig('嘉立创示例_自动保存');
console.log('配置总条数:', Object.keys(configs).length);
console.log('演示配置单位:', configs['嘉立创示例_单位']);
console.log('演示配置自动保存:', configs['嘉立创示例_自动保存']);
```
### getextensionuserconfig
# SYS\_Storage.getExtensionUserConfig() method
Get Extension user configuration
## Signature
```typescript
function getExtensionUserConfig(key: string): any | undefined;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
key
</td><td>
string
</td><td>
Configuration item
</td></tr>
</tbody></table>
## Returns
any \| undefined
The value corresponding to the configuration item. `undefined` is returned if it does not exist
## Remarks
Note: This API is only valid for extensions. Calling it in a standalone script environment will always `throw Error`
## Example
```javascript
// 1. 先写入一条演示配置
await eda.sys_Storage.setExtensionUserConfig('嘉立创示例_单位', 'mm');
// 2. 按 key 读取该配置
const value = eda.sys_Storage.getExtensionUserConfig('嘉立创示例_单位');
// 3. 读取不存在的 key,返回 undefined
const missing = eda.sys_Storage.getExtensionUserConfig('嘉立创示例_不存在的键');
// 4. 清理演示配置,还原存储现场
await eda.sys_Storage.deleteExtensionUserConfig('嘉立创示例_单位');
console.log('读取到的值:', value);
console.log('不存在的 key 返回:', missing);
```
### setextensionalluserconfigs
# SYS\_Storage.setExtensionAllUserConfigs() method
Set all user configurations of the extension
## Signature
```typescript
function setExtensionAllUserConfigs(configs: Record<string, any>): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
configs
</td><td>
Record<string, any>
</td><td>
All user configurations of the extension
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
This will overwrite all user configuration information of the current extension. Please operate with caution
Note: This API is only valid for extensions. Calling it in a standalone script environment will always `throw Error`
## Example
```javascript
// 1. 备份当前全部配置(整体覆盖前必做)
const backup = eda.sys_Storage.getExtensionAllUserConfigs();
// 2. 整体写入一份新配置,原有配置被覆盖
const ok = await eda.sys_Storage.setExtensionAllUserConfigs({
嘉立创示例_单位: 'mil',
嘉立创示例_检查更新: true,
});
// 3. 把备份的原配置写回,还原存储现场
const restored = await eda.sys_Storage.setExtensionAllUserConfigs(backup);
console.log('整体写入结果:', ok);
console.log('恢复备份结果:', restored);
console.log('备份配置条数:', Object.keys(backup).length);
```
### setextensionuserconfig
# SYS\_Storage.setExtensionUserConfig() method
Set Extension user configuration
## Signature
```typescript
function setExtensionUserConfig(key: string, value: any): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
key
</td><td>
string
</td><td>
Configuration item
</td></tr>
<tr><td>
value
</td><td>
any
</td><td>
Value
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
This API is also used to create a new extension user configuration. If it does not exist when setting, it will be created automatically
Note: This API is only valid for extensions. Calling it in a standalone script environment will always `throw Error`
## Example
```javascript
// 1. 写入一条新配置(key 不存在时自动新建)
const created = await eda.sys_Storage.setExtensionUserConfig('嘉立创示例_主题', '深色');
// 2. 用同一个 key 再次写入,覆盖旧值
const updated = await eda.sys_Storage.setExtensionUserConfig('嘉立创示例_主题', '浅色');
// 3. 清理演示配置,还原存储现场
await eda.sys_Storage.deleteExtensionUserConfig('嘉立创示例_主题');
console.log('新建配置结果:', created);
console.log('覆盖写入结果:', updated);
```
references/classes/SYS_Setting.md
# SYS\_Setting class
System / settings class
## Signature
```typescript
class SYS_Setting
```
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[getJLCColorSilkEnabled()](./SYS_Setting.md)
</td><td>
</td><td>
**_(BETA)_** 获取是否启用嘉立创彩色丝印工艺
</td></tr>
<tr><td>
[restoreDefault()](./SYS_Setting.md)
</td><td>
</td><td>
**_(BETA)_** Restore all default settings
</td></tr>
</tbody></table>
---
## 方法详情
### getjlccolorsilkenabled
# SYS\_Setting.getJLCColorSilkEnabled() method
> 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.
> Warning: This API is now obsolete.
>
> 临时接口(插入图片 PCB 迁移打通流程用):等统一设置接口落地后删除替换,请尽快迁移,勿在新功能中继续依赖
获取是否启用嘉立创彩色丝印工艺
## Signature
```typescript
function getJLCColorSilkEnabled(): Promise<boolean>;
```
## Returns
Promise<boolean>
是否启用;读取失败返回 `false`
## Remarks
ADD since EDA v5
## Example
```javascript
// 决定 UI 是否显示「放置原图(真彩)」勾选项
const enabled = await eda.sys_Setting.getJLCColorSilkEnabled();
if (enabled) {
console.log('彩色丝印工艺已启用');
}
```
### restoredefault
# SYS\_Setting.restoreDefault() method
> 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.
Restore all default settings
## Signature
```typescript
function restoreDefault(): Promise<boolean>;
```
## Returns
Promise<boolean>
Whether the operation is successful
## Remarks
Restores all EDA settings to their default state. This operation will lose all settings. Please pay special attention when calling it
## Example
```javascript
// 1. 先制造一个可观察的自定义设置:向字体白名单加入演示字体
await eda.sys_FontManager.addFont('嘉立创示例_恢复默认演示字体');
const before = await eda.sys_FontManager.getFontsList();
console.log('恢复前演示字体在列表中:', before.includes('嘉立创示例_恢复默认演示字体'));
// 2. 全局恢复默认设置(异步操作,返回是否成功;所有自定义设置将被清除)
const ok = await eda.sys_Setting.restoreDefault();
console.log('恢复默认设置返回:', ok);
// 3. 复查演示字体是否已随设置一起被清除
const after = await eda.sys_FontManager.getFontsList();
console.log('恢复后演示字体在列表中:', after.includes('嘉立创示例_恢复默认演示字体'));
// 4. 兜底清理:若字体白名单不受本接口影响,手动移除演示字体,保证净零变更
await eda.sys_FontManager.deleteFont('嘉立创示例_恢复默认演示字体');
```
references/classes/SYS_ShortcutKey.md
# SYS\_ShortcutKey class
System / shortcut key class
## Signature
```typescript
class SYS_ShortcutKey
```
## Remarks
Register and manage system shortcut keys
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[get(id)](./SYS_ShortcutKey.md)
</td><td>
</td><td>
**_(BETA)_** 获取快捷键数据
</td></tr>
<tr><td>
[getAll()](./SYS_ShortcutKey.md)
</td><td>
</td><td>
**_(BETA)_** 获取所有快捷键数据
</td></tr>
<tr><td>
[getShortcutKeys(includeSystem)](./SYS_ShortcutKey.md)
</td><td>
</td><td>
**_(BETA)_** Query shortcut key list
</td></tr>
<tr><td>
[register(id, props)](./SYS_ShortcutKey.md)
</td><td>
</td><td>
**_(BETA)_** 注册快捷键
</td></tr>
<tr><td>
[registerShortcutKey(shortcutKey, title, callbackFn, documentType, scene)](./SYS_ShortcutKey.md)
</td><td>
</td><td>
**_(BETA)_** Register shortcut key
</td></tr>
<tr><td>
[unregister(id)](./SYS_ShortcutKey.md)
</td><td>
</td><td>
**_(BETA)_** 反注册快捷键
</td></tr>
<tr><td>
[unregisterShortcutKey(shortcutKey)](./SYS_ShortcutKey.md)
</td><td>
</td><td>
**_(BETA)_** Unregister a shortcut key
</td></tr>
</tbody></table>
---
## 方法详情
### get
# SYS\_ShortcutKey.get() method
> 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.
获取快捷键数据
## Signature
```typescript
function get(id: string): ISYS_ShortcutKeyDataWithUserDefinedShortcutKey | undefined;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
快捷键 ID,如需获取其它扩展注册的快捷键,请在前缀处拼接扩展 UUID,格式为:`<扩展 UUID>.<快捷键 ID>`
</td></tr>
</tbody></table>
## Returns
[ISYS\_ShortcutKeyDataWithUserDefinedShortcutKey](../interfaces/ISYS_ShortcutKeyDataWithUserDefinedShortcutKey.md) \| undefined
获取到的快捷键数据
## Remarks
本接口允许获取其它扩展的快捷键数据,仅需按格式拼接快捷键 ID
本接口无法获取系统快捷键数据
注意:本接口仅扩展有效,在独立脚本环境内调用将始终 `throw Error` ADD since EDA v4.2
### getall
# SYS\_ShortcutKey.getAll() method
> 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.
获取所有快捷键数据
## Signature
```typescript
function getAll(): Record<string, ISYS_ShortcutKeyDataWithUserDefinedShortcutKey>;
```
## Returns
Record<string, [ISYS\_ShortcutKeyDataWithUserDefinedShortcutKey](../interfaces/ISYS_ShortcutKeyDataWithUserDefinedShortcutKey.md)<!-- -->>
获取到的快捷键数据
## Remarks
本接口将会获取本扩展的所有快捷键数据
本接口无法获取系统快捷键数据
注意:本接口仅扩展有效,在独立脚本环境内调用将始终 `throw Error` ADD since EDA v4.2
### getshortcutkeys
# SYS\_ShortcutKey.getShortcutKeys() method
> 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.
> Warning: This API is now obsolete.
>
> since EDA v4.2
Query shortcut key list
## Signature
```typescript
function getShortcutKeys(
includeSystem?: boolean,
): Promise<
Array<{
shortcutKey: TSYS_ShortcutKeys;
title: string;
documentType: Array<ESYS_ShortcutKeyEffectiveEditorRange>;
scene: Array<ESYS_ShortcutKeyEffectiveEditorScene>;
}>
>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
includeSystem
</td><td>
boolean
</td><td>
_(Optional)_ Whether Contain system shortcut key
</td></tr>
</tbody></table>
## Returns
Promise<Array<{ shortcutKey: [TSYS\_ShortcutKeys](../types/TSYS_ShortcutKeys.md)<!-- -->; title: string; documentType: Array<[ESYS\_ShortcutKeyEffectiveEditorRange](../enums/ESYS_ShortcutKeyEffectiveEditorRange.md)<!-- -->>; scene: Array<[ESYS\_ShortcutKeyEffectiveEditorScene](../enums/ESYS_ShortcutKeyEffectiveEditorScene.md)<!-- -->> }>>
Shortcut key list
## Example
```javascript
// 1. 只查非系统快捷键(扩展注册的),列表精简便于观察
const custom = await eda.sys_ShortcutKey.getShortcutKeys();
console.log('非系统快捷键数量:', custom.length);
// 2. 连同系统快捷键一起查(用于完整键位冲突检测)
const all = await eda.sys_ShortcutKey.getShortcutKeys(true);
console.log('含系统快捷键总数:', all.length);
// 3. 观察单条数据结构:shortcutKey 是键位数组,title 是名称,
// documentType 是生效页面,scene 是生效场景
const sample = all[0];
console.log('首条快捷键:', JSON.stringify(sample));
```
### register
# SYS\_ShortcutKey.register() method
> 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.
注册快捷键
## Signature
```typescript
function register(id: string, props: ISYS_ShortcutKeyDataWithCallFn): boolean;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
快捷键 ID,将会自动拼接上扩展 UUID 作为前缀
</td></tr>
<tr><td>
props
</td><td>
[ISYS\_ShortcutKeyDataWithCallFn](../interfaces/ISYS_ShortcutKeyDataWithCallFn.md)
</td><td>
快捷键数据
</td></tr>
</tbody></table>
## Returns
boolean
注册是否成功
## Remarks
此处注册快捷键时传入的 `shortcutKey` 仅为默认快捷键,用户可以在设置中修改
如若该快捷键与系统快捷键冲突,系统快捷键将会优先生效
如果需要修改已注册的快捷键信息,可以直接调用本接口,并在 `props` 中传入完整的需要修改的快捷键数据
本接口无法修改系统快捷键
注意:本接口仅扩展有效,在独立脚本环境内调用将始终 `throw Error` ADD since EDA v4.2
### registershortcutkey
# SYS\_ShortcutKey.registerShortcutKey() method
> 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.
> Warning: This API is now obsolete.
>
> since EDA v4.2
Register shortcut key
## Signature
```typescript
function registerShortcutKey(
shortcutKey: TSYS_ShortcutKeys,
title: string,
callbackFn: (shortcutKey: TSYS_ShortcutKeys) => void | Promise<void>,
documentType?: Array<ESYS_ShortcutKeyEffectiveEditorRange>,
scene?: Array<ESYS_ShortcutKeyEffectiveEditorScene>,
): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
shortcutKey
</td><td>
[TSYS\_ShortcutKeys](../types/TSYS_ShortcutKeys.md)
</td><td>
Shortcut key. If the array contains multiple elements, it is parsed as a combined shortcut key and sorted by rules before being stored in the cache
</td></tr>
<tr><td>
title
</td><td>
string
</td><td>
Shortcut key title, the friendly name of the shortcut key
</td></tr>
<tr><td>
callbackFn
</td><td>
(shortcutKey: [TSYS\_ShortcutKeys](../types/TSYS_ShortcutKeys.md)<!-- -->) => void \| Promise<void>
</td><td>
Callback function
</td></tr>
<tr><td>
documentType
</td><td>
Array<[ESYS\_ShortcutKeyEffectiveEditorRange](../enums/ESYS_ShortcutKeyEffectiveEditorRange.md)<!-- -->>
</td><td>
_(Optional)_
</td></tr>
<tr><td>
scene
</td><td>
Array<[ESYS\_ShortcutKeyEffectiveEditorScene](../enums/ESYS_ShortcutKeyEffectiveEditorScene.md)<!-- -->>
</td><td>
_(Optional)_
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Register whether the operation is successful
## Example
```javascript
// 1. 注册冷门组合键 Ctrl+Alt+Shift+F9,避免占用常用键位
// documentType 传 2(原理图图页)与 4(PCB);scene 传 4(画布绘制)
const ok = await eda.sys_ShortcutKey.registerShortcutKey(
['CONTROL', 'ALT', 'SHIFT', 'F9'],
'嘉立创示例_演示快捷键',
(shortcutKey) => {
// 用户实际按键时才触发,自动化测试不按键,此处仅演示回调写法
console.log('快捷键被按下:', JSON.stringify(shortcutKey));
},
[2, 4],
[4]
);
console.log('注册快捷键返回:', ok);
// 2. 查询验证:新注册的快捷键出现在非系统快捷键列表中
const list = await eda.sys_ShortcutKey.getShortcutKeys();
const found = list.some(item => item.title === '嘉立创示例_演示快捷键');
console.log('已注册到快捷键列表:', found);
// 3. 反注册还原键位,保证案例可重复运行且不残留全局快捷键
const removed = await eda.sys_ShortcutKey.unregisterShortcutKey(['CONTROL', 'ALT', 'SHIFT', 'F9']);
console.log('反注册还原返回:', removed);
```
### unregister
# SYS\_ShortcutKey.unregister() method
> 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.
反注册快捷键
## Signature
```typescript
function unregister(id: string): boolean;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
快捷键 ID,如需反注册其它扩展注册的快捷键,请在前缀处拼接扩展 UUID,格式为:`<扩展 UUID>.<快捷键 ID>`
</td></tr>
</tbody></table>
## Returns
boolean
反注册是否成功
## Remarks
本接口允许反注册其它扩展的快捷键,仅需按格式拼接快捷键 ID
本接口无法反注册系统快捷键
注意:本接口仅扩展有效,在独立脚本环境内调用将始终 `throw Error` ADD since EDA v4.2
### unregistershortcutkey
# SYS\_ShortcutKey.unregisterShortcutKey() method
> 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.
> Warning: This API is now obsolete.
>
> since EDA v4.2
Unregister a shortcut key
## Signature
```typescript
function unregisterShortcutKey(shortcutKey: TSYS_ShortcutKeys): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
shortcutKey
</td><td>
[TSYS\_ShortcutKeys](../types/TSYS_ShortcutKeys.md)
</td><td>
Shortcut key. The order of the passed-in elements is not distinguished; it will be sorted automatically and the matching shortcut key will be queried
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether the unregistration operation was successful
## Example
```javascript
// 1. 先注册一个演示快捷键作为操作对象
await eda.sys_ShortcutKey.registerShortcutKey(
['CONTROL', 'ALT', 'F9'],
'嘉立创示例_待移除快捷键',
() => {}
);
// 2. 反注册:故意打乱键序传入,验证不区分排列顺序的匹配规则
const ok = await eda.sys_ShortcutKey.unregisterShortcutKey(['F9', 'ALT', 'CONTROL']);
console.log('反注册返回:', ok);
// 3. 复查快捷键列表,确认演示键位已被移除
const list = await eda.sys_ShortcutKey.getShortcutKeys();
const still = list.some(item => item.title === '嘉立创示例_待移除快捷键');
console.log('反注册后仍在列表中:', still);
```
references/classes/SYS_Timer.md
# SYS\_Timer class
System / timer class
## Signature
```typescript
class SYS_Timer
```
## Remarks
Set Timer
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[clearIntervalTimer(id)](./SYS_Timer.md)
</td><td>
</td><td>
Clear the specified interval timer
</td></tr>
<tr><td>
[clearTimeoutTimer(id)](./SYS_Timer.md)
</td><td>
</td><td>
Clear the specified timeout timer
</td></tr>
<tr><td>
[setIntervalTimer(id, timeout, callFn, args)](./SYS_Timer.md)
</td><td>
</td><td>
Set an interval timer
</td></tr>
<tr><td>
[setTimeoutTimer(id, timeout, callFn, args)](./SYS_Timer.md)
</td><td>
</td><td>
Set a timeout timer
</td></tr>
</tbody></table>
---
## 方法详情
### clearintervaltimer
# SYS\_Timer.clearIntervalTimer() method
Clear the specified interval timer
## Signature
```typescript
function clearIntervalTimer(id: string): boolean;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
Timer ID
</td></tr>
</tbody></table>
## Returns
boolean
Whether the timer was cleared successfully
## Example
```javascript
// 1. 挂一个每 200ms 触发的循环定时器
let tickCount = 0;
const created = eda.sys_Timer.setIntervalTimer('嘉立创示例_停表', 200, () => { tickCount++; });
// 2. 让它运行约 1.5 秒
await new Promise(resolve => setTimeout(resolve, 1500));
const ticksAtClear = tickCount;
// 3. 清除定时器,回调不再触发
const cleared = eda.sys_Timer.clearIntervalTimer('嘉立创示例_停表');
await new Promise(resolve => setTimeout(resolve, 600));
// 4. 清除不存在的 ID 返回 false(该定时器已在上一步被清除)
const again = eda.sys_Timer.clearIntervalTimer('嘉立创示例_停表');
console.log('定时器设置结果:', created);
console.log('清除结果:', cleared);
console.log('清除前触发次数:', ticksAtClear, ',清除后新增:', tickCount - ticksAtClear);
console.log('再次清除同一 ID:', again);
```
### cleartimeouttimer
# SYS\_Timer.clearTimeoutTimer() method
Clear the specified timeout timer
## Signature
```typescript
function clearTimeoutTimer(id: string): boolean;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
Timer ID
</td></tr>
</tbody></table>
## Returns
boolean
Whether the timer was cleared successfully
## Example
```javascript
// 1. 挂一个 2 秒后才触发的定时器
let fired = false;
eda.sys_Timer.setTimeoutTimer('嘉立创示例_取消单次', 2000, () => { fired = true; });
// 2. 在触发前清除它
const cleared = eda.sys_Timer.clearTimeoutTimer('嘉立创示例_取消单次');
// 3. 对已清除的 ID 再清除一次,返回 false(定时器已不存在)
const again = eda.sys_Timer.clearTimeoutTimer('嘉立创示例_取消单次');
// 4. 等过原定触发时间,确认回调没有被触发
await new Promise(resolve => setTimeout(resolve, 1000));
console.log('清除结果:', cleared);
console.log('再次清除同一 ID:', again);
console.log('回调是否仍被触发:', fired);
```
### setintervaltimer
# SYS\_Timer.setIntervalTimer() method
Set an interval timer
## Signature
```typescript
function setIntervalTimer(
id: string,
timeout: number,
callFn: (...args: any) => void,
...args: any
): boolean;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
Timer ID, used to locate and delete the timer
</td></tr>
<tr><td>
timeout
</td><td>
number
</td><td>
Timer duration, unit ms
</td></tr>
<tr><td>
callFn
</td><td>
(...args: any) => void
</td><td>
Function called by the timer
</td></tr>
<tr><td>
args
</td><td>
any
</td><td>
Arguments passed to the timer callback function
</td></tr>
</tbody></table>
## Returns
boolean
Whether the timer was set successfully
## Remarks
If a timer with a duplicate ID is encountered, the previously set timer will be cleared
## Example
```javascript
// 1. 设置每 200ms 触发一次的循环定时器,统计触发次数
let tickCount = 0;
const created = eda.sys_Timer.setIntervalTimer('嘉立创示例_循环', 200, () => { tickCount++; });
// 2. 让它运行约 1.5 秒
await new Promise(resolve => setTimeout(resolve, 1500));
const ticksAtClear = tickCount;
// 3. 用完清除,定时器停止(净零收尾,可重复运行)
const cleared = eda.sys_Timer.clearIntervalTimer('嘉立创示例_循环');
// 4. 再等一会,确认清除后没有继续触发
await new Promise(resolve => setTimeout(resolve, 600));
console.log('设置结果:', created);
console.log('清除结果:', cleared);
console.log('运行期间触发次数:', ticksAtClear, ',清除后新增:', tickCount - ticksAtClear);
```
### settimeouttimer
# SYS\_Timer.setTimeoutTimer() method
Set a timeout timer
## Signature
```typescript
function setTimeoutTimer(
id: string,
timeout: number,
callFn: (...args: any) => void,
...args: any
): boolean;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
Timer ID
</td></tr>
<tr><td>
timeout
</td><td>
number
</td><td>
Timer duration, unit ms
</td></tr>
<tr><td>
callFn
</td><td>
(...args: any) => void
</td><td>
Function called by the timer
</td></tr>
<tr><td>
args
</td><td>
any
</td><td>
Arguments passed to the timer callback function
</td></tr>
</tbody></table>
## Returns
boolean
Whether the timer was set successfully
## Remarks
If a timer with a duplicate ID is encountered, the previously set timer will be cleared
## Example
```javascript
// 1. 设置 200ms 后触发一次的定时器,并给回调传参
let received = null;
const created = eda.sys_Timer.setTimeoutTimer('嘉立创示例_单次', 200, (msg) => { received = msg; }, '延时任务完成');
// 2. 等待定时器到期(单次定时器触发后自动结束,无需手动清理)
await new Promise(resolve => setTimeout(resolve, 1500));
console.log('设置结果:', created);
console.log('回调收到的参数:', received);
```
references/classes/SYS_Tool.md
# SYS\_Tool class
System / tool class
## Signature
```typescript
class SYS_Tool
```
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[netlistComparison(netlist1, netlist2)](./SYS_Tool.md)
</td><td>
</td><td>
**_(BETA)_** Netlist comparison
</td></tr>
<tr><td>
[pcbComparison(pcb1, pcb2, options)](./SYS_Tool.md)
</td><td>
</td><td>
**_(BETA)_** PCB comparison
</td></tr>
<tr><td>
[schematicComparison(schematicUuid1, schematicUuid2)](./SYS_Tool.md)
</td><td>
</td><td>
**_(BETA)_** Schematic comparison
</td></tr>
</tbody></table>
---
## 方法详情
### netlistcomparison
# SYS\_Tool.netlistComparison() method
> 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.
Netlist comparison
## Signature
```typescript
function netlistComparison(
netlist1: string | { projectUuid: string; documentUuid: string } | File,
netlist2: string | { projectUuid: string; documentUuid: string } | File,
): Promise<
Array<{
type: 'Net' | 'Component';
object: string;
netlist1Name: Array<string>;
netlist2Name: Array<string>;
}>
>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
netlist1
</td><td>
string \| { projectUuid: string; documentUuid: string } \| File
</td><td>
Netlist 1, which can be: 1. The UUID of a schematic or PCB in the current project; 2. The project UUID and schematic/PCB UUID of another project; 3. Schematic or PCB file data
</td></tr>
<tr><td>
netlist2
</td><td>
string \| { projectUuid: string; documentUuid: string } \| File
</td><td>
Netlist 2, which can be: 1. The UUID of a schematic or PCB in the current project; 2. The project UUID and schematic/PCB UUID of another project; 3. Schematic or PCB file data
</td></tr>
</tbody></table>
## Returns
Promise<Array<{ type: 'Net' \| 'Component'; object: string; netlist1Name: Array<string>; netlist2Name: Array<string> }>>
Netlist comparison result
## Example
```javascript
// 1. 取工程内前两张 PCB 作为两份网表的来源
const pcbs = await eda.dmt_Pcb.getAllPcbsInfo();
const docA = pcbs[0];
const docB = pcbs[1];
// 2. 同一文档与自身对比:网表完全一致,返回空数组(无差异)
const selfDiff = await eda.sys_Tool.netlistComparison(docA.uuid, docA.uuid);
console.log('自身对比差异条数:', selfDiff.length);
// 3. 两张不同 PCB 对比:返回差异清单
const diff = await eda.sys_Tool.netlistComparison(docA.uuid, docB.uuid);
console.log('两文档对比差异条数:', diff.length);
// 4. 展示差异结构:type 为差异类型,object 为差异对象,
// net1 / net2 分别是该对象在两份网表中的名称列表(运行时字段名)
for (const item of diff.slice(0, 5)) {
console.log('差异:', item.type, item.object, '网表 1:', item.net1.join('、') || '(无)', '网表 2:', item.net2.join('、') || '(无)');
}
```
### pcbcomparison
# SYS\_Tool.pcbComparison() method
> 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.
PCB comparison
## Signature
```typescript
function pcbComparison(
pcb1: string | { projectUuid: string; pcbUuid: string } | File,
pcb2: string | { projectUuid: string; pcbUuid: string } | File,
options?: {
valUnit?: ESYS_Unit.MIL | ESYS_Unit.MILLIMETER | ESYS_Unit.INCH | ESYS_Unit.CENTIMETER;
deviation?: number;
comparisonSize?: number;
},
): Promise<ISYS_ComparisonResponse>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
pcb1
</td><td>
string \| { projectUuid: string; pcbUuid: string } \| File
</td><td>
PCB 1, which can be: 1. The UUID of a PCB in the current project; 2. The project UUID and PCB UUID of another project; 3. PCB file data
</td></tr>
<tr><td>
pcb2
</td><td>
string \| { projectUuid: string; pcbUuid: string } \| File
</td><td>
PCB 2, which can be: 1. The UUID of a PCB in the current project; 2. The project UUID and PCB UUID of another project; 3. PCB file data
</td></tr>
<tr><td>
options
</td><td>
{ valUnit?: [ESYS\_Unit.MIL](../enums/ESYS_Unit.md) \| [ESYS\_Unit.MILLIMETER](../enums/ESYS_Unit.md) \| [ESYS\_Unit.INCH](../enums/ESYS_Unit.md) \| [ESYS\_Unit.CENTIMETER](../enums/ESYS_Unit.md)<!-- -->; deviation?: number; comparisonSize?: number; }
</td><td>
_(Optional)_ 对比参数
</td></tr>
</tbody></table>
## Returns
Promise<[ISYS\_ComparisonResponse](../interfaces/ISYS_ComparisonResponse.md)<!-- -->>
PCB comparison response: when `success = true`<!-- -->, `data` is the comparison result; when `success = false`<!-- -->, `error` contains the error code and message
## Remarks
ADD since EDA v3.2.205 / EDA v4.1.62
### schematiccomparison
# SYS\_Tool.schematicComparison() method
> 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.
Schematic comparison
## Signature
```typescript
function schematicComparison(
schematicUuid1: string,
schematicUuid2: string,
): Promise<ISYS_ComparisonResponse>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
schematicUuid1
</td><td>
string
</td><td>
原理图 1 UUID
</td></tr>
<tr><td>
schematicUuid2
</td><td>
string
</td><td>
原理图 2 UUID
</td></tr>
</tbody></table>
## Returns
Promise<[ISYS\_ComparisonResponse](../interfaces/ISYS_ComparisonResponse.md)<!-- -->>
Schematic comparison result
## Remarks
ADD since EDA v3.2.205 / EDA v4.1.62
references/classes/SYS_ToastMessage.md
# SYS\_ToastMessage class
> Warning: This API is now obsolete.
>
> The toast message class will soon be removed and merged into [the message notification class](./SYS_Message.md)
System / toast message class
## Signature
```typescript
class SYS_ToastMessage
```
## Remarks
Pops up a brief message notification at the edge of the screen, which will automatically disappear after a certain period of time
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[showMessage(message, messageType, timer, bottomPanel, buttonTitle, buttonCallbackFn)](./SYS_ToastMessage.md)
</td><td>
</td><td>
Show a toast message
</td></tr>
</tbody></table>
---
## 方法详情
### showmessage
# SYS\_ToastMessage.showMessage() method
> Warning: This API is now obsolete.
>
> Please use the [SYS\_Message.showToastMessage()](./SYS_Message.md) method instead
Show a toast message
## Signature
```typescript
function showMessage(
message: string,
messageType?: ESYS_ToastMessageType,
timer?: number,
bottomPanel?: ESYS_BottomPanelTab,
buttonTitle?: string,
buttonCallbackFn?: string,
): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
message
</td><td>
string
</td><td>
Message content
</td></tr>
<tr><td>
messageType
</td><td>
[ESYS\_ToastMessageType](../enums/ESYS_ToastMessageType.md)
</td><td>
_(Optional)_ Message type
</td></tr>
<tr><td>
timer
</td><td>
number
</td><td>
_(Optional)_ Auto-close countdown in seconds. `0` means it will not auto-close
</td></tr>
<tr><td>
bottomPanel
</td><td>
[ESYS\_BottomPanelTab](../enums/ESYS_BottomPanelTab.md)
</td><td>
_(Optional)_ Expand the bottom information panel
</td></tr>
<tr><td>
buttonTitle
</td><td>
string
</td><td>
_(Optional)_ Callback button title
</td></tr>
<tr><td>
buttonCallbackFn
</td><td>
string
</td><td>
_(Optional)_ Callback function content, in string form. It will be automatically parsed and executed
</td></tr>
</tbody></table>
## Returns
void
## Example
```javascript
// 1. 最简调用:默认信息类型,倒计时结束后自动消失
eda.sys_ToastMessage.showMessage('嘉立创示例 工程已自动保存');
console.log('信息吐司已显示');
// 2. 指定消息类型与倒计时秒数:成功图标,2 秒后自动关闭
eda.sys_ToastMessage.showMessage('嘉立创示例 导出完成', 'success', 2);
console.log('成功吐司已显示,2 秒后自动关闭');
// 3. 带回调按钮与底部面板联动:点击按钮执行回调并展开日志面板
eda.sys_ToastMessage.showMessage(
'嘉立创示例 检查完成,详见日志面板',
'warn',
5,
'log',
'查看日志',
'console.log("嘉立创示例 按钮回调被执行")'
);
console.log('警告吐司已显示,附带查看日志按钮,5 秒后自动关闭');
```
references/classes/SYS_Unit.md
# SYS\_Unit class
System / unit class
## Signature
```typescript
class SYS_Unit
```
## Remarks
Controls the system data units and unit conversion basic functions. Currently, the schematic data unit span is equivalent to `10mil` or `0.01inch`<!-- -->, and the PCB data unit span is equivalent to `mil`
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[getFrontendDataUnit()](./SYS_Unit.md)
</td><td>
</td><td>
**_(BETA)_** Get the EDA front-end data unit span
</td></tr>
<tr><td>
[inchToMil(inch, numberOfDecimals)](./SYS_Unit.md)
</td><td>
</td><td>
Unit conversion: inches to mils
</td></tr>
<tr><td>
[inchToMm(inch, numberOfDecimals)](./SYS_Unit.md)
</td><td>
</td><td>
Unit conversion: inches to millimeters
</td></tr>
<tr><td>
[milToInch(mil, numberOfDecimals)](./SYS_Unit.md)
</td><td>
</td><td>
Unit conversion: mils to inches
</td></tr>
<tr><td>
[milToMm(mil, numberOfDecimals)](./SYS_Unit.md)
</td><td>
</td><td>
Unit conversion: mils to millimeters
</td></tr>
<tr><td>
[mmToInch(mm, numberOfDecimals)](./SYS_Unit.md)
</td><td>
</td><td>
Unit conversion: millimeters to inches
</td></tr>
<tr><td>
[mmToMil(mm, numberOfDecimals)](./SYS_Unit.md)
</td><td>
</td><td>
Unit conversion: millimeters to mils
</td></tr>
</tbody></table>
---
## 方法详情
### getfrontenddataunit
# SYS\_Unit.getFrontendDataUnit() method
> 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.
Get the EDA front-end data unit span
## Signature
```typescript
function getFrontendDataUnit(): Promise<ESYS_Unit | undefined>;
```
## Returns
Promise<[ESYS\_Unit](../enums/ESYS_Unit.md) \| undefined>
Unit
## Remarks
This refers to the units that front-end users can switch, and it needs to be compatible with both the schematic and PCB canvases
## Example
```javascript
// 1. 读取当前前端单位(返回 Promise,需要 await;结果为 ESYS_Unit 值,如 'mm'、'mil'、'in')
const unit = await eda.sys_Unit.getFrontendDataUnit();
// 2. 输出当前单位
console.log('前端当前单位:', unit);
```
### inchtomil
# SYS\_Unit.inchToMil() method
Unit conversion: inches to mils
## Signature
```typescript
function inchToMil(inch: number, numberOfDecimals?: number): number;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
inch
</td><td>
number
</td><td>
Input value in inches
</td></tr>
<tr><td>
numberOfDecimals
</td><td>
number
</td><td>
_(Optional)_ Number of decimal places to keep, default is `4`
</td></tr>
</tbody></table>
## Returns
number
Output value in mils
## Example
```javascript
// 1. 基本换算:1 英寸 = 1000 mil(同步返回数值,无需 await)
console.log('1 英寸 =', eda.sys_Unit.inchToMil(1), 'mil');
// 2. 常用节距换算:0.1 英寸(2.54mm 栅格)与 0.02 英寸(50mil 节距)
console.log('0.1 英寸 =', eda.sys_Unit.inchToMil(0.1), 'mil');
console.log('0.02 英寸 =', eda.sys_Unit.inchToMil(0.02), 'mil');
// 3. 指定保留 2 位小数(默认 4 位)
console.log('0.0254 英寸保留 2 位小数 =', eda.sys_Unit.inchToMil(0.0254, 2), 'mil');
```
### inchtomm
# SYS\_Unit.inchToMm() method
Unit conversion: inches to millimeters
## Signature
```typescript
function inchToMm(inch: number, numberOfDecimals?: number): number;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
inch
</td><td>
number
</td><td>
Input value in inches
</td></tr>
<tr><td>
numberOfDecimals
</td><td>
number
</td><td>
_(Optional)_ Number of decimal places to keep, default is `4`
</td></tr>
</tbody></table>
## Returns
number
Output value in millimeters
## Example
```javascript
// 1. 基本换算:1 英寸 = 25.4 mm(同步返回数值,无需 await)
console.log('1 英寸 =', eda.sys_Unit.inchToMm(1), 'mm');
// 2. 常用节距换算:0.1 英寸栅格即 2.54 mm
console.log('0.1 英寸 =', eda.sys_Unit.inchToMm(0.1), 'mm');
// 3. 指定保留 3 位小数(默认 4 位)
console.log('1.25 英寸保留 3 位小数 =', eda.sys_Unit.inchToMm(1.25, 3), 'mm');
```
### miltoinch
# SYS\_Unit.milToInch() method
Unit conversion: mils to inches
## Signature
```typescript
function milToInch(mil: number, numberOfDecimals?: number): number;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
mil
</td><td>
number
</td><td>
Input value in mils
</td></tr>
<tr><td>
numberOfDecimals
</td><td>
number
</td><td>
_(Optional)_ Number of decimal places to keep, default is `4`
</td></tr>
</tbody></table>
## Returns
number
Output value in inches
## Example
```javascript
// 1. 基本换算:1000 mil = 1 英寸(同步返回数值,无需 await)
console.log('1000 mil =', eda.sys_Unit.milToInch(1000), '英寸');
// 2. 常用线宽换算:6 mil 与 10 mil
console.log('6 mil =', eda.sys_Unit.milToInch(6), '英寸');
console.log('10 mil =', eda.sys_Unit.milToInch(10), '英寸');
// 3. 指定保留 6 位小数(默认 4 位,小尺寸需要更多位才不损失精度)
console.log('6 mil 保留 6 位小数 =', eda.sys_Unit.milToInch(6, 6), '英寸');
```
### miltomm
# SYS\_Unit.milToMm() method
Unit conversion: mils to millimeters
## Signature
```typescript
function milToMm(mil: number, numberOfDecimals?: number): number;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
mil
</td><td>
number
</td><td>
Input value in mils
</td></tr>
<tr><td>
numberOfDecimals
</td><td>
number
</td><td>
_(Optional)_ Number of decimal places to keep, default is `4`
</td></tr>
</tbody></table>
## Returns
number
Output value in millimeters
## Example
```javascript
// 1. 基本换算:100 mil = 2.54 mm(同步返回数值,无需 await)
console.log('100 mil =', eda.sys_Unit.milToMm(100), 'mm');
// 2. 常用工艺值换算:6 mil 线宽与 1181 mil(约 30 mm 板宽)
console.log('6 mil =', eda.sys_Unit.milToMm(6), 'mm');
console.log('1181 mil =', eda.sys_Unit.milToMm(1181), 'mm');
// 3. 指定保留 2 位小数(默认 4 位)
console.log('3937 mil 保留 2 位小数 =', eda.sys_Unit.milToMm(3937, 2), 'mm');
```
### mmtoinch
# SYS\_Unit.mmToInch() method
Unit conversion: millimeters to inches
## Signature
```typescript
function mmToInch(mm: number, numberOfDecimals?: number): number;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
mm
</td><td>
number
</td><td>
Input value in millimeters
</td></tr>
<tr><td>
numberOfDecimals
</td><td>
number
</td><td>
_(Optional)_ Number of decimal places to keep, default is `4`
</td></tr>
</tbody></table>
## Returns
number
Output value in inches
## Example
```javascript
// 1. 基本换算:25.4 mm = 1 英寸(同步返回数值,无需 await)
console.log('25.4 mm =', eda.sys_Unit.mmToInch(25.4), '英寸');
// 2. 常用板宽换算:100 mm 与 160 mm
console.log('100 mm =', eda.sys_Unit.mmToInch(100), '英寸');
console.log('160 mm =', eda.sys_Unit.mmToInch(160), '英寸');
// 3. 指定保留 6 位小数(默认 4 位,小尺寸需要更多位才不损失精度)
console.log('2.54 mm 保留 6 位小数 =', eda.sys_Unit.mmToInch(2.54, 6), '英寸');
```
### mmtomil
# SYS\_Unit.mmToMil() method
Unit conversion: millimeters to mils
## Signature
```typescript
function mmToMil(mm: number, numberOfDecimals?: number): number;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
mm
</td><td>
number
</td><td>
Input value in millimeters
</td></tr>
<tr><td>
numberOfDecimals
</td><td>
number
</td><td>
_(Optional)_ Number of decimal places to keep, default is `4`
</td></tr>
</tbody></table>
## Returns
number
Output value in mils
## Example
```javascript
// 1. 基本换算:1 mm ≈ 39.37 mil(同步返回数值,无需 await)
console.log('1 mm =', eda.sys_Unit.mmToMil(1), 'mil');
// 2. 常用尺寸换算:5 mm 安装孔与 100 mm 板宽
console.log('5 mm =', eda.sys_Unit.mmToMil(5), 'mil');
console.log('100 mm =', eda.sys_Unit.mmToMil(100), 'mil');
// 3. 指定保留 0 位小数取整(默认 4 位)
console.log('19.685 mm 取整 =', eda.sys_Unit.mmToMil(19.685, 0), 'mil');
```
references/enums/EDMT_EditorTabEventType.md
# EDMT\_EditorTabEventType enum
Editor tab event type
## Signature
```typescript
enum EDMT_EditorTabEventType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
CLOSE
</td><td>
`'close'`
</td><td>
关闭
</td></tr>
<tr><td>
OPEN
</td><td>
`'open'`
</td><td>
打开
</td></tr>
<tr><td>
TOGGLE
</td><td>
`'toggle'`
</td><td>
切换
</td></tr>
</tbody></table>
## Remarks
When the type is [close](./EDMT_EditorTabEventType.md) or [open](./EDMT_EditorTabEventType.md)<!-- -->, the [switch](./EDMT_EditorTabEventType.md) event will also be triggered
references/enums/EDMT_IndicatorMarkerType.md
# EDMT\_IndicatorMarkerType enum
Indicator marker type
## Signature
```typescript
enum EDMT_IndicatorMarkerType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
ARC
</td><td>
`'arc'`
</td><td>
圆弧
</td></tr>
<tr><td>
CIRCLE
</td><td>
`'circle'`
</td><td>
圆形
</td></tr>
<tr><td>
LINE
</td><td>
`'line'`
</td><td>
线段
</td></tr>
<tr><td>
POINT
</td><td>
`'point'`
</td><td>
点
</td></tr>
<tr><td>
RECTANGLE
</td><td>
`'rectangle'`
</td><td>
矩形
</td></tr>
</tbody></table>
references/classes/SYS_WebSocket.md
# SYS\_WebSocket class
System / WebSocket class
## Signature
```typescript
class SYS_WebSocket
```
## Remarks
Interact with the WebSocket server
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[close(id, code, reason, extensionUuid)](./SYS_WebSocket.md)
</td><td>
</td><td>
Close the WebSocket connection
</td></tr>
<tr><td>
[register(id, serviceUri, receiveMessageCallFn, connectedCallFn, protocols)](./SYS_WebSocket.md)
</td><td>
</td><td>
Register a WebSocket connection
</td></tr>
<tr><td>
[send(id, data, extensionUuid)](./SYS_WebSocket.md)
</td><td>
</td><td>
Send data to the WebSocket server
</td></tr>
</tbody></table>
---
## 方法详情
### close
# SYS\_WebSocket.close() method
Close the WebSocket connection
## Signature
```typescript
function close(id: string, code?: number, reason?: string, extensionUuid?: string): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
Custom WebSocket ID
</td></tr>
<tr><td>
code
</td><td>
number
</td><td>
_(Optional)_ Numeric status code, corresponding to the codes allowed in [WebSocket.CloseEvent](https://developer.mozilla.org/docs/Web/API/CloseEvent/code)
</td></tr>
<tr><td>
reason
</td><td>
string
</td><td>
_(Optional)_ A human-readable string explaining why the connection was closed
</td></tr>
<tr><td>
extensionUuid
</td><td>
string
</td><td>
_(Optional)_ Extension UUID. Generally it does not need to be specified. It only needs to be specified as another extension's UUID when you need to operate on a WebSocket connection established by another extension
</td></tr>
</tbody></table>
## Returns
void
## Remarks
Note: This API requires the user to enable the extension external interaction permission, if not enabled, it will always `throw Error`
## Example
```javascript
// 1. 先注册一条连接用于演示
eda.sys_WebSocket.register('嘉立创示例_关闭', 'ws://127.0.0.1:49620', () => {}, () => {
console.log('连接已建立');
});
// 2. 等待握手完成
await new Promise(r => setTimeout(r, 1500));
// 3. 以「正常关闭」状态码 1000 关闭连接,并附带原因
eda.sys_WebSocket.close('嘉立创示例_关闭', 1000, '演示完毕');
console.log('已关闭连接(code 1000)');
```
### register
# SYS\_WebSocket.register() method
Register a WebSocket connection
## Signature
```typescript
function register(
id: string,
serviceUri: string,
receiveMessageCallFn?: (event: MessageEvent<any>) => void | Promise<void>,
connectedCallFn?: () => void | Promise<void>,
protocols?: string | Array<string>,
): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
Custom WebSocket ID
</td></tr>
<tr><td>
serviceUri
</td><td>
string
</td><td>
WebSocket service URI
</td></tr>
<tr><td>
receiveMessageCallFn
</td><td>
(event: MessageEvent<any>) => void \| Promise<void>
</td><td>
_(Optional)_ Callback function when a message is received
</td></tr>
<tr><td>
connectedCallFn
</td><td>
() => void \| Promise<void>
</td><td>
_(Optional)_ Callback function when the connection is established
</td></tr>
<tr><td>
protocols
</td><td>
string \| Array<string>
</td><td>
_(Optional)_ Sub-protocols
</td></tr>
</tbody></table>
## Returns
void
## Remarks
It can be used to detect whether the WebSocket connection is normal before execution, but note that \*\*do not attempt connections with the same ID but different parameters\*\*, as this will cause confusion: if a WebSocket connection with the specified ID is active, changes to other parameters will not be applied
Note: This API requires the user to enable the extension external interaction permission, if not enabled, it will always `throw Error`
## Example
```javascript
// 1. 注册连接,挂上「连接成功」与「收到消息」两个回调
eda.sys_WebSocket.register('嘉立创示例_注册', 'ws://127.0.0.1:49620', (event) => {
// 服务器推送的每条消息都会进入这个回调(event.data 是消息内容)
console.log('收到服务器消息:', event.data);
}, () => {
console.log('连接已建立');
});
// 2. register 是同步调用,只登记意图,握手需要一点时间,等待回调触发
await new Promise(r => setTimeout(r, 1500));
// 3. 演示完毕后关闭连接,避免残留
eda.sys_WebSocket.close('嘉立创示例_注册');
console.log('已关闭连接');
```
### send
# SYS\_WebSocket.send() method
Send data to the WebSocket server
## Signature
```typescript
function send(id: string, data: string | Blob | BufferSource, extensionUuid?: string): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
id
</td><td>
string
</td><td>
Custom WebSocket ID
</td></tr>
<tr><td>
data
</td><td>
string \| Blob \| BufferSource
</td><td>
Data to send
</td></tr>
<tr><td>
extensionUuid
</td><td>
string
</td><td>
_(Optional)_ Extension UUID. Generally it does not need to be specified. It only needs to be specified as another extension's UUID when you need to operate on a WebSocket connection established by another extension
</td></tr>
</tbody></table>
## Returns
void
## Remarks
Note: This API requires the user to enable the extension external interaction permission, if not enabled, it will always `throw Error`
## Example
```javascript
// 1. 注册连接(本例的桥接服务对 ping 消息回 pong,用来演示完整收发回路)
eda.sys_WebSocket.register('嘉立创示例_发送', 'ws://127.0.0.1:49620', (event) => {
console.log('收到服务器回复:', event.data);
}, () => {
console.log('连接已建立');
});
// 2. 等待握手完成
await new Promise(r => setTimeout(r, 1500));
// 3. 发送数据(data 支持字符串、Blob、BufferSource,这里发 JSON 字符串)
eda.sys_WebSocket.send('嘉立创示例_发送', JSON.stringify({ type: 'ping', id: '嘉立创示例_发送' }));
// 4. 等待服务器回复进入 receiveMessageCallFn
await new Promise(r => setTimeout(r, 1500));
// 5. 演示完毕后关闭连接
eda.sys_WebSocket.close('嘉立创示例_发送');
console.log('已关闭连接');
```
references/enums/EDMT_EditorDocumentType.md
# EDMT\_EditorDocumentType enum
Editor document type
## Signature
```typescript
enum EDMT_EditorDocumentType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
BLANK
</td><td>
`0`
</td><td>
空白页
</td></tr>
<tr><td>
FOOTPRINT
</td><td>
`4`
</td><td>
封装
</td></tr>
<tr><td>
HOME
</td><td>
`-1`
</td><td>
开始页
</td></tr>
<tr><td>
PANEL
</td><td>
`26`
</td><td>
面板
</td></tr>
<tr><td>
PANEL\_3D\_PREVIEW
</td><td>
`27`
</td><td>
面板 3D 预览
</td></tr>
<tr><td>
PANEL\_LIBRARY
</td><td>
`29`
</td><td>
面板库
</td></tr>
<tr><td>
PCB
</td><td>
`3`
</td><td>
PCB
</td></tr>
<tr><td>
PCB\_2D\_PREVIEW
</td><td>
`12`
</td><td>
PCB 2D 预览
</td></tr>
<tr><td>
PCB\_3D\_PREVIEW
</td><td>
`15`
</td><td>
PCB 3D 预览
</td></tr>
<tr><td>
PROJECT
</td><td>
`5`
</td><td>
工程
</td></tr>
<tr><td>
SCHEMATIC\_PAGE
</td><td>
`1`
</td><td>
原理图图页
</td></tr>
<tr><td>
SIMULATION\_SCHEMATIC\_PAGE\_NGSPICE
</td><td>
`8`
</td><td>
仿真原理图图页:Ngspice
</td></tr>
<tr><td>
SIMULATION\_SCHEMATIC\_PAGE\_SIMULIDE
</td><td>
`9`
</td><td>
仿真原理图图页:SimulIDE
</td></tr>
<tr><td>
SIMULATION\_SYMBOL\_COMPONENT\_NGSPICE
</td><td>
`7`
</td><td>
仿真元件符号:Ngspice
</td></tr>
<tr><td>
SIMULATION\_SYMBOL\_COMPONENT\_SIMULIDE
</td><td>
`32`
</td><td>
仿真元件符号:SimulIDE
</td></tr>
<tr><td>
SYMBOL\_CBB
</td><td>
`17`
</td><td>
复用模块符号
</td></tr>
<tr><td>
SYMBOL\_COMPONENT
</td><td>
`2`
</td><td>
元件符号
</td></tr>
<tr><td>
SYMBOL\_DRAWING
</td><td>
`20`
</td><td>
图纸符号
</td></tr>
<tr><td>
SYMBOL\_NET\_FLAG
</td><td>
`18`
</td><td>
网络标识符号
</td></tr>
<tr><td>
SYMBOL\_NET\_PORT
</td><td>
`19`
</td><td>
网络端口符号
</td></tr>
<tr><td>
SYMBOL\_NON\_ELECTRICAL
</td><td>
`21`
</td><td>
无电气符号
</td></tr>
<tr><td>
SYMBOL\_OFF\_PAGE\_CONNECTOR\_FLAG
</td><td>
`25`
</td><td>
跨页连接标识符号
</td></tr>
<tr><td>
SYMBOL\_SHORT\_CIRCUIT\_FLAG
</td><td>
`22`
</td><td>
短接标识符号
</td></tr>
</tbody></table>
references/classes/SYS_Window.md
# SYS\_Window class
System / window class
## Signature
```typescript
class SYS_Window
```
## Remarks
For security, only limited window navigation and listening support is provided. For more operations, use the iframe window [SYS\_IFrame](./SYS_IFrame.md)
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[addEventListener(type, listener, options)](./SYS_Window.md)
</td><td>
</td><td>
Add an event listener
</td></tr>
<tr><td>
[getCurrentTheme()](./SYS_Window.md)
</td><td>
</td><td>
Get Current theme
</td></tr>
<tr><td>
[getUrlAnchor()](./SYS_Window.md)
</td><td>
</td><td>
Get the URL anchor
</td></tr>
<tr><td>
[getUrlParam(key)](./SYS_Window.md)
</td><td>
</td><td>
Get URL parameter
</td></tr>
<tr><td>
[getViewportSize()](./SYS_Window.md)
</td><td>
</td><td>
Get the current viewport size of the page
</td></tr>
<tr><td>
[hideStartPageQuickStartItems(items)](./SYS_Window.md)
</td><td>
</td><td>
Hide start page quick start items
</td></tr>
<tr><td>
[hideStartPageSupportFloatBarItems()](./SYS_Window.md)
</td><td>
</td><td>
Hide the start page support information floating components
</td></tr>
<tr><td>
[open(url, target)](./SYS_Window.md)
</td><td>
</td><td>
Open a resource window
</td></tr>
<tr><td>
[openUI(uiName, args)](./SYS_Window.md)
</td><td>
</td><td>
Open UI window
</td></tr>
<tr><td>
[removeEventListener(removableObject)](./SYS_Window.md)
</td><td>
</td><td>
Remove Event listener
</td></tr>
<tr><td>
[urlPushState(url)](./SYS_Window.md)
</td><td>
</td><td>
Append new URL history stack information
</td></tr>
<tr><td>
[urlReplaceState(url)](./SYS_Window.md)
</td><td>
</td><td>
Modify the current URL history stack information
</td></tr>
</tbody></table>
---
## 方法详情
### addeventlistener
# SYS\_Window.addEventListener() method
Add an event listener
## Signature
```typescript
function addEventListener(
type: ESYS_WindowEventType,
listener: (ev: any) => any,
options?: { capture?: boolean; once?: boolean; passive?: boolean; signal?: AbortSignal },
): ISYS_WindowEventListenerRemovableObject | undefined;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
type
</td><td>
[ESYS\_WindowEventType](../enums/ESYS_WindowEventType.md)
</td><td>
Event type, current support `blur` `focus`
</td></tr>
<tr><td>
listener
</td><td>
(ev: any) => any
</td><td>
Event listener callback
</td></tr>
<tr><td>
options
</td><td>
\{ capture?: boolean; once?: boolean; passive?: boolean; signal?: AbortSignal \}
</td><td>
_(Optional)_ Optional parameters
</td></tr>
</tbody></table>
## Returns
[ISYS\_WindowEventListenerRemovableObject](../interfaces/ISYS_WindowEventListenerRemovableObject.md) \| undefined
Event listener method, used to remove the event listener. If it is `undefined`<!-- -->, it means creating the event listener failed
## Remarks
监听直接挂载到原生 window 上,返回的可移除对象可传给 [SYS\_Window.removeEventListener()](./SYS_Window.md) 移除; 同一扩展重复注册相同 type 的监听会被替换(非累积),卸载扩展时注册的原生监听会被自动清理。
## Example
```javascript
// 示例 1:注册 focus 监听(真实场景由用户切换窗口焦点触发,这里用合成事件模拟)
const removable = eda.sys_Window.addEventListener('focus', () => {
console.log('窗口获得焦点');
});
// 检查返回的可移除对象,其中的 type 字段记录了监听的事件类型
console.log('监听注册成功:', removable !== undefined, ',事件类型:', removable.type);
// 模拟一次获得焦点事件,回调同步触发
window.dispatchEvent(new Event('focus'));
// 注销监听,恢复原状
eda.sys_Window.removeEventListener(removable);
console.log('监听已注销');
```
### getcurrenttheme
# SYS\_Window.getCurrentTheme() method
Get Current theme
## Signature
```typescript
function getCurrentTheme(): Promise<ESYS_Theme>;
```
## Returns
Promise<[ESYS\_Theme](../enums/ESYS_Theme.md)<!-- -->>
Current theme
## Remarks
Get the current EDA theme, \*\*light\*\* or \*\*dark\*\*
## Example
```javascript
// 1. 获取当前主题(异步方法,需要 await)
const theme = await eda.sys_Window.getCurrentTheme();
// 2. 展示结果
console.log('当前主题:', theme === 'light' ? '浅色(light)' : '深色(dark)');
```
### geturlanchor
# SYS\_Window.getUrlAnchor() method
Get the URL anchor
## Signature
```typescript
function getUrlAnchor(): string;
```
## Returns
string
URL anchor value
## Example
```javascript
// 1. 备份当前完整地址(用于演示后还原)
const originalHref = location.href;
// 2. 写入一个示例锚点(地址栏会临时变成示例锚点)
eda.sys_Window.urlPushState(`${location.href.split('#')[0]}#嘉立创示例_锚点`);
// 3. 读取锚点(返回的是编码后的字符串,解码后展示)
const anchor = decodeURIComponent(eda.sys_Window.getUrlAnchor());
console.log('当前锚点:', anchor);
// 4. 还原原地址,保证编辑器锚点状态不受影响
eda.sys_Window.urlReplaceState(originalHref);
console.log('地址已还原');
```
### geturlparam
# SYS\_Window.getUrlParam() method
Get URL parameter
## Signature
```typescript
function getUrlParam(key: string): string | null;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
key
</td><td>
string
</td><td>
Parameter name
</td></tr>
</tbody></table>
## Returns
string \| null
Parameter value
## Example
```javascript
// 1. 备份当前完整地址(用于演示后还原)
const originalHref = location.href;
// 2. 用 URL 对象追加示例参数并写入地址栏
const url = new URL(location.href);
url.searchParams.set('嘉立创示例_参数', '演示值');
eda.sys_Window.urlPushState(url.href);
// 3. 读取刚写入的参数,以及一个不存在的参数
console.log('参数值:', eda.sys_Window.getUrlParam('嘉立创示例_参数'));
console.log('不存在的参数返回:', eda.sys_Window.getUrlParam('嘉立创示例_不存在'));
// 4. 还原原地址
eda.sys_Window.urlReplaceState(originalHref);
console.log('地址已还原');
```
### getviewportsize
# SYS\_Window.getViewportSize() method
Get the current viewport size of the page
## Signature
```typescript
function getViewportSize(): { width: number; height: number };
```
## Returns
\{ width: number; height: number \}
Viewport width and height (in pixels)
## Remarks
ADD since EDA v3.2.162
## Example
```javascript
// 1. 获取视口大小(同步方法,直接取值)
const size = eda.sys_Window.getViewportSize();
// 2. 展示宽高
console.log('视口宽:', size.width, 'px,视口高:', size.height, 'px');
```
### hidestartpagequickstartitems
# SYS\_Window.hideStartPageQuickStartItems() method
Hide start page quick start items
## Signature
```typescript
function hideStartPageQuickStartItems(items: Array<ESYS_StartPageQuickStartItem>): Promise<boolean>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
items
</td><td>
Array<[ESYS\_StartPageQuickStartItem](../enums/ESYS_StartPageQuickStartItem.md)<!-- -->>
</td><td>
Array of quick start items to hide
</td></tr>
</tbody></table>
## Returns
Promise<boolean>
Whether all items were hidden successfully (`false` is returned if unknown items or already-hidden items exist)
## Remarks
Hide the specified items in the quick start module of the start page
Note 1: This API requires the user to enable the extension external interaction permission, if not enabled, it will always `throw Error`
Note 2: This API is dedicated to the private deployment edition. Calling it in other editions will always `throw Error` ADD since EDA v3.2.162
### hidestartpagesupportfloatbaritems
# SYS\_Window.hideStartPageSupportFloatBarItems() method
Hide the start page support information floating components
## Signature
```typescript
function hideStartPageSupportFloatBarItems(): Promise<boolean>;
```
## Returns
Promise<boolean>
Whether Hide successful
## Remarks
Hide the floating components on the right side of the start page (WeChat, customer service, phone, feedback)
Note 1: This API requires the user to enable the extension external interaction permission, if not enabled, it will always `throw Error`
Note 2: This API is dedicated to the private deployment edition. Calling it in other editions will always `throw Error` ADD since EDA v3.2.162
### open
# SYS\_Window.open() method
Open a resource window
## Signature
```typescript
function open(url: string, target?: ESYS_WindowOpenTarget): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
url
</td><td>
string
</td><td>
URL or path of the resource to load
</td></tr>
<tr><td>
target
</td><td>
[ESYS\_WindowOpenTarget](../enums/ESYS_WindowOpenTarget.md)
</td><td>
_(Optional)_ Context target
</td></tr>
</tbody></table>
## Returns
void
## Example
```javascript
// 1. 在新标签页打开目标地址(同步方法,无返回值)
eda.sys_Window.open('http://localhost:49620/health', '_blank');
// 2. 打开的标签页由用户自行关闭
console.log('已在新标签页打开资源窗口');
```
### openui
# SYS\_Window.openUI() method
Open UI window
## Signature
```typescript
function openUI(uiName: string, args?: Record<string, any>): Promise<void>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
uiName
</td><td>
string
</td><td>
UI name
</td></tr>
<tr><td>
args
</td><td>
Record<string, any>
</td><td>
_(Optional)_ Optional parameter object
</td></tr>
</tbody></table>
## Returns
Promise<void>
## Remarks
Non-public API usage notice: This API is provided as-is without additional documentation for parameters. Parameters may be changed in a breaking manner in any version without notice.
## Example
```javascript
// 1. 打开指定名称的内置 UI 窗口(异步方法,需要 await;这里用占位名称演示调用方式)
await eda.sys_Window.openUI('嘉立创示例_UI窗口');
// 2. 调用完成(未知 uiName 静默无效,不抛错)
console.log('openUI 调用完成');
```
### removeeventlistener
# SYS\_Window.removeEventListener() method
Remove Event listener
## Signature
```typescript
function removeEventListener(removableObject: ISYS_WindowEventListenerRemovableObject): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
removableObject
</td><td>
[ISYS\_WindowEventListenerRemovableObject](../interfaces/ISYS_WindowEventListenerRemovableObject.md)
</td><td>
Window event listener can remove object
</td></tr>
</tbody></table>
## Returns
void
## Example
```javascript
// 1. 先注册一个 blur 监听,拿到可移除对象(removeEventListener 的入参)
let fired = 0;
const removable = eda.sys_Window.addEventListener('blur', () => {
fired++;
});
console.log('已注册 blur 监听,事件类型:', removable.type);
// 2. 移除监听
eda.sys_Window.removeEventListener(removable);
// 3. 再触发一次失去焦点事件,验证回调不再执行
window.dispatchEvent(new Event('blur'));
console.log('移除后回调触发次数:', fired);
```
### urlpushstate
# SYS\_Window.urlPushState() method
Append new URL history stack information
## Signature
```typescript
function urlPushState(url: string): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
url
</td><td>
string
</td><td>
URL
</td></tr>
</tbody></table>
## Returns
void
## Example
```javascript
// 1. 备份当前完整地址
const originalHref = location.href;
// 2. 追加一条带示例锚点的新历史记录
eda.sys_Window.urlPushState(`${location.href.split('#')[0]}#嘉立创示例_新状态`);
// 3. 验证地址栏已更新为新的锚点
console.log('追加后的锚点:', decodeURIComponent(eda.sys_Window.getUrlAnchor()));
// 4. 还原地址栏
eda.sys_Window.urlReplaceState(originalHref);
console.log('地址已还原');
```
### urlreplacestate
# SYS\_Window.urlReplaceState() method
Modify the current URL history stack information
## Signature
```typescript
function urlReplaceState(url: string): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
url
</td><td>
string
</td><td>
URL
</td></tr>
</tbody></table>
## Returns
void
## Example
```javascript
// 1. 备份当前完整地址
const originalHref = location.href;
// 2. 把当前历史记录的地址改写为带示例锚点的地址
eda.sys_Window.urlReplaceState(`${location.href.split('#')[0]}#嘉立创示例_替换状态`);
// 3. 验证改写生效(getUrlAnchor 返回编码后的锚点,解码后展示)
console.log('改写后的锚点:', decodeURIComponent(eda.sys_Window.getUrlAnchor()));
// 4. 改回原地址(replaceState 不新增历史记录,此处完全还原)
eda.sys_Window.urlReplaceState(originalHref);
console.log('地址已还原');
```
references/enums/EDMT_EditorSplitScreenDirection.md
# EDMT\_EditorSplitScreenDirection enum
Editor split screen direction
## Signature
```typescript
enum EDMT_EditorSplitScreenDirection
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
HORIZONTAL
</td><td>
`'horizontal'`
</td><td>
水平
</td></tr>
<tr><td>
VERTICAL
</td><td>
`'vertical'`
</td><td>
垂直
</td></tr>
</tbody></table>
references/enums/EDMT_ItemType.md
# EDMT\_ItemType enum
Document tree project type
## Signature
```typescript
enum EDMT_ItemType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
BOARD
</td><td>
`'Board'`
</td><td>
板子
</td></tr>
<tr><td>
CBB\_PCB
</td><td>
`'CBB PCB'`
</td><td>
复用模块 PCB
</td></tr>
<tr><td>
CBB\_PROJECT
</td><td>
`'CBB Project'`
</td><td>
复用模块工程
</td></tr>
<tr><td>
CBB\_SCHEMATIC
</td><td>
`'CBB Schematic'`
</td><td>
复用模块原理图
</td></tr>
<tr><td>
FOLDER
</td><td>
`'Folder'`
</td><td>
文件夹
</td></tr>
<tr><td>
PANEL
</td><td>
`'Panel'`
</td><td>
面板
</td></tr>
<tr><td>
PCB
</td><td>
`'PCB'`
</td><td>
PCB
</td></tr>
<tr><td>
PROJECT
</td><td>
`'Project'`
</td><td>
工程
</td></tr>
<tr><td>
SCHEMATIC
</td><td>
`'Schematic'`
</td><td>
原理图
</td></tr>
<tr><td>
SCHEMATIC\_PAGE
</td><td>
`'Schematic Page'`
</td><td>
原理图图页
</td></tr>
<tr><td>
TEAM
</td><td>
`'Team'`
</td><td>
团队
</td></tr>
<tr><td>
WORKSPACE
</td><td>
`'Workspace'`
</td><td>
工作区
</td></tr>
</tbody></table>
references/enums/EDMT_ProjectFileFormat.md
# EDMT\_ProjectFileFormat enum
工程文件格式
## Signature
```typescript
enum EDMT_ProjectFileFormat
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
EPRJ2
</td><td>
`'eprj2'`
</td><td>
eprj2(单文件数据库格式)
</td></tr>
<tr><td>
EPRJ3
</td><td>
`'eprj3'`
</td><td>
eprj3(文件夹 + 多文件格式)
</td></tr>
</tbody></table>
## Remarks
用于指定创建工程时的落盘文件格式:
- `EPRJ2`<!-- -->:单文件数据库格式(SQLite),兼容性好,但不便于 Git / 云存储同步 - `EPRJ3`<!-- -->:文件夹 + 多文件格式(JSON),便于 Git 管理与文件同步(Git friendly)
仅在客户端半离线 / 全离线模式创建工程时生效,在线环境由服务端创建,将忽略该参数
references/enums/EDMT_ProjectCollaborationMode.md
# EDMT\_ProjectCollaborationMode enum
Project collaboration mode
## Signature
```typescript
enum EDMT_ProjectCollaborationMode
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
FREE
</td><td>
`1`
</td><td>
自由
</td></tr>
<tr><td>
STRICT
</td><td>
`3`
</td><td>
严格
</td></tr>
</tbody></table>
references/enums/ELIB_DeviceJlcLibraryCategory.md
# ELIB\_DeviceJlcLibraryCategory enum
EasyEDA SMT library category
## Signature
```typescript
enum ELIB_DeviceJlcLibraryCategory
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
EXTEND
</td><td>
`'extend'`
</td><td>
扩展库
</td></tr>
<tr><td>
STANDARD
</td><td>
`'standard'`
</td><td>
基础库
</td></tr>
</tbody></table>
references/enums/EPCB_AutoRoutingCornerStyle.md
# EPCB\_AutoRoutingCornerStyle enum
Auto routing corner style
## Signature
```typescript
enum EPCB_AutoRoutingCornerStyle
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
DEGREE\_45
</td><td>
`0`
</td><td>
45 度
</td></tr>
<tr><td>
DEGREE\_90
</td><td>
`1`
</td><td>
90 度
</td></tr>
</tbody></table>
references/enums/ELIB_SymbolType.md
# ELIB\_SymbolType enum
Symbol type
## Signature
```typescript
enum ELIB_SymbolType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
CBB\_SYMBOL
</td><td>
`17`
</td><td>
复用模块符号
</td></tr>
<tr><td>
COMPONENT
</td><td>
`2`
</td><td>
元件符号
</td></tr>
<tr><td>
DIFFERENTIAL\_PAIRS\_FLAG
</td><td>
`31`
</td><td>
差分对标识
</td></tr>
<tr><td>
DRAWING
</td><td>
`20`
</td><td>
图纸
</td></tr>
<tr><td>
NET\_FLAG
</td><td>
`18`
</td><td>
网络标识
</td></tr>
<tr><td>
NET\_PORT
</td><td>
`19`
</td><td>
网络端口
</td></tr>
<tr><td>
NON\_ELECTRICAL
</td><td>
`21`
</td><td>
无电气
</td></tr>
<tr><td>
OFF\_PAGE\_CONNECTOR
</td><td>
`25`
</td><td>
跨页连接标识
</td></tr>
<tr><td>
SHORT\_CIRCUIT\_FLAG
</td><td>
`22`
</td><td>
短接标识
</td></tr>
</tbody></table>
references/enums/ELIB_PreviewType.md
# ELIB\_PreviewType enum
Preview view type
## Signature
```typescript
enum ELIB_PreviewType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
FOOTPRINT
</td><td>
`'F'`
</td><td>
封装预览
</td></tr>
<tr><td>
MODEL\_3D
</td><td>
`'3D'`
</td><td>
3D 预览
</td></tr>
<tr><td>
PRODUCT
</td><td>
`'P'`
</td><td>
产品实物预览
</td></tr>
<tr><td>
SYMBOL
</td><td>
`'S'`
</td><td>
符号预览
</td></tr>
</tbody></table>
references/enums/ELIB_SimulationModelType.md
# ELIB\_SimulationModelType enum
Simulation model type
## Signature
```typescript
enum ELIB_SimulationModelType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
NGSPICE
</td><td>
`'Ngspice'`
</td><td>
Ngspice
</td></tr>
<tr><td>
SIMULIDE
</td><td>
`'SimulIDE'`
</td><td>
SimulIDE
</td></tr>
</tbody></table>
references/enums/EPCB_AutoRoutingExistingPrimitiveMode.md
# EPCB\_AutoRoutingExistingPrimitiveMode enum
How auto routing handles existing wires/vias
## Signature
```typescript
enum EPCB_AutoRoutingExistingPrimitiveMode
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
KEEP
</td><td>
`'keep'`
</td><td>
保留已有导线和过孔(在其基础上继续布线)
</td></tr>
<tr><td>
REMOVE
</td><td>
`'remove'`
</td><td>
移除已有导线和过孔(推倒重布)
</td></tr>
</tbody></table>
references/enums/ELIB_LibraryType.md
# ELIB\_LibraryType enum
Comprehensive library library type
## Signature
```typescript
enum ELIB_LibraryType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
CBB
</td><td>
`'1'`
</td><td>
复用模块
</td></tr>
<tr><td>
DEVICE
</td><td>
`'3'`
</td><td>
器件
</td></tr>
<tr><td>
FOOTPRINT
</td><td>
`'4'`
</td><td>
封装
</td></tr>
<tr><td>
MODEL
</td><td>
`'5'`
</td><td>
3D 模型
</td></tr>
<tr><td>
PANEL\_LIBRARY
</td><td>
`'29'`
</td><td>
面板库
</td></tr>
<tr><td>
SIMULATION\_MODEL\_NGSPICE
</td><td>
`'32'`
</td><td>
仿真模型:Ngspice
</td></tr>
<tr><td>
SIMULATION\_MODEL\_SIMULIDE
</td><td>
`'33'`
</td><td>
仿真模型:SimulIDE
</td></tr>
<tr><td>
SYMBOL
</td><td>
`'2'`
</td><td>
符号
</td></tr>
</tbody></table>
references/enums/EPCB_DocumentCanvasUpdateCalculationActiveStatus.md
# EPCB\_DocumentCanvasUpdateCalculationActiveStatus enum
画布更新计算功能状态
## Signature
```typescript
enum EPCB_DocumentCanvasUpdateCalculationActiveStatus
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
ACTIVE
</td><td>
`'active'`
</td><td>
启用
</td></tr>
<tr><td>
INACTIVE
</td><td>
`'inactive'`
</td><td>
停用
</td></tr>
</tbody></table>
references/enums/EPCB_DocumentRatlineCalculatingActiveStatus.md
# EPCB\_DocumentRatlineCalculatingActiveStatus enum
> Warning: This API is now obsolete.
>
> since EDA v4.2
Document ratline calculation function status
## Signature
```typescript
enum EPCB_DocumentRatlineCalculatingActiveStatus
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
ACTIVE
</td><td>
`'active'`
</td><td>
启用
</td></tr>
<tr><td>
INACTIVE
</td><td>
`'inactive'`
</td><td>
停用
</td></tr>
</tbody></table>
references/enums/EPCB_AutoRoutingOptimization.md
# EPCB\_AutoRoutingOptimization enum
Auto routing optimization priority
## Signature
```typescript
enum EPCB_AutoRoutingOptimization
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
COMPLETION
</td><td>
`1`
</td><td>
优先布通率(尽可能完成所有网络)
</td></tr>
<tr><td>
FASTER
</td><td>
`0`
</td><td>
优先布线速度
</td></tr>
</tbody></table>
references/enums/EPCB_InactiveLayerDisplayMode.md
# EPCB\_InactiveLayerDisplayMode enum
Inactive layer display mode
## Signature
```typescript
enum EPCB_InactiveLayerDisplayMode
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
HIDE
</td><td>
`2`
</td><td>
隐藏
</td></tr>
<tr><td>
NORMAL\_BRIGHTNESS
</td><td>
`0`
</td><td>
正常亮度
</td></tr>
<tr><td>
TURN\_GRAY
</td><td>
`1`
</td><td>
置灰
</td></tr>
</tbody></table>
references/enums/EPCB_LayerStatus.md
# EPCB\_LayerStatus enum
Layer status
## Signature
```typescript
enum EPCB_LayerStatus
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
HIDDEN
</td><td>
`2`
</td><td>
使用但不展示
</td></tr>
<tr><td>
NOT\_USED
</td><td>
`0`
</td><td>
不使用
</td></tr>
<tr><td>
SHOW
</td><td>
`1`
</td><td>
使用并展示
</td></tr>
</tbody></table>
references/enums/EPCB_LayerColorConfiguration.md
# EPCB\_LayerColorConfiguration enum
Layer color configuration
## Signature
```typescript
enum EPCB_LayerColorConfiguration
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
ALTIUM\_DESIGNER
</td><td>
`2`
</td><td>
Altium Designer
</td></tr>
<tr><td>
EASYEDA
</td><td>
`1`
</td><td>
EasyEDA
</td></tr>
<tr><td>
JLCEDA
</td><td>
`1`
</td><td>
嘉立创 EDA
</td></tr>
<tr><td>
KICAD
</td><td>
`4`
</td><td>
KiCAD
</td></tr>
<tr><td>
PADS
</td><td>
`3`
</td><td>
PADS
</td></tr>
</tbody></table>
references/enums/EPCB_LayerId.md
# EPCB\_LayerId enum
Layer ID
## Signature
```typescript
enum EPCB_LayerId
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
BOARD\_OUTLINE
</td><td>
`11`
</td><td>
板框层
</td></tr>
<tr><td>
BOTTOM
</td><td>
`2`
</td><td>
底层
</td></tr>
<tr><td>
BOTTOM\_ASSEMBLY
</td><td>
`10`
</td><td>
底层装配层
</td></tr>
<tr><td>
BOTTOM\_PASTE\_MASK
</td><td>
`8`
</td><td>
底层锡膏(助焊)层
</td></tr>
<tr><td>
BOTTOM\_SILKSCREEN
</td><td>
`4`
</td><td>
底层丝印层
</td></tr>
<tr><td>
BOTTOM\_SOLDER\_MASK
</td><td>
`6`
</td><td>
底层阻焊层
</td></tr>
<tr><td>
BOTTOM\_STIFFENER
</td><td>
`59`
</td><td>
底层 FPC 补强层
</td></tr>
<tr><td>
COMPONENT\_MARKING
</td><td>
`49`
</td><td>
元件标识层
</td></tr>
<tr><td>
COMPONENT\_MODEL
</td><td>
`52`
</td><td>
元件模型层
</td></tr>
<tr><td>
COMPONENT\_SHAPE
</td><td>
`48`
</td><td>
元件外形层
</td></tr>
<tr><td>
CUSTOM\_1
</td><td>
`71`
</td><td>
自定义层 1
</td></tr>
<tr><td>
CUSTOM\_10
</td><td>
`80`
</td><td>
自定义层 10
</td></tr>
<tr><td>
CUSTOM\_11
</td><td>
`81`
</td><td>
自定义层 11
</td></tr>
<tr><td>
CUSTOM\_12
</td><td>
`82`
</td><td>
自定义层 12
</td></tr>
<tr><td>
CUSTOM\_13
</td><td>
`83`
</td><td>
自定义层 13
</td></tr>
<tr><td>
CUSTOM\_14
</td><td>
`84`
</td><td>
自定义层 14
</td></tr>
<tr><td>
CUSTOM\_15
</td><td>
`85`
</td><td>
自定义层 15
</td></tr>
<tr><td>
CUSTOM\_16
</td><td>
`86`
</td><td>
自定义层 16
</td></tr>
<tr><td>
CUSTOM\_17
</td><td>
`87`
</td><td>
自定义层 17
</td></tr>
<tr><td>
CUSTOM\_18
</td><td>
`88`
</td><td>
自定义层 18
</td></tr>
<tr><td>
CUSTOM\_19
</td><td>
`89`
</td><td>
自定义层 19
</td></tr>
<tr><td>
CUSTOM\_2
</td><td>
`72`
</td><td>
自定义层 2
</td></tr>
<tr><td>
CUSTOM\_20
</td><td>
`90`
</td><td>
自定义层 20
</td></tr>
<tr><td>
CUSTOM\_21
</td><td>
`91`
</td><td>
自定义层 21
</td></tr>
<tr><td>
CUSTOM\_22
</td><td>
`92`
</td><td>
自定义层 22
</td></tr>
<tr><td>
CUSTOM\_23
</td><td>
`93`
</td><td>
自定义层 23
</td></tr>
<tr><td>
CUSTOM\_24
</td><td>
`94`
</td><td>
自定义层 24
</td></tr>
<tr><td>
CUSTOM\_25
</td><td>
`95`
</td><td>
自定义层 25
</td></tr>
<tr><td>
CUSTOM\_26
</td><td>
`96`
</td><td>
自定义层 26
</td></tr>
<tr><td>
CUSTOM\_27
</td><td>
`97`
</td><td>
自定义层 27
</td></tr>
<tr><td>
CUSTOM\_28
</td><td>
`98`
</td><td>
自定义层 28
</td></tr>
<tr><td>
CUSTOM\_29
</td><td>
`99`
</td><td>
自定义层 29
</td></tr>
<tr><td>
CUSTOM\_3
</td><td>
`73`
</td><td>
自定义层 3
</td></tr>
<tr><td>
CUSTOM\_30
</td><td>
`100`
</td><td>
自定义层 30
</td></tr>
<tr><td>
CUSTOM\_4
</td><td>
`74`
</td><td>
自定义层 4
</td></tr>
<tr><td>
CUSTOM\_5
</td><td>
`75`
</td><td>
自定义层 5
</td></tr>
<tr><td>
CUSTOM\_6
</td><td>
`76`
</td><td>
自定义层 6
</td></tr>
<tr><td>
CUSTOM\_7
</td><td>
`77`
</td><td>
自定义层 7
</td></tr>
<tr><td>
CUSTOM\_8
</td><td>
`78`
</td><td>
自定义层 8
</td></tr>
<tr><td>
CUSTOM\_9
</td><td>
`79`
</td><td>
自定义层 9
</td></tr>
<tr><td>
DOCUMENT
</td><td>
`13`
</td><td>
文档层
</td></tr>
<tr><td>
DRILL\_DRAWING
</td><td>
`56`
</td><td>
钻孔图层
</td></tr>
<tr><td>
HOLE
</td><td>
`47`
</td><td>
孔层(焊盘、过孔的内孔)
</td></tr>
<tr><td>
INNER\_1
</td><td>
`15`
</td><td>
内层 1
</td></tr>
<tr><td>
INNER\_10
</td><td>
`24`
</td><td>
内层 10
</td></tr>
<tr><td>
INNER\_11
</td><td>
`25`
</td><td>
内层 11
</td></tr>
<tr><td>
INNER\_12
</td><td>
`26`
</td><td>
内层 12
</td></tr>
<tr><td>
INNER\_13
</td><td>
`27`
</td><td>
内层 13
</td></tr>
<tr><td>
INNER\_14
</td><td>
`28`
</td><td>
内层 14
</td></tr>
<tr><td>
INNER\_15
</td><td>
`29`
</td><td>
内层 15
</td></tr>
<tr><td>
INNER\_16
</td><td>
`30`
</td><td>
内层 16
</td></tr>
<tr><td>
INNER\_17
</td><td>
`31`
</td><td>
内层 17
</td></tr>
<tr><td>
INNER\_18
</td><td>
`32`
</td><td>
内层 18
</td></tr>
<tr><td>
INNER\_19
</td><td>
`33`
</td><td>
内层 19
</td></tr>
<tr><td>
INNER\_2
</td><td>
`16`
</td><td>
内层 2
</td></tr>
<tr><td>
INNER\_20
</td><td>
`34`
</td><td>
内层 20
</td></tr>
<tr><td>
INNER\_21
</td><td>
`35`
</td><td>
内层 21
</td></tr>
<tr><td>
INNER\_22
</td><td>
`36`
</td><td>
内层 22
</td></tr>
<tr><td>
INNER\_23
</td><td>
`37`
</td><td>
内层 23
</td></tr>
<tr><td>
INNER\_24
</td><td>
`38`
</td><td>
内层 24
</td></tr>
<tr><td>
INNER\_25
</td><td>
`39`
</td><td>
内层 25
</td></tr>
<tr><td>
INNER\_26
</td><td>
`40`
</td><td>
内层 26
</td></tr>
<tr><td>
INNER\_27
</td><td>
`41`
</td><td>
内层 27
</td></tr>
<tr><td>
INNER\_28
</td><td>
`42`
</td><td>
内层 28
</td></tr>
<tr><td>
INNER\_29
</td><td>
`43`
</td><td>
内层 29
</td></tr>
<tr><td>
INNER\_3
</td><td>
`17`
</td><td>
内层 3
</td></tr>
<tr><td>
INNER\_30
</td><td>
`44`
</td><td>
内层 30
</td></tr>
<tr><td>
INNER\_4
</td><td>
`18`
</td><td>
内层 4
</td></tr>
<tr><td>
INNER\_5
</td><td>
`19`
</td><td>
内层 5
</td></tr>
<tr><td>
INNER\_6
</td><td>
`20`
</td><td>
内层 6
</td></tr>
<tr><td>
INNER\_7
</td><td>
`21`
</td><td>
内层 7
</td></tr>
<tr><td>
INNER\_8
</td><td>
`22`
</td><td>
内层 8
</td></tr>
<tr><td>
INNER\_9
</td><td>
`23`
</td><td>
内层 9
</td></tr>
<tr><td>
MECHANICAL
</td><td>
`14`
</td><td>
机械层
</td></tr>
<tr><td>
MULTI
</td><td>
`12`
</td><td>
多层
</td></tr>
<tr><td>
PIN\_FLOATING
</td><td>
`51`
</td><td>
引脚悬空层
</td></tr>
<tr><td>
PIN\_SOLDERING
</td><td>
`50`
</td><td>
引脚焊接层
</td></tr>
<tr><td>
RATLINE
</td><td>
`57`
</td><td>
飞线层
</td></tr>
<tr><td>
SHELL\_3D\_BOTTOM
</td><td>
`55`
</td><td>
3D 外壳底层
</td></tr>
<tr><td>
SHELL\_3D\_OUTLINE
</td><td>
`53`
</td><td>
3D 外壳边框层
</td></tr>
<tr><td>
SHELL\_3D\_TOP
</td><td>
`54`
</td><td>
3D 外壳顶层
</td></tr>
<tr><td>
SUBSTRATE\_1
</td><td>
`101`
</td><td>
夹层(介电基板)1
</td></tr>
<tr><td>
TOP
</td><td>
`1`
</td><td>
顶层
</td></tr>
<tr><td>
TOP\_ASSEMBLY
</td><td>
`9`
</td><td>
顶层装配层
</td></tr>
<tr><td>
TOP\_PASTE\_MASK
</td><td>
`7`
</td><td>
顶层锡膏(助焊)层
</td></tr>
<tr><td>
TOP\_SILKSCREEN
</td><td>
`3`
</td><td>
顶层丝印层
</td></tr>
<tr><td>
TOP\_SOLDER\_MASK
</td><td>
`5`
</td><td>
顶层阻焊层
</td></tr>
<tr><td>
TOP\_STIFFENER
</td><td>
`58`
</td><td>
顶层 FPC 补强层
</td></tr>
</tbody></table>
references/enums/EPCB_NetEventType.md
# EPCB\_NetEventType enum
Net event type
## Signature
```typescript
enum EPCB_NetEventType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
ADD
</td><td>
`'add'`
</td><td>
新增
</td></tr>
<tr><td>
REMOVE
</td><td>
`'remove'`
</td><td>
移除
</td></tr>
<tr><td>
SELECTED
</td><td>
`'selected'`
</td><td>
选中(仅当选中整个网络时触发)
</td></tr>
</tbody></table>
references/enums/EPCB_LayerType.md
# EPCB\_LayerType enum
Layer type
## Signature
```typescript
enum EPCB_LayerType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
ASSEMBLY
</td><td>
`'ASSEMBLY'`
</td><td>
装配层
</td></tr>
<tr><td>
CUSTOM
</td><td>
`'CUSTOM'`
</td><td>
自定义层
</td></tr>
<tr><td>
INTERNAL\_ELECTRICAL
</td><td>
`'PLANE'`
</td><td>
内电层
</td></tr>
<tr><td>
OTHER
</td><td>
`'OTHER'`
</td><td>
其它
</td></tr>
<tr><td>
PASTE\_MASK
</td><td>
`'PASTE_MASK'`
</td><td>
锡膏(助焊)层
</td></tr>
<tr><td>
SIGNAL
</td><td>
`'SIGNAL'`
</td><td>
信号层
</td></tr>
<tr><td>
SILKSCREEN
</td><td>
`'SILKSCREEN'`
</td><td>
丝印层
</td></tr>
<tr><td>
SOLDER\_MASK
</td><td>
`'SOLDER_MASK'`
</td><td>
阻焊层
</td></tr>
</tbody></table>
references/enums/EPCB_MouseEventType.md
# EPCB\_MouseEventType enum
Mouse event type
## Signature
```typescript
enum EPCB_MouseEventType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
CLEAR\_SELECTED
</td><td>
`'clearSelected'`
</td><td>
取消选中
</td></tr>
<tr><td>
MOVE
</td><td>
`'move'`
</td><td>
移动
</td></tr>
<tr><td>
SELECTED
</td><td>
`'selected'`
</td><td>
选中
</td></tr>
</tbody></table>
references/enums/EPCB_PcbPlateType.md
# EPCB\_PcbPlateType enum
PCB plate type
## Signature
```typescript
enum EPCB_PcbPlateType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
FPC
</td><td>
`2`
</td><td>
FPC 软板
</td></tr>
<tr><td>
NORMAL
</td><td>
`1`
</td><td>
普通板材
</td></tr>
</tbody></table>
references/enums/EPCB_PdfOutputMethod.md
# EPCB\_PdfOutputMethod enum
PDF output method
## Signature
```typescript
enum EPCB_PdfOutputMethod
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
MULTI\_PAGE\_PDF
</td><td>
`'paged'`
</td><td>
单个多页 PDF
</td></tr>
<tr><td>
MULTIPLE\_SINGLE\_PAGE\_PDF
</td><td>
`'separated'`
</td><td>
多个单页 PDF(将会输出包含所有分解图层 PDF 文件的压缩包)
</td></tr>
<tr><td>
SINGLE\_PAGE\_PDF
</td><td>
`'merged'`
</td><td>
单个单页 PDF(将会输出包含每层一个 PDF 文件的压缩包)
</td></tr>
</tbody></table>
references/enums/EPCB_PrimitiveArcInteractiveMode.md
# EPCB\_PrimitiveArcInteractiveMode enum
Arc interaction mode
## Signature
```typescript
enum EPCB_PrimitiveArcInteractiveMode
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
CENTER\_ARC
</td><td>
`2`
</td><td>
中心圆弧交互
</td></tr>
<tr><td>
TWO\_POINT\_ARC
</td><td>
`1`
</td><td>
两点圆弧交互
</td></tr>
</tbody></table>
references/enums/EPCB_PrimitiveDimensionType.md
# EPCB\_PrimitiveDimensionType enum
Dimension type
## Signature
```typescript
enum EPCB_PrimitiveDimensionType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
ANGLE
</td><td>
`'Protractor Dimension'`
</td><td>
角度
</td></tr>
<tr><td>
LENGTH
</td><td>
`'Length Dimension'`
</td><td>
长度
</td></tr>
<tr><td>
RADIUS
</td><td>
`'Radius Dimension'`
</td><td>
半径
</td></tr>
</tbody></table>
references/enums/EPCB_PrimitiveEventType.md
# EPCB\_PrimitiveEventType enum
Primitive event type
## Signature
```typescript
enum EPCB_PrimitiveEventType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
CREATE
</td><td>
`'add'`
</td><td>
创建
</td></tr>
<tr><td>
DELETE
</td><td>
`'delete'`
</td><td>
删除
</td></tr>
<tr><td>
MODIFY
</td><td>
`'modify'`
</td><td>
属性变更
</td></tr>
</tbody></table>
references/enums/EPCB_PrimitiveFillMode.md
# EPCB\_PrimitiveFillMode enum
Fill primitive fill mode
## Signature
```typescript
enum EPCB_PrimitiveFillMode
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
INNER\_ELECTRICAL\_LAYER
</td><td>
`2`
</td><td>
内电层填充
</td></tr>
<tr><td>
MESH
</td><td>
`1`
</td><td>
网格填充
</td></tr>
<tr><td>
SOLID
</td><td>
`0`
</td><td>
实心填充
</td></tr>
</tbody></table>
## Remarks
Grid fill and inner layer fill are reserved configurations
references/enums/EPCB_PrimitivePadShapeType.md
# EPCB\_PrimitivePadShapeType enum
Pad shape type
## Signature
```typescript
enum EPCB_PrimitivePadShapeType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
ELLIPSE
</td><td>
`'ELLIPSE'`
</td><td>
圆形
</td></tr>
<tr><td>
OBLONG
</td><td>
`'OVAL'`
</td><td>
长圆形
</td></tr>
<tr><td>
POLYLINE\_COMPLEX\_POLYGON
</td><td>
`'POLYGON'`
</td><td>
折线复杂多边形
</td></tr>
<tr><td>
RECTANGLE
</td><td>
`'RECT'`
</td><td>
矩形
</td></tr>
<tr><td>
REGULAR\_POLYGON
</td><td>
`'NGON'`
</td><td>
正多边形
</td></tr>
</tbody></table>
references/enums/EPCB_PrimitivePadType.md
# EPCB\_PrimitivePadType enum
Pad type
## Signature
```typescript
enum EPCB_PrimitivePadType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
MARK\_POINT
</td><td>
`2`
</td><td>
标识点
</td></tr>
<tr><td>
NORMAL
</td><td>
`0`
</td><td>
焊盘
</td></tr>
<tr><td>
TEST
</td><td>
`1`
</td><td>
测试点
</td></tr>
</tbody></table>
references/enums/EPCB_PrimitivePadHoleType.md
# EPCB\_PrimitivePadHoleType enum
Pad drilling type
## Signature
```typescript
enum EPCB_PrimitivePadHoleType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
RECTANGLE
</td><td>
`'RECT'`
</td><td>
矩形(暂未开发)
</td></tr>
<tr><td>
ROUND
</td><td>
`'ROUND'`
</td><td>
圆形
</td></tr>
<tr><td>
SLOT
</td><td>
`'SLOT'`
</td><td>
插槽
</td></tr>
</tbody></table>
references/enums/EPCB_PrimitivePadHeatWeldingConnectionMethod.md
# EPCB\_PrimitivePadHeatWeldingConnectionMethod enum
Pad heat welding connection method
## Signature
```typescript
enum EPCB_PrimitivePadHeatWeldingConnectionMethod
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
DIRECT\_CONNECTED
</td><td>
`'Direct-connected'`
</td><td>
直连
</td></tr>
<tr><td>
DIVERGENT
</td><td>
`'Divergent'`
</td><td>
发散
</td></tr>
<tr><td>
NON\_CONNECTED
</td><td>
`'Non-connected'`
</td><td>
无连接
</td></tr>
</tbody></table>
references/enums/EPCB_PrimitivePourFillMethod.md
# EPCB\_PrimitivePourFillMethod enum
Copper fill method
## Signature
```typescript
enum EPCB_PrimitivePourFillMethod
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
GRID
</td><td>
`'90grid'`
</td><td>
90 度网格
</td></tr>
<tr><td>
GRID45
</td><td>
`'45grid'`
</td><td>
45 度网格
</td></tr>
<tr><td>
SOLID
</td><td>
`'solid'`
</td><td>
实心填充
</td></tr>
</tbody></table>
references/enums/EPCB_PrimitiveRegionRuleType.md
# EPCB\_PrimitiveRegionRuleType enum
Region primitive region rule type
## Signature
```typescript
enum EPCB_PrimitiveRegionRuleType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
FOLLOW\_REGION\_RULE
</td><td>
`9`
</td><td>
约束区域
</td></tr>
<tr><td>
NO\_COMPONENTS
</td><td>
`2`
</td><td>
禁止元件
</td></tr>
<tr><td>
NO\_FILLS
</td><td>
`6`
</td><td>
禁止填充
</td></tr>
<tr><td>
NO\_INNER\_ELECTRICAL\_LAYERS
</td><td>
`8`
</td><td>
禁止内电层
</td></tr>
<tr><td>
NO\_POURS
</td><td>
`7`
</td><td>
禁止覆铜
</td></tr>
<tr><td>
NO\_WIRES
</td><td>
`5`
</td><td>
禁止布线
</td></tr>
</tbody></table>
## Remarks
[FOLLOW\_REGION\_RULE](./EPCB_PrimitiveRegionRuleType.md) is the constrained region
references/enums/EPCB_PrimitiveStringAlignMode.md
# EPCB\_PrimitiveStringAlignMode enum
Text alignment mode
## Signature
```typescript
enum EPCB_PrimitiveStringAlignMode
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
CENTER
</td><td>
`5`
</td><td>
中心
</td></tr>
<tr><td>
CENTER\_BOTTOM
</td><td>
`6`
</td><td>
中下
</td></tr>
<tr><td>
CENTER\_TOP
</td><td>
`4`
</td><td>
中上
</td></tr>
<tr><td>
LEFT\_BOTTOM
</td><td>
`3`
</td><td>
左下
</td></tr>
<tr><td>
LEFT\_MIDDLE
</td><td>
`2`
</td><td>
左中
</td></tr>
<tr><td>
LEFT\_TOP
</td><td>
`1`
</td><td>
左上
</td></tr>
<tr><td>
RIGHT\_BOTTOM
</td><td>
`9`
</td><td>
右下
</td></tr>
<tr><td>
RIGHT\_MIDDLE
</td><td>
`8`
</td><td>
右中
</td></tr>
<tr><td>
RIGHT\_TOP
</td><td>
`7`
</td><td>
右上
</td></tr>
</tbody></table>
references/enums/EPCB_PrimitiveType.md
# EPCB\_PrimitiveType enum
Primitive type
## Signature
```typescript
enum EPCB_PrimitiveType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
ARC
</td><td>
`'Arc'`
</td><td>
圆弧线
</td></tr>
<tr><td>
ATTRIBUTE
</td><td>
`'Attribute'`
</td><td>
属性
</td></tr>
<tr><td>
COMPONENT
</td><td>
`'Component'`
</td><td>
器件
</td></tr>
<tr><td>
COMPONENT\_PAD
</td><td>
`'ComponentPad'`
</td><td>
器件焊盘
</td></tr>
<tr><td>
DIMENSION
</td><td>
`'Dimension'`
</td><td>
尺寸标注
</td></tr>
<tr><td>
FILL
</td><td>
`'Fill'`
</td><td>
填充
</td></tr>
<tr><td>
IMAGE
</td><td>
`'Image'`
</td><td>
图像
</td></tr>
<tr><td>
LINE
</td><td>
`'Line'`
</td><td>
直线
</td></tr>
<tr><td>
OBJECT
</td><td>
`'Object'`
</td><td>
二进制内嵌对象
</td></tr>
<tr><td>
PAD
</td><td>
`'Pad'`
</td><td>
焊盘
</td></tr>
<tr><td>
POLYLINE
</td><td>
`'Polyline'`
</td><td>
折线
</td></tr>
<tr><td>
POUR
</td><td>
`'Pour'`
</td><td>
覆铜边框
</td></tr>
<tr><td>
POURED
</td><td>
`'Poured'`
</td><td>
覆铜填充
</td></tr>
<tr><td>
REGION
</td><td>
`'Region'`
</td><td>
区域
</td></tr>
<tr><td>
STRING
</td><td>
`'String'`
</td><td>
文本
</td></tr>
<tr><td>
VIA
</td><td>
`'Via'`
</td><td>
过孔
</td></tr>
</tbody></table>
references/enums/ESCH_DynamicSimulationEnginePullEventType.md
# ESCH\_DynamicSimulationEnginePullEventType enum
Dynamic simulation engine pull event type
## Signature
```typescript
enum ESCH_DynamicSimulationEnginePullEventType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
COMPONENT\_UPDATE
</td><td>
`'COMPONENT_UPDATE'`
</td><td>
更新元件属性
</td></tr>
<tr><td>
SESSION\_PAUSE
</td><td>
`'SESSION_PAUSE'`
</td><td>
暂停
</td></tr>
<tr><td>
SESSION\_RESUME
</td><td>
`'SESSION_RESUME'`
</td><td>
恢复
</td></tr>
<tr><td>
SESSION\_START
</td><td>
`'SESSION_START'`
</td><td>
开始动态仿真会话
</td></tr>
<tr><td>
SESSION\_STATE\_QUERY
</td><td>
`'SESSION_STATE_QUERY'`
</td><td>
查询动态仿真状态
</td></tr>
<tr><td>
SESSION\_STOP
</td><td>
`'SESSION_STOP'`
</td><td>
停止并释放资源
</td></tr>
<tr><td>
SPEED\_SET
</td><td>
`'SPEED_SET'`
</td><td>
设置速度
</td></tr>
</tbody></table>
references/enums/EPCB_PrimitiveViaType.md
# EPCB\_PrimitiveViaType enum
Via type
## Signature
```typescript
enum EPCB_PrimitiveViaType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
BLIND
</td><td>
`1`
</td><td>
盲埋孔
</td></tr>
<tr><td>
SUTURE
</td><td>
`2`
</td><td>
缝合孔
</td></tr>
<tr><td>
VIA
</td><td>
`0`
</td><td>
通孔
</td></tr>
</tbody></table>
references/enums/ESCH_MouseEventType.md
# ESCH\_MouseEventType enum
Mouse event type
## Signature
```typescript
enum ESCH_MouseEventType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
CLEAR\_SELECTED
</td><td>
`'clearSelected'`
</td><td>
取消选中
</td></tr>
<tr><td>
SELECTED
</td><td>
`'selected'`
</td><td>
选中
</td></tr>
</tbody></table>
references/enums/ESCH_PrimitiveEventType.md
# ESCH\_PrimitiveEventType enum
Primitive event type
## Signature
```typescript
enum ESCH_PrimitiveEventType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
CHANGE
</td><td>
`'change'`
</td><td>
属性变更(除位置外的属性变更)
</td></tr>
<tr><td>
CREATE
</td><td>
`'create'`
</td><td>
创建
</td></tr>
<tr><td>
DELETE
</td><td>
`'delete'`
</td><td>
删除
</td></tr>
<tr><td>
MOVE
</td><td>
`'move'`
</td><td>
移动
</td></tr>
</tbody></table>
references/enums/ESCH_DynamicSimulationEnginePushEventType.md
# ESCH\_DynamicSimulationEnginePushEventType enum
Dynamic simulation engine push event type
## Signature
```typescript
enum ESCH_DynamicSimulationEnginePushEventType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
ENGINE\_ERROR
</td><td>
`'ENGINE_ERROR'`
</td><td>
错误
</td></tr>
<tr><td>
ENGINE\_LOG
</td><td>
`'ENGINE_LOG'`
</td><td>
实时日志
</td></tr>
<tr><td>
SESSION\_STATE
</td><td>
`'SESSION_STATE'`
</td><td>
状态变化(RUNNING/PAUSED/STOPPED...)
</td></tr>
<tr><td>
STREAM\_DATA
</td><td>
`'STREAM_DATA'`
</td><td>
实时数据帧(波形点/节点电压/内部量)
</td></tr>
<tr><td>
STREAM\_SNAPSHOT
</td><td>
`'STREAM_SNAPSHOT'`
</td><td>
一次快照(可选,用于 UI 刷新)
</td></tr>
</tbody></table>
references/enums/ESCH_ExportDocumentFileType.md
# ESCH\_ExportDocumentFileType enum
Export document file type
## Signature
```typescript
enum ESCH_ExportDocumentFileType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
PDF
</td><td>
`'PDF'`
</td><td>
PDF 文档
</td></tr>
<tr><td>
PNG
</td><td>
`'PNG'`
</td><td>
PNG 位图
</td></tr>
<tr><td>
SVG
</td><td>
`'SVG'`
</td><td>
SVG 矢量图
</td></tr>
</tbody></table>
references/enums/ESCH_PrimitiveComponentType.md
# ESCH\_PrimitiveComponentType enum
Device type
## Signature
```typescript
enum ESCH_PrimitiveComponentType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
CBB\_SYMBOL
</td><td>
`'block_symbol'`
</td><td>
复用模块符号
</td></tr>
<tr><td>
COMPONENT
</td><td>
`'part'`
</td><td>
元件符号
</td></tr>
<tr><td>
DIFFERENTIAL\_PAIRS\_FLAG
</td><td>
`'diffPairsFlag'`
</td><td>
差分对标识
</td></tr>
<tr><td>
DRAWING
</td><td>
`'sheet'`
</td><td>
图纸
</td></tr>
<tr><td>
NET\_FLAG
</td><td>
`'netflag'`
</td><td>
网络标识
</td></tr>
<tr><td>
NET\_PORT
</td><td>
`'netport'`
</td><td>
网络端口
</td></tr>
<tr><td>
NON\_ELECTRICAL\_FLAG
</td><td>
`'nonElectrical_symbol'`
</td><td>
无电气标识
</td></tr>
<tr><td>
OFF\_PAGE\_CONNECTOR
</td><td>
`'offPageConnector'`
</td><td>
跨页连接标识
</td></tr>
<tr><td>
SHORT\_CIRCUIT\_FLAG
</td><td>
`'short_symbol'`
</td><td>
短接标识
</td></tr>
</tbody></table>
references/enums/ESCH_PrimitiveFillStyle.md
# ESCH\_PrimitiveFillStyle enum
Fill style
## Signature
```typescript
enum ESCH_PrimitiveFillStyle
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
GRID
</td><td>
`'Grid'`
</td><td>
网格
</td></tr>
<tr><td>
HORIZONTAL\_LINE
</td><td>
`'Horizontal Line'`
</td><td>
横线
</td></tr>
<tr><td>
LEFT\_SLASH\_LINE
</td><td>
`'Left Slash Line'`
</td><td>
左斜线
</td></tr>
<tr><td>
NONE
</td><td>
`'None'`
</td><td>
无
</td></tr>
<tr><td>
RHOMBIC\_GRID
</td><td>
`'Rhombic Grid'`
</td><td>
菱形网格
</td></tr>
<tr><td>
RIGHT\_SLASH\_LINE
</td><td>
`'Right Slash Line'`
</td><td>
右斜线
</td></tr>
<tr><td>
SOLID
</td><td>
`'Solid'`
</td><td>
实心
</td></tr>
<tr><td>
VERTICAL\_LINE
</td><td>
`'Vertical Line'`
</td><td>
竖线
</td></tr>
</tbody></table>
references/enums/ESCH_PrimitivePinShape.md
# ESCH\_PrimitivePinShape enum
Pin shape
## Signature
```typescript
enum ESCH_PrimitivePinShape
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
CLOCK
</td><td>
`'Clock'`
</td><td>
时钟
</td></tr>
<tr><td>
INVERTED
</td><td>
`'Inverted'`
</td><td>
反向
</td></tr>
<tr><td>
INVERTED\_CLOCK
</td><td>
`'Inverted Clock'`
</td><td>
反向时钟
</td></tr>
<tr><td>
NONE
</td><td>
`'None'`
</td><td>
无
</td></tr>
</tbody></table>
references/enums/ESCH_PrimitiveTextAlignMode.md
# ESCH\_PrimitiveTextAlignMode enum
Text alignment mode
## Signature
```typescript
enum ESCH_PrimitiveTextAlignMode
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
CENTER
</td><td>
`5`
</td><td>
中心
</td></tr>
<tr><td>
CENTER\_BOTTOM
</td><td>
`6`
</td><td>
中下
</td></tr>
<tr><td>
CENTER\_TOP
</td><td>
`4`
</td><td>
中上
</td></tr>
<tr><td>
LEFT\_BOTTOM
</td><td>
`3`
</td><td>
左下
</td></tr>
<tr><td>
LEFT\_MIDDLE
</td><td>
`2`
</td><td>
左中
</td></tr>
<tr><td>
LEFT\_TOP
</td><td>
`1`
</td><td>
左上
</td></tr>
<tr><td>
RIGHT\_BOTTOM
</td><td>
`9`
</td><td>
右下
</td></tr>
<tr><td>
RIGHT\_MIDDLE
</td><td>
`8`
</td><td>
右中
</td></tr>
<tr><td>
RIGHT\_TOP
</td><td>
`7`
</td><td>
右上
</td></tr>
</tbody></table>
references/enums/ESCH_PrimitiveLineType.md
# ESCH\_PrimitiveLineType enum
Line type
## Signature
```typescript
enum ESCH_PrimitiveLineType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
DASHED
</td><td>
`1`
</td><td>
短划线
</td></tr>
<tr><td>
DOT\_DASHED
</td><td>
`3`
</td><td>
点划线
</td></tr>
<tr><td>
DOTTED
</td><td>
`2`
</td><td>
点线
</td></tr>
<tr><td>
SOLID
</td><td>
`0`
</td><td>
实线
</td></tr>
</tbody></table>
references/enums/ESCH_PrimitivePinType.md
# ESCH\_PrimitivePinType enum
Pin type
## Signature
```typescript
enum ESCH_PrimitivePinType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
BI
</td><td>
`'BI'`
</td><td>
双向
</td></tr>
<tr><td>
GROUND
</td><td>
`'Ground'`
</td><td>
地
</td></tr>
<tr><td>
HIZ
</td><td>
`'HIZ'`
</td><td>
高阻
</td></tr>
<tr><td>
IN
</td><td>
`'IN'`
</td><td>
输入
</td></tr>
<tr><td>
OPEN\_COLLECTOR
</td><td>
`'Open Collector'`
</td><td>
开集电极
</td></tr>
<tr><td>
OPEN\_EMITTER
</td><td>
`'Open Emitter'`
</td><td>
开发射极
</td></tr>
<tr><td>
OUT
</td><td>
`'OUT'`
</td><td>
输出
</td></tr>
<tr><td>
PASSIVE
</td><td>
`'Passive'`
</td><td>
无源
</td></tr>
<tr><td>
POWER
</td><td>
`'Power'`
</td><td>
电源
</td></tr>
<tr><td>
TERMINATOR
</td><td>
`'Terminator'`
</td><td>
信号终端
</td></tr>
<tr><td>
UNDEFINED
</td><td>
`'Undefined'`
</td><td>
未定义
</td></tr>
</tbody></table>
references/enums/ESCH_SimulationNetlistType.md
# ESCH\_SimulationNetlistType enum
Simulation netlist type
## Signature
```typescript
enum ESCH_SimulationNetlistType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
NGSPICE
</td><td>
`'Ngspice'`
</td><td>
Ngspice
</td></tr>
</tbody></table>
references/enums/ESCH_PrimitiveType.md
# ESCH\_PrimitiveType enum
Primitive type
## Signature
```typescript
enum ESCH_PrimitiveType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
ARC
</td><td>
`'Arc'`
</td><td>
圆弧
</td></tr>
<tr><td>
ATTRIBUTE
</td><td>
`'Attribute'`
</td><td>
属性
</td></tr>
<tr><td>
BEZIER
</td><td>
`'Bezier'`
</td><td>
三阶贝塞尔线条
</td></tr>
<tr><td>
BUS
</td><td>
`'Bus'`
</td><td>
总线
</td></tr>
<tr><td>
CIRCLE
</td><td>
`'Circle'`
</td><td>
圆
</td></tr>
<tr><td>
COMPONENT
</td><td>
`'Component'`
</td><td>
器件
</td></tr>
<tr><td>
COMPONENT\_PIN
</td><td>
`'ComponentPin'`
</td><td>
器件引脚
</td></tr>
<tr><td>
ELLIPSE
</td><td>
`'Ellipse'`
</td><td>
椭圆
</td></tr>
<tr><td>
OBJECT
</td><td>
`'Object'`
</td><td>
二进制内嵌对象
</td></tr>
<tr><td>
PIN
</td><td>
`'Pin'`
</td><td>
引脚
</td></tr>
<tr><td>
POLYGON
</td><td>
`'Polygon'`
</td><td>
多边形
</td></tr>
<tr><td>
RECTANGLE
</td><td>
`'Rectangle'`
</td><td>
矩形
</td></tr>
<tr><td>
TEXT
</td><td>
`'Text'`
</td><td>
文本
</td></tr>
<tr><td>
WIRE
</td><td>
`'Wire'`
</td><td>
导线
</td></tr>
</tbody></table>
references/enums/ESCH_SpiceSimulationEnginePullEventType.md
# ESCH\_SpiceSimulationEnginePullEventType enum
Spice simulation engine pull event type
## Signature
```typescript
enum ESCH_SpiceSimulationEnginePullEventType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
SIMULATE\_NETLIST
</td><td>
`'SIMULATE_NETLIST'`
</td><td>
仿真网表
</td></tr>
<tr><td>
VALIDATE\_NETLIST
</td><td>
`'VALIDATE_NETLIST'`
</td><td>
验证网表
</td></tr>
</tbody></table>
references/enums/ESYS_BottomPanelTab.md
# ESYS\_BottomPanelTab enum
> Warning: This API is now obsolete.
>
> 请使用 `ESYS_PanelTab` 替代 since EDA v4.2
Bottom panel tab
## Signature
```typescript
enum ESYS_BottomPanelTab
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
FIND
</td><td>
`'findResult'`
</td><td>
查找结果
</td></tr>
<tr><td>
LIBRARY
</td><td>
`'library'`
</td><td>
库
</td></tr>
<tr><td>
LOG
</td><td>
`'log'`
</td><td>
日志
</td></tr>
<tr><td>
PCB\_DRC
</td><td>
`'drcResult'`
</td><td>
PCB:DRC
</td></tr>
<tr><td>
SCHEMATIC\_DRC
</td><td>
`'schDrcResult'`
</td><td>
原理图:DRC
</td></tr>
</tbody></table>
references/enums/ESCH_SpiceSimulationEnginePushEventType.md
# ESCH\_SpiceSimulationEnginePushEventType enum
Spice simulation engine push event type
## Signature
```typescript
enum ESCH_SpiceSimulationEnginePushEventType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
ERROR\_RESULT
</td><td>
`'ERROR_RESULT'`
</td><td>
错误
</td></tr>
<tr><td>
LOG\_RESULT
</td><td>
`'LOG_RESULT'`
</td><td>
日志
</td></tr>
<tr><td>
SIMULATION\_RESULT
</td><td>
`'SIMULATION_RESULT'`
</td><td>
仿真结果
</td></tr>
<tr><td>
VALIDATION\_RESULT
</td><td>
`'VALIDATION_RESULT'`
</td><td>
验证结果
</td></tr>
</tbody></table>
references/enums/ESYS_ImportProjectImportOption.md
# ESYS\_ImportProjectImportOption enum
Import project import option
## Signature
```typescript
enum ESYS_ImportProjectImportOption
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
EXTRACT\_LIBRARIES
</td><td>
`'ExtractLibraries'`
</td><td>
提取库文件
</td></tr>
<tr><td>
IMPORT\_DOCUMENT
</td><td>
`'ImportDocument'`
</td><td>
导入文档
</td></tr>
<tr><td>
IMPORT\_DOCUMENT\_EXTRACT\_LIBRARIES
</td><td>
`'ImportDocumentExtractLibraries'`
</td><td>
导入文档并提取库
</td></tr>
</tbody></table>
references/enums/ESYS_HeaderMenuEnvironment.md
# ESYS\_HeaderMenuEnvironment enum
Header menu environment
## Signature
```typescript
enum ESYS_HeaderMenuEnvironment
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
BLANK
</td><td>
`'blank'`
</td><td>
空白页
</td></tr>
<tr><td>
FOOTPRINT
</td><td>
`'footprint'`
</td><td>
封装
</td></tr>
<tr><td>
HOME
</td><td>
`'home'`
</td><td>
主页
</td></tr>
<tr><td>
PANEL
</td><td>
`'panel'`
</td><td>
面板
</td></tr>
<tr><td>
PANEL\_LIBRARY
</td><td>
`'panelLibrary'`
</td><td>
面板库
</td></tr>
<tr><td>
PANEL\_VIEW
</td><td>
`'panelView'`
</td><td>
面板预览
</td></tr>
<tr><td>
PCB
</td><td>
`'pcb'`
</td><td>
PCB
</td></tr>
<tr><td>
PCB\_VIEW
</td><td>
`'pcbView'`
</td><td>
PCB 预览(包括 2D、3D 预览)
</td></tr>
<tr><td>
SCHEMATIC
</td><td>
`'sch'`
</td><td>
原理图
</td></tr>
<tr><td>
SIMULATION\_SCHEMATIC\_NGSPICE
</td><td>
`'simulationSchematicNgspice'`
</td><td>
仿真原理图:Ngspice
</td></tr>
<tr><td>
SIMULATION\_SCHEMATIC\_SIMULIDE
</td><td>
`'simulationSchematicSimulIDE'`
</td><td>
仿真原理图:SimulIDE
</td></tr>
<tr><td>
SYMBOL
</td><td>
`'symbol'`
</td><td>
符号(包括 CBB 符号)
</td></tr>
</tbody></table>
references/enums/ESYS_ImportProjectSchematicObjectStyle.md
# ESYS\_ImportProjectSchematicObjectStyle enum
Import project schematic primitive style
## Signature
```typescript
enum ESYS_ImportProjectSchematicObjectStyle
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
USE\_SOURCE\_FILE\_STYLE
</td><td>
`'custom'`
</td><td>
使用源文件样式
</td></tr>
<tr><td>
USE\_SYSTEM\_THEME
</td><td>
`'system'`
</td><td>
使用系统主题
</td></tr>
</tbody></table>
references/enums/ESYS_ImportProjectBoardOutlineSource.md
# ESYS\_ImportProjectBoardOutlineSource enum
Import project board outline source
## Signature
```typescript
enum ESYS_ImportProjectBoardOutlineSource
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
FROM\_KEEPOUT\_LAYER
</td><td>
`'keepout'`
</td><td>
从 Keepout 层
</td></tr>
<tr><td>
FROM\_MECHANICAL\_LAYER\_1
</td><td>
`'mechanical'`
</td><td>
从机械层 1
</td></tr>
</tbody></table>
## Remarks
This property can only be specified when `fileType` is `Altium Designer` or `Protel`<!-- -->; otherwise it will be ignored
references/enums/ESYS_LeftPanelTab.md
# ESYS\_LeftPanelTab enum
> Warning: This API is now obsolete.
>
> 请使用 `ESYS_PanelTab` 替代 since EDA v4.2
Left panel tab
## Signature
```typescript
enum ESYS_LeftPanelTab
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
BASIC\_LIBRARY
</td><td>
`'basicLibrary'`
</td><td>
常用库
</td></tr>
<tr><td>
DEVICE\_STANDARDIZATION
</td><td>
`'device-standardization'`
</td><td>
器件标准化
</td></tr>
<tr><td>
LIB\_DESIGN
</td><td>
`'libDesign'`
</td><td>
库设计
</td></tr>
<tr><td>
PROJECT\_DESIGN
</td><td>
`'projectDesign'`
</td><td>
工程设计
</td></tr>
<tr><td>
PROJECT\_LIST
</td><td>
`'project_list'`
</td><td>
工程
</td></tr>
</tbody></table>
references/enums/ESYS_LogType.md
# ESYS\_LogType enum
Log type
## Signature
```typescript
enum ESYS_LogType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
ERROR
</td><td>
`'error'`
</td><td>
错误
</td></tr>
<tr><td>
FATAL\_ERROR
</td><td>
`'fatalError'`
</td><td>
致命错误
</td></tr>
<tr><td>
INFO
</td><td>
`'info'`
</td><td>
信息
</td></tr>
<tr><td>
WARNING
</td><td>
`'warn'`
</td><td>
警告
</td></tr>
</tbody></table>
references/enums/ESYS_ImportProjectViaSolderMaskExpansion.md
# ESYS\_ImportProjectViaSolderMaskExpansion enum
Import project via solder mask extension
## Signature
```typescript
enum ESYS_ImportProjectViaSolderMaskExpansion
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
ALL\_COVER\_OIL
</td><td>
`'cover'`
</td><td>
全部盖油
</td></tr>
<tr><td>
FOLLOW\_ORIGINAL\_SETTING
</td><td>
`'custom'`
</td><td>
跟随源设置
</td></tr>
</tbody></table>
## Remarks
This property can only be specified when `fileType` is `Altium Designer` or `Protel`<!-- -->; otherwise it will be ignored
references/enums/ESYS_PanelTab.md
# ESYS\_PanelTab enum
面板标签页(不区分标签页所处面板)
## Signature
```typescript
enum ESYS_PanelTab
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
ANNOTATION
</td><td>
`'annotation'`
</td><td>
批注
</td></tr>
<tr><td>
BASIC\_LIBRARY
</td><td>
`'basicLibrary'`
</td><td>
常用库
</td></tr>
<tr><td>
DEVICE\_STANDARDIZATION
</td><td>
`'device-standardization'`
</td><td>
器件标准化
</td></tr>
<tr><td>
FIND
</td><td>
`'findResult'`
</td><td>
查找结果
</td></tr>
<tr><td>
LIB\_DESIGN
</td><td>
`'libDesign'`
</td><td>
库设计
</td></tr>
<tr><td>
LIBRARY
</td><td>
`'library'`
</td><td>
库
</td></tr>
<tr><td>
LOG
</td><td>
`'log'`
</td><td>
日志
</td></tr>
<tr><td>
PANEL\_3D\_PREVIEW\_ATTR
</td><td>
`'panel3d-attr'`
</td><td>
面板 3D 预览:属性
</td></tr>
<tr><td>
PANEL\_3D\_PREVIEW\_LAYER
</td><td>
`'panel3d-layer'`
</td><td>
面板 3D 预览:图层
</td></tr>
<tr><td>
PANEL\_ATTR
</td><td>
`'panel-attr'`
</td><td>
面板:属性
</td></tr>
<tr><td>
PANEL\_FILTER
</td><td>
`'panel-filter'`
</td><td>
面板:过滤
</td></tr>
<tr><td>
PANEL\_LAYER
</td><td>
`'panel-layer'`
</td><td>
面板:图层
</td></tr>
<tr><td>
PCB\_2D\_PREVIEW\_ATTR
</td><td>
`'pcb2d-attr'`
</td><td>
PCB 2D 预览:属性
</td></tr>
<tr><td>
PCB\_3D\_PREVIEW\_ATTR
</td><td>
`'pcb3d-attr'`
</td><td>
PCB 3D 预览:属性
</td></tr>
<tr><td>
PCB\_3D\_PREVIEW\_LAYER
</td><td>
`'pcb3d-layer'`
</td><td>
PCB 3D 预览:图层
</td></tr>
<tr><td>
PCB\_ATTR
</td><td>
`'pcb-attr'`
</td><td>
PCB:属性
</td></tr>
<tr><td>
PCB\_DRC
</td><td>
`'drcResult'`
</td><td>
PCB:DRC
</td></tr>
<tr><td>
PCB\_FILTER
</td><td>
`'pcb-filter'`
</td><td>
PCB:过滤
</td></tr>
<tr><td>
PCB\_LAYER
</td><td>
`'pcb-layer'`
</td><td>
PCB:图层
</td></tr>
<tr><td>
PCB\_SKETCHER\_ATTR
</td><td>
`'pcb-sketcher-attr'`
</td><td>
PCB:测量对象属性
</td></tr>
<tr><td>
PROJECT\_ATTR
</td><td>
`'project-attr'`
</td><td>
工程:属性
</td></tr>
<tr><td>
PROJECT\_DESIGN
</td><td>
`'projectDesign'`
</td><td>
工程设计
</td></tr>
<tr><td>
PROJECT\_LIST
</td><td>
`'project_list'`
</td><td>
工程
</td></tr>
<tr><td>
SCH\_ATTR
</td><td>
`'sch-attr'`
</td><td>
原理图:属性
</td></tr>
<tr><td>
SCH\_FILTER
</td><td>
`'sch-filter'`
</td><td>
原理图:过滤
</td></tr>
<tr><td>
SCHEMATIC\_DRC
</td><td>
`'schDrcResult'`
</td><td>
原理图:DRC
</td></tr>
</tbody></table>
## Remarks
面板标签页可互相拖动,本枚举不区分标签页所处面板(左侧 / 右侧 / 底部) ADD since EDA v4.2
references/enums/ESYS_PanelPosition.md
# ESYS\_PanelPosition enum
面板标签页位置
## Signature
```typescript
enum ESYS_PanelPosition
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
BOTTOM
</td><td>
`'bottom'`
</td><td>
底部面板
</td></tr>
<tr><td>
LEFT
</td><td>
`'left'`
</td><td>
左侧面板
</td></tr>
<tr><td>
RIGHT
</td><td>
`'right'`
</td><td>
右侧面板
</td></tr>
</tbody></table>
## Remarks
ADD since EDA v4.2
references/enums/ESYS_ShortcutKeyEffectiveEditorRange.md
# ESYS\_ShortcutKeyEffectiveEditorRange enum
快捷键生效页面范围
## Signature
```typescript
enum ESYS_ShortcutKeyEffectiveEditorRange
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
ASSEMBLY\_VARIANT
</td><td>
`11`
</td><td>
装配变量
</td></tr>
<tr><td>
BLANK
</td><td>
`0`
</td><td>
空白页
</td></tr>
<tr><td>
FOOTPRINT
</td><td>
`5`
</td><td>
封装
</td></tr>
<tr><td>
HOME
</td><td>
`1`
</td><td>
开始页
</td></tr>
<tr><td>
PANEL
</td><td>
`6`
</td><td>
面板
</td></tr>
<tr><td>
PANEL\_3D\_PREVIEW
</td><td>
`9`
</td><td>
面板 3D 预览
</td></tr>
<tr><td>
PANEL\_LIBRARY
</td><td>
`10`
</td><td>
面板库
</td></tr>
<tr><td>
PCB
</td><td>
`4`
</td><td>
PCB
</td></tr>
<tr><td>
PCB\_2D\_PREVIEW
</td><td>
`8`
</td><td>
PCB 2D 预览
</td></tr>
<tr><td>
PCB\_3D\_PREVIEW
</td><td>
`7`
</td><td>
PCB 3D 预览
</td></tr>
<tr><td>
SCHEMATIC\_PAGE
</td><td>
`2`
</td><td>
原理图图页
</td></tr>
<tr><td>
SIMULATION\_SCHEMATIC\_PAGE\_NGSPICE
</td><td>
`12`
</td><td>
仿真原理图图页:Ngspice
</td></tr>
<tr><td>
SIMULATION\_SCHEMATIC\_PAGE\_SIMULIDE
</td><td>
`13`
</td><td>
仿真原理图图页:SimulIDE
</td></tr>
<tr><td>
SIMULATION\_WAVEFORM
</td><td>
`14`
</td><td>
仿真波形分析
</td></tr>
<tr><td>
SYMBOL
</td><td>
`3`
</td><td>
符号
</td></tr>
</tbody></table>
references/enums/ESYS_NetlistType.md
# ESYS\_NetlistType enum
Netlist type
## Signature
```typescript
enum ESYS_NetlistType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
ALLEGRO
</td><td>
`'Allegro'`
</td><td>
Allegro
</td></tr>
<tr><td>
ALTIUM\_DESIGNER
</td><td>
`'Protel2'`
</td><td>
Altium Designer
</td></tr>
<tr><td>
DISA
</td><td>
`'DISA'`
</td><td>
数字化工业软件联盟
</td></tr>
<tr><td>
DISA\_SIMULATION
</td><td>
`'DSNET'`
</td><td>
数字化工业软件联盟仿真
</td></tr>
<tr><td>
EASYEDA\_PRO
</td><td>
`'EasyEDA'`
</td><td>
EasyEDA Pro Edition
</td></tr>
<tr><td>
JLCEDA\_PRO
</td><td>
`'JLCEDA'`
</td><td>
嘉立创 EDA 专业版
</td></tr>
<tr><td>
PADS
</td><td>
`'PADS'`
</td><td>
PADS
</td></tr>
<tr><td>
PROTEL2
</td><td>
`'Protel2'`
</td><td>
Protel 2
</td></tr>
</tbody></table>
references/enums/ESYS_ShortcutKeyEffectiveEditorScene.md
# ESYS\_ShortcutKeyEffectiveEditorScene enum
Effective scene range of the shortcut key
## Signature
```typescript
enum ESYS_ShortcutKeyEffectiveEditorScene
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
CANVAS\_NOT\_SELECT
</td><td>
`3`
</td><td>
画布未选中
</td></tr>
<tr><td>
CANVAS\_SELECTED
</td><td>
`2`
</td><td>
画布选中
</td></tr>
<tr><td>
DRAWING
</td><td>
`4`
</td><td>
画布绘制
</td></tr>
<tr><td>
EDITOR
</td><td>
`1`
</td><td>
非画布
</td></tr>
<tr><td>
LOCAL
</td><td>
`6`
</td><td>
局部快捷键
</td></tr>
<tr><td>
PLACING
</td><td>
`5`
</td><td>
画布放置
</td></tr>
</tbody></table>
references/enums/ESYS_StartPageQuickStartItem.md
# ESYS\_StartPageQuickStartItem enum
Start page quick start item
## Signature
```typescript
enum ESYS_StartPageQuickStartItem
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
ABOUT
</td><td>
`'About'`
</td><td>
关于
</td></tr>
<tr><td>
IMPORT\_ALTIUM
</td><td>
`'Import Altium'`
</td><td>
导入 Altium 工程
</td></tr>
<tr><td>
IMPORT\_KICAD
</td><td>
`'Import KiCad'`
</td><td>
导入 KiCad 工程
</td></tr>
<tr><td>
IMPORT\_OTHER
</td><td>
`'Import Other'`
</td><td>
导入其他格式工程
</td></tr>
<tr><td>
IMPORT\_PROFESSIONAL
</td><td>
`'Import Professional'`
</td><td>
导入专业版工程
</td></tr>
<tr><td>
IMPORT\_STANDARD
</td><td>
`'Import Standard'`
</td><td>
导入标准版工程
</td></tr>
<tr><td>
MIGRATE\_STANDARD
</td><td>
`'Migrate Standard'`
</td><td>
迁移标准版工程
</td></tr>
<tr><td>
NEW\_3D\_MODEL
</td><td>
`'New 3D Model'`
</td><td>
新建 3D 模型
</td></tr>
<tr><td>
NEW\_COMPONENT
</td><td>
`'New Component'`
</td><td>
新建元件
</td></tr>
<tr><td>
NEW\_FOOTPRINT
</td><td>
`'New Footprint'`
</td><td>
新建封装
</td></tr>
<tr><td>
NEW\_LIBRARY
</td><td>
`'New Library'`
</td><td>
新建库
</td></tr>
<tr><td>
NEW\_PROJECT
</td><td>
`'New Project'`
</td><td>
新建工程
</td></tr>
<tr><td>
NEW\_REUSE\_BLOCK
</td><td>
`'New Reuse Block'`
</td><td>
新建复用块
</td></tr>
<tr><td>
NEW\_SYMBOL
</td><td>
`'New Symbol'`
</td><td>
新建符号
</td></tr>
<tr><td>
OPEN\_PROJECT
</td><td>
`'Open Project'`
</td><td>
打开工程
</td></tr>
<tr><td>
SETTING
</td><td>
`'Setting'`
</td><td>
设置
</td></tr>
</tbody></table>
## Remarks
Corresponds to the items in the quick start module of the start page
references/enums/ESYS_Theme.md
# ESYS\_Theme enum
Theme
## Signature
```typescript
enum ESYS_Theme
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
DARK
</td><td>
`'dark'`
</td><td>
深色
</td></tr>
<tr><td>
LIGHT
</td><td>
`'light'`
</td><td>
浅色
</td></tr>
</tbody></table>
references/enums/ESYS_RightPanelTab.md
# ESYS\_RightPanelTab enum
> Warning: This API is now obsolete.
>
> 请使用 `ESYS_PanelTab` 替代 since EDA v4.2
Right panel tab
## Signature
```typescript
enum ESYS_RightPanelTab
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
ANNOTATION
</td><td>
`'annotation'`
</td><td>
批注
</td></tr>
<tr><td>
PANEL\_3D\_PREVIEW\_ATTR
</td><td>
`'panel3d-attr'`
</td><td>
面板 3D 预览:属性
</td></tr>
<tr><td>
PANEL\_3D\_PREVIEW\_LAYER
</td><td>
`'panel3d-layer'`
</td><td>
面板 3D 预览:图层
</td></tr>
<tr><td>
PANEL\_ATTR
</td><td>
`'panel-attr'`
</td><td>
面板:属性
</td></tr>
<tr><td>
PANEL\_FILTER
</td><td>
`'panel-filter'`
</td><td>
面板:过滤
</td></tr>
<tr><td>
PANEL\_LAYER
</td><td>
`'panel-layer'`
</td><td>
面板:图层
</td></tr>
<tr><td>
PCB\_2D\_PREVIEW\_ATTR
</td><td>
`'pcb2d-attr'`
</td><td>
PCB 2D 预览:属性
</td></tr>
<tr><td>
PCB\_3D\_PREVIEW\_ATTR
</td><td>
`'pcb3d-attr'`
</td><td>
PCB 3D 预览:属性
</td></tr>
<tr><td>
PCB\_3D\_PREVIEW\_LAYER
</td><td>
`'pcb3d-layer'`
</td><td>
PCB 3D 预览:图层
</td></tr>
<tr><td>
PCB\_ATTR
</td><td>
`'pcb-attr'`
</td><td>
PCB:属性
</td></tr>
<tr><td>
PCB\_FILTER
</td><td>
`'pcb-filter'`
</td><td>
PCB:过滤
</td></tr>
<tr><td>
PCB\_LAYER
</td><td>
`'pcb-layer'`
</td><td>
PCB:图层
</td></tr>
<tr><td>
PCB\_SKETCHER\_ATTR
</td><td>
`'pcb-sketcher-attr'`
</td><td>
PCB:测量对象属性
</td></tr>
<tr><td>
PROJECT\_ATTR
</td><td>
`'project-attr'`
</td><td>
工程:属性
</td></tr>
<tr><td>
SCH\_ATTR
</td><td>
`'sch-attr'`
</td><td>
原理图:属性
</td></tr>
<tr><td>
SCH\_FILTER
</td><td>
`'sch-filter'`
</td><td>
原理图:过滤
</td></tr>
</tbody></table>
references/enums/ESYS_ToastMessageType.md
# ESYS\_ToastMessageType enum
Toast message type
## Signature
```typescript
enum ESYS_ToastMessageType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
ASK
</td><td>
`'question'`
</td><td>
问询
</td></tr>
<tr><td>
ERROR
</td><td>
`'error'`
</td><td>
错误
</td></tr>
<tr><td>
INFO
</td><td>
`'info'`
</td><td>
信息
</td></tr>
<tr><td>
SUCCESS
</td><td>
`'success'`
</td><td>
成功
</td></tr>
<tr><td>
WARNING
</td><td>
`'warn'`
</td><td>
警告
</td></tr>
</tbody></table>
references/enums/ESYS_WindowEventType.md
# ESYS\_WindowEventType enum
Window event type
## Signature
```typescript
enum ESYS_WindowEventType
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
BLUR
</td><td>
`'blur'`
</td><td>
失去焦点
</td></tr>
<tr><td>
DROP
</td><td>
`'drop'`
</td><td>
文件拖入浏览器区域
</td></tr>
<tr><td>
FOCUS
</td><td>
`'focus'`
</td><td>
获取焦点
</td></tr>
</tbody></table>
references/enums/ESYS_WindowOpenTarget.md
# ESYS\_WindowOpenTarget enum
Open window context target
## Signature
```typescript
enum ESYS_WindowOpenTarget
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
BLANK
</td><td>
`'_blank'`
</td><td>
新标签页
</td></tr>
<tr><td>
SELF
</td><td>
`'_self'`
</td><td>
当前页
</td></tr>
</tbody></table>
references/enums/NetportDeviceName.md
# NetportDeviceName enum
网络端口符号对应的器件名称
## Signature
```typescript
enum NetportDeviceName
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
BI
</td><td>
`'Netport-BI'`
</td><td>
</td></tr>
<tr><td>
Ground
</td><td>
`'Netport-Ground'`
</td><td>
</td></tr>
<tr><td>
HIZ
</td><td>
`'Netport-HIZ'`
</td><td>
</td></tr>
<tr><td>
IN
</td><td>
`'Netport-IN'`
</td><td>
</td></tr>
<tr><td>
OpenCollector
</td><td>
`'Netport-Open-Collector'`
</td><td>
</td></tr>
<tr><td>
OpenEmitter
</td><td>
`'Netport-Open-Emitter'`
</td><td>
</td></tr>
<tr><td>
OUT
</td><td>
`'Netport-OUT'`
</td><td>
</td></tr>
<tr><td>
Passive
</td><td>
`'Netport-Passive'`
</td><td>
</td></tr>
<tr><td>
Power
</td><td>
`'Netport-Power'`
</td><td>
</td></tr>
<tr><td>
Terminator
</td><td>
`'Netport-Terminator'`
</td><td>
</td></tr>
<tr><td>
Undefined
</td><td>
`'Netport-Undefined'`
</td><td>
</td></tr>
</tbody></table>
references/enums/ESYS_Unit.md
# ESYS\_Unit enum
Unit
## Signature
```typescript
enum ESYS_Unit
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
CENTIMETER
</td><td>
`'cm'`
</td><td>
厘米
</td></tr>
<tr><td>
DECIMETER
</td><td>
`'dm'`
</td><td>
分米
</td></tr>
<tr><td>
IN
</td><td>
`'in'`
</td><td>
英尺
</td></tr>
<tr><td>
INCH
</td><td>
`'inch'`
</td><td>
英寸
</td></tr>
<tr><td>
METER
</td><td>
`'m'`
</td><td>
米
</td></tr>
<tr><td>
MIL
</td><td>
`'mil'`
</td><td>
密尔
</td></tr>
<tr><td>
MILLIMETER
</td><td>
`'mm'`
</td><td>
毫米
</td></tr>
</tbody></table>
references/enums/SchToolBarDeviceName.md
# SchToolBarDeviceName enum
悬浮框特殊符号对应的器件名称
## Signature
```typescript
enum SchToolBarDeviceName
```
## Enumeration Members
<table><thead><tr><th>
Member
</th><th>
Value
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
AGND
</td><td>
`'Ground-AGND'`
</td><td>
</td></tr>
<tr><td>
BI
</td><td>
`'Netport-BI'`
</td><td>
</td></tr>
<tr><td>
CAPACITOR
</td><td>
`'CAP_0603'`
</td><td>
</td></tr>
<tr><td>
DIFF\_PAIRS\_FLAG
</td><td>
`'Differential-Pairs-Flag'`
</td><td>
</td></tr>
<tr><td>
DIODE
</td><td>
`'1N4007'`
</td><td>
</td></tr>
<tr><td>
FOUR\_CHANNEL\_OSCILLOSCOPE
</td><td>
`'四通道示波器'`
</td><td>
</td></tr>
<tr><td>
GND
</td><td>
`'Ground-GND'`
</td><td>
</td></tr>
<tr><td>
IN
</td><td>
`'Netport-IN'`
</td><td>
</td></tr>
<tr><td>
INDUCTOR
</td><td>
`'L_0603'`
</td><td>
</td></tr>
<tr><td>
MULTIMETER
</td><td>
`'万用表'`
</td><td>
</td></tr>
<tr><td>
OFF\_PAGE\_CONNECTOR\_BI
</td><td>
`'Off-Page-Connector-BI'`
</td><td>
</td></tr>
<tr><td>
OFF\_PAGE\_CONNECTOR\_IN
</td><td>
`'Off-Page-Connector-In'`
</td><td>
</td></tr>
<tr><td>
OFF\_PAGE\_CONNECTOR\_OUT
</td><td>
`'Off-Page-Connector-Out'`
</td><td>
</td></tr>
<tr><td>
OUT
</td><td>
`'Netport-OUT'`
</td><td>
</td></tr>
<tr><td>
PGND
</td><td>
`'Ground-PGND'`
</td><td>
</td></tr>
<tr><td>
PROBE\_I
</td><td>
`'电流探针'`
</td><td>
</td></tr>
<tr><td>
PROBE\_L
</td><td>
`'逻辑探针'`
</td><td>
</td></tr>
<tr><td>
PROBE\_V
</td><td>
`'电压探针'`
</td><td>
</td></tr>
<tr><td>
RESISTOR
</td><td>
`'Res_0603'`
</td><td>
</td></tr>
<tr><td>
SHORT
</td><td>
`'Short-Symbol'`
</td><td>
</td></tr>
<tr><td>
TEST\_POINT
</td><td>
`'Test-Point'`
</td><td>
</td></tr>
<tr><td>
V5
</td><td>
`'Power-5V'`
</td><td>
</td></tr>
<tr><td>
VCC
</td><td>
`'Power-VCC'`
</td><td>
</td></tr>
</tbody></table>
references/interfaces/BorderConfig.md
# BorderConfig interface
边框配置
## Signature
```typescript
interface BorderConfig
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[header?](./BorderConfig.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_
</td></tr>
<tr><td>
[horizontal?](./BorderConfig.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_
</td></tr>
<tr><td>
[vertical?](./BorderConfig.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_
</td></tr>
</tbody></table>
---
## 属性详情
### header
# BorderConfig.header property
## Signature
```typescript
header?: boolean;
```
### horizontal
# BorderConfig.horizontal property
## Signature
```typescript
horizontal?: boolean;
```
### vertical
# BorderConfig.vertical property
## Signature
```typescript
vertical?: boolean;
```
references/interfaces/ButtonProps.md
# ButtonProps interface
按钮组件:可点击触发的操作按钮
## Signature
```typescript
interface ButtonProps
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[disabled?](./ButtonProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ Whether Disable
</td></tr>
<tr><td>
[icon?](./ButtonProps.md)
</td><td>
</td><td>
[IconProps](./IconProps.md)
</td><td>
_(Optional)_ Button icon configuration
</td></tr>
<tr><td>
[onClick?](./ButtonProps.md)
</td><td>
</td><td>
() => void
</td><td>
_(Optional)_ 点击按钮时触发
</td></tr>
<tr><td>
[text?](./ButtonProps.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Button show text
</td></tr>
<tr><td>
[triggerEnter?](./ButtonProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ 是否为对话框的 Enter 触发按钮(仅 Dialog 内部生效,按 Enter 会触发该按钮点击)
</td></tr>
<tr><td>
[type?](./ButtonProps.md)
</td><td>
</td><td>
'default' \| 'primary' \| 'danger' \| 'forbidden' \| 'text'
</td><td>
_(Optional)_ Button style type: default / primary / danger / forbidden / text
</td></tr>
</tbody></table>
---
## 属性详情
### disabled
# ButtonProps.disabled property
Whether Disable
## Signature
```typescript
disabled?: boolean;
```
### icon
# ButtonProps.icon property
Button icon configuration
## Signature
```typescript
icon?: IconProps;
```
### onclick
# ButtonProps.onClick property
点击按钮时触发
## Signature
```typescript
onClick?: () => void;
```
### text
# ButtonProps.text property
Button show text
## Signature
```typescript
text?: string;
```
### triggerenter
# ButtonProps.triggerEnter property
是否为对话框的 Enter 触发按钮(仅 Dialog 内部生效,按 Enter 会触发该按钮点击)
## Signature
```typescript
triggerEnter?: boolean;
```
### type
# ButtonProps.type property
Button style type: default / primary / danger / forbidden / text
## Signature
```typescript
type?: 'default' | 'primary' | 'danger' | 'forbidden' | 'text';
```
references/interfaces/BoardProps.md
# BoardProps interface
分组面板:带标题的可折叠/分组容器
## Signature
```typescript
interface BoardProps
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[bgColor?](./BoardProps.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Background color. Accepts any CSS color value
</td></tr>
<tr><td>
[children?](./BoardProps.md)
</td><td>
</td><td>
any
</td><td>
_(Optional)_ Panel content child nodes
</td></tr>
<tr><td>
[onClick?](./BoardProps.md)
</td><td>
</td><td>
() => void
</td><td>
_(Optional)_ 点击面板时触发
</td></tr>
<tr><td>
[padding?](./BoardProps.md)
</td><td>
</td><td>
number\[\]
</td><td>
_(Optional)_ Padding (CSS shorthand array)
</td></tr>
<tr><td>
[title](./BoardProps.md)
</td><td>
</td><td>
string
</td><td>
Title text ( required)
</td></tr>
</tbody></table>
---
## 属性详情
### bgcolor
# BoardProps.bgColor property
Background color. Accepts any CSS color value
## Signature
```typescript
bgColor?: string;
```
### children
# BoardProps.children property
Panel content child nodes
## Signature
```typescript
children?: any;
```
### onclick
# BoardProps.onClick property
点击面板时触发
## Signature
```typescript
onClick?: () => void;
```
### padding
# BoardProps.padding property
Padding (CSS shorthand array)
## Signature
```typescript
padding?: number[];
```
### title
# BoardProps.title property
Title text ( required)
## Signature
```typescript
title: string;
```
references/interfaces/CellCoord.md
# CellCoord interface
单元格坐标(rowKey + colKey 定位一个单元格)
## Signature
```typescript
interface CellCoord
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[colKey](./CellCoord.md)
</td><td>
</td><td>
string
</td><td>
列 key(ColumnDef.key)
</td></tr>
<tr><td>
[rowKey](./CellCoord.md)
</td><td>
</td><td>
string
</td><td>
行唯一标识(由 rowKey 提取)
</td></tr>
</tbody></table>
---
## 属性详情
### colkey
# CellCoord.colKey property
列 key(ColumnDef.key)
## Signature
```typescript
colKey: string;
```
### rowkey
# CellCoord.rowKey property
行唯一标识(由 rowKey 提取)
## Signature
```typescript
rowKey: string;
```
references/interfaces/CellClickInfo.md
# CellClickInfo interface
单元格点击信息
## Signature
```typescript
interface CellClickInfo<T = any>
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[colKey](./CellClickInfo.md)
</td><td>
</td><td>
string
</td><td>
列 key
</td></tr>
<tr><td>
[row](./CellClickInfo.md)
</td><td>
</td><td>
T
</td><td>
行数据
</td></tr>
<tr><td>
[rowIndex](./CellClickInfo.md)
</td><td>
</td><td>
number
</td><td>
行索引
</td></tr>
<tr><td>
[value](./CellClickInfo.md)
</td><td>
</td><td>
any
</td><td>
单元格值
</td></tr>
</tbody></table>
---
## 属性详情
### colkey
# CellClickInfo.colKey property
列 key
## Signature
```typescript
colKey: string;
```
### row
# CellClickInfo.row property
行数据
## Signature
```typescript
row: T;
```
### rowindex
# CellClickInfo.rowIndex property
行索引
## Signature
```typescript
rowIndex: number;
```
### value
# CellClickInfo.value property
单元格值
## Signature
```typescript
value: any;
```
references/interfaces/CheckBoxProps.md
# CheckBoxProps interface
复选框组件:可勾选的状态控件
## Signature
```typescript
interface CheckBoxProps
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[checked?](./CheckBoxProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ Whether Select
</td></tr>
<tr><td>
[disabled?](./CheckBoxProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ Whether Disable
</td></tr>
<tr><td>
[indeterminate?](./CheckBoxProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ 半选状态(全选/半选三态)
</td></tr>
<tr><td>
[name?](./CheckBoxProps.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Checkbox name (the form `name` attribute)
</td></tr>
<tr><td>
[onChange?](./CheckBoxProps.md)
</td><td>
</td><td>
(checked: boolean) => void
</td><td>
_(Optional)_ 选中状态变化时触发,参数为最新选中值
</td></tr>
<tr><td>
[onlyChangeByBox?](./CheckBoxProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ Whether the state can only be changed by clicking the checkbox itself
</td></tr>
<tr><td>
[text?](./CheckBoxProps.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Text displayed next to the checkbox
</td></tr>
</tbody></table>
---
## 属性详情
### checked
# CheckBoxProps.checked property
Whether Select
## Signature
```typescript
checked?: boolean;
```
### disabled
# CheckBoxProps.disabled property
Whether Disable
## Signature
```typescript
disabled?: boolean;
```
### indeterminate
# CheckBoxProps.indeterminate property
半选状态(全选/半选三态)
## Signature
```typescript
indeterminate?: boolean;
```
### name
# CheckBoxProps.name property
Checkbox name (the form `name` attribute)
## Signature
```typescript
name?: string;
```
### onchange
# CheckBoxProps.onChange property
选中状态变化时触发,参数为最新选中值
## Signature
```typescript
onChange?: (checked: boolean) => void;
```
### onlychangebybox
# CheckBoxProps.onlyChangeByBox property
Whether the state can only be changed by clicking the checkbox itself
## Signature
```typescript
onlyChangeByBox?: boolean;
```
### text
# CheckBoxProps.text property
Text displayed next to the checkbox
## Signature
```typescript
text?: string;
```
references/interfaces/CheckChangeDetail.md
# CheckChangeDetail interface
勾选变更详情
## Signature
```typescript
interface CheckChangeDetail
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[row?](./CheckChangeDetail.md)
</td><td>
</td><td>
Record<string, any>
</td><td>
_(Optional)_ 相关行数据
</td></tr>
<tr><td>
[trigger](./CheckChangeDetail.md)
</td><td>
</td><td>
'rowsUpdate' \| 'checkListUpdate' \| 'user'
</td><td>
变更来源
</td></tr>
</tbody></table>
---
## 属性详情
### row
# CheckChangeDetail.row property
相关行数据
## Signature
```typescript
row?: Record<string, any>;
```
### trigger
# CheckChangeDetail.trigger property
变更来源
## Signature
```typescript
trigger: 'rowsUpdate' | 'checkListUpdate' | 'user';
```
references/interfaces/ClipboardCellData.md
# ClipboardCellData interface
剪贴板单元格数据
## Signature
```typescript
interface ClipboardCellData
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[contentType](./ClipboardCellData.md)
</td><td>
</td><td>
[CellContentType](../types/CellContentType.md)
</td><td>
内容类型
</td></tr>
<tr><td>
[subType?](./ClipboardCellData.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ 子类型(预留)
</td></tr>
<tr><td>
[text](./ClipboardCellData.md)
</td><td>
</td><td>
string
</td><td>
纯文本表示
</td></tr>
<tr><td>
[value](./ClipboardCellData.md)
</td><td>
</td><td>
any
</td><td>
原始值
</td></tr>
</tbody></table>
---
## 属性详情
### contenttype
# ClipboardCellData.contentType property
内容类型
## Signature
```typescript
contentType: CellContentType;
```
### subtype
# ClipboardCellData.subType property
子类型(预留)
## Signature
```typescript
subType?: string;
```
### text
# ClipboardCellData.text property
纯文本表示
## Signature
```typescript
text: string;
```
### value
# ClipboardCellData.value property
原始值
## Signature
```typescript
value: any;
```
references/interfaces/CheckboxEditConfig.md
# CheckboxEditConfig interface
## Signature
```typescript
interface CheckboxEditConfig
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[checkedValue?](./CheckboxEditConfig.md)
</td><td>
</td><td>
any
</td><td>
_(Optional)_ 勾选时的值,默认 true
</td></tr>
<tr><td>
[disabled?](./CheckboxEditConfig.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_
</td></tr>
<tr><td>
[onChange?](./CheckboxEditConfig.md)
</td><td>
</td><td>
(checked: boolean) => void
</td><td>
_(Optional)_
</td></tr>
<tr><td>
[type](./CheckboxEditConfig.md)
</td><td>
</td><td>
'checkbox'
</td><td>
</td></tr>
<tr><td>
[uncheckedValue?](./CheckboxEditConfig.md)
</td><td>
</td><td>
any
</td><td>
_(Optional)_ 未勾选时的值,默认 false
</td></tr>
</tbody></table>
---
## 属性详情
### checkedvalue
# CheckboxEditConfig.checkedValue property
勾选时的值,默认 true
## Signature
```typescript
checkedValue?: any;
```
### disabled
# CheckboxEditConfig.disabled property
## Signature
```typescript
disabled?: boolean;
```
### onchange
# CheckboxEditConfig.onChange property
## Signature
```typescript
onChange?: (checked: boolean) => void;
```
### type
# CheckboxEditConfig.type property
## Signature
```typescript
type: 'checkbox';
```
### uncheckedvalue
# CheckboxEditConfig.uncheckedValue property
未勾选时的值,默认 false
## Signature
```typescript
uncheckedValue?: any;
```
references/interfaces/ColumnGroupDef.md
# ColumnGroupDef interface
列分组:多级表头
## Signature
```typescript
interface ColumnGroupDef<T = any>
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[align?](./ColumnGroupDef.md)
</td><td>
</td><td>
[Align](../types/Align.md)
</td><td>
_(Optional)_ 分组对齐(子列未指定时继承)
</td></tr>
<tr><td>
[children](./ColumnGroupDef.md)
</td><td>
</td><td>
[ColumnDef](./ColumnDef.md)<!-- --><T>\[\]
</td><td>
子列
</td></tr>
<tr><td>
[fixed?](./ColumnGroupDef.md)
</td><td>
</td><td>
'left' \| 'right'
</td><td>
_(Optional)_ 分组固定列位置(子列未指定时继承)
</td></tr>
<tr><td>
[key](./ColumnGroupDef.md)
</td><td>
</td><td>
string
</td><td>
分组标识(表头渲染用)
</td></tr>
<tr><td>
[title](./ColumnGroupDef.md)
</td><td>
</td><td>
string
</td><td>
分组标题
</td></tr>
<tr><td>
[type](./ColumnGroupDef.md)
</td><td>
</td><td>
'group'
</td><td>
</td></tr>
</tbody></table>
---
## 属性详情
### align
# ColumnGroupDef.align property
分组对齐(子列未指定时继承)
## Signature
```typescript
align?: Align;
```
### children
# ColumnGroupDef.children property
子列
## Signature
```typescript
children: ColumnDef < T > [];
```
### fixed
# ColumnGroupDef.fixed property
分组固定列位置(子列未指定时继承)
## Signature
```typescript
fixed?: 'left' | 'right';
```
### key
# ColumnGroupDef.key property
分组标识(表头渲染用)
## Signature
```typescript
key: string;
```
### title
# ColumnGroupDef.title property
分组标题
## Signature
```typescript
title: string;
```
### type
# ColumnGroupDef.type property
## Signature
```typescript
type: 'group';
```
references/interfaces/ColorPickerProps.md
# ColorPickerProps interface
颜色拾取组件:复用 Input color 类型,点击弹出内置固定色板,支持预览/应用/手输/清除/默认/关闭
## Signature
```typescript
interface ColorPickerProps
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[disabled?](./ColorPickerProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ 是否禁用:不可点击、不弹层、无交互
</td></tr>
<tr><td>
[onChange?](./ColorPickerProps.md)
</td><td>
</td><td>
(color: string) => void
</td><td>
_(Optional)_ 颜色值落定时触发:点色块 / √ 确认合法 hex / 清除;预览/关闭/取消不触发。载荷为统一大写的 `#RRGGBB`<!-- -->,清除为 `''`
</td></tr>
<tr><td>
[onDefault?](./ColorPickerProps.md)
</td><td>
</td><td>
() => void
</td><td>
_(Optional)_ 点击「默认」按钮时触发(纯自定义回调,无内置默认色回退),触发后关闭弹层,无参
</td></tr>
<tr><td>
[readonly?](./ColorPickerProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ 是否只读:不可手输 hex,但可打开色板选色(选色仍触发 onChange)
</td></tr>
<tr><td>
[value?](./ColorPickerProps.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ 当前颜色值(受控),合法形式 `#RGB` / `#RRGGBB`<!-- -->;空串/无 = 无颜色
</td></tr>
</tbody></table>
---
## 属性详情
### disabled
# ColorPickerProps.disabled property
是否禁用:不可点击、不弹层、无交互
## Signature
```typescript
disabled?: boolean;
```
### onchange
# ColorPickerProps.onChange property
颜色值落定时触发:点色块 / √ 确认合法 hex / 清除;预览/关闭/取消不触发。载荷为统一大写的 `#RRGGBB`<!-- -->,清除为 `''`
## Signature
```typescript
onChange?: (color: string) => void;
```
### ondefault
# ColorPickerProps.onDefault property
点击「默认」按钮时触发(纯自定义回调,无内置默认色回退),触发后关闭弹层,无参
## Signature
```typescript
onDefault?: () => void;
```
### readonly
# ColorPickerProps.readonly property
是否只读:不可手输 hex,但可打开色板选色(选色仍触发 onChange)
## Signature
```typescript
readonly?: boolean;
```
### value
# ColorPickerProps.value property
当前颜色值(受控),合法形式 `#RGB` / `#RRGGBB`<!-- -->;空串/无 = 无颜色
## Signature
```typescript
value?: string;
```
references/interfaces/ColumnEditTrigger.md
# ColumnEditTrigger interface
编辑触发方式
## Signature
```typescript
interface ColumnEditTrigger
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[trigger](./ColumnEditTrigger.md)
</td><td>
</td><td>
'click' \| 'doubleClick'
</td><td>
</td></tr>
</tbody></table>
---
## 属性详情
### trigger
# ColumnEditTrigger.trigger property
## Signature
```typescript
trigger: 'click' | 'doubleClick';
```
references/interfaces/ColumnDef.md
# ColumnDef interface
列定义
## Signature
```typescript
interface ColumnDef<T = any>
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[align?](./ColumnDef.md)
</td><td>
</td><td>
[Align](../types/Align.md)
</td><td>
_(Optional)_ 对齐方式
</td></tr>
<tr><td>
[editable?](./ColumnDef.md)
</td><td>
</td><td>
boolean \| [ColumnEditTrigger](./ColumnEditTrigger.md)
</td><td>
_(Optional)_ 是否可编辑,默认 false(不传 = 不可编辑)
</td></tr>
<tr><td>
[ellipsis?](./ColumnDef.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ 单元格文本溢出省略号:true 时单行截断(…)+ hover 显示完整文本 tooltip。 默认 false —— 单元格默认换行完整显示,省略号需显式开启。
⚠️ 虚拟滚动约束:本组件虚拟滚动为「固定行高」方案(非动态测量), 换行会撑高 `<tr>` 导致可见行定位错位。因此开启 `virtualScroll` 时, 所有可能超长换行的列必须显式 `ellipsis: true`<!-- -->(或使用 `$truncate` 插槽)保证单行。
</td></tr>
<tr><td>
[filterable?](./ColumnDef.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ 是否可筛选
</td></tr>
<tr><td>
[filterMatchMode?](./ColumnDef.md)
</td><td>
</td><td>
[FilterMatchMode](../types/FilterMatchMode.md)
</td><td>
_(Optional)_ 筛选匹配模式,默认由 type 推断:text=contains,其余(number/select/checkbox/date/boolean)=exact
</td></tr>
<tr><td>
[fixed?](./ColumnDef.md)
</td><td>
</td><td>
'left' \| 'right'
</td><td>
_(Optional)_ 固定列位置
</td></tr>
<tr><td>
[hidden?](./ColumnDef.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ 是否隐藏
</td></tr>
<tr><td>
[key](./ColumnDef.md)
</td><td>
</td><td>
keyof T & string
</td><td>
列 key(对应数据字段名)
</td></tr>
<tr><td>
[mergeByField?](./ColumnDef.md)
</td><td>
</td><td>
keyof T & string
</td><td>
_(Optional)_ 按字段分组自动合并:相同值的连续行合并为一个 cell
</td></tr>
<tr><td>
[minWidth?](./ColumnDef.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 最小列宽(px),默认 50
</td></tr>
<tr><td>
[resizable?](./ColumnDef.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ 是否可拖拽调整列宽
</td></tr>
<tr><td>
[rules?](./ColumnDef.md)
</td><td>
</td><td>
[ValidationRule](./ValidationRule.md)<!-- -->\[\]
</td><td>
_(Optional)_ 声明式校验规则(纯数据,可序列化)
</td></tr>
<tr><td>
[selectList?](./ColumnDef.md)
</td><td>
</td><td>
[SelectOption](./SelectOption.md)<!-- -->\[\]
</td><td>
_(Optional)_ 内置下拉渲染:显示选项 text 而非原始值
</td></tr>
<tr><td>
[slot?](./ColumnDef.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ 单元格内置插槽名($ 前缀),从 Main 侧内置目录解析;非 $ 前缀或未命中则回退默认渲染
</td></tr>
<tr><td>
[slotProps?](./ColumnDef.md)
</td><td>
</td><td>
[Serializable](../types/Serializable.md)
</td><td>
_(Optional)_ 传给插槽组件的纯数据(Serializable,可跨广播)
</td></tr>
<tr><td>
[sortable?](./ColumnDef.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ 是否可排序
</td></tr>
<tr><td>
[sortKey?](./ColumnDef.md)
</td><td>
</td><td>
string \| string\[\]
</td><td>
_(Optional)_ 排序字段(默认取 key,可指定字段名或字段路径数组)
</td></tr>
<tr><td>
[sortType?](./ColumnDef.md)
</td><td>
</td><td>
'string' \| 'number' \| 'date'
</td><td>
_(Optional)_ 排序类型(默认由 type 推断)
</td></tr>
<tr><td>
[title](./ColumnDef.md)
</td><td>
</td><td>
string
</td><td>
列标题
</td></tr>
<tr><td>
[type?](./ColumnDef.md)
</td><td>
</td><td>
[ColumnType](../types/ColumnType.md)
</td><td>
_(Optional)_ 列数据类型,默认 'text'。决定默认排序类型(sortType)和筛选匹配模式(filterMatchMode)
</td></tr>
<tr><td>
[width?](./ColumnDef.md)
</td><td>
</td><td>
number \| string
</td><td>
_(Optional)_ 列宽:number = 像素值,string = CSS 值(如 "50%"、"auto"、"200px")
</td></tr>
</tbody></table>
---
## 属性详情
### align
# ColumnDef.align property
对齐方式
## Signature
```typescript
align?: Align;
```
### editable
# ColumnDef.editable property
是否可编辑,默认 false(不传 = 不可编辑)
## Signature
```typescript
editable?: boolean | ColumnEditTrigger;
```
### ellipsis
# ColumnDef.ellipsis property
单元格文本溢出省略号:true 时单行截断(…)+ hover 显示完整文本 tooltip。 默认 false —— 单元格默认换行完整显示,省略号需显式开启。
⚠️ 虚拟滚动约束:本组件虚拟滚动为「固定行高」方案(非动态测量), 换行会撑高 `<tr>` 导致可见行定位错位。因此开启 `virtualScroll` 时, 所有可能超长换行的列必须显式 `ellipsis: true`<!-- -->(或使用 `$truncate` 插槽)保证单行。
## Signature
```typescript
ellipsis?: boolean;
```
### filterable
# ColumnDef.filterable property
是否可筛选
## Signature
```typescript
filterable?: boolean;
```
### filtermatchmode
# ColumnDef.filterMatchMode property
筛选匹配模式,默认由 type 推断:text=contains,其余(number/select/checkbox/date/boolean)=exact
## Signature
```typescript
filterMatchMode?: FilterMatchMode;
```
### fixed
# ColumnDef.fixed property
固定列位置
## Signature
```typescript
fixed?: 'left' | 'right';
```
### hidden
# ColumnDef.hidden property
是否隐藏
## Signature
```typescript
hidden?: boolean;
```
### key
# ColumnDef.key property
列 key(对应数据字段名)
## Signature
```typescript
key: keyof T & string;
```
### mergebyfield
# ColumnDef.mergeByField property
按字段分组自动合并:相同值的连续行合并为一个 cell
## Signature
```typescript
mergeByField?: keyof T & string;
```
### minwidth
# ColumnDef.minWidth property
最小列宽(px),默认 50
## Signature
```typescript
minWidth?: number;
```
### resizable
# ColumnDef.resizable property
是否可拖拽调整列宽
## Signature
```typescript
resizable?: boolean;
```
### rules
# ColumnDef.rules property
声明式校验规则(纯数据,可序列化)
## Signature
```typescript
rules?: ValidationRule[];
```
### selectlist
# ColumnDef.selectList property
内置下拉渲染:显示选项 text 而非原始值
## Signature
```typescript
selectList?: SelectOption[];
```
### slot
# ColumnDef.slot property
单元格内置插槽名($ 前缀),从 Main 侧内置目录解析;非 $ 前缀或未命中则回退默认渲染
## Signature
```typescript
slot?: string;
```
### slotprops
# ColumnDef.slotProps property
传给插槽组件的纯数据(Serializable,可跨广播)
## Signature
```typescript
slotProps?: Serializable;
```
### sortable
# ColumnDef.sortable property
是否可排序
## Signature
```typescript
sortable?: boolean;
```
### sortkey
# ColumnDef.sortKey property
排序字段(默认取 key,可指定字段名或字段路径数组)
## Signature
```typescript
sortKey?: string | string[];
```
### sorttype
# ColumnDef.sortType property
排序类型(默认由 type 推断)
## Signature
```typescript
sortType?: 'string' | 'number' | 'date';
```
### title
# ColumnDef.title property
列标题
## Signature
```typescript
title: string;
```
### type
# ColumnDef.type property
列数据类型,默认 'text'。决定默认排序类型(sortType)和筛选匹配模式(filterMatchMode)
## Signature
```typescript
type?: ColumnType;
```
### width
# ColumnDef.width property
列宽:number = 像素值,string = CSS 值(如 "50%"、"auto"、"200px")
## Signature
```typescript
width?: number | string;
```
references/interfaces/ClipboardConfig.md
# ClipboardConfig interface
剪贴板配置
## Signature
```typescript
interface ClipboardConfig
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[onCopy?](./ClipboardConfig.md)
</td><td>
</td><td>
(data: [ClipboardCellData](./ClipboardCellData.md)<!-- -->\[\]\[\]) => void
</td><td>
_(Optional)_ 复制通知(注意:复制走浏览器原生,此回调仅作通知,不接管复制)
</td></tr>
<tr><td>
[onPaste?](./ClipboardConfig.md)
</td><td>
</td><td>
(data: [ClipboardCellData](./ClipboardCellData.md)<!-- -->\[\]\[\], targetCell: [CellCoord](./CellCoord.md)<!-- -->) => void
</td><td>
_(Optional)_ 粘贴通知
</td></tr>
<tr><td>
[shortcuts?](./ClipboardConfig.md)
</td><td>
</td><td>
\{ copy?: string; paste?: string; cut?: string \}
</td><td>
_(Optional)_ 自定义快捷键
</td></tr>
</tbody></table>
---
## 属性详情
### oncopy
# ClipboardConfig.onCopy property
复制通知(注意:复制走浏览器原生,此回调仅作通知,不接管复制)
## Signature
```typescript
onCopy?: (data: ClipboardCellData[][]) => void;
```
### onpaste
# ClipboardConfig.onPaste property
粘贴通知
## Signature
```typescript
onPaste?: (data: ClipboardCellData[][], targetCell: CellCoord) => void;
```
### shortcuts
# ClipboardConfig.shortcuts property
自定义快捷键
## Signature
```typescript
shortcuts?: { copy?: string; paste?: string; cut?: string };
```
references/interfaces/ColumnResizeConfig.md
# ColumnResizeConfig interface
列宽拖拽配置
## Signature
```typescript
interface ColumnResizeConfig
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[minWidth?](./ColumnResizeConfig.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 最小列宽(px),默认 25
</td></tr>
<tr><td>
[onChange?](./ColumnResizeConfig.md)
</td><td>
</td><td>
(info: { colKey: string; width: number }) => void
</td><td>
_(Optional)_ 列宽变更通知
</td></tr>
<tr><td>
[persist?](./ColumnResizeConfig.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ 是否持久化列宽到 localStorage,默认 true
</td></tr>
<tr><td>
[storageKey?](./ColumnResizeConfig.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ 持久化存储 key
</td></tr>
</tbody></table>
---
## 属性详情
### minwidth
# ColumnResizeConfig.minWidth property
最小列宽(px),默认 25
## Signature
```typescript
minWidth?: number;
```
### onchange
# ColumnResizeConfig.onChange property
列宽变更通知
## Signature
```typescript
onChange?: (info: { colKey: string; width: number }) => void;
```
### persist
# ColumnResizeConfig.persist property
是否持久化列宽到 localStorage,默认 true
## Signature
```typescript
persist?: boolean;
```
### storagekey
# ColumnResizeConfig.storageKey property
持久化存储 key
## Signature
```typescript
storageKey?: string;
```
references/interfaces/CustomHeaderConfig.md
# CustomHeaderConfig interface
自定义表头配置(列可见性管理)
## Signature
```typescript
interface CustomHeaderConfig
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[availableColumns](./CustomHeaderConfig.md)
</td><td>
</td><td>
[ColumnDef](./ColumnDef.md)<!-- -->\[\]
</td><td>
全部可选列(含隐藏列)
</td></tr>
<tr><td>
[onChange](./CustomHeaderConfig.md)
</td><td>
</td><td>
(visibleKeys: string\[\]) => void
</td><td>
可见列变更通知
</td></tr>
<tr><td>
[persist?](./CustomHeaderConfig.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ 是否持久化,默认 true
</td></tr>
<tr><td>
[storageKey?](./CustomHeaderConfig.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ 持久化存储 key
</td></tr>
<tr><td>
[visibleKeys](./CustomHeaderConfig.md)
</td><td>
</td><td>
string\[\]
</td><td>
当前可见列 key 列表
</td></tr>
</tbody></table>
---
## 属性详情
### availablecolumns
# CustomHeaderConfig.availableColumns property
全部可选列(含隐藏列)
## Signature
```typescript
availableColumns: ColumnDef[];
```
### onchange
# CustomHeaderConfig.onChange property
可见列变更通知
## Signature
```typescript
onChange: (visibleKeys: string[]) => void;
```
### persist
# CustomHeaderConfig.persist property
是否持久化,默认 true
## Signature
```typescript
persist?: boolean;
```
### storagekey
# CustomHeaderConfig.storageKey property
持久化存储 key
## Signature
```typescript
storageKey?: string;
```
### visiblekeys
# CustomHeaderConfig.visibleKeys property
当前可见列 key 列表
## Signature
```typescript
visibleKeys: string[];
```
references/interfaces/ComponentPropsMap.md
# ComponentPropsMap interface
Component name → Props type mapping, serving as the sole source of the `createComponent` generic constraint
## Signature
```typescript
interface ComponentPropsMap
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[Board](./ComponentPropsMap.md)
</td><td>
</td><td>
[BoardProps](./BoardProps.md)
</td><td>
</td></tr>
<tr><td>
[Button](./ComponentPropsMap.md)
</td><td>
</td><td>
[ButtonProps](./ButtonProps.md)
</td><td>
</td></tr>
<tr><td>
[CheckBox](./ComponentPropsMap.md)
</td><td>
</td><td>
[CheckBoxProps](./CheckBoxProps.md)
</td><td>
</td></tr>
<tr><td>
[ColorPicker](./ComponentPropsMap.md)
</td><td>
</td><td>
[ColorPickerProps](./ColorPickerProps.md)
</td><td>
</td></tr>
<tr><td>
[Dialog](./ComponentPropsMap.md)
</td><td>
</td><td>
[DialogProps](./DialogProps.md)
</td><td>
</td></tr>
<tr><td>
[Flex](./ComponentPropsMap.md)
</td><td>
</td><td>
[FlexProps](./FlexProps.md)
</td><td>
</td></tr>
<tr><td>
[FlexItem](./ComponentPropsMap.md)
</td><td>
</td><td>
[FlexItemProps](./FlexItemProps.md)
</td><td>
</td></tr>
<tr><td>
[Grid](./ComponentPropsMap.md)
</td><td>
</td><td>
[GridProps](./GridProps.md)
</td><td>
</td></tr>
<tr><td>
[GridItem](./ComponentPropsMap.md)
</td><td>
</td><td>
[GridItemProps](./GridItemProps.md)
</td><td>
</td></tr>
<tr><td>
[Image](./ComponentPropsMap.md)
</td><td>
</td><td>
[ImageProps](./ImageProps.md)
</td><td>
</td></tr>
<tr><td>
[Input](./ComponentPropsMap.md)
</td><td>
</td><td>
[InputProps](./InputProps.md)
</td><td>
</td></tr>
<tr><td>
[List](./ComponentPropsMap.md)
</td><td>
</td><td>
[ListProps](./ListProps.md)
</td><td>
</td></tr>
<tr><td>
[Modal](./ComponentPropsMap.md)
</td><td>
</td><td>
[ModalProps](./ModalProps.md)
</td><td>
</td></tr>
<tr><td>
[RadioGroup](./ComponentPropsMap.md)
</td><td>
</td><td>
[RadioGroupProps](./RadioGroupProps.md)
</td><td>
</td></tr>
<tr><td>
[RichTable](./ComponentPropsMap.md)
</td><td>
</td><td>
[RichTableProps](./RichTableProps.md)
</td><td>
</td></tr>
<tr><td>
[Scroller](./ComponentPropsMap.md)
</td><td>
</td><td>
[ScrollerProps](./ScrollerProps.md)
</td><td>
</td></tr>
<tr><td>
[Select](./ComponentPropsMap.md)
</td><td>
</td><td>
[SelectProps](./SelectProps.md)
</td><td>
</td></tr>
<tr><td>
[Slider](./ComponentPropsMap.md)
</td><td>
</td><td>
[SliderProps](./SliderProps.md)
</td><td>
</td></tr>
<tr><td>
[Slot](./ComponentPropsMap.md)
</td><td>
</td><td>
[SlotProps](./SlotProps.md)
</td><td>
</td></tr>
<tr><td>
[Text](./ComponentPropsMap.md)
</td><td>
</td><td>
[TextProps](./TextProps.md)
</td><td>
</td></tr>
<tr><td>
[TextArea](./ComponentPropsMap.md)
</td><td>
</td><td>
[TextAreaProps](./TextAreaProps.md)
</td><td>
</td></tr>
</tbody></table>
---
## 属性详情
### board
# ComponentPropsMap.Board property
## Signature
```typescript
Board: BoardProps;
```
### button
# ComponentPropsMap.Button property
## Signature
```typescript
Button: ButtonProps;
```
### checkbox
# ComponentPropsMap.CheckBox property
## Signature
```typescript
CheckBox: CheckBoxProps;
```
### colorpicker
# ComponentPropsMap.ColorPicker property
## Signature
```typescript
ColorPicker: ColorPickerProps;
```
### dialog
# ComponentPropsMap.Dialog property
## Signature
```typescript
Dialog: DialogProps;
```
### flex
# ComponentPropsMap.Flex property
## Signature
```typescript
Flex: FlexProps;
```
### flexitem
# ComponentPropsMap.FlexItem property
## Signature
```typescript
FlexItem: FlexItemProps;
```
### grid
# ComponentPropsMap.Grid property
## Signature
```typescript
Grid: GridProps;
```
### griditem
# ComponentPropsMap.GridItem property
## Signature
```typescript
GridItem: GridItemProps;
```
### image
# ComponentPropsMap.Image property
## Signature
```typescript
Image: ImageProps;
```
### input
# ComponentPropsMap.Input property
## Signature
```typescript
Input: InputProps;
```
### list
# ComponentPropsMap.List property
## Signature
```typescript
List: ListProps;
```
### modal
# ComponentPropsMap.Modal property
## Signature
```typescript
Modal: ModalProps;
```
### radiogroup
# ComponentPropsMap.RadioGroup property
## Signature
```typescript
RadioGroup: RadioGroupProps;
```
### richtable
# ComponentPropsMap.RichTable property
## Signature
```typescript
RichTable: RichTableProps;
```
### scroller
# ComponentPropsMap.Scroller property
## Signature
```typescript
Scroller: ScrollerProps;
```
### select
# ComponentPropsMap.Select property
## Signature
```typescript
Select: SelectProps;
```
### slider
# ComponentPropsMap.Slider property
## Signature
```typescript
Slider: SliderProps;
```
### slot
# ComponentPropsMap.Slot property
## Signature
```typescript
Slot: SlotProps;
```
### text
# ComponentPropsMap.Text property
## Signature
```typescript
Text: TextProps;
```
### textarea
# ComponentPropsMap.TextArea property
## Signature
```typescript
TextArea: TextAreaProps;
```
references/interfaces/DialogProps.md
# DialogProps interface
对话框组件:带标题栏、可拖拽缩放的组合弹窗
## Signature
```typescript
interface DialogProps
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[children?](./DialogProps.md)
</td><td>
</td><td>
any
</td><td>
_(Optional)_ Dialog content child nodes
</td></tr>
<tr><td>
[height?](./DialogProps.md)
</td><td>
</td><td>
number \| 'auto'
</td><td>
_(Optional)_ Height ( pixels)
</td></tr>
<tr><td>
[hide?](./DialogProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ Whether Hide dialog
</td></tr>
<tr><td>
[left?](./DialogProps.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ Position from the left (pixels)
</td></tr>
<tr><td>
[maxDragY?](./DialogProps.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ Maximum vertical drag distance ( pixels)
</td></tr>
<tr><td>
[modal?](./DialogProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ Whether to display in modal mode
</td></tr>
<tr><td>
[onClose?](./DialogProps.md)
</td><td>
</td><td>
() => void
</td><td>
_(Optional)_ 关闭对话框时触发
</td></tr>
<tr><td>
[overlay?](./DialogProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ Whether to show the mask layer
</td></tr>
<tr><td>
[resizeX?](./DialogProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ Whether horizontal resizing is allowed
</td></tr>
<tr><td>
[resizeY?](./DialogProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ Whether vertical resizing is allowed
</td></tr>
<tr><td>
[title](./DialogProps.md)
</td><td>
</td><td>
string
</td><td>
Title text ( required)
</td></tr>
<tr><td>
[top?](./DialogProps.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ Position from the top (pixels)
</td></tr>
<tr><td>
[width?](./DialogProps.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ Width ( pixels)
</td></tr>
</tbody></table>
---
## 属性详情
### children
# DialogProps.children property
Dialog content child nodes
## Signature
```typescript
children?: any;
```
### height
# DialogProps.height property
Height ( pixels)
## Signature
```typescript
height?: number | 'auto';
```
### hide
# DialogProps.hide property
Whether Hide dialog
## Signature
```typescript
hide?: boolean;
```
### left
# DialogProps.left property
Position from the left (pixels)
## Signature
```typescript
left?: number;
```
### maxdragy
# DialogProps.maxDragY property
Maximum vertical drag distance ( pixels)
## Signature
```typescript
maxDragY?: number;
```
### modal
# DialogProps.modal property
Whether to display in modal mode
## Signature
```typescript
modal?: boolean;
```
### onclose
# DialogProps.onClose property
关闭对话框时触发
## Signature
```typescript
onClose?: () => void;
```
### overlay
# DialogProps.overlay property
Whether to show the mask layer
## Signature
```typescript
overlay?: boolean;
```
### resizex
# DialogProps.resizeX property
Whether horizontal resizing is allowed
## Signature
```typescript
resizeX?: boolean;
```
### resizey
# DialogProps.resizeY property
Whether vertical resizing is allowed
## Signature
```typescript
resizeY?: boolean;
```
### title
# DialogProps.title property
Title text ( required)
## Signature
```typescript
title: string;
```
### top
# DialogProps.top property
Position from the top (pixels)
## Signature
```typescript
top?: number;
```
### width
# DialogProps.width property
Width ( pixels)
## Signature
```typescript
width?: number;
```
references/interfaces/EditingConfig.md
# EditingConfig interface
编辑配置
## Signature
```typescript
interface EditingConfig
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[columns?](./EditingConfig.md)
</td><td>
</td><td>
Record<string, [ColumnEditConfig](../types/ColumnEditConfig.md)<!-- -->>
</td><td>
_(Optional)_ 列级编辑器配置(key 为 colKey,未配置的列按 ColumnType 推断默认编辑器)
</td></tr>
<tr><td>
[editingRowIndices?](./EditingConfig.md)
</td><td>
</td><td>
number\[\]
</td><td>
_(Optional)_ 受控:正在编辑的行索引
</td></tr>
<tr><td>
[onChange?](./EditingConfig.md)
</td><td>
</td><td>
(info: { rowKey: string; colKey: string; value: any }) => void
</td><td>
_(Optional)_ 编辑值变更通知
</td></tr>
<tr><td>
[onConfirm?](./EditingConfig.md)
</td><td>
</td><td>
(info: { rowKey: string; colKey: string; value: any }) => void
</td><td>
_(Optional)_ 编辑确认通知
</td></tr>
<tr><td>
[setEditingRowIndex?](./EditingConfig.md)
</td><td>
</td><td>
(index: number) => void
</td><td>
_(Optional)_ 受控:设置编辑行索引
</td></tr>
<tr><td>
[trigger?](./EditingConfig.md)
</td><td>
</td><td>
'click' \| 'doubleClick'
</td><td>
_(Optional)_ 进入编辑态的触发方式,默认 'doubleClick'
</td></tr>
</tbody></table>
---
## 属性详情
### columns
# EditingConfig.columns property
列级编辑器配置(key 为 colKey,未配置的列按 ColumnType 推断默认编辑器)
## Signature
```typescript
columns?: Record<string, ColumnEditConfig>;
```
### editingrowindices
# EditingConfig.editingRowIndices property
受控:正在编辑的行索引
## Signature
```typescript
editingRowIndices?: number[];
```
### onchange
# EditingConfig.onChange property
编辑值变更通知
## Signature
```typescript
onChange?: (info: { rowKey: string; colKey: string; value: any }) => void;
```
### onconfirm
# EditingConfig.onConfirm property
编辑确认通知
## Signature
```typescript
onConfirm?: (info: { rowKey: string; colKey: string; value: any }) => void;
```
### seteditingrowindex
# EditingConfig.setEditingRowIndex property
受控:设置编辑行索引
## Signature
```typescript
setEditingRowIndex?: (index: number) => void;
```
### trigger
# EditingConfig.trigger property
进入编辑态的触发方式,默认 'doubleClick'
## Signature
```typescript
trigger?: 'click' | 'doubleClick';
```
references/interfaces/FilteringConfig.md
# FilteringConfig interface
筛选配置
## Signature
```typescript
interface FilteringConfig
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[caseSensitive?](./FilteringConfig.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ 是否区分大小写,默认 false
</td></tr>
<tr><td>
[debounce?](./FilteringConfig.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 输入防抖毫秒数,默认 300
</td></tr>
<tr><td>
[defaultFilters?](./FilteringConfig.md)
</td><td>
</td><td>
Record<string, string>
</td><td>
_(Optional)_ 非受控:初始筛选值
</td></tr>
<tr><td>
[filters?](./FilteringConfig.md)
</td><td>
</td><td>
Record<string, string>
</td><td>
_(Optional)_ 受控:外部维护的筛选值(key 为 colKey)
</td></tr>
<tr><td>
[onChange?](./FilteringConfig.md)
</td><td>
</td><td>
(filters: Record<string, string>) => void
</td><td>
_(Optional)_ 筛选变更通知
</td></tr>
<tr><td>
[onFilterCancel?](./FilteringConfig.md)
</td><td>
</td><td>
() => void
</td><td>
_(Optional)_ 筛选取消通知
</td></tr>
<tr><td>
[placeholder?](./FilteringConfig.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ 筛选输入框占位符,默认 '筛选...'
</td></tr>
<tr><td>
[position?](./FilteringConfig.md)
</td><td>
</td><td>
'inline' \| 'popover'
</td><td>
_(Optional)_ 筛选位置:popover 弹窗 / inline 表头内联行,默认 'popover'
</td></tr>
</tbody></table>
---
## 属性详情
### casesensitive
# FilteringConfig.caseSensitive property
是否区分大小写,默认 false
## Signature
```typescript
caseSensitive?: boolean;
```
### debounce
# FilteringConfig.debounce property
输入防抖毫秒数,默认 300
## Signature
```typescript
debounce?: number;
```
### defaultfilters
# FilteringConfig.defaultFilters property
非受控:初始筛选值
## Signature
```typescript
defaultFilters?: Record<string, string>;
```
### filters
# FilteringConfig.filters property
受控:外部维护的筛选值(key 为 colKey)
## Signature
```typescript
filters?: Record<string, string>;
```
### onchange
# FilteringConfig.onChange property
筛选变更通知
## Signature
```typescript
onChange?: (filters: Record<string, string>) => void;
```
### onfiltercancel
# FilteringConfig.onFilterCancel property
筛选取消通知
## Signature
```typescript
onFilterCancel?: () => void;
```
### placeholder
# FilteringConfig.placeholder property
筛选输入框占位符,默认 '筛选...'
## Signature
```typescript
placeholder?: string;
```
### position
# FilteringConfig.position property
筛选位置:popover 弹窗 / inline 表头内联行,默认 'popover'
## Signature
```typescript
position?: 'inline' | 'popover';
```
references/interfaces/DragSortConfig.md
# DragSortConfig interface
拖拽排序配置
## Signature
```typescript
interface DragSortConfig
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[handle?](./DragSortConfig.md)
</td><td>
</td><td>
'drag-column' \| 'row'
</td><td>
_(Optional)_ 拖拽手柄形式:独立拖拽列 / 整行拖拽,默认 'drag-column'
</td></tr>
<tr><td>
[onDragEnd?](./DragSortConfig.md)
</td><td>
</td><td>
(info: { fromIndices: number \| number\[\]; toIndex: number; currentIndices: number \| number\[\] }) => void
</td><td>
_(Optional)_ 拖拽排序结束通知
</td></tr>
<tr><td>
[showDragIcon?](./DragSortConfig.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ 是否显示拖拽图标,默认 true
</td></tr>
</tbody></table>
---
## 属性详情
### handle
# DragSortConfig.handle property
拖拽手柄形式:独立拖拽列 / 整行拖拽,默认 'drag-column'
## Signature
```typescript
handle?: 'drag-column' | 'row';
```
### ondragend
# DragSortConfig.onDragEnd property
拖拽排序结束通知
## Signature
```typescript
onDragEnd?: (info: { fromIndices: number | number[]; toIndex: number; currentIndices: number | number[] }) => void;
```
### showdragicon
# DragSortConfig.showDragIcon property
是否显示拖拽图标,默认 true
## Signature
```typescript
showDragIcon?: boolean;
```
references/interfaces/FlexItemProps.md
# FlexItemProps interface
Flex 子项:Flex 布局中的单个子元素
## Signature
```typescript
interface FlexItemProps extends StyleProps
```
**Extends:** [StyleProps](./StyleProps.md)
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[children?](./FlexItemProps.md)
</td><td>
</td><td>
any
</td><td>
_(Optional)_ Child node
</td></tr>
<tr><td>
[flexRatio?](./FlexItemProps.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ Flex ratio (flex grow factor)
</td></tr>
<tr><td>
[onClick?](./FlexItemProps.md)
</td><td>
</td><td>
() => void
</td><td>
_(Optional)_ 点击子项时触发
</td></tr>
</tbody></table>
---
## 属性详情
### children
# FlexItemProps.children property
Child node
## Signature
```typescript
children?: any;
```
### flexratio
# FlexItemProps.flexRatio property
Flex ratio (flex grow factor)
## Signature
```typescript
flexRatio?: number;
```
### onclick
# FlexItemProps.onClick property
点击子项时触发
## Signature
```typescript
onClick?: () => void;
```
references/interfaces/FixedColumnConfig.md
# FixedColumnConfig interface
固定列配置(也可通过 ColumnDef.fixed 逐列声明)
## Signature
```typescript
interface FixedColumnConfig
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[left?](./FixedColumnConfig.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 左侧固定列数
</td></tr>
<tr><td>
[right?](./FixedColumnConfig.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 右侧固定列数
</td></tr>
</tbody></table>
---
## 属性详情
### left
# FixedColumnConfig.left property
左侧固定列数
## Signature
```typescript
left?: number;
```
### right
# FixedColumnConfig.right property
右侧固定列数
## Signature
```typescript
right?: number;
```
references/interfaces/IDMT_BoardItem.md
# IDMT\_BoardItem interface
Board property
## Signature
```typescript
interface IDMT_BoardItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[itemType](./IDMT_BoardItem.md)
</td><td>
`readonly`
</td><td>
[EDMT\_ItemType.BOARD](../enums/EDMT_ItemType.md)
</td><td>
Project type
</td></tr>
<tr><td>
[name](./IDMT_BoardItem.md)
</td><td>
</td><td>
string
</td><td>
Board name
</td></tr>
<tr><td>
[parentProjectUuid](./IDMT_BoardItem.md)
</td><td>
</td><td>
string
</td><td>
UUID of the project it belongs to
</td></tr>
<tr><td>
[pcb](./IDMT_BoardItem.md)
</td><td>
</td><td>
[IDMT\_PcbItem](./IDMT_PcbItem.md)
</td><td>
Subordinate PCB
</td></tr>
<tr><td>
[schematic](./IDMT_BoardItem.md)
</td><td>
</td><td>
[IDMT\_SchematicItem](./IDMT_SchematicItem.md)
</td><td>
Subordinate schematic
</td></tr>
</tbody></table>
---
## 属性详情
### itemtype
# IDMT\_BoardItem.itemType property
Project type
## Signature
```typescript
readonly itemType: EDMT_ItemType.BOARD;
```
### name
# IDMT\_BoardItem.name property
Board name
## Signature
```typescript
name: string;
```
### parentprojectuuid
# IDMT\_BoardItem.parentProjectUuid property
UUID of the project it belongs to
## Signature
```typescript
parentProjectUuid: string;
```
### pcb
# IDMT\_BoardItem.pcb property
Subordinate PCB
## Signature
```typescript
pcb: IDMT_PcbItem;
```
### schematic
# IDMT\_BoardItem.schematic property
Subordinate schematic
## Signature
```typescript
schematic: IDMT_SchematicItem;
```
references/interfaces/GridItemProps.md
# GridItemProps interface
Grid 子项:网格中的单个子元素
## Signature
```typescript
interface GridItemProps extends StyleProps
```
**Extends:** [StyleProps](./StyleProps.md)
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[align?](./GridItemProps.md)
</td><td>
</td><td>
'start' \| 'center' \| 'end' \| 'stretch'
</td><td>
_(Optional)_ Alignment within the cell
</td></tr>
<tr><td>
[children?](./GridItemProps.md)
</td><td>
</td><td>
any
</td><td>
_(Optional)_ Child node
</td></tr>
<tr><td>
[colSpan?](./GridItemProps.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ Column span
</td></tr>
<tr><td>
[rowSpan?](./GridItemProps.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ Row span
</td></tr>
</tbody></table>
---
## 属性详情
### align
# GridItemProps.align property
Alignment within the cell
## Signature
```typescript
align?: 'start' | 'center' | 'end' | 'stretch';
```
### children
# GridItemProps.children property
Child node
## Signature
```typescript
children?: any;
```
### colspan
# GridItemProps.colSpan property
Column span
## Signature
```typescript
colSpan?: number;
```
### rowspan
# GridItemProps.rowSpan property
Row span
## Signature
```typescript
rowSpan?: number;
```
references/interfaces/GridProps.md
# GridProps interface
布局容器:固定列数的网格布局容器
## Signature
```typescript
interface GridProps extends StyleProps
```
**Extends:** [StyleProps](./StyleProps.md)
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[children?](./GridProps.md)
</td><td>
</td><td>
any
</td><td>
_(Optional)_ Child node
</td></tr>
<tr><td>
[colGap?](./GridProps.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ Column gap (pixels)
</td></tr>
<tr><td>
[columns](./GridProps.md)
</td><td>
</td><td>
number \| (number \| string)\[\]
</td><td>
列数(必填)。 - number:等宽 n 列(repeat(n, 1fr)) - number\[\]:数组长度 = 列数,元素 = 各列宽度(像素) - string\[\]:数组长度 = 列数,元素 = 各列宽度(CSS 值,如 '1fr' / 'auto')
</td></tr>
<tr><td>
[rowGap?](./GridProps.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ Row gap (pixels)
</td></tr>
</tbody></table>
---
## 属性详情
### children
# GridProps.children property
Child node
## Signature
```typescript
children?: any;
```
### colgap
# GridProps.colGap property
Column gap (pixels)
## Signature
```typescript
colGap?: number;
```
### columns
# GridProps.columns property
列数(必填)。 - number:等宽 n 列(repeat(n, 1fr)) - number\[\]:数组长度 = 列数,元素 = 各列宽度(像素) - string\[\]:数组长度 = 列数,元素 = 各列宽度(CSS 值,如 '1fr' / 'auto')
## Signature
```typescript
columns: number | (number | string)[];
```
### rowgap
# GridProps.rowGap property
Row gap (pixels)
## Signature
```typescript
rowGap?: number;
```
references/interfaces/IDMT_EditorDocumentItem.md
# IDMT\_EditorDocumentItem interface
Editor document object
## Signature
```typescript
interface IDMT_EditorDocumentItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[documentType](./IDMT_EditorDocumentItem.md)
</td><td>
</td><td>
[EDMT\_EditorDocumentType](../enums/EDMT_EditorDocumentType.md)
</td><td>
Document type
</td></tr>
<tr><td>
[parentLibraryUuid?](./IDMT_EditorDocumentItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Library document UUID of the library it belongs to
</td></tr>
<tr><td>
[parentProjectUuid?](./IDMT_EditorDocumentItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Document UUID of the project it belongs to
</td></tr>
<tr><td>
[tabId](./IDMT_EditorDocumentItem.md)
</td><td>
</td><td>
string
</td><td>
Tab ID of the document
</td></tr>
<tr><td>
[uuid](./IDMT_EditorDocumentItem.md)
</td><td>
</td><td>
string
</td><td>
Document UUID
</td></tr>
</tbody></table>
---
## 属性详情
### documenttype
# IDMT\_EditorDocumentItem.documentType property
Document type
## Signature
```typescript
documentType: EDMT_EditorDocumentType;
```
### parentlibraryuuid
# IDMT\_EditorDocumentItem.parentLibraryUuid property
Library document UUID of the library it belongs to
## Signature
```typescript
parentLibraryUuid?: string;
```
### parentprojectuuid
# IDMT\_EditorDocumentItem.parentProjectUuid property
Document UUID of the project it belongs to
## Signature
```typescript
parentProjectUuid?: string;
```
### tabid
# IDMT\_EditorDocumentItem.tabId property
Tab ID of the document
## Signature
```typescript
tabId: string;
```
### uuid
# IDMT\_EditorDocumentItem.uuid property
Document UUID
## Signature
```typescript
uuid: string;
```
references/interfaces/IDMT_BriefProjectItem.md
# IDMT\_BriefProjectItem interface
Brief project properties
## Signature
```typescript
interface IDMT_BriefProjectItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[folderUuid?](./IDMT_BriefProjectItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ UUID of the folder it belongs to
</td></tr>
<tr><td>
[friendlyName](./IDMT_BriefProjectItem.md)
</td><td>
</td><td>
string
</td><td>
Project friendly name
</td></tr>
<tr><td>
[itemType](./IDMT_BriefProjectItem.md)
</td><td>
`readonly`
</td><td>
[EDMT\_ItemType.PROJECT](../enums/EDMT_ItemType.md) \| [EDMT\_ItemType.CBB\_PROJECT](../enums/EDMT_ItemType.md)
</td><td>
Project type
</td></tr>
<tr><td>
[teamUuid](./IDMT_BriefProjectItem.md)
</td><td>
</td><td>
string
</td><td>
UUID of the team it belongs to
</td></tr>
<tr><td>
[uuid](./IDMT_BriefProjectItem.md)
</td><td>
</td><td>
string
</td><td>
Project UUID
</td></tr>
</tbody></table>
---
## 属性详情
### folderuuid
# IDMT\_BriefProjectItem.folderUuid property
UUID of the folder it belongs to
## Signature
```typescript
folderUuid?: string;
```
### friendlyname
# IDMT\_BriefProjectItem.friendlyName property
Project friendly name
## Signature
```typescript
friendlyName: string;
```
### itemtype
# IDMT\_BriefProjectItem.itemType property
Project type
## Signature
```typescript
readonly itemType: EDMT_ItemType.PROJECT | EDMT_ItemType.CBB_PROJECT;
```
### teamuuid
# IDMT\_BriefProjectItem.teamUuid property
UUID of the team it belongs to
## Signature
```typescript
teamUuid: string;
```
### uuid
# IDMT\_BriefProjectItem.uuid property
Project UUID
## Signature
```typescript
uuid: string;
```
references/interfaces/FlexProps.md
# FlexProps interface
布局容器:灵活的 Flex 布局容器
## Signature
```typescript
interface FlexProps extends StyleProps
```
**Extends:** [StyleProps](./StyleProps.md)
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[alignX?](./FlexProps.md)
</td><td>
</td><td>
'start' \| 'center' \| 'end'
</td><td>
_(Optional)_ Main axis alignment (horizontal)
</td></tr>
<tr><td>
[alignY?](./FlexProps.md)
</td><td>
</td><td>
'start' \| 'center' \| 'end' \| 'stretch'
</td><td>
_(Optional)_ Cross axis alignment (vertical)
</td></tr>
<tr><td>
[children?](./FlexProps.md)
</td><td>
</td><td>
any
</td><td>
_(Optional)_ Child node
</td></tr>
<tr><td>
[classes?](./FlexProps.md)
</td><td>
</td><td>
string\[\]
</td><td>
_(Optional)_ List of additional style class names
</td></tr>
<tr><td>
[direction?](./FlexProps.md)
</td><td>
</td><td>
'column' \| 'column-reverse' \| 'row' \| 'row-reverse'
</td><td>
_(Optional)_ Main axis direction: row (horizontal) / column (vertical, including reverse)
</td></tr>
<tr><td>
[gap?](./FlexProps.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ Gap between child elements (pixels)
</td></tr>
<tr><td>
[onClick?](./FlexProps.md)
</td><td>
</td><td>
() => void
</td><td>
_(Optional)_ 点击容器时触发
</td></tr>
</tbody></table>
---
## 属性详情
### alignx
# FlexProps.alignX property
Main axis alignment (horizontal)
## Signature
```typescript
alignX?: 'start' | 'center' | 'end';
```
### aligny
# FlexProps.alignY property
Cross axis alignment (vertical)
## Signature
```typescript
alignY?: 'start' | 'center' | 'end' | 'stretch';
```
### children
# FlexProps.children property
Child node
## Signature
```typescript
children?: any;
```
### classes
# FlexProps.classes property
List of additional style class names
## Signature
```typescript
classes?: string[];
```
### direction
# FlexProps.direction property
Main axis direction: row (horizontal) / column (vertical, including reverse)
## Signature
```typescript
direction?: 'column' | 'column-reverse' | 'row' | 'row-reverse';
```
### gap
# FlexProps.gap property
Gap between child elements (pixels)
## Signature
```typescript
gap?: number;
```
### onclick
# FlexProps.onClick property
点击容器时触发
## Signature
```typescript
onClick?: () => void;
```
references/interfaces/IDMT_EditorTabItem.md
# IDMT\_EditorTabItem interface
Editor tab
## Signature
```typescript
interface IDMT_EditorTabItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[documentType](./IDMT_EditorTabItem.md)
</td><td>
</td><td>
[EDMT\_EditorDocumentType](../enums/EDMT_EditorDocumentType.md)
</td><td>
Document type
</td></tr>
<tr><td>
[draggable](./IDMT_EditorTabItem.md)
</td><td>
</td><td>
boolean
</td><td>
Whether the tab is draggable
</td></tr>
<tr><td>
[isAbleDelete](./IDMT_EditorTabItem.md)
</td><td>
</td><td>
boolean
</td><td>
Whether the tab can be closed
</td></tr>
<tr><td>
[tabId](./IDMT_EditorTabItem.md)
</td><td>
</td><td>
string
</td><td>
Tab ID
</td></tr>
<tr><td>
[title](./IDMT_EditorTabItem.md)
</td><td>
</td><td>
string
</td><td>
Tab title
</td></tr>
</tbody></table>
---
## 属性详情
### documenttype
# IDMT\_EditorTabItem.documentType property
Document type
## Signature
```typescript
documentType: EDMT_EditorDocumentType;
```
### draggable
# IDMT\_EditorTabItem.draggable property
Whether the tab is draggable
## Signature
```typescript
draggable: boolean;
```
### isabledelete
# IDMT\_EditorTabItem.isAbleDelete property
Whether the tab can be closed
## Signature
```typescript
isAbleDelete: boolean;
```
### tabid
# IDMT\_EditorTabItem.tabId property
Tab ID
## Signature
```typescript
tabId: string;
```
### title
# IDMT\_EditorTabItem.title property
Tab title
## Signature
```typescript
title: string;
```
references/interfaces/IDMT_EditorSplitScreenItem.md
# IDMT\_EditorSplitScreenItem interface
Editor split screen property
## Signature
```typescript
interface IDMT_EditorSplitScreenItem
```
## Remarks
[tabs](./IDMT_EditorSplitScreenItem.md) and [children](./IDMT_EditorSplitScreenItem.md) do not exist at the same time. When [tabs](./IDMT_EditorSplitScreenItem.md) exists, it means there is no split screen, and [children](./IDMT_EditorSplitScreenItem.md) will be `undefined`
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[children?](./IDMT_EditorSplitScreenItem.md)
</td><td>
</td><td>
Array<[IDMT\_EditorSplitScreenItem](./IDMT_EditorSplitScreenItem.md)<!-- -->>
</td><td>
_(Optional)_ Child split screens
</td></tr>
<tr><td>
[direction?](./IDMT_EditorSplitScreenItem.md)
</td><td>
</td><td>
[EDMT\_EditorSplitScreenDirection](../enums/EDMT_EditorSplitScreenDirection.md)
</td><td>
_(Optional)_ Split screen direction
</td></tr>
<tr><td>
[fatherId?](./IDMT_EditorSplitScreenItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Parent split screen ID
</td></tr>
<tr><td>
[id](./IDMT_EditorSplitScreenItem.md)
</td><td>
</td><td>
string
</td><td>
Split screen ID
</td></tr>
<tr><td>
[tabs?](./IDMT_EditorSplitScreenItem.md)
</td><td>
</td><td>
Array<[IDMT\_EditorTabItem](./IDMT_EditorTabItem.md)<!-- -->>
</td><td>
_(Optional)_ Split screen in tab
</td></tr>
</tbody></table>
---
## 属性详情
### children
# IDMT\_EditorSplitScreenItem.children property
Child split screens
## Signature
```typescript
children?: Array<IDMT_EditorSplitScreenItem>;
```
### direction
# IDMT\_EditorSplitScreenItem.direction property
Split screen direction
## Signature
```typescript
direction?: EDMT_EditorSplitScreenDirection;
```
### fatherid
# IDMT\_EditorSplitScreenItem.fatherId property
Parent split screen ID
## Signature
```typescript
fatherId?: string;
```
### id
# IDMT\_EditorSplitScreenItem.id property
Split screen ID
## Signature
```typescript
id: string;
```
### tabs
# IDMT\_EditorSplitScreenItem.tabs property
Split screen in tab
## Signature
```typescript
tabs?: Array<IDMT_EditorTabItem>;
```
references/interfaces/IDMT_FolderItem.md
# IDMT\_FolderItem interface
Folder property
## Signature
```typescript
interface IDMT_FolderItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[childrenFoldersUuid?](./IDMT_FolderItem.md)
</td><td>
</td><td>
Array<string>
</td><td>
_(Optional)_ List of child folder UUIDs
</td></tr>
<tr><td>
[description?](./IDMT_FolderItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Folder description
</td></tr>
<tr><td>
[itemType](./IDMT_FolderItem.md)
</td><td>
`readonly`
</td><td>
[EDMT\_ItemType.FOLDER](../enums/EDMT_ItemType.md)
</td><td>
Project type
</td></tr>
<tr><td>
[name](./IDMT_FolderItem.md)
</td><td>
</td><td>
string
</td><td>
Folder name
</td></tr>
<tr><td>
[parentFolderUuid](./IDMT_FolderItem.md)
</td><td>
</td><td>
string
</td><td>
Parent folder UUID
</td></tr>
<tr><td>
[teamUuid](./IDMT_FolderItem.md)
</td><td>
</td><td>
string
</td><td>
UUID of the team it belongs to
</td></tr>
<tr><td>
[uuid](./IDMT_FolderItem.md)
</td><td>
</td><td>
string
</td><td>
Folder UUID
</td></tr>
</tbody></table>
---
## 属性详情
### childrenfoldersuuid
# IDMT\_FolderItem.childrenFoldersUuid property
List of child folder UUIDs
## Signature
```typescript
childrenFoldersUuid?: Array<string>;
```
### description
# IDMT\_FolderItem.description property
Folder description
## Signature
```typescript
description?: string;
```
### itemtype
# IDMT\_FolderItem.itemType property
Project type
## Signature
```typescript
readonly itemType: EDMT_ItemType.FOLDER;
```
### name
# IDMT\_FolderItem.name property
Folder name
## Signature
```typescript
name: string;
```
### parentfolderuuid
# IDMT\_FolderItem.parentFolderUuid property
Parent folder UUID
## Signature
```typescript
parentFolderUuid: string;
```
### teamuuid
# IDMT\_FolderItem.teamUuid property
UUID of the team it belongs to
## Signature
```typescript
teamUuid: string;
```
### uuid
# IDMT\_FolderItem.uuid property
Folder UUID
## Signature
```typescript
uuid: string;
```
references/interfaces/IDMT_PanelItem.md
# IDMT\_PanelItem interface
Panel property
## Signature
```typescript
interface IDMT_PanelItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[itemType](./IDMT_PanelItem.md)
</td><td>
`readonly`
</td><td>
[EDMT\_ItemType.PANEL](../enums/EDMT_ItemType.md)
</td><td>
Project type
</td></tr>
<tr><td>
[name](./IDMT_PanelItem.md)
</td><td>
</td><td>
string
</td><td>
Panel name
</td></tr>
<tr><td>
[parentProjectUuid](./IDMT_PanelItem.md)
</td><td>
</td><td>
string
</td><td>
UUID of the project it belongs to
</td></tr>
<tr><td>
[uuid](./IDMT_PanelItem.md)
</td><td>
</td><td>
string
</td><td>
Panel UUID
</td></tr>
</tbody></table>
---
## 属性详情
### itemtype
# IDMT\_PanelItem.itemType property
Project type
## Signature
```typescript
readonly itemType: EDMT_ItemType.PANEL;
```
### name
# IDMT\_PanelItem.name property
Panel name
## Signature
```typescript
name: string;
```
### parentprojectuuid
# IDMT\_PanelItem.parentProjectUuid property
UUID of the project it belongs to
## Signature
```typescript
parentProjectUuid: string;
```
### uuid
# IDMT\_PanelItem.uuid property
Panel UUID
## Signature
```typescript
uuid: string;
```
references/interfaces/IDMT_PcbItem.md
# IDMT\_PcbItem interface
PCB property
## Signature
```typescript
interface IDMT_PcbItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[itemType](./IDMT_PcbItem.md)
</td><td>
`readonly`
</td><td>
[EDMT\_ItemType.PCB](../enums/EDMT_ItemType.md) \| [EDMT\_ItemType.CBB\_PCB](../enums/EDMT_ItemType.md)
</td><td>
Project type
</td></tr>
<tr><td>
[name](./IDMT_PcbItem.md)
</td><td>
</td><td>
string
</td><td>
PCB name
</td></tr>
<tr><td>
[parentBoardName?](./IDMT_PcbItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Name of the board it belongs to
</td></tr>
<tr><td>
[parentProjectUuid](./IDMT_PcbItem.md)
</td><td>
</td><td>
string
</td><td>
UUID of the project it belongs to
</td></tr>
<tr><td>
[uuid](./IDMT_PcbItem.md)
</td><td>
</td><td>
string
</td><td>
PCB UUID
</td></tr>
</tbody></table>
---
## 属性详情
### itemtype
# IDMT\_PcbItem.itemType property
Project type
## Signature
```typescript
readonly itemType: EDMT_ItemType.PCB | EDMT_ItemType.CBB_PCB;
```
### name
# IDMT\_PcbItem.name property
PCB name
## Signature
```typescript
name: string;
```
### parentboardname
# IDMT\_PcbItem.parentBoardName property
Name of the board it belongs to
## Signature
```typescript
parentBoardName?: string;
```
### parentprojectuuid
# IDMT\_PcbItem.parentProjectUuid property
UUID of the project it belongs to
## Signature
```typescript
parentProjectUuid: string;
```
### uuid
# IDMT\_PcbItem.uuid property
PCB UUID
## Signature
```typescript
uuid: string;
```
references/interfaces/IDMT_IndicatorMarkerShape.md
# IDMT\_IndicatorMarkerShape interface
Indicator marker shape
## Signature
```typescript
interface IDMT_IndicatorMarkerShape
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[angle?](./IDMT_IndicatorMarkerShape.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 圆弧:角度
</td></tr>
<tr><td>
[bottom?](./IDMT_IndicatorMarkerShape.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 矩形:下 Y
</td></tr>
<tr><td>
[endX?](./IDMT_IndicatorMarkerShape.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 线段 \| 圆弧:终止点 X
</td></tr>
<tr><td>
[endY?](./IDMT_IndicatorMarkerShape.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 线段 \| 圆弧:终止点 Y
</td></tr>
<tr><td>
[left?](./IDMT_IndicatorMarkerShape.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 矩形:左 X
</td></tr>
<tr><td>
[r?](./IDMT_IndicatorMarkerShape.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 圆形:半径
</td></tr>
<tr><td>
[right?](./IDMT_IndicatorMarkerShape.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 矩形:右 X
</td></tr>
<tr><td>
[startX?](./IDMT_IndicatorMarkerShape.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 线段 \| 圆弧:起始点 X
</td></tr>
<tr><td>
[startY?](./IDMT_IndicatorMarkerShape.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 线段 \| 圆弧:起始点 Y
</td></tr>
<tr><td>
[top?](./IDMT_IndicatorMarkerShape.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 矩形:上 Y
</td></tr>
<tr><td>
[type](./IDMT_IndicatorMarkerShape.md)
</td><td>
</td><td>
[EDMT\_IndicatorMarkerType](../enums/EDMT_IndicatorMarkerType.md)
</td><td>
Type
</td></tr>
<tr><td>
[x?](./IDMT_IndicatorMarkerShape.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 点:坐标 X
圆形:圆心 X
</td></tr>
<tr><td>
[y?](./IDMT_IndicatorMarkerShape.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 点:坐标 Y
圆形:圆心 Y
</td></tr>
</tbody></table>
---
## 属性详情
### angle
# IDMT\_IndicatorMarkerShape.angle property
圆弧:角度
## Signature
```typescript
angle?: number;
```
### bottom
# IDMT\_IndicatorMarkerShape.bottom property
矩形:下 Y
## Signature
```typescript
bottom?: number;
```
### endx
# IDMT\_IndicatorMarkerShape.endX property
线段 \| 圆弧:终止点 X
## Signature
```typescript
endX?: number;
```
### endy
# IDMT\_IndicatorMarkerShape.endY property
线段 \| 圆弧:终止点 Y
## Signature
```typescript
endY?: number;
```
### left
# IDMT\_IndicatorMarkerShape.left property
矩形:左 X
## Signature
```typescript
left?: number;
```
### r
# IDMT\_IndicatorMarkerShape.r property
圆形:半径
## Signature
```typescript
r?: number;
```
### right
# IDMT\_IndicatorMarkerShape.right property
矩形:右 X
## Signature
```typescript
right?: number;
```
### startx
# IDMT\_IndicatorMarkerShape.startX property
线段 \| 圆弧:起始点 X
## Signature
```typescript
startX?: number;
```
### starty
# IDMT\_IndicatorMarkerShape.startY property
线段 \| 圆弧:起始点 Y
## Signature
```typescript
startY?: number;
```
### top
# IDMT\_IndicatorMarkerShape.top property
矩形:上 Y
## Signature
```typescript
top?: number;
```
### type
# IDMT\_IndicatorMarkerShape.type property
Type
## Signature
```typescript
type: EDMT_IndicatorMarkerType;
```
### x
# IDMT\_IndicatorMarkerShape.x property
点:坐标 X
圆形:圆心 X
## Signature
```typescript
x?: number;
```
### y
# IDMT\_IndicatorMarkerShape.y property
点:坐标 Y
圆形:圆心 Y
## Signature
```typescript
y?: number;
```
references/interfaces/IDMT_SchematicPageItem.md
# IDMT\_SchematicPageItem interface
Schematic sheet property
## Signature
```typescript
interface IDMT_SchematicPageItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[itemType](./IDMT_SchematicPageItem.md)
</td><td>
`readonly`
</td><td>
[EDMT\_ItemType.SCHEMATIC\_PAGE](../enums/EDMT_ItemType.md)
</td><td>
Project type
</td></tr>
<tr><td>
[name](./IDMT_SchematicPageItem.md)
</td><td>
</td><td>
string
</td><td>
Schematic sheet name
</td></tr>
<tr><td>
[parentSchematicUuid](./IDMT_SchematicPageItem.md)
</td><td>
</td><td>
string
</td><td>
UUID of the schematic it belongs to
</td></tr>
<tr><td>
[showTitleBlock](./IDMT_SchematicPageItem.md)
</td><td>
</td><td>
boolean
</td><td>
Whether to show the title block
</td></tr>
<tr><td>
[titleBlockData](./IDMT_SchematicPageItem.md)
</td><td>
</td><td>
Record<string, { showTitle: boolean; showValue: boolean; value: any }>
</td><td>
Title block data
</td></tr>
<tr><td>
[uuid](./IDMT_SchematicPageItem.md)
</td><td>
</td><td>
string
</td><td>
Schematic sheet UUID
</td></tr>
</tbody></table>
---
## 属性详情
### itemtype
# IDMT\_SchematicPageItem.itemType property
Project type
## Signature
```typescript
readonly itemType: EDMT_ItemType.SCHEMATIC_PAGE;
```
### name
# IDMT\_SchematicPageItem.name property
Schematic sheet name
## Signature
```typescript
name: string;
```
### parentschematicuuid
# IDMT\_SchematicPageItem.parentSchematicUuid property
UUID of the schematic it belongs to
## Signature
```typescript
parentSchematicUuid: string;
```
### showtitleblock
# IDMT\_SchematicPageItem.showTitleBlock property
Whether to show the title block
## Signature
```typescript
showTitleBlock: boolean;
```
### titleblockdata
# IDMT\_SchematicPageItem.titleBlockData property
Title block data
## Signature
```typescript
titleBlockData: Record<string, { showTitle: boolean; showValue: boolean; value: any }>;
```
### uuid
# IDMT\_SchematicPageItem.uuid property
Schematic sheet UUID
## Signature
```typescript
uuid: string;
```
references/interfaces/IDMT_ProjectItem.md
# IDMT\_ProjectItem interface
Project property
## Signature
```typescript
interface IDMT_ProjectItem extends IDMT_BriefProjectItem
```
**Extends:** [IDMT\_BriefProjectItem](./IDMT_BriefProjectItem.md)
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[collaborationMode?](./IDMT_ProjectItem.md)
</td><td>
</td><td>
[EDMT\_ProjectCollaborationMode](../enums/EDMT_ProjectCollaborationMode.md)
</td><td>
_(Optional)_ Project collaboration mode
</td></tr>
<tr><td>
[data](./IDMT_ProjectItem.md)
</td><td>
</td><td>
Array<[IDMT\_BoardItem](./IDMT_BoardItem.md) \| [IDMT\_SchematicItem](./IDMT_SchematicItem.md) \| [IDMT\_PcbItem](./IDMT_PcbItem.md) \| [IDMT\_PanelItem](./IDMT_PanelItem.md)<!-- -->>
</td><td>
Project in document data
</td></tr>
<tr><td>
[description?](./IDMT_ProjectItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Description
</td></tr>
<tr><td>
[name](./IDMT_ProjectItem.md)
</td><td>
</td><td>
string
</td><td>
Project link name
</td></tr>
</tbody></table>
---
## 属性详情
### collaborationmode
# IDMT\_ProjectItem.collaborationMode property
Project collaboration mode
## Signature
```typescript
collaborationMode?: EDMT_ProjectCollaborationMode;
```
### data
# IDMT\_ProjectItem.data property
Project in document data
## Signature
```typescript
data: Array<IDMT_BoardItem | IDMT_SchematicItem | IDMT_PcbItem | IDMT_PanelItem>;
```
### description
# IDMT\_ProjectItem.description property
Description
## Signature
```typescript
description?: string;
```
### name
# IDMT\_ProjectItem.name property
Project link name
## Signature
```typescript
name: string;
```
references/interfaces/IDesignPortal.md
# IDesignPortal interface
Component tree operation contract.
## Signature
```typescript
interface IDesignPortal<T extends keyof ComponentPropsMap = keyof ComponentPropsMap>
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[createComponent](./IDesignPortal.md)
</td><td>
</td><td>
(handle: string, type: T, props: [ComponentPropsMap](./ComponentPropsMap.md)<!-- -->\[T\], eventDispatcher: (ev: any) => void, parent?: string) => void
</td><td>
</td></tr>
<tr><td>
[detachComponent](./IDesignPortal.md)
</td><td>
</td><td>
(handle: string) => void
</td><td>
</td></tr>
<tr><td>
[updateComponent](./IDesignPortal.md)
</td><td>
</td><td>
(handle: string, type: T, props: [ComponentPropsMap](./ComponentPropsMap.md)<!-- -->\[T\], eventDispatcher: (ev: any) => void) => void
</td><td>
</td></tr>
</tbody></table>
---
## 属性详情
### createcomponent
# IDesignPortal.createComponent property
## Signature
```typescript
createComponent: (handle: string, type: T, props: ComponentPropsMap[T], eventDispatcher: (ev: any) => void, parent?: string) => void;
```
### detachcomponent
# IDesignPortal.detachComponent property
## Signature
```typescript
detachComponent: (handle: string) => void;
```
### updatecomponent
# IDesignPortal.updateComponent property
## Signature
```typescript
updateComponent: (handle: string, type: T, props: ComponentPropsMap[T], eventDispatcher: (ev: any) => void) => void;
```
references/interfaces/ILIB_3DModelItem.md
# ILIB\_3DModelItem interface
3D model property
## Signature
```typescript
interface ILIB_3DModelItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[classification?](./ILIB_3DModelItem.md)
</td><td>
</td><td>
[ILIB\_ClassificationIndex](./ILIB_ClassificationIndex.md) \| Array<string>
</td><td>
_(Optional)_ Classification
</td></tr>
<tr><td>
[description?](./ILIB_3DModelItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Description
</td></tr>
<tr><td>
[libraryType](./ILIB_3DModelItem.md)
</td><td>
`readonly`
</td><td>
[ELIB\_LibraryType.MODEL](../enums/ELIB_LibraryType.md)
</td><td>
Library type
</td></tr>
<tr><td>
[libraryUuid](./ILIB_3DModelItem.md)
</td><td>
</td><td>
string
</td><td>
UUID of the library it belongs to
</td></tr>
<tr><td>
[name](./ILIB_3DModelItem.md)
</td><td>
</td><td>
string
</td><td>
3D model name
</td></tr>
<tr><td>
[uuid](./ILIB_3DModelItem.md)
</td><td>
</td><td>
string
</td><td>
3D model UUID
</td></tr>
</tbody></table>
---
## 属性详情
### classification
# ILIB\_3DModelItem.classification property
Classification
## Signature
```typescript
classification?: ILIB_ClassificationIndex | Array<string>;
```
### description
# ILIB\_3DModelItem.description property
Description
## Signature
```typescript
description?: string;
```
### librarytype
# ILIB\_3DModelItem.libraryType property
Library type
## Signature
```typescript
readonly libraryType: ELIB_LibraryType.MODEL;
```
### libraryuuid
# ILIB\_3DModelItem.libraryUuid property
UUID of the library it belongs to
## Signature
```typescript
libraryUuid: string;
```
### name
# ILIB\_3DModelItem.name property
3D model name
## Signature
```typescript
name: string;
```
### uuid
# ILIB\_3DModelItem.uuid property
3D model UUID
## Signature
```typescript
uuid: string;
```
references/interfaces/IDMT_WorkspaceItem.md
# IDMT\_WorkspaceItem interface
Workspace properties
## Signature
```typescript
interface IDMT_WorkspaceItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[itemType](./IDMT_WorkspaceItem.md)
</td><td>
`readonly`
</td><td>
[EDMT\_ItemType.WORKSPACE](../enums/EDMT_ItemType.md)
</td><td>
Project type
</td></tr>
<tr><td>
[name](./IDMT_WorkspaceItem.md)
</td><td>
</td><td>
string
</td><td>
Workspace name
</td></tr>
<tr><td>
[uuid](./IDMT_WorkspaceItem.md)
</td><td>
</td><td>
string
</td><td>
Workspace UUID
</td></tr>
</tbody></table>
---
## 属性详情
### itemtype
# IDMT\_WorkspaceItem.itemType property
Project type
## Signature
```typescript
readonly itemType: EDMT_ItemType.WORKSPACE;
```
### name
# IDMT\_WorkspaceItem.name property
Workspace name
## Signature
```typescript
name: string;
```
### uuid
# IDMT\_WorkspaceItem.uuid property
Workspace UUID
## Signature
```typescript
uuid: string;
```
references/interfaces/IDMT_TeamItem.md
# IDMT\_TeamItem interface
Team properties
## Signature
```typescript
interface IDMT_TeamItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[identity](./IDMT_TeamItem.md)
</td><td>
</td><td>
number
</td><td>
ID of the current user's identity (permission group) in the team
</td></tr>
<tr><td>
[itemType](./IDMT_TeamItem.md)
</td><td>
`readonly`
</td><td>
[EDMT\_ItemType.TEAM](../enums/EDMT_ItemType.md)
</td><td>
Project type
</td></tr>
<tr><td>
[name](./IDMT_TeamItem.md)
</td><td>
</td><td>
string
</td><td>
Team name
</td></tr>
<tr><td>
[uuid](./IDMT_TeamItem.md)
</td><td>
</td><td>
string
</td><td>
Team UUID
</td></tr>
</tbody></table>
---
## 属性详情
### identity
# IDMT\_TeamItem.identity property
ID of the current user's identity (permission group) in the team
## Signature
```typescript
identity: number;
```
### itemtype
# IDMT\_TeamItem.itemType property
Project type
## Signature
```typescript
readonly itemType: EDMT_ItemType.TEAM;
```
### name
# IDMT\_TeamItem.name property
Team name
## Signature
```typescript
name: string;
```
### uuid
# IDMT\_TeamItem.uuid property
Team UUID
## Signature
```typescript
uuid: string;
```
references/interfaces/IDMT_SchematicItem.md
# IDMT\_SchematicItem interface
Schematic property
## Signature
```typescript
interface IDMT_SchematicItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[cbbSymbol?](./IDMT_SchematicItem.md)
</td><td>
</td><td>
[ILIB\_SymbolItem](./ILIB_SymbolItem.md)
</td><td>
_(Optional)_ The module symbol associated with the reuse block schematic
</td></tr>
<tr><td>
[itemType](./IDMT_SchematicItem.md)
</td><td>
`readonly`
</td><td>
[EDMT\_ItemType.SCHEMATIC](../enums/EDMT_ItemType.md) \| [EDMT\_ItemType.CBB\_SCHEMATIC](../enums/EDMT_ItemType.md)
</td><td>
Project type
</td></tr>
<tr><td>
[name](./IDMT_SchematicItem.md)
</td><td>
</td><td>
string
</td><td>
Schematic name
</td></tr>
<tr><td>
[page](./IDMT_SchematicItem.md)
</td><td>
</td><td>
Array<[IDMT\_SchematicPageItem](./IDMT_SchematicPageItem.md)<!-- -->>
</td><td>
Subordinate schematic sheet
</td></tr>
<tr><td>
[parentBoardName?](./IDMT_SchematicItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Name of the board it belongs to
</td></tr>
<tr><td>
[parentProjectUuid](./IDMT_SchematicItem.md)
</td><td>
</td><td>
string
</td><td>
UUID of the project it belongs to
</td></tr>
<tr><td>
[uuid](./IDMT_SchematicItem.md)
</td><td>
</td><td>
string
</td><td>
Schematic UUID
</td></tr>
</tbody></table>
---
## 属性详情
### cbbsymbol
# IDMT\_SchematicItem.cbbSymbol property
The module symbol associated with the reuse block schematic
## Signature
```typescript
cbbSymbol?: ILIB_SymbolItem;
```
### itemtype
# IDMT\_SchematicItem.itemType property
Project type
## Signature
```typescript
readonly itemType: EDMT_ItemType.SCHEMATIC | EDMT_ItemType.CBB_SCHEMATIC;
```
### name
# IDMT\_SchematicItem.name property
Schematic name
## Signature
```typescript
name: string;
```
### page
# IDMT\_SchematicItem.page property
Subordinate schematic sheet
## Signature
```typescript
page: Array<IDMT_SchematicPageItem>;
```
### parentboardname
# IDMT\_SchematicItem.parentBoardName property
Name of the board it belongs to
## Signature
```typescript
parentBoardName?: string;
```
### parentprojectuuid
# IDMT\_SchematicItem.parentProjectUuid property
UUID of the project it belongs to
## Signature
```typescript
parentProjectUuid: string;
```
### uuid
# IDMT\_SchematicItem.uuid property
Schematic UUID
## Signature
```typescript
uuid: string;
```
references/interfaces/ILIB_3DModelSearchItem.md
# ILIB\_3DModelSearchItem interface
Searched 3D model properties
## Signature
```typescript
interface ILIB_3DModelSearchItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[ascription](./ILIB_3DModelSearchItem.md)
</td><td>
</td><td>
string
</td><td>
Ownership
</td></tr>
<tr><td>
[classification?](./ILIB_3DModelSearchItem.md)
</td><td>
</td><td>
[ILIB\_ClassificationIndex](./ILIB_ClassificationIndex.md) \| Array<string>
</td><td>
_(Optional)_ Classification
</td></tr>
<tr><td>
[description?](./ILIB_3DModelSearchItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Description
</td></tr>
<tr><td>
[lastModifiedBy](./ILIB_3DModelSearchItem.md)
</td><td>
</td><td>
string
</td><td>
Last modifier
</td></tr>
<tr><td>
[libraryUuid](./ILIB_3DModelSearchItem.md)
</td><td>
</td><td>
string
</td><td>
UUID of the library it belongs to
</td></tr>
<tr><td>
[name](./ILIB_3DModelSearchItem.md)
</td><td>
</td><td>
string
</td><td>
3D model name
</td></tr>
<tr><td>
[ordinal](./ILIB_3DModelSearchItem.md)
</td><td>
</td><td>
number
</td><td>
Sorting
</td></tr>
<tr><td>
[updateTimestamp](./ILIB_3DModelSearchItem.md)
</td><td>
</td><td>
number
</td><td>
Update timestamp
</td></tr>
<tr><td>
[uuid](./ILIB_3DModelSearchItem.md)
</td><td>
</td><td>
string
</td><td>
3D model UUID
</td></tr>
</tbody></table>
---
## 属性详情
### ascription
# ILIB\_3DModelSearchItem.ascription property
Ownership
## Signature
```typescript
ascription: string;
```
### classification
# ILIB\_3DModelSearchItem.classification property
Classification
## Signature
```typescript
classification?: ILIB_ClassificationIndex | Array<string>;
```
### description
# ILIB\_3DModelSearchItem.description property
Description
## Signature
```typescript
description?: string;
```
### lastmodifiedby
# ILIB\_3DModelSearchItem.lastModifiedBy property
Last modifier
## Signature
```typescript
lastModifiedBy: string;
```
### libraryuuid
# ILIB\_3DModelSearchItem.libraryUuid property
UUID of the library it belongs to
## Signature
```typescript
libraryUuid: string;
```
### name
# ILIB\_3DModelSearchItem.name property
3D model name
## Signature
```typescript
name: string;
```
### ordinal
# ILIB\_3DModelSearchItem.ordinal property
Sorting
## Signature
```typescript
ordinal: number;
```
### updatetimestamp
# ILIB\_3DModelSearchItem.updateTimestamp property
Update timestamp
## Signature
```typescript
updateTimestamp: number;
```
### uuid
# ILIB\_3DModelSearchItem.uuid property
3D model UUID
## Signature
```typescript
uuid: string;
```
references/interfaces/ILIB_CbbSearchItem.md
# ILIB\_CbbSearchItem interface
Searched reuse block properties
## Signature
```typescript
interface ILIB_CbbSearchItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[ascription](./ILIB_CbbSearchItem.md)
</td><td>
</td><td>
string
</td><td>
Ownership
</td></tr>
<tr><td>
[classification?](./ILIB_CbbSearchItem.md)
</td><td>
</td><td>
[ILIB\_ClassificationIndex](./ILIB_ClassificationIndex.md) \| Array<string>
</td><td>
_(Optional)_ Classification
</td></tr>
<tr><td>
[description?](./ILIB_CbbSearchItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Description
</td></tr>
<tr><td>
[lastModifiedBy](./ILIB_CbbSearchItem.md)
</td><td>
</td><td>
string
</td><td>
Last modifier
</td></tr>
<tr><td>
[libraryUuid](./ILIB_CbbSearchItem.md)
</td><td>
</td><td>
string
</td><td>
UUID of the library it belongs to
</td></tr>
<tr><td>
[name](./ILIB_CbbSearchItem.md)
</td><td>
</td><td>
string
</td><td>
Reuse block name
</td></tr>
<tr><td>
[ordinal](./ILIB_CbbSearchItem.md)
</td><td>
</td><td>
number
</td><td>
Sorting
</td></tr>
<tr><td>
[updateTimestamp](./ILIB_CbbSearchItem.md)
</td><td>
</td><td>
number
</td><td>
Update timestamp
</td></tr>
<tr><td>
[uuid](./ILIB_CbbSearchItem.md)
</td><td>
</td><td>
string
</td><td>
Reuse block UUID
</td></tr>
</tbody></table>
---
## 属性详情
### ascription
# ILIB\_CbbSearchItem.ascription property
Ownership
## Signature
```typescript
ascription: string;
```
### classification
# ILIB\_CbbSearchItem.classification property
Classification
## Signature
```typescript
classification?: ILIB_ClassificationIndex | Array<string>;
```
### description
# ILIB\_CbbSearchItem.description property
Description
## Signature
```typescript
description?: string;
```
### lastmodifiedby
# ILIB\_CbbSearchItem.lastModifiedBy property
Last modifier
## Signature
```typescript
lastModifiedBy: string;
```
### libraryuuid
# ILIB\_CbbSearchItem.libraryUuid property
UUID of the library it belongs to
## Signature
```typescript
libraryUuid: string;
```
### name
# ILIB\_CbbSearchItem.name property
Reuse block name
## Signature
```typescript
name: string;
```
### ordinal
# ILIB\_CbbSearchItem.ordinal property
Sorting
## Signature
```typescript
ordinal: number;
```
### updatetimestamp
# ILIB\_CbbSearchItem.updateTimestamp property
Update timestamp
## Signature
```typescript
updateTimestamp: number;
```
### uuid
# ILIB\_CbbSearchItem.uuid property
Reuse block UUID
## Signature
```typescript
uuid: string;
```
references/interfaces/ILIB_CbbItem.md
# ILIB\_CbbItem interface
Reuse block property
## Signature
```typescript
interface ILIB_CbbItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[boards](./ILIB_CbbItem.md)
</td><td>
</td><td>
Array<[IDMT\_BoardItem](./IDMT_BoardItem.md)<!-- -->>
</td><td>
Subordinate boards
</td></tr>
<tr><td>
[classification?](./ILIB_CbbItem.md)
</td><td>
</td><td>
[ILIB\_ClassificationIndex](./ILIB_ClassificationIndex.md) \| Array<string>
</td><td>
_(Optional)_ Classification
</td></tr>
<tr><td>
[description?](./ILIB_CbbItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Description
</td></tr>
<tr><td>
[libraryType](./ILIB_CbbItem.md)
</td><td>
`readonly`
</td><td>
[ELIB\_LibraryType.CBB](../enums/ELIB_LibraryType.md)
</td><td>
Library type
</td></tr>
<tr><td>
[libraryUuid](./ILIB_CbbItem.md)
</td><td>
</td><td>
string
</td><td>
UUID of the library it belongs to
</td></tr>
<tr><td>
[name](./ILIB_CbbItem.md)
</td><td>
</td><td>
string
</td><td>
Reuse block name
</td></tr>
<tr><td>
[uuid](./ILIB_CbbItem.md)
</td><td>
</td><td>
string
</td><td>
Reuse block UUID
</td></tr>
</tbody></table>
---
## 属性详情
### boards
# ILIB\_CbbItem.boards property
Subordinate boards
## Signature
```typescript
boards: Array<IDMT_BoardItem>;
```
### classification
# ILIB\_CbbItem.classification property
Classification
## Signature
```typescript
classification?: ILIB_ClassificationIndex | Array<string>;
```
### description
# ILIB\_CbbItem.description property
Description
## Signature
```typescript
description?: string;
```
### librarytype
# ILIB\_CbbItem.libraryType property
Library type
## Signature
```typescript
readonly libraryType: ELIB_LibraryType.CBB;
```
### libraryuuid
# ILIB\_CbbItem.libraryUuid property
UUID of the library it belongs to
## Signature
```typescript
libraryUuid: string;
```
### name
# ILIB\_CbbItem.name property
Reuse block name
## Signature
```typescript
name: string;
```
### uuid
# ILIB\_CbbItem.uuid property
Reuse block UUID
## Signature
```typescript
uuid: string;
```
references/interfaces/ILIB_ClassificationNode.md
# ILIB\_ClassificationNode interface
> This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
分类树节点(分类无 UUID,以名称为唯一标识)
## Signature
```typescript
interface ILIB_ClassificationNode
```
## Remarks
分类不限层级数,以名称字符串数组标识,如 `['一级', '二级', '三级']`
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[children?](./ILIB_ClassificationNode.md)
</td><td>
</td><td>
Array<[ILIB\_ClassificationNode](./ILIB_ClassificationNode.md)<!-- -->>
</td><td>
**_(ALPHA)_** _(Optional)_ 子分类节点数组
</td></tr>
<tr><td>
[name](./ILIB_ClassificationNode.md)
</td><td>
</td><td>
string
</td><td>
**_(ALPHA)_** 分类名称
</td></tr>
</tbody></table>
---
## 属性详情
### children
# ILIB\_ClassificationNode.children property
> This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
子分类节点数组
## Signature
```typescript
children?: Array<ILIB_ClassificationNode>;
```
### name
# ILIB\_ClassificationNode.name property
> This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
分类名称
## Signature
```typescript
name: string;
```
references/interfaces/ILIB_DeviceAssociationItem.md
# ILIB\_DeviceAssociationItem interface
Device associated symbol, footprint property
## Signature
```typescript
interface ILIB_DeviceAssociationItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[footprint?](./ILIB_DeviceAssociationItem.md)
</td><td>
</td><td>
\{ uuid: string; libraryUuid: string \}
</td><td>
_(Optional)_ Footprint
</td></tr>
<tr><td>
[footprintUuid](./ILIB_DeviceAssociationItem.md)
</td><td>
</td><td>
string
</td><td>
封装 UUID
</td></tr>
<tr><td>
[images?](./ILIB_DeviceAssociationItem.md)
</td><td>
</td><td>
Array<string>
</td><td>
_(Optional)_
</td></tr>
<tr><td>
[symbol](./ILIB_DeviceAssociationItem.md)
</td><td>
</td><td>
{ type: [ELIB\_SymbolType](../enums/ELIB_SymbolType.md)<!-- -->; uuid: string; libraryUuid: string }
</td><td>
Symbol
</td></tr>
<tr><td>
[symbolType](./ILIB_DeviceAssociationItem.md)
</td><td>
</td><td>
[ELIB\_SymbolType](../enums/ELIB_SymbolType.md)
</td><td>
符号类型
</td></tr>
<tr><td>
[symbolUuid](./ILIB_DeviceAssociationItem.md)
</td><td>
</td><td>
string
</td><td>
符号 UUID
</td></tr>
</tbody></table>
---
## 属性详情
### footprint
# ILIB\_DeviceAssociationItem.footprint property
Footprint
## Signature
```typescript
footprint?: { uuid: string; libraryUuid: string };
```
### footprintuuid
# ILIB\_DeviceAssociationItem.footprintUuid property
> Warning: This API is now obsolete.
>
> 请使用 [footprint](./ILIB_DeviceSearchItem.md) 替代
封装 UUID
## Signature
```typescript
footprintUuid: string;
```
### images
# ILIB\_DeviceAssociationItem.images property
## Signature
```typescript
images?: Array<string>;
```
### symbol
# ILIB\_DeviceAssociationItem.symbol property
Symbol
## Signature
```typescript
symbol: {
type: ELIB_SymbolType;
uuid: string;
libraryUuid: string;
}
```
### symboltype
# ILIB\_DeviceAssociationItem.symbolType property
> Warning: This API is now obsolete.
>
> 请使用 [symbol](./ILIB_DeviceSearchItem.md) 替代
符号类型
## Signature
```typescript
symbolType: ELIB_SymbolType;
```
### symboluuid
# ILIB\_DeviceAssociationItem.symbolUuid property
> Warning: This API is now obsolete.
>
> 请使用 [symbol](./ILIB_DeviceSearchItem.md) 替代
符号 UUID
## Signature
```typescript
symbolUuid: string;
```
references/interfaces/ILIB_DeviceExtendPropertyItem.md
# ILIB\_DeviceExtendPropertyItem interface
Device extension property
## Signature
```typescript
interface ILIB_DeviceExtendPropertyItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[addIntoBom?](./ILIB_DeviceExtendPropertyItem.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ Add to BOM
</td></tr>
<tr><td>
[addIntoPcb?](./ILIB_DeviceExtendPropertyItem.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ Transfer to PCB
</td></tr>
<tr><td>
[designator?](./ILIB_DeviceExtendPropertyItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Designator
</td></tr>
<tr><td>
[manufacturer?](./ILIB_DeviceExtendPropertyItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Manufacturer
</td></tr>
<tr><td>
[manufacturerId?](./ILIB_DeviceExtendPropertyItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Manufacturer ID
</td></tr>
<tr><td>
[name?](./ILIB_DeviceExtendPropertyItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Name
</td></tr>
<tr><td>
[net?](./ILIB_DeviceExtendPropertyItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Net
</td></tr>
<tr><td>
[otherProperty?](./ILIB_DeviceExtendPropertyItem.md)
</td><td>
</td><td>
Record<string, boolean \| number \| string \| undefined>
</td><td>
_(Optional)_ Other property
</td></tr>
<tr><td>
[supplier?](./ILIB_DeviceExtendPropertyItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Supplier
</td></tr>
<tr><td>
[supplierId?](./ILIB_DeviceExtendPropertyItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Supplier ID
</td></tr>
</tbody></table>
---
## 属性详情
### addintobom
# ILIB\_DeviceExtendPropertyItem.addIntoBom property
Add to BOM
## Signature
```typescript
addIntoBom?: boolean;
```
### addintopcb
# ILIB\_DeviceExtendPropertyItem.addIntoPcb property
Transfer to PCB
## Signature
```typescript
addIntoPcb?: boolean;
```
### designator
# ILIB\_DeviceExtendPropertyItem.designator property
Designator
## Signature
```typescript
designator?: string;
```
### manufacturer
# ILIB\_DeviceExtendPropertyItem.manufacturer property
Manufacturer
## Signature
```typescript
manufacturer?: string;
```
### manufacturerid
# ILIB\_DeviceExtendPropertyItem.manufacturerId property
Manufacturer ID
## Signature
```typescript
manufacturerId?: string;
```
### name
# ILIB\_DeviceExtendPropertyItem.name property
Name
## Signature
```typescript
name?: string;
```
### net
# ILIB\_DeviceExtendPropertyItem.net property
Net
## Signature
```typescript
net?: string;
```
### otherproperty
# ILIB\_DeviceExtendPropertyItem.otherProperty property
Other property
## Signature
```typescript
otherProperty?: Record<string, boolean | number | string | undefined>;
```
### supplier
# ILIB\_DeviceExtendPropertyItem.supplier property
Supplier
## Signature
```typescript
supplier?: string;
```
### supplierid
# ILIB\_DeviceExtendPropertyItem.supplierId property
Supplier ID
## Signature
```typescript
supplierId?: string;
```
references/interfaces/ILIB_ClassificationIndex.md
# ILIB\_ClassificationIndex interface
> Warning: This API is now obsolete.
>
> since EDA v3.2; dropped EDA v3.3
Classification index
## Signature
```typescript
interface ILIB_ClassificationIndex
```
## Remarks
This classification index is used to index the classifications in the specified library. The library UUID and library type are only used for identification purposes of this index, to prevent indexes in different libraries from referencing each other and causing errors
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[libraryType](./ILIB_ClassificationIndex.md)
</td><td>
</td><td>
[ELIB\_LibraryType](../enums/ELIB_LibraryType.md)
</td><td>
Library type
</td></tr>
<tr><td>
[libraryUuid](./ILIB_ClassificationIndex.md)
</td><td>
</td><td>
string
</td><td>
Library UUID
</td></tr>
<tr><td>
[primaryClassificationUuid](./ILIB_ClassificationIndex.md)
</td><td>
</td><td>
string
</td><td>
Primary classification UUID
</td></tr>
<tr><td>
[secondaryClassificationUuid?](./ILIB_ClassificationIndex.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Secondary classification UUID
</td></tr>
</tbody></table>
---
## 属性详情
### librarytype
# ILIB\_ClassificationIndex.libraryType property
Library type
## Signature
```typescript
libraryType: ELIB_LibraryType;
```
### libraryuuid
# ILIB\_ClassificationIndex.libraryUuid property
Library UUID
## Signature
```typescript
libraryUuid: string;
```
### primaryclassificationuuid
# ILIB\_ClassificationIndex.primaryClassificationUuid property
Primary classification UUID
## Signature
```typescript
primaryClassificationUuid: string;
```
### secondaryclassificationuuid
# ILIB\_ClassificationIndex.secondaryClassificationUuid property
Secondary classification UUID
## Signature
```typescript
secondaryClassificationUuid?: string;
```
references/interfaces/ILIB_DevicePropertiesForSearch.md
# ILIB\_DevicePropertiesForSearch interface
Device parameters that can be used for precise search
## Signature
```typescript
interface ILIB_DevicePropertiesForSearch
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[footprintName?](./ILIB_DevicePropertiesForSearch.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Associate footprint name
</td></tr>
<tr><td>
[name?](./ILIB_DevicePropertiesForSearch.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Device name
</td></tr>
<tr><td>
[partCode?](./ILIB_DevicePropertiesForSearch.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Part code
</td></tr>
<tr><td>
[partNumber?](./ILIB_DevicePropertiesForSearch.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Part number
</td></tr>
<tr><td>
[supplierFootprint?](./ILIB_DevicePropertiesForSearch.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Supplier footprint name
</td></tr>
<tr><td>
[supplierId?](./ILIB_DevicePropertiesForSearch.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Supplier ID
</td></tr>
<tr><td>
[symbolName?](./ILIB_DevicePropertiesForSearch.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Associated symbol name
</td></tr>
<tr><td>
[value?](./ILIB_DevicePropertiesForSearch.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Value
</td></tr>
</tbody></table>
---
## 属性详情
### footprintname
# ILIB\_DevicePropertiesForSearch.footprintName property
Associate footprint name
## Signature
```typescript
footprintName?: string;
```
### name
# ILIB\_DevicePropertiesForSearch.name property
Device name
## Signature
```typescript
name?: string;
```
### partcode
# ILIB\_DevicePropertiesForSearch.partCode property
Part code
## Signature
```typescript
partCode?: string;
```
### partnumber
# ILIB\_DevicePropertiesForSearch.partNumber property
Part number
## Signature
```typescript
partNumber?: string;
```
### supplierfootprint
# ILIB\_DevicePropertiesForSearch.supplierFootprint property
Supplier footprint name
## Signature
```typescript
supplierFootprint?: string;
```
### supplierid
# ILIB\_DevicePropertiesForSearch.supplierId property
Supplier ID
## Signature
```typescript
supplierId?: string;
```
### symbolname
# ILIB\_DevicePropertiesForSearch.symbolName property
Associated symbol name
## Signature
```typescript
symbolName?: string;
```
### value
# ILIB\_DevicePropertiesForSearch.value property
Value
## Signature
```typescript
value?: string;
```
references/interfaces/ILIB_DeviceSearchItem.md
# ILIB\_DeviceSearchItem interface
Searched device properties
## Signature
```typescript
interface ILIB_DeviceSearchItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[classification?](./ILIB_DeviceSearchItem.md)
</td><td>
</td><td>
[ILIB\_ClassificationIndex](./ILIB_ClassificationIndex.md) \| Array<string>
</td><td>
_(Optional)_ Device classification
</td></tr>
<tr><td>
[description?](./ILIB_DeviceSearchItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Description
</td></tr>
<tr><td>
[footprint?](./ILIB_DeviceSearchItem.md)
</td><td>
</td><td>
\{ name: string; uuid: string; libraryUuid: string \}
</td><td>
_(Optional)_ Associate footprint
</td></tr>
<tr><td>
[footprintName?](./ILIB_DeviceSearchItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ 关联封装名称
</td></tr>
<tr><td>
[footprintUuid](./ILIB_DeviceSearchItem.md)
</td><td>
</td><td>
string
</td><td>
关联封装 UUID
</td></tr>
<tr><td>
[imageUuid?](./ILIB_DeviceSearchItem.md)
</td><td>
</td><td>
string \| string\[\]
</td><td>
_(Optional)_ Associate image UUID
</td></tr>
<tr><td>
[libraryUuid](./ILIB_DeviceSearchItem.md)
</td><td>
</td><td>
string
</td><td>
UUID of the library it belongs to
</td></tr>
<tr><td>
[model3D?](./ILIB_DeviceSearchItem.md)
</td><td>
</td><td>
\{ name: string; uuid: string; libraryUuid: string \}
</td><td>
_(Optional)_ Associate 3D model
</td></tr>
<tr><td>
[model3DName?](./ILIB_DeviceSearchItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ 关联 3D 模型名称
</td></tr>
<tr><td>
[model3DUuid](./ILIB_DeviceSearchItem.md)
</td><td>
</td><td>
string
</td><td>
关联 3D 模型 UUID
</td></tr>
<tr><td>
[name](./ILIB_DeviceSearchItem.md)
</td><td>
</td><td>
string
</td><td>
Device name
</td></tr>
<tr><td>
[ordinal](./ILIB_DeviceSearchItem.md)
</td><td>
</td><td>
number
</td><td>
Sorting
</td></tr>
<tr><td>
[otherProperty?](./ILIB_DeviceSearchItem.md)
</td><td>
</td><td>
Record<string, boolean \| number \| string \| undefined>
</td><td>
_(Optional)_ Other property
</td></tr>
<tr><td>
[symbol](./ILIB_DeviceSearchItem.md)
</td><td>
</td><td>
\{ name: string; uuid: string; libraryUuid: string \}
</td><td>
Associated symbol
</td></tr>
<tr><td>
[symbolName](./ILIB_DeviceSearchItem.md)
</td><td>
</td><td>
string
</td><td>
关联符号名称
</td></tr>
<tr><td>
[symbolUuid](./ILIB_DeviceSearchItem.md)
</td><td>
</td><td>
string
</td><td>
关联符号 UUID
</td></tr>
<tr><td>
[uuid](./ILIB_DeviceSearchItem.md)
</td><td>
</td><td>
string
</td><td>
Device UUID
</td></tr>
</tbody></table>
---
## 属性详情
### classification
# ILIB\_DeviceSearchItem.classification property
Device classification
## Signature
```typescript
classification?: ILIB_ClassificationIndex | Array<string>;
```
### description
# ILIB\_DeviceSearchItem.description property
Description
## Signature
```typescript
description?: string;
```
### footprint
# ILIB\_DeviceSearchItem.footprint property
Associate footprint
## Signature
```typescript
footprint?: { name: string; uuid: string; libraryUuid: string };
```
### footprintname
# ILIB\_DeviceSearchItem.footprintName property
> Warning: This API is now obsolete.
>
> 请使用 [footprint](./ILIB_DeviceSearchItem.md) 替代
关联封装名称
## Signature
```typescript
footprintName?: string;
```
### footprintuuid
# ILIB\_DeviceSearchItem.footprintUuid property
> Warning: This API is now obsolete.
>
> 请使用 [footprint](./ILIB_DeviceSearchItem.md) 替代
关联封装 UUID
## Signature
```typescript
footprintUuid: string;
```
### imageuuid
# ILIB\_DeviceSearchItem.imageUuid property
Associate image UUID
## Signature
```typescript
imageUuid?: string | string[];
```
### libraryuuid
# ILIB\_DeviceSearchItem.libraryUuid property
UUID of the library it belongs to
## Signature
```typescript
libraryUuid: string;
```
### model3d
# ILIB\_DeviceSearchItem.model3D property
Associate 3D model
## Signature
```typescript
model3D?: { name: string; uuid: string; libraryUuid: string };
```
### model3dname
# ILIB\_DeviceSearchItem.model3DName property
> Warning: This API is now obsolete.
>
> 请使用 [model3D](./ILIB_DeviceSearchItem.md) 替代
关联 3D 模型名称
## Signature
```typescript
model3DName?: string;
```
### model3duuid
# ILIB\_DeviceSearchItem.model3DUuid property
> Warning: This API is now obsolete.
>
> 请使用 [model3D](./ILIB_DeviceSearchItem.md) 替代
关联 3D 模型 UUID
## Signature
```typescript
model3DUuid: string;
```
### name
# ILIB\_DeviceSearchItem.name property
Device name
## Signature
```typescript
name: string;
```
### ordinal
# ILIB\_DeviceSearchItem.ordinal property
Sorting
## Signature
```typescript
ordinal: number;
```
### otherproperty
# ILIB\_DeviceSearchItem.otherProperty property
Other property
## Signature
```typescript
otherProperty?: Record<string, boolean | number | string | undefined>;
```
### symbol
# ILIB\_DeviceSearchItem.symbol property
Associated symbol
## Signature
```typescript
symbol: {
name: string;
uuid: string;
libraryUuid: string;
}
```
### symbolname
# ILIB\_DeviceSearchItem.symbolName property
> Warning: This API is now obsolete.
>
> 请使用 [symbol](./ILIB_DeviceSearchItem.md) 替代
关联符号名称
## Signature
```typescript
symbolName: string;
```
### symboluuid
# ILIB\_DeviceSearchItem.symbolUuid property
> Warning: This API is now obsolete.
>
> 请使用 [symbol](./ILIB_DeviceSearchItem.md) 替代
关联符号 UUID
## Signature
```typescript
symbolUuid: string;
```
### uuid
# ILIB\_DeviceSearchItem.uuid property
Device UUID
## Signature
```typescript
uuid: string;
```
references/interfaces/ILIB_ExtendLibrary3DModelFunctions.md
# ILIB\_ExtendLibrary3DModelFunctions interface
External library 3D model functions
## Signature
```typescript
interface ILIB_ExtendLibrary3DModelFunctions extends ILIB_ExtendLibraryFunctions
```
**Extends:** [ILIB\_ExtendLibraryFunctions](./ILIB_ExtendLibraryFunctions.md)
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[getList](./ILIB_ExtendLibrary3DModelFunctions.md)
</td><td>
</td><td>
(props: [ILIB\_ExtendLibrarySearchProperty](./ILIB_ExtendLibrarySearchProperty.md)<!-- --><{ }>) => Promise<[ILIB\_ExtendLibrarySearchResult](./ILIB_ExtendLibrarySearchResult.md)<!-- --><[ILIB\_ExtendLibraryItemIndex](./ILIB_ExtendLibraryItemIndex.md) & [ILIB\_ExtendLibrarySearchResultDataLine](./ILIB_ExtendLibrarySearchResultDataLine.md) & { modelType: 'step' }>>
</td><td>
</td></tr>
</tbody></table>
---
## 属性详情
### getlist
# ILIB\_ExtendLibrary3DModelFunctions.getList property
## Signature
```typescript
getList: (props: ILIB_ExtendLibrarySearchProperty<{}>) =>
Promise<
ILIB_ExtendLibrarySearchResult<
ILIB_ExtendLibraryItemIndex
& ILIB_ExtendLibrarySearchResultDataLine & { modelType: 'step' }
>
>;
```
references/interfaces/ILIB_DeviceItem.md
# ILIB\_DeviceItem interface
Device property
## Signature
```typescript
interface ILIB_DeviceItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[association](./ILIB_DeviceItem.md)
</td><td>
</td><td>
[ILIB\_DeviceAssociationItem](./ILIB_DeviceAssociationItem.md)
</td><td>
Associate
</td></tr>
<tr><td>
[classification?](./ILIB_DeviceItem.md)
</td><td>
</td><td>
[ILIB\_ClassificationIndex](./ILIB_ClassificationIndex.md) \| Array<string>
</td><td>
_(Optional)_ Device classification
</td></tr>
<tr><td>
[description?](./ILIB_DeviceItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Description
</td></tr>
<tr><td>
[libraryType](./ILIB_DeviceItem.md)
</td><td>
`readonly`
</td><td>
[ELIB\_LibraryType.DEVICE](../enums/ELIB_LibraryType.md)
</td><td>
Library type
</td></tr>
<tr><td>
[libraryUuid](./ILIB_DeviceItem.md)
</td><td>
</td><td>
string
</td><td>
UUID of the library it belongs to
</td></tr>
<tr><td>
[name](./ILIB_DeviceItem.md)
</td><td>
</td><td>
string
</td><td>
Device name
</td></tr>
<tr><td>
[property](./ILIB_DeviceItem.md)
</td><td>
</td><td>
[ILIB\_DeviceExtendPropertyItem](./ILIB_DeviceExtendPropertyItem.md)
</td><td>
Extension property
</td></tr>
<tr><td>
[subPartNames](./ILIB_DeviceItem.md)
</td><td>
</td><td>
\[\]
</td><td>
Sub-part name array
</td></tr>
<tr><td>
[uuid](./ILIB_DeviceItem.md)
</td><td>
</td><td>
string
</td><td>
Device UUID
</td></tr>
</tbody></table>
---
## 属性详情
### association
# ILIB\_DeviceItem.association property
Associate
## Signature
```typescript
association: ILIB_DeviceAssociationItem;
```
### classification
# ILIB\_DeviceItem.classification property
Device classification
## Signature
```typescript
classification?: ILIB_ClassificationIndex | Array<string>;
```
### description
# ILIB\_DeviceItem.description property
Description
## Signature
```typescript
description?: string;
```
### librarytype
# ILIB\_DeviceItem.libraryType property
Library type
## Signature
```typescript
readonly libraryType: ELIB_LibraryType.DEVICE;
```
### libraryuuid
# ILIB\_DeviceItem.libraryUuid property
UUID of the library it belongs to
## Signature
```typescript
libraryUuid: string;
```
### name
# ILIB\_DeviceItem.name property
Device name
## Signature
```typescript
name: string;
```
### property
# ILIB\_DeviceItem.property property
Extension property
## Signature
```typescript
property: ILIB_DeviceExtendPropertyItem;
```
### subpartnames
# ILIB\_DeviceItem.subPartNames property
Sub-part name array
## Signature
```typescript
subPartNames: [];
```
### uuid
# ILIB\_DeviceItem.uuid property
Device UUID
## Signature
```typescript
uuid: string;
```
references/interfaces/ILIB_ExtendLibraryCbbFunctions.md
# ILIB\_ExtendLibraryCbbFunctions interface
External library reuse block functions
## Signature
```typescript
interface ILIB_ExtendLibraryCbbFunctions extends ILIB_ExtendLibraryFunctions
```
**Extends:** [ILIB\_ExtendLibraryFunctions](./ILIB_ExtendLibraryFunctions.md)
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[getList](./ILIB_ExtendLibraryCbbFunctions.md)
</td><td>
</td><td>
(props: any) => Promise<[ILIB\_ExtendLibrarySearchResult](./ILIB_ExtendLibrarySearchResult.md)<!-- --><[ILIB\_ExtendLibraryItem](./ILIB_ExtendLibraryItem.md) & [ILIB\_ExtendLibrarySearchResultDataLine](./ILIB_ExtendLibrarySearchResultDataLine.md) & { schematics?: Array<{ uuid: string; name: string; updateTime: string; description?: string }>; pcbs?: Array<{ uuid: string; name: string; updateTime: number; thumb?: string; createTime?: number; creator?: [ILIB\_ExtendLibraryUserIndex](./ILIB_ExtendLibraryUserIndex.md)<!-- -->; modifier?: [ILIB\_ExtendLibraryUserIndex](./ILIB_ExtendLibraryUserIndex.md)<!-- -->; description?: string }>; boards?: Array<{ pcbUuid: string; schUuid: string; name: string }>; sheets?: Array<{ uuid: string; name: string; belongSchematicUuid: string; updateTime: number; thumb?: string; createTime?: number; creator?: [ILIB\_ExtendLibraryUserIndex](./ILIB_ExtendLibraryUserIndex.md)<!-- -->; modifier?: [ILIB\_ExtendLibraryUserIndex](./ILIB_ExtendLibraryUserIndex.md)<!-- -->; description?: string }> }>>
</td><td>
</td></tr>
</tbody></table>
---
## 属性详情
### getlist
# ILIB\_ExtendLibraryCbbFunctions.getList property
## Signature
```typescript
getList: (props: any) =>
Promise<
ILIB_ExtendLibrarySearchResult<
ILIB_ExtendLibraryItem
& ILIB_ExtendLibrarySearchResultDataLine & {
schematics?: Array<{
uuid: string;
name: string;
updateTime: string;
description?: string;
}>;
pcbs?: Array<{
uuid: string;
name: string;
updateTime: number;
thumb?: string;
createTime?: number;
creator?: ILIB_ExtendLibraryUserIndex;
modifier?: ILIB_ExtendLibraryUserIndex;
description?: string;
}>;
boards?: Array<{ pcbUuid: string; schUuid: string; name: string }>;
sheets?: Array<{
uuid: string;
name: string;
belongSchematicUuid: string;
updateTime: number;
thumb?: string;
createTime?: number;
creator?: ILIB_ExtendLibraryUserIndex;
modifier?: ILIB_ExtendLibraryUserIndex;
description?: string;
}>;
}
>
>;
```
references/interfaces/ILIB_ExtendLibraryDeviceFunctions.md
# ILIB\_ExtendLibraryDeviceFunctions interface
External library device functions
## Signature
```typescript
interface ILIB_ExtendLibraryDeviceFunctions extends ILIB_ExtendLibraryFunctions
```
**Extends:** [ILIB\_ExtendLibraryFunctions](./ILIB_ExtendLibraryFunctions.md)
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[getList](./ILIB_ExtendLibraryDeviceFunctions.md)
</td><td>
</td><td>
(props: [ILIB\_ExtendLibrarySearchProperty](./ILIB_ExtendLibrarySearchProperty.md)<!-- --><{ attributes?: Record<string, string>; symbolType?: [ELIB\_SymbolType](../enums/ELIB_SymbolType.md) }>) => Promise<[ILIB\_ExtendLibrarySearchResult](./ILIB_ExtendLibrarySearchResult.md)<!-- --><[ILIB\_ExtendLibraryItemIndex](./ILIB_ExtendLibraryItemIndex.md) & { classification?: [ILIB\_ExtendLibraryClassificationIndex](./ILIB_ExtendLibraryClassificationIndex.md) \| Array<string>; symbol?: [ILIB\_ExtendLibraryItem](./ILIB_ExtendLibraryItem.md) & { symbolType: [ELIB\_SymbolType](../enums/ELIB_SymbolType.md) }; footprint?: [ILIB\_ExtendLibraryItem](./ILIB_ExtendLibraryItem.md)<!-- -->; symbols?: Array<[ILIB\_ExtendLibraryItem](./ILIB_ExtendLibraryItem.md) & { symbolType: [ELIB\_SymbolType](../enums/ELIB_SymbolType.md) }>; footprints?: Array<[ILIB\_ExtendLibraryItem](./ILIB_ExtendLibraryItem.md)<!-- -->>; model3d?: [ILIB\_ExtendLibraryItemIndex](./ILIB_ExtendLibraryItemIndex.md) & { adjustment?: { size?: { x: number; y: number; z: number }; rotation?: { x: number; y: number; z: number }; offset?: { x: number; y: number; z: number } } }; images?: Array<[ILIB\_ExtendLibraryItem](./ILIB_ExtendLibraryItem.md)<!-- -->>; value?: string; supplierPart?: string; manufacturer?: string; description?: string; updateTime?: number; createTime?: number; attributes?: Record<string, string>; }>>
</td><td>
</td></tr>
<tr><td>
[getSupportedPreviewTypes](./ILIB_ExtendLibraryDeviceFunctions.md)
</td><td>
</td><td>
() => Promise<Array<[ELIB\_PreviewType](../enums/ELIB_PreviewType.md)<!-- -->>>
</td><td>
获取支持的预览类型
</td></tr>
<tr><td>
[getSupportedSymbolTypes](./ILIB_ExtendLibraryDeviceFunctions.md)
</td><td>
</td><td>
() => Promise<Array<[ELIB\_SymbolType](../enums/ELIB_SymbolType.md)<!-- -->>>
</td><td>
获取支持的符号类型
</td></tr>
</tbody></table>
---
## 属性详情
### getlist
# ILIB\_ExtendLibraryDeviceFunctions.getList property
## Signature
```typescript
getList: (
props: ILIB_ExtendLibrarySearchProperty<{
attributes?: Record<string, string>;
symbolType?: ELIB_SymbolType;
}>,
) =>
Promise<
ILIB_ExtendLibrarySearchResult<
ILIB_ExtendLibraryItemIndex & {
classification?: ILIB_ExtendLibraryClassificationIndex | Array<string>;
symbol?: ILIB_ExtendLibraryItem & { symbolType: ELIB_SymbolType };
footprint?: ILIB_ExtendLibraryItem;
symbols?: Array<ILIB_ExtendLibraryItem & { symbolType: ELIB_SymbolType }>;
footprints?: Array<ILIB_ExtendLibraryItem>;
model3d?: ILIB_ExtendLibraryItemIndex & {
adjustment?: {
size?: { x: number; y: number; z: number };
rotation?: { x: number; y: number; z: number };
offset?: { x: number; y: number; z: number };
};
};
images?: Array<ILIB_ExtendLibraryItem>;
value?: string;
supplierPart?: string;
manufacturer?: string;
description?: string;
updateTime?: number;
createTime?: number;
attributes?: Record<string, string>;
}
>
>;
```
### getsupportedpreviewtypes
# ILIB\_ExtendLibraryDeviceFunctions.getSupportedPreviewTypes property
获取支持的预览类型
## Signature
```typescript
getSupportedPreviewTypes: () => Promise<Array<ELIB_PreviewType>>;
```
### getsupportedsymboltypes
# ILIB\_ExtendLibraryDeviceFunctions.getSupportedSymbolTypes property
获取支持的符号类型
## Signature
```typescript
getSupportedSymbolTypes: () => Promise<Array<ELIB_SymbolType>>;
```
references/interfaces/ILIB_ExtendLibraryFootprintFunctions.md
# ILIB\_ExtendLibraryFootprintFunctions interface
External library footprint functions
## Signature
```typescript
interface ILIB_ExtendLibraryFootprintFunctions extends ILIB_ExtendLibraryFunctions
```
**Extends:** [ILIB\_ExtendLibraryFunctions](./ILIB_ExtendLibraryFunctions.md)
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[getList](./ILIB_ExtendLibraryFootprintFunctions.md)
</td><td>
</td><td>
(props: [ILIB\_ExtendLibrarySearchProperty](./ILIB_ExtendLibrarySearchProperty.md)<!-- --><{ }>) => Promise<[ILIB\_ExtendLibrarySearchResult](./ILIB_ExtendLibrarySearchResult.md)<!-- --><[ILIB\_ExtendLibraryItem](./ILIB_ExtendLibraryItem.md) & [ILIB\_ExtendLibrarySearchResultDataLine](./ILIB_ExtendLibrarySearchResultDataLine.md)<!-- -->>>
</td><td>
</td></tr>
</tbody></table>
---
## 属性详情
### getlist
# ILIB\_ExtendLibraryFootprintFunctions.getList property
## Signature
```typescript
getList: (props: ILIB_ExtendLibrarySearchProperty<{}>) =>
Promise<
ILIB_ExtendLibrarySearchResult<
ILIB_ExtendLibraryItem & ILIB_ExtendLibrarySearchResultDataLine
>
>;
```
references/interfaces/ILIB_ExtendLibraryItem.md
# ILIB\_ExtendLibraryItem interface
External library item
## Signature
```typescript
interface ILIB_ExtendLibraryItem extends ILIB_ExtendLibraryItemIndex
```
**Extends:** [ILIB\_ExtendLibraryItemIndex](./ILIB_ExtendLibraryItemIndex.md)
## Remarks
Here the `url` or `data` field needs to be passed. If both are passed, the data of `data` is used and the `url` field is ignored
If only the `url` field is passed in, a request will be made to it to try to obtain its library file
The data of `data` can be in Blob or DataURL format
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[data?](./ILIB_ExtendLibraryItem.md)
</td><td>
</td><td>
string \| Blob
</td><td>
_(Optional)_ Library file data
</td></tr>
<tr><td>
[url?](./ILIB_ExtendLibraryItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Library file URL
</td></tr>
</tbody></table>
---
## 属性详情
### data
# ILIB\_ExtendLibraryItem.data property
Library file data
## Signature
```typescript
data?: string | Blob;
```
### url
# ILIB\_ExtendLibraryItem.url property
Library file URL
## Signature
```typescript
url?: string;
```
references/interfaces/ILIB_ExtendLibraryItemIndex.md
# ILIB\_ExtendLibraryItemIndex interface
External library item index
## Signature
```typescript
interface ILIB_ExtendLibraryItemIndex
```
## Remarks
Supports external libraries using a name or UUID as the unique ID index of the item
Under normal circumstances, each library is expected to have a UUID, but some systems may not have a UUID field (or a field that can serve a similar purpose) at development time
When only the `name` field is passed here, `name` will be used as the unique ID, and duplicate names are not allowed
If both the `uuid` and `name` fields are passed, only `uuid` cannot be duplicated
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[name](./ILIB_ExtendLibraryItemIndex.md)
</td><td>
</td><td>
string
</td><td>
Library name
</td></tr>
<tr><td>
[uuid?](./ILIB_ExtendLibraryItemIndex.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Library UUID
</td></tr>
</tbody></table>
---
## 属性详情
### name
# ILIB\_ExtendLibraryItemIndex.name property
Library name
## Signature
```typescript
name: string;
```
### uuid
# ILIB\_ExtendLibraryItemIndex.uuid property
Library UUID
## Signature
```typescript
uuid?: string;
```
references/interfaces/ILIB_ExtendLibraryFunctions.md
# ILIB\_ExtendLibraryFunctions interface
External library functions
## Signature
```typescript
interface ILIB_ExtendLibraryFunctions
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[getClassificationTree](./ILIB_ExtendLibraryFunctions.md)
</td><td>
</td><td>
() => Promise<Array<{ name: string; uuid?: string; children?: Array<{ name: string; uuid?: string }> \| undefined }>>
</td><td>
获取分类树
</td></tr>
<tr><td>
[getDetail](./ILIB_ExtendLibraryFunctions.md)
</td><td>
</td><td>
(uuid: string) => Promise<any>
</td><td>
获取详细信息
</td></tr>
<tr><td>
[getList](./ILIB_ExtendLibraryFunctions.md)
</td><td>
</td><td>
(props: [ILIB\_ExtendLibrarySearchProperty](./ILIB_ExtendLibrarySearchProperty.md)<!-- --><any>) => Promise<[ILIB\_ExtendLibrarySearchResult](./ILIB_ExtendLibrarySearchResult.md)<!-- --><any>>
</td><td>
获取列表
</td></tr>
</tbody></table>
---
## 属性详情
### getclassificationtree
# ILIB\_ExtendLibraryFunctions.getClassificationTree property
获取分类树
## Signature
```typescript
getClassificationTree: () =>
Promise<
Array<{
name: string;
uuid?: string;
children?: Array<{ name: string; uuid?: string }> | undefined;
}>
>;
```
### getdetail
# ILIB\_ExtendLibraryFunctions.getDetail property
获取详细信息
## Signature
```typescript
getDetail: (uuid: string) => Promise<any>;
```
### getlist
# ILIB\_ExtendLibraryFunctions.getList property
获取列表
## Signature
```typescript
getList: (props: ILIB_ExtendLibrarySearchProperty<any>) =>
Promise<ILIB_ExtendLibrarySearchResult<any>>;
```
references/interfaces/ILIB_ExtendLibraryClassificationIndex.md
# ILIB\_ExtendLibraryClassificationIndex interface
> Warning: This API is now obsolete.
>
> since EDA v3.2; dropped EDA v3.3
External library classification index
## Signature
```typescript
interface ILIB_ExtendLibraryClassificationIndex
```
## Remarks
Supports external libraries using a name or UUID as the unique ID index of the classification
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[primaryClassificationName?](./ILIB_ExtendLibraryClassificationIndex.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Primary classification name
</td></tr>
<tr><td>
[primaryClassificationUuid?](./ILIB_ExtendLibraryClassificationIndex.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Primary classification UUID
</td></tr>
<tr><td>
[secondaryClassificationName?](./ILIB_ExtendLibraryClassificationIndex.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Secondary classification name
</td></tr>
<tr><td>
[secondaryClassificationUuid?](./ILIB_ExtendLibraryClassificationIndex.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Secondary classification UUID
</td></tr>
</tbody></table>
---
## 属性详情
### primaryclassificationname
# ILIB\_ExtendLibraryClassificationIndex.primaryClassificationName property
Primary classification name
## Signature
```typescript
primaryClassificationName?: string;
```
### primaryclassificationuuid
# ILIB\_ExtendLibraryClassificationIndex.primaryClassificationUuid property
Primary classification UUID
## Signature
```typescript
primaryClassificationUuid?: string;
```
### secondaryclassificationname
# ILIB\_ExtendLibraryClassificationIndex.secondaryClassificationName property
Secondary classification name
## Signature
```typescript
secondaryClassificationName?: string;
```
### secondaryclassificationuuid
# ILIB\_ExtendLibraryClassificationIndex.secondaryClassificationUuid property
Secondary classification UUID
## Signature
```typescript
secondaryClassificationUuid?: string;
```
references/interfaces/ILIB_ExtendLibraryUserIndex.md
# ILIB\_ExtendLibraryUserIndex interface
External library user index
## Signature
```typescript
interface ILIB_ExtendLibraryUserIndex
```
## Remarks
Supports external libraries using a name or the associated user UUID within the EasyEDA system as the unique ID index of the user
If you want to associate with an EasyEDA user, pass in the user's UUID. The user's name will be automatically read (if the user exists)
If you only want to display the user name, you can pass in the `name` field
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[name?](./ILIB_ExtendLibraryUserIndex.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ User name
</td></tr>
<tr><td>
[uuid?](./ILIB_ExtendLibraryUserIndex.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ User UUID within the EasyEDA system
</td></tr>
</tbody></table>
---
## 属性详情
### name
# ILIB\_ExtendLibraryUserIndex.name property
User name
## Signature
```typescript
name?: string;
```
### uuid
# ILIB\_ExtendLibraryUserIndex.uuid property
User UUID within the EasyEDA system
## Signature
```typescript
uuid?: string;
```
references/interfaces/ILIB_ExtendLibrarySearchResult.md
# ILIB\_ExtendLibrarySearchResult interface
External library search result
## Signature
```typescript
interface ILIB_ExtendLibrarySearchResult<T>
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[count](./ILIB_ExtendLibrarySearchResult.md)
</td><td>
</td><td>
number
</td><td>
Total item count
</td></tr>
<tr><td>
[lists](./ILIB_ExtendLibrarySearchResult.md)
</td><td>
</td><td>
Array<T>
</td><td>
Result list
</td></tr>
<tr><td>
[page](./ILIB_ExtendLibrarySearchResult.md)
</td><td>
</td><td>
number
</td><td>
Current page count
</td></tr>
<tr><td>
[pageSize](./ILIB_ExtendLibrarySearchResult.md)
</td><td>
</td><td>
number
</td><td>
Number of entries per page
</td></tr>
<tr><td>
[totalPage](./ILIB_ExtendLibrarySearchResult.md)
</td><td>
</td><td>
number
</td><td>
Total page count
</td></tr>
</tbody></table>
---
## 属性详情
### count
# ILIB\_ExtendLibrarySearchResult.count property
Total item count
## Signature
```typescript
count: number;
```
### lists
# ILIB\_ExtendLibrarySearchResult.lists property
Result list
## Signature
```typescript
lists: Array<T>;
```
### page
# ILIB\_ExtendLibrarySearchResult.page property
Current page count
## Signature
```typescript
page: number;
```
### pagesize
# ILIB\_ExtendLibrarySearchResult.pageSize property
Number of entries per page
## Signature
```typescript
pageSize: number;
```
### totalpage
# ILIB\_ExtendLibrarySearchResult.totalPage property
Total page count
## Signature
```typescript
totalPage: number;
```
references/interfaces/ILIB_ExtendLibrarySearchProperty.md
# ILIB\_ExtendLibrarySearchProperty interface
External library search property
## Signature
```typescript
interface ILIB_ExtendLibrarySearchProperty<T>
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[page?](./ILIB_ExtendLibrarySearchProperty.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ Page count
</td></tr>
<tr><td>
[pageSize?](./ILIB_ExtendLibrarySearchProperty.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ Number of entries per page
</td></tr>
<tr><td>
[query](./ILIB_ExtendLibrarySearchProperty.md)
</td><td>
</td><td>
T & { wd?: string; listByTitles?: Array<string>; classification?: [ILIB\_ExtendLibraryClassificationIndex](./ILIB_ExtendLibraryClassificationIndex.md) \| Array<string> }
</td><td>
Query parameter
</td></tr>
</tbody></table>
---
## 属性详情
### page
# ILIB\_ExtendLibrarySearchProperty.page property
Page count
## Signature
```typescript
page?: number;
```
### pagesize
# ILIB\_ExtendLibrarySearchProperty.pageSize property
Number of entries per page
## Signature
```typescript
pageSize?: number;
```
### query
# ILIB\_ExtendLibrarySearchProperty.query property
Query parameter
## Signature
```typescript
query: T & { wd?: string; listByTitles?: Array<string>; classification?: ILIB_ExtendLibraryClassificationIndex | Array<string> };
```
references/interfaces/ILIB_ExtendLibrarySymbolFunctions.md
# ILIB\_ExtendLibrarySymbolFunctions interface
External library symbol functions
## Signature
```typescript
interface ILIB_ExtendLibrarySymbolFunctions extends ILIB_ExtendLibraryFunctions
```
**Extends:** [ILIB\_ExtendLibraryFunctions](./ILIB_ExtendLibraryFunctions.md)
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[getList](./ILIB_ExtendLibrarySymbolFunctions.md)
</td><td>
</td><td>
(props: [ILIB\_ExtendLibrarySearchProperty](./ILIB_ExtendLibrarySearchProperty.md)<!-- --><{ symbolType?: [ELIB\_SymbolType](../enums/ELIB_SymbolType.md) }>) => Promise<[ILIB\_ExtendLibrarySearchResult](./ILIB_ExtendLibrarySearchResult.md)<!-- --><[ILIB\_ExtendLibraryItem](./ILIB_ExtendLibraryItem.md) & [ILIB\_ExtendLibrarySearchResultDataLine](./ILIB_ExtendLibrarySearchResultDataLine.md) & { symbolType: [ELIB\_SymbolType](../enums/ELIB_SymbolType.md) }>>
</td><td>
</td></tr>
<tr><td>
[getSupportedSymbolTypes](./ILIB_ExtendLibrarySymbolFunctions.md)
</td><td>
</td><td>
() => Promise<Array<[ELIB\_SymbolType](../enums/ELIB_SymbolType.md)<!-- -->>>
</td><td>
获取支持的符号类型
</td></tr>
</tbody></table>
---
## 属性详情
### getlist
# ILIB\_ExtendLibrarySymbolFunctions.getList property
## Signature
```typescript
getList: (props: ILIB_ExtendLibrarySearchProperty<{ symbolType?: ELIB_SymbolType }>) =>
Promise<
ILIB_ExtendLibrarySearchResult<
ILIB_ExtendLibraryItem
& ILIB_ExtendLibrarySearchResultDataLine & { symbolType: ELIB_SymbolType }
>
>;
```
### getsupportedsymboltypes
# ILIB\_ExtendLibrarySymbolFunctions.getSupportedSymbolTypes property
获取支持的符号类型
## Signature
```typescript
getSupportedSymbolTypes: () => Promise<Array<ELIB_SymbolType>>;
```
references/interfaces/ILIB_FootprintSearchItem.md
# ILIB\_FootprintSearchItem interface
Searched footprint properties
## Signature
```typescript
interface ILIB_FootprintSearchItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[ascription](./ILIB_FootprintSearchItem.md)
</td><td>
</td><td>
string
</td><td>
Ownership
</td></tr>
<tr><td>
[classification?](./ILIB_FootprintSearchItem.md)
</td><td>
</td><td>
[ILIB\_ClassificationIndex](./ILIB_ClassificationIndex.md) \| Array<string>
</td><td>
_(Optional)_ Classification
</td></tr>
<tr><td>
[description?](./ILIB_FootprintSearchItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Description
</td></tr>
<tr><td>
[lastModifiedBy](./ILIB_FootprintSearchItem.md)
</td><td>
</td><td>
string
</td><td>
Last modifier
</td></tr>
<tr><td>
[libraryUuid](./ILIB_FootprintSearchItem.md)
</td><td>
</td><td>
string
</td><td>
UUID of the library it belongs to
</td></tr>
<tr><td>
[name](./ILIB_FootprintSearchItem.md)
</td><td>
</td><td>
string
</td><td>
Footprint name
</td></tr>
<tr><td>
[ordinal](./ILIB_FootprintSearchItem.md)
</td><td>
</td><td>
number
</td><td>
Sorting
</td></tr>
<tr><td>
[updateTimestamp](./ILIB_FootprintSearchItem.md)
</td><td>
</td><td>
number
</td><td>
Update timestamp
</td></tr>
<tr><td>
[uuid](./ILIB_FootprintSearchItem.md)
</td><td>
</td><td>
string
</td><td>
Footprint UUID
</td></tr>
</tbody></table>
---
## 属性详情
### ascription
# ILIB\_FootprintSearchItem.ascription property
Ownership
## Signature
```typescript
ascription: string;
```
### classification
# ILIB\_FootprintSearchItem.classification property
Classification
## Signature
```typescript
classification?: ILIB_ClassificationIndex | Array<string>;
```
### description
# ILIB\_FootprintSearchItem.description property
Description
## Signature
```typescript
description?: string;
```
### lastmodifiedby
# ILIB\_FootprintSearchItem.lastModifiedBy property
Last modifier
## Signature
```typescript
lastModifiedBy: string;
```
### libraryuuid
# ILIB\_FootprintSearchItem.libraryUuid property
UUID of the library it belongs to
## Signature
```typescript
libraryUuid: string;
```
### name
# ILIB\_FootprintSearchItem.name property
Footprint name
## Signature
```typescript
name: string;
```
### ordinal
# ILIB\_FootprintSearchItem.ordinal property
Sorting
## Signature
```typescript
ordinal: number;
```
### updatetimestamp
# ILIB\_FootprintSearchItem.updateTimestamp property
Update timestamp
## Signature
```typescript
updateTimestamp: number;
```
### uuid
# ILIB\_FootprintSearchItem.uuid property
Footprint UUID
## Signature
```typescript
uuid: string;
```
references/interfaces/ILIB_FootprintItem.md
# ILIB\_FootprintItem interface
Footprint property
## Signature
```typescript
interface ILIB_FootprintItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[classification?](./ILIB_FootprintItem.md)
</td><td>
</td><td>
[ILIB\_ClassificationIndex](./ILIB_ClassificationIndex.md) \| Array<string>
</td><td>
_(Optional)_ Classification
</td></tr>
<tr><td>
[description?](./ILIB_FootprintItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Description
</td></tr>
<tr><td>
[libraryType](./ILIB_FootprintItem.md)
</td><td>
`readonly`
</td><td>
[ELIB\_LibraryType.FOOTPRINT](../enums/ELIB_LibraryType.md)
</td><td>
Library type
</td></tr>
<tr><td>
[libraryUuid](./ILIB_FootprintItem.md)
</td><td>
</td><td>
string
</td><td>
UUID of the library it belongs to
</td></tr>
<tr><td>
[model3D?](./ILIB_FootprintItem.md)
</td><td>
</td><td>
\{ name: string; uuid: string; libraryUuid: string \}
</td><td>
_(Optional)_ 关联 3D 模型
ADD since v4.1.22
</td></tr>
<tr><td>
[name](./ILIB_FootprintItem.md)
</td><td>
</td><td>
string
</td><td>
Footprint name
</td></tr>
<tr><td>
[otherProperty?](./ILIB_FootprintItem.md)
</td><td>
</td><td>
Record<string, boolean \| number \| string \| undefined>
</td><td>
_(Optional)_ 其它属性
</td></tr>
<tr><td>
[uuid](./ILIB_FootprintItem.md)
</td><td>
</td><td>
string
</td><td>
Footprint UUID
</td></tr>
</tbody></table>
---
## 属性详情
### classification
# ILIB\_FootprintItem.classification property
Classification
## Signature
```typescript
classification?: ILIB_ClassificationIndex | Array<string>;
```
### description
# ILIB\_FootprintItem.description property
Description
## Signature
```typescript
description?: string;
```
### librarytype
# ILIB\_FootprintItem.libraryType property
Library type
## Signature
```typescript
readonly libraryType: ELIB_LibraryType.FOOTPRINT;
```
### libraryuuid
# ILIB\_FootprintItem.libraryUuid property
UUID of the library it belongs to
## Signature
```typescript
libraryUuid: string;
```
### model3d
# ILIB\_FootprintItem.model3D property
关联 3D 模型
ADD since v4.1.22
## Signature
```typescript
model3D?: { name: string; uuid: string; libraryUuid: string };
```
### name
# ILIB\_FootprintItem.name property
Footprint name
## Signature
```typescript
name: string;
```
### otherproperty
# ILIB\_FootprintItem.otherProperty property
其它属性
## Signature
```typescript
otherProperty?: Record<string, boolean | number | string | undefined>;
```
### uuid
# ILIB\_FootprintItem.uuid property
Footprint UUID
## Signature
```typescript
uuid: string;
```
references/interfaces/ILIB_FootprintPropertiesForSearch.md
# ILIB\_FootprintPropertiesForSearch interface
Footprint parameters that can be used for precise search
## Signature
```typescript
interface ILIB_FootprintPropertiesForSearch
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[name?](./ILIB_FootprintPropertiesForSearch.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Footprint name
</td></tr>
</tbody></table>
---
## 属性详情
### name
# ILIB\_FootprintPropertiesForSearch.name property
Footprint name
## Signature
```typescript
name?: string;
```
references/interfaces/ILIB_ExtendLibrarySearchResultDataLine.md
# ILIB\_ExtendLibrarySearchResultDataLine interface
External library search result data line
## Signature
```typescript
interface ILIB_ExtendLibrarySearchResultDataLine
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[classification?](./ILIB_ExtendLibrarySearchResultDataLine.md)
</td><td>
</td><td>
[ILIB\_ExtendLibraryClassificationIndex](./ILIB_ExtendLibraryClassificationIndex.md) \| Array<string>
</td><td>
_(Optional)_
</td></tr>
<tr><td>
[createTime?](./ILIB_ExtendLibrarySearchResultDataLine.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_
</td></tr>
<tr><td>
[creator?](./ILIB_ExtendLibrarySearchResultDataLine.md)
</td><td>
</td><td>
[ILIB\_ExtendLibraryUserIndex](./ILIB_ExtendLibraryUserIndex.md)
</td><td>
_(Optional)_
</td></tr>
<tr><td>
[description?](./ILIB_ExtendLibrarySearchResultDataLine.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_
</td></tr>
<tr><td>
[modifier?](./ILIB_ExtendLibrarySearchResultDataLine.md)
</td><td>
</td><td>
[ILIB\_ExtendLibraryUserIndex](./ILIB_ExtendLibraryUserIndex.md)
</td><td>
_(Optional)_
</td></tr>
<tr><td>
[owner?](./ILIB_ExtendLibrarySearchResultDataLine.md)
</td><td>
</td><td>
[ILIB\_ExtendLibraryUserIndex](./ILIB_ExtendLibraryUserIndex.md)
</td><td>
_(Optional)_
</td></tr>
<tr><td>
[updateTime?](./ILIB_ExtendLibrarySearchResultDataLine.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_
</td></tr>
<tr><td>
[version?](./ILIB_ExtendLibrarySearchResultDataLine.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_
</td></tr>
</tbody></table>
---
## 属性详情
### classification
# ILIB\_ExtendLibrarySearchResultDataLine.classification property
## Signature
```typescript
classification?: ILIB_ExtendLibraryClassificationIndex | Array<string>;
```
### createtime
# ILIB\_ExtendLibrarySearchResultDataLine.createTime property
## Signature
```typescript
createTime?: number;
```
### creator
# ILIB\_ExtendLibrarySearchResultDataLine.creator property
## Signature
```typescript
creator?: ILIB_ExtendLibraryUserIndex;
```
### description
# ILIB\_ExtendLibrarySearchResultDataLine.description property
## Signature
```typescript
description?: string;
```
### modifier
# ILIB\_ExtendLibrarySearchResultDataLine.modifier property
## Signature
```typescript
modifier?: ILIB_ExtendLibraryUserIndex;
```
### owner
# ILIB\_ExtendLibrarySearchResultDataLine.owner property
## Signature
```typescript
owner?: ILIB_ExtendLibraryUserIndex;
```
### updatetime
# ILIB\_ExtendLibrarySearchResultDataLine.updateTime property
## Signature
```typescript
updateTime?: number;
```
### version
# ILIB\_ExtendLibrarySearchResultDataLine.version property
## Signature
```typescript
version?: string;
```
references/interfaces/ILIB_LibraryItem.md
# ILIB\_LibraryItem interface
Library property
## Signature
```typescript
interface ILIB_LibraryItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[libraryType](./ILIB_LibraryItem.md)
</td><td>
</td><td>
[ELIB\_LibraryType](../enums/ELIB_LibraryType.md)
</td><td>
Library type
</td></tr>
<tr><td>
[libraryUuid?](./ILIB_LibraryItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ UUID of the library it belongs to
</td></tr>
<tr><td>
[uuid](./ILIB_LibraryItem.md)
</td><td>
</td><td>
string
</td><td>
UUID
</td></tr>
</tbody></table>
---
## 属性详情
### librarytype
# ILIB\_LibraryItem.libraryType property
Library type
## Signature
```typescript
libraryType: ELIB_LibraryType;
```
### libraryuuid
# ILIB\_LibraryItem.libraryUuid property
UUID of the library it belongs to
## Signature
```typescript
libraryUuid?: string;
```
### uuid
# ILIB\_LibraryItem.uuid property
UUID
## Signature
```typescript
uuid: string;
```
references/interfaces/ILIB_LibraryInfo.md
# ILIB\_LibraryInfo interface
Library information
## Signature
```typescript
interface ILIB_LibraryInfo
```
## Remarks
Contains the name of the library and its UUID
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[name](./ILIB_LibraryInfo.md)
</td><td>
</td><td>
string
</td><td>
Library name
</td></tr>
<tr><td>
[uuid](./ILIB_LibraryInfo.md)
</td><td>
</td><td>
string
</td><td>
Library UUID
</td></tr>
</tbody></table>
---
## 属性详情
### name
# ILIB\_LibraryInfo.name property
Library name
## Signature
```typescript
name: string;
```
### uuid
# ILIB\_LibraryInfo.uuid property
Library UUID
## Signature
```typescript
uuid: string;
```
references/interfaces/ILIB_PanelLibrarySearchItem.md
# ILIB\_PanelLibrarySearchItem interface
Searched panel library properties
## Signature
```typescript
interface ILIB_PanelLibrarySearchItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[ascription](./ILIB_PanelLibrarySearchItem.md)
</td><td>
</td><td>
string
</td><td>
Ownership
</td></tr>
<tr><td>
[classification?](./ILIB_PanelLibrarySearchItem.md)
</td><td>
</td><td>
[ILIB\_ClassificationIndex](./ILIB_ClassificationIndex.md) \| Array<string>
</td><td>
_(Optional)_ Classification
</td></tr>
<tr><td>
[description?](./ILIB_PanelLibrarySearchItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Description
</td></tr>
<tr><td>
[lastModifiedBy](./ILIB_PanelLibrarySearchItem.md)
</td><td>
</td><td>
string
</td><td>
Last modifier
</td></tr>
<tr><td>
[libraryUuid](./ILIB_PanelLibrarySearchItem.md)
</td><td>
</td><td>
string
</td><td>
UUID of the library it belongs to
</td></tr>
<tr><td>
[name](./ILIB_PanelLibrarySearchItem.md)
</td><td>
</td><td>
string
</td><td>
Panel library name
</td></tr>
<tr><td>
[ordinal](./ILIB_PanelLibrarySearchItem.md)
</td><td>
</td><td>
number
</td><td>
Sorting
</td></tr>
<tr><td>
[updateTimestamp](./ILIB_PanelLibrarySearchItem.md)
</td><td>
</td><td>
number
</td><td>
Update timestamp
</td></tr>
<tr><td>
[uuid](./ILIB_PanelLibrarySearchItem.md)
</td><td>
</td><td>
string
</td><td>
Panel library UUID
</td></tr>
</tbody></table>
---
## 属性详情
### ascription
# ILIB\_PanelLibrarySearchItem.ascription property
Ownership
## Signature
```typescript
ascription: string;
```
### classification
# ILIB\_PanelLibrarySearchItem.classification property
Classification
## Signature
```typescript
classification?: ILIB_ClassificationIndex | Array<string>;
```
### description
# ILIB\_PanelLibrarySearchItem.description property
Description
## Signature
```typescript
description?: string;
```
### lastmodifiedby
# ILIB\_PanelLibrarySearchItem.lastModifiedBy property
Last modifier
## Signature
```typescript
lastModifiedBy: string;
```
### libraryuuid
# ILIB\_PanelLibrarySearchItem.libraryUuid property
UUID of the library it belongs to
## Signature
```typescript
libraryUuid: string;
```
### name
# ILIB\_PanelLibrarySearchItem.name property
Panel library name
## Signature
```typescript
name: string;
```
### ordinal
# ILIB\_PanelLibrarySearchItem.ordinal property
Sorting
## Signature
```typescript
ordinal: number;
```
### updatetimestamp
# ILIB\_PanelLibrarySearchItem.updateTimestamp property
Update timestamp
## Signature
```typescript
updateTimestamp: number;
```
### uuid
# ILIB\_PanelLibrarySearchItem.uuid property
Panel library UUID
## Signature
```typescript
uuid: string;
```
references/interfaces/ILIB_SymbolItem.md
# ILIB\_SymbolItem interface
Symbol property
## Signature
```typescript
interface ILIB_SymbolItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[cbbUuid?](./ILIB_SymbolItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ UUID of the reuse block it belongs to. Only the reuse block symbol has this property
</td></tr>
<tr><td>
[classification?](./ILIB_SymbolItem.md)
</td><td>
</td><td>
[ILIB\_ClassificationIndex](./ILIB_ClassificationIndex.md) \| Array<string>
</td><td>
_(Optional)_ Classification
</td></tr>
<tr><td>
[description?](./ILIB_SymbolItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Description
</td></tr>
<tr><td>
[libraryType](./ILIB_SymbolItem.md)
</td><td>
`readonly`
</td><td>
[ELIB\_LibraryType.SYMBOL](../enums/ELIB_LibraryType.md)
</td><td>
Library type
</td></tr>
<tr><td>
[libraryUuid](./ILIB_SymbolItem.md)
</td><td>
</td><td>
string
</td><td>
UUID of the library it belongs to
</td></tr>
<tr><td>
[name](./ILIB_SymbolItem.md)
</td><td>
</td><td>
string
</td><td>
Symbol name
</td></tr>
<tr><td>
[otherProperty?](./ILIB_SymbolItem.md)
</td><td>
</td><td>
Record<string, boolean \| number \| string \| undefined>
</td><td>
_(Optional)_ 其它属性
</td></tr>
<tr><td>
[subPartNames](./ILIB_SymbolItem.md)
</td><td>
</td><td>
\[\]
</td><td>
Sub-part name array
</td></tr>
<tr><td>
[type](./ILIB_SymbolItem.md)
</td><td>
</td><td>
[ELIB\_SymbolType](../enums/ELIB_SymbolType.md)
</td><td>
Symbol type
</td></tr>
<tr><td>
[uuid](./ILIB_SymbolItem.md)
</td><td>
</td><td>
string
</td><td>
Symbol UUID
</td></tr>
</tbody></table>
---
## 属性详情
### cbbuuid
# ILIB\_SymbolItem.cbbUuid property
UUID of the reuse block it belongs to. Only the reuse block symbol has this property
## Signature
```typescript
cbbUuid?: string;
```
### classification
# ILIB\_SymbolItem.classification property
Classification
## Signature
```typescript
classification?: ILIB_ClassificationIndex | Array<string>;
```
### description
# ILIB\_SymbolItem.description property
Description
## Signature
```typescript
description?: string;
```
### librarytype
# ILIB\_SymbolItem.libraryType property
Library type
## Signature
```typescript
readonly libraryType: ELIB_LibraryType.SYMBOL;
```
### libraryuuid
# ILIB\_SymbolItem.libraryUuid property
UUID of the library it belongs to
## Signature
```typescript
libraryUuid: string;
```
### name
# ILIB\_SymbolItem.name property
Symbol name
## Signature
```typescript
name: string;
```
### otherproperty
# ILIB\_SymbolItem.otherProperty property
其它属性
## Signature
```typescript
otherProperty?: Record<string, boolean | number | string | undefined>;
```
### subpartnames
# ILIB\_SymbolItem.subPartNames property
Sub-part name array
## Signature
```typescript
subPartNames: [];
```
### type
# ILIB\_SymbolItem.type property
Symbol type
## Signature
```typescript
type: ELIB_SymbolType;
```
### uuid
# ILIB\_SymbolItem.uuid property
Symbol UUID
## Signature
```typescript
uuid: string;
```
references/interfaces/ILIB_SimulationModelSearchItem.md
# ILIB\_SimulationModelSearchItem interface
Searched simulation model properties
## Signature
```typescript
interface ILIB_SimulationModelSearchItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[ascription](./ILIB_SimulationModelSearchItem.md)
</td><td>
</td><td>
string
</td><td>
Ownership
</td></tr>
<tr><td>
[classification?](./ILIB_SimulationModelSearchItem.md)
</td><td>
</td><td>
Array<string>
</td><td>
_(Optional)_ Classification
</td></tr>
<tr><td>
[description?](./ILIB_SimulationModelSearchItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Description
</td></tr>
<tr><td>
[lastModifiedBy](./ILIB_SimulationModelSearchItem.md)
</td><td>
</td><td>
string
</td><td>
Last modifier
</td></tr>
<tr><td>
[libraryUuid](./ILIB_SimulationModelSearchItem.md)
</td><td>
</td><td>
string
</td><td>
UUID of the library it belongs to
</td></tr>
<tr><td>
[name](./ILIB_SimulationModelSearchItem.md)
</td><td>
</td><td>
string
</td><td>
Simulation model name
</td></tr>
<tr><td>
[ordinal](./ILIB_SimulationModelSearchItem.md)
</td><td>
</td><td>
number
</td><td>
Sorting
</td></tr>
<tr><td>
[type](./ILIB_SimulationModelSearchItem.md)
</td><td>
</td><td>
[ELIB\_SimulationModelType](../enums/ELIB_SimulationModelType.md)
</td><td>
Simulation model type
</td></tr>
<tr><td>
[updateTimestamp](./ILIB_SimulationModelSearchItem.md)
</td><td>
</td><td>
number
</td><td>
Update timestamp
</td></tr>
<tr><td>
[uuid](./ILIB_SimulationModelSearchItem.md)
</td><td>
</td><td>
string
</td><td>
Simulation model UUID
</td></tr>
</tbody></table>
---
## 属性详情
### ascription
# ILIB\_SimulationModelSearchItem.ascription property
Ownership
## Signature
```typescript
ascription: string;
```
### classification
# ILIB\_SimulationModelSearchItem.classification property
Classification
## Signature
```typescript
classification?: Array<string>;
```
### description
# ILIB\_SimulationModelSearchItem.description property
Description
## Signature
```typescript
description?: string;
```
### lastmodifiedby
# ILIB\_SimulationModelSearchItem.lastModifiedBy property
Last modifier
## Signature
```typescript
lastModifiedBy: string;
```
### libraryuuid
# ILIB\_SimulationModelSearchItem.libraryUuid property
UUID of the library it belongs to
## Signature
```typescript
libraryUuid: string;
```
### name
# ILIB\_SimulationModelSearchItem.name property
Simulation model name
## Signature
```typescript
name: string;
```
### ordinal
# ILIB\_SimulationModelSearchItem.ordinal property
Sorting
## Signature
```typescript
ordinal: number;
```
### type
# ILIB\_SimulationModelSearchItem.type property
Simulation model type
## Signature
```typescript
type: ELIB_SimulationModelType;
```
### updatetimestamp
# ILIB\_SimulationModelSearchItem.updateTimestamp property
Update timestamp
## Signature
```typescript
updateTimestamp: number;
```
### uuid
# ILIB\_SimulationModelSearchItem.uuid property
Simulation model UUID
## Signature
```typescript
uuid: string;
```
references/interfaces/ILIB_SymbolPropertiesForSearch.md
# ILIB\_SymbolPropertiesForSearch interface
Symbol parameters that can be used for precise search
## Signature
```typescript
interface ILIB_SymbolPropertiesForSearch
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[name?](./ILIB_SymbolPropertiesForSearch.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Symbol name
</td></tr>
</tbody></table>
---
## 属性详情
### name
# ILIB\_SymbolPropertiesForSearch.name property
Symbol name
## Signature
```typescript
name?: string;
```
references/interfaces/ILIB_PanelLibraryItem.md
# ILIB\_PanelLibraryItem interface
Panel library property
## Signature
```typescript
interface ILIB_PanelLibraryItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[classification?](./ILIB_PanelLibraryItem.md)
</td><td>
</td><td>
[ILIB\_ClassificationIndex](./ILIB_ClassificationIndex.md) \| Array<string>
</td><td>
_(Optional)_ Classification
</td></tr>
<tr><td>
[description?](./ILIB_PanelLibraryItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Description
</td></tr>
<tr><td>
[libraryType](./ILIB_PanelLibraryItem.md)
</td><td>
`readonly`
</td><td>
[ELIB\_LibraryType.PANEL\_LIBRARY](../enums/ELIB_LibraryType.md)
</td><td>
Library type
</td></tr>
<tr><td>
[libraryUuid](./ILIB_PanelLibraryItem.md)
</td><td>
</td><td>
string
</td><td>
UUID of the library it belongs to
</td></tr>
<tr><td>
[name](./ILIB_PanelLibraryItem.md)
</td><td>
</td><td>
string
</td><td>
Panel library name
</td></tr>
<tr><td>
[uuid](./ILIB_PanelLibraryItem.md)
</td><td>
</td><td>
string
</td><td>
Panel library UUID
</td></tr>
</tbody></table>
---
## 属性详情
### classification
# ILIB\_PanelLibraryItem.classification property
Classification
## Signature
```typescript
classification?: ILIB_ClassificationIndex | Array<string>;
```
### description
# ILIB\_PanelLibraryItem.description property
Description
## Signature
```typescript
description?: string;
```
### librarytype
# ILIB\_PanelLibraryItem.libraryType property
Library type
## Signature
```typescript
readonly libraryType: ELIB_LibraryType.PANEL_LIBRARY;
```
### libraryuuid
# ILIB\_PanelLibraryItem.libraryUuid property
UUID of the library it belongs to
## Signature
```typescript
libraryUuid: string;
```
### name
# ILIB\_PanelLibraryItem.name property
Panel library name
## Signature
```typescript
name: string;
```
### uuid
# ILIB\_PanelLibraryItem.uuid property
Panel library UUID
## Signature
```typescript
uuid: string;
```
references/interfaces/ILIB_SymbolSearchItem.md
# ILIB\_SymbolSearchItem interface
Searched symbol properties
## Signature
```typescript
interface ILIB_SymbolSearchItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[ascription](./ILIB_SymbolSearchItem.md)
</td><td>
</td><td>
string
</td><td>
Ownership
</td></tr>
<tr><td>
[classification?](./ILIB_SymbolSearchItem.md)
</td><td>
</td><td>
[ILIB\_ClassificationIndex](./ILIB_ClassificationIndex.md) \| Array<string>
</td><td>
_(Optional)_ Classification
</td></tr>
<tr><td>
[description?](./ILIB_SymbolSearchItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Description
</td></tr>
<tr><td>
[lastModifiedBy](./ILIB_SymbolSearchItem.md)
</td><td>
</td><td>
string
</td><td>
Last modifier
</td></tr>
<tr><td>
[libraryUuid](./ILIB_SymbolSearchItem.md)
</td><td>
</td><td>
string
</td><td>
UUID of the library it belongs to
</td></tr>
<tr><td>
[name](./ILIB_SymbolSearchItem.md)
</td><td>
</td><td>
string
</td><td>
Symbol name
</td></tr>
<tr><td>
[ordinal](./ILIB_SymbolSearchItem.md)
</td><td>
</td><td>
number
</td><td>
Sorting
</td></tr>
<tr><td>
[type](./ILIB_SymbolSearchItem.md)
</td><td>
</td><td>
[ELIB\_SymbolType](../enums/ELIB_SymbolType.md)
</td><td>
Symbol type
</td></tr>
<tr><td>
[updateTimestamp](./ILIB_SymbolSearchItem.md)
</td><td>
</td><td>
number
</td><td>
Update timestamp
</td></tr>
<tr><td>
[uuid](./ILIB_SymbolSearchItem.md)
</td><td>
</td><td>
string
</td><td>
Symbol UUID
</td></tr>
</tbody></table>
---
## 属性详情
### ascription
# ILIB\_SymbolSearchItem.ascription property
Ownership
## Signature
```typescript
ascription: string;
```
### classification
# ILIB\_SymbolSearchItem.classification property
Classification
## Signature
```typescript
classification?: ILIB_ClassificationIndex | Array<string>;
```
### description
# ILIB\_SymbolSearchItem.description property
Description
## Signature
```typescript
description?: string;
```
### lastmodifiedby
# ILIB\_SymbolSearchItem.lastModifiedBy property
Last modifier
## Signature
```typescript
lastModifiedBy: string;
```
### libraryuuid
# ILIB\_SymbolSearchItem.libraryUuid property
UUID of the library it belongs to
## Signature
```typescript
libraryUuid: string;
```
### name
# ILIB\_SymbolSearchItem.name property
Symbol name
## Signature
```typescript
name: string;
```
### ordinal
# ILIB\_SymbolSearchItem.ordinal property
Sorting
## Signature
```typescript
ordinal: number;
```
### type
# ILIB\_SymbolSearchItem.type property
Symbol type
## Signature
```typescript
type: ELIB_SymbolType;
```
### updatetimestamp
# ILIB\_SymbolSearchItem.updateTimestamp property
Update timestamp
## Signature
```typescript
updateTimestamp: number;
```
### uuid
# ILIB\_SymbolSearchItem.uuid property
Symbol UUID
## Signature
```typescript
uuid: string;
```
references/interfaces/IPCB_AutoRoutingResult.md
# IPCB\_AutoRoutingResult interface
Auto routing result
## Signature
```typescript
interface IPCB_AutoRoutingResult
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[duration](./IPCB_AutoRoutingResult.md)
</td><td>
</td><td>
number
</td><td>
Auto routing duration (milliseconds)
</td></tr>
<tr><td>
[failedNets](./IPCB_AutoRoutingResult.md)
</td><td>
</td><td>
Array<string>
</td><td>
List of net names that failed to be routed
</td></tr>
<tr><td>
[success](./IPCB_AutoRoutingResult.md)
</td><td>
</td><td>
boolean
</td><td>
Whether auto routing started successfully
</td></tr>
<tr><td>
[successNetsCount](./IPCB_AutoRoutingResult.md)
</td><td>
</td><td>
number
</td><td>
Number of nets that were routed successfully
</td></tr>
<tr><td>
[totalNetsCount](./IPCB_AutoRoutingResult.md)
</td><td>
</td><td>
number
</td><td>
Total number of nets participating in auto routing
</td></tr>
</tbody></table>
---
## 属性详情
### duration
# IPCB\_AutoRoutingResult.duration property
Auto routing duration (milliseconds)
## Signature
```typescript
duration: number;
```
### failednets
# IPCB\_AutoRoutingResult.failedNets property
List of net names that failed to be routed
## Signature
```typescript
failedNets: Array<string>;
```
### success
# IPCB\_AutoRoutingResult.success property
Whether auto routing started successfully
## Signature
```typescript
success: boolean;
```
### successnetscount
# IPCB\_AutoRoutingResult.successNetsCount property
Number of nets that were routed successfully
## Signature
```typescript
successNetsCount: number;
```
### totalnetscount
# IPCB\_AutoRoutingResult.totalNetsCount property
Total number of nets participating in auto routing
## Signature
```typescript
totalNetsCount: number;
```
references/interfaces/ILIB_SimulationModelItem.md
# ILIB\_SimulationModelItem interface
Simulation model properties
## Signature
```typescript
interface ILIB_SimulationModelItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[classification?](./ILIB_SimulationModelItem.md)
</td><td>
</td><td>
Array<string>
</td><td>
_(Optional)_ Classification
</td></tr>
<tr><td>
[description?](./ILIB_SimulationModelItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Description
</td></tr>
<tr><td>
[libraryType](./ILIB_SimulationModelItem.md)
</td><td>
`readonly`
</td><td>
[ELIB\_LibraryType.SIMULATION\_MODEL\_NGSPICE](../enums/ELIB_LibraryType.md) \| [ELIB\_LibraryType.SIMULATION\_MODEL\_SIMULIDE](../enums/ELIB_LibraryType.md)
</td><td>
Library type
</td></tr>
<tr><td>
[libraryUuid](./ILIB_SimulationModelItem.md)
</td><td>
</td><td>
string
</td><td>
UUID of the library it belongs to
</td></tr>
<tr><td>
[modelCategory](./ILIB_SimulationModelItem.md)
</td><td>
</td><td>
string
</td><td>
Simulation model category
</td></tr>
<tr><td>
[modelData](./ILIB_SimulationModelItem.md)
</td><td>
</td><td>
string
</td><td>
Simulation model data
</td></tr>
<tr><td>
[modelPin](./ILIB_SimulationModelItem.md)
</td><td>
</td><td>
string
</td><td>
Simulation model pin
</td></tr>
<tr><td>
[name](./ILIB_SimulationModelItem.md)
</td><td>
</td><td>
string
</td><td>
Simulation model name
</td></tr>
<tr><td>
[type](./ILIB_SimulationModelItem.md)
</td><td>
</td><td>
[ELIB\_SimulationModelType](../enums/ELIB_SimulationModelType.md)
</td><td>
Simulation model type
</td></tr>
<tr><td>
[uuid](./ILIB_SimulationModelItem.md)
</td><td>
</td><td>
string
</td><td>
Simulation model UUID
</td></tr>
</tbody></table>
---
## 属性详情
### classification
# ILIB\_SimulationModelItem.classification property
Classification
## Signature
```typescript
classification?: Array<string>;
```
### description
# ILIB\_SimulationModelItem.description property
Description
## Signature
```typescript
description?: string;
```
### librarytype
# ILIB\_SimulationModelItem.libraryType property
Library type
## Signature
```typescript
readonly libraryType: ELIB_LibraryType.SIMULATION_MODEL_NGSPICE | ELIB_LibraryType.SIMULATION_MODEL_SIMULIDE;
```
### libraryuuid
# ILIB\_SimulationModelItem.libraryUuid property
UUID of the library it belongs to
## Signature
```typescript
libraryUuid: string;
```
### modelcategory
# ILIB\_SimulationModelItem.modelCategory property
Simulation model category
## Signature
```typescript
modelCategory: string;
```
### modeldata
# ILIB\_SimulationModelItem.modelData property
Simulation model data
## Signature
```typescript
modelData: string;
```
### modelpin
# ILIB\_SimulationModelItem.modelPin property
Simulation model pin
## Signature
```typescript
modelPin: string;
```
### name
# ILIB\_SimulationModelItem.name property
Simulation model name
## Signature
```typescript
name: string;
```
### type
# ILIB\_SimulationModelItem.type property
Simulation model type
## Signature
```typescript
type: ELIB_SimulationModelType;
```
### uuid
# ILIB\_SimulationModelItem.uuid property
Simulation model UUID
## Signature
```typescript
uuid: string;
```
references/interfaces/IPCB_AutoLayoutResult.md
# IPCB\_AutoLayoutResult interface
Auto layout result
## Signature
```typescript
interface IPCB_AutoLayoutResult
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[duration](./IPCB_AutoLayoutResult.md)
</td><td>
</td><td>
number
</td><td>
Auto layout duration (milliseconds)
</td></tr>
<tr><td>
[failedComponents](./IPCB_AutoLayoutResult.md)
</td><td>
</td><td>
Array<string>
</td><td>
List of device primitive IDs that failed to be laid out
</td></tr>
<tr><td>
[success](./IPCB_AutoLayoutResult.md)
</td><td>
</td><td>
boolean
</td><td>
Whether auto layout started successfully
</td></tr>
<tr><td>
[successComponentsCount](./IPCB_AutoLayoutResult.md)
</td><td>
</td><td>
number
</td><td>
Number of devices that were laid out successfully
</td></tr>
<tr><td>
[totalComponentsCount](./IPCB_AutoLayoutResult.md)
</td><td>
</td><td>
number
</td><td>
Total number of devices participating in auto layout
</td></tr>
</tbody></table>
---
## 属性详情
### duration
# IPCB\_AutoLayoutResult.duration property
Auto layout duration (milliseconds)
## Signature
```typescript
duration: number;
```
### failedcomponents
# IPCB\_AutoLayoutResult.failedComponents property
List of device primitive IDs that failed to be laid out
## Signature
```typescript
failedComponents: Array<string>;
```
### success
# IPCB\_AutoLayoutResult.success property
Whether auto layout started successfully
## Signature
```typescript
success: boolean;
```
### successcomponentscount
# IPCB\_AutoLayoutResult.successComponentsCount property
Number of devices that were laid out successfully
## Signature
```typescript
successComponentsCount: number;
```
### totalcomponentscount
# IPCB\_AutoLayoutResult.totalComponentsCount property
Total number of devices participating in auto layout
## Signature
```typescript
totalComponentsCount: number;
```
references/interfaces/IPCB_AutoRoutingProps.md
# IPCB\_AutoRoutingProps interface
Auto routing props
## Signature
```typescript
interface IPCB_AutoRoutingProps
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[cornerStyle?](./IPCB_AutoRoutingProps.md)
</td><td>
</td><td>
[EPCB\_AutoRoutingCornerStyle](../enums/EPCB_AutoRoutingCornerStyle.md)
</td><td>
_(Optional)_ 布线拐角风格
</td></tr>
<tr><td>
[existingPrimitiveMode?](./IPCB_AutoRoutingProps.md)
</td><td>
</td><td>
[EPCB\_AutoRoutingExistingPrimitiveMode](../enums/EPCB_AutoRoutingExistingPrimitiveMode.md)
</td><td>
_(Optional)_ 已有导线/过孔的处理方式
</td></tr>
<tr><td>
[ignoreNets?](./IPCB_AutoRoutingProps.md)
</td><td>
</td><td>
Array<string>
</td><td>
_(Optional)_ 忽略网络
</td></tr>
<tr><td>
[layers?](./IPCB_AutoRoutingProps.md)
</td><td>
</td><td>
Array<[TPCB\_LayersOfCopper](../types/TPCB_LayersOfCopper.md)<!-- -->>
</td><td>
_(Optional)_ 布线图层
</td></tr>
<tr><td>
[optimization?](./IPCB_AutoRoutingProps.md)
</td><td>
</td><td>
[EPCB\_AutoRoutingOptimization](../enums/EPCB_AutoRoutingOptimization.md)
</td><td>
_(Optional)_ 效果优先级
</td></tr>
<tr><td>
[RoutingNets?](./IPCB_AutoRoutingProps.md)
</td><td>
</td><td>
'selected' \| 'selectedComponents' \| Array<string>
</td><td>
_(Optional)_ 布线网络
</td></tr>
</tbody></table>
---
## 属性详情
### cornerstyle
# IPCB\_AutoRoutingProps.cornerStyle property
布线拐角风格
## Signature
```typescript
cornerStyle?: EPCB_AutoRoutingCornerStyle;
```
## Remarks
指定自动布线使用的拐角风格,默认为 45 度
### existingprimitivemode
# IPCB\_AutoRoutingProps.existingPrimitiveMode property
已有导线/过孔的处理方式
## Signature
```typescript
existingPrimitiveMode?: EPCB_AutoRoutingExistingPrimitiveMode;
```
## Remarks
指定对画布上已有导线和过孔的处理方式,默认为保留
### ignorenets
# IPCB\_AutoRoutingProps.ignoreNets property
忽略网络
## Signature
```typescript
ignoreNets?: Array<string>;
```
## Remarks
指定需要忽略(不参与自动布线)的网络名称数组;如不传入,则不忽略任何网络
### layers
# IPCB\_AutoRoutingProps.layers property
布线图层
## Signature
```typescript
layers?: Array<TPCB_LayersOfCopper>;
```
## Remarks
指定允许参与自动布线的图层 ID 数组;如不传入,则使用当前 PCB 的所有可用信号层
### optimization
# IPCB\_AutoRoutingProps.optimization property
效果优先级
## Signature
```typescript
optimization?: EPCB_AutoRoutingOptimization;
```
## Remarks
指定自动布线的优化目标,默认为布通率
### routingnets
# IPCB\_AutoRoutingProps.RoutingNets property
布线网络
## Signature
```typescript
RoutingNets?: 'selected' | 'selectedComponents' | Array<string>;
```
## Remarks
指定需要参与自动布线的网络名称数组;如不传入或传入空数组,则对所有未布线的网络进行自动布线
references/interfaces/IPCB_DifferentialPairItem.md
# IPCB\_DifferentialPairItem interface
Differential pair properties
## Signature
```typescript
interface IPCB_DifferentialPairItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[name](./IPCB_DifferentialPairItem.md)
</td><td>
</td><td>
string
</td><td>
Differential pair name
</td></tr>
<tr><td>
[negativeNet](./IPCB_DifferentialPairItem.md)
</td><td>
</td><td>
string
</td><td>
Negative net
</td></tr>
<tr><td>
[positiveNet](./IPCB_DifferentialPairItem.md)
</td><td>
</td><td>
string
</td><td>
Positive net
</td></tr>
</tbody></table>
---
## 属性详情
### name
# IPCB\_DifferentialPairItem.name property
Differential pair name
## Signature
```typescript
name: string;
```
### negativenet
# IPCB\_DifferentialPairItem.negativeNet property
Negative net
## Signature
```typescript
negativeNet: string;
```
### positivenet
# IPCB\_DifferentialPairItem.positiveNet property
Positive net
## Signature
```typescript
positiveNet: string;
```
references/interfaces/IPCB_DiscretizeOptions.md
# IPCB\_DiscretizeOptions interface
Discretization options
## Signature
```typescript
interface IPCB_DiscretizeOptions
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[tolerance?](./IPCB_DiscretizeOptions.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 弦高容差,即弧/曲线被弦(相邻离散点连线)近似时允许的最大偏差
</td></tr>
</tbody></table>
---
## 属性详情
### tolerance
# IPCB\_DiscretizeOptions.tolerance property
弦高容差,即弧/曲线被弦(相邻离散点连线)近似时允许的最大偏差
## Signature
```typescript
tolerance?: number;
```
## Remarks
容差越小,离散点越密集,对曲线近似越精确;单位与多边形坐标一致
references/interfaces/IPCB_DiscretizedPoint.md
# IPCB\_DiscretizedPoint interface
Discretized point
## Signature
```typescript
interface IPCB_DiscretizedPoint
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[x](./IPCB_DiscretizedPoint.md)
</td><td>
</td><td>
number
</td><td>
X coordinate
</td></tr>
<tr><td>
[y](./IPCB_DiscretizedPoint.md)
</td><td>
</td><td>
number
</td><td>
Y coordinate
</td></tr>
</tbody></table>
---
## 属性详情
### x
# IPCB\_DiscretizedPoint.x property
X coordinate
## Signature
```typescript
x: number;
```
### y
# IPCB\_DiscretizedPoint.y property
Y coordinate
## Signature
```typescript
y: number;
```
references/interfaces/IPCB_BomPropertiesTableColumns.md
# IPCB\_BomPropertiesTableColumns interface
BOM column properties and sorting rules
## Signature
```typescript
interface IPCB_BomPropertiesTableColumns
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[group?](./IPCB_BomPropertiesTableColumns.md)
</td><td>
</td><td>
null \| 'Yes' \| 'No'
</td><td>
_(Optional)_ Whether to group
</td></tr>
<tr><td>
[orderWeight?](./IPCB_BomPropertiesTableColumns.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ Order weight (a larger weight is placed on the left side of the BOM first)
</td></tr>
<tr><td>
[property](./IPCB_BomPropertiesTableColumns.md)
</td><td>
</td><td>
string
</td><td>
Property
</td></tr>
<tr><td>
[sort?](./IPCB_BomPropertiesTableColumns.md)
</td><td>
</td><td>
null \| 'asc' \| 'desc'
</td><td>
_(Optional)_ Sorting rule
</td></tr>
<tr><td>
[title?](./IPCB_BomPropertiesTableColumns.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Show name
</td></tr>
</tbody></table>
---
## 属性详情
### group
# IPCB\_BomPropertiesTableColumns.group property
Whether to group
## Signature
```typescript
group?: null | 'Yes' | 'No';
```
### orderweight
# IPCB\_BomPropertiesTableColumns.orderWeight property
Order weight (a larger weight is placed on the left side of the BOM first)
## Signature
```typescript
orderWeight?: number;
```
### property
# IPCB\_BomPropertiesTableColumns.property property
Property
## Signature
```typescript
property: string;
```
### sort
# IPCB\_BomPropertiesTableColumns.sort property
Sorting rule
## Signature
```typescript
sort?: null | 'asc' | 'desc';
```
### title
# IPCB\_BomPropertiesTableColumns.title property
Show name
## Signature
```typescript
title?: string;
```
references/interfaces/IPCB_NetClassItem.md
# IPCB\_NetClassItem interface
Net class property
## Signature
```typescript
interface IPCB_NetClassItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[color](./IPCB_NetClassItem.md)
</td><td>
</td><td>
{ r: number; g: number; b: number; alpha: number } \| null
</td><td>
Net class color
</td></tr>
<tr><td>
[name](./IPCB_NetClassItem.md)
</td><td>
</td><td>
string
</td><td>
Net class name
</td></tr>
<tr><td>
[nets](./IPCB_NetClassItem.md)
</td><td>
</td><td>
Array<string>
</td><td>
Net name array
</td></tr>
</tbody></table>
---
## 属性详情
### color
# IPCB\_NetClassItem.color property
Net class color
## Signature
```typescript
color: { r: number; g: number; b: number; alpha: number } | null;
```
### name
# IPCB\_NetClassItem.name property
Net class name
## Signature
```typescript
name: string;
```
### nets
# IPCB\_NetClassItem.nets property
Net name array
## Signature
```typescript
nets: Array<string>;
```
references/interfaces/IPCB_PadPairMinWireLengthItem.md
# IPCB\_PadPairMinWireLengthItem interface
Pad pair minimum wire length properties
## Signature
```typescript
interface IPCB_PadPairMinWireLengthItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[minWireLength](./IPCB_PadPairMinWireLengthItem.md)
</td><td>
</td><td>
number
</td><td>
Minimum wire length
</td></tr>
<tr><td>
[padPair](./IPCB_PadPairMinWireLengthItem.md)
</td><td>
</td><td>
\[string, string\]
</td><td>
Pad for array
</td></tr>
</tbody></table>
---
## 属性详情
### minwirelength
# IPCB\_PadPairMinWireLengthItem.minWireLength property
Minimum wire length
## Signature
```typescript
minWireLength: number;
```
### padpair
# IPCB\_PadPairMinWireLengthItem.padPair property
Pad for array
## Signature
```typescript
padPair: [string, string];
```
references/interfaces/IPCB_NetInfo.md
# IPCB\_NetInfo interface
Net property
## Signature
```typescript
interface IPCB_NetInfo
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[color](./IPCB_NetInfo.md)
</td><td>
</td><td>
{ r: number; g: number; b: number; alpha: number } \| null
</td><td>
Color
</td></tr>
<tr><td>
[length](./IPCB_NetInfo.md)
</td><td>
</td><td>
number
</td><td>
Length
</td></tr>
<tr><td>
[net](./IPCB_NetInfo.md)
</td><td>
</td><td>
string
</td><td>
Net name
</td></tr>
</tbody></table>
---
## 属性详情
### color
# IPCB\_NetInfo.color property
Color
## Signature
```typescript
color: { r: number; g: number; b: number; alpha: number } | null;
```
### length
# IPCB\_NetInfo.length property
Length
## Signature
```typescript
length: number;
```
### net
# IPCB\_NetInfo.net property
Net name
## Signature
```typescript
net: string;
```
references/interfaces/IPCB_EqualLengthNetGroupItem.md
# IPCB\_EqualLengthNetGroupItem interface
Equal-length net group properties
## Signature
```typescript
interface IPCB_EqualLengthNetGroupItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[color](./IPCB_EqualLengthNetGroupItem.md)
</td><td>
</td><td>
{ r: number; g: number; b: number; alpha: number } \| null
</td><td>
Equal-length net group color
</td></tr>
<tr><td>
[name](./IPCB_EqualLengthNetGroupItem.md)
</td><td>
</td><td>
string
</td><td>
Equal-length net group name
</td></tr>
<tr><td>
[nets](./IPCB_EqualLengthNetGroupItem.md)
</td><td>
</td><td>
Array<string>
</td><td>
Net name array
</td></tr>
</tbody></table>
---
## 属性详情
### color
# IPCB\_EqualLengthNetGroupItem.color property
Equal-length net group color
## Signature
```typescript
color: { r: number; g: number; b: number; alpha: number } | null;
```
### name
# IPCB\_EqualLengthNetGroupItem.name property
Equal-length net group name
## Signature
```typescript
name: string;
```
### nets
# IPCB\_EqualLengthNetGroupItem.nets property
Net name array
## Signature
```typescript
nets: Array<string>;
```
references/interfaces/IPCB_LayerItem.md
# IPCB\_LayerItem interface
Layer properties
## Signature
```typescript
interface IPCB_LayerItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[color](./IPCB_LayerItem.md)
</td><td>
</td><td>
string
</td><td>
Color (RGB HEX format)
</td></tr>
<tr><td>
[id](./IPCB_LayerItem.md)
</td><td>
</td><td>
[EPCB\_LayerId](../enums/EPCB_LayerId.md)
</td><td>
Layer ID
</td></tr>
<tr><td>
[inactiveColor](./IPCB_LayerItem.md)
</td><td>
</td><td>
string
</td><td>
Inactive color (RGB HEX format)
</td></tr>
<tr><td>
[inactiveTransparency](./IPCB_LayerItem.md)
</td><td>
</td><td>
number
</td><td>
Inactive transparency (%)
</td></tr>
<tr><td>
[layerStatus](./IPCB_LayerItem.md)
</td><td>
</td><td>
[EPCB\_LayerStatus](../enums/EPCB_LayerStatus.md)
</td><td>
Layer status
</td></tr>
<tr><td>
[locked](./IPCB_LayerItem.md)
</td><td>
</td><td>
boolean
</td><td>
Whether it is locked
</td></tr>
<tr><td>
[name](./IPCB_LayerItem.md)
</td><td>
</td><td>
string
</td><td>
Name
</td></tr>
<tr><td>
[transparency](./IPCB_LayerItem.md)
</td><td>
</td><td>
number
</td><td>
Transparency (%)
</td></tr>
<tr><td>
[type](./IPCB_LayerItem.md)
</td><td>
</td><td>
[EPCB\_LayerType](../enums/EPCB_LayerType.md)
</td><td>
Type
</td></tr>
</tbody></table>
---
## 属性详情
### color
# IPCB\_LayerItem.color property
Color (RGB HEX format)
## Signature
```typescript
color: string;
```
### id
# IPCB\_LayerItem.id property
Layer ID
## Signature
```typescript
id: EPCB_LayerId;
```
### inactivecolor
# IPCB\_LayerItem.inactiveColor property
Inactive color (RGB HEX format)
## Signature
```typescript
inactiveColor: string;
```
### inactivetransparency
# IPCB\_LayerItem.inactiveTransparency property
Inactive transparency (%)
## Signature
```typescript
inactiveTransparency: number;
```
### layerstatus
# IPCB\_LayerItem.layerStatus property
Layer status
## Signature
```typescript
layerStatus: EPCB_LayerStatus;
```
### locked
# IPCB\_LayerItem.locked property
Whether it is locked
## Signature
```typescript
locked: boolean;
```
### name
# IPCB\_LayerItem.name property
Name
## Signature
```typescript
name: string;
```
### transparency
# IPCB\_LayerItem.transparency property
Transparency (%)
## Signature
```typescript
transparency: number;
```
### type
# IPCB\_LayerItem.type property
Type
## Signature
```typescript
type: EPCB_LayerType;
```
references/interfaces/IPCB_PadPairGroupItem.md
# IPCB\_PadPairGroupItem interface
Pad pair group properties
## Signature
```typescript
interface IPCB_PadPairGroupItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[name](./IPCB_PadPairGroupItem.md)
</td><td>
</td><td>
string
</td><td>
Pad pair group name
</td></tr>
<tr><td>
[padPairs](./IPCB_PadPairGroupItem.md)
</td><td>
</td><td>
Array<\[string, string\]>
</td><td>
Pad for array
</td></tr>
</tbody></table>
---
## 属性详情
### name
# IPCB\_PadPairGroupItem.name property
Pad pair group name
## Signature
```typescript
name: string;
```
### padpairs
# IPCB\_PadPairGroupItem.padPairs property
Pad for array
## Signature
```typescript
padPairs: Array<[string, string]>;
```
references/interfaces/IPCB_Primitive.md
# IPCB\_Primitive interface
PCB primitive
## Signature
```typescript
interface IPCB_Primitive
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[create](./IPCB_Primitive.md)
</td><td>
</td><td>
() => [IPCB\_Primitive](./IPCB_Primitive.md) \| Promise<[IPCB\_Primitive](./IPCB_Primitive.md)<!-- -->>
</td><td>
</td></tr>
<tr><td>
[done](./IPCB_Primitive.md)
</td><td>
</td><td>
() => [IPCB\_Primitive](./IPCB_Primitive.md) \| Promise<[IPCB\_Primitive](./IPCB_Primitive.md)<!-- -->>
</td><td>
</td></tr>
<tr><td>
[getState\_PrimitiveId](./IPCB_Primitive.md)
</td><td>
</td><td>
() => string
</td><td>
</td></tr>
<tr><td>
[getState\_PrimitiveType](./IPCB_Primitive.md)
</td><td>
</td><td>
() => [EPCB\_PrimitiveType](../enums/EPCB_PrimitiveType.md)
</td><td>
</td></tr>
<tr><td>
[isAsync](./IPCB_Primitive.md)
</td><td>
</td><td>
() => boolean
</td><td>
</td></tr>
<tr><td>
[reset](./IPCB_Primitive.md)
</td><td>
</td><td>
() => [IPCB\_Primitive](./IPCB_Primitive.md) \| Promise<[IPCB\_Primitive](./IPCB_Primitive.md)<!-- -->>
</td><td>
</td></tr>
<tr><td>
[toAsync](./IPCB_Primitive.md)
</td><td>
</td><td>
() => [IPCB\_Primitive](./IPCB_Primitive.md)
</td><td>
</td></tr>
<tr><td>
[toSync](./IPCB_Primitive.md)
</td><td>
</td><td>
() => [IPCB\_Primitive](./IPCB_Primitive.md)
</td><td>
</td></tr>
</tbody></table>
---
## 属性详情
### create
# IPCB\_Primitive.create property
## Signature
```typescript
create: () => IPCB_Primitive | Promise<IPCB_Primitive>;
```
### done
# IPCB\_Primitive.done property
## Signature
```typescript
done: () => IPCB_Primitive | Promise<IPCB_Primitive>;
```
### getstate_primitiveid
# IPCB\_Primitive.getState\_PrimitiveId property
## Signature
```typescript
getState_PrimitiveId: () => string;
```
### getstate_primitivetype
# IPCB\_Primitive.getState\_PrimitiveType property
## Signature
```typescript
getState_PrimitiveType: () => EPCB_PrimitiveType;
```
### isasync
# IPCB\_Primitive.isAsync property
## Signature
```typescript
isAsync: () => boolean;
```
### reset
# IPCB\_Primitive.reset property
## Signature
```typescript
reset: () => IPCB_Primitive | Promise<IPCB_Primitive>;
```
### toasync
# IPCB\_Primitive.toAsync property
## Signature
```typescript
toAsync: () => IPCB_Primitive;
```
### tosync
# IPCB\_Primitive.toSync property
## Signature
```typescript
toSync: () => IPCB_Primitive;
```
references/interfaces/IPCB_PrimitiveAPI.md
# IPCB\_PrimitiveAPI interface
PCB primitive API
## Signature
```typescript
interface IPCB_PrimitiveAPI
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[create](./IPCB_PrimitiveAPI.md)
</td><td>
</td><td>
(...args: any\[\]) => [IPCB\_Primitive](./IPCB_Primitive.md) \| undefined \| Promise<[IPCB\_Primitive](./IPCB_Primitive.md)<!-- -->> \| Promise<[IPCB\_Primitive](./IPCB_Primitive.md) \| undefined>
</td><td>
</td></tr>
<tr><td>
[delete](./IPCB_PrimitiveAPI.md)
</td><td>
</td><td>
(primitiveIds: string \| any \| Array<string> \| Array<any>) => boolean \| Promise<boolean>
</td><td>
</td></tr>
<tr><td>
[get](./IPCB_PrimitiveAPI.md)
</td><td>
</td><td>
{ (primitiveIds: string): [IPCB\_Primitive](./IPCB_Primitive.md) \| undefined \| Promise<[IPCB\_Primitive](./IPCB_Primitive.md) \| undefined>; (primitiveIds: Array<string>): Array<[IPCB\_Primitive](./IPCB_Primitive.md)<!-- -->> \| Promise<Array<[IPCB\_Primitive](./IPCB_Primitive.md)<!-- -->>> }
</td><td>
</td></tr>
<tr><td>
[getAll](./IPCB_PrimitiveAPI.md)
</td><td>
</td><td>
(...args: any\[\]) => Array<[IPCB\_Primitive](./IPCB_Primitive.md)<!-- -->> \| Promise<Array<[IPCB\_Primitive](./IPCB_Primitive.md)<!-- -->>>
</td><td>
</td></tr>
<tr><td>
[getAllPrimitiveId](./IPCB_PrimitiveAPI.md)
</td><td>
</td><td>
(...args: any\[\]) => Array<string> \| Promise<Array<string>>
</td><td>
</td></tr>
<tr><td>
[modify](./IPCB_PrimitiveAPI.md)
</td><td>
</td><td>
(primitiveId: string \| any, ...args: any\[\]) => [IPCB\_Primitive](./IPCB_Primitive.md) \| undefined \| Promise<[IPCB\_Primitive](./IPCB_Primitive.md)<!-- -->> \| Promise<[IPCB\_Primitive](./IPCB_Primitive.md) \| undefined>
</td><td>
</td></tr>
</tbody></table>
---
## 属性详情
### create
# IPCB\_PrimitiveAPI.create property
## Signature
```typescript
create: (...args: any[]) =>
IPCB_Primitive | undefined | Promise<IPCB_Primitive> | Promise<IPCB_Primitive | undefined>;
```
### delete
# IPCB\_PrimitiveAPI.delete property
## Signature
```typescript
delete: (primitiveIds: string | any | Array<string> | Array<any>) => boolean | Promise<boolean>;
```
### get
# IPCB\_PrimitiveAPI.get property
## Signature
```typescript
get: { (primitiveIds: string): IPCB_Primitive | undefined | Promise<IPCB_Primitive | undefined>; (primitiveIds: Array<string>): Array<IPCB_Primitive> | Promise<Array<IPCB_Primitive>> };
```
### getall
# IPCB\_PrimitiveAPI.getAll property
## Signature
```typescript
getAll: (...args: any[]) => Array<IPCB_Primitive> | Promise<Array<IPCB_Primitive>>;
```
### getallprimitiveid
# IPCB\_PrimitiveAPI.getAllPrimitiveId property
## Signature
```typescript
getAllPrimitiveId: (...args: any[]) => Array<string> | Promise<Array<string>>;
```
### modify
# IPCB\_PrimitiveAPI.modify property
## Signature
```typescript
modify: (primitiveId: string | any, ...args: any[]) =>
IPCB_Primitive | undefined | Promise<IPCB_Primitive> | Promise<IPCB_Primitive | undefined>;
```
references/interfaces/IPCB_PhysicalStackingConfiguration.md
# IPCB\_PhysicalStackingConfiguration interface
物理叠层配置
## Signature
```typescript
interface IPCB_PhysicalStackingConfiguration
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[layerCount](./IPCB_PhysicalStackingConfiguration.md)
</td><td>
</td><td>
number
</td><td>
总叠层数
</td></tr>
<tr><td>
[list](./IPCB_PhysicalStackingConfiguration.md)
</td><td>
</td><td>
Array<Record<string, unknown>>
</td><td>
叠层列表
</td></tr>
<tr><td>
[name](./IPCB_PhysicalStackingConfiguration.md)
</td><td>
</td><td>
string
</td><td>
物理叠层配置名称
</td></tr>
</tbody></table>
---
## 属性详情
### layercount
# IPCB\_PhysicalStackingConfiguration.layerCount property
总叠层数
## Signature
```typescript
layerCount: number;
```
### list
# IPCB\_PhysicalStackingConfiguration.list property
叠层列表
## Signature
```typescript
list: Array<Record<string, unknown>>;
```
### name
# IPCB\_PhysicalStackingConfiguration.name property
物理叠层配置名称
## Signature
```typescript
name: string;
```
references/interfaces/IPCB_PrimitiveSolderMaskAndPasteMaskExpansion.md
# IPCB\_PrimitiveSolderMaskAndPasteMaskExpansion interface
Solder mask / paste mask expansion
## Signature
```typescript
interface IPCB_PrimitiveSolderMaskAndPasteMaskExpansion
```
## Remarks
This parameter setting includes the following three cases:
1. When the primitive is a top/bottom layer SMD pad, the solder mask/paste mask expansion of the corresponding layer can be set; other settings have no effect
2. When the primitive is a through-hole pad, the solder mask expansion of the top/bottom layer can be set; paste mask expansion settings have no effect
3. When the primitive is a via, the solder mask expansion of the top/bottom layer can be set; paste mask expansion settings have no effect. If it is a blind via, its solder mask expansion setting takes effect according to its exposed layer
The paste mask expansion is generally only used for specific purposes such as stencil production. If you do not understand its function, feel free to ignore its parameter settings
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[bottomPasteMask?](./IPCB_PrimitiveSolderMaskAndPasteMaskExpansion.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ Bottom paste mask expansion
</td></tr>
<tr><td>
[bottomSolderMask?](./IPCB_PrimitiveSolderMaskAndPasteMaskExpansion.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ Bottom solder mask expansion
</td></tr>
<tr><td>
[topPasteMask?](./IPCB_PrimitiveSolderMaskAndPasteMaskExpansion.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ Top paste mask expansion
</td></tr>
<tr><td>
[topSolderMask?](./IPCB_PrimitiveSolderMaskAndPasteMaskExpansion.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ Top solder mask expansion
</td></tr>
</tbody></table>
---
## 属性详情
### bottompastemask
# IPCB\_PrimitiveSolderMaskAndPasteMaskExpansion.bottomPasteMask property
Bottom paste mask expansion
## Signature
```typescript
bottomPasteMask?: number;
```
### bottomsoldermask
# IPCB\_PrimitiveSolderMaskAndPasteMaskExpansion.bottomSolderMask property
Bottom solder mask expansion
## Signature
```typescript
bottomSolderMask?: number;
```
### toppastemask
# IPCB\_PrimitiveSolderMaskAndPasteMaskExpansion.topPasteMask property
Top paste mask expansion
## Signature
```typescript
topPasteMask?: number;
```
### topsoldermask
# IPCB\_PrimitiveSolderMaskAndPasteMaskExpansion.topSolderMask property
Top solder mask expansion
## Signature
```typescript
topSolderMask?: number;
```
references/interfaces/IPCB_PrimitivePouredPourFill.md
# IPCB\_PrimitivePouredPourFill interface
Copper fill region
## Signature
```typescript
interface IPCB_PrimitivePouredPourFill
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[fill](./IPCB_PrimitivePouredPourFill.md)
</td><td>
</td><td>
boolean
</td><td>
Whether to fill
</td></tr>
<tr><td>
[id](./IPCB_PrimitivePouredPourFill.md)
</td><td>
</td><td>
string
</td><td>
ID
</td></tr>
<tr><td>
[lineWidth](./IPCB_PrimitivePouredPourFill.md)
</td><td>
</td><td>
number
</td><td>
Line width
</td></tr>
<tr><td>
[path](./IPCB_PrimitivePouredPourFill.md)
</td><td>
</td><td>
[IPCB\_ComplexPolygon](../classes/IPCB_ComplexPolygon.md)
</td><td>
Complex polygon
</td></tr>
</tbody></table>
---
## 属性详情
### fill
# IPCB\_PrimitivePouredPourFill.fill property
Whether to fill
## Signature
```typescript
fill: boolean;
```
### id
# IPCB\_PrimitivePouredPourFill.id property
ID
## Signature
```typescript
id: string;
```
### linewidth
# IPCB\_PrimitivePouredPourFill.lineWidth property
Line width
## Signature
```typescript
lineWidth: number;
```
### path
# IPCB\_PrimitivePouredPourFill.path property
Complex polygon
## Signature
```typescript
path: IPCB_ComplexPolygon;
```
references/interfaces/IPCB_PrimitivePadHeatWelding.md
# IPCB\_PrimitivePadHeatWelding interface
Pad thermal relief optimization parameters
## Signature
```typescript
interface IPCB_PrimitivePadHeatWelding
```
## Remarks
When the connection method ([connectionMethod](./IPCB_PrimitivePadHeatWelding.md)<!-- -->) is direct connection ([DIRECT\_CONNECTED](../enums/EPCB_PrimitivePadHeatWeldingConnectionMethod.md)<!-- -->) or no connection ([NON\_CONNECTED](../enums/EPCB_PrimitivePadHeatWeldingConnectionMethod.md)<!-- -->), the settings of divergence spacing, divergence line width, and divergence angle will be ignored
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[connectionMethod](./IPCB_PrimitivePadHeatWelding.md)
</td><td>
</td><td>
[EPCB\_PrimitivePadHeatWeldingConnectionMethod](../enums/EPCB_PrimitivePadHeatWeldingConnectionMethod.md)
</td><td>
Connection method
</td></tr>
<tr><td>
[divergenceAngle?](./IPCB_PrimitivePadHeatWelding.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ Divergence angle
</td></tr>
<tr><td>
[divergenceLineWidth?](./IPCB_PrimitivePadHeatWelding.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ Divergence line width
</td></tr>
<tr><td>
[divergenceSpacing?](./IPCB_PrimitivePadHeatWelding.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ Divergence spacing
</td></tr>
</tbody></table>
---
## 属性详情
### divergenceangle
# IPCB\_PrimitivePadHeatWelding.divergenceAngle property
Divergence angle
## Signature
```typescript
divergenceAngle?: number;
```
### divergencelinewidth
# IPCB\_PrimitivePadHeatWelding.divergenceLineWidth property
Divergence line width
## Signature
```typescript
divergenceLineWidth?: number;
```
### divergencespacing
# IPCB\_PrimitivePadHeatWelding.divergenceSpacing property
Divergence spacing
## Signature
```typescript
divergenceSpacing?: number;
```
---
## 方法详情
### connectionmethod
# IPCB\_PrimitivePadHeatWelding.connectionMethod property
Connection method
## Signature
```typescript
connectionMethod: EPCB_PrimitivePadHeatWeldingConnectionMethod;
```
references/interfaces/IPCB_SubstratePhysicalProperties.md
# IPCB\_SubstratePhysicalProperties interface
基板物理属性
## Signature
```typescript
interface IPCB_SubstratePhysicalProperties
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[numberOfLayers](./IPCB_SubstratePhysicalProperties.md)
</td><td>
</td><td>
[TPCB\_NumberOfCopperLayers](../types/TPCB_NumberOfCopperLayers.md)
</td><td>
铜箔层数
</td></tr>
<tr><td>
[substrateMaterial](./IPCB_SubstratePhysicalProperties.md)
</td><td>
</td><td>
'Common' \| 'FPC Flexible'
</td><td>
基板材料
</td></tr>
</tbody></table>
---
## 属性详情
### numberoflayers
# IPCB\_SubstratePhysicalProperties.numberOfLayers property
铜箔层数
## Signature
```typescript
numberOfLayers: TPCB_NumberOfCopperLayers;
```
### substratematerial
# IPCB\_SubstratePhysicalProperties.substrateMaterial property
基板材料
## Signature
```typescript
substrateMaterial: 'Common' | 'FPC Flexible';
```
references/interfaces/IRawNet.md
# IRawNet interface
原始数据 - net
## Signature
```typescript
interface IRawNet
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[designatorPinName](./IRawNet.md)
</td><td>
</td><td>
string \| null
</td><td>
</td></tr>
<tr><td>
[nlNet](./IRawNet.md)
</td><td>
</td><td>
string
</td><td>
</td></tr>
<tr><td>
[wires](./IRawNet.md)
</td><td>
</td><td>
Array<[IRawWire](./IRawWire.md)<!-- -->>
</td><td>
</td></tr>
</tbody></table>
---
## 属性详情
### designatorpinname
# IRawNet.designatorPinName property
## Signature
```typescript
designatorPinName: string | null;
```
### nlnet
# IRawNet.nlNet property
## Signature
```typescript
nlNet: string;
```
### wires
# IRawNet.wires property
## Signature
```typescript
wires: Array<IRawWire>;
```
references/interfaces/IRawPureSchematic.md
# IRawPureSchematic interface
原始数据 - pureSchematic
## Signature
```typescript
interface IRawPureSchematic
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[nlNetWires](./IRawPureSchematic.md)
</td><td>
</td><td>
Array<[IRawNet](./IRawNet.md)<!-- -->>
</td><td>
</td></tr>
<tr><td>
[sheets](./IRawPureSchematic.md)
</td><td>
</td><td>
\{ \[uuid: string\]: \{ uuid: string; title: string; displayTitle: string; zIndex: number \} \}
</td><td>
</td></tr>
</tbody></table>
---
## 属性详情
### nlnetwires
# IRawPureSchematic.nlNetWires property
## Signature
```typescript
nlNetWires: Array<IRawNet>;
```
### sheets
# IRawPureSchematic.sheets property
## Signature
```typescript
sheets: { [uuid: string]: { uuid: string; title: string; displayTitle: string; zIndex: number } };
```
references/interfaces/IRawSchematic.md
# IRawSchematic interface
原始数据 - schematic
## Signature
```typescript
interface IRawSchematic
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[board](./IRawSchematic.md)
</td><td>
</td><td>
string
</td><td>
</td></tr>
<tr><td>
[displayTitle](./IRawSchematic.md)
</td><td>
</td><td>
string
</td><td>
</td></tr>
<tr><td>
[title](./IRawSchematic.md)
</td><td>
</td><td>
string
</td><td>
</td></tr>
</tbody></table>
---
## 属性详情
### board
# IRawSchematic.board property
## Signature
```typescript
board: string;
```
### displaytitle
# IRawSchematic.displayTitle property
## Signature
```typescript
displayTitle: string;
```
### title
# IRawSchematic.title property
## Signature
```typescript
title: string;
```
references/interfaces/IRawWire.md
# IRawWire interface
原始数据 - wire
## Signature
```typescript
interface IRawWire
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[net](./IRawWire.md)
</td><td>
</td><td>
string
</td><td>
</td></tr>
<tr><td>
[netName](./IRawWire.md)
</td><td>
</td><td>
string\[\]
</td><td>
</td></tr>
<tr><td>
[nlNet](./IRawWire.md)
</td><td>
</td><td>
string
</td><td>
</td></tr>
<tr><td>
[path](./IRawWire.md)
</td><td>
</td><td>
string
</td><td>
</td></tr>
<tr><td>
[wirePath](./IRawWire.md)
</td><td>
</td><td>
string
</td><td>
</td></tr>
</tbody></table>
---
## 属性详情
### net
# IRawWire.net property
## Signature
```typescript
net: string;
```
### netname
# IRawWire.netName property
## Signature
```typescript
netName: string[];
```
### nlnet
# IRawWire.nlNet property
## Signature
```typescript
nlNet: string;
```
### path
# IRawWire.path property
## Signature
```typescript
path: string;
```
### wirepath
# IRawWire.wirePath property
## Signature
```typescript
wirePath: string;
```
references/interfaces/ISCH_DrcError.md
# ISCH\_DrcError interface
DRC 错误条目
## Signature
```typescript
interface ISCH_DrcError
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[net?](./ISCH_DrcError.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ 涉及网络(若有)
</td></tr>
<tr><td>
[primitives](./ISCH_DrcError.md)
</td><td>
</td><td>
Array<[ISCH\_DrcErrorPrimitive](./ISCH_DrcErrorPrimitive.md)<!-- -->>
</td><td>
涉及的图元
</td></tr>
<tr><td>
[rule](./ISCH_DrcError.md)
</td><td>
</td><td>
string
</td><td>
触发规则 key,如 `IN-IN`<!-- -->、`OUT-OUT`
</td></tr>
<tr><td>
[type](./ISCH_DrcError.md)
</td><td>
</td><td>
'fatalError' \| 'error' \| 'warn'
</td><td>
错误级别
</td></tr>
</tbody></table>
---
## 属性详情
### net
# ISCH\_DrcError.net property
涉及网络(若有)
## Signature
```typescript
net?: string;
```
### primitives
# ISCH\_DrcError.primitives property
涉及的图元
## Signature
```typescript
primitives: Array<ISCH_DrcErrorPrimitive>;
```
### rule
# ISCH\_DrcError.rule property
触发规则 key,如 `IN-IN`<!-- -->、`OUT-OUT`
## Signature
```typescript
rule: string;
```
### type
# ISCH\_DrcError.type property
错误级别
## Signature
```typescript
type: 'fatalError' | 'error' | 'warn';
```
references/interfaces/ISCH_DrcErrorPrimitive.md
# ISCH\_DrcErrorPrimitive interface
DRC 错误涉及的图元
## Signature
```typescript
interface ISCH_DrcErrorPrimitive
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[designator?](./ISCH_DrcErrorPrimitive.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ 位号,如 `R1`
</td></tr>
<tr><td>
[name?](./ISCH_DrcErrorPrimitive.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ 图元名字(引脚号 / 网络名 / 器件名,依规则而定)
</td></tr>
<tr><td>
[primitiveId](./ISCH_DrcErrorPrimitive.md)
</td><td>
</td><td>
string
</td><td>
图元 ID(可用于画布跳转定位)
</td></tr>
<tr><td>
[sheet?](./ISCH_DrcErrorPrimitive.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ 所在图页 ID
</td></tr>
</tbody></table>
---
## 属性详情
### designator
# ISCH\_DrcErrorPrimitive.designator property
位号,如 `R1`
## Signature
```typescript
designator?: string;
```
### name
# ISCH\_DrcErrorPrimitive.name property
图元名字(引脚号 / 网络名 / 器件名,依规则而定)
## Signature
```typescript
name?: string;
```
### primitiveid
# ISCH\_DrcErrorPrimitive.primitiveId property
图元 ID(可用于画布跳转定位)
## Signature
```typescript
primitiveId: string;
```
### sheet
# ISCH\_DrcErrorPrimitive.sheet property
所在图页 ID
## Signature
```typescript
sheet?: string;
```
references/interfaces/ISCH_ExportPngResolution.md
# ISCH\_ExportPngResolution interface
原理图导出图片分辨率
## Signature
```typescript
interface ISCH_ExportPngResolution
```
## Remarks
仅 PNG 导出支持分辨率参数,用于按长宽分辨率导出高清图片:
- 支持只传入 `width` 或 `height` 中的任意一个,另一侧将按原始比例自动拉伸输出(保持长宽比例); - `width` 与 `height` 均不传时,按当前一倍分辨率输出; - 单边最大支持 \*\*4096\*\*。
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[height?](./ISCH_ExportPngResolution.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 输出图片高度(像素),最大 4096
</td></tr>
<tr><td>
[width?](./ISCH_ExportPngResolution.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 输出图片宽度(像素),最大 4096
</td></tr>
</tbody></table>
---
## 属性详情
### height
# ISCH\_ExportPngResolution.height property
输出图片高度(像素),最大 4096
## Signature
```typescript
height?: number;
```
### width
# ISCH\_ExportPngResolution.width property
输出图片宽度(像素),最大 4096
## Signature
```typescript
width?: number;
```
references/interfaces/ISCH_Primitive.md
# ISCH\_Primitive interface
Schematic primitive
## Signature
```typescript
interface ISCH_Primitive
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[create](./ISCH_Primitive.md)
</td><td>
</td><td>
() => [ISCH\_Primitive](./ISCH_Primitive.md) \| Promise<[ISCH\_Primitive](./ISCH_Primitive.md)<!-- -->>
</td><td>
</td></tr>
<tr><td>
[done](./ISCH_Primitive.md)
</td><td>
</td><td>
() => [ISCH\_Primitive](./ISCH_Primitive.md) \| Promise<[ISCH\_Primitive](./ISCH_Primitive.md)<!-- -->>
</td><td>
</td></tr>
<tr><td>
[getState\_PrimitiveId](./ISCH_Primitive.md)
</td><td>
</td><td>
() => string
</td><td>
</td></tr>
<tr><td>
[getState\_PrimitiveType](./ISCH_Primitive.md)
</td><td>
</td><td>
() => [ESCH\_PrimitiveType](../enums/ESCH_PrimitiveType.md)
</td><td>
</td></tr>
<tr><td>
[isAsync](./ISCH_Primitive.md)
</td><td>
</td><td>
() => boolean
</td><td>
</td></tr>
<tr><td>
[reset](./ISCH_Primitive.md)
</td><td>
</td><td>
() => [ISCH\_Primitive](./ISCH_Primitive.md) \| Promise<[ISCH\_Primitive](./ISCH_Primitive.md)<!-- -->>
</td><td>
</td></tr>
<tr><td>
[toAsync](./ISCH_Primitive.md)
</td><td>
</td><td>
() => [ISCH\_Primitive](./ISCH_Primitive.md)
</td><td>
</td></tr>
<tr><td>
[toSync](./ISCH_Primitive.md)
</td><td>
</td><td>
() => [ISCH\_Primitive](./ISCH_Primitive.md)
</td><td>
</td></tr>
</tbody></table>
---
## 属性详情
### create
# ISCH\_Primitive.create property
## Signature
```typescript
create: () => ISCH_Primitive | Promise<ISCH_Primitive>;
```
### done
# ISCH\_Primitive.done property
## Signature
```typescript
done: () => ISCH_Primitive | Promise<ISCH_Primitive>;
```
### getstate_primitiveid
# ISCH\_Primitive.getState\_PrimitiveId property
## Signature
```typescript
getState_PrimitiveId: () => string;
```
### getstate_primitivetype
# ISCH\_Primitive.getState\_PrimitiveType property
## Signature
```typescript
getState_PrimitiveType: () => ESCH_PrimitiveType;
```
### isasync
# ISCH\_Primitive.isAsync property
## Signature
```typescript
isAsync: () => boolean;
```
### reset
# ISCH\_Primitive.reset property
## Signature
```typescript
reset: () => ISCH_Primitive | Promise<ISCH_Primitive>;
```
### toasync
# ISCH\_Primitive.toAsync property
## Signature
```typescript
toAsync: () => ISCH_Primitive;
```
### tosync
# ISCH\_Primitive.toSync property
## Signature
```typescript
toSync: () => ISCH_Primitive;
```
references/interfaces/ISCH_PrimitiveAPI.md
# ISCH\_PrimitiveAPI interface
Schematic primitive API
## Signature
```typescript
interface ISCH_PrimitiveAPI
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[create](./ISCH_PrimitiveAPI.md)
</td><td>
</td><td>
(...args: any\[\]) => [ISCH\_Primitive](./ISCH_Primitive.md) \| undefined \| Promise<[ISCH\_Primitive](./ISCH_Primitive.md)<!-- -->> \| Promise<[ISCH\_Primitive](./ISCH_Primitive.md) \| undefined>
</td><td>
</td></tr>
<tr><td>
[delete](./ISCH_PrimitiveAPI.md)
</td><td>
</td><td>
(primitiveIds: string \| any \| Array<string> \| Array<any>) => boolean \| Promise<boolean>
</td><td>
</td></tr>
<tr><td>
[get](./ISCH_PrimitiveAPI.md)
</td><td>
</td><td>
{ (primitiveIds: string): [ISCH\_Primitive](./ISCH_Primitive.md) \| undefined \| Promise<[ISCH\_Primitive](./ISCH_Primitive.md) \| undefined>; (primitiveIds: Array<string>): Array<[ISCH\_Primitive](./ISCH_Primitive.md)<!-- -->> \| Promise<Array<[ISCH\_Primitive](./ISCH_Primitive.md)<!-- -->>> }
</td><td>
</td></tr>
<tr><td>
[getAll](./ISCH_PrimitiveAPI.md)
</td><td>
</td><td>
(...args: any\[\]) => Array<[ISCH\_Primitive](./ISCH_Primitive.md)<!-- -->> \| Promise<Array<[ISCH\_Primitive](./ISCH_Primitive.md)<!-- -->>>
</td><td>
</td></tr>
<tr><td>
[getAllPrimitiveId](./ISCH_PrimitiveAPI.md)
</td><td>
</td><td>
(...args: any\[\]) => Array<string> \| Promise<Array<string>>
</td><td>
</td></tr>
<tr><td>
[modify](./ISCH_PrimitiveAPI.md)
</td><td>
</td><td>
(primitiveId: string \| any, ...args: any\[\]) => [ISCH\_Primitive](./ISCH_Primitive.md) \| undefined \| Promise<[ISCH\_Primitive](./ISCH_Primitive.md)<!-- -->> \| Promise<[ISCH\_Primitive](./ISCH_Primitive.md) \| undefined>
</td><td>
</td></tr>
</tbody></table>
---
## 属性详情
### create
# ISCH\_PrimitiveAPI.create property
## Signature
```typescript
create: (...args: any[]) =>
ISCH_Primitive | undefined | Promise<ISCH_Primitive> | Promise<ISCH_Primitive | undefined>;
```
### delete
# ISCH\_PrimitiveAPI.delete property
## Signature
```typescript
delete: (primitiveIds: string | any | Array<string> | Array<any>) => boolean | Promise<boolean>;
```
### get
# ISCH\_PrimitiveAPI.get property
## Signature
```typescript
get: { (primitiveIds: string): ISCH_Primitive | undefined | Promise<ISCH_Primitive | undefined>; (primitiveIds: Array<string>): Array<ISCH_Primitive> | Promise<Array<ISCH_Primitive>> };
```
### getall
# ISCH\_PrimitiveAPI.getAll property
## Signature
```typescript
getAll: (...args: any[]) => Array<ISCH_Primitive> | Promise<Array<ISCH_Primitive>>;
```
### getallprimitiveid
# ISCH\_PrimitiveAPI.getAllPrimitiveId property
## Signature
```typescript
getAllPrimitiveId: (...args: any[]) => Array<string> | Promise<Array<string>>;
```
### modify
# ISCH\_PrimitiveAPI.modify property
## Signature
```typescript
modify: (primitiveId: string | any, ...args: any[]) =>
ISCH_Primitive | undefined | Promise<ISCH_Primitive> | Promise<ISCH_Primitive | undefined>;
```
references/interfaces/ISCH_ProjectNetInfo.md
# ISCH\_ProjectNetInfo interface
Project net property
## Signature
```typescript
interface ISCH_ProjectNetInfo
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[boardName](./ISCH_ProjectNetInfo.md)
</td><td>
</td><td>
string
</td><td>
Board name
</td></tr>
<tr><td>
[nets](./ISCH_ProjectNetInfo.md)
</td><td>
</td><td>
Array<[ISCH\_NetInfo](./ISCH_NetInfo.md)<!-- -->>
</td><td>
Net
</td></tr>
<tr><td>
[schematicName](./ISCH_ProjectNetInfo.md)
</td><td>
</td><td>
string
</td><td>
Schematic name
</td></tr>
<tr><td>
[schematicUuid](./ISCH_ProjectNetInfo.md)
</td><td>
</td><td>
string
</td><td>
Schematic UUID
</td></tr>
</tbody></table>
---
## 属性详情
### boardname
# ISCH\_ProjectNetInfo.boardName property
Board name
## Signature
```typescript
boardName: string;
```
### nets
# ISCH\_ProjectNetInfo.nets property
Net
## Signature
```typescript
nets: Array<ISCH_NetInfo>;
```
### schematicname
# ISCH\_ProjectNetInfo.schematicName property
Schematic name
## Signature
```typescript
schematicName: string;
```
### schematicuuid
# ISCH\_ProjectNetInfo.schematicUuid property
Schematic UUID
## Signature
```typescript
schematicUuid: string;
```
references/interfaces/ISCH_NetInfo.md
# ISCH\_NetInfo interface
Net property
## Signature
```typescript
interface ISCH_NetInfo
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[net](./ISCH_NetInfo.md)
</td><td>
</td><td>
string
</td><td>
Net name
</td></tr>
<tr><td>
[wires](./ISCH_NetInfo.md)
</td><td>
</td><td>
Array<[ISCH\_WireInfo](./ISCH_WireInfo.md)<!-- -->>
</td><td>
Wire
</td></tr>
</tbody></table>
---
## 属性详情
### net
# ISCH\_NetInfo.net property
Net name
## Signature
```typescript
net: string;
```
### wires
# ISCH\_NetInfo.wires property
Wire
## Signature
```typescript
wires: Array<ISCH_WireInfo>;
```
references/interfaces/ISCH_WireInfo.md
# ISCH\_WireInfo interface
Wire property
## Signature
```typescript
interface ISCH_WireInfo
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[globalNetName](./ISCH_WireInfo.md)
</td><td>
</td><td>
string
</td><td>
Global net name
</td></tr>
<tr><td>
[id](./ISCH_WireInfo.md)
</td><td>
</td><td>
string
</td><td>
ID
</td></tr>
<tr><td>
[name](./ISCH_WireInfo.md)
</td><td>
</td><td>
string
</td><td>
Wire name
</td></tr>
<tr><td>
[pageName](./ISCH_WireInfo.md)
</td><td>
</td><td>
string
</td><td>
Schematic sheet name
</td></tr>
<tr><td>
[pageUuid](./ISCH_WireInfo.md)
</td><td>
</td><td>
string
</td><td>
Schematic sheet UUID
</td></tr>
</tbody></table>
---
## 属性详情
### globalnetname
# ISCH\_WireInfo.globalNetName property
Global net name
## Signature
```typescript
globalNetName: string;
```
### id
# ISCH\_WireInfo.id property
ID
## Signature
```typescript
id: string;
```
### name
# ISCH\_WireInfo.name property
Wire name
## Signature
```typescript
name: string;
```
### pagename
# ISCH\_WireInfo.pageName property
Schematic sheet name
## Signature
```typescript
pageName: string;
```
### pageuuid
# ISCH\_WireInfo.pageUuid property
Schematic sheet UUID
## Signature
```typescript
pageUuid: string;
```
references/interfaces/ISYS_ComparisonResponse.md
# ISYS\_ComparisonResponse interface
对比响应返回结果
## Signature
```typescript
interface ISYS_ComparisonResponse
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[data?](./ISYS_ComparisonResponse.md)
</td><td>
</td><td>
any
</td><td>
_(Optional)_ 对比结果(`success = true` 时存在)
</td></tr>
<tr><td>
[error?](./ISYS_ComparisonResponse.md)
</td><td>
</td><td>
{ code: [TSYS\_ComparisonErrorCode](../types/TSYS_ComparisonErrorCode.md)<!-- -->; message: string }
</td><td>
_(Optional)_ 错误(`success = false` 时存在)
</td></tr>
<tr><td>
[success](./ISYS_ComparisonResponse.md)
</td><td>
</td><td>
boolean
</td><td>
是否成功
</td></tr>
</tbody></table>
---
## 属性详情
### data
# ISYS\_ComparisonResponse.data property
对比结果(`success = true` 时存在)
## Signature
```typescript
data?: any;
```
### error
# ISYS\_ComparisonResponse.error property
错误(`success = false` 时存在)
## Signature
```typescript
error?: { code: TSYS_ComparisonErrorCode; message: string };
```
### success
# ISYS\_ComparisonResponse.success property
是否成功
## Signature
```typescript
success: boolean;
```
references/interfaces/ISYS_ExtensionExternalApiIndex.md
# ISYS\_ExtensionExternalApiIndex interface
external API 扁平索引(按命名空间分组)
## Signature
```typescript
interface ISYS_ExtensionExternalApiIndex
```
## Remarks
键结构:namespace -<!-- -->> apiName -<!-- -->> 注册者列表(按 priority 升序) 便于调用时 O(1) 查找并按优先级取第一个(最早注册优先)
references/interfaces/ISYS_ExtensionRegisteredExternalApis.md
# ISYS\_ExtensionRegisteredExternalApis interface
扩展注入的上层接口注册表(按扩展分组)
## Signature
```typescript
interface ISYS_ExtensionRegisteredExternalApis
```
## Remarks
键结构:extensionUuid -<!-- -->> namespace -<!-- -->> apiName -<!-- -->> 注册条目 便于按扩展卸载时整组清理
references/interfaces/ISYS_ExternalApiHelp.md
# ISYS\_ExternalApiHelp interface
扩展注入的上层接口 Help 元数据
## Signature
```typescript
interface ISYS_ExternalApiHelp
```
## Remarks
注册 external 接口时可附带本元数据,供 Help 框架渐进式披露; AI 可通过 `eda.sys_Help.help('external', namespace, apiName)` 查询
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[description?](./ISYS_ExternalApiHelp.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ 详细说明
</td></tr>
<tr><td>
[example?](./ISYS_ExternalApiHelp.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ 使用示例
</td></tr>
<tr><td>
[params?](./ISYS_ExternalApiHelp.md)
</td><td>
</td><td>
Array<{ name: string; type?: string; description?: string; required?: boolean }>
</td><td>
_(Optional)_ 入参说明
</td></tr>
<tr><td>
[returns?](./ISYS_ExternalApiHelp.md)
</td><td>
</td><td>
\{ type?: string; description?: string \}
</td><td>
_(Optional)_ 返回值说明
</td></tr>
<tr><td>
[title?](./ISYS_ExternalApiHelp.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ 接口标题
</td></tr>
</tbody></table>
---
## 属性详情
### description
# ISYS\_ExternalApiHelp.description property
详细说明
## Signature
```typescript
description?: string;
```
### example
# ISYS\_ExternalApiHelp.example property
使用示例
## Signature
```typescript
example?: string;
```
### params
# ISYS\_ExternalApiHelp.params property
入参说明
## Signature
```typescript
params?: Array<{ name: string; type?: string; description?: string; required?: boolean }>;
```
### returns
# ISYS\_ExternalApiHelp.returns property
返回值说明
## Signature
```typescript
returns?: { type?: string; description?: string };
```
### title
# ISYS\_ExternalApiHelp.title property
接口标题
## Signature
```typescript
title?: string;
```
references/interfaces/ISYS_HeaderMenuSub1MenuItem.md
# ISYS\_HeaderMenuSub1MenuItem interface
Top-level secondary menu item
## Signature
```typescript
interface ISYS_HeaderMenuSub1MenuItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[icon?](./ISYS_HeaderMenuSub1MenuItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Menu item icon
</td></tr>
<tr><td>
[id](./ISYS_HeaderMenuSub1MenuItem.md)
</td><td>
</td><td>
string
</td><td>
Menu item ID, cannot be repeated
</td></tr>
<tr><td>
[menuItems?](./ISYS_HeaderMenuSub1MenuItem.md)
</td><td>
</td><td>
Array<[ISYS\_HeaderMenuSub2MenuItem](./ISYS_HeaderMenuSub2MenuItem.md) \| null>
</td><td>
_(Optional)_ Sub-menu item
</td></tr>
<tr><td>
[registerFn?](./ISYS_HeaderMenuSub1MenuItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Registration method name (the method needs to be exported in the extension entry file)
</td></tr>
<tr><td>
[shortcutKey?](./ISYS_HeaderMenuSub1MenuItem.md)
</td><td>
</td><td>
[TSYS\_ShortcutKeys](../types/TSYS_ShortcutKeys.md)
</td><td>
_(Optional)_ 局部快捷键
</td></tr>
<tr><td>
[title](./ISYS_HeaderMenuSub1MenuItem.md)
</td><td>
</td><td>
string
</td><td>
Menu item title
</td></tr>
</tbody></table>
---
## 属性详情
### icon
# ISYS\_HeaderMenuSub1MenuItem.icon property
Menu item icon
## Signature
```typescript
icon?: string;
```
### id
# ISYS\_HeaderMenuSub1MenuItem.id property
Menu item ID, cannot be repeated
## Signature
```typescript
id: string;
```
### menuitems
# ISYS\_HeaderMenuSub1MenuItem.menuItems property
Sub-menu item
## Signature
```typescript
menuItems?: Array<ISYS_HeaderMenuSub2MenuItem | null>;
```
### shortcutkey
# ISYS\_HeaderMenuSub1MenuItem.shortcutKey property
局部快捷键
## Signature
```typescript
shortcutKey?: TSYS_ShortcutKeys;
```
## Remarks
ADD since EDA v5.0
### title
# ISYS\_HeaderMenuSub1MenuItem.title property
Menu item title
## Signature
```typescript
title: string;
```
---
## 方法详情
### registerfn
# ISYS\_HeaderMenuSub1MenuItem.registerFn property
Registration method name (the method needs to be exported in the extension entry file)
## Signature
```typescript
registerFn?: string;
```
references/interfaces/ISYS_ExternalApiRegistration.md
# ISYS\_ExternalApiRegistration interface
扩展注入的上层接口注册条目
## Signature
```typescript
interface ISYS_ExternalApiRegistration
```
## Remarks
存储在 gVars.extensionRegisteredExternalApis 与 gVars.extensionExternalApiIndex 中
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[callFn](./ISYS_ExternalApiRegistration.md)
</td><td>
</td><td>
(...args: any\[\]) => any \| Promise<any>
</td><td>
实际调用函数
</td></tr>
<tr><td>
[extensionUuid](./ISYS_ExternalApiRegistration.md)
</td><td>
</td><td>
string
</td><td>
注册该接口的扩展 UUID
</td></tr>
<tr><td>
[help?](./ISYS_ExternalApiRegistration.md)
</td><td>
</td><td>
[ISYS\_ExternalApiHelp](./ISYS_ExternalApiHelp.md)
</td><td>
_(Optional)_ Help 元数据(可选)
</td></tr>
<tr><td>
[priority](./ISYS_ExternalApiRegistration.md)
</td><td>
</td><td>
number
</td><td>
注册顺序,越小越优先(最早注册优先)
</td></tr>
</tbody></table>
---
## 属性详情
### callfn
# ISYS\_ExternalApiRegistration.callFn property
实际调用函数
## Signature
```typescript
callFn: (...args: any[]) => any | Promise<any>;
```
### extensionuuid
# ISYS\_ExternalApiRegistration.extensionUuid property
注册该接口的扩展 UUID
## Signature
```typescript
extensionUuid: string;
```
### help
# ISYS\_ExternalApiRegistration.help property
Help 元数据(可选)
## Signature
```typescript
help?: ISYS_ExternalApiHelp;
```
### priority
# ISYS\_ExternalApiRegistration.priority property
注册顺序,越小越优先(最早注册优先)
## Signature
```typescript
priority: number;
```
references/interfaces/ISYS_HeaderMenuTopMenuItem.md
# ISYS\_HeaderMenuTopMenuItem interface
Top-level primary menu item
## Signature
```typescript
interface ISYS_HeaderMenuTopMenuItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[id](./ISYS_HeaderMenuTopMenuItem.md)
</td><td>
</td><td>
string
</td><td>
Menu item ID, cannot be repeated
</td></tr>
<tr><td>
[menuItems?](./ISYS_HeaderMenuTopMenuItem.md)
</td><td>
</td><td>
Array<[ISYS\_HeaderMenuSub1MenuItem](./ISYS_HeaderMenuSub1MenuItem.md) \| null>
</td><td>
_(Optional)_ Sub-menu item
</td></tr>
<tr><td>
[title](./ISYS_HeaderMenuTopMenuItem.md)
</td><td>
</td><td>
string
</td><td>
Menu item title
</td></tr>
</tbody></table>
---
## 属性详情
### id
# ISYS\_HeaderMenuTopMenuItem.id property
Menu item ID, cannot be repeated
## Signature
```typescript
id: string;
```
### menuitems
# ISYS\_HeaderMenuTopMenuItem.menuItems property
Sub-menu item
## Signature
```typescript
menuItems?: Array<ISYS_HeaderMenuSub1MenuItem | null>;
```
### title
# ISYS\_HeaderMenuTopMenuItem.title property
Menu item title
## Signature
```typescript
title: string;
```
references/interfaces/ISYS_HeaderMenuSub2MenuItem.md
# ISYS\_HeaderMenuSub2MenuItem interface
Top-level tertiary menu item
## Signature
```typescript
interface ISYS_HeaderMenuSub2MenuItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[icon?](./ISYS_HeaderMenuSub2MenuItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Menu item icon
</td></tr>
<tr><td>
[id](./ISYS_HeaderMenuSub2MenuItem.md)
</td><td>
</td><td>
string
</td><td>
Menu item ID, cannot be repeated
</td></tr>
<tr><td>
[registerFn?](./ISYS_HeaderMenuSub2MenuItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Registration method name (the method needs to be exported in the extension entry file)
</td></tr>
<tr><td>
[shortcutKey?](./ISYS_HeaderMenuSub2MenuItem.md)
</td><td>
</td><td>
[TSYS\_ShortcutKeys](../types/TSYS_ShortcutKeys.md)
</td><td>
_(Optional)_ 局部快捷键
</td></tr>
<tr><td>
[title](./ISYS_HeaderMenuSub2MenuItem.md)
</td><td>
</td><td>
string
</td><td>
Menu item title
</td></tr>
</tbody></table>
---
## 属性详情
### icon
# ISYS\_HeaderMenuSub2MenuItem.icon property
Menu item icon
## Signature
```typescript
icon?: string;
```
### id
# ISYS\_HeaderMenuSub2MenuItem.id property
Menu item ID, cannot be repeated
## Signature
```typescript
id: string;
```
### shortcutkey
# ISYS\_HeaderMenuSub2MenuItem.shortcutKey property
局部快捷键
## Signature
```typescript
shortcutKey?: TSYS_ShortcutKeys;
```
## Remarks
ADD since EDA v5.0
### title
# ISYS\_HeaderMenuSub2MenuItem.title property
Menu item title
## Signature
```typescript
title: string;
```
---
## 方法详情
### registerfn
# ISYS\_HeaderMenuSub2MenuItem.registerFn property
Registration method name (the method needs to be exported in the extension entry file)
## Signature
```typescript
registerFn?: string;
```
references/interfaces/ISYS_FileSystemFileList.md
# ISYS\_FileSystemFileList interface
File system file path
## Signature
```typescript
interface ISYS_FileSystemFileList
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[fileName](./ISYS_FileSystemFileList.md)
</td><td>
</td><td>
string
</td><td>
File name (no slashes at the beginning or end)
</td></tr>
<tr><td>
[fullPath](./ISYS_FileSystemFileList.md)
</td><td>
</td><td>
string
</td><td>
Full path, an absolute path including the file name
</td></tr>
<tr><td>
[isDirectory](./ISYS_FileSystemFileList.md)
</td><td>
</td><td>
boolean
</td><td>
Whether it is a directory
</td></tr>
<tr><td>
[relativePath?](./ISYS_FileSystemFileList.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Relative path, not including the passed-in path and file name (when no path is passed in, there is no relative path), with no slashes at the beginning or end
</td></tr>
<tr><td>
[subFiles?](./ISYS_FileSystemFileList.md)
</td><td>
</td><td>
Array<[ISYS\_FileSystemFileList](./ISYS_FileSystemFileList.md)<!-- -->>
</td><td>
_(Optional)_ Sub-files of the directory
</td></tr>
</tbody></table>
---
## 属性详情
### filename
# ISYS\_FileSystemFileList.fileName property
File name (no slashes at the beginning or end)
## Signature
```typescript
fileName: string;
```
### fullpath
# ISYS\_FileSystemFileList.fullPath property
Full path, an absolute path including the file name
## Signature
```typescript
fullPath: string;
```
### isdirectory
# ISYS\_FileSystemFileList.isDirectory property
Whether it is a directory
## Signature
```typescript
isDirectory: boolean;
```
### relativepath
# ISYS\_FileSystemFileList.relativePath property
Relative path, not including the passed-in path and file name (when no path is passed in, there is no relative path), with no slashes at the beginning or end
## Signature
```typescript
relativePath?: string;
```
### subfiles
# ISYS\_FileSystemFileList.subFiles property
Sub-files of the directory
## Signature
```typescript
subFiles?: Array<ISYS_FileSystemFileList>;
```
references/interfaces/ISYS_HeaderMenus.md
# ISYS\_HeaderMenus interface
Header menu item
## Signature
```typescript
interface ISYS_HeaderMenus
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[blank?](./ISYS_HeaderMenus.md)
</td><td>
</td><td>
Array<[ISYS\_HeaderMenuTopMenuItem](./ISYS_HeaderMenuTopMenuItem.md)<!-- -->>
</td><td>
_(Optional)_ Blank page
</td></tr>
<tr><td>
[footprint?](./ISYS_HeaderMenus.md)
</td><td>
</td><td>
Array<[ISYS\_HeaderMenuTopMenuItem](./ISYS_HeaderMenuTopMenuItem.md)<!-- -->>
</td><td>
_(Optional)_ Footprint
</td></tr>
<tr><td>
[home?](./ISYS_HeaderMenus.md)
</td><td>
</td><td>
Array<[ISYS\_HeaderMenuTopMenuItem](./ISYS_HeaderMenuTopMenuItem.md)<!-- -->>
</td><td>
_(Optional)_ Home
</td></tr>
<tr><td>
[panel?](./ISYS_HeaderMenus.md)
</td><td>
</td><td>
Array<[ISYS\_HeaderMenuTopMenuItem](./ISYS_HeaderMenuTopMenuItem.md)<!-- -->>
</td><td>
_(Optional)_ Panel
</td></tr>
<tr><td>
[panelLibrary?](./ISYS_HeaderMenus.md)
</td><td>
</td><td>
Array<[ISYS\_HeaderMenuTopMenuItem](./ISYS_HeaderMenuTopMenuItem.md)<!-- -->>
</td><td>
_(Optional)_ Panel library
</td></tr>
<tr><td>
[panelView?](./ISYS_HeaderMenus.md)
</td><td>
</td><td>
Array<[ISYS\_HeaderMenuTopMenuItem](./ISYS_HeaderMenuTopMenuItem.md)<!-- -->>
</td><td>
_(Optional)_ Panel preview
</td></tr>
<tr><td>
[pcb?](./ISYS_HeaderMenus.md)
</td><td>
</td><td>
Array<[ISYS\_HeaderMenuTopMenuItem](./ISYS_HeaderMenuTopMenuItem.md)<!-- -->>
</td><td>
_(Optional)_ PCB
</td></tr>
<tr><td>
[pcbView?](./ISYS_HeaderMenus.md)
</td><td>
</td><td>
Array<[ISYS\_HeaderMenuTopMenuItem](./ISYS_HeaderMenuTopMenuItem.md)<!-- -->>
</td><td>
_(Optional)_ PCB preview (including 2D and 3D preview)
</td></tr>
<tr><td>
[sch?](./ISYS_HeaderMenus.md)
</td><td>
</td><td>
Array<[ISYS\_HeaderMenuTopMenuItem](./ISYS_HeaderMenuTopMenuItem.md)<!-- -->>
</td><td>
_(Optional)_ 原理图
</td></tr>
<tr><td>
[schematic?](./ISYS_HeaderMenus.md)
</td><td>
</td><td>
Array<[ISYS\_HeaderMenuTopMenuItem](./ISYS_HeaderMenuTopMenuItem.md)<!-- -->>
</td><td>
_(Optional)_ Schematic
</td></tr>
<tr><td>
[simulationSchematicNgspice?](./ISYS_HeaderMenus.md)
</td><td>
</td><td>
Array<[ISYS\_HeaderMenuTopMenuItem](./ISYS_HeaderMenuTopMenuItem.md)<!-- -->>
</td><td>
_(Optional)_ Simulation schematic: Ngspice
</td></tr>
<tr><td>
[simulationSchematicNGspice?](./ISYS_HeaderMenus.md)
</td><td>
</td><td>
Array<[ISYS\_HeaderMenuTopMenuItem](./ISYS_HeaderMenuTopMenuItem.md)<!-- -->>
</td><td>
_(Optional)_ 仿真原理图:Ngspice
</td></tr>
<tr><td>
[simulationSchematicSimulIDE?](./ISYS_HeaderMenus.md)
</td><td>
</td><td>
Array<[ISYS\_HeaderMenuTopMenuItem](./ISYS_HeaderMenuTopMenuItem.md)<!-- -->>
</td><td>
_(Optional)_ Simulation schematic: SimulIDE
</td></tr>
<tr><td>
[symbol?](./ISYS_HeaderMenus.md)
</td><td>
</td><td>
Array<[ISYS\_HeaderMenuTopMenuItem](./ISYS_HeaderMenuTopMenuItem.md)<!-- -->>
</td><td>
_(Optional)_ Symbol (including CBB symbols)
</td></tr>
</tbody></table>
---
## 属性详情
### blank
# ISYS\_HeaderMenus.blank property
Blank page
## Signature
```typescript
blank?: Array<ISYS_HeaderMenuTopMenuItem>;
```
### footprint
# ISYS\_HeaderMenus.footprint property
Footprint
## Signature
```typescript
footprint?: Array<ISYS_HeaderMenuTopMenuItem>;
```
### home
# ISYS\_HeaderMenus.home property
Home
## Signature
```typescript
home?: Array<ISYS_HeaderMenuTopMenuItem>;
```
### panel
# ISYS\_HeaderMenus.panel property
Panel
## Signature
```typescript
panel?: Array<ISYS_HeaderMenuTopMenuItem>;
```
### panellibrary
# ISYS\_HeaderMenus.panelLibrary property
Panel library
## Signature
```typescript
panelLibrary?: Array<ISYS_HeaderMenuTopMenuItem>;
```
### panelview
# ISYS\_HeaderMenus.panelView property
Panel preview
## Signature
```typescript
panelView?: Array<ISYS_HeaderMenuTopMenuItem>;
```
### pcb
# ISYS\_HeaderMenus.pcb property
PCB
## Signature
```typescript
pcb?: Array<ISYS_HeaderMenuTopMenuItem>;
```
### pcbview
# ISYS\_HeaderMenus.pcbView property
PCB preview (including 2D and 3D preview)
## Signature
```typescript
pcbView?: Array<ISYS_HeaderMenuTopMenuItem>;
```
### sch
# ISYS\_HeaderMenus.sch property
> Warning: This API is now obsolete.
>
> 请使用 `schematic` 替代
原理图
## Signature
```typescript
sch?: Array<ISYS_HeaderMenuTopMenuItem>;
```
### schematic
# ISYS\_HeaderMenus.schematic property
Schematic
## Signature
```typescript
schematic?: Array<ISYS_HeaderMenuTopMenuItem>;
```
### simulationschematicngspice
# ISYS\_HeaderMenus.simulationSchematicNGspice property
> Warning: This API is now obsolete.
>
> 请使用 `simulationSchematicNgspice` 替代
仿真原理图:Ngspice
## Signature
```typescript
simulationSchematicNGspice?: Array<ISYS_HeaderMenuTopMenuItem>;
```
### simulationschematicsimulide
# ISYS\_HeaderMenus.simulationSchematicSimulIDE property
Simulation schematic: SimulIDE
## Signature
```typescript
simulationSchematicSimulIDE?: Array<ISYS_HeaderMenuTopMenuItem>;
```
### symbol
# ISYS\_HeaderMenus.symbol property
Symbol (including CBB symbols)
## Signature
```typescript
symbol?: Array<ISYS_HeaderMenuTopMenuItem>;
```
references/interfaces/ISYS_HelpClassSummary.md
# ISYS\_HelpClassSummary interface
由 help 查询返回的类摘要
## Signature
```typescript
interface ISYS_HelpClassSummary
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[deprecated?](./ISYS_HelpClassSummary.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ 类废弃说明
</td></tr>
<tr><td>
[methods](./ISYS_HelpClassSummary.md)
</td><td>
</td><td>
Array<string \| { name: string; comment?: string }>
</td><td>
方法列表
</td></tr>
<tr><td>
[remarks?](./ISYS_HelpClassSummary.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ 类说明
</td></tr>
<tr><td>
[title?](./ISYS_HelpClassSummary.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ 类标题
</td></tr>
<tr><td>
[titles?](./ISYS_HelpClassSummary.md)
</td><td>
</td><td>
Record<string, string \| undefined>
</td><td>
_(Optional)_ 各接口标题(external 场景,键为接口名)
</td></tr>
</tbody></table>
---
## 属性详情
### deprecated
# ISYS\_HelpClassSummary.deprecated property
类废弃说明
## Signature
```typescript
deprecated?: string;
```
### remarks
# ISYS\_HelpClassSummary.remarks property
类说明
## Signature
```typescript
remarks?: string;
```
### title
# ISYS\_HelpClassSummary.title property
类标题
## Signature
```typescript
title?: string;
```
### titles
# ISYS\_HelpClassSummary.titles property
各接口标题(external 场景,键为接口名)
## Signature
```typescript
titles?: Record<string, string | undefined>;
```
---
## 方法详情
### methods
# ISYS\_HelpClassSummary.methods property
方法列表
## Signature
```typescript
methods: Array<string | { name: string; comment?: string }>;
```
## Remarks
类场景为方法条目 `{ name, comment }`<!-- -->;external 场景为接口名 `string`<!-- -->(无注释结构)
references/interfaces/ISYS_HelpData.md
# ISYS\_HelpData interface
lc-build 生成的 API jsonSchema(d.ts 的 JSON 形态)
## Signature
```typescript
interface ISYS_HelpData
```
## Remarks
结构:`$defs.{类型名}.{...jsonSchema}`<!-- -->,类的方法位于 `properties` 下
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[$defs?](./ISYS_HelpData.md)
</td><td>
</td><td>
Record<string, any>
</td><td>
_(Optional)_ 类型定义表:类型名 -<!-- -->> 类型 schema
</td></tr>
<tr><td>
[$schema?](./ISYS_HelpData.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ JSON Schema 版本
</td></tr>
</tbody></table>
---
## 属性详情
### _defs
# ISYS\_HelpData.$defs property
类型定义表:类型名 -<!-- -->> 类型 schema
## Signature
```typescript
$defs?: Record<string, any>;
```
### _schema
# ISYS\_HelpData.$schema property
JSON Schema 版本
## Signature
```typescript
$schema?: string;
```
references/interfaces/ISYS_HelpMethodDetail.md
# ISYS\_HelpMethodDetail interface
Help 查询返回的方法详情
## Signature
```typescript
interface ISYS_HelpMethodDetail
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[deprecated?](./ISYS_HelpMethodDetail.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ 方法废弃说明
</td></tr>
<tr><td>
[example?](./ISYS_HelpMethodDetail.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ 使用示例
</td></tr>
<tr><td>
[isAsync?](./ISYS_HelpMethodDetail.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ 方法是否异步(返回 Promise,调用时需 `await`<!-- -->)
</td></tr>
<tr><td>
[params?](./ISYS_HelpMethodDetail.md)
</td><td>
</td><td>
Array<{ name: string; type?: string; description?: string; required?: boolean; deprecated?: string; }>
</td><td>
_(Optional)_ 入参列表
</td></tr>
<tr><td>
[remarks?](./ISYS_HelpMethodDetail.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ 方法说明
</td></tr>
<tr><td>
[returns?](./ISYS_HelpMethodDetail.md)
</td><td>
</td><td>
\{ type?: string; description?: string \}
</td><td>
_(Optional)_ 返回值
</td></tr>
<tr><td>
[title?](./ISYS_HelpMethodDetail.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ 方法标题
</td></tr>
</tbody></table>
---
## 方法详情
### deprecated
# ISYS\_HelpMethodDetail.deprecated property
方法废弃说明
## Signature
```typescript
deprecated?: string;
```
### example
# ISYS\_HelpMethodDetail.example property
使用示例
## Signature
```typescript
example?: string;
```
### isasync
# ISYS\_HelpMethodDetail.isAsync property
方法是否异步(返回 Promise,调用时需 `await`<!-- -->)
## Signature
```typescript
isAsync?: boolean;
```
### params
# ISYS\_HelpMethodDetail.params property
入参列表
## Signature
```typescript
params?: Array<{
name: string;
type?: string;
description?: string;
required?: boolean;
deprecated?: string;
}>;
```
### remarks
# ISYS\_HelpMethodDetail.remarks property
方法说明
## Signature
```typescript
remarks?: string;
```
### returns
# ISYS\_HelpMethodDetail.returns property
返回值
## Signature
```typescript
returns?: { type?: string; description?: string };
```
### title
# ISYS\_HelpMethodDetail.title property
方法标题
## Signature
```typescript
title?: string;
```
references/interfaces/ISYS_LogLine.md
# ISYS\_LogLine interface
Log line
## Signature
```typescript
interface ISYS_LogLine
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[message](./ISYS_LogLine.md)
</td><td>
</td><td>
string
</td><td>
Log content
</td></tr>
<tr><td>
[timestamp](./ISYS_LogLine.md)
</td><td>
</td><td>
number
</td><td>
Timestamp
</td></tr>
<tr><td>
[type](./ISYS_LogLine.md)
</td><td>
</td><td>
[ESYS\_LogType](../enums/ESYS_LogType.md)
</td><td>
Log type
</td></tr>
</tbody></table>
---
## 属性详情
### message
# ISYS\_LogLine.message property
Log content
## Signature
```typescript
message: string;
```
### timestamp
# ISYS\_LogLine.timestamp property
Timestamp
## Signature
```typescript
timestamp: number;
```
### type
# ISYS\_LogLine.type property
Log type
## Signature
```typescript
type: ESYS_LogType;
```
references/interfaces/ISYS_MathBBox.md
# ISYS\_MathBBox interface
BBox (minimum bounding rectangle)
## Signature
```typescript
interface ISYS_MathBBox
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[maxX](./ISYS_MathBBox.md)
</td><td>
</td><td>
number
</td><td>
Maximum X coordinate
</td></tr>
<tr><td>
[maxY](./ISYS_MathBBox.md)
</td><td>
</td><td>
number
</td><td>
Maximum Y coordinate
</td></tr>
<tr><td>
[minX](./ISYS_MathBBox.md)
</td><td>
</td><td>
number
</td><td>
Minimum X coordinate
</td></tr>
<tr><td>
[minY](./ISYS_MathBBox.md)
</td><td>
</td><td>
number
</td><td>
Minimum Y coordinate
</td></tr>
</tbody></table>
---
## 属性详情
### maxx
# ISYS\_MathBBox.maxX property
Maximum X coordinate
## Signature
```typescript
maxX: number;
```
### maxy
# ISYS\_MathBBox.maxY property
Maximum Y coordinate
## Signature
```typescript
maxY: number;
```
### minx
# ISYS\_MathBBox.minX property
Minimum X coordinate
## Signature
```typescript
minX: number;
```
### miny
# ISYS\_MathBBox.minY property
Minimum Y coordinate
## Signature
```typescript
minY: number;
```
references/interfaces/ISYS_MathPolygonWithHoles.md
# ISYS\_MathPolygonWithHoles interface
Polygon with holes
## Signature
```typescript
interface ISYS_MathPolygonWithHoles
```
## Remarks
Contains one outer ring and zero to multiple holes (inner rings), preserving the complete topology
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[holes](./ISYS_MathPolygonWithHoles.md)
</td><td>
</td><td>
Array<Array<[ISYS\_MathPoint](./ISYS_MathPoint.md)<!-- -->>>
</td><td>
Array of holes (inner rings)
</td></tr>
<tr><td>
[outer](./ISYS_MathPolygonWithHoles.md)
</td><td>
</td><td>
Array<[ISYS\_MathPoint](./ISYS_MathPoint.md)<!-- -->>
</td><td>
Outer ring
</td></tr>
</tbody></table>
---
## 属性详情
### holes
# ISYS\_MathPolygonWithHoles.holes property
Array of holes (inner rings)
## Signature
```typescript
holes: Array<Array<ISYS_MathPoint>>;
```
### outer
# ISYS\_MathPolygonWithHoles.outer property
Outer ring
## Signature
```typescript
outer: Array<ISYS_MathPoint>;
```
references/interfaces/ISYS_RightClickMenuItem.md
# ISYS\_RightClickMenuItem interface
Right-click menu item
## Signature
```typescript
interface ISYS_RightClickMenuItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[icon?](./ISYS_RightClickMenuItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Menu item icon
</td></tr>
<tr><td>
[id](./ISYS_RightClickMenuItem.md)
</td><td>
</td><td>
string
</td><td>
Menu item ID, cannot be repeated
</td></tr>
<tr><td>
[menuItems?](./ISYS_RightClickMenuItem.md)
</td><td>
</td><td>
Array<[ISYS\_RightClickMenuItem](./ISYS_RightClickMenuItem.md) \| null>
</td><td>
_(Optional)_ Sub-menu item
</td></tr>
<tr><td>
[registerFn?](./ISYS_RightClickMenuItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Registration method name (the method needs to be exported in the extension entry file)
</td></tr>
<tr><td>
[title?](./ISYS_RightClickMenuItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Menu item title
</td></tr>
</tbody></table>
---
## 属性详情
### icon
# ISYS\_RightClickMenuItem.icon property
Menu item icon
## Signature
```typescript
icon?: string;
```
### id
# ISYS\_RightClickMenuItem.id property
Menu item ID, cannot be repeated
## Signature
```typescript
id: string;
```
### menuitems
# ISYS\_RightClickMenuItem.menuItems property
Sub-menu item
## Signature
```typescript
menuItems?: Array<ISYS_RightClickMenuItem | null>;
```
### title
# ISYS\_RightClickMenuItem.title property
Menu item title
## Signature
```typescript
title?: string;
```
---
## 方法详情
### registerfn
# ISYS\_RightClickMenuItem.registerFn property
Registration method name (the method needs to be exported in the extension entry file)
## Signature
```typescript
registerFn?: string;
```
references/interfaces/ISYS_MessageBusTask.md
# ISYS\_MessageBusTask interface
Message bus task
## Signature
```typescript
interface ISYS_MessageBusTask
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[cancel](./ISYS_MessageBusTask.md)
</td><td>
</td><td>
() => void
</td><td>
调用以取消任务
</td></tr>
<tr><td>
[execute](./ISYS_MessageBusTask.md)
</td><td>
</td><td>
(message: any) => Promise<void>
</td><td>
任务处理
</td></tr>
<tr><td>
[running](./ISYS_MessageBusTask.md)
</td><td>
</td><td>
() => boolean
</td><td>
检查运行状态
</td></tr>
</tbody></table>
---
## 属性详情
### cancel
# ISYS\_MessageBusTask.cancel property
调用以取消任务
## Signature
```typescript
cancel: () => void;
```
### execute
# ISYS\_MessageBusTask.execute property
任务处理
## Signature
```typescript
execute: (message: any) => Promise<void>;
```
### running
# ISYS\_MessageBusTask.running property
检查运行状态
## Signature
```typescript
running: () => boolean;
```
references/interfaces/ISYS_MultilingualLanguagesData.md
# ISYS\_MultilingualLanguagesData interface
Multilingual data
## Signature
```typescript
interface ISYS_MultilingualLanguagesData
```
## Remarks
Contains data of multiple languages under the same namespace
references/interfaces/ISYS_MathPoint.md
# ISYS\_MathPoint interface
Discrete points
## Signature
```typescript
interface ISYS_MathPoint
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[x](./ISYS_MathPoint.md)
</td><td>
</td><td>
number
</td><td>
X coordinate
</td></tr>
<tr><td>
[y](./ISYS_MathPoint.md)
</td><td>
</td><td>
number
</td><td>
Y coordinate
</td></tr>
</tbody></table>
---
## 属性详情
### x
# ISYS\_MathPoint.x property
X coordinate
## Signature
```typescript
x: number;
```
### y
# ISYS\_MathPoint.y property
Y coordinate
## Signature
```typescript
y: number;
```
references/interfaces/ISYS_ShortcutKeyDataWithCallFn.md
# ISYS\_ShortcutKeyDataWithCallFn interface
包含 CallFn 的快捷键数据
## Signature
```typescript
interface ISYS_ShortcutKeyDataWithCallFn extends ISYS_ShortcutKeyData
```
**Extends:** [ISYS\_ShortcutKeyData](./ISYS_ShortcutKeyData.md)
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[callFn](./ISYS_ShortcutKeyDataWithCallFn.md)
</td><td>
</td><td>
() => void \| Promise<void>
</td><td>
快捷键方法
</td></tr>
</tbody></table>
---
## 方法详情
### callfn
# ISYS\_ShortcutKeyDataWithCallFn.callFn property
快捷键方法
## Signature
```typescript
callFn: () => void | Promise<void>;
```
references/interfaces/ISYS_ShortcutKeyData.md
# ISYS\_ShortcutKeyData interface
快捷键数据
## Signature
```typescript
interface ISYS_ShortcutKeyData
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[range](./ISYS_ShortcutKeyData.md)
</td><td>
</td><td>
Array<[ESYS\_ShortcutKeyEffectiveEditorRange](../enums/ESYS_ShortcutKeyEffectiveEditorRange.md)<!-- -->>
</td><td>
快捷键生效页面范围
</td></tr>
<tr><td>
[remark](./ISYS_ShortcutKeyData.md)
</td><td>
</td><td>
string
</td><td>
备注
</td></tr>
<tr><td>
[scene](./ISYS_ShortcutKeyData.md)
</td><td>
</td><td>
Array<[ESYS\_ShortcutKeyEffectiveEditorScene](../enums/ESYS_ShortcutKeyEffectiveEditorScene.md)<!-- -->>
</td><td>
快捷键生效场景范围
</td></tr>
<tr><td>
[shortcutKey](./ISYS_ShortcutKeyData.md)
</td><td>
</td><td>
[TSYS\_ShortcutKeys](../types/TSYS_ShortcutKeys.md) \| null
</td><td>
快捷键
</td></tr>
<tr><td>
[title](./ISYS_ShortcutKeyData.md)
</td><td>
</td><td>
string
</td><td>
标题
</td></tr>
</tbody></table>
---
## 属性详情
### range
# ISYS\_ShortcutKeyData.range property
快捷键生效页面范围
## Signature
```typescript
range: Array<ESYS_ShortcutKeyEffectiveEditorRange>;
```
### remark
# ISYS\_ShortcutKeyData.remark property
备注
## Signature
```typescript
remark: string;
```
### scene
# ISYS\_ShortcutKeyData.scene property
快捷键生效场景范围
## Signature
```typescript
scene: Array<ESYS_ShortcutKeyEffectiveEditorScene>;
```
### shortcutkey
# ISYS\_ShortcutKeyData.shortcutKey property
快捷键
## Signature
```typescript
shortcutKey: TSYS_ShortcutKeys | null;
```
### title
# ISYS\_ShortcutKeyData.title property
标题
## Signature
```typescript
title: string;
```
references/interfaces/ISYS_ShortcutKeyDataWithUserDefinedShortcutKey.md
# ISYS\_ShortcutKeyDataWithUserDefinedShortcutKey interface
包含 userDefinedShortcutKey 的快捷键数据
## Signature
```typescript
interface ISYS_ShortcutKeyDataWithUserDefinedShortcutKey extends ISYS_ShortcutKeyData
```
**Extends:** [ISYS\_ShortcutKeyData](./ISYS_ShortcutKeyData.md)
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[userDefinedShortcutKey?](./ISYS_ShortcutKeyDataWithUserDefinedShortcutKey.md)
</td><td>
</td><td>
[TSYS\_ShortcutKeys](../types/TSYS_ShortcutKeys.md) \| null
</td><td>
_(Optional)_ 用户定义快捷键
</td></tr>
</tbody></table>
---
## 属性详情
### userdefinedshortcutkey
# ISYS\_ShortcutKeyDataWithUserDefinedShortcutKey.userDefinedShortcutKey property
用户定义快捷键
## Signature
```typescript
userDefinedShortcutKey?: TSYS_ShortcutKeys | null;
```
references/interfaces/ISYS_WindowEventListenerRemovableObject.md
# ISYS\_WindowEventListenerRemovableObject interface
Window event listener can remove object
## Signature
```typescript
interface ISYS_WindowEventListenerRemovableObject
```
## Remarks
This object is obtained from [addEventListener](../classes/SYS_Window.md) and can be used to remove the created event listener by simply passing it to [removeEventListener](../classes/SYS_Window.md)
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[listener](./ISYS_WindowEventListenerRemovableObject.md)
</td><td>
</td><td>
(ev: any) => any
</td><td>
</td></tr>
<tr><td>
[options?](./ISYS_WindowEventListenerRemovableObject.md)
</td><td>
</td><td>
\{ capture?: boolean \}
</td><td>
_(Optional)_
</td></tr>
<tr><td>
[type](./ISYS_WindowEventListenerRemovableObject.md)
</td><td>
</td><td>
[ESYS\_WindowEventType](../enums/ESYS_WindowEventType.md)
</td><td>
</td></tr>
</tbody></table>
---
## 属性详情
### listener
# ISYS\_WindowEventListenerRemovableObject.listener property
## Signature
```typescript
listener: (ev: any) => any;
```
### options
# ISYS\_WindowEventListenerRemovableObject.options property
## Signature
```typescript
options?: { capture?: boolean };
```
### type
# ISYS\_WindowEventListenerRemovableObject.type property
## Signature
```typescript
type: ESYS_WindowEventType;
```
references/interfaces/IconProps.md
# IconProps interface
图标配置:通过 URL 或 CSS class 指定图标
## Signature
```typescript
interface IconProps
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[iconClass?](./IconProps.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Icon CSS class name
</td></tr>
<tr><td>
[iconUrl?](./IconProps.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Icon image URL
</td></tr>
</tbody></table>
---
## 属性详情
### iconclass
# IconProps.iconClass property
Icon CSS class name
## Signature
```typescript
iconClass?: string;
```
### iconurl
# IconProps.iconUrl property
Icon image URL
## Signature
```typescript
iconUrl?: string;
```
references/interfaces/ImageProps.md
# ImageProps interface
图片组件:展示单张图片
## Signature
```typescript
interface ImageProps
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[onClick?](./ImageProps.md)
</td><td>
</td><td>
() => void
</td><td>
_(Optional)_ 点击图片时触发
</td></tr>
<tr><td>
[src](./ImageProps.md)
</td><td>
</td><td>
string
</td><td>
Image URL (required)
</td></tr>
<tr><td>
[title?](./ImageProps.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Image title (alt/text)
</td></tr>
</tbody></table>
---
## 属性详情
### onclick
# ImageProps.onClick property
点击图片时触发
## Signature
```typescript
onClick?: () => void;
```
### src
# ImageProps.src property
Image URL (required)
## Signature
```typescript
src: string;
```
### title
# ImageProps.title property
Image title (alt/text)
## Signature
```typescript
title?: string;
```
references/interfaces/InputProps.md
# InputProps interface
输入框组件:支持下拉、搜索、清除、前后缀等多种形态
## Signature
```typescript
interface InputProps
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[clearBtn?](./InputProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ Whether Show clear button
</td></tr>
<tr><td>
[clickBtn?](./InputProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ Whether to show the click button
</td></tr>
<tr><td>
[disabled?](./InputProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ Whether Disable input
</td></tr>
<tr><td>
[dropDownList?](./InputProps.md)
</td><td>
</td><td>
[ListChildren](./ListChildren.md)<!-- -->\[\]
</td><td>
_(Optional)_ Dropdown list data. When provided, the input box can select from a dropdown
</td></tr>
<tr><td>
[onAddClick?](./InputProps.md)
</td><td>
</td><td>
(data: string) => void
</td><td>
_(Optional)_ 点击添加按钮时触发,参数为当前输入值
</td></tr>
<tr><td>
[onBlur?](./InputProps.md)
</td><td>
</td><td>
(data: string) => void
</td><td>
_(Optional)_ 输入框失焦时触发,参数为当前输入值
</td></tr>
<tr><td>
[onChange?](./InputProps.md)
</td><td>
</td><td>
(data: string) => void
</td><td>
_(Optional)_ 输入内容变化时触发,参数为最新值
</td></tr>
<tr><td>
[onClick?](./InputProps.md)
</td><td>
</td><td>
() => void
</td><td>
_(Optional)_ 点击输入框时触发
</td></tr>
<tr><td>
[onFilterClick?](./InputProps.md)
</td><td>
</td><td>
(data: string) => void
</td><td>
_(Optional)_ 点击筛选按钮时触发,参数为当前输入值
</td></tr>
<tr><td>
[onSearchClick?](./InputProps.md)
</td><td>
</td><td>
(data: string) => void
</td><td>
_(Optional)_ 点击搜索按钮时触发,参数为当前输入值
</td></tr>
<tr><td>
[otherAttr?](./InputProps.md)
</td><td>
</td><td>
\{ \[key: string\]: string \}
</td><td>
_(Optional)_ Other attributes attached to the input element (key-value pair string)
</td></tr>
<tr><td>
[placeholder?](./InputProps.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Placeholder text
</td></tr>
<tr><td>
[preText?](./InputProps.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Prefix text
</td></tr>
<tr><td>
[readonly?](./InputProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is read-only
</td></tr>
<tr><td>
[searchBtn?](./InputProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ Whether Show search button
</td></tr>
<tr><td>
[testVal?](./InputProps.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Validation value for testing
</td></tr>
<tr><td>
[textAlign?](./InputProps.md)
</td><td>
</td><td>
'left' \| 'center' \| 'right'
</td><td>
_(Optional)_ 输入框内文字水平对齐(旧世界图片尺寸输入框数字居中用 textAlign: 'center')
</td></tr>
<tr><td>
[type](./InputProps.md)
</td><td>
</td><td>
'text' \| 'telephone' \| 'number' \| 'password' \| 'color' \| 'email'
</td><td>
Input box type (required)
</td></tr>
<tr><td>
[value?](./InputProps.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Current input value
</td></tr>
</tbody></table>
---
## 属性详情
### clearbtn
# InputProps.clearBtn property
Whether Show clear button
## Signature
```typescript
clearBtn?: boolean;
```
### clickbtn
# InputProps.clickBtn property
Whether to show the click button
## Signature
```typescript
clickBtn?: boolean;
```
### disabled
# InputProps.disabled property
Whether Disable input
## Signature
```typescript
disabled?: boolean;
```
### dropdownlist
# InputProps.dropDownList property
Dropdown list data. When provided, the input box can select from a dropdown
## Signature
```typescript
dropDownList?: ListChildren[];
```
### onaddclick
# InputProps.onAddClick property
点击添加按钮时触发,参数为当前输入值
## Signature
```typescript
onAddClick?: (data: string) => void;
```
### onblur
# InputProps.onBlur property
输入框失焦时触发,参数为当前输入值
## Signature
```typescript
onBlur?: (data: string) => void;
```
### onchange
# InputProps.onChange property
输入内容变化时触发,参数为最新值
## Signature
```typescript
onChange?: (data: string) => void;
```
### onclick
# InputProps.onClick property
点击输入框时触发
## Signature
```typescript
onClick?: () => void;
```
### onfilterclick
# InputProps.onFilterClick property
点击筛选按钮时触发,参数为当前输入值
## Signature
```typescript
onFilterClick?: (data: string) => void;
```
### onsearchclick
# InputProps.onSearchClick property
点击搜索按钮时触发,参数为当前输入值
## Signature
```typescript
onSearchClick?: (data: string) => void;
```
### otherattr
# InputProps.otherAttr property
Other attributes attached to the input element (key-value pair string)
## Signature
```typescript
otherAttr?: { [key: string]: string };
```
### placeholder
# InputProps.placeholder property
Placeholder text
## Signature
```typescript
placeholder?: string;
```
### pretext
# InputProps.preText property
Prefix text
## Signature
```typescript
preText?: string;
```
### readonly
# InputProps.readonly property
Whether it is read-only
## Signature
```typescript
readonly?: boolean;
```
### searchbtn
# InputProps.searchBtn property
Whether Show search button
## Signature
```typescript
searchBtn?: boolean;
```
### testval
# InputProps.testVal property
Validation value for testing
## Signature
```typescript
testVal?: string;
```
### textalign
# InputProps.textAlign property
输入框内文字水平对齐(旧世界图片尺寸输入框数字居中用 textAlign: 'center')
## Signature
```typescript
textAlign?: 'left' | 'center' | 'right';
```
### type
# InputProps.type property
Input box type (required)
## Signature
```typescript
type: 'text' | 'telephone' | 'number' | 'password' | 'color' | 'email';
```
### value
# InputProps.value property
Current input value
## Signature
```typescript
value?: string;
```
references/interfaces/KeyboardConfig.md
# KeyboardConfig interface
键盘导航配置
## Signature
```typescript
interface KeyboardConfig
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[useExcelDefaults?](./KeyboardConfig.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ 是否启用 Excel 默认快捷键(↑↓/Home/End/Enter/F2/Ctrl+A/Escape 等),默认 true
</td></tr>
</tbody></table>
---
## 属性详情
### useexceldefaults
# KeyboardConfig.useExcelDefaults property
是否启用 Excel 默认快捷键(↑↓/Home/End/Enter/F2/Ctrl+A/Escape 等),默认 true
## Signature
```typescript
useExcelDefaults?: boolean;
```
references/interfaces/InputEditConfig.md
# InputEditConfig interface
## Signature
```typescript
interface InputEditConfig
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[inputType?](./InputEditConfig.md)
</td><td>
</td><td>
'text' \| 'number'
</td><td>
_(Optional)_ 原生 input 类型,默认 'text'
</td></tr>
<tr><td>
[maxLength?](./InputEditConfig.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_
</td></tr>
<tr><td>
[onChange?](./InputEditConfig.md)
</td><td>
</td><td>
(value: string) => void
</td><td>
_(Optional)_
</td></tr>
<tr><td>
[onConfirm?](./InputEditConfig.md)
</td><td>
</td><td>
(value: string) => void
</td><td>
_(Optional)_
</td></tr>
<tr><td>
[placeholder?](./InputEditConfig.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_
</td></tr>
<tr><td>
[type](./InputEditConfig.md)
</td><td>
</td><td>
'input'
</td><td>
</td></tr>
</tbody></table>
---
## 属性详情
### inputtype
# InputEditConfig.inputType property
原生 input 类型,默认 'text'
## Signature
```typescript
inputType?: 'text' | 'number';
```
### maxlength
# InputEditConfig.maxLength property
## Signature
```typescript
maxLength?: number;
```
### onchange
# InputEditConfig.onChange property
## Signature
```typescript
onChange?: (value: string) => void;
```
### onconfirm
# InputEditConfig.onConfirm property
## Signature
```typescript
onConfirm?: (value: string) => void;
```
### placeholder
# InputEditConfig.placeholder property
## Signature
```typescript
placeholder?: string;
```
### type
# InputEditConfig.type property
## Signature
```typescript
type: 'input';
```
references/interfaces/ListChildren.md
# ListChildren interface
列表项:支持多级嵌套分组
## Signature
```typescript
interface ListChildren
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[children?](./ListChildren.md)
</td><td>
</td><td>
[ListChildren](./ListChildren.md)<!-- -->\[\]
</td><td>
_(Optional)_ Child list items, used for multi-level nesting
</td></tr>
<tr><td>
[clearBtn?](./ListChildren.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ Whether Show clear button
</td></tr>
<tr><td>
[icons?](./ListChildren.md)
</td><td>
</td><td>
[IconProps](./IconProps.md)<!-- -->\[\]
</td><td>
_(Optional)_ List of list item icons
</td></tr>
<tr><td>
[id?](./ListChildren.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Unique ID of the list item
</td></tr>
<tr><td>
[selected?](./ListChildren.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ Whether Select
</td></tr>
<tr><td>
[title](./ListChildren.md)
</td><td>
</td><td>
string
</td><td>
List item title (required)
</td></tr>
<tr><td>
[value?](./ListChildren.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Associated value of the list item
</td></tr>
</tbody></table>
---
## 属性详情
### children
# ListChildren.children property
Child list items, used for multi-level nesting
## Signature
```typescript
children?: ListChildren[];
```
### clearbtn
# ListChildren.clearBtn property
Whether Show clear button
## Signature
```typescript
clearBtn?: boolean;
```
### icons
# ListChildren.icons property
List of list item icons
## Signature
```typescript
icons?: IconProps[];
```
### id
# ListChildren.id property
Unique ID of the list item
## Signature
```typescript
id?: string;
```
### selected
# ListChildren.selected property
Whether Select
## Signature
```typescript
selected?: boolean;
```
### title
# ListChildren.title property
List item title (required)
## Signature
```typescript
title: string;
```
### value
# ListChildren.value property
Associated value of the list item
## Signature
```typescript
value?: string;
```
references/interfaces/ListProps.md
# ListProps interface
列表组件:支持多级嵌套、图标、展开的列表
## Signature
```typescript
interface ListProps
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[border?](./ListProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ Whether to show the border
</td></tr>
<tr><td>
[expandEnable?](./ListProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ Whether nested child items are allowed to expand
</td></tr>
<tr><td>
[itemHeight?](./ListProps.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ List item height (pixels)
</td></tr>
<tr><td>
[list](./ListProps.md)
</td><td>
</td><td>
[ListChildren](./ListChildren.md)<!-- -->\[\]
</td><td>
List data ( required)
</td></tr>
<tr><td>
[maxHeight?](./ListProps.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 列表最大高度(像素)。提供时列表视口高度取 min(内容高度, 该值),用于如下拉菜单等父容器无定值高度的场景,使虚拟列表可正常滚动
</td></tr>
<tr><td>
[onItemClick?](./ListProps.md)
</td><td>
</td><td>
(id: string, item: [ListChildren](./ListChildren.md)<!-- -->) => void
</td><td>
_(Optional)_ 点击列表项时触发,参数为 id 与列表项
</td></tr>
<tr><td>
[onItemContextmenu?](./ListProps.md)
</td><td>
</td><td>
(id: string) => void
</td><td>
_(Optional)_ 右键点击列表项时触发,参数为 id
</td></tr>
<tr><td>
[onItemDblclick?](./ListProps.md)
</td><td>
</td><td>
(id: string) => void
</td><td>
_(Optional)_ 双击列表项时触发,参数为 id
</td></tr>
</tbody></table>
---
## 属性详情
### border
# ListProps.border property
Whether to show the border
## Signature
```typescript
border?: boolean;
```
### expandenable
# ListProps.expandEnable property
Whether nested child items are allowed to expand
## Signature
```typescript
expandEnable?: boolean;
```
### itemheight
# ListProps.itemHeight property
List item height (pixels)
## Signature
```typescript
itemHeight?: number;
```
### list
# ListProps.list property
List data ( required)
## Signature
```typescript
list: ListChildren[];
```
### maxheight
# ListProps.maxHeight property
列表最大高度(像素)。提供时列表视口高度取 min(内容高度, 该值),用于如下拉菜单等父容器无定值高度的场景,使虚拟列表可正常滚动
## Signature
```typescript
maxHeight?: number;
```
### onitemclick
# ListProps.onItemClick property
点击列表项时触发,参数为 id 与列表项
## Signature
```typescript
onItemClick?: (id: string, item: ListChildren) => void;
```
### onitemcontextmenu
# ListProps.onItemContextmenu property
右键点击列表项时触发,参数为 id
## Signature
```typescript
onItemContextmenu?: (id: string) => void;
```
### onitemdblclick
# ListProps.onItemDblclick property
双击列表项时触发,参数为 id
## Signature
```typescript
onItemDblclick?: (id: string) => void;
```
references/interfaces/ModalProps.md
# ModalProps interface
模态弹窗:可拖拽、可调整大小的顶层弹窗
## Signature
```typescript
interface ModalProps
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[children?](./ModalProps.md)
</td><td>
</td><td>
any
</td><td>
_(Optional)_ Popup content child nodes
</td></tr>
<tr><td>
[height](./ModalProps.md)
</td><td>
</td><td>
number \| 'auto'
</td><td>
Height ( pixels, required)
</td></tr>
<tr><td>
[hide?](./ModalProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ Whether to hide the popup
</td></tr>
<tr><td>
[left](./ModalProps.md)
</td><td>
</td><td>
number
</td><td>
Position from the left (pixels, required)
</td></tr>
<tr><td>
[maxDragX?](./ModalProps.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ Maximum horizontal drag distance (pixels)
</td></tr>
<tr><td>
[maxDragY?](./ModalProps.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ Maximum vertical drag distance ( pixels)
</td></tr>
<tr><td>
[onMoved?](./ModalProps.md)
</td><td>
</td><td>
(top: number, left: number) => void
</td><td>
_(Optional)_ 弹窗移动时触发,参数为新位置
</td></tr>
<tr><td>
[overlay?](./ModalProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ Whether to show the mask layer
</td></tr>
<tr><td>
[resizeX?](./ModalProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ Whether horizontal resizing is allowed
</td></tr>
<tr><td>
[resizeY?](./ModalProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ Whether vertical resizing is allowed
</td></tr>
<tr><td>
[top](./ModalProps.md)
</td><td>
</td><td>
number
</td><td>
Position from the top (pixels, required)
</td></tr>
<tr><td>
[width](./ModalProps.md)
</td><td>
</td><td>
number
</td><td>
Width ( pixels, required)
</td></tr>
</tbody></table>
---
## 属性详情
### children
# ModalProps.children property
Popup content child nodes
## Signature
```typescript
children?: any;
```
### height
# ModalProps.height property
Height ( pixels, required)
## Signature
```typescript
height: number | 'auto';
```
### hide
# ModalProps.hide property
Whether to hide the popup
## Signature
```typescript
hide?: boolean;
```
### left
# ModalProps.left property
Position from the left (pixels, required)
## Signature
```typescript
left: number;
```
### maxdragx
# ModalProps.maxDragX property
Maximum horizontal drag distance (pixels)
## Signature
```typescript
maxDragX?: number;
```
### maxdragy
# ModalProps.maxDragY property
Maximum vertical drag distance ( pixels)
## Signature
```typescript
maxDragY?: number;
```
### onmoved
# ModalProps.onMoved property
弹窗移动时触发,参数为新位置
## Signature
```typescript
onMoved?: (top: number, left: number) => void;
```
### overlay
# ModalProps.overlay property
Whether to show the mask layer
## Signature
```typescript
overlay?: boolean;
```
### resizex
# ModalProps.resizeX property
Whether horizontal resizing is allowed
## Signature
```typescript
resizeX?: boolean;
```
### resizey
# ModalProps.resizeY property
Whether vertical resizing is allowed
## Signature
```typescript
resizeY?: boolean;
```
### top
# ModalProps.top property
Position from the top (pixels, required)
## Signature
```typescript
top: number;
```
### width
# ModalProps.width property
Width ( pixels, required)
## Signature
```typescript
width: number;
```
references/interfaces/NumberEditConfig.md
# NumberEditConfig interface
## Signature
```typescript
interface NumberEditConfig
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[max?](./NumberEditConfig.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_
</td></tr>
<tr><td>
[min?](./NumberEditConfig.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_
</td></tr>
<tr><td>
[onChange?](./NumberEditConfig.md)
</td><td>
</td><td>
(value: number) => void
</td><td>
_(Optional)_
</td></tr>
<tr><td>
[onConfirm?](./NumberEditConfig.md)
</td><td>
</td><td>
(value: number) => void
</td><td>
_(Optional)_
</td></tr>
<tr><td>
[placeholder?](./NumberEditConfig.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_
</td></tr>
<tr><td>
[precision?](./NumberEditConfig.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 小数精度位数
</td></tr>
<tr><td>
[step?](./NumberEditConfig.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 步长,默认 1
</td></tr>
<tr><td>
[type](./NumberEditConfig.md)
</td><td>
</td><td>
'number'
</td><td>
</td></tr>
</tbody></table>
---
## 属性详情
### max
# NumberEditConfig.max property
## Signature
```typescript
max?: number;
```
### min
# NumberEditConfig.min property
## Signature
```typescript
min?: number;
```
### onchange
# NumberEditConfig.onChange property
## Signature
```typescript
onChange?: (value: number) => void;
```
### onconfirm
# NumberEditConfig.onConfirm property
## Signature
```typescript
onConfirm?: (value: number) => void;
```
### placeholder
# NumberEditConfig.placeholder property
## Signature
```typescript
placeholder?: string;
```
### precision
# NumberEditConfig.precision property
小数精度位数
## Signature
```typescript
precision?: number;
```
### step
# NumberEditConfig.step property
步长,默认 1
## Signature
```typescript
step?: number;
```
### type
# NumberEditConfig.type property
## Signature
```typescript
type: 'number';
```
references/interfaces/RadioItem.md
# RadioItem interface
单选组中的单个选项
## Signature
```typescript
interface RadioItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[disabled?](./RadioItem.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ Whether the option is disabled
</td></tr>
<tr><td>
[text](./RadioItem.md)
</td><td>
</td><td>
string
</td><td>
Option display text (required)
</td></tr>
<tr><td>
[value](./RadioItem.md)
</td><td>
</td><td>
string
</td><td>
Option value (required)
</td></tr>
</tbody></table>
---
## 属性详情
### disabled
# RadioItem.disabled property
Whether the option is disabled
## Signature
```typescript
disabled?: boolean;
```
### text
# RadioItem.text property
Option display text (required)
## Signature
```typescript
text: string;
```
### value
# RadioItem.value property
Option value (required)
## Signature
```typescript
value: string;
```
references/interfaces/RadioGroupProps.md
# RadioGroupProps interface
单选组组件:一组互斥的单选选项
## Signature
```typescript
interface RadioGroupProps
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[gap?](./RadioGroupProps.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ Option gap (pixels)
</td></tr>
<tr><td>
[group](./RadioGroupProps.md)
</td><td>
</td><td>
[RadioItem](./RadioItem.md)<!-- -->\[\]
</td><td>
Option list (required)
</td></tr>
<tr><td>
[lineBreak?](./RadioGroupProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ Whether to arrange in line breaks
</td></tr>
<tr><td>
[onChange?](./RadioGroupProps.md)
</td><td>
</td><td>
(value: string) => void
</td><td>
_(Optional)_ 选中值变化时触发,参数为选中项的值
</td></tr>
<tr><td>
[onlyChangeByBox?](./RadioGroupProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ Whether the state can only be changed by clicking the radio button itself
</td></tr>
<tr><td>
[selectedValue?](./RadioGroupProps.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Currently selected value
</td></tr>
</tbody></table>
---
## 属性详情
### gap
# RadioGroupProps.gap property
Option gap (pixels)
## Signature
```typescript
gap?: number;
```
### group
# RadioGroupProps.group property
Option list (required)
## Signature
```typescript
group: RadioItem[];
```
### linebreak
# RadioGroupProps.lineBreak property
Whether to arrange in line breaks
## Signature
```typescript
lineBreak?: boolean;
```
### onchange
# RadioGroupProps.onChange property
选中值变化时触发,参数为选中项的值
## Signature
```typescript
onChange?: (value: string) => void;
```
### onlychangebybox
# RadioGroupProps.onlyChangeByBox property
Whether the state can only be changed by clicking the radio button itself
## Signature
```typescript
onlyChangeByBox?: boolean;
```
### selectedvalue
# RadioGroupProps.selectedValue property
Currently selected value
## Signature
```typescript
selectedValue?: string;
```
references/interfaces/RichTableProps.md
# RichTableProps interface
RichTable 组件属性
## Signature
```typescript
interface RichTableProps<T extends Record<string, any> = Record<string, any>>
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[border?](./RichTableProps.md)
</td><td>
</td><td>
boolean \| [BorderConfig](./BorderConfig.md)
</td><td>
_(Optional)_ 边框:true = 全边框,object = 精细控制
</td></tr>
<tr><td>
[className?](./RichTableProps.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ 容器类名
</td></tr>
<tr><td>
[clipboard?](./RichTableProps.md)
</td><td>
</td><td>
[ClipboardConfig](./ClipboardConfig.md) \| true
</td><td>
_(Optional)_ 剪贴板(粘贴/剪切)
</td></tr>
<tr><td>
[columnResize?](./RichTableProps.md)
</td><td>
</td><td>
[ColumnResizeConfig](./ColumnResizeConfig.md) \| true
</td><td>
_(Optional)_ 列宽拖拽
</td></tr>
<tr><td>
[columns](./RichTableProps.md)
</td><td>
</td><td>
[ColumnDefOrGroup](../types/ColumnDefOrGroup.md)<!-- --><T>\[\]
</td><td>
列定义
</td></tr>
<tr><td>
[customHeader?](./RichTableProps.md)
</td><td>
</td><td>
[CustomHeaderConfig](./CustomHeaderConfig.md)
</td><td>
_(Optional)_ 自定义表头(列可见性)
</td></tr>
<tr><td>
[data](./RichTableProps.md)
</td><td>
</td><td>
T\[\]
</td><td>
行数据
</td></tr>
<tr><td>
[dragSort?](./RichTableProps.md)
</td><td>
</td><td>
[DragSortConfig](./DragSortConfig.md) \| true
</td><td>
_(Optional)_ 拖拽排序
</td></tr>
<tr><td>
[editing?](./RichTableProps.md)
</td><td>
</td><td>
[EditingConfig](./EditingConfig.md)
</td><td>
_(Optional)_ 单元格编辑
</td></tr>
<tr><td>
[emptyText?](./RichTableProps.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ 空数据提示文本,默认 "暂无数据"
</td></tr>
<tr><td>
[filtering?](./RichTableProps.md)
</td><td>
</td><td>
[FilteringConfig](./FilteringConfig.md) \| true
</td><td>
_(Optional)_ 筛选
</td></tr>
<tr><td>
[fixedColumns?](./RichTableProps.md)
</td><td>
</td><td>
[FixedColumnConfig](./FixedColumnConfig.md)
</td><td>
_(Optional)_ 固定列
</td></tr>
<tr><td>
[fixedHeader?](./RichTableProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ 是否固定表头,默认 true
</td></tr>
<tr><td>
[headHeight?](./RichTableProps.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 表头高度,默认 32
</td></tr>
<tr><td>
[height?](./RichTableProps.md)
</td><td>
</td><td>
number \| string
</td><td>
_(Optional)_ 容器高度
</td></tr>
<tr><td>
[keyboard?](./RichTableProps.md)
</td><td>
</td><td>
[KeyboardConfig](./KeyboardConfig.md) \| true
</td><td>
_(Optional)_ 键盘导航
</td></tr>
<tr><td>
[loading?](./RichTableProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ 加载中状态
</td></tr>
<tr><td>
[onAllChecked?](./RichTableProps.md)
</td><td>
</td><td>
(info: { data: T\[\]; checked: boolean }) => void
</td><td>
_(Optional)_ 全选/取消全选通知
</td></tr>
<tr><td>
[onCellClick?](./RichTableProps.md)
</td><td>
</td><td>
(info: [CellClickInfo](./CellClickInfo.md)<!-- --><T>) => void
</td><td>
_(Optional)_ 单元格点击
</td></tr>
<tr><td>
[onCheckChange?](./RichTableProps.md)
</td><td>
</td><td>
(info: { checkedRows: T\[\]; checkedKeys: string\[\]; detail: [CheckChangeDetail](./CheckChangeDetail.md) }) => void
</td><td>
_(Optional)_ 勾选变更通知
</td></tr>
<tr><td>
[onColSizeChange?](./RichTableProps.md)
</td><td>
</td><td>
(info: { colKey: string; width: number }) => void
</td><td>
_(Optional)_ 列宽变更通知
</td></tr>
<tr><td>
[onDataChange?](./RichTableProps.md)
</td><td>
</td><td>
(info: { data: T\[\]; changedRow?: T; type?: [DataChangeType](../types/DataChangeType.md) }) => void
</td><td>
_(Optional)_ 数据变更通知
</td></tr>
<tr><td>
[onDragMoveEnd?](./RichTableProps.md)
</td><td>
</td><td>
(info: { fromIndices: number \| number\[\]; toIndex: number; currentIndices: number \| number\[\] }) => void
</td><td>
_(Optional)_ 拖拽排序结束通知
</td></tr>
<tr><td>
[onEditCommit?](./RichTableProps.md)
</td><td>
</td><td>
(info: { row: T; colKey: string; value: any; oldValue: any }) => void
</td><td>
_(Optional)_ 编辑提交通知
</td></tr>
<tr><td>
[onEditStateChange?](./RichTableProps.md)
</td><td>
</td><td>
(cell: [CellCoord](./CellCoord.md) \| null) => void
</td><td>
_(Optional)_ 编辑状态变更通知
</td></tr>
<tr><td>
[onError?](./RichTableProps.md)
</td><td>
</td><td>
(info: { message: string }) => void
</td><td>
_(Optional)_ 错误回调
</td></tr>
<tr><td>
[onFilterChange?](./RichTableProps.md)
</td><td>
</td><td>
(filters: Record<string, string>) => void
</td><td>
_(Optional)_ 筛选变更通知
</td></tr>
<tr><td>
[onHeaderContextMenu?](./RichTableProps.md)
</td><td>
</td><td>
(colKey: string) => void
</td><td>
_(Optional)_ 表头右键菜单
</td></tr>
<tr><td>
[onRowClick?](./RichTableProps.md)
</td><td>
</td><td>
(info: { row: T; index: number }) => void
</td><td>
_(Optional)_ 行单击
</td></tr>
<tr><td>
[onRowContextMenu?](./RichTableProps.md)
</td><td>
</td><td>
(info: { row: T; index: number }) => void
</td><td>
_(Optional)_ 行右键菜单
</td></tr>
<tr><td>
[onRowDoubleClick?](./RichTableProps.md)
</td><td>
</td><td>
(info: { row: T; index: number }) => void
</td><td>
_(Optional)_ 行双击
</td></tr>
<tr><td>
[onRowMouseEnter?](./RichTableProps.md)
</td><td>
</td><td>
(info: { row: T; index: number }) => void
</td><td>
_(Optional)_ 行鼠标进入
</td></tr>
<tr><td>
[onRowMouseLeave?](./RichTableProps.md)
</td><td>
</td><td>
(info: { row: T; index: number }) => void
</td><td>
_(Optional)_ 行鼠标离开
</td></tr>
<tr><td>
[onSelectionChange?](./RichTableProps.md)
</td><td>
</td><td>
(info: { selectedKeys: string\[\]; selectedRows: T\[\] }) => void
</td><td>
_(Optional)_ 选择变更通知
</td></tr>
<tr><td>
[onSortChange?](./RichTableProps.md)
</td><td>
</td><td>
(sort: [SortState](./SortState.md)<!-- -->\[\]) => void
</td><td>
_(Optional)_ 排序变更通知
</td></tr>
<tr><td>
[rowHeight?](./RichTableProps.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 行高,默认 28
</td></tr>
<tr><td>
[rowHighlightOnHover?](./RichTableProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ 行悬浮高亮,默认 false
</td></tr>
<tr><td>
[rowKey?](./RichTableProps.md)
</td><td>
</td><td>
keyof T \| ((row: T, index: number) => string)
</td><td>
_(Optional)_ 行唯一标识字段或提取函数,默认 'id'
</td></tr>
<tr><td>
[searchHighlight?](./RichTableProps.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ 搜索高亮词(对单元格文本大小写不敏感全匹配高亮)
</td></tr>
<tr><td>
[selection?](./RichTableProps.md)
</td><td>
</td><td>
[SelectionConfig](./SelectionConfig.md) \| true
</td><td>
_(Optional)_ 行选择
</td></tr>
<tr><td>
[showHeader?](./RichTableProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ 是否显示表头,默认 true
</td></tr>
<tr><td>
[showRowNumber?](./RichTableProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ 是否显示行号列
</td></tr>
<tr><td>
[sorting?](./RichTableProps.md)
</td><td>
</td><td>
[SortingConfig](./SortingConfig.md) \| true
</td><td>
_(Optional)_ 排序
</td></tr>
<tr><td>
[striped?](./RichTableProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ 斑马纹
</td></tr>
<tr><td>
[style?](./RichTableProps.md)
</td><td>
</td><td>
Record<string, string \| number>
</td><td>
_(Optional)_ 容器样式
</td></tr>
<tr><td>
[tableBodyStyle?](./RichTableProps.md)
</td><td>
</td><td>
Record<string, string>
</td><td>
_(Optional)_ 表体样式
</td></tr>
<tr><td>
[textAlign?](./RichTableProps.md)
</td><td>
</td><td>
[Align](../types/Align.md)
</td><td>
_(Optional)_ 全局文本对齐(列的 align 优先级更高)
</td></tr>
<tr><td>
[virtualScroll?](./RichTableProps.md)
</td><td>
</td><td>
[VirtualScrollConfig](./VirtualScrollConfig.md) \| true
</td><td>
_(Optional)_ 虚拟滚动(仅固定行高,非动态测量)。 ⚠️ 约束:开启后每行高度恒等于 rowHeight,单元格换行会撑高行导致定位错位。 因此所有可能超长换行的列必须配 `ellipsis: true`<!-- -->(或 `$truncate` 插槽)保持单行。
</td></tr>
<tr><td>
[width?](./RichTableProps.md)
</td><td>
</td><td>
number \| string
</td><td>
_(Optional)_ 容器宽度
</td></tr>
</tbody></table>
---
## 属性详情
### border
# RichTableProps.border property
边框:true = 全边框,object = 精细控制
## Signature
```typescript
border?: boolean | BorderConfig;
```
### classname
# RichTableProps.className property
容器类名
## Signature
```typescript
className?: string;
```
### clipboard
# RichTableProps.clipboard property
剪贴板(粘贴/剪切)
## Signature
```typescript
clipboard?: ClipboardConfig | true;
```
### columnresize
# RichTableProps.columnResize property
列宽拖拽
## Signature
```typescript
columnResize?: ColumnResizeConfig | true;
```
### columns
# RichTableProps.columns property
列定义
## Signature
```typescript
columns: ColumnDefOrGroup < T > [];
```
### customheader
# RichTableProps.customHeader property
自定义表头(列可见性)
## Signature
```typescript
customHeader?: CustomHeaderConfig;
```
### data
# RichTableProps.data property
行数据
## Signature
```typescript
data: T[];
```
### dragsort
# RichTableProps.dragSort property
拖拽排序
## Signature
```typescript
dragSort?: DragSortConfig | true;
```
### editing
# RichTableProps.editing property
单元格编辑
## Signature
```typescript
editing?: EditingConfig;
```
### emptytext
# RichTableProps.emptyText property
空数据提示文本,默认 "暂无数据"
## Signature
```typescript
emptyText?: string;
```
### filtering
# RichTableProps.filtering property
筛选
## Signature
```typescript
filtering?: FilteringConfig | true;
```
### fixedcolumns
# RichTableProps.fixedColumns property
固定列
## Signature
```typescript
fixedColumns?: FixedColumnConfig;
```
### fixedheader
# RichTableProps.fixedHeader property
是否固定表头,默认 true
## Signature
```typescript
fixedHeader?: boolean;
```
### headheight
# RichTableProps.headHeight property
表头高度,默认 32
## Signature
```typescript
headHeight?: number;
```
### height
# RichTableProps.height property
容器高度
## Signature
```typescript
height?: number | string;
```
### keyboard
# RichTableProps.keyboard property
键盘导航
## Signature
```typescript
keyboard?: KeyboardConfig | true;
```
### loading
# RichTableProps.loading property
加载中状态
## Signature
```typescript
loading?: boolean;
```
### onallchecked
# RichTableProps.onAllChecked property
全选/取消全选通知
## Signature
```typescript
onAllChecked?: (info: { data: T[]; checked: boolean }) => void;
```
### oncellclick
# RichTableProps.onCellClick property
单元格点击
## Signature
```typescript
onCellClick?: (info: CellClickInfo<T>) => void;
```
### oncheckchange
# RichTableProps.onCheckChange property
勾选变更通知
## Signature
```typescript
onCheckChange?: (info: { checkedRows: T[]; checkedKeys: string[]; detail: CheckChangeDetail }) => void;
```
### oncolsizechange
# RichTableProps.onColSizeChange property
列宽变更通知
## Signature
```typescript
onColSizeChange?: (info: { colKey: string; width: number }) => void;
```
### ondatachange
# RichTableProps.onDataChange property
数据变更通知
## Signature
```typescript
onDataChange?: (info: { data: T[]; changedRow?: T; type?: DataChangeType }) => void;
```
### ondragmoveend
# RichTableProps.onDragMoveEnd property
拖拽排序结束通知
## Signature
```typescript
onDragMoveEnd?: (info: { fromIndices: number | number[]; toIndex: number; currentIndices: number | number[] }) => void;
```
### oneditcommit
# RichTableProps.onEditCommit property
编辑提交通知
## Signature
```typescript
onEditCommit?: (info: { row: T; colKey: string; value: any; oldValue: any }) => void;
```
### oneditstatechange
# RichTableProps.onEditStateChange property
编辑状态变更通知
## Signature
```typescript
onEditStateChange?: (cell: CellCoord | null) => void;
```
### onerror
# RichTableProps.onError property
错误回调
## Signature
```typescript
onError?: (info: { message: string }) => void;
```
### onfilterchange
# RichTableProps.onFilterChange property
筛选变更通知
## Signature
```typescript
onFilterChange?: (filters: Record<string, string>) => void;
```
### onheadercontextmenu
# RichTableProps.onHeaderContextMenu property
表头右键菜单
## Signature
```typescript
onHeaderContextMenu?: (colKey: string) => void;
```
### onrowclick
# RichTableProps.onRowClick property
行单击
## Signature
```typescript
onRowClick?: (info: { row: T; index: number }) => void;
```
### onrowcontextmenu
# RichTableProps.onRowContextMenu property
行右键菜单
## Signature
```typescript
onRowContextMenu?: (info: { row: T; index: number }) => void;
```
### onrowdoubleclick
# RichTableProps.onRowDoubleClick property
行双击
## Signature
```typescript
onRowDoubleClick?: (info: { row: T; index: number }) => void;
```
### onrowmouseenter
# RichTableProps.onRowMouseEnter property
行鼠标进入
## Signature
```typescript
onRowMouseEnter?: (info: { row: T; index: number }) => void;
```
### onrowmouseleave
# RichTableProps.onRowMouseLeave property
行鼠标离开
## Signature
```typescript
onRowMouseLeave?: (info: { row: T; index: number }) => void;
```
### onselectionchange
# RichTableProps.onSelectionChange property
选择变更通知
## Signature
```typescript
onSelectionChange?: (info: { selectedKeys: string[]; selectedRows: T[] }) => void;
```
### onsortchange
# RichTableProps.onSortChange property
排序变更通知
## Signature
```typescript
onSortChange?: (sort: SortState[]) => void;
```
### rowheight
# RichTableProps.rowHeight property
行高,默认 28
## Signature
```typescript
rowHeight?: number;
```
### rowhighlightonhover
# RichTableProps.rowHighlightOnHover property
行悬浮高亮,默认 false
## Signature
```typescript
rowHighlightOnHover?: boolean;
```
### rowkey
# RichTableProps.rowKey property
行唯一标识字段或提取函数,默认 'id'
## Signature
```typescript
rowKey?: keyof T | ((row: T, index: number) => string);
```
### searchhighlight
# RichTableProps.searchHighlight property
搜索高亮词(对单元格文本大小写不敏感全匹配高亮)
## Signature
```typescript
searchHighlight?: string;
```
### selection
# RichTableProps.selection property
行选择
## Signature
```typescript
selection?: SelectionConfig | true;
```
### showheader
# RichTableProps.showHeader property
是否显示表头,默认 true
## Signature
```typescript
showHeader?: boolean;
```
### showrownumber
# RichTableProps.showRowNumber property
是否显示行号列
## Signature
```typescript
showRowNumber?: boolean;
```
### sorting
# RichTableProps.sorting property
排序
## Signature
```typescript
sorting?: SortingConfig | true;
```
### striped
# RichTableProps.striped property
斑马纹
## Signature
```typescript
striped?: boolean;
```
### style
# RichTableProps.style property
容器样式
## Signature
```typescript
style?: Record<string, string | number>;
```
### tablebodystyle
# RichTableProps.tableBodyStyle property
表体样式
## Signature
```typescript
tableBodyStyle?: Record<string, string>;
```
### textalign
# RichTableProps.textAlign property
全局文本对齐(列的 align 优先级更高)
## Signature
```typescript
textAlign?: Align;
```
### virtualscroll
# RichTableProps.virtualScroll property
虚拟滚动(仅固定行高,非动态测量)。 ⚠️ 约束:开启后每行高度恒等于 rowHeight,单元格换行会撑高行导致定位错位。 因此所有可能超长换行的列必须配 `ellipsis: true`<!-- -->(或 `$truncate` 插槽)保持单行。
## Signature
```typescript
virtualScroll?: VirtualScrollConfig | true;
```
### width
# RichTableProps.width property
容器宽度
## Signature
```typescript
width?: number | string;
```
references/interfaces/ScrollerProps.md
# ScrollerProps interface
滚动组件:虚拟滚动列表,仅渲染可见行
## Signature
```typescript
interface ScrollerProps
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[buffer?](./ScrollerProps.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ Number of extra buffered rows to render
</td></tr>
<tr><td>
[children?](./ScrollerProps.md)
</td><td>
</td><td>
any
</td><td>
_(Optional)_ Child node
</td></tr>
<tr><td>
[itemCount](./ScrollerProps.md)
</td><td>
</td><td>
number
</td><td>
Total row count (required)
</td></tr>
<tr><td>
[itemHeight](./ScrollerProps.md)
</td><td>
</td><td>
number
</td><td>
Height of each row (pixels, required)
</td></tr>
<tr><td>
[onVisibleRowsChange?](./ScrollerProps.md)
</td><td>
</td><td>
(visibleRows: { index: number; slotName: string }\[\]) => void
</td><td>
_(Optional)_ 可见行变化时触发,参数为可见行索引与对应插槽名列表
</td></tr>
</tbody></table>
---
## 属性详情
### buffer
# ScrollerProps.buffer property
Number of extra buffered rows to render
## Signature
```typescript
buffer?: number;
```
### children
# ScrollerProps.children property
Child node
## Signature
```typescript
children?: any;
```
### itemcount
# ScrollerProps.itemCount property
Total row count (required)
## Signature
```typescript
itemCount: number;
```
### itemheight
# ScrollerProps.itemHeight property
Height of each row (pixels, required)
## Signature
```typescript
itemHeight: number;
```
### onvisiblerowschange
# ScrollerProps.onVisibleRowsChange property
可见行变化时触发,参数为可见行索引与对应插槽名列表
## Signature
```typescript
onVisibleRowsChange?: (visibleRows: { index: number; slotName: string }[]) => void;
```
references/interfaces/RowMetaConfig.md
# RowMetaConfig interface
行元数据配置,独立于业务数据(挂在 row.rowMeta 上)
## Signature
```typescript
interface RowMetaConfig
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[bgColor?](./RowMetaConfig.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ 行背景色
</td></tr>
<tr><td>
[disabledCheckbox?](./RowMetaConfig.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ 该行勾选框禁用
</td></tr>
<tr><td>
[disabledRow?](./RowMetaConfig.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ 该行禁用(不可点击选中)
</td></tr>
<tr><td>
[noCheckbox?](./RowMetaConfig.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ 该行不显示勾选框
</td></tr>
</tbody></table>
---
## 属性详情
### bgcolor
# RowMetaConfig.bgColor property
行背景色
## Signature
```typescript
bgColor?: string;
```
### disabledcheckbox
# RowMetaConfig.disabledCheckbox property
该行勾选框禁用
## Signature
```typescript
disabledCheckbox?: boolean;
```
### disabledrow
# RowMetaConfig.disabledRow property
该行禁用(不可点击选中)
## Signature
```typescript
disabledRow?: boolean;
```
### nocheckbox
# RowMetaConfig.noCheckbox property
该行不显示勾选框
## Signature
```typescript
noCheckbox?: boolean;
```
references/interfaces/SelectEditConfig.md
# SelectEditConfig interface
## Signature
```typescript
interface SelectEditConfig
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[disabled?](./SelectEditConfig.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_
</td></tr>
<tr><td>
[multiple?](./SelectEditConfig.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ 是否多选
</td></tr>
<tr><td>
[onChange?](./SelectEditConfig.md)
</td><td>
</td><td>
(value: string \| number \| Array<string \| number>) => void
</td><td>
_(Optional)_
</td></tr>
<tr><td>
[options](./SelectEditConfig.md)
</td><td>
</td><td>
[SelectOption](./SelectOption.md)<!-- -->\[\]
</td><td>
下拉选项
</td></tr>
<tr><td>
[placeholder?](./SelectEditConfig.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_
</td></tr>
<tr><td>
[searchable?](./SelectEditConfig.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ 是否可搜索过滤
</td></tr>
<tr><td>
[type](./SelectEditConfig.md)
</td><td>
</td><td>
'select'
</td><td>
</td></tr>
</tbody></table>
---
## 属性详情
### disabled
# SelectEditConfig.disabled property
## Signature
```typescript
disabled?: boolean;
```
### multiple
# SelectEditConfig.multiple property
是否多选
## Signature
```typescript
multiple?: boolean;
```
### onchange
# SelectEditConfig.onChange property
## Signature
```typescript
onChange?: (value: string | number | Array<string | number>) => void;
```
### options
# SelectEditConfig.options property
下拉选项
## Signature
```typescript
options: SelectOption[];
```
### placeholder
# SelectEditConfig.placeholder property
## Signature
```typescript
placeholder?: string;
```
### searchable
# SelectEditConfig.searchable property
是否可搜索过滤
## Signature
```typescript
searchable?: boolean;
```
### type
# SelectEditConfig.type property
## Signature
```typescript
type: 'select';
```
references/interfaces/SelectProps.md
# SelectProps interface
下拉选择器:基于输入框的下拉选择控件
## Signature
```typescript
interface SelectProps
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[disabled?](./SelectProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ Whether Disable
</td></tr>
<tr><td>
[dropDownList?](./SelectProps.md)
</td><td>
</td><td>
[SelectListItem](./SelectListItem.md)<!-- -->\[\]
</td><td>
_(Optional)_ Dropdown option list
</td></tr>
<tr><td>
[onChange?](./SelectProps.md)
</td><td>
</td><td>
(value: string) => void
</td><td>
_(Optional)_ 选中值变化时触发,参数为选中项的值
</td></tr>
<tr><td>
[readonly?](./SelectProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ Whether it is read-only
</td></tr>
<tr><td>
[value?](./SelectProps.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Current select value
</td></tr>
</tbody></table>
---
## 属性详情
### disabled
# SelectProps.disabled property
Whether Disable
## Signature
```typescript
disabled?: boolean;
```
### dropdownlist
# SelectProps.dropDownList property
Dropdown option list
## Signature
```typescript
dropDownList?: SelectListItem[];
```
### onchange
# SelectProps.onChange property
选中值变化时触发,参数为选中项的值
## Signature
```typescript
onChange?: (value: string) => void;
```
### readonly
# SelectProps.readonly property
Whether it is read-only
## Signature
```typescript
readonly?: boolean;
```
### value
# SelectProps.value property
Current select value
## Signature
```typescript
value?: string;
```
references/interfaces/SelectListItem.md
# SelectListItem interface
下拉选项:支持多级嵌套分组
## Signature
```typescript
interface SelectListItem
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[children?](./SelectListItem.md)
</td><td>
</td><td>
[SelectListItem](./SelectListItem.md)<!-- -->\[\]
</td><td>
_(Optional)_ Child options, used for multi-level nesting
</td></tr>
<tr><td>
[selected?](./SelectListItem.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ Whether Select
</td></tr>
<tr><td>
[title](./SelectListItem.md)
</td><td>
</td><td>
string
</td><td>
Option title (required)
</td></tr>
<tr><td>
[value?](./SelectListItem.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Associated value of the option
</td></tr>
</tbody></table>
---
## 属性详情
### children
# SelectListItem.children property
Child options, used for multi-level nesting
## Signature
```typescript
children?: SelectListItem[];
```
### selected
# SelectListItem.selected property
Whether Select
## Signature
```typescript
selected?: boolean;
```
### title
# SelectListItem.title property
Option title (required)
## Signature
```typescript
title: string;
```
### value
# SelectListItem.value property
Associated value of the option
## Signature
```typescript
value?: string;
```
references/interfaces/SelectOption.md
# SelectOption interface
下拉选项
## Signature
```typescript
interface SelectOption
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[color?](./SelectOption.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ 选项颜色(如状态色标)
</td></tr>
<tr><td>
[disabled?](./SelectOption.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ 是否禁用该选项
</td></tr>
<tr><td>
[text](./SelectOption.md)
</td><td>
</td><td>
string
</td><td>
显示文本
</td></tr>
<tr><td>
[value](./SelectOption.md)
</td><td>
</td><td>
string \| number
</td><td>
选项值
</td></tr>
</tbody></table>
---
## 属性详情
### color
# SelectOption.color property
选项颜色(如状态色标)
## Signature
```typescript
color?: string;
```
### disabled
# SelectOption.disabled property
是否禁用该选项
## Signature
```typescript
disabled?: boolean;
```
### text
# SelectOption.text property
显示文本
## Signature
```typescript
text: string;
```
### value
# SelectOption.value property
选项值
## Signature
```typescript
value: string | number;
```
references/interfaces/SortState.md
# SortState interface
排序状态
## Signature
```typescript
interface SortState
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[columnKey](./SortState.md)
</td><td>
</td><td>
string
</td><td>
参与排序的列 key
</td></tr>
<tr><td>
[order](./SortState.md)
</td><td>
</td><td>
[SortOrder](../types/SortOrder.md)
</td><td>
排序方向
</td></tr>
</tbody></table>
---
## 属性详情
### columnkey
# SortState.columnKey property
参与排序的列 key
## Signature
```typescript
columnKey: string;
```
### order
# SortState.order property
排序方向
## Signature
```typescript
order: SortOrder;
```
references/interfaces/SelectionConfig.md
# SelectionConfig interface
选择配置
## Signature
```typescript
interface SelectionConfig
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[align?](./SelectionConfig.md)
</td><td>
</td><td>
[Align](../types/Align.md)
</td><td>
_(Optional)_ 勾选框列对齐,默认 'left'
</td></tr>
<tr><td>
[checkboxColumnWidth?](./SelectionConfig.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 勾选框列宽度,默认 30
</td></tr>
<tr><td>
[ctrlSelect?](./SelectionConfig.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ 是否支持 Ctrl 多选,默认 true
</td></tr>
<tr><td>
[defaultSelectedKeys?](./SelectionConfig.md)
</td><td>
</td><td>
string\[\]
</td><td>
_(Optional)_ 非受控:初始选中行 key 列表
</td></tr>
<tr><td>
[disabledCheckboxKeys?](./SelectionConfig.md)
</td><td>
</td><td>
string\[\]
</td><td>
_(Optional)_ 禁用勾选框的行 key 列表
</td></tr>
<tr><td>
[disabledSelectKeys?](./SelectionConfig.md)
</td><td>
</td><td>
string\[\]
</td><td>
_(Optional)_ 不可选的行 key 列表
</td></tr>
<tr><td>
[onChange?](./SelectionConfig.md)
</td><td>
</td><td>
(info: { selectedKeys: string\[\]; selectedRows: [RichTableRow](../types/RichTableRow.md)<!-- -->\[\]; detail: { action: 'select' \| 'unselect' \| 'selectAll' \| 'clear'; row?: [RichTableRow](../types/RichTableRow.md)<!-- -->; triggerFromCheck?: boolean } }) => void
</td><td>
_(Optional)_ 选择变更通知(受控模式必传)
</td></tr>
<tr><td>
[rangeSelect?](./SelectionConfig.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ 是否启用 Ctrl/Shift 范围选择,默认 false(type=multiple 时可开启)
</td></tr>
<tr><td>
[selectedKeys?](./SelectionConfig.md)
</td><td>
</td><td>
string\[\]
</td><td>
_(Optional)_ 受控:外部维护的选中行 key 列表
</td></tr>
<tr><td>
[selectOnRowClick?](./SelectionConfig.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ 单击行时是否触发选中(type=single 时默认 true)
</td></tr>
<tr><td>
[shiftSelect?](./SelectionConfig.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ 是否支持 Shift 范围选,默认 true
</td></tr>
<tr><td>
[type](./SelectionConfig.md)
</td><td>
</td><td>
'single' \| 'multiple' \| 'checkbox'
</td><td>
选择模式: - single:单击单选一行 - multiple:单击 + Ctrl/Shift 多选 - checkbox:勾选框列(勾选仅通过 checkbox,行点击不改变勾选)
</td></tr>
</tbody></table>
---
## 属性详情
### align
# SelectionConfig.align property
勾选框列对齐,默认 'left'
## Signature
```typescript
align?: Align;
```
### checkboxcolumnwidth
# SelectionConfig.checkboxColumnWidth property
勾选框列宽度,默认 30
## Signature
```typescript
checkboxColumnWidth?: number;
```
### ctrlselect
# SelectionConfig.ctrlSelect property
是否支持 Ctrl 多选,默认 true
## Signature
```typescript
ctrlSelect?: boolean;
```
### defaultselectedkeys
# SelectionConfig.defaultSelectedKeys property
非受控:初始选中行 key 列表
## Signature
```typescript
defaultSelectedKeys?: string[];
```
### disabledcheckboxkeys
# SelectionConfig.disabledCheckboxKeys property
禁用勾选框的行 key 列表
## Signature
```typescript
disabledCheckboxKeys?: string[];
```
### disabledselectkeys
# SelectionConfig.disabledSelectKeys property
不可选的行 key 列表
## Signature
```typescript
disabledSelectKeys?: string[];
```
### onchange
# SelectionConfig.onChange property
选择变更通知(受控模式必传)
## Signature
```typescript
onChange?: (info: { selectedKeys: string[]; selectedRows: RichTableRow[]; detail: { action: 'select' | 'unselect' | 'selectAll' | 'clear'; row?: RichTableRow; triggerFromCheck?: boolean } }) => void;
```
### rangeselect
# SelectionConfig.rangeSelect property
是否启用 Ctrl/Shift 范围选择,默认 false(type=multiple 时可开启)
## Signature
```typescript
rangeSelect?: boolean;
```
### selectedkeys
# SelectionConfig.selectedKeys property
受控:外部维护的选中行 key 列表
## Signature
```typescript
selectedKeys?: string[];
```
### selectonrowclick
# SelectionConfig.selectOnRowClick property
单击行时是否触发选中(type=single 时默认 true)
## Signature
```typescript
selectOnRowClick?: boolean;
```
### shiftselect
# SelectionConfig.shiftSelect property
是否支持 Shift 范围选,默认 true
## Signature
```typescript
shiftSelect?: boolean;
```
### type
# SelectionConfig.type property
选择模式: - single:单击单选一行 - multiple:单击 + Ctrl/Shift 多选 - checkbox:勾选框列(勾选仅通过 checkbox,行点击不改变勾选)
## Signature
```typescript
type: 'single' | 'multiple' | 'checkbox';
```
references/interfaces/SortingConfig.md
# SortingConfig interface
排序配置
## Signature
```typescript
interface SortingConfig
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[defaultState?](./SortingConfig.md)
</td><td>
</td><td>
[SortState](./SortState.md)<!-- -->\[\]
</td><td>
_(Optional)_ 非受控:初始排序状态
</td></tr>
<tr><td>
[multiple?](./SortingConfig.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ 是否支持多列排序,默认 false
</td></tr>
<tr><td>
[onChange?](./SortingConfig.md)
</td><td>
</td><td>
(state: [SortState](./SortState.md)<!-- -->\[\]) => void
</td><td>
_(Optional)_ 排序变更通知
</td></tr>
<tr><td>
[remote?](./SortingConfig.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ 远端排序:true 时仅触发 onChange,不本地排序,默认 false
</td></tr>
<tr><td>
[state?](./SortingConfig.md)
</td><td>
</td><td>
[SortState](./SortState.md)<!-- -->\[\]
</td><td>
_(Optional)_ 受控:外部维护的排序状态
</td></tr>
</tbody></table>
---
## 属性详情
### defaultstate
# SortingConfig.defaultState property
非受控:初始排序状态
## Signature
```typescript
defaultState?: SortState[];
```
### multiple
# SortingConfig.multiple property
是否支持多列排序,默认 false
## Signature
```typescript
multiple?: boolean;
```
### onchange
# SortingConfig.onChange property
排序变更通知
## Signature
```typescript
onChange?: (state: SortState[]) => void;
```
### remote
# SortingConfig.remote property
远端排序:true 时仅触发 onChange,不本地排序,默认 false
## Signature
```typescript
remote?: boolean;
```
### state
# SortingConfig.state property
受控:外部维护的排序状态
## Signature
```typescript
state?: SortState[];
```
references/interfaces/SlotProps.md
# SlotProps interface
插槽组件:为父组件提供具名内容占位
## Signature
```typescript
interface SlotProps
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[children?](./SlotProps.md)
</td><td>
</td><td>
any
</td><td>
_(Optional)_ Slot content child nodes
</td></tr>
<tr><td>
[name](./SlotProps.md)
</td><td>
</td><td>
string
</td><td>
Slot name (required)
</td></tr>
</tbody></table>
---
## 属性详情
### children
# SlotProps.children property
Slot content child nodes
## Signature
```typescript
children?: any;
```
### name
# SlotProps.name property
Slot name (required)
## Signature
```typescript
name: string;
```
references/interfaces/SliderProps.md
# SliderProps interface
滑杆组件:基于浏览器原生 range 输入
## Signature
```typescript
interface SliderProps
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[max?](./SliderProps.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 最大值(默认 1)
</td></tr>
<tr><td>
[min?](./SliderProps.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 最小值(默认 0)
</td></tr>
<tr><td>
[onChange?](./SliderProps.md)
</td><td>
</td><td>
(value: number) => void
</td><td>
_(Optional)_ 值变化时触发,参数为最新值
</td></tr>
<tr><td>
[value?](./SliderProps.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 当前值(受控)
</td></tr>
</tbody></table>
---
## 属性详情
### max
# SliderProps.max property
最大值(默认 1)
## Signature
```typescript
max?: number;
```
### min
# SliderProps.min property
最小值(默认 0)
## Signature
```typescript
min?: number;
```
### onchange
# SliderProps.onChange property
值变化时触发,参数为最新值
## Signature
```typescript
onChange?: (value: number) => void;
```
### value
# SliderProps.value property
当前值(受控)
## Signature
```typescript
value?: number;
```
references/interfaces/StyleProps.md
# StyleProps interface
通用样式属性:可被布局容器等组件继承的样式集合
## Signature
```typescript
interface StyleProps
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[backgroundColor?](./StyleProps.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Background color. Accepts any CSS color value
</td></tr>
<tr><td>
[backgroundImage?](./StyleProps.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ CSS background-image(如 url(data:...)棋盘格背景)
</td></tr>
<tr><td>
[borderColor?](./StyleProps.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Border color. Only takes effect when borderWidth > 0
</td></tr>
<tr><td>
[borderStyle?](./StyleProps.md)
</td><td>
</td><td>
'solid' \| 'dashed' \| 'dotted'
</td><td>
_(Optional)_ 边框线型,默认 solid(borderWidth<!-- -->><!-- -->0 时生效)
</td></tr>
<tr><td>
[borderWidth?](./StyleProps.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ Border width (pixels). Takes effect when > 0
</td></tr>
<tr><td>
[color?](./StyleProps.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Text color. Accepts any CSS color value
</td></tr>
<tr><td>
[cursor?](./StyleProps.md)
</td><td>
</td><td>
'pointer' \| 'default' \| 'none' \| 'move' \| 'text'
</td><td>
_(Optional)_ Cursor style when the mouse hovers
</td></tr>
<tr><td>
[display?](./StyleProps.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Override the display style
</td></tr>
<tr><td>
[height?](./StyleProps.md)
</td><td>
</td><td>
number \| '100%'
</td><td>
_(Optional)_ Height ( pixels) or '100%'
</td></tr>
<tr><td>
[hide?](./StyleProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ Whether to hide (display: none), taking precedence over invisible
</td></tr>
<tr><td>
[invisible?](./StyleProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ Whether to only hide visually (visibility: hidden), still occupying space
</td></tr>
<tr><td>
[margin?](./StyleProps.md)
</td><td>
</td><td>
number\[\]
</td><td>
_(Optional)_ Margin (CSS shorthand), e.g. \[top, right, bottom, left\] or \[vertical, horizontal\] or \[all\]
</td></tr>
<tr><td>
[padding?](./StyleProps.md)
</td><td>
</td><td>
number\[\]
</td><td>
_(Optional)_ Padding (CSS shorthand), e.g. \[top, right, bottom, left\] or \[vertical, horizontal\] or \[all\]
</td></tr>
<tr><td>
[rotate?](./StyleProps.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ Rotation angle (degrees)
</td></tr>
<tr><td>
[width?](./StyleProps.md)
</td><td>
</td><td>
number \| '100%'
</td><td>
_(Optional)_ Width ( pixels) or '100%'
</td></tr>
</tbody></table>
---
## 属性详情
### backgroundcolor
# StyleProps.backgroundColor property
Background color. Accepts any CSS color value
## Signature
```typescript
backgroundColor?: string;
```
### backgroundimage
# StyleProps.backgroundImage property
CSS background-image(如 url(data:...)棋盘格背景)
## Signature
```typescript
backgroundImage?: string;
```
### bordercolor
# StyleProps.borderColor property
Border color. Only takes effect when borderWidth > 0
## Signature
```typescript
borderColor?: string;
```
### borderstyle
# StyleProps.borderStyle property
边框线型,默认 solid(borderWidth<!-- -->><!-- -->0 时生效)
## Signature
```typescript
borderStyle?: 'solid' | 'dashed' | 'dotted';
```
### borderwidth
# StyleProps.borderWidth property
Border width (pixels). Takes effect when > 0
## Signature
```typescript
borderWidth?: number;
```
### color
# StyleProps.color property
Text color. Accepts any CSS color value
## Signature
```typescript
color?: string;
```
### cursor
# StyleProps.cursor property
Cursor style when the mouse hovers
## Signature
```typescript
cursor?: 'pointer' | 'default' | 'none' | 'move' | 'text';
```
### display
# StyleProps.display property
Override the display style
## Signature
```typescript
display?: string;
```
### height
# StyleProps.height property
Height ( pixels) or '100%'
## Signature
```typescript
height?: number | '100%';
```
### hide
# StyleProps.hide property
Whether to hide (display: none), taking precedence over invisible
## Signature
```typescript
hide?: boolean;
```
### invisible
# StyleProps.invisible property
Whether to only hide visually (visibility: hidden), still occupying space
## Signature
```typescript
invisible?: boolean;
```
### margin
# StyleProps.margin property
Margin (CSS shorthand), e.g. \[top, right, bottom, left\] or \[vertical, horizontal\] or \[all\]
## Signature
```typescript
margin?: number[];
```
### padding
# StyleProps.padding property
Padding (CSS shorthand), e.g. \[top, right, bottom, left\] or \[vertical, horizontal\] or \[all\]
## Signature
```typescript
padding?: number[];
```
### rotate
# StyleProps.rotate property
Rotation angle (degrees)
## Signature
```typescript
rotate?: number;
```
### width
# StyleProps.width property
Width ( pixels) or '100%'
## Signature
```typescript
width?: number | '100%';
```
references/interfaces/TextAreaProps.md
# TextAreaProps interface
多行文本输入组件
## Signature
```typescript
interface TextAreaProps
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[disabled?](./TextAreaProps.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ Whether Disable input
</td></tr>
<tr><td>
[name?](./TextAreaProps.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Input box name (the form `name` attribute)
</td></tr>
<tr><td>
[onChange?](./TextAreaProps.md)
</td><td>
</td><td>
(value: string) => void
</td><td>
_(Optional)_ 文本变化时触发,参数为最新值
</td></tr>
<tr><td>
[placeholder?](./TextAreaProps.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Placeholder text
</td></tr>
<tr><td>
[resizable?](./TextAreaProps.md)
</td><td>
</td><td>
\{ x?: boolean; y?: boolean \}
</td><td>
_(Optional)_ Whether it is resizable (x horizontal / y vertical)
</td></tr>
<tr><td>
[value?](./TextAreaProps.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Current text value
</td></tr>
</tbody></table>
---
## 属性详情
### disabled
# TextAreaProps.disabled property
Whether Disable input
## Signature
```typescript
disabled?: boolean;
```
### name
# TextAreaProps.name property
Input box name (the form `name` attribute)
## Signature
```typescript
name?: string;
```
### onchange
# TextAreaProps.onChange property
文本变化时触发,参数为最新值
## Signature
```typescript
onChange?: (value: string) => void;
```
### placeholder
# TextAreaProps.placeholder property
Placeholder text
## Signature
```typescript
placeholder?: string;
```
### resizable
# TextAreaProps.resizable property
Whether it is resizable (x horizontal / y vertical)
## Signature
```typescript
resizable?: { x?: boolean; y?: boolean };
```
### value
# TextAreaProps.value property
Current text value
## Signature
```typescript
value?: string;
```
references/interfaces/TextProps.md
# TextProps interface
文本组件:静态文本展示
## Signature
```typescript
interface TextProps
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[color?](./TextProps.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Text color
</td></tr>
<tr><td>
[fontFamily?](./TextProps.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ Font family
</td></tr>
<tr><td>
[fontSize?](./TextProps.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ Font size ( pixels)
</td></tr>
<tr><td>
[textAlign?](./TextProps.md)
</td><td>
</td><td>
'left' \| 'center' \| 'right'
</td><td>
_(Optional)_ Horizontal alignment
</td></tr>
<tr><td>
[value](./TextProps.md)
</td><td>
</td><td>
string
</td><td>
Text content ( required)
</td></tr>
</tbody></table>
---
## 属性详情
### color
# TextProps.color property
Text color
## Signature
```typescript
color?: string;
```
### fontfamily
# TextProps.fontFamily property
Font family
## Signature
```typescript
fontFamily?: string;
```
### fontsize
# TextProps.fontSize property
Font size ( pixels)
## Signature
```typescript
fontSize?: number;
```
### textalign
# TextProps.textAlign property
Horizontal alignment
## Signature
```typescript
textAlign?: 'left' | 'center' | 'right';
```
### value
# TextProps.value property
Text content ( required)
## Signature
```typescript
value: string;
```
references/interfaces/TextareaEditConfig.md
# TextareaEditConfig interface
## Signature
```typescript
interface TextareaEditConfig
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[maxLength?](./TextareaEditConfig.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_
</td></tr>
<tr><td>
[onChange?](./TextareaEditConfig.md)
</td><td>
</td><td>
(value: string) => void
</td><td>
_(Optional)_
</td></tr>
<tr><td>
[onConfirm?](./TextareaEditConfig.md)
</td><td>
</td><td>
(value: string) => void
</td><td>
_(Optional)_
</td></tr>
<tr><td>
[placeholder?](./TextareaEditConfig.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_
</td></tr>
<tr><td>
[rows?](./TextareaEditConfig.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 行数,默认 3
</td></tr>
<tr><td>
[type](./TextareaEditConfig.md)
</td><td>
</td><td>
'textarea'
</td><td>
</td></tr>
</tbody></table>
---
## 属性详情
### maxlength
# TextareaEditConfig.maxLength property
## Signature
```typescript
maxLength?: number;
```
### onchange
# TextareaEditConfig.onChange property
## Signature
```typescript
onChange?: (value: string) => void;
```
### onconfirm
# TextareaEditConfig.onConfirm property
## Signature
```typescript
onConfirm?: (value: string) => void;
```
### placeholder
# TextareaEditConfig.placeholder property
## Signature
```typescript
placeholder?: string;
```
### rows
# TextareaEditConfig.rows property
行数,默认 3
## Signature
```typescript
rows?: number;
```
### type
# TextareaEditConfig.type property
## Signature
```typescript
type: 'textarea';
```
references/interfaces/ValidationRule.md
# ValidationRule interface
校验规则(声明式,纯数据,可序列化)
## Signature
```typescript
interface ValidationRule
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[max?](./ValidationRule.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 最大值(数字)
</td></tr>
<tr><td>
[maxLength?](./ValidationRule.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 最大长度(字符串)
</td></tr>
<tr><td>
[message?](./ValidationRule.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ 校验失败时的提示文案
</td></tr>
<tr><td>
[min?](./ValidationRule.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 最小值(数字)
</td></tr>
<tr><td>
[minLength?](./ValidationRule.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 最小长度(字符串)
</td></tr>
<tr><td>
[pattern?](./ValidationRule.md)
</td><td>
</td><td>
string
</td><td>
_(Optional)_ 正则表达式字符串(匹配失败即校验失败)
</td></tr>
<tr><td>
[required?](./ValidationRule.md)
</td><td>
</td><td>
boolean
</td><td>
_(Optional)_ 是否必填(空值 = null/undefined/空白字符串)
</td></tr>
</tbody></table>
---
## 属性详情
### max
# ValidationRule.max property
最大值(数字)
## Signature
```typescript
max?: number;
```
### maxlength
# ValidationRule.maxLength property
最大长度(字符串)
## Signature
```typescript
maxLength?: number;
```
### message
# ValidationRule.message property
校验失败时的提示文案
## Signature
```typescript
message?: string;
```
### min
# ValidationRule.min property
最小值(数字)
## Signature
```typescript
min?: number;
```
### minlength
# ValidationRule.minLength property
最小长度(字符串)
## Signature
```typescript
minLength?: number;
```
### pattern
# ValidationRule.pattern property
正则表达式字符串(匹配失败即校验失败)
## Signature
```typescript
pattern?: string;
```
### required
# ValidationRule.required property
是否必填(空值 = null/undefined/空白字符串)
## Signature
```typescript
required?: boolean;
```
references/types/Align.md
# Align type
对齐方式
## Signature
```typescript
type Align = 'left' | 'center' | 'right';
```
references/interfaces/VirtualScrollConfig.md
# VirtualScrollConfig interface
虚拟滚动配置
## Signature
```typescript
interface VirtualScrollConfig
```
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[onScrollToEnd?](./VirtualScrollConfig.md)
</td><td>
</td><td>
() => void
</td><td>
_(Optional)_ 滚动到底部通知
</td></tr>
<tr><td>
[overscan?](./VirtualScrollConfig.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 预渲染行数(上下各),默认 10
</td></tr>
<tr><td>
[scrollEndThreshold?](./VirtualScrollConfig.md)
</td><td>
</td><td>
number
</td><td>
_(Optional)_ 触发 onScrollToEnd 的距底阈值,默认 200
</td></tr>
</tbody></table>
---
## 属性详情
### onscrolltoend
# VirtualScrollConfig.onScrollToEnd property
滚动到底部通知
## Signature
```typescript
onScrollToEnd?: () => void;
```
### overscan
# VirtualScrollConfig.overscan property
预渲染行数(上下各),默认 10
## Signature
```typescript
overscan?: number;
```
### scrollendthreshold
# VirtualScrollConfig.scrollEndThreshold property
触发 onScrollToEnd 的距底阈值,默认 200
## Signature
```typescript
scrollEndThreshold?: number;
```
references/types/ColumnDefOrGroup.md
# ColumnDefOrGroup type
列定义(支持普通列和列分组)
## Signature
```typescript
type ColumnDefOrGroup<T = any> = ColumnDef<T> | ColumnGroupDef<T>;
```
## References
[ColumnDef](../interfaces/ColumnDef.md)<!-- -->, [ColumnGroupDef](../interfaces/ColumnGroupDef.md)
references/types/CellContentType.md
# CellContentType type
剪贴板单元格内容类型(决定粘贴时的解析策略)
## Signature
```typescript
type CellContentType = 'TEXT' | 'INPUT' | 'TEXTAREA' | 'SELECT' | 'CHECKBOX';
```
references/types/FilterMatchMode.md
# FilterMatchMode type
筛选匹配模式
## Signature
```typescript
type FilterMatchMode = 'contains' | 'startsWith' | 'endsWith' | 'exact' | 'regex';
```
references/types/ColumnType.md
# ColumnType type
列数据类型,默认 'text'。决定默认排序类型(sortType)和筛选匹配模式(filterMatchMode)
## Signature
```typescript
type ColumnType = 'text' | 'number' | 'select' | 'checkbox' | 'date' | 'boolean';
```
references/types/DataChangeType.md
# DataChangeType type
数据变更类型
## Signature
```typescript
type DataChangeType = 'NORMAL' | 'CHECKED' | 'ASC_SORT' | 'DESC_SORT';
```
references/types/ColumnEditConfig.md
# ColumnEditConfig type
五种编辑器类型配置
## Signature
```typescript
type ColumnEditConfig
= InputEditConfig | NumberEditConfig | SelectEditConfig | TextareaEditConfig | CheckboxEditConfig;
```
## References
[InputEditConfig](../interfaces/InputEditConfig.md)<!-- -->, [NumberEditConfig](../interfaces/NumberEditConfig.md)<!-- -->, [SelectEditConfig](../interfaces/SelectEditConfig.md)<!-- -->, [TextareaEditConfig](../interfaces/TextareaEditConfig.md)<!-- -->, [CheckboxEditConfig](../interfaces/CheckboxEditConfig.md)
references/types/RichTableRow.md
# RichTableRow type
行数据:业务数据 + 行元数据(rowMeta)
## Signature
```typescript
type RichTableRow<T = any> = T & Partial<RowMetaConfig>;
```
## References
[RowMetaConfig](../interfaces/RowMetaConfig.md)
references/types/Serializable.md
# Serializable type
## Signature
```typescript
type Serializable = SerializablePrimitive | Serializable[] | { [key: string]: Serializable };
```
## References
[SerializablePrimitive](./SerializablePrimitive.md)<!-- -->, [Serializable](./Serializable.md)references/types/SerializablePrimitive.md
# SerializablePrimitive type
可序列化纯数据(可跨 BroadcastChannel 结构化克隆)。 编译期拒绝函数 / Date / React 元素等不可序列化值——slotProps 等跨广播字段必须用它。
## Signature
```typescript
type SerializablePrimitive = string | number | boolean | null;
```
references/types/SortOrder.md
# SortOrder type
排序方向
## Signature
```typescript
type SortOrder = 'asc' | 'desc';
```
references/types/TPCB_LayersInTheSelectable.md
# TPCB\_LayersInTheSelectable type
Selectable layers
## Signature
```typescript
type TPCB_LayersInTheSelectable
= | TPCB_LayersOfInner
| TPCB_LayersOfCustom
| EPCB_LayerId.TOP
| EPCB_LayerId.TOP_SILKSCREEN
| EPCB_LayerId.TOP_SOLDER_MASK
| EPCB_LayerId.TOP_PASTE_MASK
| EPCB_LayerId.TOP_ASSEMBLY
| EPCB_LayerId.TOP_STIFFENER
| EPCB_LayerId.BOTTOM
| EPCB_LayerId.BOTTOM_SILKSCREEN
| EPCB_LayerId.BOTTOM_SOLDER_MASK
| EPCB_LayerId.BOTTOM_PASTE_MASK
| EPCB_LayerId.BOTTOM_ASSEMBLY
| EPCB_LayerId.BOTTOM_STIFFENER
| EPCB_LayerId.BOARD_OUTLINE
| EPCB_LayerId.MULTI
| EPCB_LayerId.DOCUMENT
| EPCB_LayerId.MECHANICAL
| EPCB_LayerId.DRILL_DRAWING
| EPCB_LayerId.RATLINE
| EPCB_LayerId.COMPONENT_SHAPE
| EPCB_LayerId.COMPONENT_MARKING
| EPCB_LayerId.PIN_SOLDERING
| EPCB_LayerId.PIN_FLOATING
| EPCB_LayerId.SHELL_3D_OUTLINE
| EPCB_LayerId.SHELL_3D_TOP
| EPCB_LayerId.SHELL_3D_BOTTOM;
```
## References
[TPCB\_LayersOfInner](./TPCB_LayersOfInner.md)<!-- -->, [TPCB\_LayersOfCustom](./TPCB_LayersOfCustom.md)<!-- -->, [EPCB\_LayerId.TOP](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.TOP\_SILKSCREEN](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.TOP\_SOLDER\_MASK](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.TOP\_PASTE\_MASK](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.TOP\_ASSEMBLY](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.TOP\_STIFFENER](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.BOTTOM](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.BOTTOM\_SILKSCREEN](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.BOTTOM\_SOLDER\_MASK](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.BOTTOM\_PASTE\_MASK](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.BOTTOM\_ASSEMBLY](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.BOTTOM\_STIFFENER](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.BOARD\_OUTLINE](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.MULTI](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.DOCUMENT](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.MECHANICAL](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.DRILL\_DRAWING](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.RATLINE](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.COMPONENT\_SHAPE](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.COMPONENT\_MARKING](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.PIN\_SOLDERING](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.PIN\_FLOATING](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.SHELL\_3D\_OUTLINE](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.SHELL\_3D\_TOP](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.SHELL\_3D\_BOTTOM](../enums/EPCB_LayerId.md)
## Remarks
Here are all layers that can be selected and set visible in the editor layer menu
references/types/TPCB_LayerTypesOfInnerLayer.md
# TPCB\_LayerTypesOfInnerLayer type
Layer types allowed to be set for inner layers
## Signature
```typescript
type TPCB_LayerTypesOfInnerLayer = EPCB_LayerType.SIGNAL | EPCB_LayerType.INTERNAL_ELECTRICAL;
```
## References
[EPCB\_LayerType.SIGNAL](../enums/EPCB_LayerType.md)<!-- -->, [EPCB\_LayerType.INTERNAL\_ELECTRICAL](../enums/EPCB_LayerType.md)
references/types/TPCB_LayersOfCopper.md
# TPCB\_LayersOfCopper type
Layers of copper
## Signature
```typescript
type TPCB_LayersOfCopper = TPCB_LayersOfInner | EPCB_LayerId.TOP | EPCB_LayerId.BOTTOM;
```
## References
[TPCB\_LayersOfInner](./TPCB_LayersOfInner.md)<!-- -->, [EPCB\_LayerId.TOP](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.BOTTOM](../enums/EPCB_LayerId.md)
## Remarks
This is for the convenience of single-layer copper design and does not include [EPCB\_LayerId.MULTI](../enums/EPCB_LayerId.md)
references/types/TPCB_LayersOfCustom.md
# TPCB\_LayersOfCustom type
Custom layers
## Signature
```typescript
type TPCB_LayersOfCustom
= | EPCB_LayerId.CUSTOM_1
| EPCB_LayerId.CUSTOM_2
| EPCB_LayerId.CUSTOM_3
| EPCB_LayerId.CUSTOM_4
| EPCB_LayerId.CUSTOM_5
| EPCB_LayerId.CUSTOM_6
| EPCB_LayerId.CUSTOM_7
| EPCB_LayerId.CUSTOM_8
| EPCB_LayerId.CUSTOM_9
| EPCB_LayerId.CUSTOM_10
| EPCB_LayerId.CUSTOM_11
| EPCB_LayerId.CUSTOM_12
| EPCB_LayerId.CUSTOM_13
| EPCB_LayerId.CUSTOM_14
| EPCB_LayerId.CUSTOM_15
| EPCB_LayerId.CUSTOM_16
| EPCB_LayerId.CUSTOM_17
| EPCB_LayerId.CUSTOM_18
| EPCB_LayerId.CUSTOM_19
| EPCB_LayerId.CUSTOM_20
| EPCB_LayerId.CUSTOM_21
| EPCB_LayerId.CUSTOM_22
| EPCB_LayerId.CUSTOM_23
| EPCB_LayerId.CUSTOM_24
| EPCB_LayerId.CUSTOM_25
| EPCB_LayerId.CUSTOM_26
| EPCB_LayerId.CUSTOM_27
| EPCB_LayerId.CUSTOM_28
| EPCB_LayerId.CUSTOM_29
| EPCB_LayerId.CUSTOM_30;
```
## References
[EPCB\_LayerId.CUSTOM\_1](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.CUSTOM\_2](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.CUSTOM\_3](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.CUSTOM\_4](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.CUSTOM\_5](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.CUSTOM\_6](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.CUSTOM\_7](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.CUSTOM\_8](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.CUSTOM\_9](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.CUSTOM\_10](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.CUSTOM\_11](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.CUSTOM\_12](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.CUSTOM\_13](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.CUSTOM\_14](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.CUSTOM\_15](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.CUSTOM\_16](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.CUSTOM\_17](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.CUSTOM\_18](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.CUSTOM\_19](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.CUSTOM\_20](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.CUSTOM\_21](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.CUSTOM\_22](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.CUSTOM\_23](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.CUSTOM\_24](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.CUSTOM\_25](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.CUSTOM\_26](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.CUSTOM\_27](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.CUSTOM\_28](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.CUSTOM\_29](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.CUSTOM\_30](../enums/EPCB_LayerId.md)
references/types/TPCB_LayersOfFill.md
# TPCB\_LayersOfFill type
Layers of the fill
## Signature
```typescript
type TPCB_LayersOfFill
= | TPCB_LayersOfCopper
| TPCB_LayersOfCustom
| EPCB_LayerId.TOP_SILKSCREEN
| EPCB_LayerId.TOP_SOLDER_MASK
| EPCB_LayerId.TOP_PASTE_MASK
| EPCB_LayerId.TOP_ASSEMBLY
| EPCB_LayerId.BOTTOM_SILKSCREEN
| EPCB_LayerId.BOTTOM_SOLDER_MASK
| EPCB_LayerId.BOTTOM_PASTE_MASK
| EPCB_LayerId.BOTTOM_ASSEMBLY
| EPCB_LayerId.DOCUMENT
| EPCB_LayerId.MECHANICAL
| EPCB_LayerId.MULTI;
```
## References
[TPCB\_LayersOfCopper](./TPCB_LayersOfCopper.md)<!-- -->, [TPCB\_LayersOfCustom](./TPCB_LayersOfCustom.md)<!-- -->, [EPCB\_LayerId.TOP\_SILKSCREEN](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.TOP\_SOLDER\_MASK](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.TOP\_PASTE\_MASK](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.TOP\_ASSEMBLY](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.BOTTOM\_SILKSCREEN](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.BOTTOM\_SOLDER\_MASK](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.BOTTOM\_PASTE\_MASK](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.BOTTOM\_ASSEMBLY](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.DOCUMENT](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.MECHANICAL](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.MULTI](../enums/EPCB_LayerId.md)
## Remarks
When the fill layer is [EPCB\_LayerId.MULTI](../enums/EPCB_LayerId.md)<!-- -->, it represents a slot region
references/types/TPCB_LayersOfImage.md
# TPCB\_LayersOfImage type
Layers of complex polygon figures (SVG images, text)
## Signature
```typescript
type TPCB_LayersOfImage
= | TPCB_LayersOfCopper
| TPCB_LayersOfCustom
| EPCB_LayerId.TOP_SILKSCREEN
| EPCB_LayerId.TOP_SOLDER_MASK
| EPCB_LayerId.TOP_ASSEMBLY
| EPCB_LayerId.BOTTOM_SILKSCREEN
| EPCB_LayerId.BOTTOM_SOLDER_MASK
| EPCB_LayerId.BOTTOM_ASSEMBLY
| EPCB_LayerId.DOCUMENT
| EPCB_LayerId.MECHANICAL
| EPCB_LayerId.DRILL_DRAWING;
```
## References
[TPCB\_LayersOfCopper](./TPCB_LayersOfCopper.md)<!-- -->, [TPCB\_LayersOfCustom](./TPCB_LayersOfCustom.md)<!-- -->, [EPCB\_LayerId.TOP\_SILKSCREEN](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.TOP\_SOLDER\_MASK](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.TOP\_ASSEMBLY](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.BOTTOM\_SILKSCREEN](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.BOTTOM\_SOLDER\_MASK](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.BOTTOM\_ASSEMBLY](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.DOCUMENT](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.MECHANICAL](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.DRILL\_DRAWING](../enums/EPCB_LayerId.md)
references/types/TPCB_LayersOfComponent.md
# TPCB\_LayersOfComponent type
Layers of the device
## Signature
```typescript
type TPCB_LayersOfComponent = EPCB_LayerId.TOP | EPCB_LayerId.BOTTOM;
```
## References
[EPCB\_LayerId.TOP](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.BOTTOM](../enums/EPCB_LayerId.md)
references/types/TPCB_LayersOfDimension.md
# TPCB\_LayersOfDimension type
Layers of the dimension
## Signature
```typescript
type TPCB_LayersOfDimension
= | TPCB_LayersOfCustom
| EPCB_LayerId.TOP_SILKSCREEN
| EPCB_LayerId.BOTTOM_SILKSCREEN
| EPCB_LayerId.DOCUMENT
| EPCB_LayerId.MECHANICAL;
```
## References
[TPCB\_LayersOfCustom](./TPCB_LayersOfCustom.md)<!-- -->, [EPCB\_LayerId.TOP\_SILKSCREEN](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.BOTTOM\_SILKSCREEN](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.DOCUMENT](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.MECHANICAL](../enums/EPCB_LayerId.md)
references/types/TPCB_LayersOfLine.md
# TPCB\_LayersOfLine type
Layers of the line
## Signature
```typescript
type TPCB_LayersOfLine
= | TPCB_LayersOfCopper
| TPCB_LayersOfCustom
| EPCB_LayerId.TOP_SILKSCREEN
| EPCB_LayerId.TOP_SOLDER_MASK
| EPCB_LayerId.TOP_PASTE_MASK
| EPCB_LayerId.TOP_ASSEMBLY
| EPCB_LayerId.BOTTOM_SILKSCREEN
| EPCB_LayerId.BOTTOM_SOLDER_MASK
| EPCB_LayerId.BOTTOM_PASTE_MASK
| EPCB_LayerId.BOTTOM_ASSEMBLY
| EPCB_LayerId.BOARD_OUTLINE
| EPCB_LayerId.DOCUMENT
| EPCB_LayerId.MECHANICAL
| EPCB_LayerId.DRILL_DRAWING;
```
## References
[TPCB\_LayersOfCopper](./TPCB_LayersOfCopper.md)<!-- -->, [TPCB\_LayersOfCustom](./TPCB_LayersOfCustom.md)<!-- -->, [EPCB\_LayerId.TOP\_SILKSCREEN](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.TOP\_SOLDER\_MASK](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.TOP\_PASTE\_MASK](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.TOP\_ASSEMBLY](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.BOTTOM\_SILKSCREEN](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.BOTTOM\_SOLDER\_MASK](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.BOTTOM\_PASTE\_MASK](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.BOTTOM\_ASSEMBLY](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.BOARD\_OUTLINE](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.DOCUMENT](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.MECHANICAL](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.DRILL\_DRAWING](../enums/EPCB_LayerId.md)
references/types/TPCB_LayersOfObject.md
# TPCB\_LayersOfObject type
Layers of binary embedded objects
## Signature
```typescript
type TPCB_LayersOfObject
= EPCB_LayerId.TOP_SILKSCREEN | EPCB_LayerId.BOTTOM_SILKSCREEN | EPCB_LayerId.DOCUMENT;
```
## References
[EPCB\_LayerId.TOP\_SILKSCREEN](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.BOTTOM\_SILKSCREEN](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.DOCUMENT](../enums/EPCB_LayerId.md)
references/types/TPCB_LayersOfInner.md
# TPCB\_LayersOfInner type
Inner layers
## Signature
```typescript
type TPCB_LayersOfInner
= | EPCB_LayerId.INNER_1
| EPCB_LayerId.INNER_2
| EPCB_LayerId.INNER_3
| EPCB_LayerId.INNER_4
| EPCB_LayerId.INNER_5
| EPCB_LayerId.INNER_6
| EPCB_LayerId.INNER_7
| EPCB_LayerId.INNER_8
| EPCB_LayerId.INNER_9
| EPCB_LayerId.INNER_10
| EPCB_LayerId.INNER_11
| EPCB_LayerId.INNER_12
| EPCB_LayerId.INNER_13
| EPCB_LayerId.INNER_14
| EPCB_LayerId.INNER_15
| EPCB_LayerId.INNER_16
| EPCB_LayerId.INNER_17
| EPCB_LayerId.INNER_18
| EPCB_LayerId.INNER_19
| EPCB_LayerId.INNER_20
| EPCB_LayerId.INNER_21
| EPCB_LayerId.INNER_22
| EPCB_LayerId.INNER_23
| EPCB_LayerId.INNER_24
| EPCB_LayerId.INNER_25
| EPCB_LayerId.INNER_26
| EPCB_LayerId.INNER_27
| EPCB_LayerId.INNER_28
| EPCB_LayerId.INNER_29
| EPCB_LayerId.INNER_30;
```
## References
[EPCB\_LayerId.INNER\_1](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.INNER\_2](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.INNER\_3](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.INNER\_4](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.INNER\_5](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.INNER\_6](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.INNER\_7](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.INNER\_8](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.INNER\_9](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.INNER\_10](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.INNER\_11](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.INNER\_12](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.INNER\_13](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.INNER\_14](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.INNER\_15](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.INNER\_16](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.INNER\_17](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.INNER\_18](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.INNER\_19](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.INNER\_20](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.INNER\_21](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.INNER\_22](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.INNER\_23](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.INNER\_24](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.INNER\_25](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.INNER\_26](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.INNER\_27](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.INNER\_28](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.INNER\_29](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.INNER\_30](../enums/EPCB_LayerId.md)
references/types/TPCB_LayersOfPad.md
# TPCB\_LayersOfPad type
Layers of the pad
## Signature
```typescript
type TPCB_LayersOfPad = EPCB_LayerId.TOP | EPCB_LayerId.BOTTOM | EPCB_LayerId.MULTI;
```
## References
[EPCB\_LayerId.TOP](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.BOTTOM](../enums/EPCB_LayerId.md)<!-- -->, [EPCB\_LayerId.MULTI](../enums/EPCB_LayerId.md)
references/types/TPCB_LayersOfRegion.md
# TPCB\_LayersOfRegion type
Layers of the region
## Signature
```typescript
type TPCB_LayersOfRegion = TPCB_LayersOfCopper | EPCB_LayerId.MULTI;
```
## References
[TPCB\_LayersOfCopper](./TPCB_LayersOfCopper.md)<!-- -->, [EPCB\_LayerId.MULTI](../enums/EPCB_LayerId.md)
references/types/TPCB_PolygonSourceArray.md
# TPCB\_PolygonSourceArray type
Single polygon source array
## Signature
```typescript
type TPCB_PolygonSourceArray = Array<'L' | 'ARC' | 'CARC' | 'C' | 'R' | 'CIRCLE' | number>;
```
## Remarks
A single polygon is a region described by an unbroken line whose start and end coincide. If the start and end do not coincide, they will be automatically closed.
Example of the data format of a single polygon:
`[300, 200, 'L', 400, 200, 'ARC', 400, 220, 15, 'C', 200, 500, 400, 300, 100, 100]`
`['R', 100, 200, 300, 300, 0, 0]`
`['CIRCLE', 100, 200, 5]`
The data of a single polygon is composed of the following modes:
1. L line mode
`x1 y1 L x2 y3 x3 y3 ...`
- `{number}` `x` - X coordinate of the line point
- `{number}` `y` - Y coordinate of the line point
② ARC/CARC arc mode
`ARC` is two-point arc interaction, and `CARC` is center arc interaction
`startX startY ARC arcAngle endX endY`
`startX startY CARC arcAngle endX endY`
- `{number}` `startX` - Start X
- `{number}` `startY` - Start Y
- `{number}` `arcAngle` - Arc angle (negative values rotate clockwise; in degrees)
- `{number}` `endX` - End X
- `{number}` `endY` - End Y
3. C cubic Bezier mode
`x1 y1 C x2 y2 x3 y3 x4 y4 ...`
- `{number}` `x` - Control point X
- `{number}` `y` - Control point Y
④ R rectangle mode
`R x y width height rot round`
- `{number}` `x` - top-left point X
- `{number}` `y` - top-left point Y
- `{number}` `width` - width
- `{number}` `height` - height
- `{number}` `rotation` - rotation angle
- `{number}` `round` - corner radius
5. CIRCLE mode
`CIRCLE cx cy radius`
- `{number}` `cx` - center point X
- `{number}` `xy` - center point Y
- `{number}` `radius` - radius
- `{number}` `radius` - 半径references/types/TPCB_NumberOfCopperLayers.md
# TPCB\_NumberOfCopperLayers type
铜箔层数
## Signature
```typescript
type TPCB_NumberOfCopperLayers
= 2 | 4 | 6 | 8 | 10 | 12 | 14 | 16 | 18 | 20 | 22 | 24 | 26 | 28 | 30 | 32;
```
references/types/TPCB_PrimitivePadHole.md
# TPCB\_PrimitivePadHole type
Pad drilling
## Signature
```typescript
type TPCB_PrimitivePadHole
= [EPCB_PrimitivePadHoleType.ROUND, number] | [EPCB_PrimitivePadHoleType.SLOT, number, number];
```
## References
[EPCB\_PrimitivePadHoleType.ROUND](../enums/EPCB_PrimitivePadHoleType.md)<!-- -->, [EPCB\_PrimitivePadHoleType.SLOT](../enums/EPCB_PrimitivePadHoleType.md)
## Remarks
Pad drilling currently has the following two [types](../enums/EPCB_PrimitivePadHoleType.md)<!-- -->:
1. Circle
`[EPCB_PrimitivePadHoleType.ROUND, diameter]`
- `{number}` `diameter` - diameter
2. Slot
`[EPCB_PrimitivePadHoleType.SLOT, diameter, length]`
- `{number}` `length` - Length. The length cannot be smaller than the diameter; if it is, the length value follows the diameter
- `{number}` `diameter` - diameterreferences/types/TPCB_PrimitiveDimensionCoordinateSet.md
# TPCB\_PrimitiveDimensionCoordinateSet type
Dimension coordinate set
## Signature
```typescript
type TPCB_PrimitiveDimensionCoordinateSet
= | [number, number, number, number, number, number]
| [number, number, number, number, number, number, number, number];
```
## Remarks
The dimension coordinate set has the following three [dimension types](../enums/EPCB_PrimitiveDimensionType.md)<!-- -->:
1. Radius dimension
`[x1, y1, x2, y2, x3, y3]`
- `{number}` `x1` - X of the endpoint on the circle/arc
- `{number}` `y1` - Y of the endpoint on the circle/arc
- `{number}` `x2` - X of the endpoint at the tail of the dimension line
- `{number}` `y2` - Y of the endpoint at the tail of the dimension line
- `{number}` `x3` - X of the bottom-left endpoint of the dimension text
- `{number}` `y3` - Y of the bottom-left endpoint of the dimension text
2. Length dimension
`[x1, y1, x2, y2, x3, y3, x4, y4]`
- `{number}` `x1` - X of the first measurement endpoint
- `{number}` `y1` - Y of the first measurement endpoint
- `{number}` `x2` - X of the first dimension arrow endpoint
- `{number}` `y2` - Y of the first dimension arrow endpoint
- `{number}` `x3` - X of the second dimension arrow endpoint
- `{number}` `y3` - Y of the second dimension arrow endpoint
- `{number}` `x4` - X of the second measurement endpoint
- `{number}` `y4` - Y of the second measurement endpoint
3. Angle dimension
`[x1, y1, x2, y2, x3, y3]`
- `{number}` `x1` - X of the first side endpoint
- `{number}` `y1` - Y of the first side endpoint
- `{number}` `x2` - X of the angle center
- `{number}` `y2` - Y of the angle center
- `{number}` `x3` - X of the second side endpoint
- `{number}` `y3` - Y of the second side endpointreferences/types/TPCB_PrimitivePadShape.md
# TPCB\_PrimitivePadShape type
Pad shape
## Signature
```typescript
type TPCB_PrimitivePadShape
= | [
(
| EPCB_PrimitivePadShapeType.ELLIPSE
| EPCB_PrimitivePadShapeType.OBLONG
| EPCB_PrimitivePadShapeType.REGULAR_POLYGON
),
number,
number,
]
| [EPCB_PrimitivePadShapeType.RECTANGLE, number, number, number]
| [
EPCB_PrimitivePadShapeType.POLYLINE_COMPLEX_POLYGON,
TPCB_PolygonSourceArray | Array<TPCB_PolygonSourceArray>,
];
```
## References
[EPCB\_PrimitivePadShapeType.ELLIPSE](../enums/EPCB_PrimitivePadShapeType.md)<!-- -->, [EPCB\_PrimitivePadShapeType.OBLONG](../enums/EPCB_PrimitivePadShapeType.md)<!-- -->, [EPCB\_PrimitivePadShapeType.REGULAR\_POLYGON](../enums/EPCB_PrimitivePadShapeType.md)<!-- -->, [EPCB\_PrimitivePadShapeType.RECTANGLE](../enums/EPCB_PrimitivePadShapeType.md)<!-- -->, [EPCB\_PrimitivePadShapeType.POLYLINE\_COMPLEX\_POLYGON](../enums/EPCB_PrimitivePadShapeType.md)<!-- -->, [TPCB\_PolygonSourceArray](./TPCB_PolygonSourceArray.md)
## Remarks
A pad currently has the following four [shape types](../enums/EPCB_PrimitivePadShapeType.md)<!-- -->:
1. Circle
`[EPCB_PrimitivePadShapeType.ELLIPSE, width, height]`
- `{number}` `width` - width
- `{number}` `height` - height
② rectangle
`[EPCB_PrimitivePadShapeType.RECTANGLE, width, height, round]`
- `{number}` `width` - width
- `{number}` `height` - height
- `{number}` `round` - corner radius
3. Regular polygon
`[EPCB_PrimitivePadShapeType.REGULAR_POLYGON, diameter, numberOfSides]`
- `{number}` `diameter` - diameter
- `{number}` `numberOfSides` - Number of sides (<!-- -->> 2)
4. Polyline complex polygon
`[EPCB_PrimitivePadShapeType.POLYLINE_COMPLEX_POLYGON, complexPolygon]`
- `{TPCB_PolygonSourceArray | Array<TPCB_PolygonSourceArray>}` `complexPolygon` - complex polygon source array, you can use [IPCB\_ComplexPolygon.getSource()](../classes/IPCB_ComplexPolygon.md) getreferences/types/TPCB_PrimitiveSpecialPadShape.md
# TPCB\_PrimitiveSpecialPadShape type
Special pad shape
## Signature
```typescript
type TPCB_PrimitiveSpecialPadShape = Array<[number, number, TPCB_PrimitivePadShape]>;
```
## References
[TPCB\_PrimitivePadShape](./TPCB_PrimitivePadShape.md)
## Remarks
`Array<[startLayer, endLayer, TPCB_PrimitivePadShape]>`
- `{number}` `startLayer` - Start layer
- `{number}` `endLayer` - End layerreferences/types/TSYS_LanguageKeyValuePairs.md
# TSYS\_LanguageKeyValuePairs type
语言数据键值对
## Signature
```typescript
type TSYS_LanguageKeyValuePairs = Record<string, string>;
```
## Remarks
单一语言的数据
references/types/TSYS_ComparisonErrorCode.md
# TSYS\_ComparisonErrorCode type
对比失败错误码
## Signature
```typescript
type TSYS_ComparisonErrorCode
= | 'INVALID_PARAM'
| 'SAME_PCB'
| 'SAME_SCH'
| 'PCB_NOT_FOUND'
| 'SCH_NOT_FOUND'
| 'COMPARISON_FAILED';
```
references/types/TSYS_ShortcutKeys.md
# TSYS\_ShortcutKeys type
Shortcut key
## Signature
```typescript
type TSYS_ShortcutKeys = Array<
| 'SHIFT'
| 'LEFT_SHIFT'
| 'RIGHT_SHIFT'
| 'FN'
| 'ALT'
| 'LEFT_ALT'
| 'RIGHT_ALT'
| 'CONTROL'
| 'LEFT_CONTROL'
| 'RIGHT_CONTROL'
| 'COMMAND'
| 'WIN'
| 'OPTION'
| 'SUPER'
| 'TAB'
| 'SPACE'
| 'UP'
| 'DOWN'
| 'LEFT'
| 'RIGHT'
| 'F1'
| 'F2'
| 'F3'
| 'F4'
| 'F5'
| 'F6'
| 'F7'
| 'F8'
| 'F9'
| 'F10'
| 'F11'
| 'F12'
| 'F13'
| 'F14'
| 'F15'
| 'F16'
| 'F17'
| 'F18'
| 'F19'
| 'F20'
| '`'
| '1'
| '2'
| '3'
| '4'
| '5'
| '6'
| '7'
| '8'
| '9'
| '0'
| '-'
| '='
| 'Q'
| 'W'
| 'E'
| 'R'
| 'T'
| 'Y'
| 'U'
| 'I'
| 'O'
| 'P'
| '['
| ']'
| 'A'
| 'S'
| 'D'
| 'F'
| 'G'
| 'H'
| 'J'
| 'K'
| 'L'
| ';'
| '\''
| '\\'
| 'Z'
| 'X'
| 'C'
| 'V'
| 'B'
| 'N'
| 'M'
| ','
| '.'
| '/'
>;
```
scripts/bridge-server.mjs
/**
* EasyEDA WebSocket Bridge Server
*
* 这是一个 Node.js WebSocket 服务端,用于桥接 AI 编程工具和 EasyEDA Pro 客户端。
* 支持所有兼容 Agent Skills 标准的工具(Claude Code、OpenCode、QwenCode 等)。
*
* 架构:
* ┌──────────────┐ HTTP/WS ┌────────────────┐ WebSocket ┌──────────┐
* │ AI Agent │ ◄───────────► │ Bridge Server │ ◄───────────► │ EasyEDA │
* │ (Skill Tool) │ Port Range │ (This Server) │ Port Range │ (Client) │
* └──────────────┘ 49620-49629 └────────────────┘ 49620-49629 └──────────┘
*
* 端口范围 49620-49629,启动时自动检测可用端口。
* EasyEDA 扩展通过 eda.sys_WebSocket.register() 连接到此服务。
* AI 通过 HTTP API 或直接 WebSocket 发送代码执行请求。
*
* 握手验证协议:
* - GET /health 返回 { service: "easyeda-bridge", ... }
* - WebSocket 连接后服务端发送 { type: "handshake", service: "easyeda-bridge" }
* - 客户端需验证 service 字段匹配后才确认连接有效
*
* 协议格式(JSON):
* {
* "type": "execute" | "result" | "error" | "ping" | "pong" | "handshake",
* "id": "<request-uuid>",
* "code": "<js code string>", // execute 时
* "result": <any>, // result 时
* "error": "<error message>", // error 时
* "timestamp": <unix ms>
* }
*/
import { WebSocketServer } from 'ws';
import { randomUUID } from 'node:crypto';
import { createServer, get as httpGet } from 'node:http';
import { createConnection } from 'node:net';
// ─── Port Configuration ─────────────────────────────────────────────
const PORT_START = 49620;
const PORT_END = 49629;
const SERVICE_ID = 'easyeda-bridge';
const LISTEN_HOST = '127.0.0.1';
function formatBannerLine(label, value) {
return `║ ${`${label}:`.padEnd(12)} ${String(value).padEnd(44)}║`;
}
// ─── State ──────────────────────────────────────────────────────────
/** @type {Map<string, import('ws').WebSocket>} EDA window ID -> WebSocket */
const edaClients = new Map();
/** @type {Map<string, {resolve: Function, reject: Function, timer: NodeJS.Timeout}>} */
const pendingRequests = new Map();
/** @type {string | null} 当前AI端选中的EDA窗口ID */
let activeEdaWindowId = null;
const REQUEST_TIMEOUT_MS = 30_000;
// ─── Port Detection ─────────────────────────────────────────────────
/**
* Check if a TCP port is already in use.
* @param {number} port
* @returns {Promise<boolean>} true if port is in use
*/
function isPortInUse(port) {
return new Promise((resolve) => {
const socket = createConnection({ port, host: '127.0.0.1' });
socket.setTimeout(300);
socket.on('connect', () => {
socket.destroy();
resolve(true);
});
socket.on('timeout', () => {
socket.destroy();
resolve(false);
});
socket.on('error', () => {
socket.destroy();
resolve(false);
});
});
}
/**
* Check if a port is already running our bridge service.
* Sends HTTP GET /health and verifies { service: "easyeda-bridge" }.
* @param {number} port
* @returns {Promise<boolean>}
*/
function isBridgeRunning(port) {
return new Promise((resolve) => {
const req = httpGet(`http://127.0.0.1:${port}/health`, { timeout: 800 }, (res) => {
let data = '';
res.on('data', (chunk) => (data += chunk));
res.on('end', () => {
try {
const json = JSON.parse(data);
resolve(json.service === SERVICE_ID);
} catch {
resolve(false);
}
});
});
req.on('error', () => resolve(false));
req.on('timeout', () => { req.destroy(); resolve(false); });
});
}
/**
* Detect if an existing bridge instance is already running in the port range.
* @returns {Promise<number|null>} The port of the existing instance, or null
*/
async function findExistingInstance() {
for (let port = PORT_START; port <= PORT_END; port++) {
if (await isBridgeRunning(port)) return port;
}
return null;
}
/**
* Find the first available port in range.
* @returns {Promise<number>}
*/
async function findAvailablePort() {
for (let port = PORT_START; port <= PORT_END; port++) {
const inUse = await isPortInUse(port);
if (!inUse) return port;
}
throw new Error(`All ports in range ${PORT_START}-${PORT_END} are in use`);
}
// ─── HTTP Server (for AI to submit code via HTTP POST) ─────────────
const httpServer = createServer(async (req, res) => {
// CORS
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Methods', 'POST, GET, OPTIONS');
res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
if (req.method === 'OPTIONS') {
res.writeHead(204);
res.end();
return;
}
// Health check — includes service identifier for client handshake verification
if (req.method === 'GET' && req.url === '/health') {
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({
service: SERVICE_ID,
status: 'ok',
edaConnected: edaClients.size > 0,
edaWindowCount: edaClients.size,
activeWindowId: activeEdaWindowId,
pendingRequests: pendingRequests.size,
timestamp: Date.now(),
}));
return;
}
// List all connected EDA windows
if (req.method === 'GET' && req.url === '/eda-windows') {
res.writeHead(200, { 'Content-Type': 'application/json' });
const windows = [];
for (const [windowId, ws] of edaClients) {
windows.push({
windowId,
connected: ws.readyState === 1,
active: windowId === activeEdaWindowId,
});
}
res.end(JSON.stringify({
windows,
activeWindowId: activeEdaWindowId,
count: edaClients.size,
}));
return;
}
// Set active EDA window
if (req.method === 'POST' && req.url === '/eda-windows/select') {
let body = '';
for await (const chunk of req) body += chunk;
try {
const payload = JSON.parse(body);
const { windowId } = payload;
if (!edaClients.has(windowId)) {
res.writeHead(404, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({ error: `EDA window "${windowId}" not found` }));
return;
}
activeEdaWindowId = windowId;
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({ success: true, activeWindowId }));
}
catch {
res.writeHead(400, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({ error: 'Invalid request body' }));
}
return;
}
// Execute code on EDA
if (req.method === 'POST' && req.url === '/execute') {
let body = '';
for await (const chunk of req) body += chunk;
try {
const payload = JSON.parse(body);
const code = payload.code;
const windowId = payload.windowId; // optional, uses active window if not specified
if (!code || typeof code !== 'string') {
res.writeHead(400, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({ error: 'Missing "code" field (string)' }));
return;
}
const result = await executeOnEda(code, windowId);
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({ success: true, result, windowId: windowId || activeEdaWindowId }));
} catch (err) {
const status = err.message?.includes('not connected') ? 503 : 500;
res.writeHead(status, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({ success: false, error: err.message }));
}
return;
}
res.writeHead(404, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({ error: 'Not found' }));
});
// ─── WebSocket Server ───────────────────────────────────────────────
const wss = new WebSocketServer({ server: httpServer });
wss.on('connection', (ws, req) => {
const clientType = req.url === '/eda' ? 'eda' : 'agent';
console.log(`[WS] New ${clientType} connection from ${req.socket.remoteAddress}`);
// Send handshake message for client verification
ws.send(JSON.stringify({
type: 'handshake',
service: SERVICE_ID,
clientType,
timestamp: Date.now(),
}));
if (clientType === 'eda') {
let registeredWindowId = null;
ws.on('message', (raw) => {
try {
const msg = JSON.parse(raw.toString());
if (msg.type === 'register' && msg.windowId) {
// EDA client registering with window ID
registeredWindowId = msg.windowId;
edaClients.set(registeredWindowId, ws);
// Auto-select if first window or if no active window
if (edaClients.size === 1 || !activeEdaWindowId) {
activeEdaWindowId = registeredWindowId;
}
console.log(`[WS] EDA window registered: ${registeredWindowId}, total: ${edaClients.size}`);
return;
}
// Always pass a valid windowId (use registeredWindowId if available, otherwise log warning)
const effectiveWindowId = registeredWindowId || 'unregistered';
handleEdaMessage(msg, effectiveWindowId);
} catch (err) {
console.error('[WS] Failed to parse EDA message:', err.message);
}
});
ws.on('close', (code, reason) => {
console.log(`[WS] EDA window disconnected: ${registeredWindowId} (${code} ${reason})`);
if (registeredWindowId) {
edaClients.delete(registeredWindowId);
if (activeEdaWindowId === registeredWindowId) {
// Select another window if available
activeEdaWindowId = edaClients.keys().next().value || null;
}
// Reject pending requests for this window
for (const [id, req] of pendingRequests) {
if (req.windowId === registeredWindowId) {
clearTimeout(req.timer);
req.reject(new Error(`EDA window "${registeredWindowId}" disconnected`));
pendingRequests.delete(id);
}
}
}
});
ws.on('error', (err) => {
console.error('[WS] EDA client error:', err.message);
});
} else {
// Agent / AI client connection
ws.on('message', async (raw) => {
try {
const msg = JSON.parse(raw.toString());
if (msg.type === 'execute') {
try {
const result = await executeOnEda(msg.code, msg.windowId);
ws.send(JSON.stringify({
type: 'result',
id: msg.id,
result,
timestamp: Date.now(),
}));
} catch (err) {
ws.send(JSON.stringify({
type: 'error',
id: msg.id,
error: err.message,
timestamp: Date.now(),
}));
}
} else if (msg.type === 'ping') {
ws.send(JSON.stringify({ type: 'pong', id: msg.id, timestamp: Date.now() }));
}
} catch (err) {
console.error('[WS] Failed to parse agent message:', err.message);
}
});
ws.on('close', () => {
console.log('[WS] Agent client disconnected');
});
}
});
// ─── Core logic ─────────────────────────────────────────────────────
/**
* Send a message to the connected EDA client
* @param {string} windowId - Target EDA window ID
* @param {object} msg - Message to send
*/
function sendToEda(windowId, msg) {
const edaClient = edaClients.get(windowId);
if (!edaClient) {
throw new Error(`EDA window "${windowId}" not found in connected clients`);
}
if (edaClient.readyState !== 1) {
throw new Error(`EDA window "${windowId}" is not in connected state (readyState: ${edaClient.readyState})`);
}
try {
edaClient.send(JSON.stringify(msg));
} catch (err) {
throw new Error(`Failed to send to EDA window "${windowId}": ${err.message}`);
}
}
/**
* Execute JavaScript code on the EDA client and return the result
* @param {string} code - JavaScript code to execute in EDA context
* @param {string} [windowId] - Specific EDA window ID (uses active window if not specified)
* @returns {Promise<any>}
*/
function executeOnEda(code, windowId) {
return new Promise((resolve, reject) => {
const targetWindowId = windowId || activeEdaWindowId;
if (!targetWindowId) {
reject(new Error('No EDA window connected. Please connect an EDA window first.'));
return;
}
if (!edaClients.has(targetWindowId) || edaClients.get(targetWindowId).readyState !== 1) {
reject(new Error(`EDA window "${targetWindowId}" is no longer connected. Please select another window.`));
return;
}
const id = randomUUID();
const timer = setTimeout(() => {
pendingRequests.delete(id);
reject(new Error(`Request ${id} timed out after ${REQUEST_TIMEOUT_MS}ms`));
}, REQUEST_TIMEOUT_MS);
pendingRequests.set(id, { resolve, reject, timer, windowId: targetWindowId });
try {
sendToEda(targetWindowId, {
type: 'execute',
id,
code,
windowId: targetWindowId,
timestamp: Date.now(),
});
} catch (err) {
clearTimeout(timer);
pendingRequests.delete(id);
reject(err);
}
});
}
/**
* Handle messages received from EDA client
* @param {object} msg - Message from EDA
* @param {string} windowId - EDA window ID that sent the message
*/
function handleEdaMessage(msg, windowId) {
if (msg.type === 'ping') {
console.log(`[WS] Ping received from ${windowId}, sending pong`);
const edaClient = edaClients.get(windowId);
if (edaClient && edaClient.readyState === 1) {
try {
edaClient.send(JSON.stringify({
type: 'pong',
id: msg.id,
timestamp: Date.now(),
}));
} catch (err) {
console.error(`[WS] Failed to send pong to ${windowId}:`, err.message);
}
} else {
console.warn(`[WS] Cannot send pong: window ${windowId} not found or disconnected`);
}
return;
}
if (msg.type === 'pong') {
console.log('[EDA] Pong received from window', windowId, '- connection healthy');
return;
}
if (msg.type === 'result' || msg.type === 'error') {
const pending = pendingRequests.get(msg.id);
if (pending) {
clearTimeout(pending.timer);
pendingRequests.delete(msg.id);
if (msg.type === 'result') {
pending.resolve(msg.result);
} else {
pending.reject(new Error(msg.error || 'Unknown EDA error'));
}
}
return;
}
console.log('[EDA] Unknown message type:', msg.type, 'from window:', windowId);
}
// ─── Start ──────────────────────────────────────────────────────────
async function start() {
try {
// ── Singleton check: exit if an identical bridge is already running ──
const existingPort = await findExistingInstance();
if (existingPort) {
console.log(`✅ Bridge server is already running on port ${existingPort}, no need to start another instance.`);
process.exit(0);
}
const port = await findAvailablePort();
httpServer.listen(port, LISTEN_HOST, () => {
console.log(`
╔══════════════════════════════════════════════════════════════╗
║ EasyEDA WebSocket Bridge Server ║
╠══════════════════════════════════════════════════════════════╣
║ ║
${formatBannerLine('Port', port)}
${formatBannerLine('Listen Host', `${LISTEN_HOST} (localhost only)`)}
${formatBannerLine('Port Range', `${PORT_START}-${PORT_END}`)}
${formatBannerLine('Service ID', SERVICE_ID)}
║ ║
║ HTTP API: http://localhost:${port} ║
║ WS (EDA): ws://localhost:${port}/eda ║
║ WS (Agent): ws://localhost:${port}/agent ║
║ ║
║ Endpoints: ║
║ GET /health - 健康检查 & EDA 连接状态 ║
║ POST /execute - 执行代码 {"code": "..."} ║
║ ║
║ Handshake: ║
║ /health returns { service: "${SERVICE_ID}" } ║
║ WS sends { type: "handshake", service: "..." } ║
║ ║
╚══════════════════════════════════════════════════════════════╝
`);
});
httpServer.on('error', (err) => {
if (err.code === 'EADDRINUSE') {
console.error(`❌ Port ${port} became occupied. Restarting...`);
httpServer.close();
start(); // Retry
} else {
throw err;
}
});
} catch (err) {
console.error(`❌ ${err.message}`);
process.exit(1);
}
}
start();
references/types/TSYS_MathPolygonInput.md
# TSYS\_MathPolygonInput type
Polygon input type
## Signature
```typescript
type TSYS_MathPolygonInput
= | Array<ISYS_MathPoint>
| TPCB_PolygonSourceArray
| IPCB_Polygon
| IPCB_ComplexPolygon
| TSYS_MathPolygonGroup;
```
## References
[ISYS\_MathPoint](../interfaces/ISYS_MathPoint.md)<!-- -->, [TPCB\_PolygonSourceArray](./TPCB_PolygonSourceArray.md)<!-- -->, [IPCB\_Polygon](../classes/IPCB_Polygon.md)<!-- -->, [IPCB\_ComplexPolygon](../classes/IPCB_ComplexPolygon.md)<!-- -->, [TSYS\_MathPolygonGroup](./TSYS_MathPolygonGroup.md)
## Remarks
The following input formats are supported: - Discrete point array: `[{x, y}, {x, y}, ...]` - Single polygon source array: [TPCB\_PolygonSourceArray](./TPCB_PolygonSourceArray.md) - Single polygon object: [IPCB\_Polygon](../classes/IPCB_Polygon.md) - Complex polygon object: [IPCB\_ComplexPolygon](../classes/IPCB_ComplexPolygon.md) - Polygon group: [TSYS\_MathPolygonGroup](./TSYS_MathPolygonGroup.md)references/types/TSYS_MathPolygonGroup.md
# TSYS\_MathPolygonGroup type
Polygon group
## Signature
```typescript
type TSYS_MathPolygonGroup = Array<ISYS_MathPolygonWithHoles>;
```
## References
[ISYS\_MathPolygonWithHoles](../interfaces/ISYS_MathPolygonWithHoles.md)
## Remarks
The return type of Boolean operations, composed of multiple polygons with holes, preserving the association between outer rings and holes
user-guide/using-extension.md
# Getting and Using Extensions
## Getting Extensions
EasyEDA Pro now provides the official [Extensions Marketplace](https://jlcext.com), where you can conveniently obtain a wide range of EasyEDA Pro extensions provided by both official and third-party developers.

## Installing Extensions
### V3 Installation
1. Open the [EasyEDA Pro Editor](https://pro.easyeda.com/editor).
2. In the top menu, click **Advanced** -\> **Extension Manager**:

3. While online, you can search for extensions and install them directly. If you already have an extension file, you can also click **Import** to import it:

4. Switch to the **Installed** list and click an installed extension to configure its enabled state and permissions. If **Show in top menu** is not checked, the extension entry will appear under the **Advanced** menu by default:

### V2 Installation
1. Open the [EasyEDA Pro Editor](https://pro.easyeda.com/editor).
2. In the top menu bar, click **Settings** -\> **Extensions** -\> **Extension Manager...** in sequence:

3. In the pop-up window, click **Import Extension**, then select the downloaded `.eext` file to complete the import.

4. Extension settings
- Installed extensions can be enabled or disabled. The registered menu of an enabled extension will be displayed in the top menu bar:

- Some extensions involve external interactions, such as network access. You need to enable the extension's **External Interactions** permission to ensure proper operation:
