About Creating Geometric Tolerances (VBA/ActiveX)

To create a geometric tolerance, use the AddTolerance method.

This method requires three values as input: the text string comprising the tolerance symbol, the location in the drawing to place the tolerance, and a directional vector specifying the direction of the tolerance. You can also copy, move, erase, scale, and rotate tolerances.

Create a geometric tolerance

This example creates a simple geometric tolerance in model space.

Sub Ch5_CreateTolerance()
    Dim toleranceObj As AcadTolerance
    Dim textString As String
    Dim insertionPoint(0 To 2) As Double
    Dim direction(0 To 2) As Double

    ' Define the tolerance object
    textString = "Here is the Feature Control Frame"
    insertionPoint(0) = 5
    insertionPoint(1) = 5
    insertionPoint(2) = 0
    direction(0) = 1
    direction(1) = 1
    direction(2) = 0
    ' Create the tolerance object in model space
    Set toleranceObj = ThisDrawing.ModelSpace. _
        AddTolerance(textString, insertionPoint, direction)
    ZoomAll
End Sub