Private Sub Form_Load()
Dim objApp As SolidEdgeFramework.Application
Dim objDoc As SolidEdgePart.PartDocument
Dim objEPProfile As SolidEdgePart.Profile
Dim objEPProfArray(1 To 2) As SolidEdgePart.Profile
Dim objEPModel As SolidEdgePart.Model
Dim objMParent As SolidEdgePart.PartDocument
Dim lngStatus As Long
' Report errors
Const PI = 3.14159265358979
' Create/get the application with specific settings
On Error Resume Next
Set objApp = GetObject(, "SolidEdge.Application")
If Err Then
Err.Clear
Set objApp = CreateObject("SolidEdge.Application")
Set objDoc = objApp.Documents.Add("SolidEdge.PartDocument")
objApp.Visible = True
Else
Set objDoc = objApp.ActiveDocument
End If
' *** creating the model object
' creating the profile for an extruded protrusion feature
Set objEPProfile = objDoc.ProfileSets.Add.Profiles.Add(pRefPlaneDisp:=objDoc.RefPlanes(1))
Call objEPProfile.Circles2d.AddByCenterRadius(x:=0, y:=0, Radius:=0.025)
lngStatus = objEPProfile.End(ValidationCriteria:=igProfileClosed)
If (lngStatus <> 0) Then
MsgBox "Profile for the base feature is not closed"
End If
objEPProfile.Visible = False
' creating the base extruded protrusion
Set objEPProfArray(1) = objEPProfile
Set objEPModel = objDoc.Models.AddFiniteExtrudedProtrusion(NumberOfProfiles:=1, _
ProfileArray:=objEPProfArray, ProfilePlaneSide:=igSymmetric, _
ExtrusionDistance:=0.1)
If (objEPModel.ExtrudedProtrusions(1).Status <> igFeatureOK) Then
MsgBox "AddFiniteExtrudedProtrusion method fails"
End If
' getting the parent object of the models collection
Set objMParent = objDoc.Models.Parent
' USER DISPLAY
' Release objects
Set objApp = Nothing
Set objDoc = Nothing
Set objEPProfile = Nothing
Set objEPProfArray(1) = Nothing
Set objEPModel = Nothing
Set objMParent = Nothing
End Sub