創(chuàng)建圓柱的兩種方法
方法一
接口說明
CreateCylinder (Template, radius, height)
Template 模板.
radius A Double 半徑
height A Double 高度
窗體設(shè)計
1.png
程序代碼
Sub main()
Form1.Show
End Sub
Private Sub CommandButton1_Click()
'定義半徑變量
Dim radius, height As Double
Dim solid As SmartSolidElement
'半徑
radius = Val(TextBox1.Value)
'高度
height = Val(TextBox2.Value)
'創(chuàng)建圓柱
Set solid = SmartSolid.CreateCylinder(Nothing, radius, height)
'添加至模型空間
ActiveModelReference.AddElement solid
End Sub
運行效果
2.png
方法二
接口說明2
CreateWedge (Template, radius, height, angle)
參數(shù)說明:
radius A Double 半徑
height A Double 高度
angle A Double 角度
Template 模板.
窗體設(shè)計
1 form.png
程序設(shè)計
Sub main()
Form1.Show
End Sub
Private Sub CommandButton1_Click()
Dim radius, height, angle As Double
Dim result As SmartSolidElement
'半徑
radius = Val(TextBox1.Value)
'高度
height = Val(TextBox2.Value)
'角度
angle = Val(TextBox3.Value)
Set result = SmartSolid.CreateWedge(Nothing, radius, height, angle)
ActiveModelReference.AddElement result
Form1.Hide
End Sub
運行參數(shù)1
運行參數(shù)1
運行效果1
運行效果1
運行參數(shù)2
運行參數(shù)2
運行效果2
運行效果2