AddTolerance Method (ActiveX)

Creates a tolerance entity.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddTolerance(Text, InsertionPoint, Direction)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

Text

Access: Input-only

Type: String

The text string for the tolerance.

InsertionPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates in the drawing specifying the placement of the tolerance symbol.

Direction

Access: Input-only

Type: Variant (three-element array of doubles)

A 3D directional vector specifying the direction of the tolerance symbol.

Return Value (RetVal)

Type: Tolerance

The newly created Tolerance object.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AddTolerance()
    ' This example creates a tolerance object in model space.
    
    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 = "{\Fgdt;r}%%vasdf{\Fgdt;l}%%vdf%%vxc%%v12{\Fgdt;m}%%vsd" & vbCrLf & _
                 "{\Fgdt;t}%%vdfd%%v3dd{\Fgdt;l}%%vv%%v%%vxc{\Fgdt;m}" & vbCrLf & _
                 "123"
    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

Visual LISP:

(vl-load-com)
(defun c:Example_AddTolerance()
    ;; This example creates a tolerance object in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    ;; Define the tolerance object
    (setq insertionPoint (vlax-3d-point 5 5 0)
          direction (vlax-3d-point 1 0 0))

;;"{\Fgdt;r}%%vasdf{\Fgdt;l}%%vdf%%vxc%%v12{\Fgdt;m}%%vsd"
  
    (setq textString (strcat "{\\Fgdt;r}%%vasdf{\\Fgdt;l}%%vdf%%vxc%%v12{\\Fgdt;m}%%vsd\n"
                             "{\\Fgdt;t}%%vdfd%%v3dd{\\Fgdt;l}%%vv%%v%%vxc{\\Fgdt;m}\n"
                             "123"
                     )
    )
	
    ;; Create the tolerance object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq toleranceObj (vla-AddTolerance modelSpace textString insertionPoint direction))  
    (vla-ZoomAll acadObj)
)