nicpapa 发表于 2022-7-6 06:16:22

用于点导出的LISP

您好,我在论坛上找到了一个非常好的Lisp程序这个工作。但我想在这方面有所不同。Lisp程序是ECoor。lsp,由Vladimir Azarko制作。
我想要的变化是:
1) 选择圆并获取中心以写入坐标
2) 按以下格式编写文本:
n、 x,y和有2位数字000.00
1,120.12,200.54
 
谢谢

Tharwat 发表于 2022-7-6 06:22:51

看看这个,伙计。
 
这会将所选圆的中心写入驱动器C:/My Folder/coordinates。因此,如果你没有相同名称的驱动器只需更换
字符C:和你最喜欢的一个。。
 

(defun c:TesT (/ *error* dir fNme ss i sname c)
(vl-load-com)
; THARWAT Oct. 07.2010
(defun *error* (msg)
   (and fNme (close fNme))
   (if (and msg
            (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*QUIT*,"))
       )
   (princ (strcat "\nError: " msg))
   )
)

(setq dir "C:\\My Folder")
(vl-mkdir dir)
(if (and
       (setq fNme (open "C:/My Folder/coordinates.txt" "w"))
       (setq ss (ssget '((0 . "CIRCLE"))))
   )
   (progn
   (repeat (setq i (sslength ss))
       (setq sname (ssname ss (setq i (1- i))))
       (setq c (cdr (assoc 10 (entget sname))))
       (write-line
         (strcat (rtos (car c) 2 2) "\t" (rtos (cadr c) 2 2))
         fNme
       )
   )
   (close fNme)
   )
   (princ)
)
(princ)
)

 
塔瓦特

nicpapa 发表于 2022-7-6 06:25:35

Tharwat it good,we can add to take text numers near of the circle,and write to the text in this format point numer,x,y.好吧,我们可以在圆的附近加上一个文本numer,然后用这个格式把文本写成点numer,x,y。
谢谢

Tharwat 发表于 2022-7-6 06:28:01

像这样的事情??
 

(defun c:TesT (/ *error* dir fNme ss i sname c x y)
(vl-load-com)
; THARWAT Oct. 07.2010
(defun *error* (msg)
   (and fNme (close fNme))
   (if (and msg
            (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*QUIT*,"))
       )
   (princ (strcat "\nError: " msg))
   )
)

(setq dir "C:\\My Folder")
(vl-mkdir dir)
(if (and
       (setq fNme (open "C:/My Folder/coordinates.txt" "w"))
       (setq ss (ssget '((0 . "CIRCLE"))))
   )
   (progn
   (repeat (setq i (sslength ss))
       (setq sname (ssname ss (setq i (1- i))))
       (setq c (cdr (assoc 10 (entget sname))))
       (write-line
         (strcat (setq x (rtos (car c) 2 2))
               "\t"
                (setq y (rtos (cadr c) 2 2))
         )
         fNme
       )
       (entmakex (list '(0 . "MTEXT")
                     '(100 . "AcDbEntity")
                     '(100 . "AcDbMText")
                     (cons 40 (getvar 'textsize))
                     (cons 1
                           (strcat "X" "=" " " x "\\P" "Y" "=" " " y)
                     )
                     (assoc 10 (entget sname))
                     '(50 . 0.)
                     '(210 0.0 0.0 1.0)
               )
       )

   )
   (close fNme)
   )
   (princ)
)
(princ)
)

nicpapa 发表于 2022-7-6 06:30:40

对不起,我写错了。
我有一些画,有一个圆作为点,圆的附近是编号文本如18。
如果可能的话,这些圆就是我想要的标桩点,将它们导出到文本文件中,就像你发布的第一个一样,但数字在圆的附近。
eg文本文件
点nubmer,x,y
18,5124.24,45646.63
19,5454.26,46566.63
.....
 
查看附件的图像。。
谢谢

Lee Mac 发表于 2022-7-6 06:34:38

塔尔瓦特,
 
研究GetField函数。

Tharwat 发表于 2022-7-6 06:36:43

实际上,我正在使用GetField函数来选择已经存在的所需文件,在OP的请求中,需要创建一个文件并将字符串(数据)导出到其中。

Lee Mac 发表于 2022-7-6 06:39:35

 
您可以使用GetField创建新文件,阅读文档。

VVA 发表于 2022-7-6 06:41:54

>尼帕帕
感谢您的反馈。您可能对该程序输出坐标(大地坐标和数学坐标)感到满意

nicpapa 发表于 2022-7-6 06:45:30

很多人。。。
导出坐标(大地坐标和数学坐标)它真的很好,只有两个问题lisp它不工作,它给出了一个错误
命令:GEO_EXPORT
; 错误:退出/退出中止
但是vlx正在工作,我一次又一次地检查路径支持,我制造了新闻,但什么都没有。
第二个问题是如何将最后一个数字改为2,而不导出z
eg 1869206.0264034992.735,0.000
至1869206.034034992.74
 
再次感谢。。
页: [1] 2
查看完整版本: 用于点导出的LISP