乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
楼主: 4o4osan

[编程交流] 更改曲面生成设置

[复制链接]

20

主题

338

帖子

323

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
100
发表于 2022-7-5 20:49:44 | 显示全部楼层
4o4osan,
 
我相信我可能已经弄明白了。我在考虑如何将“UseMaxTriangleLen”属性的值设置为true,但我们的“TriangleLenMax”仍然设置为零。使用这些参数,不会创建最大三角形长度为零的曲面。因此,我需要将最大三角形长度设置为大于零的值,然后将“UseMaxTriangleLen”设置为true。
 
我使用了以下代码,能够设置值。
 
  1. ;first we need to get the Civil 3D Application Interface
  2. (setq app (vlax-get-or-create-object "AeccXUiLand.AeccApplication.10.3"))
  3. ;Next we need to get the Active Document:
  4. (setq ad (vlax-get-property app 'ActiveDocument))
  5. ;From there we get the settings:
  6. (setq settings (vlax-get-property ad 'Settings))
  7. ;Then the Surface Command Settings:
  8. (setq surfcomset (vlax-get-property settings 'SurfaceCommandsSettings))
  9. ;Then the Create Surface Settings:
  10. (setq createsurfset (vlax-get-property surfcomset 'CreateSurfaceSettings))
  11. ;Then we finally reach the Build Options Settings:
  12. (setq buildoptionset (vlax-get-property createsurfset 'BuildOptionsSettings))
  13. ;Next We need to set our maximum triangle length
  14. ;Get the TrianglLenMax property
  15. (setq trimaxlen (vlax-get-property buildoptionset 'TrianglLenMax))
  16. ;Set the value to something other than zero.
  17. (setq tml (getreal "\nEnter Maximum Triangle Length: "))
  18. (vlax-put-property trimaxlen 'Value tml)
  19. ;Then we need to get the UseMaxTriangleLen Property
  20. (setq UseMaxTriLen (vlax-get-property buildoptionset 'UseMaxTriangleLen))
  21. ;We can set the vlaue of this to true or false using :vlax-true or :vlax-false
  22. (vlax-put-property UseMaxTriLen 'value :vlax-true)

 
上述代码在Civil 3D 2014上进行了测试。您可能需要编辑Civil 3D 2013的代码。为此,在检索应用程序接口时,将值10.3更改为10.0。
 
如果这对你有效,请告诉我。
 
当做
 
hippe013
回复

使用道具 举报

9

主题

24

帖子

15

银币

初来乍到

Rank: 1

铜币
45
发表于 2022-7-5 20:52:04 | 显示全部楼层
Hi Hippie13,
 
我相信你可以按照你描述的方式更改属性,但是如果手动选择要更改(禁用)构建设置的现有曲面,代码会是什么样子呢?
 
我试了很多东西,但还没有结果。
回复

使用道具 举报

20

主题

338

帖子

323

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
100
发表于 2022-7-5 20:57:57 | 显示全部楼层
你能把到目前为止你放在一起的东西贴出来吗?
回复

使用道具 举报

9

主题

24

帖子

15

银币

初来乍到

Rank: 1

铜币
45
发表于 2022-7-5 21:00:27 | 显示全部楼层
嗨,嬉皮士,
 
我测试了你的代码,它运行良好,但只在任何新创建的曲面上-我可以启用/禁用“使用最大三角形长度”。我的目标是在现有曲面上更改的构建设置。
 
  1. [code](vl-load-com)
  2. ;first we need to get the Civil 3D Application Interface
  3. ;;;(setq app (vlax-get-or-create-object "AeccXUiLand.AeccApplication.10.0"))
  4. (setq se (entsel "\nSelect Surface only: "))
  5. (setq see (vlax-ename->vla-object  (car se)))
  6. (setq app (vlax-get-property see 'Application))
  7. ;Next we need to get the Active Document:
  8. (setq ad (vlax-get-property app 'ActiveDocument))
  9. ;From there we get the settings:
  10. (setq settings (vlax-get-property ad 'Settings))
  11. ;Then the Surface Command Settings:
  12. (setq surfcomset (vlax-get-property settings 'SurfaceCommandsSettings))
  13. ;Then the Create Surface Settings:
  14. (setq createsurfset (vlax-get-property surfcomset 'CreateSurfaceSettings))
  15. ;Then we finally reach the Build Options Settings:
  16. (setq buildoptionset (vlax-get-property createsurfset 'BuildOptionsSettings))
  17. ;Next We need to set our maximum triangle length
  18. ;Get the TrianglLenMax property
  19. (setq trimaxlen (vlax-get-property buildoptionset 'TrianglLenMax))
  20. ;Set the value to something other than zero.
  21. (setq tml (getreal "\nEnter Maximum Triangle Length: "))
  22. (vlax-put-property trimaxlen 'Value tml)
  23. ;Then we need to get the UseMaxTriangleLen Property
  24. (setq UseMaxTriLen (vlax-get-property buildoptionset 'UseMaxTriangleLen))
  25. ;We can set the vlaue of this to true or false using :vlax-true or :vlax-false
  26. (vlax-put-property UseMaxTriLen 'value :vlax-true)
[/code]
 
这是我的猜测,在代码的开头添加了一些额外的行。它不起作用,我知道为什么-因为我正在更改变量,这些变量与所选曲面不再有任何联系。
我缺少如何将属性放在子属性上的知识。
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 21:04:58 | 显示全部楼层
有时需要一个树形图来计算你有多深。
 
对于任何感兴趣的人来说,这是我的版本检查在主程序发布之前被称为defun,然后释放并不重要,保存在我的自动加载中。lsp
 
  1. ;vercheck.lsp  version check for *aecc objects
  2. (defun ah:vercheck ( / vrsn appstr)
  3. (vl-load-com)
  4. (if ((lambda (vrsn)
  5.        (cond
  6.         ((vl-string-search "R17.2" vrsn) (setq appstr "6.0")) ;09
  7.         ((vl-string-search "R18.0" vrsn) (setq appstr "7.0")) ;10
  8.         ((vl-string-search "R18.1" vrsn) (setq appstr "8.0")) ;11
  9.         ((vl-string-search "R18.2" vrsn) (setq appstr "9.0")) ;12 ?
  10.         ((vl-string-search "R19.0" vrsn) (setq appstr "10.0")) ;13
  11.         ((vl-string-search "R19.1" vrsn)(setq appstr "11.0"));;2014
  12.         ((vl-string-search "R20.0" vrsn)(setq appstr "12.0"));;2015
  13.         ((alert "This version of C3D not supported!"))
  14.        )
  15.       )
  16.       (vlax-product-key)
  17.      )                         ; end if condition progn is true
  18.      (progn
  19.        (cond (*AeccDoc*)
  20.          ((setq *AeccDoc*
  21.            (vlax-get
  22.              (cond (*AeccApp*)
  23.                ((setq *AeccApp*
  24.                  (vla-getinterfaceobject
  25.                     (cond (*Acad*)
  26.                     ((setq *Acad* (vlax-get-acad-object)))
  27.                     )
  28.                     (strcat "AeccXUiLand.AeccApplication." appstr)
  29.                  )
  30.                 )
  31.                )
  32.              )
  33.              'ActiveDocument
  34.            )
  35.           )
  36.          )
  37.        ) ; end main cond
  38.      ) ; end progn
  39. ) ; end if vsrn
  40. )
回复

使用道具 举报

20

主题

338

帖子

323

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
100
发表于 2022-7-5 21:07:05 | 显示全部楼层
这可能会为你指明正确的方向。
 
更改现有曲面的生成设置。(测试Civil 3d 2014)
 
  1. ;Get your existing surface
  2. (setq surf-obj (vlax-ename->vla-object (car (entsel "\nSelect Surface Object:"))))
  3. ;Get the Surface Definition Properties
  4. (setq defprop (vlax-get-property surf-obj 'DefinitionProperties))
  5. ;Set the Maximum Triangle Length
  6. (setq tml (getreal "\nEnter Maximum Triangle Length:"))
  7. (vlax-put-property defprop 'MaximumTriangleLength tml)
  8. ;Use Maximum Triangle Length
  9. (vlax-put-property defprop 'UseMaximumTriangleLength :vlax-true)
  10. ;Rebuild your Surface
  11. (vlax-invoke-method surf-obj 'Rebuild)
回复

使用道具 举报

9

主题

24

帖子

15

银币

初来乍到

Rank: 1

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

使用道具 举报

20

主题

338

帖子

323

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
100
发表于 2022-7-5 21:14:17 | 显示全部楼层
很高兴听到它为你工作!
 
我怀疑“使用三角网线之间的最大角度”对大多数用户来说并不重要,因此它没有包含在API中。我可以看到使用它的原因(也许?),但是,在我放在一起的所有表面上,我从来没有发现自己使用过那种约束设置。
 
您可能知道,Civil 3D对象上的ActiveX方法和属性的文档很少(如果有)。
 
我敢打赌,可以使用更改设置。NET,因为它是托管API。
 
当做
 
hippe013
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-11 09:26 , Processed in 0.993004 second(s), 66 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表