Jump to content

Recommended Posts

Posted

Everyone, i have a lisp routine that does multiple etransmits, the prblem is alot of our clients want bound dwg's. We can have up to 200 drawings to issue at once, so its alot of time to bind each xref, file save as etc. Id like a routine that would do all this for me, so i could set it up on another machine, and have the routine open all drawings, bind the xrefs, and save as a new file (so it doesnt overwrite our drawing with everything bound) One problem i can see is occasionally one of our xrefs may be unloaded, or not found. Not sure how the program could cope with this. Does anyone have a lisp file for this? Thanks

Posted

I have one that works perfectly. Make sure you create a blank dwg, save it as "dummy.dwg", and put it in your search path folder. It will Detach unloaded/unresolved xrefs, bind xrefs, audit and purge your dwg. Command is SENT.

 

;...............................................................................
;
;       << Detach unloaded/unresolved xrefs, Bind xrefs, Audit, Purge >>
;                                      <<  2007 >>
;
;          NOTE: Must have a blank dwg in search path name "dummy.dwg" 
;
;...............................................................................
(defun C:SENT ( / )
 
 (defun *error*(msg)
   (setvar "modemacro" ".")
   (setvar "bindtype" oldBnType)
   (setvar "cmdecho" 1)
   (princ "\n...Audit/Bind/PurgeAll terminated!!!  ")
   (princ)
   ); end of *error*
 
 (setvar "modemacro" "Audit/Bind/PurgeAll processing......please wait......")
 (setvar "cmdecho" 0)
 (prompt "\n--- Audit/Bind/PurgeAll......please wait---")
 (prompt "\nAuditing...")(terpri)
 (command "_audit" "y")
 (bind_xrefs)
 (prompt "\nPurging #1")(terpri)
 (command "-purge" "a" "*" "N")
 (prompt "\nPurging #2")(terpri)
 (command "-purge" "a" "*" "N")
 (prompt "\nPurging #3")(terpri)
 (command "-purge" "a" "*" "N")
 (prompt "\n--- Audit, Bind, PurgeAll completed! ---")
 (setvar "modemacro" ".")
 (setvar "cmdecho" 1)
 (princ)
); end of c:sent

(defun bind_xrefs ( / CMD)
 (setq oldBnType(getvar "bindtype"))
 (setq CMD (getvar "CMDECHO"))
 (setvar "CMDECHO" 0)
 (setvar "bindtype" 0)
 (setq XLIST (xref-status))
 (if XLIST 
   (progn
     (prompt "\nBinding all Xrefs...")
     (foreach n XLIST (rem-xref n))  
     (command "-xref" "b" "*" )
     (prompt "...done")(terpri)
   )  
 )
 (setvar "CMDECHO" CMD)
 (setvar "bindtype" oldBnType)
 (princ)
)

(defun rem-xref ( XL / XNAME XSTATUS )
 (setq XNAME (nth 0 XL))
 (setq XSTATUS (nth 2 XL))
 (if (= XSTATUS "UNLOADED")
   (rem_unload)
 )
 (if (= XSTATUS "UNRESOLVED")
   (rem_unload)
 )
)

(defun xref-status ( / d n f r)
 (while (setq d (tblnext "block" (null d)))
   (cond
     (
       (eq 4 (logand 4 (cdr (assoc 70 d))))
       (setq
         d (entget (tblobjname "block" (cdr (assoc 2 d))))
         n (cdr (assoc 2 d))
         p (cdr (assoc 3 d))
         f (cdr (assoc 70 d))
       )
       (setq r
         (cons
           (list n p
             (cond
               ( (eq 32 (logand 32 f)) "LOADED")
               ( (assoc 71 d) "UNLOADED")
               ( t "UNRESOLVED")
             )
           )
           r
         )
       )
     )
   )
 )
 (reverse r)
)


(defun rem_unload ( / )
 (setq DFILE (findfile "dummy.dwg"))
 (if (not DFILE)
   (prompt "\nCannot find dummy_xref drawing ")
   (progn
     (command "-xref" "p" XNAME DFILE)
     (command "-xref" "r" XNAME)
   )
 )
)

Posted

Im not sure if this is exactly what im after, or maybe im just doing it wrong. I want the lisp to be able to do multiple drawings, and not have to open them all. Id rather just select the drawings i want and it do it for me, but also save the file as something new (so i dont overwrite my proper drawing) does this program do this? if so how do i use it?

Posted

Have you tired setting looking in the e-transmit settings. You can add files in there to be e-transited at the same time as the one you have opened. Also you can create a new transmittal setup which you can tell it to bind and purge all drawings for you. It I use it all the time.

 

I think this is what you are after. Its a part of Autocad you dont need another lisp or script to do this. Just set it up right and it will do all the drawings you add

Posted

Thanks i hadn't seen that yet. Works pretty well, and it will have to do till we get all our programs up and running. thanks for your help

Posted

Got a VB.Net app which will do it if you are interested...is basic at the moment, but can be expanded to handle different scenarios (nested xref, etc.)

Posted

