Lisp to change layer of lines based on bar diameter

Lisp to change layer of lines based on bar diameter

prash1730
Participant Participant
4,474 Views
38 Replies
Message 1 of 39

Lisp to change layer of lines based on bar diameter

prash1730
Participant
Participant

Namaste,

Can anyone please help me out with a lisp / command which identifies the bar diameter and changes the layer & color of the bars it is indicating (nearest to arrow pointer)

For ex: 8mm green, 10mm blue, 12mm orange 16mm magenta, 20mm red, 25mm flourecent green.

 

Thank you for your valuable time.

Best regards,

PNP

 

PS: i am using another lisp to give the length of the each bar dia and multiply them manually by 2 (usually we will have 2 bars in a beam ) to get the overall length for boq purposes.

0 Likes
Accepted solutions (2)
4,475 Views
38 Replies
Replies (38)
Message 21 of 39

ec-cad
Collaborator
Collaborator

prash1730,

Hope you didn't give up.

I think the attached will work on that new drawing with just 'Text' for the Bar info.

This one looks for 'Text' that ends in (chr 216) . To see this character, at command

prompt, type:  (print (chr 216))

Anyway, looks like it's doing the job. (again).

You can use it on either drawings with "NO" block or just 'Text'

ECCAD

0 Likes
Message 22 of 39

ec-cad
Collaborator
Collaborator

prash1730,

I posted a new Lisp: Do_Bars4.lsp, but I don't see it.

This version will look for 'Text' - or - Block "NO".

Seems to work for me on attached .dwg.

ECCAD

0 Likes
Message 23 of 39

ec-cad
Collaborator
Collaborator

prash

Try this new version of Lisp out.

It should work on your 'New' drawing type with just Text for the # rods, and Diameters.

I tried posting it (3) times now, but this thread may have too many attachments.

 

ECCAD

 

0 Likes
Message 24 of 39

prash1730
Participant
Participant

Namaste,

@ec-cad thanks a lot for sparing your valuable time.. 🙏🙏 as suggested by you, i checked Do_Bars3.lsp in a file which had reinforcement tagging as block attribute and it is working fine!.

 

PS: While most of the bar colours will be changed and also layers converted, many of them are not getting converted. We have to zoom into each beam and check if the bars are converted or not. If not, we have to run the GO command again and then it works!

Any particular reason for this?

I have attached the file for your reference.

 

Best regards,

PNP

0 Likes
Message 25 of 39

ec-cad
Collaborator
Collaborator

Maybe the Text is Left Justified, and by a Leader that goes from the right end of the text ?

I can make a 'FIX' function for you to select the Text, then the Leader (one at a time) to quickly make

those instances behave .. If so, let me know. I can include it in the original Lisp, so you only have to

Zoom or scroll to a given slab and type FIX, then pick items.

 

ECCAD

0 Likes
Message 26 of 39

ec-cad
Collaborator
Collaborator

You say you zoom into a layout, and type GO again and it works ?

Maybe the Crossing Window that checks if a Leader is 'close' to the Text insertion point

is a little small. Try increasing those window point calculations for the Leader. Here's the

code area to  change:

