Private Sub Form_Load()
Dim objApp As SolidEdgeFramework.Application
Dim objDoc As SolidEdgePart.PartDocument
Dim objCurve As SolidEdgePart.Profile
Dim objRPNTC As SolidEdgePart.RefPlane
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 a circular profile on a principal reference plane
Set objCurve = objDoc.ProfileSets.Add.Profiles.Add(pRefPlaneDisp:=objDoc.RefPlanes(1))
Call objCurve.Circles2d.AddByCenterRadius(x:=0, y:=0, Radius:=0.1)
lngStatus = objCurve.End(ValidationCriteria:=igProfileClosed)
If lngStatus <> 0 Then
MsgBox "profile is not closed"
End If
' *** creating a reference plane normal to the above curve with igCurveEnd & igPivotEnd
Set objRPNTC = objDoc.RefPlanes.AddNormalToCurve(Curve:=objCurve, _
PlanePoint:=igCurveEnd, OrientationPlaneOrPivot:=objDoc.RefPlanes(1), _
pivotorigin:=igPivotEnd)
If (objDoc.RefPlanes.Count <> 4) Then
MsgBox "AddNormalToCurve method fails with igCurveEnd & igPivotEnd"
End If
Set objRPNTC = Nothing
' *** creating a reference plane normal to the above curve with igCurveStart & igPivotEnd
Set objRPNTC = objDoc.RefPlanes.AddNormalToCurve(Curve:=objCurve, _
PlanePoint:=igCurveStart, OrientationPlaneOrPivot:=objDoc.RefPlanes(1), _
pivotorigin:=igPivotEnd)
If (objDoc.RefPlanes.Count <> 5) Then
MsgBox "AddNormalToCurve method fails with igCurveStart & igPivotEnd"
End If
Set objRPNTC = Nothing
' *** creating a reference plane normal to the above curve with igCurveEnd & igPivotStart
Set objRPNTC = objDoc.RefPlanes.AddNormalToCurve(Curve:=objCurve, _
PlanePoint:=igCurveEnd, OrientationPlaneOrPivot:=objDoc.RefPlanes(1), _
pivotorigin:=igPivotStart)
If (objDoc.RefPlanes.Count <> 6) Then
MsgBox "AddNormalToCurve method fails with igCurveEnd & igPivotStart"
End If
Set objRPNTC = Nothing
' *** creating a reference plane normal to the above curve with igCurveStart & igPivotStart
Set objRPNTC = objDoc.RefPlanes.AddNormalToCurve(Curve:=objCurve, _
PlanePoint:=igCurveStart, OrientationPlaneOrPivot:=objDoc.RefPlanes(1), _
pivotorigin:=igPivotStart)
If (objDoc.RefPlanes.Count <> 7) Then
MsgBox "AddNormalToCurve method fails with igCurveStart & igPivotStart"
End If
Set objRPNTC = Nothing
' USER DISPLAY
' Release objects
Set objApp = Nothing
Set objDoc = Nothing
Set objCurve = Nothing
Set objRPNTC = Nothing
End Sub