Jump to content

block attributes set value


janickovic

Recommended Posts

Hello, 

 

I have a titleblock with attributes,  where I would like to change attributes using lisp. I tried Lee-Mac routiens, tried JTB with no luck, 

i guess it have something to do with the fact my block is dynamic, or something 

(entget (car (entsel)))

Select object: ((-1 . <Entity name: 1746772d820>) (0 . "INSERT") (5 . "DA2") (102 . "{ACAD_XDICTIONARY") (360 . <Entity name: 1746772d830>) (102 . "}") (330 . <Entity name: 1746772eed0>) (100 . "AcDbEntity") (67 . 1) (410 . "01 А2") (8 . "0") (100 . "AcDbBlockReference") (66 . 1) (2 . "*U8") (10 589.0 5.0 0.0) (41 . 1.0) (42 . 1.0) (43 . 1.0) (50 . 0.0) (70 . 0) (71 . 0) (44 . 0.0) (45 . 0.0) (210 0.0 0.0 1.0))

 

i am trying to change the PAGES attribute... btw

 

so there is some trick, and i just cant figure it out. I'd be happe to provide the block, but I am unable to make attachment to post.

 

Thanks for help

Sample.dwg

Link to comment
Share on other sites

Yes the problem is caused by the fact that your block is dynamic, but there are a couple of simple workarounds for this. I cannot open your drawing as it is in a later version of AutoCAD than mine (2012). If you re-post the drawing saved as 2010 or earlier I'll have a look.

 

Is this a one off change, or are you trying to automate updating several instances of the block to be numbered sequentially over several layouts?

Link to comment
Share on other sites

Thanks, 

 

here is a AC2010 file + the script i am using.

its only one block per file i need to change and its in a layout.

 

PS: i cannot use the COM style commands, i am using script in accoreconsole batch commands.

 

Thanks for help

Sample2010.dwg test_attr.scr

Edited by janickovic
Link to comment
Share on other sites

OK. Attached is updated lisp and the drawing I tested it on. I copied the single layout to make three layout to test across multiple layouts. Tested and working.

 

I have enclosed the last part of your "script" into a (c:) defun named test. Once loaded type test. You can rename this to whatever you want. The script finds all blocks in paperspace and filters by the effectivename property to match  "_TITLEBLOCK_MAIN". This is in uppercase to avoid case problems matching strings using the "=" function. The lisp can be run from paperspace or modelspace as I have altered the ssget filter to attributed blocks NOT in modelspace .

 

 

test_attr1.lsp

Sample2010.dwg

Edited by dlanorh
Link to comment
Share on other sites

thanks very much , but as i mentioned i cannot use vlax- methods, they do not work in AutoCad CoreConsole, it have to be pure lisp.

Link to comment
Share on other sites

18 minutes ago, janickovic said:

thanks very much , but as i mentioned i cannot use vlax- methods, they do not work in AutoCad CoreConsole, it have to be pure lisp.

 

I noticed that on my edit. See attached version. You'll need to rename the ext from ".lsp" to ".scr". NOT tested

 

test_attr2.lsp

Link to comment
Share on other sites

21 minutes ago, janickovic said:

Thanks very much!

 

Not a problem. My excuse is that I always use "ss". The (strcase) error was just a brainfart. :lol:

 

Link to comment
Share on other sites

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...