Sub CreateCylinder(iCount As Integer, iDis As Integer)
' --------------------------------------------------------------
' 连接到CATIA,如果CATIA未启动,启动它
' --------------------------------------------------------------
Dim CATIA As Object
On Error Resume Next
Set CATIA = GetObject(, "CATIA.Application")
If Err.Number <> 0 Then
Set CATIA = CreateObject("CATIA.Application")
CATIA.Visible = True
End If
On Error GoTo 0
' --------------------------------------------------------------
' 创建一个零件文档
' --------------------------------------------------------------
Set documents1 = CATIA.Documents
Set partDocument1 = documents1.Add("Part")
Set part1 = partDocument1.Part
Set bodies1 = part1.Bodies