Jump to content

Recommended Posts

Posted (edited)

Hi everyone,

I’m working on a complex borehole location drawing in AutoCAD with many boreholes and corresponding data tables. When a new borehole is added, I would like to have an AutoLISP routine that can automatically place a new table and leader for that borehole without overlapping the existing tables.

The layout concept is roughly like the attached image:

Each borehole is a point/block near the center of the drawing.

Each borehole has a data table placed outside the central cluster.

A leader (polyline or multileader) connects the borehole to its table, using straight segments and preferably angles that are multiples of 60 degrees (or similar fixed angles).

When space on one side is not available, the routine should try other directions until it finds a free spot between the existing tables.

What I would like the routine to do is:

Take the new borehole (block or point) as input.

Use a standard table block (or AutoCAD table) with a known size and insertion point.

Search along several radial directions (0°, 60°, 120°, 180°, 240°, 300° or similar) at a given distance to find a position where the table’s bounding box does not overlap existing tables or a central “no‑go” area.

Insert the new table at the first (or best) free position and draw the leader from the borehole to the table with clean, orthogonal/60° segments.

I have some AutoLISP experience and I’m thinking about using:

Block/table bounding boxes (vla-getBoundingBox) for collision checks.

Simple rectangle overlap tests to avoid collisions.

Polar coordinates for candidate positions at fixed angles and distances.

Before I start building this “placement engine” from scratch, I’d really like your feedback:

Has anyone already written something similar (automatic table/label placement around a central cluster, avoiding overlaps)?

From your experience, is this approach (block + attributes + leader + bounding‑box collision tests) reasonable, or is there a better pattern?

Any tips on robust overlap detection or examples of similar LISP routines you recommend looking at?

Would you implement this with standard tables, block attributes, or something else for the borehole information ?

Any ideas, sample code, or links to existing routines would be greatly appreciated. Thanks in advance for your time and suggestions!

 

** Find attached plz

11.pdf

Edited by MSHR
Posted (edited)

Welcome.

 

To make a cleaner look I would make a master Chart (or multiple BH SW MW  or by area with a box around them) with all the relative call outs. this would allow a larger view of the area. eliminate the use/need of leaders that aren't really doing anything but cluttering the drawing.

 

-edit 

Then updating would be adding borehole location and adding to the chart.

Edited by mhupp
  • Agree 2
Posted (edited)

I thought I posted something already, I agree with @mhupp making a single table is much easier, it can be sorted via borehole name and so on. Yes you can have it now, many of us here have done that request many times. Or can do say a couple of tables rather than lots.

 

Yep found at Theswamp. https://www.theswamp.org/index.php?topic=60630.0

 

Need sample dwg and a Excel or csv.

 

 

 

Edited by BIGAL
  • Like 1
Posted
Quote

Thanks for responding, but our client needs these shapes as well due to a ministry request. Unfortunately, we need to prepare the drawing according to their requirements.

 

Bummer extra work to be overcomplicated and hard to update probably by design.

Posted (edited)

Hi,
I suppose it must be as you say, but wouldn’t it be easier to associate the information with each manhole and display it when selecting each one with the mouse?
In my opinion, with your method the information is difficult to relate, because it appears too concentrated.

Edited by PGia
Posted

A big table of all the boreholes can be made looking like this. Think of it as more than two vertically, yes can have a color background.

 

image.png.4def73fa74b7bf6c5ae294b5ea93021e.png

Is that ok ? Can be sorted by date or name.

Posted (edited)
1 hour ago, PGia said:

but wouldn’t it be easier to associate the information with each manhole and display it when selecting each one with the mouse?
In my opinion, with your method the information is difficult to relate, because it appears too concentrated.

 

Yes but as I have had to do things working with the government or local municipalities isn't so cut and dry. just easier to do it the way they want it

Edited by mhupp
  • Like 1
Posted

Do you only have AutoCAD  LT 2026 to do this?

 

As already requested, you need a to post a .dwg and Excel, CSV, etc.

Posted

Off the top of my head, could you use polar coordinates to split the site into slices? With 60-degree increments, you have six slices. When you process a borehole, you use the distance from the center of the site to place the table at a proportional distance in the outer area. By setting the placement angle to a clamped fraction of the slice, you get a fixed number of places for the tables, so there's no chance of overlap. That way you don't have a lot of edge cases, and the tables correspond roughly to the boreholes.

 

I'm probably not explaining this clearly. I can put together a diagram and maybe some code if you need them.

  • Like 1
Posted (edited)

@MSHR   its your turn now people waiting for sample dwg, there are prepared to help, like @CyberAngel I suggested can select boreholes and make a single table of those selected. Repeat as required.

Edited by BIGAL
Posted
13 hours ago, BIGAL said:

@PGia its your turn now people waiting for sample dwg, there are prepared to help, like @CyberAngel I suggested can select boreholes and make a single table of those selected. Repeat as required.

@PGia is not the OP. The OP is @MSHR.

  • 3 weeks later...
Posted
On 6/5/2026 at 6:51 AM, SLW210 said:

@PGia is not the OP. The OP is @MSHR.

No its mine,
So sorry, I was involve with my project's.
Please find the attached DWG file.
 

Sample.dwg

Posted

Hi Folks,
I'm looking for an existing AutoLISP routine before writing one from scratch.

I need a Lisp for AutoCAD Tables (AcDbTable) that can detect text inside a table cell that has been separated using Alt+Enter (multiple lines within the same cell).

The desired workflow is:

Select one or more AutoCAD Lt tables.

Scan every cell.

Detect cells containing multiple lines (Alt+Enter line breaks).

Display the cell location (row and column).

Show each individual line with its line number.

Ask which line should be modified.

Ask for an AutoCAD Color Index (ACI).

Change the font color of only that specific line, while preserving all other formatting in the cell (font, text height, bold, italic, stacked text, fields, etc.).

Example:

Cell (Row 3, Column 5)

Line 1: Existing Text

Line 2: New Text

Line 3: Notes

Choose line to recolor: 2

ACI Color: 1 (Red)

Only Line 2 should become red.

Has anyone already written a Lisp that does something similar, or knows of an existing solution? Any links, examples, or source code would be greatly appreciated.

Posted (edited)

As the cell is Mtext you can set each line a different color, using the mtext color control. This was done manually. So will see maybe later will have time to do something. Have an idea will find the cells with multi line split into multi text lines, display the line and what color it is now so you can change any or all lines.

 

image.png.c0e2171c4f601064c11360a3c779192e.png

 

Looking at dwg it looks like you only want 2 colors 1 & 87 so will keep the multi color for later.

Edited by BIGAL
Posted

Need some more clarification, you ask for multi line to be different colors, but you have table that are multi row, not Multi line cells. That is a big difference. So if you just want tables with a heading and one row to be red, then any others with header and rows greater than 2 will be heading Red line rest green 87 lines. That can be done.

 

I think need to go back a step and work on the table creation in your other post as you pick boreholes there is no reason why the colors can not be set then. So will have a go at the other post, making single table for multiple boreholes much easier than trying to place individual tables for each borehole.

 

Will post something for you to say yes that is ok. 

 

I did ask about the source data where is the say Excel or csv that has the values that are being used in your tables, you have supplied a half answer.

Posted (edited)

Admin may want to merge the two posts about this task, questions asked on other post, information is missing that is needed to provide a solution. Where is table data source ?

Edited by BIGAL
Posted

I have merged the 2 threads since they seem related.

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...