Hippe013 发表于 2022-7-5 20:49:44

4o4osan,
 
我相信我可能已经弄明白了。我在考虑如何将“UseMaxTriangleLen”属性的值设置为true,但我们的“TriangleLenMax”仍然设置为零。使用这些参数,不会创建最大三角形长度为零的曲面。因此,我需要将最大三角形长度设置为大于零的值,然后将“UseMaxTriangleLen”设置为true。
 
我使用了以下代码,能够设置值。
 
;first we need to get the Civil 3D Application Interface
(setq app (vlax-get-or-create-object "AeccXUiLand.AeccApplication.10.3"))

;Next we need to get the Active Document:
(setq ad (vlax-get-property app 'ActiveDocument))

;From there we get the settings:
(setq settings (vlax-get-property ad 'Settings))

;Then the Surface Command Settings:
(setq surfcomset (vlax-get-property settings 'SurfaceCommandsSettings))

;Then the Create Surface Settings:
(setq createsurfset (vlax-get-property surfcomset 'CreateSurfaceSettings))

;Then we finally reach the Build Options Settings:
(setq buildoptionset (vlax-get-property createsurfset 'BuildOptionsSettings))

;Next We need to set our maximum triangle length
;Get the TrianglLenMax property
(setq trimaxlen (vlax-get-property buildoptionset 'TrianglLenMax))

;Set the value to something other than zero.
(setq tml (getreal "\nEnter Maximum Triangle Length: "))
(vlax-put-property trimaxlen 'Value tml)

;Then we need to get the UseMaxTriangleLen Property
(setq UseMaxTriLen (vlax-get-property buildoptionset 'UseMaxTriangleLen))

;We can set the vlaue of this to true or false using :vlax-true or :vlax-false
(vlax-put-property UseMaxTriLen 'value :vlax-true)
 
上述代码在Civil 3D 2014上进行了测试。您可能需要编辑Civil 3D 2013的代码。为此,在检索应用程序接口时,将值10.3更改为10.0。
 
如果这对你有效,请告诉我。
 
当做
 
hippe013

4o4osan 发表于 2022-7-5 20:52:04

Hi Hippie13,
 
我相信你可以按照你描述的方式更改属性,但是如果手动选择要更改(禁用)构建设置的现有曲面,代码会是什么样子呢?
 
我试了很多东西,但还没有结果。

Hippe013 发表于 2022-7-5 20:57:57

你能把到目前为止你放在一起的东西贴出来吗?

4o4osan 发表于 2022-7-5 21:00:27

嗨,嬉皮士,
 
我测试了你的代码,它运行良好,但只在任何新创建的曲面上-我可以启用/禁用“使用最大三角形长度”。我的目标是在现有曲面上更改的构建设置。
 
(vl-load-com)

;first we need to get the Civil 3D Application Interface
;;;(setq app (vlax-get-or-create-object "AeccXUiLand.AeccApplication.10.0"))

(setq se (entsel "\nSelect Surface only: "))
(setq see (vlax-ename->vla-object(car se)))
(setq app (vlax-get-property see 'Application))

;Next we need to get the Active Document:
(setq ad (vlax-get-property app 'ActiveDocument))

;From there we get the settings:
(setq settings (vlax-get-property ad 'Settings))

;Then the Surface Command Settings:
(setq surfcomset (vlax-get-property settings 'SurfaceCommandsSettings))

;Then the Create Surface Settings:
(setq createsurfset (vlax-get-property surfcomset 'CreateSurfaceSettings))

;Then we finally reach the Build Options Settings:
(setq buildoptionset (vlax-get-property createsurfset 'BuildOptionsSettings))

;Next We need to set our maximum triangle length
;Get the TrianglLenMax property
(setq trimaxlen (vlax-get-property buildoptionset 'TrianglLenMax))

;Set the value to something other than zero.
(setq tml (getreal "\nEnter Maximum Triangle Length: "))
(vlax-put-property trimaxlen 'Value tml)

;Then we need to get the UseMaxTriangleLen Property
(setq UseMaxTriLen (vlax-get-property buildoptionset 'UseMaxTriangleLen))

;We can set the vlaue of this to true or false using :vlax-true or :vlax-false
(vlax-put-property UseMaxTriLen 'value :vlax-true)
 
这是我的猜测,在代码的开头添加了一些额外的行。它不起作用,我知道为什么-因为我正在更改变量,这些变量与所选曲面不再有任何联系。
我缺少如何将属性放在子属性上的知识。

BIGAL 发表于 2022-7-5 21:04:58

有时需要一个树形图来计算你有多深。
 
对于任何感兴趣的人来说,这是我的版本检查在主程序发布之前被称为defun,然后释放并不重要,保存在我的自动加载中。lsp
 
;vercheck.lspversion check for *aecc objects

(defun ah:vercheck ( / vrsn appstr)
(vl-load-com)
(if ((lambda (vrsn)
       (cond
      ((vl-string-search "R17.2" vrsn) (setq appstr "6.0")) ;09
      ((vl-string-search "R18.0" vrsn) (setq appstr "7.0")) ;10
      ((vl-string-search "R18.1" vrsn) (setq appstr "8.0")) ;11
      ((vl-string-search "R18.2" vrsn) (setq appstr "9.0")) ;12 ?
      ((vl-string-search "R19.0" vrsn) (setq appstr "10.0")) ;13
      ((vl-string-search "R19.1" vrsn)(setq appstr "11.0"));;2014
      ((vl-string-search "R20.0" vrsn)(setq appstr "12.0"));;2015
      ((alert "This version of C3D not supported!"))
       )
      )
      (vlax-product-key)
   )                         ; end if condition progn is true
   (progn
       (cond (*AeccDoc*)
         ((setq *AeccDoc*
         (vlax-get
             (cond (*AeccApp*)
               ((setq *AeccApp*
               (vla-getinterfaceobject
                  (cond (*Acad*)
                  ((setq *Acad* (vlax-get-acad-object)))
                  )
                  (strcat "AeccXUiLand.AeccApplication." appstr)
               )
                )
               )
             )
             'ActiveDocument
         )
          )
         )
       ) ; end main cond
   ) ; end progn
) ; end if vsrn
)

Hippe013 发表于 2022-7-5 21:07:05

这可能会为你指明正确的方向。
 
更改现有曲面的生成设置。(测试Civil 3d 2014)
 
;Get your existing surface
(setq surf-obj (vlax-ename->vla-object (car (entsel "\nSelect Surface Object:"))))

;Get the Surface Definition Properties
(setq defprop (vlax-get-property surf-obj 'DefinitionProperties))

;Set the Maximum Triangle Length
(setq tml (getreal "\nEnter Maximum Triangle Length:"))

(vlax-put-property defprop 'MaximumTriangleLength tml)

;Use Maximum Triangle Length
(vlax-put-property defprop 'UseMaximumTriangleLength :vlax-true)

;Rebuild your Surface
(vlax-invoke-method surf-obj 'Rebuild)

4o4osan 发表于 2022-7-5 21:09:13

万岁,
 
任务完成50%。非常感谢Hippie13。
您的代码适用于任何曲面。
 
我搜索了更多可以将UseMaximumAngle更改为No,buuut。。。再次没有运气。
 
奇怪的是,所有的定义选项都列在“DefinitionProperties”中,除了我要找的:x之外
 
我读了更多关于该设置的内容,每次保存并再次打开图形时,子设置“相邻三角网线之间的最大角度”似乎都会变为默认值。我做了测试,结果是真的,这让它更加可疑。
无论如何,我会继续挖掘!

Hippe013 发表于 2022-7-5 21:14:17

很高兴听到它为你工作!
 
我怀疑“使用三角网线之间的最大角度”对大多数用户来说并不重要,因此它没有包含在API中。我可以看到使用它的原因(也许?),但是,在我放在一起的所有表面上,我从来没有发现自己使用过那种约束设置。
 
您可能知道,Civil 3D对象上的ActiveX方法和属性的文档很少(如果有)。
 
我敢打赌,可以使用更改设置。NET,因为它是托管API。
 
当做
 
hippe013
页: 1 [2]
查看完整版本: 更改曲面生成设置