Get GTol Witness Line Example (VB.NET)
This example shows how to get the witness line of a geometric tolerance
frame.
'---------------------------------------------------------------------------
' Preconditions:
' 1. Open:
' <SolidWorks_install_dir>\samples\tutorial\api\GTolWitnessLine.slddrw
' 2. Select the geometric tolerance frame.
' 3. Open an Immediate window.
'
' Postconditions: Inspect the Immediate window for the
' witness line start and end point coordinates.
'--------------------------------------------------------------------------
Imports
SolidWorks.Interop.sldworks
Imports
SolidWorks.Interop.swconst
Imports
System
Imports
System.Diagnostics
Partial
Class
SolidWorksMacro
Dim
swModel As
ModelDoc2
Dim
swModelDocExt As
ModelDocExtension
Dim
swSelMgr As
SelectionMgr
Dim
selGtol As
Gtol
Dim i
As
Long
Dim
params As
Object
Sub
main()
swModel = swApp.ActiveDoc
swModelDocExt = swModel.Extension
swSelMgr = swModel.SelectionManager
selGtol = swSelMgr.GetSelectedObject6(1, 0)
params = selGtol.GetWitnessLine
For
i = 0 To
UBound(params)
Debug.Print(params(i))
Next
i
End
Sub
Public
swApp As
SldWorks
End
Class