Author Topic: Where layers can be referenced other than Block definition  (Read 2816 times)

0 Members and 1 Guest are viewing this topic.

Coder

  • Swamp Rat
  • Posts: 827
Hello guys,

Where can a layer name be referenced in a drawing other than Block definition?

I have moved objects that lay on a specific layer names to another then after trying to delete the old layer names from the drawing, I received a message :
; error: Automation Error. Object is referenced by other object(s)

Thanks in advance.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Where layers can be referenced other than Block definition
« Reply #1 on: June 06, 2018, 12:59:59 PM »
Can you post the drawing?

Crank

  • Water Moccasin
  • Posts: 1503
Re: Where layers can be referenced other than Block definition
« Reply #2 on: June 06, 2018, 01:35:57 PM »
Hello guys,

Where can a layer name be referenced in a drawing other than Block definition?

[…]
XDATA
Vault Professional 2023     +     AEC Collection

rkmcswain

  • Swamp Rat
  • Posts: 978
Re: Where layers can be referenced other than Block definition
« Reply #3 on: June 06, 2018, 03:11:58 PM »
Not sure if you were including this, but anonymous blocks also.
If you're working in a vertical product (such as Civil 3D), then in styles.

Crank

  • Water Moccasin
  • Posts: 1503
Re: Where layers can be referenced other than Block definition
« Reply #4 on: June 06, 2018, 03:35:28 PM »
Try LAYTRANS to map the stubborn layer to layer 0
Vault Professional 2023     +     AEC Collection

Coder

  • Swamp Rat
  • Posts: 827
Re: Where layers can be referenced other than Block definition
« Reply #5 on: June 06, 2018, 04:27:28 PM »
Can you post the drawing?
Thank you Lee for your kind reply.
After digging into the drawing that I received from the client, I found is that there are attributed blocks in blocks and after adding codes to work around that matter, I got it working correctly now.
Hello guys,

Where can a layer name be referenced in a drawing other than Block definition?

[…]
XDATA
Thank you Crank for your kind reply.
Can the XDATA reference a layer to be prevented from purge? I think XDATA is just a string that represents a layer name in this case nothing else unless I miss something here!.
Can you please clarify your point on this?

Not sure if you were including this, but anonymous blocks also.
If you're working in a vertical product (such as Civil 3D), then in styles.

Thank you, that is a very good point.

rkmcswain

  • Swamp Rat
  • Posts: 978
Re: Where layers can be referenced other than Block definition
« Reply #6 on: June 06, 2018, 04:37:59 PM »
Quote from: Coder
Can the XDATA reference a layer to be prevented from purge? I think XDATA is just a string that represents a layer name in this case nothing else unless I miss something here!.


Yes, absolutely.


From the Customization Guide:





You can attach Xdata to layer 0 referencing a layer, to keep that layer from being purged (since layer 0 can't be purged)... unless of course, someone knows how to remove that xdata.




Coder

  • Swamp Rat
  • Posts: 827
Re: Where layers can be referenced other than Block definition
« Reply #7 on: June 06, 2018, 05:36:41 PM »
Quote from: Coder
Can the XDATA reference a layer to be prevented from purge? I think XDATA is just a string that represents a layer name in this case nothing else unless I miss something here!.


Yes, absolutely.

You can attach Xdata to layer 0 referencing a layer, to keep that layer from being purged (since layer 0 can't be purged)... unless of course, someone knows how to remove that xdata.

That make sense.
Thank you so much.

ahsattarian

  • Newt
  • Posts: 112
Re: Where layers can be referenced other than Block definition
« Reply #8 on: January 23, 2021, 10:39:00 AM »
I've written this, but it doesn't work


Code - Auto/Visual Lisp: [Select]
  1. (defun c:a ()
  2.   (cond ((= (getvar "clayer") "0") (exit)))
  3.   (setq s (tblobjname "layer" "0"))
  4.   (setq en (entget s '("*")))
  5.   (print en)
  6.   (setq app "XLayer")
  7.   (setq code 1003)
  8.   (setq txt (getvar "clayer"))
  9.   (setq en (entget s (list app)))
  10.   (if (assoc -3 en) ;|  #Xdata  |;
  11.     (setq en (subst (list -3 (list app (cons code txt))) (assoc -3 en) en))
  12.     (setq en (append en (list (list -3 (list app (cons code txt))))))
  13.   )
  14.   (entmod en)
  15.   (setq en (entget s '("*")))
  16.   (print en)
  17.   (princ)
  18. )



Would U please help me   ????

Crank

  • Water Moccasin
  • Posts: 1503
Re: Where layers can be referenced other than Block definition
« Reply #9 on: January 23, 2021, 01:09:18 PM »
You need to register your external entity data first, so there is an unique identifier for your own XDATA:
Code: [Select]
(regapp "XLayer")After you've registered this name is entered into the APPID symbol table.
Vault Professional 2023     +     AEC Collection

ahsattarian

  • Newt
  • Posts: 112
Re: Where layers can be referenced other than Block definition
« Reply #10 on: January 24, 2021, 11:56:55 AM »
Thank u very much indeed  !!!   -    It worked !!!