I want to write a routine that will save a lot of time, but I’m not sure how to do one of the tasks.
Some background:
As part of the requirements for getting a plat approved here, we must submit slope calculations based on a formula listed in the Municipal Code that gives the average slope of the lot.
The formula is S = (I x Lx 0.0023) / A
Where:
I is the contour interval of the contours being used (usually 2’, but varies)
L is the length of the contours contained in the parcel
0.0023 is a given factor
A is the area of the parcel in acres
In a drawing, we have the contours (usually as polylines at the correct elevation, I sacrifice {explode} the contour objects in a separate drawing specifically for doing this), and line work that represents the parcels, which are closed polylines themselves.
The task I am having trouble wrapping my head around is finding the length of the portions of the contours enclosed in the lot.
What I do now is use the parcel boundary to trim the contours to the boundary, and then I use a routine that returns the total length of the polylines selected, and then I plug that into the formula in a spread sheet or on my calculator, then undo back through the trim and go to the next parcel.
What I want to do is:
All of this I am capable of.
- Select the index contour; extract the layer info
- Select the minor contour, extract the layer info
- Use the layer info and entity type to filter the contours to a selection set.
- Get the contour interval (I) (or, maybe get it from the contours themselves)
- Go into a while loop to:
- Select a closed polyline that reflects the parcel.
- Extract the area (A) of the parcel and convert to acres
8. Now the tricky part (at least for me):
Once the parcel polyline is selected, I need to return the length of the potions of the polylines (contours) that are inside the parcel.
Given that the parcel and contours are at different elevations, and that the contour polylines run through the parcel (sometimes more than once; some are totally within the parcel; some run in and out and back in and back out {you get the picture}). I am not sure how to even start writing something that will return the length of the potion of a polyline that falls within the given area, ignoring the length that is outside.
Once that it accomplished, the rest is easy.
Has anyone else accomplished this? Is there a way? Where should I start?
Any help would be greatly appreciated,