cjf160204 发表于 2024-7-15 09:43:29

展桩基坐标并画圆

展桩基坐标并可以画圆

cjf160204 发表于 2024-7-15 11:04:49

(DEFUN C:ZD( / E1 E2 A A1 A2 A3 A4 B1 B2 B3 B4 I textSize diameter )
(setq E1 (GETVAR "cmdecho"))
(SETVAR "cmdecho" 0)
(setq E2 (GETVAR "osmode"))
(SETVAR "osmode" 0)
(VL-LOAD-COM)
(setq A (GETFILED "选取数据文件" "" "txt" 16))
(setq A1 (OPEN A "r"))
(setq I 0)
(setq textSize (getreal "\n 请输入文字大小: "))
(setq diameter (getreal "\n 请输入圆的直径: "))
(command "undo")
(command "be")
(while (and(if (AND (setqA2 (READ-LINE A1)) (/= (STRLEN A2) 0)) (PROGNT)))
    (setq A3 (VL-STRING-POSITION (ASCII ",") A2))
    (setq A4 (VL-STRING-POSITION (ASCII ",") A2 (+ A3 1)))
    (setq B (SUBSTR A2 1 A3))
    (setq B1 (READ (SUBSTR A2 (+ A3 2) (- A4 A3 1))))
    (setq B2 (READ (SUBSTR A2 (+ A4 2))))
    (setq B3 (LIST (+ B2 0.375) (- B1 0.375)))
    (setq B4 (LIST B2 B1))
    (command ".text")
    (command B3)
    (command textSize)
    (command 0)
    (command B)
    (command ".point")
    (command B4)
    (if (> diameter 0); 只有当直径大于 0 时才画圆
      (command "circle" B4 (/ diameter 2))
    )
    (setq I (1+ I))
)
(command "undo")
(command "e")
(CLOSE A1)
(SETVAR "cmdecho" E1)
(SETVAR "osmode" E2)
(PRINC "\n 展点结束!展点数:")
(PRINC I)
(PRINC "\n")
(PRINC)
)

cjf160204 发表于 2024-7-15 11:06:02

cjf160204 发表于 2024-7-15 11:04
(DEFUN C:ZD( / E1 E2 A A1 A2 A3 A4 B1 B2 B3 B4 I textSize diameter )
(setq E1 (GETVAR "cmdecho")) ...

这个才对,上面展点位置和圆心有细微偏差,这个展点位置和圆心位置一致

散装的啤酒 发表于 2024-7-15 11:11:36

这个很好的,感谢您。

cjf160204 发表于 2024-7-15 11:17:55

散装的啤酒 发表于 2024-7-15 11:11
这个很好的,感谢您。

本来展点完,桩基又要画圆,可以一个插件搞定
页: [1]
查看完整版本: 展桩基坐标并画圆