A Tabasi Posted December 1, 2023 Share Posted December 1, 2023 Hello friends I have a concrete structure file that I need to prepare a reinforcement shop plan for implementation. I have made a block with attributes for tag size, length, and shape of armatures and used it. Well, now I have encountered a lot of time with errors in the numbering (mark). I want a lisp that I made based on the contents of the tag block to do the numbering intelligently. In fact, similar to software such as View and Tekla Structures. Can anyone help me? Tag block file I always follow the format of this tag block. For example ..T... , L=...m Rebar Tag-Block-Cadtutor.dwg Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 1, 2023 Share Posted December 1, 2023 The number is the easy bit 01,02 and so on. You need some way of pick a bar and it auto works out its a "L" "Straight bar" "1 hook", "2 hook". I can think of about 10 different type of bar descriptions. The length would be auto generated from the pick object.  So I would take a step back and think about that first rather than the end block answer.  Post a dwg with example rebar shapes.  I would do a Google about "drawing Rebar Autocad Lisp", I would expect they would have the add block part, I know I have done hook ends, for a "L" that was enter len1, len2 etc. 1 Quote Link to comment Share on other sites More sharing options...
A Tabasi Posted December 2, 2023 Author Share Posted December 2, 2023 thank  BIGAL I am sending the final file of the rebar shop drawing to better convey my meaning. In simple language, I have created two blocks, the first block is for drawing the rebar, and the second block is related to the rebar tag. However, the numbering process is done manually and is very time-consuming, which is accompanied by errors. I am looking for a solution to reduce the numbering time and reduce possible errors to zero. Since I don't know programming, I need your help. Rebar Tag-Block.dwg Block C LEVEL +494-BEAMS Workshop Rev0.0 Part2.dwg Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 2, 2023 Share Posted December 2, 2023 Ok looking at dwg, Can get Lengthprimaryshape Can get size1 Can get visibilty1  Re number if know the name of the block or blocks eg "Longitudinal Bar-rev1.0", can get how many blocks, so your next number is tot+1, you would not just insert the reobar rather use a lisp so it adds correct number at time of drafting. Could also do a missed some and just renumber all, that may though result in numbers all over the place rather than beam by beam.  Should be able to do something its fishing time maybe later.  1 Quote Link to comment Share on other sites More sharing options...
A Tabasi Posted December 3, 2023 Author Share Posted December 3, 2023 Hi BIGAL I read your comment several times, but to be honest, I didn't understand what you meant? I know I have to try myself, but the biggest problem for me right now is my lack of programming knowledge. In any case, can you guide me if my idea and desire can be accepted and implemented? Thank you for answering the question I raised in this post. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 4, 2023 Share Posted December 4, 2023 (edited) "Should be able to do something its fishing time maybe later". Gone fishing no time to program been a couple of busy days off in a rocky boat. Will try to find some time now back on land. Â Try this very crude needs a second version that works by picking the reo bar and getting all correct info. Â (defun c:addnum ( / idx sel str ) (setq num (getint "\nstart number ")) (if (setq sel (ssget '((0 . "MULTILEADER")))) (repeat (setq idx (sslength sel)) (setq mld (vlax-ename->vla-object (ssname sel (setq idx (1- idx))))) (vlax-for obj (vla-item (vla-get-blocks (vla-get-document mld)) (vla-get-contentblockname mld)) (if (and (= "AcDbAttributeDefinition" (vla-get-objectname obj)) (= :vlax-false (vla-get-constant obj)) ) (progn (setq oid (vla-get-objectid obj)) (if (= (vla-get-tagstring obj) "POS") (vla-setblockattributevalue mld oid (rtos num 2 0) ) ) ) ) ) (setq num (1+ num)) ) ) (princ) ) (C:emdl) Â Edited December 4, 2023 by BIGAL 1 Quote Link to comment Share on other sites More sharing options...
A Tabasi Posted December 5, 2023 Author Share Posted December 5, 2023 (edited) Hello BIGAL thank you for your time. I tested the code you sent. Changes need to be made to it according to the chart and diagrams I am sending. This chart shows you the processing stages my code in Lisp goes through and exactly what I have in mind and envision. Numbering lisp Diagram.dwg Edited December 5, 2023 by A Tabasi Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 5, 2023 Share Posted December 5, 2023 (edited) I understand each similar bar shape and length is given same number, but when doing BOM gives total number of that type of bar. Â Can be done I have something that does the sort and count, then makes Table. Will have a look at Block level C.dwg and see where we go. There may be a small fee think beer money. Edited December 5, 2023 by BIGAL Quote Link to comment Share on other sites More sharing options...
A Tabasi Posted December 6, 2023 Author Share Posted December 6, 2023 (edited) Hello again Well, so there is a solution to the issue I raised. To be honest, I am an engineer in Iran and I don't know if I can count your beer money or not. But I am extremely grateful to you for your support and help, sir BIGAL Edited December 6, 2023 by A Tabasi Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 7, 2023 Share Posted December 7, 2023 Getting some where this is just a portion of your bars.  (("U Shape" "L=8.0m" "1x2T20" "01") 1) (("U Shape" "L=10.5m" "4T20" "01") 2) (("U Shape" "L=10.5m" "1x2T20" "01") 1) (("Smooth Shape" "L=6.65m" "3T20" "01") 1) (("Smooth Shape" "L=6.2m" "3T20" "01") 2) (("Smooth Shape" "L=5.9m" "2T10" "16") 1) (("Smooth Shape" "L=5.9m" "1T20" "14") 1) (("Smooth Shape" "L=5.95m" "5T20" "01") 1) (("Smooth Shape" "L=5.95m" "2T20" "11") 1) (("Smooth Shape" "L=5.95m" "2T20" "05") 1) (("Smooth Shape" "L=5.95m" "2T10" "10") 1) (("Smooth Shape" "L=5.95m" "13T20" "01") 1) (("Smooth Shape" "L=5.95m" "10T10" "01") 1) (("Smooth Shape" "L=5.8m" "3T10" "09") 1) (("Smooth Shape" "L=5.85m" "4T20" "15") 1) (("Smooth Shape" "L=5.85m" "3T20" "08") 1) (("Smooth Shape" "L=5.85m" "2T20" "15") 1) (("Smooth Shape" "L=5.85m" "2T20" "08") 1) (("Smooth Shape" "L=5.85m" "2T10" "17") 1)................. The last number is how many match the 4 values. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 8, 2023 Share Posted December 8, 2023 (edited) Â (defun compare-elements (a b sortspec) ( (lambda (x y test) (if (and (equal x y ) (cdr sortspec)) (compare-elements a b (cdr sortspec)) (apply test (list x y)) ) ) (nth (cdar sortspec) a) (nth (cdar sortspec) b) (caar sortspec) ) ) (defun complex-sort (alst sortspec) (vl-sort alst '(lambda (a b) (compare-elements a b sortspec) ) ) ) (defun c:barcnt ( / ss lst tot ent atts att ent1 x mld obj) (setq ss (ssget "X" (list (cons 0 "MULTILEADER")(cons 8 "rebar Tag")(cons 410 "Model")))) (setq lst '()) (repeat (setq x (sslength ss)) (setq ent (entget (ssname ss (setq x (1- x))))) (setq atts (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 302)) ent))) (setq atts (list (nth 1 atts)(nth 2 atts)(nth 3 atts) (cdr (assoc -1 ent)))) (setq lst (cons atts lst)) ) (setq lst (complex-sort lst '((< . 0) (< . 1) (< . 2)))) (setq tot 1 x 0) (repeat (length lst) (setq ent1 (nth x lst)) (setq mld (vlax-ename->vla-object (nth 3 ent1))) (vlax-for obj (vla-item (vla-get-blocks (vla-get-document mld)) (vla-get-contentblockname mld)) (if (and (= "AcDbAttributeDefinition" (vla-get-objectname obj)) (= :vlax-false (vla-get-constant obj)) ) (progn (setq oid (vla-get-objectid obj)) (if (= (vla-get-tagstring obj) "POS") (vla-setblockattributevalue mld oid (rtos tot 2 0) ) ) ) ) ) (setq x (1+ x) tot (1+ tot)) ) (princ) ) (c:barcnt) Â Edited December 8, 2023 by BIGAL 1 Quote Link to comment Share on other sites More sharing options...
A Tabasi Posted December 8, 2023 Author Share Posted December 8, 2023 I tried to test but I couldn't. This message is displayed "error: no function definition: COMPLEX-SORT Cannot invoke (command) from *error* without prior call to (*push-error-using-command*). Converting (command) calls to (command-s) is recommended."  It's still not complete as I understand it. In any case, I am very grateful to you and I would like to repay the kindness and love you have shown me. I hope I can do the idea I have in my head with your help. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 8, 2023 Share Posted December 8, 2023 Something went wrong with paste code did not update properly, have a look at version above has the complex sort. 1 Quote Link to comment Share on other sites More sharing options...
A Tabasi Posted December 9, 2023 Author Share Posted December 9, 2023 I tested the code. I am very excited because it solved part of the problem I had. But I have a question. Please look at the file below. Although the numbering has been done, two different numbers have been considered for two completely identical rebars. Test Lisp.dwg Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 9, 2023 Share Posted December 9, 2023 Yes every bar has an individual number at moment just getting it to work one step at a time. Quote Link to comment Share on other sites More sharing options...
A Tabasi Posted December 10, 2023 Author Share Posted December 10, 2023 What will be the next step? Can we hope to improve the code? Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 10, 2023 Share Posted December 10, 2023 There is 2 solutions to a request the slow response its free, the I want ASAP has a cost.  So some one else can jump in and fix the 1 problem at moment or I will do it when I have time. 2 Quote Link to comment Share on other sites More sharing options...
A Tabasi Posted December 10, 2023 Author Share Posted December 10, 2023 Do not misunderstand. I understand you are busy only because I am excited about what you are generously doing. In any case, I understand your situation, and thanks a lot for your support. Quote Link to comment Share on other sites More sharing options...
A Tabasi Posted December 24, 2023 Author Share Posted December 24, 2023 HI Mr. BIGAL Do you have an idea for the topic I point out? Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 24, 2023 Share Posted December 24, 2023 (edited) Sorry will get back on to this.  Just need to fine tune the table and will post something. Edited December 26, 2023 by BIGAL 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.