Author Topic: Assigning contour elevations...  (Read 14442 times)

0 Members and 1 Guest are viewing this topic.

Guest

  • Guest
Assigning contour elevations...
« on: October 10, 2006, 03:40:54 PM »
...to 5,170 contours.  What's the easiest way??

Yeah, I've got a drawing with over 5,000 contours (currently plines) that I need to make "real".  I'm using LDT5.  I'm hoping I don't have to click on each one to set the elevation.

Maybe someone has a little program they'd like to share??

I'm open to any/all ideas.

Jeff_M

  • King Gator
  • Posts: 4098
  • C3D user & customizer
Re: Assigning contour elevations...
« Reply #1 on: October 10, 2006, 03:57:04 PM »
Well, I'd rather talk to you here than the other place, so.....

How do you know what the elevation is supposed to be for the plines?

Guest

  • Guest
Re: Assigning contour elevations...
« Reply #2 on: October 10, 2006, 04:05:48 PM »
There's a piece of text sitting on every 10 foot contour.

Jeff_M

  • King Gator
  • Posts: 4098
  • C3D user & customizer
Re: Assigning contour elevations...
« Reply #3 on: October 10, 2006, 04:27:19 PM »
Sorry, Matt, I don't have anything already coded. About the best I can come up with right now would be to set one of the lowest plines at it's elevation, then have a program that would have you select the plines by a Fence and it would assign elevations upwardly in 1' (or whatever they should be) increments. Trouble is, I'm not so sure a Fence would actually select in order so you'd probaly have to sort them based on interection point vs start point. May be a tall order......good luck! If I get some time I'll see what I can do about the actual code.

Swift

  • Swamp Rat
  • Posts: 596
Re: Assigning contour elevations...
« Reply #4 on: October 10, 2006, 05:15:19 PM »
Hey guys I worked on something like what he needs a while back for when I digitized contours but I never finished it. I was working on the ideal of a crossing line and using the distance from first end point to intersections to determine the contour elevations.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Assigning contour elevations...
« Reply #5 on: October 10, 2006, 05:24:37 PM »
If the text is on the pline, then would an ssget for text, with the fence, where the fence points are the pline points, grab the text?  If so then you know the elevation for that pline, and are able to change the elevation.

Just thinking out loud.  I'm not a civil guy, so if I'm way off base, just let me know.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Dinosaur

  • Guest
Re: Assigning contour elevations...
« Reply #6 on: October 10, 2006, 05:40:57 PM »
In case there are no automated solutions offered that work for you, here is how I would progress along the  l  o  n  g  route.
I would start this project with a MAP cleanup operation (you have LDT5 so I know you have MAP) to eliminate any gaps or overlaps in the segments you need to join.  This will also do most of the joining for you if you chose the right settings.
Are these things all have the same layer or color and linetype?  If they are different in one or more property, you can use the select similar command to break the index contours out and change just those to a layer you can isolate.  This will break the task visually into easier chunks.  The easiest approach if they are not to any elevation already (I am assuming that you have checked and found no Z values) is to start joining the segments into a continuous ployline and change the polylines to a different layer as you finish with them and assign the correct elevation.  It will take a while but it is not prohibitive as long as you have done the cleanup first.

LE

  • Guest
Re: Assigning contour elevations...
« Reply #7 on: October 10, 2006, 05:53:53 PM »
Can you upload a sample drawing (just a small area)... if you can.

sinc

  • Guest
Re: Assigning contour elevations...
« Reply #8 on: October 10, 2006, 05:56:42 PM »
...to 5,170 contours.  What's the easiest way??

Yeah, I've got a drawing with over 5,000 contours (currently plines) that I need to make "real".  I'm using LDT5.  I'm hoping I don't have to click on each one to set the elevation.


How are you currently doing this task?  Are you clicking on each line and typing the elevation in the Properties?

There's also the "Assign Elevation" command in the Contour Utilities.  It's easier than typing every elevation, but I still wouldn't want to use it for 5000+ contours...

I don't suppose there's any chance you can go back to whoever created the contours and have them give you something more useful, like a TIN?  That would definitely be "the easiest way"...   :-D

SomeCallMeDave

  • Guest
Re: Assigning contour elevations...
« Reply #9 on: October 10, 2006, 06:16:09 PM »
Here is a quick routine that may help.  Swift's post gave me the idea for it.

It assumes that the contour entities are LWPolylines, and that the color of them has been change to something other than ByLayer. And also that the linetype doesn't have any dashes.  Sometimes fence misses a pick due to dashes.

Draw a pline from downhill to uphill, that crosses each contour only once.  The routine can't do the whole site at once, but it should be faster than picking them manually.

I haven't tested it much, but maybe it will help.

