PDA

View Full Version : X-REF Manager Auto Re-load???



Adam R.
2005-04-19, 02:51 PM
Hello All,
I'm not sure if I'm finding more ways to be productive or more ways to be lazy. If my boss is reading this then its definitely the first. Here's my problem, I am tired of reloading an xref 50 times a day. Is there a setting that sets the xref to reload automatically after it has been saved? If not I'm open to ideas for a way around this situation.

Thank you,
Adam

madcadder
2005-04-19, 05:41 PM
I have a button that reloads all xrefs and does a qsave after.

^C^C^C.-xref r * qs

tatriest
2005-04-20, 12:52 PM
I would like it if the one-click button would reload ONLY the loaded xref's. When I use the above macro, it loads the unloaded xref's.

Terry

Adam R.
2005-04-20, 02:08 PM
Thanks Tod, This works great for me. 99% of the time we only use two xrefs in each drawing. Now I just have to turn off the auto alert at the bottom of the screen. This is also just one click instead of four, You just saved me 75% of my xref reload time. Thanks again for your help.

Adam

madcadder
2005-04-20, 02:44 PM
Thanks Tod, This works great for me. 99% of the time we only use two xrefs in each drawing. Now I just have to turn off the auto alert at the bottom of the screen. This is also just one click instead of four, You just saved me 75% of my xref reload time. Thanks again for your help.

Adam
Welcome. Anything to save clicks.




I would like it if the one-click button would reload ONLY the loaded xref's. When I use the above macro, it loads the unloaded xref's.

Terry
Now we are talking LISP. Could have time to work on that. STILL WAITING to get these drawings to be checked.

Opie
2005-04-20, 03:04 PM
Now we are talking LISP.

Try this code.


(defun C:RX (/ BLOCKS NEXTBLOCK N) ;; Reload all "loaded" xref's only
;; Richard Lawrence (c) 2005
;; Revised code to include required function
(defun ASC (ELEMENT ENTITY /) (cdr (assoc ELEMENT ENTITY))) ;;; retrieve assoc data from entity
(setq BLOCKS NIL)
(setq NEXTBLOCK (tblnext "BLOCK" t))
(while (/= NEXTBLOCK NIL)
(if (= (logand (ASC 70 NEXTBLOCK) 4) 4)
(if (= (logand (ASC 70 NEXTBLOCK) 32) 32)
(if BLOCKS
(setq BLOCKS (append BLOCKS (list (ASC 2 NEXTBLOCK))))
(setq BLOCKS (list (ASC 2 NEXTBLOCK)))
)
)
)
(setq NEXTBLOCK (tblnext "BLOCK"))
)
(if blocks
(progn
(foreach N BLOCKS
(command "-XREF" "R" N)
)
(if (= (length blocks) 1)
(princ (strcat "\n"(itoa(length blocks))" reference reloaded."))
(princ (strcat "\n"(itoa(length blocks))" references reloaded."))
)
)
(princ "\nNo xref's found.")
)
(princ)
)

This routine will check to see if the xref is currently loaded, if so it will reload it. if it is not loaded, it will not reload it.

I hope this helps.

madcadder
2005-04-20, 03:12 PM
This routine will check to see if the xref is currently loaded, if so it will reload it. if it is not loaded, it will not reload it.

I hope this helps.

Great! Now didn't that just save me the time and trouble.
Now I don't have anything to do.

Still Waiting... tapping fingers on desk.

Opie
2005-04-20, 03:29 PM
Great! Now didn't that just save me the time and trouble.
Now I don't have anything to do.

Still Waiting... tapping fingers on desk.
:Oops: Oh... sorry... let me go back and edit my last post and i'll remove it for you...:wink:

tatriest
2005-04-20, 04:24 PM
I get the following error - no function defintion:ASC

Thanks, Terry

Mike.Perry
2005-04-20, 04:36 PM
I get the following error - no function defintion:ASCHi

