@atlisp/mcp 1.6.7 → 1.6.8
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 +15 -38
- package/package.json +1 -1
package/dist/atlisp-mcp.js
CHANGED
|
@@ -864,33 +864,6 @@ function lispPairsToObject(pairs) {
|
|
|
864
864
|
}
|
|
865
865
|
return obj;
|
|
866
866
|
}
|
|
867
|
-
function parseEntity(arr) {
|
|
868
|
-
if (!Array.isArray(arr) || arr.length < 5)
|
|
869
|
-
return null;
|
|
870
|
-
const [type, handle, layer, color, linetype, ...rest] = arr;
|
|
871
|
-
const entity = {
|
|
872
|
-
type: String(type).toUpperCase().replace(/^"|"$/g, ""),
|
|
873
|
-
handle: String(handle),
|
|
874
|
-
layer: String(layer),
|
|
875
|
-
color,
|
|
876
|
-
linetype: String(linetype)
|
|
877
|
-
};
|
|
878
|
-
const entType = typeof entity.type === "string" ? entity.type.toUpperCase() : entity.type;
|
|
879
|
-
if (/^(TEXT|MTEXT|ATTRIB|TCH_TEXT)$/.test(entType) && rest[0] != null) {
|
|
880
|
-
entity.text = String(rest[0]);
|
|
881
|
-
}
|
|
882
|
-
if (/^(LINE|LWPOLYLINE|POLYLINE|ARC|CIRCLE|SPLINE|ELLIPSE|XLINE|RAY)$/.test(entType) && Array.isArray(rest[0])) {
|
|
883
|
-
entity.points = rest[0].map((pt) => {
|
|
884
|
-
if (Array.isArray(pt) && pt.length >= 2)
|
|
885
|
-
return { x: Number(pt[0]), y: Number(pt[1]), z: Number(pt[2] || 0) };
|
|
886
|
-
return null;
|
|
887
|
-
}).filter(Boolean);
|
|
888
|
-
}
|
|
889
|
-
if (entType === "INSERT" && rest[0] != null) {
|
|
890
|
-
entity.blockName = String(rest[0]);
|
|
891
|
-
}
|
|
892
|
-
return entity;
|
|
893
|
-
}
|
|
894
867
|
function propertyPairsToObject(pairs) {
|
|
895
868
|
if (!Array.isArray(pairs))
|
|
896
869
|
return null;
|
|
@@ -950,15 +923,19 @@ function buildTextCode({ layer, bbox, offset, limit }) {
|
|
|
950
923
|
}
|
|
951
924
|
const filterExpr = `(list ${items.join(" ")})`;
|
|
952
925
|
return `(progn
|
|
953
|
-
(defun @t:props (ent / ed
|
|
954
|
-
(setq ed (entget ent)
|
|
955
|
-
(
|
|
956
|
-
(
|
|
957
|
-
(vl-prin1-to-string (
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
(
|
|
961
|
-
(vl-prin1-to-string (
|
|
926
|
+
(defun @t:props (ent / ed ins)
|
|
927
|
+
(setq ed (entget ent) ins (cdr (assoc 10 ed)))
|
|
928
|
+
(list
|
|
929
|
+
(list "type" (vl-prin1-to-string (cdr (assoc 0 ed))))
|
|
930
|
+
(list "handle" (vl-prin1-to-string (cdr (assoc 5 ed))))
|
|
931
|
+
(list "layer" (vl-prin1-to-string (cdr (assoc 8 ed))))
|
|
932
|
+
(list "color" (if (assoc 62 ed) (cdr (assoc 62 ed)) 256))
|
|
933
|
+
(list "linetype" (vl-prin1-to-string (if (assoc 6 ed) (cdr (assoc 6 ed)) "ByLayer")))
|
|
934
|
+
(list "text" (vl-prin1-to-string (cdr (assoc 1 ed))))
|
|
935
|
+
(list "insert" (list (car ins) (cadr ins) (caddr ins)))
|
|
936
|
+
(list "height" (cdr (assoc 40 ed)))
|
|
937
|
+
(list "rotation" (cdr (assoc 50 ed)))
|
|
938
|
+
(list "style" (vl-prin1-to-string (if (assoc 7 ed) (cdr (assoc 7 ed)) "Standard")))))
|
|
962
939
|
(defun @t:run nil
|
|
963
940
|
(setq ss (ssget "_X" ${filterExpr}))
|
|
964
941
|
(if (null ss)
|
|
@@ -975,7 +952,7 @@ var RESOURCES = [
|
|
|
975
952
|
{ uri: "atlisp://cad/info", name: "CAD Info", description: "CAD \u8FDE\u63A5\u4FE1\u606F", mimeType: "application/json", subscribable: true },
|
|
976
953
|
{ uri: "atlisp://dwg/layers", name: "Layers", description: "\u56FE\u5C42\u5217\u8868", mimeType: "application/json", subscribable: true },
|
|
977
954
|
{ uri: "atlisp://dwg/entities", name: "Entities", description: "\u56FE\u5143\u5217\u8868\u3002\u65E0\u53C2\u6570\u65F6\u8FD4\u56DE\u603B\u6570\u548C\u6309\u7C7B\u578B\u7EDF\u8BA1\uFF1B\u6709\u53C2\u6570\u65F6\u8FD4\u56DE filtered \u56FE\u6587\u7684 entity:properties \u5168\u5C5E\u6027 JSON\uFF08ObjectName, Handle, Layer, Color, Center, Radius \u7B49\uFF09\uFF0C\u652F\u6301 ?type=LINE&layer=0&bbox=0,0,100,100", mimeType: "application/json", subscribable: true },
|
|
978
|
-
{ uri: "atlisp://dwg/texts", name: "Texts", description: "\u6587\u672C\u5B9E\u4F53\
|
|
955
|
+
{ uri: "atlisp://dwg/texts", name: "Texts", description: "\u6587\u672C\u5B9E\u4F53 key:value \u5217\u8868 (TEXT/MTEXT/ATTRIB/TCH_TEXT)\uFF0C\u652F\u6301 ?layer=0&bbox=0,0,100,100&limit=5000&offset=0", mimeType: "application/json", subscribable: true },
|
|
979
956
|
{ uri: "atlisp://dwg/name", name: "DWG Name", description: "\u5F53\u524D DWG \u6587\u4EF6\u540D", mimeType: "application/json", subscribable: true },
|
|
980
957
|
{ uri: "atlisp://dwg/path", name: "DWG Path", description: "\u6587\u4EF6\u5B8C\u6574\u8DEF\u5F84", mimeType: "application/json", subscribable: true },
|
|
981
958
|
{ uri: "atlisp://cad/dwgs", name: "DWG List", description: "\u6240\u6709\u6253\u5F00\u7684 DWG \u6587\u4EF6\u5217\u8868", mimeType: "application/json", subscribable: true },
|
|
@@ -1297,7 +1274,7 @@ async function getTexts(params = {}) {
|
|
|
1297
1274
|
const textsIdx = parsed.indexOf("texts");
|
|
1298
1275
|
const rawTexts = textsIdx !== -1 && Array.isArray(parsed[textsIdx + 1]) ? parsed[textsIdx + 1] : [];
|
|
1299
1276
|
const data = lispPairsToObject(parsed);
|
|
1300
|
-
data.texts = rawTexts.length > 0 ? rawTexts.map(
|
|
1277
|
+
data.texts = rawTexts.length > 0 ? rawTexts.map(propertyPairsToObject).filter(Boolean) : [];
|
|
1301
1278
|
data.offset = offset;
|
|
1302
1279
|
data.limit = limit;
|
|
1303
1280
|
setCache(cacheKey, data);
|