Crossref.lsp hasn't been updated in a while, and
there may be new ways to reference objects that
it doesn't take into account.
Nowadays, I use the GetReferenceCount() method in
AcadX, which counts the number of hard references
to a given object. That's the hands-down fastest
way to find out if a given layer is referenced.
// Layer param is an AcadLayer object
(defun IsLayerReferenced (Layer / Result AcadX)
(setq AcadX
(vla-getInterfaceObject
(vlax-get-acad-object)
"AcadX.Application"
)
)
(setq Result
(> (car (vlax-safearray->list
(vlax-variant-value
(vlax-invoke-method AcadX
'GetReferenceCount
Layer
)
)
)
)
0
)
(vlax-release-object AcadX)
Result
)
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005
http://www.acadxtabs.com
AcadX for AutoCAD 2004 Beta 1
http://mysite.verizon.net/~vze2vjds/acadx/AcadX16.zip
"Dan Allen" wrote in message news:40522bb3$1_3@newsprd01...
> Try the code in Tony Tanzillo's crossref.lsp
>
> http://mysite.verizon.net/~vze2vjds/crossref.htm
>
> note the caveats about block creation layer
>
> Dan
> --
> ;;; For reply, change numbers to decimal
>
>
> "Matt Stachoni" wrote in message
> news:ur5450lct4eg74ft64g2m623pm601uiqf6@4ax.com...
> > On Fri, 12 Mar 2004 09:43:44 -0500, "Ken Krupa"
> > wrote:
> >
> > >You could do a Purge of all layers, then (tblsearch "layer"
> > >"Substitute_Layer_Name") to see if it exists. [Make sure
> > >"Substitute_Layer_Name" is not the current layer before purging.]
> >
> > I would never advocate such a detructive method of checking if a layer
> > is referenced. Remember that anything can happein inside the routine
> > that will cause the program flow to fail, and irreparable harm to the
> > drawing.
> >
> > Matt
> > mstachoni@comcast.net
> > mstachoni@bhhtait.com
>
>