Notice for Xref is unloaded

Notice for Xref is unloaded

Automohan
Advocate Advocate
861 Views
4 Replies
Message 1 of 5

Notice for Xref is unloaded

Automohan
Advocate
Advocate

Need solution for this - we usually unload some xref's for better performance of the file to modify

Before print click, need a warning message should appear that some of the xref's are unloaded do you need to load it

& before print

 

Mistakenly doing publish with unloaded xref's & wasting of time.......

 

thanks

"Save Energy"
Did you find this reply helpful? If so please use the Accept as Solution
0 Likes
862 Views
4 Replies
Replies (4)
Message 2 of 5

scot-65
Advisor
Advisor
Perhaps some conceptual thinking...

Determine the number of xrefs in a given file at startup.
Determine the state of each xref (in this instance unloaded).
Save this information in the dictionary as a list <<may not be necessary...>>.
Set one of the USER variables to the value of the unloaded xrefs.
Write to MODEMACRO this value:
(setvar 'MODEMACRO "$(if,$(=,$(getvar,USERI1),0),Loaded,Unloaded)")
<untested>
Build a command reactor to intercept the XREF command; specifically
CommandEnded/Canceled/Error to <<rebuild dictionary and>> update USERI1.
Optional sub-section in command reactor to intercept PLOT, PUBLISH, etc.
and check the value of USERI1 and invoke an alert.

The USER keys, for the most part, were originally designed to store custom
information for the purpose of displaying the custom value somewhere in
the UI. Suggest setting the user key every time a drawing is opened in case
a third party program interferes (I was guilty of this at one time).

???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes
Message 3 of 5

ronjonp
Advisor
Advisor

Maybe something like this:

(or *unloadedxrefalert*
    (setq *unloadedxrefalert* (vlr-command-reactor nil '((:vlr-commandwillstart . xrefalert))))
)
(defun xrefalert (get info / m)
  (cond	((wcmatch (car info) "*PLOT*,*PUBLISH*")
	 (setq m "")
	 (vlax-for b (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))
	   (if (and (= -1 (vlax-get b 'isxref)) (= 0 (vla-get-count b)))
	     (setq m (strcat "\n" (vla-get-path b) " is UNLOADED!!" m))
	   )
	 )
	 (or (= m "") (alert m))
	)
  )
  (princ)
)
Message 4 of 5

scot-65
Advisor
Advisor
The other day I was assigned to edit someone else's unmaintained
file and was able to purge out 1500 unused blocks. The method you
show iterates thru the blocks inside the reactor, which might cause
a significant delay when calling forward commands PLOT and PUBLISH.

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes
Message 5 of 5

ronjonp
Advisor
Advisor

Agreed that many blocks in a drawing would slow this down. Do you have a better way to approach it?

 

From my testing in the past I've only seen a huge delay when block definitions are in the ten to hundreds of thousands.

0 Likes