Drawing Service Lines Programmatically

Drawing Service Lines Programmatically

Anonymous
Not applicable
233 Views
2 Replies
Message 1 of 3

Drawing Service Lines Programmatically

Anonymous
Not applicable
I am trying to automate the drawing of Hydrant service lines using VBA. I
have the code written to insert the Hydrant block and to annotate it,
however, I would like to find the closest line (Main water line) to this
block and draw a line from the center of the block to a point perpendicular
to the closest line. I would like to automate this with as little input from
the user as possible.

Any ideas?

Tim Simboli
GIS Programmer
Vanasse Hangen Brustlin, Inc
0 Likes
234 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
If all your main water lines were on a layer that had nothing but water
mains on it, you could programmatically do something like...

Create selection set of all water lines on layer "mains"
Loop through each one checking the perp dist from your hydrant insertion pt
to each line
Store the first dist and first perp point in an array
Compare each subsequent dist to the stored dist, if it is less, replace the
array values
In the end you should have the point with the shortest distance in your
array
Add the line from the block insertion pt to the water line

...If the layer idea is not feasible then you might consider selecting the
water lines manually.


Regards,
Jacob Dinardi

"Tim Simboli" wrote in message
news:6678F9E8340913BADCD057579CE593F3@in.WebX.maYIadrTaRb...
> I am trying to automate the drawing of Hydrant service lines using VBA. I
> have the code written to insert the Hydrant block and to annotate it,
> however, I would like to find the closest line (Main water line) to this
> block and draw a line from the center of the block to a point
perpendicular
> to the closest line. I would like to automate this with as little input
from
> the user as possible.
>
> Any ideas?
>
> Tim Simboli
> GIS Programmer
> Vanasse Hangen Brustlin, Inc
>
>
0 Likes
Message 3 of 3

Anonymous
Not applicable
You will need the aid of the curve methods (namely,
the getClosestPointTo() method) which are not available
to VBA.

You can use AcadX.arx to access these methods, as well
as some additional curve functionality that might be
useful for what you're doing as well, from VBA.

http://www.caddzone.com/acadx/acadx15.htm

"Tim Simboli" wrote in message
news:6678F9E8340913BADCD057579CE593F3@in.WebX.maYIadrTaRb...
> I am trying to automate the drawing of Hydrant service lines using VBA. I
> have the code written to insert the Hydrant block and to annotate it,
> however, I would like to find the closest line (Main water line) to this
> block and draw a line from the center of the block to a point
perpendicular
> to the closest line. I would like to automate this with as little input
from
> the user as possible.
>
> Any ideas?
>
> Tim Simboli
> GIS Programmer
> Vanasse Hangen Brustlin, Inc
>
>
0 Likes