Code: [Select]
(defun c:SetELev()
   (setq Ent1 (car (entsel "\nSelect Fence Pline "))
         LowestEl (getreal "\nEnter Lowest Elevation ")
         ContInter (getreal "\nEnter Contour Interval ")
         LastVert (fix (vlax-curve-getEndParam Ent1))
         VertList (list (vlax-curve-getPointAtParam Ent1 0))
         count 1
         oEnt1 (vlax-ename->vla-object Ent1)
   )     
   
   (repeat LastVert   
      (setq VertList (append VertList (list (vlax-curve-GetPointAtParam Ent1 Count)))
            Count (+ Count 1)   
      )     
   
    )
   
    (setq ss1 (ssget "F" VertList)
          Count 0
          CrossPtList nil
          ss1 (ssdel Ent1 ss1)
    );setq
   
       
    (repeat (sslength ss1)
       (if  CrossPtList
           (setq CrossPtList (append CrossPtList (list (last (last (last (ssnamex ss1 count) )))) ) )
           (setq CrossPtList (list (last (last (last (ssnamex ss1 count))))))
       );if
       (setq Count (+ count 1))
    );repeat
   
    (setq DistList nil
          Count 0
          CurrElev LowestEl
         
    );setq
   
    (repeat (length CrossPtList)
       (if DistList
           (setq DistList (append DistList (list (vlax-curve-GetDistAtPoint Ent1 (vlax-curve-getClosestPointTo Ent1 (nth count CrossPtList))))))
           (setq DistList (list (vlax-curve-GetDistAtPoint Ent1 (vlax-curve-getClosestPointTo Ent1 (nth count CrossPtList)))))
       );if
       (setq count (+ 1 count))         
    );repeat
    (setq DistListSortI (vl-sort-i DistList '<)
          count 0
    );setq
   
    (repeat (length DistListSortI)
       (setq currEnt (ssname ss1 (nth count DistListSortI))
             currElev (+ LowestEl (* ContInter count))
             CurrEntList (entget currEnt)
             ;change the elevation
             CurrEntList (subst (cons 38 currElev) (assoc 38 CurrEntList) CurrEntList)
             ;change the color so we can keep track
             colorIndex 6
             CurrEntList (subst (cons 62 colorIndex) (assoc 62 CurrEntList) CurrEntList)
        );setq
        (entmod CurrEntList)
        (setq count (+ count 1))
    )

)


LE

  • Guest
Re: Assigning contour elevations...
« Reply #10 on: October 10, 2006, 06:26:59 PM »
Something I would do in lisp is:

If the text objects are on top of each polyline and the polyline is not broken in that part, then... do:

1. Select the text entities.
2. Iterate over each text and get the bounding box.
3. Make a selection from those two points using ssget "c" and use a filter for a polyline.
4. Make sure the selection is equal to one (0) item, an use the string value of the text, assign it to the polyline and call ssdel to delete the item (pline) from the selection.

I think that might work.

LE

  • Guest
Re: Assigning contour elevations...
« Reply #11 on: October 10, 2006, 06:57:04 PM »
And here is.... you can run more tests and make it better.

Good luck!

Code: [Select]
(defun C:TEST  (/ ss p1 p2 s pline txt)
  (if (setq ss (ssget '((0 . "TEXT"))))
    (progn
      (mapcar
'(lambda (obj)
   (vla-getboundingbox obj 'p1 'p2)
   (setq p1 (vlax-safearray->list p1))
   (setq p2 (vlax-safearray->list p2))
   (if (setq s (ssget "_C" p1 p2 '((0 . "LWPOLYLINE"))))
     (progn
       (setq pline (vlax-ename->vla-object (ssname s 0)))
       (setq txt (vla-get-textstring obj))
       (vla-put-elevation pline (distof txt)))))
(mapcar 'vlax-ename->vla-object
(vl-remove-if
  (function listp)
  (mapcar (function cadr) (ssnamex ss))))))))
(princ)

MMccall

  • Guest
Re: Assigning contour elevations...
« Reply #12 on: October 10, 2006, 07:14:03 PM »
I ran a quick web search and came up with a company named 4D Technologies that has a collection of GeoTools (over 200 tools).  Two of the tools are made just for the purpose of assigning elevations to contour lines.  $149 to buy, might have a free demo period to test it out.  You can alsos purchase them one tool at a time. ($2-8 each)
« Last Edit: October 10, 2006, 07:17:33 PM by MMccall »

LE

  • Guest
Re: Assigning contour elevations...
« Reply #13 on: October 10, 2006, 07:21:59 PM »
Hey!!!

I write commands for a custom Civil CAD application - and I/We here normally give the code for free....  :-)

MMccall

  • Guest
Re: Assigning contour elevations...
« Reply #14 on: October 10, 2006, 07:31:13 PM »
I meant no disrespect to those that have the ability to write their own stuff and I do appreciate you freely sharing it with everyone.   I only meant it as a quick, cheap, and simple alternative to those, like myself , that look at the code you've shared and still don't really know what to do with it.  :ugly: