@atlisp/mcp 1.8.2 → 1.8.3
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 +29 -38
- package/package.json +1 -1
package/dist/atlisp-mcp.js
CHANGED
|
@@ -1554,51 +1554,30 @@ function buildBlockRefsCode(filterBlockName) {
|
|
|
1554
1554
|
return `(progn
|
|
1555
1555
|
(vl-load-com)
|
|
1556
1556
|
|
|
1557
|
-
(defun @br:try (
|
|
1558
|
-
(
|
|
1559
|
-
(setq r (vl-catch-all-apply
|
|
1560
|
-
(function (lambda () (vlax-get obj prop))))))
|
|
1561
|
-
nil
|
|
1562
|
-
r))
|
|
1563
|
-
|
|
1564
|
-
(defun @br:get-attrs (ent / att atts)
|
|
1565
|
-
(if (setq att (entnext ent))
|
|
1566
|
-
(progn
|
|
1567
|
-
(setq atts nil)
|
|
1568
|
-
(while (= (cdr (assoc 0 (entget att))) "ATTRIB")
|
|
1569
|
-
(setq atts (cons (cons (cdr (assoc 2 (entget att))) (cdr (assoc 1 (entget att)))) atts))
|
|
1570
|
-
att (entnext att))
|
|
1571
|
-
(reverse atts))
|
|
1572
|
-
nil))
|
|
1573
|
-
|
|
1574
|
-
(defun @br:get-dynprops (obj / r)
|
|
1575
|
-
(setq r (vl-catch-all-apply
|
|
1576
|
-
(function (lambda ()
|
|
1577
|
-
(mapcar '(lambda (x)
|
|
1578
|
-
(cons (vla-get-propertyname x)
|
|
1579
|
-
(list (cons "value" (vlax-get x 'value))
|
|
1580
|
-
(cons "readOnly" (vlax-get x 'readonly))
|
|
1581
|
-
(cons "show" (vlax-get x 'show)))))
|
|
1582
|
-
(vlax-safearray->list (vlax-invoke obj 'getdynamicblockproperties)))))))
|
|
1557
|
+
(defun @br:try-fn (fn arg / r)
|
|
1558
|
+
(setq r (vl-catch-all-apply (function (lambda () (apply fn (list arg))))))
|
|
1583
1559
|
(if (vl-catch-all-error-p r) nil r))
|
|
1584
1560
|
|
|
1585
|
-
(defun @br:props (ent /
|
|
1561
|
+
(defun @br:props (ent / ed r p2 p10 p50 p41 p42 p43)
|
|
1562
|
+
(setq ed (entget ent)
|
|
1563
|
+
p10 (cdr (assoc 10 ed))
|
|
1564
|
+
p50 (cdr (assoc 50 ed))
|
|
1565
|
+
p41 (cdr (assoc 41 ed))
|
|
1566
|
+
p42 (cdr (assoc 42 ed))
|
|
1567
|
+
p43 (cdr (assoc 43 ed)))
|
|
1586
1568
|
(setq r (vl-catch-all-apply
|
|
1587
1569
|
(function (lambda ()
|
|
1588
|
-
(setq obj (vlax-ename->vla-object ent)
|
|
1589
|
-
ed (entget ent))
|
|
1590
1570
|
(list
|
|
1591
1571
|
(cons "handle" (cdr (assoc 5 ed)))
|
|
1592
1572
|
(cons "layer" (cdr (assoc 8 ed)))
|
|
1593
|
-
(cons "blockName" (
|
|
1594
|
-
(cons "effectiveBlockName" (
|
|
1595
|
-
(cons "insertionPoint" (
|
|
1596
|
-
(cons "rotation"
|
|
1597
|
-
(cons "scale" (list
|
|
1598
|
-
(cons "
|
|
1599
|
-
(cons "
|
|
1600
|
-
|
|
1601
|
-
(if (vl-catch-all-error-p r) nil r))
|
|
1573
|
+
(cons "blockName" (cdr (assoc 2 ed)))
|
|
1574
|
+
(cons "effectiveBlockName" (cdr (assoc 2 ed)))
|
|
1575
|
+
(cons "insertionPoint" (list (car p10) (cadr p10) (caddr p10)))
|
|
1576
|
+
(cons "rotation" p50)
|
|
1577
|
+
(cons "scale" (list p41 p42 p43))
|
|
1578
|
+
(cons "attributes" (@br:try-fn 'block:get-attributes ent))
|
|
1579
|
+
(cons "dynamicProperties" (@br:try-fn 'block:get-properties ent)))))))
|
|
1580
|
+
(if (vl-catch-all-error-p r) (list (cons "handle" (cdr (assoc 5 ed)))) r))
|
|
1602
1581
|
|
|
1603
1582
|
(setq ss (ssget "_X" ${filterCode}))
|
|
1604
1583
|
(if (null ss)
|
|
@@ -1648,6 +1627,18 @@ async function getBlockRefs(params = {}) {
|
|
|
1648
1627
|
val = val.map((v) => typeof v === "number" ? v : 1);
|
|
1649
1628
|
} else if (key === "isDynamic") {
|
|
1650
1629
|
val = val === true || val === "true" || val === 1;
|
|
1630
|
+
} else if (key === "attributes" && Array.isArray(val)) {
|
|
1631
|
+
const o = {};
|
|
1632
|
+
val.forEach((p) => {
|
|
1633
|
+
if (Array.isArray(p) && p.length >= 2) o[String(p[0])] = p[1];
|
|
1634
|
+
});
|
|
1635
|
+
val = o;
|
|
1636
|
+
} else if (key === "dynamicProperties" && Array.isArray(val)) {
|
|
1637
|
+
const o = {};
|
|
1638
|
+
val.forEach((p) => {
|
|
1639
|
+
if (Array.isArray(p) && p.length >= 2) o[String(p[0])] = p[1];
|
|
1640
|
+
});
|
|
1641
|
+
val = o;
|
|
1651
1642
|
}
|
|
1652
1643
|
obj[key] = val;
|
|
1653
1644
|
}
|