Jump to content

Recommended Posts

Posted

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

Posted

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.

  • Like 1
Posted

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

Posted

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.

 

  • Thanks 1
Posted

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.

Posted (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 by BIGAL
  • Thanks 1
Posted (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 by A Tabasi
Posted (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 by BIGAL
Posted (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 by A Tabasi
Posted

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. 

Posted (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 by BIGAL
  • Like 1
Posted

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.

Posted

Something went wrong with paste code did not update properly, have a look at version above has the complex sort.

  • Like 1
Posted

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

Posted

Yes every bar has an individual number at moment just getting it to work one step at a time. 

Posted

What will be the next step? Can we hope to improve the code?

Posted

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.

  • Like 2
Posted

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.

  • 2 weeks later...
Posted

HI

Mr. BIGAL
Do you have an idea for the topic I point out?🙄

Posted (edited)

Sorry will get back on to this. 

 

Just need to fine tune the table and will post something.

Edited by BIGAL

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...