(defun GETLDR ( pt ); pass in insertion point of NO block
(if pt
(progn
(setq CC 0)
(setq P1 (list (- (car pt) 2.5)(+ (cadr pt) 2.5))); left, up
(setq P2 (list (+ (car pt) 2.5)(+ (cadr pt) 2.5))); right, up
(setq P3 (list (- (car pt) 2.5)(- (cadr pt) 2.5))); left, down
(setq P4 (list (+ (car pt) 2.5)(- (cadr pt) 2.5))); right, down

 

ECCAD

0 Likes
Message 27 of 39

ec-cad
Collaborator
Collaborator
Accepted solution

I opened up the Window a bit, from 2.5 to 5.5. And minor other changes.

It seems to color / change layers of 99% of those rods. There are a couple on

upper layouts that are not 'connected' together so it didn't do those.

Hope you like the improvements.

 

ECCAD

Message 28 of 39

prash1730
Participant
Participant

Namaste,

Thanks a lot @ec-cad 🙏🙏

Best regards,

PNP

0 Likes
Message 29 of 39

prash1730
Participant
Participant

Namaste,

Hope you all are doing well. It has been sometime that i used the do_bars4.lsp.

However, now when i load it and try to use it, it is not working. I have removed the old versions in APP LOAD as the commands might interfere. But still not able to change the colour of bars. It is creating new layers for different dia. bars. however, it is not changing the colour of bars nor assigning the particular reinforcement layer to them. @ec-cad can you please help 🙏🙏

0 Likes
Message 30 of 39

ec-cad
Collaborator
Collaborator

Sure, I'll take another look at it. Can you post your most recent drawing that has the issues ?

THX

ECCAD

 

0 Likes
Message 31 of 39

prash1730
Participant
Participant

Namaste,

Thank you for your response @ec-cad. please find attached the latest drawing which i used for the check. It is fairly working for bar attibutes but not working when the bar dia is text.

 

Thanks a lot for your kind help.. 🙏🙏

0 Likes
Message 32 of 39

ec-cad
Collaborator
Collaborator
Accepted solution

Prash,

Your new drawing has (both) blocks named NO, and Text.

Also, the Text Size for those Quantity / Size markers are 162.5 Text Height.

I had very tight windows for picking up the nearest Leader ( + - 0.5), so I had

to modify the program to check the Text Height and calculate the Crossing window accordingly.

I have a hard time keeping up with your drawing structure (or lack of). No more changes.

 

ECCAD

0 Likes
Message 33 of 39

prash1730
Participant
Participant

Namaste @ec-cad,

First of all, i am really very sorry to have bothered you on this topic. Thank you for your feedback. Since we are working with both metric and FPS units we are having this issue. We are working on it to improve the drawing quality.

 

Secondly, thanks a lot again for taking time from your busy schedule to find a solution. It means a lot!

 

Best regards,

PNP

0 Likes
Message 34 of 39

ec-cad
Collaborator
Collaborator

Prash,

Since the program is not reliable, due to drawing content, you may want a smaller Lisp

to 'select' multiple rods, and just type in the Diameter. Program would then change the Layer and Color

for those selected. You could Zoom to view a given layout, pick each set of rods that didn't get changed

and it would finish up the process.

Would you need such a program ?

 

ECCAD

 

0 Likes
Message 35 of 39

prash1730
Participant
Participant

Namaste,

@ec-cad thanks a lot for your help. I cannot ask for more after Dobars_5.
However, if you could find time from your busy schedule for this lisp it would be great! Thanks a lot for your kind help 🙏🙏

 

Best regards,

PNP

0 Likes
Message 36 of 39

ec-cad
Collaborator
Collaborator

Prash,

Sure you 'can' ask.

Attached, find Do_Bars5 and Fix_Bars.

Load Fix_Bars, zoom around, pan, whatever, then type FIX to fix-up those Bars that didn't get changed.

You select one, or many, hit Enter to complete selection set, then Input the Diameter.

No error checking on the Diameter.

On the Do_Bars5, I changed it to look for (3) entity names, (LINE, LWPOLYLINE, & POLYLINE). Old version

may have missed some, because your drawing was not made in AutoCAD, maybe some other CAD.

 

ECCAD

 

0 Likes
Message 37 of 39

ec-cad
Collaborator
Collaborator

Prash,

Couple of improvements. Fix_Bars.lsp has (2) functions.

1. FIX - Select Bars to change, asks Dia, places those bars on associated Layer & Color.

2. Added:  FIND_BARS - Gets a selection set of those remaining on Layer 'Reinforcement', and

    allows you to 'Copy' that group to (right or left), and drops them there.

   So, you can see them alongside of original layouts.

   You can erase Window or Crossing when done.

 

If I think of anything else that would be useful, I'll post it.

 

ECCAD

0 Likes
Message 38 of 39

prash1730
Participant
Participant

Namaste,

Thanks a lot @ec-cad. will check it out.. 🙏🙏

0 Likes
Message 39 of 39

CADaSchtroumpf
Advisor
Advisor

@prash1730 

Hi,

Just a suggestion for your new drawings to automate your bars.
This is just an example that can be modified. With this code you can: either create a new bar, or select an already drawn polyline to assign a diameter to it. You can even reassign a new diameter to a polyline already processed by the code (the diameter text(s) will be updated)

We could complete the information attached to the polyline by completing the BAR variable in the code, for example the weight, the product code, the type of steel etc..

0 Likes