microstation二次开发之创建长方体
2019-07-09 本文已影响13人
清风明月永相随
长方体创建的接口说明
CreateSlab (Template, width, length, height)
width double类型 宽度
length double类型 长度
height double类型 高度
Template 元素模板.
窗体设计
![](https://img.haomeiwen.com/i7293730/dcc6a736bd3016e5.png)
程序代码
Sub main()
Form1.Show
End Sub
Private Sub CommandButton1_Click()
Dim length, width, height As Double
Dim solid As SmartSolidElement
'长度
length = Val(TextBox1.Value)
'宽度
width = Val(TextBox2.Value)
'高度
height = Val(TextBox3.Value)
'创建长方体
Set solid = SmartSolid.CreateSlab(Nothing, width, length, height)
'添加至模型空间
ActiveModelReference.AddElement solid
End Sub
运行效果
![](https://img.haomeiwen.com/i7293730/16cca3873657038a.png)