Jump to content

Recommended Posts

Posted
I went through that a while back and came up with this AWSOME lisp to Detach/Audit/bind/Purgeall. It can handle nested, unloaded, and unresolved xrefs. You MUST put a blank dwg named dummy.dwg in one of your search path folder for it to work.

 

See my thread here:

http://www.cadtutor.net/forum/showthread.php?t=13141

 

I could be wrong here, but aren't just running the xref binding just 3 times ? Or am i overlooking something ?

  • Replies 131
  • Created
  • Last Reply

Top Posters In This Topic

  • erik_NL

    24

  • JeepMaster

    18

  • rkohan

    12

  • Lee Mac

    10

Posted
I could be wrong here, but aren't just running the xref binding just 3 times ? Or am i overlooking something ?

I don't quite understand your question. My lisp audits the dwgs, binds them all, then purge the drawings 3 times.

Posted
I don't quite understand your question. My lisp audits the dwgs, binds them all, then purge the drawings 3 times.

 

that's indeed my question. euhm, i mean if the drawing has 4 xref's, one will not be binded ?

 

-- edit --

Nevermind, i wasn't looking as well as i should have.

Guest LElkins
Posted

Good Morning Ladies and Gents

 

I now have it so it will allow for multiple drawing select.

 

Extract the dvb file from the zip.

Place the dvb anywhere that you want, on the server if more users need it. Then create a custom button and add the macro

^C^C-vbarun;"dvb location/AutoArchive.dvb!Start";

where dvb location is the path to the dvb file. Ensure that you use / rather than \ in the file path.

 

Ensure that all unloaded/unreferenced xrefs are removed prior to using this tool.

When saveas it will create a directory named as YYMMDD in the selected directory.

Ensure that you have closed all drawing, and just start a new drawing when running the tool.

Your AutoCAD session will not be unusable for a short period of time, which will differ dependant on the number and size of drawings that you have selected. This time should be minimal.

 

 

Let me know if you have any problems or make any modifications.

 

If anyone would like a detailed description of how to use it then please PM with your email add and I will forward an email.

 

Cheers

 

Please note that the attach vba script is provided as is, and you use at your own risk. Although it has been tested thoroughly, it is impractical to test each possible scenario.

Posted
Good Morning Ladies and Gents

 

I now have it so it will allow for multiple drawing select.

quote]

 

LElkins,

 

some short testing done, time ain't on my side these week. Getting a error on the viewport locking part.

 

testingmethod; Did a qnew drawing, run the program, selected the options. Debug said error in the bold line;

 

If VpLockBtn.Value = True Then
Dim vp As AcadEntity
For Each vp In ThisDrawing.PaperSpace
[b]If vp.ObjectName = "AcDbViewport" Then
[/b]vp.DisplayLocked = True
End If
Next
End If

Guest LElkins
Posted

OK. Did the previous single drawing version work ok?

Is there a VP in the new drawing paperspace?

 

Cheers

Posted

Yes, there is a viewport in the drawing. Looks like it ain't depending on the viewport routine ( again quick testing ) but at the end of the routine ( the complete routine ).

I just did a real life test with the viewport option NOT selected and after all the drawings were done there was a error. Hope you can do something with this info.

Guest LElkins
Posted

I will look into it. I have been running it now for a few days and have been testing it on various systems and i working fine.

 

Will let you know when I come up with a fix.

 

Cheers

Guest LElkins
Posted

Out of curiosity, did you select one of the save options, either to saveas or overwrite the original?

 

Cheers

Posted
Out of curiosity, did you select one of the save options, either to saveas or overwrite the original?

 

Cheers

 

Yes,

I did "overwrite the original".

can do some more testing after the break :)

 

-- Edit --

By selecting multiple drawings,

I can only select one drawing at the time, isn't there a solution to select all in dir or just as in Explorer with shift and/or ctrl.

Posted

If you need any help or explanation of this then please ask.

 

Cheers

 

Hi! LElkins, Ive succesfully used the script to bind files you where so kind to post... :)

The problem is, that the script is not binding all of my files. Ive checked those files and they dont seem to have any problem in the xrefs, since Ive tried to do the binding manually with the "-xref" and "b" commands and it works perfectly. Do you have any idea why this could be happenning?

Any help would be really apreciated.

Guest LElkins
Posted

