DWG分离
你好,各位大师,我有一个问题,几天了。在一个dwg文件中有多个图形框架,如下所示:20160822102426.png
现在,问题是如何按框架分隔每个图形,并将其保存为独立的DWG文件
函数可能如下:http://through-the-interface.typepad.com/through_the_interface/2010/03/marchs-plugin-of-the-month-live-on-autodesk-labs-batch-publish-for-autocad.html
如果你愿意,c#代码会更好。
谢谢。。。。。。
**** Hidden Message ***** 哦,来吧,谁来帮帮我 http://forums.autodesk.com/t5/net/dwg-separate/m-p/6513577/highlight/false#M49863v
这是同一个问题,我问;;;
;;; LayoutsToDwgs.lsp
;;; Created 2000-03-27
;;; By Jimmy Bergmark
;;; Copyright (C) 1997-2012 JTB World, All Rights Reserved
;;; Website: www.jtbworld.com
;;; E-mail: info@jtbworld.com
;;;
;;; 2003-12-12 Sets UCS to world in model space
;;; to avoid problem with wblock
;;; 2011-06-06 Excludes empty layouts
;;; 2012-06-01 Handle Map prompt with WBLOCK
;;; Include AutoCAD Map information in the export? :
;;; 2013-03-04 Added _ on some commands to internationalize it
;;;
;;; For AutoCAD 2000, 2000i, 2002, 2004, 2005,
;;; 2006, 2007, 2008, 2009, 2011, 2012, 2013 and newer
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Creates separate drawings of all layouts.
;;; The new drawings are saved to the current drawings path
;;; and overwrites existing drawings.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun c:LayoutsToDwgs (/ errexit undox olderr oldcmdecho fn path
msg msg2 fileprefix i j)
(defun errexit (s)
(princ "\nError:")
(princ s)
(restore)
)
(defun undox ()
(command "._undo" "_E")
(setvar "cmdecho" oldcmdecho)
(setq *error* olderr)
(princ)
)
(setq olderr*error*
restore undox
*error* errexit
)
(setq oldcmdecho (getvar "cmdecho"))
(setvar "cmdecho" 0)
(defun DelAllLayouts (Keeper / TabName)
(vlax-for Layout
(vla-get-Layouts
(vla-get-activedocument (vlax-get-acad-object))
)
(if
(and
(/= (setq TabName (strcase (vla-get-name layout))) "MODEL")
(/= TabName (strcase Keeper))
)
(vla-delete layout)
)
)
)
(vl-load-com)
(setq msg "" msg2 "" i 0 j 0)
(command "._undo" "_BE")
(setq fileprefix (getstring "Enter filename prefix: "))
(foreach lay (layoutlist)
(if (and (/= lay "Model") (> (vla-get-count (vla-get-block (vla-Item (vla-get-Layouts (vla-get-activedocument (vlax-get-acad-object))) lay))) 1))
(progn
(command "_.undo" "_M")
(DelAllLayouts lay)
(setvar "tilemode" 1)
(command "_.ucs" "_w")
(setvar "tilemode" 0)
(setq path (getvar "DWGPREFIX"))
(setq fn (strcat path fileprefix lay ".dwg"))
(if (findfile fn)
(progn
(command "_.-wblock" fn "_Y")
(if (equal 1 (logand 1 (getvar "cmdactive")))
(progn
(setq i (1+ i) msg (strcat msg "\n" fn))
(command "*")
)
(setq j (1+ j) msg2 (strcat msg2 "\n" fn))
)
)
(progn
(command "_.-wblock" fn "*")
(setq i (1+ i)msg (strcat msg "\n" fn))
)
)
(if (equal 1 (logand 1 (getvar "cmdactive")))
(command "_N")
)
(command "_.undo" "_B")
)
)
)
(if (/= msg "")
(progn
(if (= i 1)
(prompt "\nFollowing drawing was created:")
(prompt "\nFollowing drawings were created:")
)
(prompt msg)
)
)
(if (/= msg2 "")
(progn
(if (= j 1)
(prompt "\nFollowing drawing was NOT created:")
(prompt "\nFollowing drawings were NOT created:")
)
(prompt msg2)
)
)
(command "._undo" "_E")
(textscr)
(restore)
(princ)
)
(princ)
我知道你在要求。NET,但试一试?它很旧,但坚如磐石 哦,兄弟,
我的功能是有一些图纸在一个dwg文件中,也许像批量绘图工具 要炸薯条吗
更严重的是,该板的目的是帮助人们编写代码,而不是为他们完成所有工作。如果你发布你的代码并指出你遇到障碍的地方,你会走得更远。如果你没有代码,如果你不会写代码,那么我建议你找个人来雇佣(不,那不是我)。 哈哈
兄弟,我写了几天,
现在我可以识别画框了,
,我的意思是你可以显示重要的代码,而不是全部<最后,如果你愿意的话<那么,我错了吗??? 在您煞费苦心地编写代码来解决这个问题,或者花钱雇人来做这件事之前,您可能想问问创建这个绘图的人:是否正确地使用了AutoCAD来生成这个绘图?如果图纸生成正确,很可能不需要编写任何代码来批量打印,例如,每个框架可以在它自己的布局上,并且可以使用“发布”命令一次打印选定的布局或所有布局。针对糟糕的绘图编写代码是您最不想做的事情。 太棒了<我做那件事是有罪的,结果总是不好。 最后我myself.thanks大家解决了 如果您不共享解决方案,此线程将毫无价值
页:
[1]