Private Sub Form_Load()
Dim objApp As SolidEdgeFrameWork.Application
Dim objDoc As SolidEdgeDraft.DraftDocument
Dim objSheet As SolidEdgeDraft.Sheet
Dim objCompStrns As SolidEdgeFrameworkSupport.ComplexStrings2d
Dim objCompStrn1 As SolidEdgeFrameworkSupport.ComplexString2d
Dim objCompStrn2 As SolidEdgeFrameworkSupport.ComplexString2d
Dim objCompStrn3 As SolidEdgeFrameworkSupport.ComplexString2d
Dim objL1 As SolidEdgeFrameworkSupport.Line2d
Dim objL2 As SolidEdgeFrameworkSupport.Line2d
Dim objL3 As SolidEdgeFrameworkSupport.Line2d
Dim objL4 As SolidEdgeFrameworkSupport.Line2d
Dim objL5 As SolidEdgeFrameworkSupport.Line2d
Dim objL6 As SolidEdgeFrameworkSupport.Line2d
Dim objBObjs1(0 To 1) As Object
Dim objBObjs2(0 To 1) As Object
Dim objBObjs3(0 To 1) As Object
' 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.DraftDocument")
objApp.Visible = True
Else
Set objDoc = objApp.ActiveDocument
End If
On Error GoTo 0
'Get the Active Sheet object
Set objSheet = objDoc.ActiveSheet
'Create ComplexStrings2d collection object
Set objCompStrns = objSheet.ComplexStrings2d
'Draw few lines on the active sheet
Set objL1 = objSheet.Lines2d.AddBy2Points(x1:=0.1, y1:=0.1, x2:=0.2, y2:=0.2)
Set objL2 = objSheet.Lines2d.AddBy2Points(x1:=0.2, y1:=0.2, x2:=0.4, y2:=0.2)
Set objL3 = objSheet.Lines2d.AddBy2Points(x1:=0.15, y1:=0.1, x2:=0.25, y2:=0.25)
Set objL4 = objSheet.Lines2d.AddBy2Points(x1:=0.25, y1:=0.25, x2:=0.5, y2:=0.1)
Set objL5 = objSheet.Lines2d.AddBy2Points(x1:=0.175, y1:=0.1, x2:=0.325, y2:=0.2)
Set objL6 = objSheet.Lines2d.AddBy2Points(x1:=0.325, y1:=0.2, x2:=0.525, y2:=0.15)
'Store the Objects in an Array
Set objBObjs1(0) = objL1
Set objBObjs1(1) = objL2
Set objBObjs2(0) = objL3
Set objBObjs2(1) = objL4
Set objBObjs3(0) = objL5
Set objBObjs3(1) = objL6
'Create the ComplexString2d objects
Set objCompStrn1 = objCompStrns.AddByObjects(ArraySize:=2, Members:=objBObjs1())
Set objCompStrn2 = objCompStrns.AddByObjects(ArraySize:=2, Members:=objBObjs2())
Set objCompStrn3 = objCompStrns.AddByObjects(ArraySize:=2, Members:=objBObjs3())
'Apply sendtoback method to the third string
Call objCompStrn3.SendToBack
' USER DISPLAY
' Release objects
Set objApp = Nothing
Set objDoc = Nothing
Set objSheet = Nothing
Set objCompStrns = Nothing
Set objCompStrn1 = Nothing
Set objCompStrn2 = Nothing
Set objCompStrn3 = Nothing
Set objL1 = Nothing
Set objL2 = Nothing
Set objL3 = Nothing
Set objL4 = Nothing
Set objL5 = Nothing
Set objL6 = Nothing
Set objBObjs1(0) = Nothing
Set objBObjs1(1) = Nothing
Set objBObjs2(0) = Nothing
Set objBObjs2(1) = Nothing
Set objBObjs3(0) = Nothing
Set objBObjs3(1) = Nothing
End Sub