souvik Posted May 2, 2012 Posted May 2, 2012 Hi, I'm new here. I want a lisp file which automatically copy visible content of a drawing and save it to a new dwg file. Is it possible? Please help me. Quote
Tharwat Posted May 2, 2012 Posted May 2, 2012 Welcome to Cadtutor . wblock command help at all ? Quote
souvik Posted May 2, 2012 Author Posted May 2, 2012 Thanks for your reply. But It will only export the content in Model not in Layout. I want to export both Quote
Lt Dan's legs Posted May 2, 2012 Posted May 2, 2012 (edited) (defun c:test ( / nfn app fn ) (vl-load-com) (if (setq nfn (getfiled "Choose directory" "c:\\" "dwg" 1)) (progn (setq fn (vla-get-fullname (setq *acdoc* (cond ( *acdoc* ) ( (vla-get-activedocument (vlax-get-acad-object)) ) ) ) ) ) (vla-saveas *acdoc* nfn) (vla-save *acdoc*) (vla-saveas *acdoc* fn) (vla-save *acdoc*) (cond ( (findfile "c:\\Windows\\media\\tada.wav") (setq app (vlax-create-object "WMPlayer.OCX.7")) (vlax-invoke (vlax-get app 'CurrentPlaylist) 'Appenditem (vlax-invoke app 'NewMedia "c:\\Windows\\media\\tada.wav") ) (vlax-invoke (vlax-get app 'controls) 'play) (vlax-release-object app) (gc) ) ) (startapp "explorer" (vl-filename-directory nfn)) ) ) (princ) ) Edited May 2, 2012 by Lt Dan's legs boredom Quote
Lt Dan's legs Posted May 2, 2012 Posted May 2, 2012 I've updated my code above. I'm assuming you wanted to make a backup of the current drawing.. Quote
souvik Posted May 3, 2012 Author Posted May 3, 2012 Thanks all-of you. But they does not fulfill my need. I actually want a lisp which copy all the visible content in the model as well as in Layout (but not that layers and contents which are turned off) and save it to a another drawing. Quote
pBe Posted May 3, 2012 Posted May 3, 2012 (edited) What about making a list of all Frozen/Off layers, use that list to delete all objects that falls onto that list then wblock Programmatically that is. Well? I'm ready to write the code for you only if you tell me the filename format or folder path Have time to play (defun c:Leaveus ( / aDoc Layers path laylist) (setvar 'Expert 5) (setq aDoc (vla-get-activedocument (vlax-get-acad-object)) laylist nil path (strcat (getvar 'dwgprefix) "CopyOfFiles" "\\")) [i] ;<-- "CopyOfFiles" Folder name for Visible drawings [/i] (vlax-for itm (vla-get-layers aDoc) (if (or (eq (vla-get-Freeze itm) :vlax-true) (eq (vla-get-LayerOn itm) :vlax-false)) (setq laylist (cons (vla-get-name itm) laylist)))) (vl-mkdir path) (if (and (= (getvar 'Dwgtitled) 1) laylist) (progn [b] (command "_undo" "Mark") [/b] (vlax-for layout (vla-get-layouts adoc) (vlax-for ent (vla-get-block layout) (if (member (vla-get-layer ent) laylist) (vla-delete ent)))) (command [b]"-wblock"[/b] (strcat path (getvar 'Dwgname)) "*") [b] (command "_undo" "Back") [/b] ) ) (princ) ) HTH Edited May 3, 2012 by pBe Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.