Private Sub Form_Load()
Dim objApp As SolidEdgeFrameWork.Application
Dim objDoc As SolidEdgeAssembly.AssemblyDocument
Dim objLayouts As SolidEdgeAssembly.Layouts
Dim objLayout As SolidEdgeAssembly.Layout
Dim objLayoutProfile As SolidEdgePart.Profile
' Local variables to be declared here
' 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.AssemblyDocument")
objApp.Visible = True
Else
Set objDoc = objApp.ActiveDocument
End If
On Error GoTo 0
'Get the Layouts Collection
Set objLayouts = objDoc.Layouts
'Create a new Layout
Set objLayout = objLayouts.Add(AsmRefPlane:=objDoc.RefPlanes(1))
'Get the Profile object from Layout
Set objLayoutProfile = objLayout.Profile
'Now that we got the profile object Let's draw some elements
'A line
Call objLayoutProfile.Lines2d.AddBy2Points(x1:=0, y1:=0, x2:=0.05, y2:=0.05)
'A cirlce
Call objLayoutProfile.Circles2d.AddByCenterRadius(x:=0, y:=0, Radius:=0.05)
'A RectangularPattern2d
Call objLayoutProfile.RectangularPatterns2d.Add(originx:=0.01, originy:=0.01, Width:=0.05, _
Height:=0.05, Angle:=0, OffsetType:=sePatternFitOffset, _
XCount:=4, YCount:=5, XSpace:=0.005, YSpace:=0.005)
' Release objects
Set objApp = Nothing
Set objDoc = Nothing
Set objLayouts = Nothing
Set objLayout = Nothing
Set objLayoutProfile = Nothing
End Sub