Millsy29 Posted July 14, 2010 Posted July 14, 2010 Hi everyone i have been given a etransmit lisp but I have a problem with it. a). I can't find the command prompt to run the lisp b). I’m not to sure what the lisp does in it entirety. What i would like it to do is create an etransmit .zip file and put next to original file. Then detach x-refs I have created a button on my palettes to detach all x-refs that works fine -xr D *. but it would be nice to have a lisp to do both . Does anyone have a lisp like this? ;***SCRIPTABLE ETRANSMIT (apply '(lambda () (SETVAR "CMDECHO" 0) (COMMAND "QSAVE" ) ;;;*----------------------------------------------------------- (COMMAND "LAYER" "UNLOCK" "*" "") (COMMAND "TILEMODE" "0" ) (COMMAND "pspace" ) (command "LAYER" "t" "VIEWPORT" "u" "*" "m" "VIEWPORT" "c" "8" "VIEWPORT" "T" "0" "S" "0" "") (if(="Model" (getvar "ctab")) (setq XX1 (ssget "_X" '((0 . "viewport")))) (progn (foreach mb (vl-remove "Model"(layoutlist)) (setvar "ctab" mb) (setvar "psltscale" 1) (setvar "ltscale" 1) (setq XX1 (ssget "_X" '((0 . "viewport")))) (command "-vports" "lock" "off" xx1 "")))) ;;;*----------------------------------------------------------- (defun removexref (xrefname / blkname) (if (setq blkname (tblsearch "block" xrefname)) (if (= (cdr (assoc 70 blkname)) 12) (command ".xref" "d" xrefname) ) ) (princ) ) (defun remove-unloaded-xrefs () (vlax-for block (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) (if (and (= :vlax-true (vla-get-isxref block)) (= 0 (vla-get-count block)) ) (vla-detach block) ) ) ) (apply '(lambda () (remove-unloaded-xrefs) (princ) ) '() ) ;;;*----------------------------------------------------------- (defun TODAY ( / d yr mo da) (setq d (rtos (getvar "CDATE") 2 6) yr (substr d 3 2) mo (substr d 5 2) DAY (substr d 7 2) );setq (strcat yr mo DAY) );defun ;;;*----------------------------------------------------------- (defun NOW ( / d hr mi se) (setq d (rtos (getvar "CDATE") 2 6) hr (substr d 10 2) mi (substr d 12 2) se (substr d 14 2) );setq (strcat hr mi se) );defun ;;;*----------------------------------------------------------- (SETQ CPFIX (getvar "dwgprefix")) (SETQ CDNAM (getvar "dwgNAME")) (SETQ NDIR (STRCAT "eTran-" (today) "/" )) (vl-mkDir (strcat CPFIX NDIR )) ;;;*----------------------------------------------------------- (SETQ NFNAME (strcat (vl-filename-base (getvar "dwgname")) "-" (today) (NOW) )) ;;;*------------------------------------------------------------ (command "saveas" "2004" (strcat (getvar "dwgprefix") NDIR NFNAME ".dwg")) ;;;*------------------------------------------------------------ (command "ETRANSMIT" "CH" "ETRANS" "C" (strcat (getvar "dwgprefix") NFNAME )) ;;;*------------------------------------------------------------ (COMMAND "QSAVE" ) ;;;*------------------------------------------------------------ (princ) ) '() ) Thanks Millsy Quote
VVA Posted July 14, 2010 Posted July 14, 2010 a). I can't find the command prompt to run the lisp _-ETRANSMIT Quote
rkmcswain Posted July 14, 2010 Posted July 14, 2010 -ETRANSMIT No, that only runs the eTransmit command at the command line. There is no command definition in this lisp code. It will run as soon as it's loaded. Quote
Millsy29 Posted July 14, 2010 Author Posted July 14, 2010 do you have a lisp that will etransmit??? or etransmit and detach x-refs??? thats has a command promt??? Quote
Tharwat Posted July 14, 2010 Posted July 14, 2010 Try This very simple ... (defun c:try () (vl-cmdf "_.qsave" "_.-etransmit" "_c" pause ) ) Good Luck Tharwat Quote
Millsy29 Posted July 14, 2010 Author Posted July 14, 2010 thanks for that tharwat, it nearly worked. that simple code has given me an insight in to the lisp code. but no .zip file is created. see AutoCAD Text window below. Command: _.-etransmit Updating fields... Enter an option [Create transmittal package/Report only/CUrrent setup/CHoose setup] : _c Gathering files ... File name for transmittal package: \ Updating Indexes for block *Model_Space Done. Transmittal created: \.zip. Command: T millsy Quote
Tharwat Posted July 14, 2010 Posted July 14, 2010 Noway , I have try it for so many times and it was marvelous . Open a new drawing and implement the codes and check once again . The only thing that codes will ask for the location of your file ... try it in different ways. Good luck Tharwat Quote
alanjt Posted July 14, 2010 Posted July 14, 2010 (command "_.qsave" "_.-etransmit" "_c" (strcat (getvar 'dwgprefix) (vl-filename-base (getvar 'dwgname)) ".zip" ) ) Quote
Tharwat Posted July 14, 2010 Posted July 14, 2010 Here is the result of the code .... file created. Command: try _.qsave Command: _.-etransmit Updating fields... Enter an option [Create transmittal package/Report only/CUrrent setup/CHoose setup] <Report only>: _c Gathering files ... [color="Red"]Transmittal created[/color]: D:\Projects\C-62 Saffarini\C-62 Drainage\DRAINAGE REV.5 - Standard.zip. Regards Tharwat Quote
Millsy29 Posted July 14, 2010 Author Posted July 14, 2010 That works brilliantly i can't thank you enough Alan... How do i put this on a button on the palettte without a command prompt? or is it easy to add a defun C:et command prompt? millsy Quote
alanjt Posted July 14, 2010 Posted July 14, 2010 You're welcome. (defun c:Test nil (vl-load-com) (command "_.qsave" "_.-etransmit" "_c" (strcat (getvar 'dwgprefix) (vl-filename-base (getvar 'dwgname)) ".zip" ) ) (princ) ) Quote
Millsy29 Posted July 14, 2010 Author Posted July 14, 2010 ha ha ha well mr ventura how hard would it be to add a detach x-ref and a purge all at the end after...? i have created buttons for these functions on my palette -purge all * no and -xr D * these work fine but i'm starting to look for things to automate in one as there is nothing like working hard to make your life easier in the long run! (or getting the cad lisp gods to show you how its done) Millsy Quote
alanjt Posted July 14, 2010 Posted July 14, 2010 You've already worked out the syntax. You just have to apply it in the form of (command "_.-xref" "_d" "*") blah blah blah. Are you wanting to detach everything before eTransmit, but NOT have the drawing save that way? Quote
Millsy29 Posted July 14, 2010 Author Posted July 14, 2010 i see, i will have a crack at it and let you know how i get on.. the idea is to do the extra functions after the etransmit. so it leaves an empty shell drawing in the file so we cant overwright it when updating the drawing again. thanks again millsy Quote
alanjt Posted July 14, 2010 Posted July 14, 2010 i see, i will have a crack at it and let you know how i get on.. the idea is to do the extra functions after the etransmit. so it leaves an empty shell drawing in the file so we cant overwright it when updating the drawing again. thanks again millsy Shout if you need help. Quote
Millsy29 Posted July 14, 2010 Author Posted July 14, 2010 i've have had a go at it, but to no joy. this is what i have done below. the etransmit works of course but the rest i put in doesn't (defun c:et nil (vl-load-com) (command "_.qsave" "_.-etransmit" "_c" (strcat (getvar 'dwgprefix) (vl-filename-base (getvar 'dwgname)) ".zip" ) command "_.-xref" "_d" "*") ) command "_.-purge" "_all" "*" "no") ) ) (princ) ) where am i going wrong? and can you point me to com beginers website for lisps. i feel like i'm starting to ask too much of poeple now millsy Millsy - Please use [noparse] [/noparse] tags as it makes the code easier to read. Thanks. Quote
alanjt Posted July 14, 2010 Posted July 14, 2010 Let's make things a little easier to understand (untested)... (defun c:et nil (vl-load-com) (command "_.qsave") (command "_.-etransmit" "_c" (strcat (getvar 'dwgprefix) (vl-filename-base (getvar 'dwgname)) ".zip") ) (command "_.-xref" "_d" "*") (command "_.-purge" "_all" "*" "_no") (princ) ) Look at the link to AfraLISP in my signature. 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.