pxt2015 发表于 2025-7-1 23:03:13

2025.06.07版本API,xdrx_points_offset无法偏移?

xdrx_points_offset是我的一个高频函数,最近升级CAD,也升级了API,直接用最新版本。
发现2025.06.07版本API,xdrx_points_offset无法偏移?不管是直线,三点PL线,还是矩形PL线

XDSoft 发表于 2025-7-1 23:03:14

pxt2015 发表于 2025-7-5 10:42
;;------------------------ 通用函数(defun c:xdrxver ()(xdrx_prompt    "\n晓东API版本"    (xdrx_doc ...


(defun c:tt ()
(xdrx-begin)
(while (setq
           poly        (car
                  (xdrx-entsel "\n拾取多段线<退出>:" '((0 . "*polyline,line")))
                )
       )
    (setq verts (xdrx-getpropertyvalue poly "vertices"))
    (setq closed (xdrx-getpropertyvalue poly "isclosed"))
    (setq voffset (xdrx-points-offset 100.0 verts))
    (xdrx-polyline-make voffset closed)
    (xdrx-entity-matchprop poly (entlast))
)
(xdrx-end)
(princ)
)

XDSoft 发表于 2025-7-3 19:33:00

xdrx-points-offset是 点表偏移

Command: !box
((22952.1 2424.77 0.0) (21742.3 6090.09 0.0) (18078.1 4880.67 0.0) (19287.9 1215.35 0.0))

Command: (setq b (xdrx-points-offset 100.0 box))
((23047.0 2456.11 0.0) (21805.9 6216.39 0.0) (17951.8 4944.28 0.0) (19192.9 1184.0 0.0))

XDSoft 发表于 2025-7-3 19:33:36

xdrx-points-offset是 点表偏移

Command: !box
((22952.1 2424.77 0.0) (21742.3 6090.09 0.0) (18078.1 4880.67 0.0) (19287.9 1215.35 0.0))

Command: (setq b (xdrx-points-offset 100.0 box))
((23047.0 2456.11 0.0) (21805.9 6216.39 0.0) (17951.8 4944.28 0.0) (19192.9 1184.0 0.0))

pxt2015 发表于 2025-7-5 10:42:23

本帖最后由 pxt2015 于 2025-7-5 11:51 编辑

;;------------------------ 通用函数(defun c:xdrxver ()(xdrx_prompt    "\n晓东API版本"    (xdrx_document_getversionex)    ", CAD版本"    (substr (getvar "acadver") 1 4))(princ))(defun xd-DimLst (pts / str i_dim n zg_dim)(setq i_dim 0)(setq zg_dim (/ (getvar "VIEWSIZE") 25.0)) ;屏幕高度的倍数(foreach n pts    (setq str (itoa (setq i_dim (1+ i_dim))))    (xdrx_text_make n str zg_dim 0))(xdrx_polyline_make pts))(if (= (xdrx_document_getversionex) "2020.02.08")(setq Xd-GetSpt Xdrx_Entity_GetStretchPoint)(setq Xd-GetSpt Xdrx_Entity_StretchPoints));;------------------------ 测试Xdrx_Points_Offset(defun c:t1 ()(vl-cmdf "undo" "be")(c:xdrxver)(setq note "\n选择line,lwpolyline:")(while (setq e0 (xdrx_entsel note '((0 . "line,lwpolyline"))))    (setq pts (Xd-GetSpt (car e0)))        (xd-DimLst (Xdrx_Points_Offset 500 pts)))(vl-cmdf "undo" "e")(princ))






1/2 运行环境:Windows11家庭中文版,24H2,操作系统版本26100.4351,autoCAD2018,晓东API版本号:2020.02.08




2/2 运行环境:Windows11家庭中文版,24H2,操作系统版本26100.4351,autoCAD2023,晓东API版本号:2025.06.08



第二个动画显示,没有达到预期的偏移效果。


pxt2015 发表于 2025-8-4 10:21:30

本帖最后由 pxt2015 于 2025-8-4 10:27 编辑

终于找到原因了:2025版本API,(xdrx_points_offset dis pts)执行偏移的时候dis要输入实数500.0,不能输入整数500。

页: [1]
查看完整版本: 2025.06.07版本API,xdrx_points_offset无法偏移?