Thanks, might be worth having a look at if you wouldnt mind sharing. Our company is at the moment making a program that will issue our drawings, by putting an issue in the title block, creating a PDF and bound DWG, so maybe we can expand what you've got to include all this.

 

Thanks

  • 1 year later...
Posted
Everyone, i have a lisp routine that does multiple etransmits, the prblem is alot of our clients want bound dwg's. We can have up to 200 drawings to issue at once, so its alot of time to bind each xref, file save as etc. Id like a routine that would do all this for me, so i could set it up on another machine, and have the routine open all drawings, bind the xrefs, and save as a new file (so it doesnt overwrite our drawing with everything bound) One problem i can see is occasionally one of our xrefs may be unloaded, or not found. Not sure how the program could cope with this. Does anyone have a lisp file for this? Thanks

 

 

Hi,

 

I'm looking for a lsp that can do something your talking about. I have a group of drawings that I need to etransmit but I need every drawing to have its own etransmit. At the moment I have to open each drawing and make a etransmit. I have seen the option in etransmit to add drawings but it puts them into one zip file.

We dont have to bind in the xref's so hoping your lisp works

 

Thanks

Stephen

Posted

These days I'd try to steer clear of VBA, especially if you're on 64bit.

 

I use a little add-on to ACad called AutoScript (just do a google for it). Then I have it run the following in a text SCR file on selected drawings:

(vl-load-com)
(setq dwg (vl-filename-base (getvar "DWGNAME"))
     path "C:/TEMP/ISSUE/"
)
(if (not (vl-file-directory-p path)) (vl-mkdir path))
_PURGE _ALL *
_NO
_PURGE _ALL *
_NO
_PURGE _ALL *
_NO
_PURGE _Regapps *
_NO
_AUDIT _YES
(if (setq fn (findfile (strcat path dwg ".DWG"))) (vl-file-delete fn))
(command "._SAVEAS" "" (strcat path dwg ".DWG"))
(if (setq fn (findfile (strcat path dwg ".ZIP"))) (vl-file-delete fn))
(command ".-ETransmit" "_CHoose" "Bound" "_Create" (strcat path dwg ".ZIP"))

It first saves the DWG to that folder (change the folder as needed in the script), since it then even works if someone else has the file open at the time. And I've made an eTransmit setup with the Bind-Xrefs option turned on. No need to have yet more lisp to bind the xrefs.

Posted

Thanks for that, I downloaded the Autoscript exe and through menuload I loaded the cui but when I run the program I get this mesage.

Unknown command "AUTOSCRIPT". Press F1 for help. Any ideas why it doesnt run

Posted

I'm unsure why you had to do the menuload. I just tried it, uninstalled my AutoScript, then reinstalled it (i.e. double clicked the AutoScript-for-AutoCAD.exe file dounloaded from here: http://www.cadig.com/products/autocad-script-pro.php). It works perfectly without me needing to change anything in all 3 versions of ACad installed on my PC (Vanilla 2008, Vanilla 2011 and ACA 2011) - it even added the AutoScript menu item in all 3. And the command opens the AutoScript 2.5 dialog in each.

 

Did you close ACad before installing? Also have you got some strange customization which modifies your workspaces?

Posted

I restarted CAD and that sorted that, I ran Autoscript and loaded the scr you gave me and added a few drawingsAutoscript.JPG

 

I ran the script it then prompted me to select standard etransmit setup, I then selected create transmittal package, it then prompts me for a file save location so I save and it only creates one etransmit of the first drawing on the list. Am I missing out on something I should be doing

 

Thanks

Posted

Thanks for the video help thats great, I'm following the video but when I run it it prompts me for Capture.jpg

 

Maybe its a setting in CAD

 

It looks like a great Lisp if I can get it to work

Posted

I got it working I wasnt calling transmittal setup Bound so rename it and that worked great, thanks for that. I would love to be able to make something like that myself have you had specific training or have just went about learning lisp yourself

Posted

Lisp I've mainly learned from trial-n-error ... the most help I got was on the AUGI site. Once you get into it, it starts to make sense - and there's 10,000's of examples you can find nearly everywhere.

Posted
Lisp I've mainly learned from trial-n-error ... the most help I got was on the AUGI site. Once you get into it, it starts to make sense - and there's 10,000's of examples you can find nearly everywhere.

 

I must start reading up on that, would it be possibe to add the -scalelistedit command to the script

Posted
I must start reading up on that, would it be possibe to add the -scalelistedit command to the script
It the SCR file it would be the "simplest" thing in the world. The SCR is nothing more than the keystrokes you'd have typed yourself at the ACad command line. So to add the -ScaleListEdit, just figure out what keys you'd have pressed to perform it manually and add those into the SCR ... there's nothing "strange" to substitute like when you're doing lisp / diesel macros (a space is still a space, a new line is an enter).

 

If you want to perform more than just a simple keystroke repeat on each DWG, you'll then need to look into Lisp. You use the (command ...) function to send command strings and other data to ACad's command line. The thing is with lisp you can set it to vary the "keystrokes" depending on any number of variables. But if you don't need to vary anything it would be over-kill to do this through lisp's command function.

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