MSHR Posted May 25 Posted May 25 (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 May 25 by MSHR Quote
mhupp Posted May 26 Posted May 26 (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 May 26 by mhupp 2 Quote
BIGAL Posted May 26 Posted May 26 (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 May 26 by BIGAL 1 Quote
mhupp Posted May 27 Posted May 27 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. Quote
PGia Posted May 28 Posted May 28 (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 May 28 by PGia Quote
BIGAL Posted May 28 Posted May 28 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. Is that ok ? Can be sorted by date or name. Quote
mhupp Posted May 28 Posted May 28 (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 May 28 by mhupp 1 Quote
SLW210 Posted May 29 Posted May 29 Do you only have AutoCAD LT 2026 to do this? As already requested, you need a to post a .dwg and Excel, CSV, etc. Quote
CyberAngel Posted June 4 Posted June 4 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. 1 Quote
BIGAL Posted June 4 Posted June 4 (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 June 5 by BIGAL Quote
SLW210 Posted June 5 Posted June 5 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. Quote
MSHR Posted Friday at 02:21 PM Author Posted Friday at 02:21 PM 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 Quote
MSHR Posted Friday at 02:23 PM Author Posted Friday at 02:23 PM 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. Quote
MSHR Posted Friday at 04:10 PM Author Posted Friday at 04:10 PM I attached sample file. Sample.dwg Quote
BIGAL Posted Friday at 11:58 PM Posted Friday at 11:58 PM (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. Looking at dwg it looks like you only want 2 colors 1 & 87 so will keep the multi color for later. Edited yesterday at 12:10 AM by BIGAL Quote
BIGAL Posted yesterday at 02:29 AM Posted yesterday at 02:29 AM 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. Quote
BIGAL Posted yesterday at 02:33 AM Posted yesterday at 02:33 AM (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 yesterday at 02:33 AM by BIGAL Quote
SLW210 Posted 1 hour ago Posted 1 hour ago I have merged the 2 threads since they seem related. Quote
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.