See this (http://forums.augi.com/showthread.php?p=112866#post112866) post by "richardl.25628".

Have a good one, Mike

Opie
2005-04-20, 04:44 PM
Hi

Within "richardl.25628" routine try changing the four instances of ASC to ASSOC

Have a good one, Mike
Sorry, i have a routine to get the value of the group code.


(defun ASC (ELEMENT ENTITY /) (cdr (assoc ELEMENT ENTITY))) ;;; retrieve assoc data from entity

tatriest
2005-04-20, 04:45 PM
I get the following error -

bad argument type: fixnump: (70 . 0)

Opie
2005-04-20, 04:50 PM
revised code


(defun C:RX (/ BLOCKS NEXTBLOCK N IMPLIED SSCNT);; Reload "loaded" xref's only
;; Richard Lawrence (c) 2008
(defun ASC (ELEMENT ENTITY /) (cdr (assoc ELEMENT ENTITY))) ;;; retrieve assoc data from entity
(SETQ Implied (SSGET "I" '((0 . "INSERT"))))
(IF (NULL Implied)
(PROGN
(setq BLOCKS NIL)
(setq NEXTBLOCK (tblnext "BLOCK" t))
(while (/= NEXTBLOCK NIL)
(if (= (logand (ASC 70 NEXTBLOCK) 4) 4)
(if (= (logand (ASC 70 NEXTBLOCK) 32) 32)
(if BLOCKS
(setq BLOCKS (append BLOCKS (list (ASC 2 NEXTBLOCK))))
(setq BLOCKS (list (ASC 2 NEXTBLOCK)))
)
)
)
(setq NEXTBLOCK (tblnext "BLOCK"))
)
)
(PROGN
(REPEAT (SETQ SSCNT (SSLENGTH Implied))
(SETQ
NEXTBLOCK (ENTGET (SSNAME Implied (SETQ SSCNT (1- SSCNT))))
)
(if BLOCKS
(setq BLOCKS (append BLOCKS (list (ASC 2 NEXTBLOCK))))
(setq BLOCKS (list (ASC 2 NEXTBLOCK)))
)
)
)
)
(if blocks
(progn
(foreach N BLOCKS
(command "-XREF" "R" N)
)
(if (= (length blocks) 1)
(princ (strcat "\n"(itoa(length blocks))" reference reloaded."))
(princ (strcat "\n"(itoa(length blocks))" references reloaded."))
)
)
(princ "\nNo xref's found.")
)
(princ)
)

tatriest
2005-04-20, 04:54 PM
Thanks Richard and Mike, I pasted the ASC function in and it worked GREAT!!! I'll update my file with your latest revisions with the princ function.


Thanks A LOT !!!!!

Opie
2005-04-20, 04:58 PM
Thanks Richard and Mike, I pasted the ASC function in and it worked GREAT!!! I'll update my file with your latest revisions with the princ function.


Thanks A LOT !!!!!
I just updated it with a little better reporting to the user.

Now, if I could find just out the command or reporting '06 does on its pop-up to say which file has been updated. I could then only update that reference instead of all the references that are loaded.

I'm glad it has helped.

RobertB
2005-04-20, 05:58 PM
Now, if I could find just out the command or reporting '06 does on its pop-up to say which file has been updated. I could then only update that reference instead of all the references that are loaded.I'd say you need to look at the FileDependency object.

Opie
2005-05-04, 08:20 PM
I'd say you need to look at the FileDependency object.
How would someone go about modifing the code executed from the xref balloon?

cwade
2005-05-04, 11:02 PM
Better still is there a variable that gets changed when an X-ref needs updating? I wouldn't mind reloading all x-refs, but I am thinking that I could set AutoCAD to automatically run this command whenever an X-ref needs updating.

RobertB
2005-05-05, 02:17 AM
How would someone go about modifing the code executed from the xref balloon?You cannot.

RobertB
2005-05-05, 02:18 AM
Better still is there a variable that gets changed when an X-ref needs updating? I wouldn't mind reloading all x-refs, but I am thinking that I could set AutoCAD to automatically run this command whenever an X-ref needs updating.Look at the FileDependency object. (Is there an echo in here?) :rolleyes:

Chirag Mistry
2005-05-05, 01:55 PM
Reload an External Reference by selecting it

^C^C(if(not c:reload)(load "reload")) reload

This works great for me, just click on the button and pick the xref.

cwade
2005-05-05, 07:55 PM
Look at the FileDependency object. (Is there an echo in here?) :rolleyes:
Ok, but how on earth do you use it? I don't mess with VBA portions of stuff, because I have yet to figure out how to call it from LISP. If it changed a variable it would work great, beacuse I have a routine that reacts to variables being changed.

kbsheppard
2005-05-20, 03:55 AM
Hi folks, I'm new here (actually my first post) but I've been running this Cad thing for a while now...anyway I just flipped briefly through this thread...ummm ya know the little status bar icon where that baloon thingy originates from, well if you right click it you get an option to reload all xrefs...or is that just an oversimplification???

Adam R.
2005-05-23, 07:55 PM
Not really, that still requires 2 clicks, and I've got it down to one. It doesn't seem like much, but after 500 reloads it is substantial.

Rayllen
2005-06-07, 04:04 PM
revised code


(defun C:RX (/ BLOCKS NEXTBLOCK N) ;; Reload all "loaded" xref's only
;; Richard Lawrence (c) 2005
(defun ASC (ELEMENT ENTITY /) (cdr (assoc ELEMENT ENTITY))) ;;; retrieve assoc data from entity
(setq BLOCKS NIL)
(setq NEXTBLOCK (tblnext "BLOCK" t))
(while (/= NEXTBLOCK NIL)
(if (= (logand (ASC 70 NEXTBLOCK) 4) 4)
(if (= (logand (ASC 70 NEXTBLOCK) 32) 32)
(if BLOCKS
(setq BLOCKS (append BLOCKS (list (ASC 2 NEXTBLOCK))))
(setq BLOCKS (list (ASC 2 NEXTBLOCK)))
)
)
)
(setq NEXTBLOCK (tblnext "BLOCK"))
)
(if blocks
(progn
(foreach N BLOCKS
(command "-XREF" "R" N)
)
(if (= (length blocks) 1)
(princ (strcat "n"(itoa(length blocks))" reference reloaded."))
(princ (strcat "n"(itoa(length blocks))" references reloaded."))
)
)
(princ "nNo xref's found.")
)
(princ)
)

Ok, I'm very new to all of this, and I've never worked with this type of stuff before. I am one of those people who would be greatly affected by having a shortcut to reloading only the loaded XREF's. However, I am not sure how you would go about putting this code into autocad to make it work for simple people like me. I was hoping that someone could explain this simply for me

thank you (in advance)

Mike.Perry
2005-06-07, 09:27 PM
Ok, I'm very new to all of this, and I've never worked with this type of stuff before. I am one of those people who would be greatly affected by having a shortcut to reloading only the loaded XREF's. However, I am not sure how you would go about putting this code into autocad to make it work for simple people like me. I was hoping that someone could explain this simply for meHi

Have a read of this (http://forums.augi.com/showthread.php?p=135685#post135685) post and this (http://forums.augi.com/showthread.php?p=28967#post28967) one.

+

Have a browse of the following threads -

Image transparency (http://forums.augi.com/showthread.php?t=14727)

Total polyline length (http://forums.augi.com/showthread.php?t=8351)

Have a good one, Mike

iainslie
2008-06-13, 07:39 PM
GENIUS! I was hoping I could get direction to write this and here it is! Thanks!


revised code


(defun C:RX (/ BLOCKS NEXTBLOCK N) ;; Reload all "loaded" xref's only
;; Richard Lawrence (c) 2005
(defun ASC (ELEMENT ENTITY /) (cdr (assoc ELEMENT ENTITY))) ;;; retrieve assoc data from entity
(setq BLOCKS NIL)
(setq NEXTBLOCK (tblnext "BLOCK" t))
(while (/= NEXTBLOCK NIL)
(if (= (logand (ASC 70 NEXTBLOCK) 4) 4)
(if (= (logand (ASC 70 NEXTBLOCK) 32) 32)
(if BLOCKS
(setq BLOCKS (append BLOCKS (list (ASC 2 NEXTBLOCK))))
(setq BLOCKS (list (ASC 2 NEXTBLOCK)))
)
)
)
(setq NEXTBLOCK (tblnext "BLOCK"))
)
(if blocks
(progn
(foreach N BLOCKS
(command "-XREF" "R" N)
)
(if (= (length blocks) 1)
(princ (strcat "\n"(itoa(length blocks))" reference reloaded."))
(princ (strcat "\n"(itoa(length blocks))" references reloaded."))
)
)
(princ "\nNo xref's found.")
)
(princ)
)

Opie
2008-06-13, 07:44 PM
Go back to my original post. I have revised the code once more to allow one to select the xrefs to reload or if none are previously selected, all loaded xrefs will be reloaded.