Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swSelMgr As SldWorks.SelectionMgr
Dim swDisplayDimension As SldWorks.DisplayDimension
Dim swDimension As SldWorks.Dimension
Dim swDimensionTolerance As SldWorks.DimensionTolerance
Dim fontHeight As Double
Dim fontScale As Double
Dim bRet As Boolean
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swSelMgr = swModel.SelectionManager
Set swDisplayDimension = swSelMgr.GetSelectedObject6(1, 0)
If swSelMgr.GetSelectedObjectType3(1, -1) <> swSelDIMENSIONS Then Exit Sub
Set swDimension = swDisplayDimension.GetDimension
Set swDimensionTolerance = swDimension.Tolerance
swDimensionTolerance.Type = swTolType_e.swTolFIT
bRet = swDimensionTolerance.SetFitValues("H12", "")
swDimensionTolerance.Type = swTolType_e.swTolFITTOLONLY
swModel.GraphicsRedraw2
End Sub
In this case, the program will insert the "Fit", and the numerical values will be zeros. How to use swTolType_e, tolerance to match fit?
Or is it all a great bug?
SolidworksApi macros