cabltv1 Posted February 11, 2009 Posted February 11, 2009 Please help! I need a routine that will do the following... 1) Click on a block. The block has 2 TAGs. TAG 1: NODE_ID TAG 2: AMP_ID 2) Then I want to click on another clock that has 1 TAG. Tag: SIG_FROM The "SIG_FROM" attribute needs to have a dash between the source TAGs "NOD_ID" & "AMP_ID". Example: 1st block (Source) TAG 1: NODE_ID = 1234 TAG 2: AMP_ID = 1A2B 2nd block (Destination) Tag: SIG_FROM = 1234-1A2B (No spaces on either side of dash) Thanks in advance for any help you can give me. Quote
dbroada Posted February 11, 2009 Posted February 11, 2009 does this thread help? http://www.cadtutor.net/forum/showthread.php?t=32085 and if you give your threads pertinent titles the search engine would have picked it up in the similar threads at the bottom of this page. Quote
cabltv1 Posted February 11, 2009 Author Posted February 11, 2009 Sorry about the Title. The code from the link you provided works great except it takes 2 attributes from the first block and updates 2 attributes in the second block. What I need is 2 attributes from the first block to be combined with a dash in between and update 1 attribute in the second block. Sorry for the confusion. Quote
Lee Mac Posted February 11, 2009 Posted February 11, 2009 I'm sure you have requested something like this before in which the two attributes are strung together to form the input for the third... Quote
Lee Mac Posted February 11, 2009 Posted February 11, 2009 But, if you really can't work it out... Do you want the destination block to be a multiple selection or maybe an automatic update? Quote
Lee Mac Posted February 11, 2009 Posted February 11, 2009 Thought I'd seen it before.... Could this not be modified in some way? http://www.cadtutor.net/forum/showthread.php?t=31967 Quote
Lee Mac Posted February 11, 2009 Posted February 11, 2009 Anyhow... gives me a bit of practice I suppose: (defun c:cabltv (/ blk aEnt aEntLst nID aID nAt eLst dEnt dEntLst) (if (setq blk (ssget "_:S" (list (cons 0 "INSERT") (cons 66 1) (if (getvar "CTAB")(cons 410 (getvar "CTAB")) (cons 67 (- 1 (getvar "TILEMODE"))))))) (progn (setq aEnt (entnext (ssname blk 0))) (while (not (eq "SEQEND" (cdadr (setq aEntLst (entget aEnt))))) (cond ((eq "NODE_ID" (cdr (assoc 2 aEntLst))) (setq nID (cdr (assoc 1 aEntLst)))) ((eq "AMP_ID" (cdr (assoc 2 aEntLst))) (setq aID (cdr (assoc 1 aEntLst))))) (setq aEnt (entnext aEnt))) (setq nAt (strcat nID (chr 45) aID)) (if (setq ss (ssget (list (cons 0 "INSERT") (cons 66 1) (if (getvar "CTAB")(cons 410 (getvar "CTAB")) (cons 67 (- 1 (getvar "TILEMODE"))))))) (progn (setq eLst (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))) (foreach e eLst (setq dEnt (entnext e)) (while (not (eq "SEQEND" (cdadr (setq dEntLst (entget dEnt))))) (if (eq "SIG_FROM" (cdr (assoc 2 dEntLst))) (entmod (subst (cons 1 nAt) (assoc 1 dEntLst) dEntLst))) (setq dEnt (entnext dEnt))))) (princ "\n<!> No Destination Blocks Selected <!>"))) (princ "\n<!> No Attributed Block Selected <!>")) (vl-cmdf "_regenall") (princ)) Quote
cabltv1 Posted February 11, 2009 Author Posted February 11, 2009 Lee, As usual it works like a charm! You may have given me the code (or similar code) before. I have been so enveloped with this project I lost track a little as to what I had and had not completed on my list of things to do. It seemed familiar to me too. I think this is the last thing on my list that needs to be completed. Thanks for all of your help! You have been of invaluable help to me. Quote
Lee Mac Posted February 11, 2009 Posted February 11, 2009 Thank you for your kind words cabltv - they are much appreciated. Glad it can save you some time in the long run 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.