Running Mile (desperate for help)

Discussion in 'AutoCAD' started by tpc, Mar 24, 2005.

  1. tpc

    tpc Guest

    This may be a long shot, and difficult to explain, but:
    Our company needs to count houses, buldings, etc. along a pipeline
    route within an autocad drawing. This count will be the first mile of
    pipe and a 660' offset each side of the pipeline. Then, continue to
    count, moving down the pipeline every 10' feet or so. The main problem
    is that the pipe is never a straight polyline and the total need to go
    into a spreadsheet (excel). I believe I have Excel part figured out.
    But the running mile count thing is killing me. Does anyone have any
    idea how to write a VBA program to do this? Or do you think it may be
    a mixture of VBA and Autolisp?

    Thank you so much for any help you have.
    Todd
     
    tpc, Mar 24, 2005
    #1
  2. tpc

    Tim Arheit Guest

    First calculate the station and offset of each house (ie.the distance
    along the polyline, and the distance right or left of the polyline).
    Sort the list of houses by their station and offset and the running
    count should be pretty easy.

    Calculating the station/offset is the difficult part. You'll need to
    use an algorithm that will calculate the perpendicular distance from a
    point to a line, and the distance along the line. Then using that
    algorithm check each segment of the polyline representing your
    pipeline and select the segment the point is closest to and use the
    distance along the polyline up to that point as the station.

    You should then have station, offset pairs after sorting might look
    like:

    100, -500
    300, 200
    350, -260
    1000, 600
    1200, -200
    etc...

    (positive offsets being to the right of the pipeline, negative being
    to the left)
    From this list is pretty simple to calculate how many houses are in
    the first 600 feet, etc.

    -Tim
     
    Tim Arheit, Mar 25, 2005
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.