@atlisp/mcp 1.8.16 → 1.8.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/atlisp-mcp.js +7 -7
- package/dist/handlers/3d-handlers.js +128 -0
- package/dist/handlers/batch-handlers.js +260 -0
- package/dist/handlers/block-handlers.js +214 -0
- package/dist/handlers/cad-handlers.js +180 -0
- package/dist/handlers/constraint-handlers.js +130 -0
- package/dist/handlers/dim-hatch-handlers.js +340 -0
- package/dist/handlers/draw-handlers.js +175 -0
- package/dist/handlers/edit-handlers.js +179 -0
- package/dist/handlers/entity-handlers.js +196 -0
- package/dist/handlers/external-handlers.js +218 -0
- package/dist/handlers/file-handlers.js +172 -0
- package/dist/handlers/function-handlers.js +158 -0
- package/dist/handlers/layer-handlers.js +181 -0
- package/dist/handlers/package-handlers.js +89 -0
- package/dist/handlers/parametric-handlers.js +272 -0
- package/dist/handlers/pdf-annotation-handlers.js +117 -0
- package/dist/handlers/prompt-handlers.js +9 -0
- package/dist/handlers/purge-handlers.js +137 -0
- package/dist/handlers/query-print-handlers.js +662 -0
- package/dist/handlers/resource-cache.js +63 -0
- package/dist/handlers/resource-defs.js +79 -0
- package/dist/handlers/resource-handlers.js +131 -0
- package/dist/handlers/resource-readers.js +1045 -0
- package/dist/handlers/sheetset-handlers.js +430 -0
- package/dist/handlers/spatial-handlers.js +174 -0
- package/dist/handlers/style-handlers.js +162 -0
- package/dist/handlers/text-handlers.js +198 -0
- package/dist/handlers/ucs-layout-handlers.js +271 -0
- package/dist/handlers/viewport-handlers.js +150 -0
- package/dist/handlers/xdata-handlers.js +148 -0
- package/dist/handlers/xref-handlers.js +334 -0
- package/dist/lisp-security.js +7 -2
- package/package.json +2 -2
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { cad } from '../cad.js';
|
|
2
|
+
import { escapeLispString } from '../handler-utils.js';
|
|
3
|
+
|
|
4
|
+
export async function purgeAll(params) {
|
|
5
|
+
if (!cad.connected) { await cad.connect(); }
|
|
6
|
+
if (!cad.connected) return { content: [{ type: 'text', text: '未连接 CAD' }], isError: true };
|
|
7
|
+
try {
|
|
8
|
+
const code = `(progn (command "_.PURGE" "A" "" "N") "OK")`;
|
|
9
|
+
const result = await cad.sendCommandWithResult(code);
|
|
10
|
+
if (result === 'OK' || result === '"OK"') {
|
|
11
|
+
return { content: [{ type: 'text', text: '已清理所有未使用项' }] };
|
|
12
|
+
}
|
|
13
|
+
return { content: [{ type: 'text', text: `清理失败: ${result}` }], isError: true };
|
|
14
|
+
} catch (e) {
|
|
15
|
+
return { content: [{ type: 'text', text: `错误: ${e.message}` }], isError: true };
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export async function purgeBlocks(params) {
|
|
20
|
+
if (!cad.connected) { await cad.connect(); }
|
|
21
|
+
if (!cad.connected) return { content: [{ type: 'text', text: '未连接 CAD' }], isError: true };
|
|
22
|
+
try {
|
|
23
|
+
const pattern = params.namePattern || '*';
|
|
24
|
+
const code = `(progn (command "_.PURGE" "B" "${escapeLispString(pattern)}" "N") "OK")`;
|
|
25
|
+
const result = await cad.sendCommandWithResult(code);
|
|
26
|
+
if (result === 'OK' || result === '"OK"') {
|
|
27
|
+
return { content: [{ type: 'text', text: `已清理未使用的块: ${pattern}` }] };
|
|
28
|
+
}
|
|
29
|
+
return { content: [{ type: 'text', text: `清理失败: ${result}` }], isError: true };
|
|
30
|
+
} catch (e) {
|
|
31
|
+
return { content: [{ type: 'text', text: `错误: ${e.message}` }], isError: true };
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export async function purgeLayers(params) {
|
|
36
|
+
if (!cad.connected) { await cad.connect(); }
|
|
37
|
+
if (!cad.connected) return { content: [{ type: 'text', text: '未连接 CAD' }], isError: true };
|
|
38
|
+
try {
|
|
39
|
+
const pattern = params.namePattern || '*';
|
|
40
|
+
const code = `(progn (command "_.PURGE" "LA" "${escapeLispString(pattern)}" "N") "OK")`;
|
|
41
|
+
const result = await cad.sendCommandWithResult(code);
|
|
42
|
+
if (result === 'OK' || result === '"OK"') {
|
|
43
|
+
return { content: [{ type: 'text', text: `已清理未使用的图层: ${pattern}` }] };
|
|
44
|
+
}
|
|
45
|
+
return { content: [{ type: 'text', text: `清理失败: ${result}` }], isError: true };
|
|
46
|
+
} catch (e) {
|
|
47
|
+
return { content: [{ type: 'text', text: `错误: ${e.message}` }], isError: true };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export async function purgeStyles(params) {
|
|
52
|
+
if (!cad.connected) { await cad.connect(); }
|
|
53
|
+
if (!cad.connected) return { content: [{ type: 'text', text: '未连接 CAD' }], isError: true };
|
|
54
|
+
try {
|
|
55
|
+
const pattern = params.namePattern || '*';
|
|
56
|
+
const code = `(progn (command "_.PURGE" "ST" "${escapeLispString(pattern)}" "N") "OK")`;
|
|
57
|
+
const result = await cad.sendCommandWithResult(code);
|
|
58
|
+
if (result === 'OK' || result === '"OK"') {
|
|
59
|
+
return { content: [{ type: 'text', text: `已清理未使用的样式: ${pattern}` }] };
|
|
60
|
+
}
|
|
61
|
+
return { content: [{ type: 'text', text: `清理失败: ${result}` }], isError: true };
|
|
62
|
+
} catch (e) {
|
|
63
|
+
return { content: [{ type: 'text', text: `错误: ${e.message}` }], isError: true };
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export async function purgeRegisteredApps(params) {
|
|
68
|
+
if (!cad.connected) { await cad.connect(); }
|
|
69
|
+
if (!cad.connected) return { content: [{ type: 'text', text: '未连接 CAD' }], isError: true };
|
|
70
|
+
try {
|
|
71
|
+
const pattern = params.namePattern || '*';
|
|
72
|
+
const code = `(progn (command "_.PURGE" "R" "${escapeLispString(pattern)}" "N") "OK")`;
|
|
73
|
+
const result = await cad.sendCommandWithResult(code);
|
|
74
|
+
if (result === 'OK' || result === '"OK"') {
|
|
75
|
+
return { content: [{ type: 'text', text: `已清理未注册的应用程序: ${pattern}` }] };
|
|
76
|
+
}
|
|
77
|
+
return { content: [{ type: 'text', text: `清理失败: ${result}` }], isError: true };
|
|
78
|
+
} catch (e) {
|
|
79
|
+
return { content: [{ type: 'text', text: `错误: ${e.message}` }], isError: true };
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export async function drawingAudit(params) {
|
|
84
|
+
if (!cad.connected) { await cad.connect(); }
|
|
85
|
+
if (!cad.connected) return { content: [{ type: 'text', text: '未连接 CAD' }], isError: true };
|
|
86
|
+
try {
|
|
87
|
+
const code = `(progn (command "_.AUDIT" "Y") "OK")`;
|
|
88
|
+
const result = await cad.sendCommandWithResult(code);
|
|
89
|
+
if (result === 'OK' || result === '"OK"') {
|
|
90
|
+
return { content: [{ type: 'text', text: '图形审计完成,已修复所有错误' }] };
|
|
91
|
+
}
|
|
92
|
+
return { content: [{ type: 'text', text: `审计失败: ${result}` }], isError: true };
|
|
93
|
+
} catch (e) {
|
|
94
|
+
return { content: [{ type: 'text', text: `错误: ${e.message}` }], isError: true };
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export async function drawingRecover(params) {
|
|
99
|
+
if (!cad.connected) { await cad.connect(); }
|
|
100
|
+
if (!cad.connected) return { content: [{ type: 'text', text: '未连接 CAD' }], isError: true };
|
|
101
|
+
try {
|
|
102
|
+
const code = `(progn (command "_.RECOVER" "${escapeLispString(params.filePath)}") "OK")`;
|
|
103
|
+
const result = await cad.sendCommandWithResult(code);
|
|
104
|
+
if (result === 'OK' || result === '"OK"') {
|
|
105
|
+
return { content: [{ type: 'text', text: `已恢复文件: ${params.filePath}` }] };
|
|
106
|
+
}
|
|
107
|
+
return { content: [{ type: 'text', text: `恢复失败: ${result}` }], isError: true };
|
|
108
|
+
} catch (e) {
|
|
109
|
+
return { content: [{ type: 'text', text: `错误: ${e.message}` }], isError: true };
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export async function overkill(params) {
|
|
114
|
+
if (!cad.connected) { await cad.connect(); }
|
|
115
|
+
if (!cad.connected) return { content: [{ type: 'text', text: '未连接 CAD' }], isError: true };
|
|
116
|
+
try {
|
|
117
|
+
const handleList = params.handles
|
|
118
|
+
.map(h => `(setq ss (ssadd (handent "${escapeLispString(h)}") ss))`)
|
|
119
|
+
.join('\n');
|
|
120
|
+
const code = `(progn
|
|
121
|
+
(vl-load-com)
|
|
122
|
+
(setq ss (ssadd))
|
|
123
|
+
${handleList}
|
|
124
|
+
(if (> (sslength ss) 0)
|
|
125
|
+
(progn (command "_.OVERKILL" ss "" "") "OK")
|
|
126
|
+
"NO_ENTITIES"
|
|
127
|
+
)
|
|
128
|
+
)`;
|
|
129
|
+
const result = await cad.sendCommandWithResult(code);
|
|
130
|
+
if (result === 'OK' || result === '"OK"') {
|
|
131
|
+
return { content: [{ type: 'text', text: `已删除 ${params.handles.length} 个实体中的重复几何图形` }] };
|
|
132
|
+
}
|
|
133
|
+
return { content: [{ type: 'text', text: `删除重复实体失败: ${result}` }], isError: true };
|
|
134
|
+
} catch (e) {
|
|
135
|
+
return { content: [{ type: 'text', text: `错误: ${e.message}` }], isError: true };
|
|
136
|
+
}
|
|
137
|
+
}
|