Jim Clayton Posted September 15, 2021 Posted September 15, 2021 Hey guys. I swiped super genius Lee Mac's Match Attributes Lisp and made a few tweaks to fit my personal needs. So far I've added an AttachmentPoint, Color, and TextAlignmentPoint to the list of attribute mods. The one final thing I want to do to it is allow for Text Justification to be matched. I've tried several different ways and the closest I can get is for the text from one attribute to STACK on top of the source attribute. So I think I'm missing an insertion/basepoint or something but I can't seem to figure out what I need to do to make this work. Would greatly appreciate any help. Thanks. *Lisp and sample dwg attached. *defun c:MatchAttribs MatchAttribs.lsp Example.dwg Quote
Jim Clayton Posted September 15, 2021 Author Posted September 15, 2021 (edited) * Edited September 15, 2021 by Jim Clayton Quote
BIGAL Posted September 16, 2021 Posted September 16, 2021 You may need to look at the relationship of the attribute to the insert point of the 1st block picked then apply that to second block based on its insertion point. 1 Quote
Jim Clayton Posted September 16, 2021 Author Posted September 16, 2021 BigAl, Thanks for response and the help is greatly appreciated. I think I understand what you're saying in regards to the Insertion Point being pulled from the Source attribute rather than the Destination attribute. I've been researching/trying to add to the code but currently I haven't found the correct way to go about doing it. Will let you know if I come up with something. Tks. Quote
Jim Clayton Posted September 16, 2021 Author Posted September 16, 2021 I did try using that but it's syncing all of the blocks on the drawing. I was looking for something more isolated that would allow me to select the objects that I wanted to sync. I'm pretty sure I came across a second Lisp that allows me to do this (TEST2) and so I could perform all of the functions that I want to do in Two commands rather than one, but the issue I'm having now is that the MatchAttribs.lsp isn't allowing me to select more than one Destination object. This might be a user error, it might be something in the code, i'm not sure. But if I were to get that sorted out then I think I could probably use the two lisps two achieve what I'm trying to do. MatchAttribs.lsp TEST 2.lsp Quote
BIGAL Posted September 17, 2021 Posted September 17, 2021 In Lee's code he uses nentsel so you may be better writing your own version from scratch you can double up and reselect the the block based on the nentsel point use (ssget Pt '((0 . "INSERT")) ) then (ssname ss 0) so then get the properties of the two objects seperatelly that way get attrib X & Y offset from insertion point, apply that to new block. If you get stuck ask again. Quote
ronjonp Posted September 17, 2021 Posted September 17, 2021 3 hours ago, BIGAL said: In Lee's code he uses nentsel so you may be better writing your own version from scratch you can double up and reselect the the block based on the nentsel point use (ssget Pt '((0 . "INSERT")) ) then (ssname ss 0) so then get the properties of the two objects seperatelly that way get attrib X & Y offset from insertion point, apply that to new block. If you get stuck ask again. Another question related to the the sample drawing, why don't you have a common block? That's the beauty of a block. Seems like you're making more work for yourself. 1 Quote
Jim Clayton Posted September 17, 2021 Author Posted September 17, 2021 It's HydraCAD...nothing makes sense and all logic is out the window. But yes, typically I agree with you. The tag's (blocks) are auto-generated by the program. Quote
Jim Clayton Posted September 17, 2021 Author Posted September 17, 2021 Also thank you both for your help. Looking over all of this information now. Quote
Jim Clayton Posted September 17, 2021 Author Posted September 17, 2021 I figured out what the issue was. After trying and failing multiple times to follow BigAl's instructions, I went back to Mr. Mac's site and looked at the original description for the Lisp. It stated originally that it allowed users to select MULTIPLE attributes but I wasn't able to do that. So I started from scratch, introduced any changes I had made one at a time, and realized that I basically broke it? It does allow you to select multiple attributes one at a time but when I started adding to the properties, it stopped. So, It works like a champ now. The only issue I'm still having with it is that I'd like to be able to use a window to select multiple objects rather than do it one at a time. So I'm trying to get that sorted out without breaking it again. Thanks BigAl, Thanks ronjonp, and Thanks Mr. Mac. Quote
ronjonp Posted September 17, 2021 Posted September 17, 2021 Rather than matching all the properties, why not copy the source block over the ones you want, delete the block then update the attribute content? Quote
Jim Clayton Posted September 17, 2021 Author Posted September 17, 2021 It might be something that I keep in mind for in the future, but for the time being I'm only a few months into learning HydraCAD and trying to become familiar with what is/is not essential. There's a few things that are auto generated for flowing heads and performing calcs and until I get a better grasp of it I don't want to make too many changes, only try to simplify what's in front of me. But, something to keep in mind. Quote
ronjonp Posted September 17, 2021 Posted September 17, 2021 I was thinking something like this: (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)) (foreach b (vl-remove-if 'listp (mapcar 'cadr (ssnamex (ssdel e 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 Error: bad argument type: lselsetp nil Quote
ronjonp Posted September 20, 2021 Posted September 20, 2021 1 hour ago, Jim Clayton said: Error: bad argument type: lselsetp nil I guess I could see that happening if you only select one item? Quote
Jim Clayton Posted September 20, 2021 Author Posted September 20, 2021 The way I ran it was, load lisp, type command, select source object (single), select destination objects (multiple). After making all the selections it throws an error. I tried selecting single/single, then tried multiple/single, then multiple/multiple. Those three terminate the lisp function. Not really sure what the issue is. Quote
Jim Clayton Posted September 20, 2021 Author Posted September 20, 2021 Please see attached. Thanks for the help. If it does work like depicted above then that's exactly what I'm trying to achieve so that would be very helpful. Tks. Sample.dwg FOO.lsp Quote
ronjonp Posted September 20, 2021 Posted September 20, 2021 4 minutes ago, Jim Clayton said: Please see attached. Thanks for the help. If it does work like depicted above then that's exactly what I'm trying to achieve so that would be very helpful. Tks. Sample.dwg 192.11 kB · 0 downloads FOO.lsp 726 B · 0 downloads Not sure .. works fine here: 1 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.