itacad Posted March 10, 2023 Posted March 10, 2023 (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 March 10, 2023 by itacad Quote
itacad Posted July 24 Author Posted July 24 (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 July 24 by itacad Quote
CyberAngel Posted July 24 Posted July 24 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. Quote
BIGAL Posted July 25 Posted July 25 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. Quote
CyberAngel Posted July 25 Posted July 25 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? Quote
BIGAL Posted July 25 Posted July 25 (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 July 25 by BIGAL Quote
Recommended Posts
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.