janickovic Posted May 10, 2020 Share Posted May 10, 2020 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 Quote Link to comment Share on other sites More sharing options...
dlanorh Posted May 10, 2020 Share Posted May 10, 2020 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? Quote Link to comment Share on other sites More sharing options...
janickovic Posted May 10, 2020 Author Share Posted May 10, 2020 (edited) 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 May 10, 2020 by janickovic Quote Link to comment Share on other sites More sharing options...
dlanorh Posted May 10, 2020 Share Posted May 10, 2020 (edited) 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 May 10, 2020 by dlanorh Quote Link to comment Share on other sites More sharing options...
janickovic Posted May 10, 2020 Author Share Posted May 10, 2020 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. Quote Link to comment Share on other sites More sharing options...
dlanorh Posted May 10, 2020 Share Posted May 10, 2020 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 Quote Link to comment Share on other sites More sharing options...
dlanorh Posted May 10, 2020 Share Posted May 10, 2020 @janickovic Sorry, two errors found now I've had a chance to run it. Attached is updated test_attr3.lsp Quote Link to comment Share on other sites More sharing options...
janickovic Posted May 10, 2020 Author Share Posted May 10, 2020 yes, i was just about to post it worked after two "typos" Quote Link to comment Share on other sites More sharing options...
janickovic Posted May 10, 2020 Author Share Posted May 10, 2020 Thanks very much! Quote Link to comment Share on other sites More sharing options...
dlanorh Posted May 10, 2020 Share Posted May 10, 2020 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. Quote Link to comment Share on other sites More sharing options...
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.