Jump to content

Finding Local Depressions in Surface


broncos15

Recommended Posts

Actually this works (average point of boundary line), but not the results you are expecting:

(defun c:sa (/ _getsurfaceanalysis a anlsys drains drainpt out p wshed x)
 ;; https://www.theswamp.org/index.php?topic=50877.msg559985#msg559985
 ;; RJP modified for surface analysis 07.07.2017
 (defun _getsurfaceanalysis (/ c3d civdb civdoc out)
   (if	(and (setq c3d (strcat "HKEY_LOCAL_MACHINE\\"
		       (if vlax-user-product-key
			 (vlax-user-product-key)
			 (vlax-product-key)
		       )
	       )
     )
     (setq c3d (vl-registry-read c3d "Release"))
     (setq c3d (substr c3d 1 (vl-string-search "." c3d (+ (vl-string-search "." c3d) 1))))
     (setq c3d (vla-getinterfaceobject
		 (vlax-get-acad-object)
		 (strcat "AeccXUiLand.AeccApplication." c3d)
	       )
     )
     (setq civdoc (vlax-get c3d 'activedocument))
     (setq civdb (vlax-get civdoc 'database))
)
     (vlax-for x (vlax-get civdb 'surfaces) (setq out (cons (vlax-get x 'surfaceanalysis) out)))
   )
   out
 )
 (if
   (and (setq a (_getsurfaceanalysis))
 (setq anlsys (mapcar '(lambda (x) (vlax-get x 'watershedanalysis)) a))
 (setq wshed (mapcar '(lambda (x) (vlax-get x 'watershedregions)) anlsys))
 (or (foreach shed wshed
       (vlax-for shed2 shed
	 (cond ((vlax-property-available-p shed2 'boundaryline)
		(setq drains (cons (vlax-safearray->list
				     (vlax-variant-value (vlax-get-property shed2 'boundaryline))
				   )
				   drains
			     )
		)
	       )
	 )
       )
     )
     drains
 )
 (setq p (getpoint "\nPick a point away from the surface: "))
   );; Average point of watershedregion boundaryline
    (foreach p2 drains
      (entmakex (list '(0 . "line")
	       (cons 10 p)
	       (cons 11 (mapcar '(lambda (x) (/ x (length p2))) (apply 'mapcar (cons '+ p2))))
	 )
      )
    )
 )
 (princ)
)

Link to comment
Share on other sites

  • Replies 22
  • Created
  • Last Reply

Top Posters In This Topic

  • broncos15

    11

  • ronjonp

    10

  • BIGAL

    1

  • lrm

    1

Top Posters In This Topic

That is close enough though so that the user can see the general region that they need check local depressions in. Thank you so much!

Link to comment
Share on other sites

That is close enough though so that the user can see the general region that they need check local depressions in. Thank you so much!

 

Glad we got it sorted :)

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