Private Sub Form_Load()
Dim objApp As SolidEdgeFrameWork.Application
Dim objDoc As SolidEdgePart.PartDocument
Dim objProfile As SolidEdgePart.Profile
Dim objProfileset As SolidEdgePart.ProfileSet
Dim objEdges As Object
Dim objEdge As Object
Dim objGeom2d As Object
Dim objPrjGeom2d As Object
' Local variables to be declared here
Const TESTFILE = "T:\vbtests\testcases\Cylinder.par"
' 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
On Error GoTo 0
'Close the existing Document
Call objDoc.Close(Savechanges:=False)
'Open the test case
Set objDoc = objApp.Documents.Open(Filename:=TESTFILE)
'Get the Edges collection of the ExtrudedProtrusion1
Set objEdges = objDoc.Models(1).ExtrudedProtrusions(1).Edges(igQueryAll)
'Get the circular edge
Set objEdge = objEdges(1)
'Get the ProfileSet
Set objProfileset = objDoc.ProfileSets.Add
'Add a Profile
Set objProfile = objProfileset.Profiles.Add(objDoc.RefPlanes(1))
'Project the Circular Edge onto the Profile to get the 2d Geometry object
Set objPrjGeom2d = objProfile.ProjectEdge(objEdge)
' Release objects
Set objApp = Nothing
Set objDoc = Nothing
Set objProfileset = Nothing
Set objProfile = Nothing
Set objEdges = Nothing
Set objEdge = Nothing
Set objPrjGeom2d = Nothing
End Sub