使用特定部分保存
你好我正在尝试一种方法,从多个具有不同文件名的相同图形(我有1000个文件)中保存,其中仅包含整个图形中的特定部分,该部分需要包含命名部分作为图形编号。
此图形中没有块或任何属性。
例如,请参阅附件
我需要保存名为630的绘图,该绘图与绘图编号相同。
如果绘图编号为631,则需要删除除631以外的所有其他绘图。
现在我正在做的是从每个图形中删除不需要的绘图,并分别保存每个图形。
我希望你能得到我的要求。
任何人有解决这个问题的想法,请与我分享。。
提前感谢……:):)
630.dwg 如果满足以下条件,则可以这样做(但时间很长):
-所有文件都像一个示例
-单独图层上的多段线,此图层上没有其他元素
-在单独的层上编号,此层上没有其他元素
-等等。
您需要查看完整文件。 您可以找到文本插入点,然后使用(命令“bpoly”pt“”)创建绘图的新pline,获取坐标,然后编写一个脚本文件,其中所有绘图的开头都是new,最后是saveas绘图编号。角点也需要移动吗?输出是否保存在dwg模板中?或者使用open而不是new,它需要一个缩放因子,但使用extmin和extmax也很容易。明显的东西,如层等
new
pline
x,y x,y x,y x,y c
text plotmum....
saveas
plotnum
close
new
pline
x,y x,y x,y x,y c
text plotnum ......
saveas
plotnum
saveas
close
也许是Lisp程序的脚本
(do_lots 621 pt1 pt2 pt3 pt4)
(do_lots 622 pt1 pt2 pt3 pt4)
为什么631图是唯一的开放多边形?
试试这个,它被设置为一个测试,需要一点用户修改,我已经将重复功能设置为3进行测试,它创建了3个新的dwg。它是为了寻找一个c:\temp目录进行测试,所以在那里写下了新的。我把一个空白的dwg版本叫做PLOTS保存到c:\temp中,当我打开它,把新的绘图放在这个dwg中,这样图层或任何其他东西仍然存在。
重要的一点是,它不会检查现有的dwg,因此如果它已经存在,则会出错。它需要知道输出的位置等,但这可以添加。
试着让我知道。
进行3个绘图
; pline co-ords example
; By Alan H
(defun getcoords (ent)
(vlax-safearray->list
(vlax-variant-value
(vlax-get-property
(vlax-ename->vla-object ent)
"Coordinates"
)
)
)
)
; program starts here
; writes out a bpoly of a plot and the label for that plot
; to a brand new file of just that plot
(defun do_lots ( / ss x y fn)
(setq oldsnap (getvar 'osmode))
(setvar 'osmode 0)
(setq ss (ssget "X" (list (cons 0 "*text")(cons 8 "Villa Numbers"))))
(setq fn (open "C:\\temp\\plots.scr" "W"))
(setq x 0) ; rem this out for all plots
(repeat 3; for testing
;(repeat (sslength ss) for all
(setq txt (vlax-ename->vla-object (ssname ss x)))
(setq txtstr (vla-get-textstring txt))
(setq txtins (vlax-safearray->list (vlax-variant-value (vla-get-insertionpoint txt))))
(command "bpoly" txtins "")
(setq co-ords (getcoords (entlast)))
(command "erase" "l" "")
(write-line "open C:/Temp/Plots.dwg" fn)
(write-line "clayer" fn)
(write-line (strcat "\"" "Villa Plot Limits" "\"") fn)
(write-line "Pline" fn)
(setq y 0)
(repeat (/ (length co-ords) 2)
(write-line (strcat (rtos(nth y co-ords) 2 3 ) "," (rtos (nth (+ y 1) co-ords) 2 3)) fn)
(setq y (+ y 2))
)
(write-line "c" fn)
(write-line "zoom extents" fn)
(write-line "Text" fn)
(write-line (strcat (rtos (nth 0 txtins) 2 3) "," (rtos (nth 1 txtins) 2 3 )) fn)
(write-line"2.0" fn)
(write-line "0" fn)
(write-line txtstr fn)
(write-line "filedia" fn)
(write-line "0" fn)
(write-line "saveas" fn)
(write-line "2013" fn)
(write-line (strcat "C:/temp/" txtstr) fn)
(write-line "close" fn)
(setq x (+ x 1))
)
(close fn)
(setvar 'osmode oldsnap)
)
(do_lots)
(command "script" "c:\\temp\\plots")
对
这将需要一个漫长的过程来创建一条捷径。
比加尔的指示也很好,但这一次没有足够的时间来加快它。
因此,对于这个案例,我正在完成1000张图纸的路上,已经完成了半天的1/3。
这次运气不好。。。
我们将在以后找到解决此问题的方法。。。8)8)
感谢你们的大力支持和宝贵指示:) 嗨,比格尔,
给我一点时间来测试你的程序,当然我会尽快让你知道反馈。
再次。。。。非常感谢BIGAL…:) 比加尔,
你能给我提供完整版本的LISP吗。。。。。这一次更有帮助。 以下是我的尝试:
但是你需要钱。。。
多少钱?
页:
[1]
2