Jump to content

Selection of contours automatically


aloy

Recommended Posts

Hello everybody,

I have a series of closed contours starting from 2.0m to 3.0m at intervals of 0.1m. I can get the area enclosed by each contour line manually by using measuregeom command and selecting a contour. I am trying to see whether the pointing to the contours can be done with lisp from top to bottom. Can this be done?.

Thanking in advance for any suggestion.

 

Aloy

Link to comment
Share on other sites

Hello everybody,

... whether the pointing to the contours can be done with lisp from top to bottom.

 

Pointing?

And where do you want area results to appear?

 

(defun c:demo (/ data ss e)
 (setq data nil
       ss
            (ssget '(
                     (0 . "LWPOLYLINE")
                     (-4 . "&=")
                     (70 . 1)
                    )
            )
 )
 (repeat (sslength ss)
   (setq e (ssname ss 0))
   (setq
     data (cons
            (list (cdr (assoc 38 (entget e))) (vlax-curve-getarea e))
            data
          )
   )
   (ssdel e ss)
 )
 (foreach itm (vl-sort data '(lambda (a b) (< (car a) (car b))))
   (princ (strcat "\nContour: "
                  (rtos (car itm))
                  "\t"
                  (rtos (cadr itm))
          )
   )
 )
 (textscr)
 (princ)
)

Edited by pBe
Link to comment
Share on other sites

Pbe thought about this but had to do something else, using ssget F should remove the need to sort the data but would mean maybe more picks.

 

This is real quick attempt just for method

(defun c:conar ( / ss x pt1 pt2)
(setq pt1 (getpoint "1st point"))
(setq pt2 (getpoint pt1 "2nd point"))
(setq ss (ssget "F" (list pt1 pt2)(list (cons 0 "Lwpolyline"))))
(repeat (setq x (sslength ss))
(alert (strcat "area is " (rtos (vla-get-area (vlax-ename->vla-object (ssname ss (setq x (- x 1)))))2 2)))
)
)
(c:conar)

Link to comment
Share on other sites

Thanks pbe. It works. However I need to point to the contour. Let me explain what I want to do:

I have a large land area say 50 hectares which is like a basin with highest contour at 3m. At the center a flat area of about 15 hectares at 2m contour. In between there are closed contours at 0.1 intervals. Water is flowing into the basin at a rate of 10 cum per second. I want to show how the area gets filled with time say by highlighting contours and indicating the time on screen when a that particular contour gets filled. In this case I am ignoring the effects of hydraulics. Is it possible to do it without pointing ( may be I can point just once)?.

Regards,

Aloy

Link to comment
Share on other sites

Pbe thought about this but had to do something else, using ssget F should remove the need to sort the data but would mean maybe more picks.

 

That is a good idea, but last night I was thinking there might be more than one contour on a given value, which means one still needs to gather all data.

 

Contour.JPG

 

(defun c:demo (/ data ss e level data)
 (setq data nil
       ss
            (ssget '(
                     (0 . "LWPOLYLINE")
                     (-4 . "&=")
                     (70 . 1)
                    )
            )
 )
 (repeat (sslength ss)
   (setq e (ssname ss 0)
         level (cdr (assoc 38 (entget e)))
         area (vlax-curve-getarea e))
   (setq data    
   	(if (setq f (assoc level data))
           (subst (list level (+ area (Cadr f))) f data)
 	(cons
             (list level area )
             data
           )            
   		)
         )
         
         
   (ssdel e ss)
 )
     
 (foreach itm (vl-sort data '(lambda (a b) (< (car a) (car b))))
   (princ (strcat "\nContour: "
                  (rtos (car itm))
                  "\t"
                  (rtos (cadr itm))
          )
   )
 )
 (textscr)
 (princ)
)

 

But then again, i could be totally off. :lol:

Link to comment
Share on other sites

Thanks pbe. It works. However I need to point to the contour. Let me explain what I want to do:

