Export Tube Data Example (VBA)
This example shows how to export routing tube data.
'----------------------------------------------------------------------------
' Preconditions:
' 1. Add SolidWorks Routing as an add-in
' (in SolidWorks select Tools >
Add-Ins > SolidWorks Routing).
' 2. Add the SolidWorks <version> Routing Type Library as a reference
' (in the
IDE select Tools > References).
' 3. In Tools > Options > System Options > Routing > Routing File
Locations,
' add locations of your SolidWorks Routing files.
' 4. Open install_dir\samples\tutorial\api\tubing.sldasm.
' 5. In the FeatureManager design tree select Tube1^Tubing assembly.
' 6. Open an Immediate Window.
' 7. Ensure that c:\temp exists.
'
' Postconditions: Tangent bend data is exported to c:\temp\default.html.
'--------------------------------------------------------------------------
Dim swApp As SldWorks.SldWorks
Option Explicit
Sub main()
Dim swModel As SldWorks.ModelDoc2
Dim swTopLevelAssembly As SldWorks.AssemblyDoc
Dim rtRouteManager As SWRoutingLib.RouteManager
Dim resultCode As Long
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swTopLevelAssembly = swModel
' Get the RouteManager from the top-level assembly
Set rtRouteManager = swTopLevelAssembly.GetRouteManager
If rtRouteManager Is Nothing Then
Debug.Print "No RouteManager found in top-level document."
Exit Sub
End If
resultCode = rtRouteManager.ExportTubeData("c:\temp.html",
1, 0)
End Sub