ronjonp Posted July 11, 2017 Share Posted July 11, 2017 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) ) Quote Link to comment Share on other sites More sharing options...
broncos15 Posted July 11, 2017 Author Share Posted July 11, 2017 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! Quote Link to comment Share on other sites More sharing options...
ronjonp Posted July 11, 2017 Share Posted July 11, 2017 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.