Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.
Hi All. First time poster.
I'm looking for something I feel should be pretty easy, but just not finding it. I need to get an Attribute value from one block and paste it into multiple different blocks (different TAG).
Currently routine is:
- Double Click Source Attribute
- Ctrl C
- Mouse over to Enhanced Att Editor
- Click OK to close
- Select all destination Blocks
- Find appropriate Att in the Propeties
- Ctrl V
At the very least I'd like to be able to:
- Select tool (or type command),
- Click on any visible Attribute and have its value copied to the clipboard
- Select all destination Blocks
- Find appropriate Att in the Propeties
- Ctrl V
I'm mostly just trying to eliminate the whole Enhanced Att Editor part, but if anyone has any better suggestions, I'm all ears. I have to do this a lot and any eliminated clicks, keys, or mice are helpful.
It would be super awesome to eliminate the Ctrl V at the end but I'm sure that would kick up the complexity a bit.
Solved! Go to Solution.
Solved by ВeekeeCZ. Go to Solution.
@jason.lEZRWT wrote:
It would be super awesome to eliminate the Ctrl V at the end but I'm sure that would kick up the complexity a bit.
If the target blocks are on the same drawing, there would be no need to Ctrl C and Ctrl V at all. It couldn't be that hard to write a code that is suited to your requirements. But what do you think is missing here? If we could only see a sample drawing.... 🤔
A simple code could be like this
(defun c:tf (/ astc)
(vl-load-com)
(setq astc (vla-get-textstring
(vlax-ename->vla-object
(car (nentsel "\nSelect Text: "))))
)
(while (setq trgt (vlax-ename->vla-object (car (nentsel "\nText to change: "))))
(vlax-put-property trgt 'TEXTSTRING astc)
)
)
HTH
It doesn't eliminate the Ctrl+V part, but at least you can skip the Attribute-editor middle-man, this way:
(cdr (assoc 1 (entget (car (nentsel "\nSelect Attribute to get value from: ")))))
That will put the contents in the command line, whence you can Ctrl+C copy it for pasting in at the Properties palette. I'm sure there's a way to feed it to the clipboard for you instead of [or in addition to] the command line [so you don't need to do the Ctrl+C part] -- I'll let you Search for that.
EDIT: For brevity, at least, >this< looks promising as a way to do that.
Thank you so much for getting back. Here's the details and a sample drawing.
I'm working on Wiring Schematics. The wires need to be associated with the Source and Destination connectors. The connectors have attribute Ref_Des (shown in green). The wires have attributes SOURCE_REFDES and DEST_REFDES. The connector attribute needs to be copied to the wires SOURCE_REFDES or DEST_REFDES respectively.
As noted below, I'm currently copying the connector REF_DES via Enhanced Att Editor, selecting all applicable wires, and pasting the value via the properties window.
Current Routine. Didn't note before that there's some ESCs in there too.
Select the wires first, then pick a source and desc. Or just one of them, and RT click for the other....
(vl-load-com) (defun c:WC ( / w s d i e) (princ "Select wires, ") (setq w (ssget '((0 . "INSERT")))) (and (setq s (car (nentsel "\nSource: "))) (setq s (cdr (assoc 1 (entget s))))) (and (setq d (car (nentsel "\nDestination: "))) (setq d (cdr (assoc 1 (entget d))))) (if (and w (or s d)) (repeat (setq i (sslength w)) (setq e (ssname w (setq i (1- i)))) (and s (vl-catch-all-apply 'setpropertyvalue (list e "SOURCE_REFDES" s))) (and d (vl-catch-all-apply 'setpropertyvalue (list e "DEST_REFDES" d))))) (princ) )
Just learned that trick this morning. It's a good tip. I need to get in the habit of that one. Just incorporated you program. Works like a charm! Saves a ton of time.
Why not do this as 1 line no need for "and", the description could be more like this.
(setq s (cdr (assoc 1 (entget (car (nentsel "\nPick Source Attribute: "))))))
@Sea-Haven wrote:
Why not do this as 1 line no need for "and", the description could be more like this.
(setq s (cdr (assoc 1 (entget (car (nentsel "\nPick Source Attribute: "))))))
The AND prevents the ENTGET from failing when nothing was selected.
Yes, could be more descriptive but why?! It's a very specific tool for this job only.
I try to always be descriptive for picks after all the next time it gets ran could be months away and user forgot what to do. Also doing paid work I never know who is going to be using it, including the new kid that started yesterday. I had 8 staff and would occasionally get "how do I run it again"
Any one also reading code can follow the sequence pretty easy.
Can't find what you're looking for? Ask the community or share your knowledge.