它现在正在与圆圈一起工作 我想计算面积并将其导出到excel文件中。
有任何lisp例程。
我已经为上面的lisp例程,但在两个文件中
一个用于导出坐标,另一个用于计算面积。
如何合并这两者或导出坐标替换为导出区域。
谢谢和问候!!
山姆
将2dpoints导出到CSV。lsp
地区LSP 嗨,塔瓦,
我使用这个lisp,但也添加了弧。
几个问题:
如何也列出直径(或半径,如果其弧)与X和Y坐标?
是否允许选择用户定义的0,0(或UCS原点预设)?
这是我修改过的版本
(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,ARC"))))
)
(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 3))
"\t"
(setq y (rtos (cadr c) 2 3))
)
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)
(command "mtext" "0,0" "2,2" "0,0" "ORIGIN" "")
(command "chprop" "l" "" "c" "4" "")
)
(princ)
)
(princ)
)
嗨,shailujp
这
(defun c:Test (/ *error* fl f ss i sn e c r x y)
;;;--- Tharwat 03.06.2013---;;;
(defun *error* (msg)
(and f (close f))
(princ (strcat "\nError: " msg "\n*Cancel*"))
)
(if (and (setq fl (getfiled "Specify the text file name :"
(getvar 'DWGPREFIX)
"txt"
1
)
)
(setq f (open fl "w"))
(progn (princ "\n Select Arcs and Circles ")
(setq ss (ssget '((0 . "CIRCLE,ARC"))))
)
)
(progn
(write-line "X: \t Y: \t Diameter/Radius" f)
(repeat (setq i (sslength ss))
(setq e (entget (setq sn (ssname ss (setq i (1- i)))))
c (cdr (assoc 10 e))
)
(if (eq (cdr (assoc 0 e)) "ARC")
(setq r (cdr (assoc 40 e)))
(setq r (* (cdr (assoc 40 e)) 2.))
)
(write-line
(strcat (setq x (rtos (car c) 2 3))
"\t"
(setq y (rtos (cadr c) 2 3))
"\t"
(rtos r 2 3)
)
f
)
(entmakex
(list '(0 . "MTEXT")
'(100 . "AcDbEntity")
'(100 . "AcDbMText")
(cons 40 (getvar 'TEXTSIZE))
(cons 1 (strcat "X" "=" " " x "\\P" "Y" "=" " " y))
(assoc 10 e)
'(50 . 0.)
)
)
)
(close f)
)
(princ)
)
(princ)
) 嗨,塔瓦,
你的Lisp程序很好用。我删除了圆弧过滤,因为我只使用直径作为输出。
作为并添加了创建表的功能,我下载了J.Villareal的另一个例程。这使我能够使用实用程序生成的excel数据插入表格。
你能帮我再深入一步吗?可以在图纸中插入序列号文本(定义实体)而不是XY坐标吗。XY和直径详细信息仅在表中需要。这样的话,绘图就会很干净,因为较小的绘图会被太多的多行文字重叠而弄乱,变得很难阅读。
我已经附上lisp文件以及图纸。
P、 我叫谢里什,你叫什么?
测试2.lsp
图纸1.dwg shailujp,
请阅读代码发布指南,并在以后发布代码时使用代码标签。我帮你修改了之前的帖子。 有人能帮我安排一下日程吗? 也许这会有帮助 高VVA
链接上的lisp有效,但由于某些原因,输出坐标与实际尺寸不匹配。不确定它是如何工作的。
无论如何,我可以用下面的代码做些什么(主要来自Tharwat,但我做了一些调整):
1) 要求用户输入以指定原点(基本上设置UCS)
2) 将XY直径细节导出到excel文件(&D)(使用trans函数将XY转换为当前UCS)
3) 添加0,0原点文本,以便用户知道原点是否正确。
4) 使用J.Villareal的TBL3在图纸上恢复整个表格。lisp(使用数据链)
我想要的是:
1) 所有实体(圆弧或圆)应在图纸1、2、3等上编号。。。。(类似于COORN utility对每个链接所做的操作)
2) 它创建的表格应具有第一列序列号(每个项目1)和第五列实体类型(例如圆弧或圆),以识别对象类型。
有人能试试这个吗?
(defun c:XYT (/ *error* fl f ss i sn e c d x y DLName)
;;;--- Tharwat 03.06.2013---;;;
(SETVAR "TEXTSIZE" 2.5)
(defun *error* (msg)
(and f (close f))
(princ (strcat "\nError: " msg "\n*Cancel*"))
)
(if (and (setq fl (getfiled "Specify the .xls file name :"
(getvar 'DWGPREFIX)
"xls"
1
)
)
(setq f (open fl "w"))
(progn
(setq orgn (getpoint "\n Specify the origin:"))
(command "ucs" "o" orgn)
(princ "\n Select Ellipse, Arcs & Circles")
(setq ss (ssget '((0 . "ELLIPSE,CIRCLE,ARC"))))
)
)
(progn
(write-line "X: \t Y: \t Dia:" f)
(repeat (setq i (sslength ss))
(setq e (entget (setq sn (ssname ss (setq i (1- i)))))
c (cdr (assoc 10 e))
)
;(if (eq (cdr (assoc 0 e)) "arc")
;(setq r (cdr (assoc 40 e)))
(setq d (* (cdr (assoc 40 e)) 2.))
(write-line
(strcat (setq x (rtos (car (trans c 0 1)) 2 3))
"\t"
(setq y (rtos (cadr (trans c 0 1)) 2 3))
"\t"
(setq d (rtos d 2 3))
)
f
)
)
(close f)
(command "mtext" "0,0" "j" "tr" "-2,-2" "0,0" "ORIGIN" "")
(command "chprop" "l" "" "c" "4" "")
(load "tbl3")
(tbl3)
; (command "scale" "L" "" pause "0.6")
(princ)
)
(princ)
)
)
页:
1
[2]