正确代码:将四面体网格设置为默认网格,并设置单元数

以下代码将 CST 中的网格类型设置为四面体网格,并设置每个最大模型框边缘的单元数为 10,每个组件框边缘的单元数为 1。

sCommand = ['With Mesh',
            '.Reset',
            '.MeshType 2',
            '.MeshTypePerComponent False',
            '.MeshTypePerComponentValue 0',
            '.CellCountPerModelBoxEdge 10',
            '.CellCountPerComponentBoxEdge 1',
            '.MeshAll',
            'End With']
sCommand = line_break.join(sCommand)
modeler.add_to_history("set tet mesh", sCommand)

代码解释:

  • With Mesh: 开始网格设置块
  • .Reset: 重置网格设置
  • .MeshType 2: 将网格类型设置为四面体网格
  • .MeshTypePerComponent False: 关闭组件级别的网格设置
  • .MeshTypePerComponentValue 0: 设置组件级别网格类型为默认值
  • .CellCountPerModelBoxEdge 10: 设置每个最大模型框边缘的单元数为 10
  • .CellCountPerComponentBoxEdge 1: 设置每个组件框边缘的单元数为 1
  • .MeshAll: 将网格设置应用于整个模型
  • End With: 结束网格设置块

将命令合并成字符串,并将其添加到 CST 的历史记录中:

  • sCommand = line_break.join(sCommand):将列表中的每行代码拼接成一个字符串
  • modeler.add_to_history("set tet mesh", sCommand):将命令字符串添加到 CST 的历史记录中,方便后续调用。

总结:

以上代码成功将 CST 中的网格类型设置为四面体网格,并设置了每个最大模型框边缘的单元数。希望这份代码能够帮助您在 CST 中进行准确的网格设置!

CST 四面体网格设置:正确代码与详细解释

原文地址: https://www.cveoy.top/t/topic/Bxe 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录