Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Anonymous
in reply to: BrandonBG

I define the leader properties, create a blank leader, fill in the text of the new leader.

 

fyi: There's some module level constants used in here (e.g. oPlanes, oTG, oPartDef, etc.).

    Private Sub AnnotateTaperedGroove()
        Dim annName As String = "GasketFaceNote"
        Dim finishedFace As Face = GetFace("GasketFaceSurface")
        Dim pointOnFace As Point = finishedFace.PointOnFace
        Dim annPlane As WorkPlane = oPlanes.Item("XZ Plane")
        Dim annTextPoint As Point = oTG.CreatePoint(pointOnFace.X - 1,, pointOnFace.Z - 1)
        Dim sIPropertySet As String = "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}"
        Dim sIPropertySetName As String = "User Defined Properties"
        Dim sParameterName As String = "GasketFaceHt"
        Dim annText As String = "<Property Document='model' PropertySet='" & sIPropertySetName & "' Property='" & sParameterName & "' FormatID='" & sIPropertySet & "'></Property>"
        Call AnnotateLeaderNote(annName, annText, finishedFace, pointOnFace, annPlane, annTextPoint)
    End Sub

    Private Sub AnnotateLeaderNote(ByVal annName As String, ByVal annText As String,
                                   ByRef surfaceGeometry As Object, ByRef surfaceIntent As Object,
                                   ByRef annPlane As Object, ByRef annPoint As Point)
        Dim annIntent As GeometryIntent =
            oPartDef.CreateGeometryIntent(surfaceGeometry, surfaceIntent)
        Dim annLeaderPoints As ObjectCollection =
            oApp.TransientObjects.CreateObjectCollection()
        annLeaderPoints.Add(annPoint)
        annLeaderPoints.Add(annIntent)
        Dim annPlaneDef As AnnotationPlaneDefinition =
            oAnnotations.CreateAnnotationPlaneDefinitionUsingPlane(annPlane)
        Dim annDefinition As ModelLeaderNoteDefinition =
            oAnnotations.ModelLeaderNotes.CreateDefinition(annLeaderPoints, "", annPlaneDef)
        Dim annLeaderNote As ModelLeaderNote = oAnnotations.ModelLeaderNotes.Add(annDefinition)
        annLeaderNote.Definition.Text.FormattedText = annText
        NameLastAnnotation(annName)
    End Sub