I have a large land area say 50 hectares which is like a basin with highest contour at 3m. At the center a flat area of about 15 hectares at 2m contour. In between there are closed contours at 0.1 intervals. Water is flowing into the basin at a rate of 10 cum per second. I want to show how the area gets filled with time say by highlighting contours and indicating the time on screen when a that particular contour gets filled. In this case I am ignoring the effects of hydraulics. Is it possible to do it without pointing ( may be I can point just once)?.

Regards,

Aloy

 

Its easier to understand if you post a sample drawing along with the desired result.

Link to comment
Share on other sites

Maybe use the outer boundary as the limit in this case max Z then find all inside. I agree though for a simple shape, need a dwg.

 

Pbe by dragging the two points over the whole shape what I did does work. I tested on a similar shape. I have just gone through this exercise at work and what I have done would have been useful, but as we are still playing with the shape I will use it next time.

 

The volume is the sum of two areas / 2 * height.

 

The likes of CIV3d do volume by slices.

Link to comment
Share on other sites

...I have just gone through this exercise at work and what I have done would have been useful...

...

The volume is the sum of two areas / 2 * height.

...

 

That's good to know, save us none Civil guys time figuring out whats what with the contours :D

 

Can't wait to see how this thing goes. :popcorn:

Link to comment
Share on other sites

Pbe have a go at this I need to check vols just take your image 1 side with decreasing or increasing elevations etc Pick inside then outside. A double hole needs to be done differently that is why you have Volume calc software it works from say a TIN Triangular irregular network.

 

(defun c:conar ( / ss x pt1 pt2 a1 a2 z1 z2 vol adiff volinc)
(setq pt1 (getpoint "1st point"))
(setq pt2 (getpoint pt1 "2nd point"))
(setq ss (ssget "F" (list pt1 pt2)(list (cons 0 "Lwpolyline"))))
(setq x (sslength ss))
(setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1)))))
(setq a1 (vla-get-area obj))
(setq z1 (vla-get-elevation obj))
(setq vol 0.0)
(repeat  x
(setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1)))))
(setq z2 (vla-get-elevation obj))
(setq a2 (vla-get-area obj))
(setq diff (- z1 z2))
(setq adiff (/ (+ a1 a2) 2.0))
(setq volinc (* diff adiff))
(setq vol (+ volinc  vol))
(alert (strcat  "\nTotal vol is " (rtos vol 2 2) "\nElev " (rtos z2 2 2) " - " (rtos z1 2 2) "\nPart vol is " (rtos volinc 2 2 )))
( setq a1 a2)
(setq z1 z2)
)
)
(c:conar)

Link to comment
Share on other sites

BIGAL,

This is fantastic. Thank you very much. For my simulation I will have to use these figures do some calcs, show respective hatched areas take pictures of the screen and perhaps show in a video.

Thanks again.

Link to comment
Share on other sites

pBe,

I am not allowed to put any drawings of the project. However I attach part of the points list forming the basin. This can be used to generate the points and contours via a TIN surface.

Regards,

Aloy

ptlist.lsp

Link to comment
Share on other sites

Bigal,

I created 3D plines manually and found that the code doesn't identify them. Perhaps this is because the contour lines are 2d (lwpolylines? ) and identified with a number for the level.

Thanks.

Aloy

Link to comment
Share on other sites

There was a post last week about polylines and LWpolylines and using this as a way to say is it 2d or 3d. I would need to look at this (setq z1 (vla-get-elevation obj)) rather is it 2d or 3d the 3d would pull the 1st vertice out and get the Z. Post a dwg.

Link to comment
Share on other sites

Hi Bigal,

I need to draw a pline around the point set. For that I need to pick the point in a concave boundary. Is there a way to make the osnap work when the cross (at a pline command) is near a point given in my post N. 12?.

Link to comment
Share on other sites

Actually I found the solution for the problem described in my above post. After loading the file containing the point set, activate the osnap for 'Node' , at line command hover the curser near the point that need to be snapped.

Link to comment
Share on other sites

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...