fromMlm Posted October 9 Share Posted October 9 Hi all, Again I have found a lisp Lee Mac made that copies a field into a dimension, "copyfield", but it requires that the field already exists... So is there a way to create a field from an attribute in a block and then insert the field directly into a dimension? Thanks in advance. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted October 9 Share Posted October 9 You can do a dimension then update the dimension string with a field just double click the dimension and a field is an option. In image move corner point and dim updates both normal length and area. You need to explain more what is in the field, then could speed up the process with a lisp. Quote Link to comment Share on other sites More sharing options...
fromMlm Posted Thursday at 07:39 AM Author Share Posted Thursday at 07:39 AM Thanks for your answer! I have rebar block with a rebar number called "Littera". I would be great if I could place that directly into the dimesnsion, which works as a marker for in what area the rebars are to be placed. Can that also be done for multiple attributes into the same dimension? block.dwg Quote Link to comment Share on other sites More sharing options...
BIGAL Posted Thursday at 11:13 PM Share Posted Thursday at 11:13 PM In simple terms if you want say all attributes into the dim can be done by just using a text answer, it will not update. but you can run again. For every time you want to do this using a field you have to get the ID of the attributes in the block selected, these are different for every block. Ok good news can be done, do you want the 25 12 s200 A326a as answer ? Quote Link to comment Share on other sites More sharing options...
fromMlm Posted Friday at 06:37 AM Author Share Posted Friday at 06:37 AM Thanks again Bigal for your reply! The other attributes and "Littera" are for extraction to excel to sort them there. What i was hoping for, was if one, two or more different "Littra" can be put into same dimension as field? But multiple attributes as text answer into dimension from different blocks would be nice as well. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted Friday at 10:33 PM Share Posted Friday at 10:33 PM (edited) Yes should be the answer, I have take 2 attributes add them together and put result into a 3rd attribute all as fields. Should be able to do pick pick etc 1 - ? then put in a dim. Try this pick the attributes. Tested on 1 2 & 3 attributes. ; Take block atts and put as field in dimension ; By AlanH 2024 (defun c:wow ( / lst obj x str) (setq lst '()) (while (setq ent (nentsel "\nPick a attribute Enter to stop ")) (setq obj (vlax-ename->vla-object (car ent))) (setq lst (cons (vlax-invoke-method (vla-get-Utility (vla-get-activedocument (vlax-get-acad-object))) 'GetObjectIdString obj :vlax-false) lst )) ) (setq lst (reverse lst)) (setq x -1 str "") (repeat (length lst) (setq str (strcat str " " "%<\\AcObjProp Object(%<\\_ObjId " (nth (setq x (1+ x)) lst) ">%).Textstring>%")) ) (setq obj (vlax-ename->vla-object (car (nentsel "\nPick dimension ")))) (vlax-put obj 'textstring str) (command "regen") (princ) ) Edited Saturday at 02:07 AM by BIGAL Quote Link to comment Share on other sites More sharing options...
fromMlm Posted Saturday at 04:15 PM Author Share Posted Saturday at 04:15 PM Thank you very much Bigal! Works super! I could even put the chosen attribute into a block as a field. Quote Link to comment Share on other sites More sharing options...
fromMlm Posted Saturday at 05:04 PM Author Share Posted Saturday at 05:04 PM By the way, and I hope I'm not pushing it. Is there a way to put in commas between the attributes? Thanks again! Quote Link to comment Share on other sites More sharing options...
BIGAL Posted Saturday at 10:34 PM Share Posted Saturday at 10:34 PM Try this version (defun c:wow ( / lst obj x str) (setq lst '()) (while (setq ent (nentsel "\nPick a attribute Enter to stop ")) (setq obj (vlax-ename->vla-object (car ent))) (setq lst (cons (vlax-invoke-method (vla-get-Utility (vla-get-activedocument (vlax-get-acad-object))) 'GetObjectIdString obj :vlax-false) lst )) ) (setq lst (reverse lst)) (setq x -1 ) (setq str (strcat "%<\\AcObjProp Object(%<\\_ObjId " (nth (setq x (1+ x)) lst) ">%).Textstring>%")) (if (> (length lst) 1) (repeat (- (length lst) 1) (setq str (strcat str "," "%<\\AcObjProp Object(%<\\_ObjId " (nth (setq x (1+ x)) lst) ">%).Textstring>%")) ) ) (setq obj (vlax-ename->vla-object (car (nentsel "\nPick dimension ")))) (vlax-put obj 'textstring str) (command "regen") (princ) ) (c:wow) Quote Link to comment Share on other sites More sharing options...
fromMlm Posted Sunday at 08:48 AM Author Share Posted Sunday at 08:48 AM Thanks!! But it seems like something happend. When I update an attribute it won't change in the dimension. And when I go into the dimension the fields isn't there and it turns back to a plain dimension. What am I missing? Quote Link to comment Share on other sites More sharing options...
BIGAL Posted Sunday at 11:27 PM Share Posted Sunday at 11:27 PM (edited) You are right I changed the attribute value and the dim field did not update. I did the same to a mtext and it worked. It looks like you can not Update the dim value. May have to look at a dynamic block with a attribute. Any body have an idea ? Maybe ask over at forums/autodesk post link to here. Ok probably only way is make a dim block with also a Mtext value. Have the measurement set to blank eg space. insert it, align the dim and stretch etc, explode, then code will work. Edited Monday at 12:54 AM by BIGAL Quote Link to comment Share on other sites More sharing options...
fromMlm Posted Monday at 06:52 AM Author Share Posted Monday at 06:52 AM Thanks for replying! I will try and post it at the other forum as well. Quote Link to comment Share on other sites More sharing options...
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.