broncos15 发表于 2022-7-5 16:47:37

啊,这很有道理。我使用的是2015年,所以我必须看看2015年是否存在此函数,或者是否有等效函数。

broncos15 发表于 2022-7-5 16:48:25

因此,我一直在阅读2013年和2015年的《开发者指南》,其中指出“.NET API没有实现与COM API AeccSurfaceAnalysisWaterSheds.CalculateWatersheds()方法等效的方法,但您可以使用SurfaceAnalysis.Ge****ershedData()方法访问WaterSheds
来自现有分析的数据,并更改流域区域的属性(如AreaColor)。”在运行每行代码后,anlsys变量(用于查找流域分析)和wshed(用于查找流域区域)都会给出有效的响应。我很困惑,为什么他们在看了开发者指南后,不给排水管价值(对于局部萧条)。
 
有人对我可以尝试调查的内容有什么建议/建议吗?

ronjonp 发表于 2022-7-5 16:54:05

你能把你正在试用代码的图贴出来吗?
 
下面是一个对象转储:IAeccWatershedRegionDepression
 

broncos15 发表于 2022-7-5 16:54:52

附件是我表面的一部分。我不得不把它剪下来,因为它太大了。
局部抑郁症。图纸

ronjonp 发表于 2022-7-5 16:58:56

我更新了原始代码。它出错的原因是“wshed”中嵌入了不同类型的对象。

broncos15 发表于 2022-7-5 17:02:42

这几乎完美,非常感谢你的帮助!这些线被绘制到可能发生溢流的洼地区域边缘的最低点,而不是流域洼地(即局部洼地)内的实际最低点。我将试着看看我是否能找出这些信息在流域洼地中的位置。

ronjonp 发表于 2022-7-5 17:06:38

我在“wsched”对象中没有看到任何会在上一个示例图形中绘制到红色排水沟的线。这是另一个版本,它做得更多。。也许你能找到你需要的
(defun c:sa (/ _getsurfaceanalysis a anlsys drains drainpt out p p2 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 'drains)
                  (setq drains (cons (vlax-get shed2 'drains) drains))
               )
               ((vlax-property-available-p shed2 'drainpoint)
                  (setq drainpt (cons (vlax-get shed2 'drainpoint) drainpt))
               )
               ((vlax-property-available-p shed2 'boundarydrainpoint)
                  (setq drainpt (cons (vlax-get shed2 'boundarydrainpoint) drainpt))
               )
               ((vlax-property-available-p shed2 'boundarydrainsegment)
                  (setq drainpt (cons (vlax-get shed2 'boundarydrainsegment) drainpt))
               )
           )
       )
       )
       drains
   )
   (foreach drain drains
   (vlax-for drain2 drain (setq out (cons (vlax-get drain2 'location) out)))
   )
   (setq p (getpoint "\nPick a point away from the surface: "))
   )
   (foreach x (append out drainpt)
   (setq p2 x)
   (if (= 3 (length p2))
(entmakex (list '(0 . "line") (cons 10 p) (cons 11 p2)))
(while p2
(entmakex (list '(0 . "line") (cons 10 p) (cons 11 (list (car p2) (cadr p2) (caddr p2)))))
(setq p2 (cdddr p2))
)
   )
   )
)
(princ)
)

broncos15 发表于 2022-7-5 17:09:16

我会处理这些更新后的代码,看看我能做些什么。再次感谢您的帮助!

broncos15 发表于 2022-7-5 17:11:02

所以我想我找到了如何得到点,它将是分水岭区域边界线的质心。边界线的点值在一个数组中,我不太擅长。我试着弄乱代码
(foreach shed wshed
(vlax-for shed2 shed
    (if (vlax-property-available-p shed2 'boundaryline)
      (setq drains (cons (vlax-SafeArray->List (vlax-get-propertyshed2 'boundaryline)) drains))
    )
)
       )

ronjonp 发表于 2022-7-5 17:13:27

 
你可能运气不好:
页: 1 [2]
查看完整版本: 在S中查找局部凹陷