Jump to content

data from contour


hepcpltd

Recommended Posts

Acad drawing is available with survey contour. Is there any autolisp or codes which will find elevation of intermediate unknown points from nearby contours.

Link to comment
Share on other sites

Are the contours 3D lines? If so, can you draw a line from one contour to another (using Nearest Osnap), and then break the line at your required point and ID the end of the line.

 

I see that you are using LT which means that you cannot use Lisp, and I do not know about 3D lines.

Link to comment
Share on other sites

Simple maths draw a line from start contour dist1 extend to next contour dist 2 the ratio dist1/dist2 * ht diff + level 1st contour = elevation if I wrote it right.

Link to comment
Share on other sites

Having Acad full version. My problem is, there are so many points outside contour lines and with some lisp I want to assign 'Z' to those point/ Text by interpolating contour values in drawing.

Link to comment
Share on other sites

Simple maths draw a line from start contour dist1 extend to next contour dist 2 the ratio dist1/dist2 * ht diff + level 1st contour = elevation if I wrote it right.

 

Having Acad full version. My problem is, there are so many points outside contour lines and with some lisp I want to assign 'Z' to those point/ Text by interpolating contour values in drawing.

Link to comment
Share on other sites

Having Acad full version. My problem is, there are so many points outside contour lines and with some lisp I want to assign 'Z' to those point/ Text by interpolating contour values in drawing.

 

With a simple piece of drawing before and after , I guess that would clarify your needs to all readers .

Link to comment
Share on other sites

Perhaps I should repeat my request for information. Are the contour lines in 3D?

 

If most of your points are outside the contour lines, you would be extrapolating instead of interpolating.

 

How confident are you that the ground has the same slope outside the contours as that slope defined by the existing contours?

 

It might be better to request that the survey be extended to cover the area that you want.

Link to comment
Share on other sites

Try this simple code and select any entity and it would show you the Z value in a message box .

 

(defun c:Test (/ ss)
 (if (setq ss (car (entsel "\n Select Entity :")))
   (alert (strcat " The Z is >> "
                  " : "
                  (rtos (caddr (cdr (assoc 10 (entget ss)))) 2)
          )
   )
   (princ "\n Nothing Selected :")
 )
 (princ)
)

 

Tharwat

Link to comment
Share on other sites

To get the level at your point, first of all draw a line (NOT a polyline) at approximately right angles to the nearest contours (using the Osnap Nearest) so that the line passes through the desired point.

 

Then ID the line where you want the level.

InterLevel.jpg

Link to comment
Share on other sites

Here is a very old program of mine that might help, tweaked for the purpose of this post:

([color=BLUE]defun[/color] c:Sample ( [color=BLUE]/[/color] _sub dc el l1 ls p1 p2 sp ss ) [color=GREEN];; © Lee Mac 2011[/color]

   ([color=BLUE]defun[/color] _sub ( lst el )
       ([color=BLUE]if[/color] lst ([color=BLUE]cons[/color] ([color=BLUE]list[/color] ([color=BLUE]car[/color] lst) ([color=BLUE]cadr[/color] lst) el) (_sub ([color=BLUE]cdddr[/color] lst) el)))
   )

   ([color=BLUE]setq[/color] dc ([color=BLUE]vla-get-activedocument[/color] ([color=BLUE]vlax-get-acad-object[/color]))
         sp ([color=BLUE]vlax-get-property[/color] dc ([color=BLUE]if[/color] ([color=BLUE]=[/color] 1 ([color=BLUE]getvar[/color] 'CVPORT)) 'paperspace 'modelspace))
   )
   ([color=BLUE]if[/color]
       ([color=BLUE]and[/color]
           ([color=BLUE]setq[/color] p1 ([color=BLUE]getpoint[/color] [color=MAROON]"\nSpecify First Point of Sample Line: "[/color]))
           ([color=BLUE]setq[/color] p2 ([color=BLUE]getpoint[/color] [color=MAROON]"\nSpecify Second Point of Sample Line: "[/color] p1))
           ([color=BLUE]ssget[/color] [color=MAROON]"_F"[/color] ([color=BLUE]list[/color] p1 p2) '((0 . [color=MAROON]"LWPOLYLINE"[/color])))
           ([color=BLUE]setq[/color] p1 ([color=BLUE]trans[/color] p1 1 0)
                 p2 ([color=BLUE]trans[/color] p2 1 0)
           )
       )
       ([color=BLUE]progn[/color]
           ([color=BLUE]setq[/color] l1 ([color=BLUE]vlax-invoke[/color] sp 'addline p1 p2))
           ([color=BLUE]vlax-for[/color] ob ([color=BLUE]setq[/color] ss ([color=BLUE]vla-get-activeselectionset[/color] dc))
               ([color=BLUE]setq[/color] el ([color=BLUE]vla-get-elevation[/color] ob))
               ([color=BLUE]vla-put-elevation[/color] ob 0.)
               ([color=BLUE]setq[/color] ls ([color=BLUE]append[/color] ls (_sub ([color=BLUE]vlax-invoke[/color] ob 'intersectwith l1 [color=BLUE]acextendnone[/color]) el)))
               ([color=BLUE]vla-put-elevation[/color] ob el)
           )
           ([color=BLUE]vla-delete[/color] ss)
           ([color=BLUE]vla-delete[/color] l1)
           ([color=BLUE]vlax-invoke[/color] sp 'add3dpoly
               ([color=BLUE]apply[/color] '[color=BLUE]append[/color]
                   ([color=BLUE]vl-sort[/color] ls
                       ([color=BLUE]function[/color]
                           ([color=BLUE]lambda[/color] ( a b )
                               ([color=BLUE]<[/color]
                                   ([color=BLUE]distance[/color] p1 ([color=BLUE]list[/color] ([color=BLUE]car[/color] a) ([color=BLUE]cadr[/color] a)))
                                   ([color=BLUE]distance[/color] p1 ([color=BLUE]list[/color] ([color=BLUE]car[/color] b) ([color=BLUE]cadr[/color] b)))
                               )
                           )
                       )
                   )
               )
           )
       )
   )
   ([color=BLUE]princ[/color])
)
([color=BLUE]vl-load-com[/color]) ([color=BLUE]princ[/color])

Pick two points running across your contours and the above will create a 3D Polyline with vertices at the elevations of the contours.

Link to comment
Share on other sites

  • 3 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...