Jump to content

Recommended Posts

Posted

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 :D. 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

  • Replies 24
  • Created
  • Last Reply

Top Posters In This Topic

  • Millsy29

    10

  • alanjt

    8

  • Tharwat

    3

  • rkmcswain

    2

Popular Days

Top Posters In This Topic

Posted

a). I can't find the command prompt to run the lisp

_-ETRANSMIT

Posted
-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.

Posted

do you have a lisp that will etransmit??? or etransmit and detach x-refs??? thats has a command promt???

Posted

Try This very simple ...

(defun c:try ()
(vl-cmdf "_.qsave" "_.-etransmit" "_c" pause )
)

 

Good Luck

 

Tharwat

Posted

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

Posted

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

Posted
(command "_.qsave"
        "_.-etransmit"
        "_c"
        (strcat (getvar 'dwgprefix)
                (vl-filename-base (getvar 'dwgname))
                ".zip"
        )
)

Posted

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

Posted

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

Posted

You're welcome. :)

 

(defun c:Test nil
 (vl-load-com)
 (command "_.qsave"
          "_.-etransmit"
          "_c"
          (strcat (getvar 'dwgprefix)
                  (vl-filename-base (getvar 'dwgname))
                  ".zip"
          )
 )
 (princ)
)

Posted

ha ha ha :lol: 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! :D (or getting the cad lisp gods to show you how its done)

 

 

Millsy

Posted

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?

Posted

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

Posted
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.

Posted

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.

Posted

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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...