Hey swampers,
I posted earlier about assigning elevations to blocks based on contour lines. There were some good ideas, but unfortunately, I'm too busy to write the thing. So I thought I'd post it here, and opensource the result. I get the code I want, someone gets paid, future programmers get to use the result. A win for everybody, not to mention this could be fairly entertaining. I decided after the fact to include LISP code, so if this post needs to be moved somewhere different, an admin can do that.
PROBLEMS:
The first problem is isolating what objects to use for the elevation models, and where. if possible I'd like to avoid user interaction here, but it may be that the user needs to be prompted for some elevation layers or something. If the solution requires user interaction, your solution must include the interface to do so.
The second problem is interpolating elevation values from the elevation models and assigning those values to blocks. If the points fall within the bounds of the proposed grade, the elevation should be assigned from the proposed grade. If not, they should be assigned from the existing grade.
Challenge drawing files are here.CODE:
The code has to be .NET C# or LISP. Try to comment it well. Do not post compiled code, I will not run it (and neither should anybody else). Include your username in a comment at the top of the file. All code posted will be public domain. One entry per user.
.NET: post a complete sln file I can open and compile in VS2019 I'll netload the compiled dll into vanilla AutoCAD 2021.
LISP: Post an uncompiled LISP file.
DRAWINGS AND CHALLENGE
QUALIFY.DWG: Create a command 'RACE'. It will prompt the user to select the layers/or objects for both the existing and proposed contours. Using those contours, calculate and set the elevations for the test blocks in Qualifer.dwg. All blocks should get an elevation within .25' of what I've got shown there (after all, my math could be wrong) Note that the base file in the xref is twisted about and not at 0,0 etc. Sometimes CAD monkeys do weird things, and we gotta accomodate that.
RACE.DWG: If your code qualifies, I'll run it 3 times on this drawing on my machine and average the times. I'll be using AutoCAD 2021 for the test. There is a single xref in this drawing that contains all the contours. Code that produces elevations that do not agree to consensus(within .25') with the rest of the entries will not be eligible for the prize. Include a timer in your project. Start the timer from when the user finishes selection of the layers. Print the elapsed time to the command line once the command is complete.
DEADLINE: October 22, 2021, 5pm MST.
PRIZES:
Paid in paypal, crypto, however I can get it to you.
Fastest .NET Solution: $400
Fastest LISP Solution $400
2nd Fastest (either): $100
Donation to Swamp: $200
If there's questions/clarifications needed, I'll do my best to clear them up before the deadline. I should have results the following week.
Good luck!