Quango1 Posted March 31, 2023 Posted March 31, 2023 Hi All, I was wondering if there was a way to connect one block with attributes to another block with attributes? I currently have a block for manholes which can be used for obtaining the Easting, Northing, Cover Level & Invert Level. I was wondering if i could have a different block that contains attributes for the information below and have them linked so it reads this information from the first block above. Currently i have just used the field information to read each attribute in the first block so that when it moves or i change information the table updates. If anyone has any suggestions it would be much appreciated. Thanks in advance! Quote
BIGAL Posted April 1, 2023 Posted April 1, 2023 When using fields with block attributes there is one gotcha, you have to reassign the Field ID for the attribute in the next block. If you look at the field its ID value refers to the original block no matter how many times you copy. So the way around is must reset the field value each time. This is not what you want but shows a method, of updating the field ID value. ; add 2 attributes and put the value as a field into the 3rd attribute. ; BY AlanH (defun c:test ( / obj lst x ) (setq oldatt (getvar 'attdia)) (setvar 'attdia 0) (command "-insert" "c" (getpoint "\npick point") 1 1 0 (getstring "\nEnter Att1 ") (getstring "\nEnter Att2 ") (getstring "\nEnter Att3 ") "-") (setq obj (vlax-ename->vla-object (entlast))) (setq lst '()) (foreach att (vlax-invoke obj 'getattributes) (princ "\n") (setq lst (cons (strcat "%<\\AcObjProp Object(%<\\_ObjId " (vlax-invoke-method (vla-get-Utility (vla-get-activedocument (vlax-get-acad-object))) 'GetObjectIdString att :vlax-false) ">%).Textstring>%" ) lst )) ) (setq str nil) (setq x (length lst)) (setq str (strcat "%<\\AcExpr " (nth (setq x (- x 1)) lst) " + " (nth (setq x (- x 1)) lst) " + " (nth (setq x (- x 1)) lst) ">%" ) ) (setq x 1 y 4) (foreach att(vlax-invoke obj 'getattributes) (if (= x y) (Vla-put-textstring att str) ) (setq x (+ x 1)) ) (setvar 'attdia oldatt) (princ) ) (c:test) Post a dwg so can see the block please have a few blocks, do you have code already re making tables or is that needed as well. Quote
Quango1 Posted June 1, 2023 Author Posted June 1, 2023 @BIGAL Sorry for the very slow response. I have attached the DWG with the two blocks in question. Like you said at the moment you have to reassign the Field ID each time you copy the block. I'm not sure what the best way to get this working, but a lisp that lets you go through and select which table block reads the Manhole information block then updates it attributes would be good. Not sure if that is possible though. Thanks Setting Out Table Block Working.dwg Quote
BIGAL Posted June 4, 2023 Posted June 4, 2023 I have had a look and a 3rd party water, sewer and drainage package woud be the way to go, as this would do way more and produce schedules of current design. Have a look at Civil Site Design. Looking at your dwg if don't want a 3rd party program, you should use a table with fields. Similar to the block answer. 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.