TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Fabricio28 on November 23, 2012, 01:57:57 PM

Title: How to delete Xref-dependent layer?
Post by: Fabricio28 on November 23, 2012, 01:57:57 PM
Hi guys,
I want to delete Xref-dependent layer.
AutoCAd says I can't delete it.
I want to delete them. How can I do that?

Thank in advance.
Title: Re: How to delete Xref-dependent layer?
Post by: Coder on November 23, 2012, 02:37:31 PM
use command laydel
Title: Re: How to delete Xref-dependent layer?
Post by: Fabricio28 on November 23, 2012, 03:36:59 PM
It is impossible to use command laydel.
Because the Xref is attached as a block.

Is there other possibility?

Thanks
Title: Re: How to delete Xref-dependent layer?
Post by: Jeff_M on November 23, 2012, 03:39:43 PM
Open the Xref, remove the layer from that drawing, save, close, reload Xref
Title: Re: How to delete Xref-dependent layer?
Post by: Fabricio28 on November 23, 2012, 05:36:10 PM
Hi Jeff_M

Thanks for replay...

I can't do that. Because the Xref drawing contain layer that I can't remove.

On the other hand, I won't need all layer in the layer-Xref's drawing.

Regards
Title: Re: How to delete Xref-dependent layer?
Post by: Lee Mac on November 24, 2012, 07:08:04 AM
Freeze the XRef layers that you don't need?
Title: Re: How to delete Xref-dependent layer?
Post by: irneb on November 24, 2012, 07:29:07 AM
I don't understand ... an xref-dependent layer means that layer comes from the xreffed DWG file. It's not inside the current DWG, so you cannot delete it directly inside the current DWG. If you don't want that layer, then delete it from the xreffed DWG (that's where it IS). Or detach the xref so it doesn't bring any of its layers into the current DWG.

If you want to keep it inside the xreffed DWG, but not show it in the current yet still show some other layers from the xref, then as Lee's stated: Freeze/Off/VPFreeze the layer so it doesn't appear in the current drawing's graphics. Appart from the above 2 methods (delete / detach) there is no way to get rid of the layer in the Layer Manager list in the current DWG. Either live with it, or don't use xrefs.

Remember: An XRef is a link to another DWG, it's just implemented as a special type of block. So you'll see the stuff that's contained in the other DWG. But they'll be read-only since they are simply linked to from the current DWG - they're not imported (as in Insert --> browse). They're still part of the other DWG only shown in this one as well.

Edit: If by "delete" you mean you want to remove the overriden settings for it in the current DWG. Thus reloading its colour/linetype/etc. from the original xref: Then there's an issue with that. You'll need to fiddle around with VisRetain, and save the properties of the other layers so you can restore them back again. Or you'll need to use ObjectDBX to read the layer's properties from within the xref DWG then apply those properties to the dependent layer.
Title: Re: How to delete Xref-dependent layer?
Post by: Lee Mac on November 24, 2012, 08:03:35 AM
Thank you for providing a far more thorough response Irneb  :-)

Edit: If by "delete" you mean you want to remove the overriden settings for it in the current DWG. Thus reloading its colour/linetype/etc. from the original xref: Then there's an issue with that. You'll need to fiddle around with VisRetain, and save the properties of the other layers so you can restore them back again. Or you'll need to use ObjectDBX to read the layer's properties from within the xref DWG then apply those properties to the dependent layer.

The following program may help in that respect:

http://lee-mac.com/resetxreflayers.html (http://lee-mac.com/resetxreflayers.html)

Title: Re: How to delete Xref-dependent layer?
Post by: irneb on November 24, 2012, 08:26:02 AM
I've actually just thought of a non-programming way of performing that selective layer reload idea (probably not the first guy to think of this though):
Title: Re: How to delete Xref-dependent layer?
Post by: Fabricio28 on November 25, 2012, 10:06:47 AM
Thank you guys for replay,

Quote
I've actually just thought of a non-programming way of performing that selective layer reload idea (probably not the first guy to think of this though):
Make a backup copy of the xref DWG file.
LayDel the layers you want to reload inside the XRef.
Save the xref and reload into the containing DWG.
Close the containing DWG.
Restore the backup of the xref.
Reopen the containing DWG ... those layers should now have loaded as if they are new layers.

Thanks for the tip, irneb. I'll do that, maybe it works.
But I thought that had other way to do that, like a lisp LayDel xref.

And also thank you Lee Mac.
I'll take a look into your code and I let you know if it works.

Best Regards.
Title: Re: How to delete Xref-dependent layer?
Post by: Fabricio28 on November 25, 2012, 10:17:14 AM
I have a main file,about 50 layers. And I have to create other projects through this main file.
The problem is, I don't need all layers to create other projects, I just need some of them.

And my question is How to delete Xref dependent layers?

Because I have a lisp that freeze Xref dependent layers, and I thought that had delete Xref layers.

Thank in advance.
Sorry for my poor english.
Title: Re: How to delete Xref-dependent layer?
Post by: irneb on November 25, 2012, 11:56:03 PM
Again ... that is imposible. The only way you can "delete" that layer is to delete it from the main file. That's why it's called "dependent", it "depends" on the xref, it is not actually part of the current drawing.
Title: Re: How to delete Xref-dependent layer?
Post by: Fabricio28 on November 26, 2012, 05:27:10 AM
Quote
Posted by: Lee Mac
« on: November 24, 2012, 08:03:35 am »

Thank you for providing a far more thorough response Irneb

Thanks irneb. I get it.
I was just explaining my task.

Best Regards
 :lol: