microstation二次開發(fā)之創(chuàng)建圓柱/圓柱楔子

創(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
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

推薦閱讀更多精彩內(nèi)容