Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

layer name in block attribute

17 REPLIES 17
SOLVED
Reply
Message 1 of 18
abr6304
3482 Views, 17 Replies

layer name in block attribute

Sorry for my english
I am looking to obtain automatically in the fields attribute of a block name the layer on which it is inserted.
Is this possible?
Thank you in advance for your answers

17 REPLIES 17
Message 2 of 18
pendean
in reply to: abr6304

You want the field inside the block to identify what layer that same block is on?
Message 3 of 18
abr6304
in reply to: pendean

I must draw many cables on a plane, everyone is on a separate layer and I have to put labels on each cable to identify it.

So I have a "attribute- block" that I have to insert on the plane, put on the right layer (the same as the cable) and then complete it with the name of the cable (it's also the name of the layer).
What I seek is that the block is complete alone when changing layer.

Do you think it's possible ?

Message 4 of 18
dmfrazier
in reply to: abr6304

I'm not sure if your concept can work or not, but you might be able to achieve your goal using an MLeader instead of an attributed block.

In the text of the MLeader, insert a Field that references an Object, select your Polyline object, select the Layer property, and set the Format.

 

When the Polyline's layer is changed (or the layer is renamed), the text in the MLeader will update after a regen.

 

If necessary, you can use DataExtraction to create a table listing the text content of each MLeader. 

Message 5 of 18
pendean
in reply to: abr6304

is this Electrical or Data cabling? You might find AutoCAD Electrical worth upgrading to just for that function.
Message 6 of 18
abr6304
in reply to: dmfrazier

Thank you for your reply but I can not use Mleader because the design of the label is fixed actuelement it consists in the block surrounded by an attribute of a polyline on a Wipeout to hide the cable under the label.
When I replace the attibut by the field it does not work I have to put the field on the label so three entities: the cable, the label and the field!
Message 7 of 18
abr6304
in reply to: pendean

These are fiber optic cable but I need to develop a solution on AutoCad "basic" we do not have AutoCAD Electrical
Message 8 of 18
cadwomen
in reply to: abr6304

mayby you post a sample

 

 

cw

If my post answers your question, please mark it as an Accepted Solution, so that others can find answers quickly!
Message 9 of 18
dmfrazier
in reply to: abr6304

"I can not use Mleader because the design of the label is fixed..."

 

"Fixed" by what?  What is forcing you to use the current label design?  What do you loose if you change it?

 

Please post a DWG file containing the block you are trying to use.

 

Note:

1. It is possible to create an MLeader that has no "leader" portion, and also has a background mask to act like a "wipeout".

2. You can also use MText to do essentially the same thing.

Message 10 of 18
pendean
in reply to: abr6304

How do you do all this now? Be very detailed in your response please, use command names and functions.
Message 11 of 18
abr6304
in reply to: dmfrazier

The design of the label is fixed because I belong to a company with several drawing office here and everything is standardized so that each office uses the same SYMBOLS so I can not move to the appearance of the label in printing, but I try to make use of the preferred designer.

I attach a small snippet of the type of plan that I have done with how I made labels for the moment (field + block)

Thanks for your answers

Message 12 of 18
abr6304
in reply to: cadwomen

I attach a small snippet of the type of plan that I have done with how I made labels for the moment (field + block) but I would not have two bodies but one.
Thank you in advance for your answers

Message 13 of 18
abr6304
in reply to: pendean

In English below

Ok je vais détailler :
J'ai créé un block sur le layer 0
Dans ce block j'ai d'abord une Wipeout et ensuite une polyline par dessus, le tout forme une "étiquette vide"
J'insère le block sur le layer du câble à repérer, ensuite je crée un field qui "lit" le layer du bloc.
Finalement je fait un regen et le field indique le layer du bloc
Mais je voudrais ne plus avoir deux entités ( un block et un field ) mais une seule que je pourrait insérer sur le le câble et qui "lirait" le layer du câble et non pas celui du bloc "étiquette"
Je joins un extrait du type de plan à réaliser avec ma manière actuelle de travailler
D'avance merci pour vos réponses

 

In english (auto translate)

Ok I will detail:
I created a block on layer 0
In this block I first have a Wipeout then a polyline over, the whole forms a "blank label"
I insert the block on the layer of the cable to identify, then I create a field that "reads" the block layer.
Finally I made a regen and field indicates the block layer
But I would not have two entities (a block and a field) but one that I could insert the cable and "read" the layer of the cable (a polyline) and not the block layer
I enclose an extract from the type of plan to achieve with my current way of working
Thank you in advance for your answers

Message 14 of 18
dmfrazier
in reply to: abr6304

Thank you for the detailed description.

 

If I understand you correctly...

You can certainly modify the block (Tete-de-cable-auto, for example) by adding the MText with the Field, and then editing the Field to report the layer of the Polyline within the block. Currently the Polyline within the block is on layer Tete-cable, but you have said you want the Field to report the name of the layer on which the block is inserted (a layer named for a cable identifier).  In order for that to work, that Polyline will have to be placed on the layer you want the Field to report.  This means you would have to have a different block definition for each different layer name.

 

Unfortunately, once the MText with the Field is added to the block definition (via Refedit or Bedit), there is no way to point the Field to a specific insert of that block to get to its layer.  (You can't point to the thing that you are currently editing.)

You could try making a "compound" block by combining an insert of the block (on the correct layer) and the MText with the Field pointing to the block insert's layer, but if the same block might be inserted on several different layers within the same DWG, you would still have to produce a unique block definition for each different layer.

 

You might be able to achieve a single object with functionality similar to this by creating a Dynamic Block with multiple visibility states, in which each has a piece of Text or MText containing a layer name (cable identifier) which the user would select from a drop-down list.  But with this method you would not get the automation I think you desire.

 

You might also look into using a Group to keep together your label block insert and its associated MText+Field.

Message 15 of 18
abr6304
in reply to: dmfrazier

Ok

perfect

This  solution works perfectly
I have a single entity, a group, that I can copy as many times as necessary and updates with a simple regen giving the name of the layer in the field on which the label is

That's what I was looking for

 

Thank's for all

Message 16 of 18
cadwomen
in reply to: abr6304

Morning

 

but with this , you have to care all time that you change the Layer of the Block also ?

isent it mayby easyer to make a linetype with the code inside ?

 

or is there a tool what make you are a lable wtih a link to the objekt line

 

cw

If my post answers your question, please mark it as an Accepted Solution, so that others can find answers quickly!
Message 17 of 18
massimo.corradi
in reply to: abr6304

When you are inside the block editor and you define an attribute (with ATTDEF), there is a "insert filed" button just right of the "Default" vaule. There you can, under field names choose "BlockPlaceholder" , then under Block Reference Property  choose "Layer". That will show the layer where the block is inserted - if I understood you well. Do not forget to Regen to update those attributes after you changed the layer.

 

Message 18 of 18
abr6304
in reply to: massimo.corradi

Wonderful solution!
Simple, clean, clear
Exactly what I like Smiley Very Happy
A big thank you

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

Post to forums  

Autodesk Design & Make Report

”Boost