Private Sub Form_Load()
Dim objApp As SolidEdgeFramework.Application
Dim objDoc As SolidEdgePart.PartDocument
Dim objECProfile As SolidEdgePart.Profile
Dim objExtCutout As SolidEdgePart.ExtrudedCutout
Dim objBody As SolidEdgeGeometry.Body
Dim objEdge As SolidEdgeGeometry.Edge
Dim objStartVertex As SolidEdgeGeometry.Vertex
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 base feature
If CreateModel(objDoc) <> "" Then
MsgBox "Error creating the model"
Exit Sub
End If
' *** creating an extruded cutout on the base feature
' creating a profile for the extruded cutout feature and validating it
Set objECProfile = objDoc.ProfileSets.Add.Profiles.Add(pRefPlaneDisp:=objDoc.RefPlanes(1))
Call objECProfile.Lines2d.AddBy2Points(x1:=-0.075, y1:=0, x2:=0.075, y2:=0)
lngStatus = objECProfile.End(ValidationCriteria:=igProfileSingle)
If (lngStatus <> 0) Then
MsgBox "Profile for the extruded cutout feature is disjoint"
End If
' creating the extruded cutout feature
Set objExtCutout = objDoc.Models(1).ExtrudedCutouts.AddThroughNext(Profile:=objECProfile, ProfileSide:=igRight, _
ProfilePlaneSide:=igBoth)
If (objDoc.Models(1).ExtrudedCutouts(1).Status <> igFeatureOK) Then
MsgBox "AddThroughNext method of ExtrudedCutouts object fails"
End If
objECProfile.Visible = False
' getting the body object of the model
Set objBody = objDoc.Models(1).Body
'getting an edge from the collection of edges of the body
Set objEdge = objBody.Edges(EdgeType:=igQueryAll).Item(2)
' getting the start vertex object for the edge
Set objStartVertex = objEdge.StartVertex
' USER DISPLAY
' Release objects
Set objApp = Nothing
Set objDoc = Nothing
Set objECProfile = Nothing
Set objExtCutout = Nothing
Set objBody = Nothing
Set objEdge = Nothing
Set objStartVertex = Nothing
End Sub