Private Sub Form_Load()
Dim objApp As SolidEdgeFramework.Application
Dim objDoc As SolidEdgePart.PartDocument
Dim objModel As SolidEdgePart.Model
Dim objPPlane(1 To 2) As SolidEdgePart.RefPlane
Dim objPFaces(1 To 4) As SolidEdgeGeometry.Face
Dim objRPAngular(1 To 6) As SolidEdgePart.RefPlane
Const TESTFILE = "T:\vbtests\testcases\cube.par"
' 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
Call objDoc.Close
' opening the test case file
Set objDoc = objApp.Documents.Open(Filename:=TESTFILE)
Set objModel = objDoc.Models(1)
' *** creating a reference plane at an angle and normal to a principal reference plane
Set objPPlane(1) = objDoc.RefPlanes(2)
Set objRPAngular(1) = objDoc.RefPlanes.AddAngularByAngle(ParentPlane:=objPPlane(1), _
Angle:=(2 * PI / 3), NormalSide:=igNormalSide, Pivot:=objDoc.RefPlanes(1), _
pivotorigin:=igPivotEnd, Local:=True)
If (objDoc.RefPlanes.Count <> 5) Then
MsgBox "AddAngularByAngle method of the RefPlanes object fails"
End If
' *** creating a reference plane at an angle and reverse normal to a principal reference plane
Set objPPlane(2) = objDoc.RefPlanes(2)
Set objRPAngular(2) = objDoc.RefPlanes.AddAngularByAngle(ParentPlane:=objPPlane(2), _
Angle:=(2 * PI / 3), NormalSide:=igReverseNormalSide, Pivot:=objDoc.RefPlanes(1), _
pivotorigin:=igPivotEnd, Local:=True)
If (objDoc.RefPlanes.Count <> 6) Then
MsgBox "AddAngularByAngle method of the RefPlanes object fails"
End If
' *** creating a reference plane at an angle and normal to the top face of a cube with igPivotEnd
Set objPFaces(1) = objModel.ExtrudedProtrusions(1).TopCap
Set objRPAngular(3) = objDoc.RefPlanes.AddAngularByAngle(ParentPlane:=objPFaces(1), _
Angle:=(PI / 3), NormalSide:=igNormalSide, Pivot:=objPFaces(1).Edges(1), _
pivotorigin:=igPivotEnd, Local:=False)
If (objDoc.RefPlanes.Count <> 7) Then
MsgBox "AddAngularByAngle method of the RefPlanes object fails"
End If
' *** creating a reference plane at an angle and reverse normal to the top face of a cube with igPivotEnd
Set objPFaces(2) = objModel.ExtrudedProtrusions(1).TopCap
Set objRPAngular(4) = objDoc.RefPlanes.AddAngularByAngle(ParentPlane:=objPFaces(2), _
Angle:=(PI / 3), NormalSide:=igReverseNormalSide, Pivot:=objPFaces(2).Edges(1), _
pivotorigin:=igPivotEnd, Local:=False)
If (objDoc.RefPlanes.Count <> 8) Then
MsgBox "AddAngularByAngle method of the RefPlanes object fails"
End If
' *** creating a reference plane at an angle and normal to the top face of a cube with igPivotStart
Set objPFaces(3) = objModel.ExtrudedProtrusions(1).TopCap
Set objRPAngular(5) = objDoc.RefPlanes.AddAngularByAngle(ParentPlane:=objPFaces(3), _
Angle:=(PI / 3), NormalSide:=igNormalSide, Pivot:=objPFaces(3).Edges(1), _
pivotorigin:=igPivotStart, Local:=False)
If (objDoc.RefPlanes.Count <> 9) Then
MsgBox "AddAngularByAngle method of the RefPlanes object fails"
End If
' *** creating a reference plane at an angle and reverse normal to the top face of a cube with igPivotStart
Set objPFaces(4) = objModel.ExtrudedProtrusions(1).TopCap
Set objRPAngular(6) = objDoc.RefPlanes.AddAngularByAngle(ParentPlane:=objPFaces(4), _
Angle:=(PI / 3), NormalSide:=igReverseNormalSide, Pivot:=objPFaces(4).Edges(1), _
pivotorigin:=igPivotStart, Local:=False)
If (objDoc.RefPlanes.Count <> 10) Then
MsgBox "AddAngularByAngle method of the RefPlanes object fails"
End If
' USER DISPLAY
Dim i As Integer
' Release objects
Set objApp = Nothing
Set objDoc = Nothing
Set objModel = Nothing
For i = 1 To 6
Set objRPAngular(i) = Nothing
Next i
For i = 1 To 4
Set objPFaces(i) = Nothing
Next i
Set objPPlane(1) = Nothing
Set objPPlane(2) = Nothing
End Sub