I will have a look this weekend if I get a chance.

 

Cheers

Posted
I will have a look this weekend if I get a chance.

 

Cheers

 

FYI, i'm running acad2008 and have no problems. Maybe something to look for ?

Posted

Tried in acad 2008 using the same files , but they didnt work either...

Posted (edited)

Hi, i havent been succesful w my problem... im sending you the script file since i had to make some changes to it, because i was getting an error... (basically just not locking the VP) but the thing is, it works in some of the files but only on like one out of ten...

It is opening all the files and it appears to be doing everything on the script but then i open it and the references are there. Sometimes the size of the file changes so i guess it did purge, but not the bind...

 

I have never used a dvb so im sticking w ths script for now...i hope you could help me out...

Thanks a lot!

 

Im copying the text of the cript im using here:

 

-purge
all
*
n
audit
y
-xref
b
*
-purge
all
*
n
audit
y
-layer
lock
*
zoom
Extents
tilemode
0
mview
l
on
all
pspace
zoom
extents
qsave
quit

IssueRoutine.scr

Edited by SLW210
Guest LElkins
Posted
Hi, i havent been succesful w my problem... im sending you the script file since i had to make some changes to it, because i was getting an error... (basically just not locking the VP) but the thing is, it works in some of the files but only on like one out of ten...

It is opening all the files and it appears to be doing everything on the script but then i open it and the references are there. Sometimes the size of the file changes so i guess it did purge, but not the bind...

 

Sorry Karen, I had assumed you were referring to the dvb.

When using this script, ensure that you have no unreferenced external references, or unloaded external references, as this will throw an error and it will skip the remaining xrefs. The reason it is not locking the viewport is because I had added the lock layers before lock viewports. See the updated attached script and let me know how things go.

 

Thank you.

Guest LElkins
Posted

ArchiveRoutine.zip (24.0 KB, 6 views)

 

6 views, but only 1 person comments? Anyone else?

I am still working with it to try and improve it, but if anyone else can add some input or advise, that would be great.

 

Thank you.

 

Have a great day all.

Posted
ArchiveRoutine.zip (24.0 KB, 6 views)

 

6 views, but only 1 person comments? Anyone else?

I am still working with it to try and improve it, but if anyone else can add some input or advise, that would be great.

 

Thank you.

 

Have a great day all.

 

will try to take a dive into it. But first some excersises from the course i toke. AutoCAD Customizing :-)

 

Edit -

I think this lisp is to much for me for a quick look. I'm going to look further in the VBA as posted as that's the language i want to learn.

Posted (edited)
Hi, i havent been succesful w my problem... im sending you the script file since i had to make some changes to it, because i was getting an error... (basically just not locking the VP) but the thing is, it works in some of the files but only on like one out of ten...

It is opening all the files and it appears to be doing everything on the script but then i open it and the references are there. Sometimes the size of the file changes so i guess it did purge, but not the bind...

 

I have never used a dvb so im sticking w ths script for now...i hope you could help me out...

Thanks a lot!

 

Im copying the text of the cript im using here:

 

-purge
all
*
n
audit
y
-xref
b
*
-purge
all
*
n
audit
y
-layer
lock
*
zoom
Extents
tilemode
0
mview
l
on
all
pspace
zoom
extents
qsave
quit

My lisp code is somewhat similar to your script and you can easily modify it to your needs. It has more error traps and it can handle unloaded/unreference/unresolved xrefs. Here's the code again:

(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)
   )
 )
)

If you need help using lisp, just let me know. You need to put a blank dwg named "dummy.dwg" in your search path. See page 2 Post #20.

Edited by SLW210
Guest LElkins
Posted

Good Afternoon Ladies, Gentleman and children of all ages.

 

Sorry to keep bumping this and not letting the thread die, but I have now adjusted the vba, again, and it will now handle unloaded xrefs, and shouldn't (fingers crossed) throw any error messages.

The listbox will now have a horizontal scroll where necessary.

 

Extract the dvb file from the zip.

Place the dvb anywhere that you want, on the server if more users need it. Then create a custom button and add the macro

^C^C-vbarun;"dvb location/Prepare.dvb!Start";

where dvb location is the path to the dvb file. Ensure that you use / rather than \ in the file path.

 

Let me know if you have any problems.

 

Cheers

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