Private Sub Form_Load()
Dim objApp As SolidEdgeFramework.Application
Dim objDoc As SolidEdgePart.PartDocument
Dim objModel As SolidEdgePart.Model
Dim objRPlanes As SolidEdgePart.RefPlanes
Dim objPPlane(1 To 4) As SolidEdgePart.RefPlane
Dim objPFace(1 To 12) As SolidEdgeGeometry.Face
Dim objRPParallel(1 To 16) 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(TESTFILE)
Set objModel = objDoc.Models(1)
' geting the reference planes collection object
Set objRPlanes = objDoc.RefPlanes
' adding a reference plane parallel to and at a distance to a pricipal plane
Set objPPlane(1) = objRPlanes.Item(1)
Set objRPParallel(1) = objRPlanes.AddParallelByDistance(ParentPlane:=objPPlane(1), Distance:=0.01, _
NormalSide:=igLeft)
If (objRPlanes.Count <> 5) Then
MsgBox "AddParallelByDistance fails"
End If
' adding a reference plane coincident to a pricipal plane
Set objPPlane(2) = objRPlanes.Item(2)
Set objRPParallel(2) = objRPlanes.AddParallelByDistance(ParentPlane:=objPPlane(2), Distance:=0, _
NormalSide:=igLeft)
If (objRPlanes.Count <> 6) Then
MsgBox "AddParallelByDistance fails"
End If
' adding a reference plane parallel to and at a distance to a plane face of the cube
Set objPFace(1) = objModel.ExtrudedProtrusions(1).TopCap
Set objRPParallel(3) = objRPlanes.AddParallelByDistance(ParentPlane:=objPFace(1), Distance:=0.01, _
NormalSide:=igLeft)
If (objRPlanes.Count <> 7) Then
MsgBox "AddParallelByDistance fails"
End If
' adding a reference plane coincident to a planar face
Set objPFace(2) = objModel.ExtrudedProtrusions(1).BottomCap
Set objRPParallel(4) = objRPlanes.AddParallelByDistance(ParentPlane:=objPFace(2), Distance:=0, _
NormalSide:=igLeft)
If (objRPlanes.Count <> 8) Then
MsgBox "AddParallelByDistance fails"
End If
' using the optional arguments
' adding a reference plane parallel to and at a distance to a plane face of the cube with igLineStart
Set objPFace(3) = objModel.ExtrudedProtrusions(1).TopCap
Set objRPParallel(5) = objRPlanes.AddParallelByDistance(ParentPlane:=objPFace(3), Distance:=0.01, _
NormalSide:=igLeft, Pivot:=objPFace(3).Edges(1), pivotorigin:=igLineStart)
If (objRPlanes.Count <> 9) Then
MsgBox "AddParallelByDistance fails"
End If
' adding a reference plane coincident to a planar face with igLineStart
Set objPFace(4) = objModel.ExtrudedProtrusions(1).BottomCap
Set objRPParallel(6) = objRPlanes.AddParallelByDistance(ParentPlane:=objPFace(4), Distance:=0, _
NormalSide:=igLeft, Pivot:=objPFace(4).Edges(1), pivotorigin:=igLineStart)
If (objRPlanes.Count <> 10) Then
MsgBox "AddParallelByDistance fails"
End If
' adding a reference plane parallel to and at a distance to a plane face of the cube with igLineEnd
Set objPFace(5) = objModel.ExtrudedProtrusions(1).TopCap
Set objRPParallel(7) = objRPlanes.AddParallelByDistance(ParentPlane:=objPFace(5), Distance:=0.01, _
NormalSide:=igLeft, Pivot:=objPFace(5).Edges(1), pivotorigin:=igLineEnd)
If (objRPlanes.Count <> 11) Then
MsgBox "AddParallelByDistance fails"
End If
' adding a reference plane coincident to a planar face with igLineEnd
Set objPFace(6) = objModel.ExtrudedProtrusions(1).BottomCap
Set objRPParallel(8) = objRPlanes.AddParallelByDistance(ParentPlane:=objPFace(6), Distance:=0, _
NormalSide:=igLeft, Pivot:=objPFace(6).Edges(1), pivotorigin:=igLineEnd)
If (objRPlanes.Count <> 12) Then
MsgBox "AddParallelByDistance fails"
End If
' *** using igRight for the normalside
' adding a reference plane parallel to and at a distance to a pricipal plane
Set objPPlane(3) = objRPlanes.Item(1)
Set objRPParallel(9) = objRPlanes.AddParallelByDistance(ParentPlane:=objPPlane(3), Distance:=0.01, _
NormalSide:=igRight)
If (objRPlanes.Count <> 13) Then
MsgBox "AddParallelByDistance fails"
End If
' adding a reference plane coincident to a pricipal plane
Set objPPlane(4) = objRPlanes.Item(2)
Set objRPParallel(10) = objRPlanes.AddParallelByDistance(ParentPlane:=objPPlane(4), Distance:=0, _
NormalSide:=igRight)
If (objRPlanes.Count <> 14) Then
MsgBox "AddParallelByDistance fails"
End If
' adding a reference plane parallel to and at a distance to a plane face of the cube
Set objPFace(7) = objModel.ExtrudedProtrusions(1).TopCap
Set objRPParallel(11) = objRPlanes.AddParallelByDistance(ParentPlane:=objPFace(7), Distance:=0.01, _
NormalSide:=igRight)
If (objRPlanes.Count <> 15) Then
MsgBox "AddParallelByDistance fails"
End If
' adding a reference plane coincident to a planar face
Set objPFace(8) = objModel.ExtrudedProtrusions(1).BottomCap
Set objRPParallel(12) = objRPlanes.AddParallelByDistance(ParentPlane:=objPFace(8), Distance:=0, _
NormalSide:=igRight)
If (objRPlanes.Count <> 16) Then
MsgBox "AddParallelByDistance fails"
End If
' using the optional arguments
' adding a reference plane parallel to and at a distance to a plane face of the cube with igLineStart
Set objPFace(9) = objModel.ExtrudedProtrusions(1).TopCap
Set objRPParallel(13) = objRPlanes.AddParallelByDistance(ParentPlane:=objPFace(9), Distance:=0.01, _
NormalSide:=igRight, Pivot:=objPFace(9).Edges(1), pivotorigin:=igLineStart)
If (objRPlanes.Count <> 17) Then
MsgBox "AddParallelByDistance fails"
End If
' adding a reference plane coincident to a planar face with igLineStart
Set objPFace(10) = objModel.ExtrudedProtrusions(1).BottomCap
Set objRPParallel(14) = objRPlanes.AddParallelByDistance(ParentPlane:=objPFace(10), Distance:=0, _
NormalSide:=igRight, Pivot:=objPFace(10).Edges(1), pivotorigin:=igLineStart)
If (objRPlanes.Count <> 18) Then
MsgBox "AddParallelByDistance fails"
End If
' adding a reference plane parallel to and at a distance to a plane face of the cube with igLineEnd
Set objPFace(11) = objModel.ExtrudedProtrusions(1).TopCap
Set objRPParallel(15) = objRPlanes.AddParallelByDistance(ParentPlane:=objPFace(11), Distance:=0.01, _
NormalSide:=igRight, Pivot:=objPFace(11).Edges(1), pivotorigin:=igLineEnd)
If (objRPlanes.Count <> 19) Then
MsgBox "AddParallelByDistance fails"
End If
' adding a reference plane coincident to a planar face with igLineEnd
Set objPFace(12) = objModel.ExtrudedProtrusions(1).BottomCap
Set objRPParallel(16) = objRPlanes.AddParallelByDistance(ParentPlane:=objPFace(12), Distance:=0, _
NormalSide:=igRight, Pivot:=objPFace(12).Edges(1), pivotorigin:=igLineEnd)
If (objRPlanes.Count <> 20) Then
MsgBox "AddParallelByDistance fails"
End If
' USER DISPLAY
Dim i As Integer
' Release objects
Set objApp = Nothing
Set objDoc = Nothing
Set objModel = Nothing
Set objRPlanes = Nothing
For i = 1 To 16
Set objRPParallel(i) = Nothing
Next i
For i = 1 To 12
Set objPFace(i) = Nothing
Next i
For i = 1 To 4
Set objPPlane(i) = Nothing
Next i
End Sub