Jim Clayton Posted September 20, 2021 Author Posted September 20, 2021 I see what the issue is. I selected the source, then the destination objects. Didn't work. Above you're selecting the source, then the source/destination objects. Just tried that and it works. Details. Good news. I think this will work out well. I appreciate all of the help. Quote
ronjonp Posted September 20, 2021 Posted September 20, 2021 1 minute ago, Jim Clayton said: I see what the issue is. I selected the source, then the destination objects. Didn't work. Above you're selecting the source, then the source/destination objects. Just tried that and it works. Details. Good news. I think this will work out well. I appreciate all of the help. Ah yes ... my bad, try this version: (defun c:foo (/ a c e o s) ;; RJP » 2021-09-17 (cond ((and (setq e (car (entsel))) (= 1 (cdr (assoc 66 (entget e)))) (setq s (ssget ":L" '((0 . "INSERT") (66 . 1)))) ) (setq o (vlax-ename->vla-object e)) (ssdel e s) (foreach b (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (setq a (vla-copy o)) (setq e (vlax-vla-object->ename a)) (setq c (vlax-ename->vla-object b)) (vlax-invoke a 'move (vlax-get a 'insertionpoint) (vlax-get c 'insertionpoint)) (foreach at (vlax-invoke c 'getattributes) (vl-catch-all-apply 'setpropertyvalue (list e (vla-get-tagstring at) (vla-get-textstring at)) ) ) (entdel b) ) ) ) (princ) ) Quote
Jim Clayton Posted September 20, 2021 Author Posted September 20, 2021 Even better! Thanks again. Exactly what I needed! Quote
ronjonp Posted September 20, 2021 Posted September 20, 2021 (edited) 7 minutes ago, Jim Clayton said: Even better! Thanks again. Exactly what I needed! Glad to help. Bear in mind this will not preserve rotation, scale etc of blocks that get replaced. Edited September 20, 2021 by ronjonp Quote
cadmaster1004 Posted November 9, 2022 Posted November 9, 2022 (edited) There's a problem with one of the great rehearsals above. When you use the re-study, the block changes as well. Text justify or angle is good to apply, I don't want it to change to a block. ATTRIBUTE_TEXT AND ANGLE MATCH.dwg Edited November 9, 2022 by cadmaster1004 Quote
ronjonp Posted November 9, 2022 Posted November 9, 2022 16 hours ago, cadmaster1004 said: There's a problem with one of the great rehearsals above. When you use the re-study, the block changes as well. Text justify or angle is good to apply, I don't want it to change to a block. ATTRIBUTE_TEXT AND ANGLE MATCH.dwg 101.1 kB · 1 download That is the way the code is written. It copies the source block to the destination block location then matches attribute values. A better way to do this IMO is to open the block editor .. make the changes you want to the attributes. Close the block editor then ATTSYNC. Quote
cadmaster1004 Posted November 9, 2022 Posted November 9, 2022 Thank you so much for your answer. I am familiar with attsync. Then, can't you make the lisp work only for the same block? For example, if you apply Lisp from block A to block B, It doesn't work at all, it only works on the same block. Quote
BIGAL Posted November 9, 2022 Posted November 9, 2022 Are you talking about "Redefine block" very different to copy block. Quote
cadmaster1004 Posted December 7, 2022 Posted December 7, 2022 (edited) On 11/10/2022 at 3:29 AM, ronjonp said: That is the way the code is written. It copies the source block to the destination block location then matches attribute values. A better way to do this IMO is to open the block editor .. make the changes you want to the attributes. Close the block editor then ATTSYNC. I'm very sorry to ask you this again. As I said before, this code is pretty good. However, if I select another block(attribute), that block(attribute) will change completely. so, Can't you let me apply the applicable study only to the same block(attribute)? I looked up the conditional statement for a few days, but I couldn't solve it. ex) Run lisp -> Select A Block -> Select A, B, C, D, E Block Apply applicable lisp only to block A. And attsync is not considered because the properties need to be different between the same blocks. I am sorry for my poor English. Edited December 7, 2022 by cadmaster1004 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.