Connecting points to curves by the shortest distance in AutoCAD using .NET Part 1

A question came into the LISP forum during Wednesday’s Answer Day. It related to a really interesting task: to take certain blocks in a drawing and connect them to the closest polyline via a perpendicular line. It took me a little while to understand, but basically the problem relates to pipeline design: there are gully posts – represented as blocks – that need to be connected to pipelines (polylines) in the drawing. They need to be connected by the shortest path, which will be perpendicular to the pipeline (assuming the pipeline is long enough, of course).

It was too juicy a problem to put to one side, so I ended up putting a little code together. I chose to solve it using C#: LISP wasn’t a hard and fast requirement, and it’s far easier for me to code it in .NET. The answer I originally gave on the forum was unnecessarily complicated, as it turns out, but we’ll see that on Monday when we extend this code to also search for pipelines in the drawing.

So, to start with,…

Read more

Leave a Comment