Jump to content

Recommended Posts

Posted (edited)

Hello, is it possible to write the layer name with an Data Field or a Diesel Expressiono?...or better yet, just a part of the layer name, for example the last 4 characters

 

The goal is to have an attribute inside a block that populates automatically when I change the layer of the block

 

Thank you in advance

Edited by itacad
  • 1 year later...
Posted (edited)

Sorry, I made a mistake, I'm writing to this topic again to see if you have any suggestions.
I would like to write the layer on which it is positioned in an attribute.
I would also like to write the last 3 letters of the layer name

Thank you

Edited by itacad
Posted

This should get you started. You can create an attribute in a block and define it as a field. It's called a block placeholder field. The field can take on the value of the block's layer. Make sure you keep the block attributes synchronized and use Regenall to update the field values.

 

The trick is to open the field dialog when you create the attribute. It's next to the Default box in the Attribute pane, at least in my 2021 version.

 

How to filter the layer name and get the last three letters is a separate issue.

Posted

One issue I found with blocks is that %<\AcObjProp Object(%<\_ObjId 2689587840>%).Layer>% the Objid keeps changing so would need a insert lisp anyway. I googled a bit and there was a comment about using diesel in a field with substr but that is as far as I went. 

 

The layer name eg ASDF-123 vs QWERTYUIO-456 how do you get the value of where to start reading the last 3 characters, in lisp is easy as you can get length of string - 3. Not sure how in Diesel.

Posted
11 hours ago, BIGAL said:

One issue I found with blocks is that %<\AcObjProp Object(%<\_ObjId 2689587840>%).Layer>% the Objid keeps changing so would need a insert lisp anyway. I googled a bit and there was a comment about using diesel in a field with substr but that is as far as I went. ...

 

Re: the part I bolded, seems like that would be a deal breaker all by itself. But how would AutoCAD keep track of where to put the field data if it couldn't identify the blocks?

Posted (edited)

CyberAngel it's not a problem if using lisp to insert the block as you can get ID of the (entlast) then as a second step put the field value into the attribute. Have somewhere. I think it was for add 2 attributes and put result into a 3rd attribute.

Edited by BIGAL

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...