Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Is layer occupied

24 REPLIES 24
Reply
Message 1 of 25
coachball8
443 Views, 24 Replies

Is layer occupied

I need to define a list of layers, then check a number of drawings to see if any entities exist on the specified list of layers within the drawing thru lisp. If true, I'll copy the drawings to another location on the server. Anyone got any suggestions? TIA
24 REPLIES 24
Message 21 of 25
Anonymous
in reply to: coachball8

Doesn't work for me either, fwiw -- Autodesk Discussion Group Facilitator "Ken Alexander" wrote in message news:4051d54d$1_1@newsprd01... > > Am I reading the help wrong, or should the layer group code 70 show > a bit code of 64 if the layer is referenced by at least one entity? I > tried it and it doesn't work.
Message 22 of 25
Anonymous
in reply to: coachball8

Thanks Jason. I tried it in Acad2000 and a no go as well. -- Ken Alexander Acad2004 Windows2000 Prof. "We can't solve problems by using the same kind of thinking we used when we created them." --Albert Einstein "Jason Piercey" wrote in message news:40531f1b$1_1@newsprd01... > Doesn't work for me either, fwiw > > -- > Autodesk Discussion Group Facilitator > > > "Ken Alexander" wrote in message > news:4051d54d$1_1@newsprd01... > > > > Am I reading the help wrong, or should the layer group code 70 show > > a bit code of 64 if the layer is referenced by at least one entity? I > > tried it and it doesn't work. > >
Message 23 of 25
Anonymous
in reply to: coachball8

See attached. Rename it to a .lsp file (attached as .txt file for those poor soles surfin' using IE and are declined a down load because security gets in a froth over the .lsp extension). HAGWE, Michael. "coachball8" wrote in message news:30078323.1079086750461.JavaMail.jive@jiveforum2.autodesk.com... > I need to define a list of layers, then check a number of drawings to see if any entities exist on the specified list of layers within the drawing thru lisp. If true, I'll copy the drawings to another location on the server. Anyone got any suggestions? TIA
Message 24 of 25
Anonymous
in reply to: coachball8

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 > >
Message 25 of 25
Anonymous
in reply to: coachball8

[code] (setq Result (> (car (vlax-safearray->list (vlax-variant-value (vlax-invoke-method AcadX 'GetReferenceCount Layer ) ) ) ) 0 ) (setq Result (> (car (vlax-safearray->list (vlax-variant-value (vlax-invoke-method AcadX 'GetReferenceCount Layer ) ) ) ) 0 ) ) [/code] Just a guess; cheers. "Tony Tanzillo" wrote in message news:4053cacf$1_2@newsprd01... > 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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost