I have no idea how to write LISPs, so I ended up using ChatGPT to write one for me. I want the lisp to change the selected attributes from ONLY THE SELECTED blocks. However, the lisp applies the command to subsequent block iterations in the order they were created. I've tried explaining to GPT but either I can't explain myself in writing, or GPT doesn't know what it's doing I've attached LISP and test file. Thanks!
Solved! Go to Solution.
Solved by paullimapa. Go to Solution.
Solved by Kent1Cooper. Go to Solution.
So you only want a LISP that will change a "number" to the letter X in your custom block, nothing more.
And this is based on a manual selection by you of 'certain' blocks only? Or is there some other anticipated selection method?
Yes, that's exactly right. I don't know what you mean by an anticipated selection method; if the LISP prompts me to select the blocks, or whether I select the blocks first and then run the LISP... it does the iteration regardless. Don't know if that matters.
Attached is revised AttX.lsp
This will only allow you to select block name: Bubble and change Tag name: NO.
If you want a different block name or tag name change that at the beginning of the code here:
;; Prompt user to select blocks
(setq blknam "Bubble" ; block name
tagnam "NO." ; tag name
If it's the same Attribute and you want it changed to the same value in selected Blocks, and you need to select the Blocks anyway, no routine is necessary. Just select the Blocks and you can change them all collectively in the Properties palette.
Just pick in where it says *VARIES* and type in your X, and they'll all change [and only the selected ones].
I see what you're getting at. I made the adjustments with the attached AttX.lsp.
I incorporated your GetTags function with a minor modification and then created my own PickTag function which is similar to your SelectTag function except it'll now let you pick the Attribute Tag name from a cursor menu or at the command line instead of having to type the corresponding number.
What @Kent1Cooper pointed out is absolutely correct assuming you only select all matching Block names like with the Select Similar option or the Blocks all have matching Attribute Tag names. But if you would like to have the flexibility of selecting a mix of Blocks with different Attribute Tags on the screen then a lisp function would be required.
Note your lisp code acquires the Attribute Tag names from the first Block selected. To select another Tag name selection from a different Block make that selection first and then enter Previous to perform the same operations on the same selection set.
Glad to have helped. Actually this is the first time I’ve seen code generated from ChatGPT that had some pretty legit code…cheers!!!
Can't find what you're looking for? Ask the community or share your knowledge.