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 1 hour ago Posted 1 hour ago 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. 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.