Add multiline text note

I would like to place a mulite line text note with leader. However the secondary text line cannot appear.

 Thx!

Dim oStartPoint As Point3d
Dim oEndPoint As Point3d
Dim o3EndPoint As Point3d
Dim dimstl As DimensionStyle
Dim dimstls As DimensionStyles
Dim dimEl As DimensionElement


oStartPoint.x = 0
oStartPoint.y = 0
oStartPoint.z = 0
oEndPoint.x = 0.45
oEndPoint.y = 0.45
oEndPoint.z = 0
o3EndPoint.x = 0.85
o3EndPoint.y = 0.45
o3EndPoint.z = 0

 

Set dimstls = ActiveDesignFile.DimensionStyles

Set dimstl = dimstls.Item(1)
dimstl.NoteLeaderType = MsdDimNoteLeaderTypeLine
Set dimEl = CreateDimensionElement1(Nothing, rotation, MsdDimType.msdDimTypeNote)


dimEl.AddReferencePoint ActiveModelReference, oStartPoint
dimEl.AddReferencePoint ActiveModelReference, oEndPoint
dimEl.AddReferencePoint ActiveModelReference, o3EndPoint


dimEl.PrimaryText = "First Line"
dimEl.SecondaryText = "Secondary Line"
dimEl.Redraw DrawMode

ActiveModelReference.AddElement dimEl

Parents
  • I think you are getting confused with a dimensions primary and secondary dimension display, ie the capability to display a dimension in mm and inches. What you need to do is simply build up your string with line feed characters. I don't believe the note has the capability to display secondary annotation.

    Replace dimEl.PrimaryText = "First Line"

    With

    dimEl.PrimaryText = "First Line" & vbLf & "Second Line"

    you will then have a multiline leader.

    HTH

    Andy

  • Thx Andy!

    I replaced the syntax. However the note shown in one line as First Line *  Second Line.

    Regards,

    Wah

     

    Wah

  • Was there a resolution to this?

    I'm running into the same problem. I've tried different vb constants:

    dimEl.PrimaryText (1, msdDimTextFieldMain) = "First Line" & vbLf & "Second Line" & vbCrLf & "Third Line"

    dimEl.PrimaryText (1, msdDimTextFieldMain) = "First Line" & vbLf & "Second Line" & vbLf & "Third Line"

    dimEl.PrimaryText (1, msdDimTextFieldMain) = "First Line" & vbLf & "Second Line" & vbCr & "Third Line"

    dimEl.PrimaryText (1, msdDimTextFieldMain) = "First Line" & vbLf & "Second Line" & vbLf & "Third Line"

    They all give similar results, but none gives me multiple text lines.

    Thanks,

    Rod

    Rod Wing
    Senior Systems Analyst

  • One other peculiar thing I found using the CreateDimensionElement1 method is that the note created did not implement many of the Note settings in the dimension style.

    I found a solution posted by John Gooding on the old discussion.bentley.com site. Using CadInputQueue you can send lines of text to the Wordprocessor dialog using the following syntax.

    With CadInputQueue
        .SendCommand "WORD PLACE NOTE ICON "
        .SendMessageToApplication "WORDPROC", "firstline This is the first line"
        .SendMessageToApplication "WORDPROC", "nextline This is the second line"
        .SendMessageToApplication "WORDPROC", "nextline This is the third line"
    End With

    What I did is to use the CreateDimensionElement1 method while placing the datapoints to allow for dynamics. Then after the user enters the second datapoint I thow out the element created by the CreateDimensionElement1 method and call this sub to place the note.

    Sub PlaceNoteEnd(pt1 As Point3d, pt2 As Point3d, strArray() As String)
        Dim i As Long
        Dim iStart As Long
        Dim iEnd As Long
       
        iStart = LBound(strArray)
        iEnd = UBound(strArray)
       
        With CadInputQueue
            .SendCommand "WORD PLACE NOTE ICON "
            .SendMessageToApplication "WORDPROC", "firstline " & strArray(iStart)
           
            iStart = iStart + 1
            For i = iStart To iEnd
                .SendMessageToApplication "WORDPROC", "nextline " & strArray(i)
            Next
           
            .SendDataPoint pt1
            .SendDataPoint pt2
        End With
    End Sub

    Rod Wing
    Senior Systems Analyst

Reply
  • One other peculiar thing I found using the CreateDimensionElement1 method is that the note created did not implement many of the Note settings in the dimension style.

    I found a solution posted by John Gooding on the old discussion.bentley.com site. Using CadInputQueue you can send lines of text to the Wordprocessor dialog using the following syntax.

    With CadInputQueue
        .SendCommand "WORD PLACE NOTE ICON "
        .SendMessageToApplication "WORDPROC", "firstline This is the first line"
        .SendMessageToApplication "WORDPROC", "nextline This is the second line"
        .SendMessageToApplication "WORDPROC", "nextline This is the third line"
    End With

    What I did is to use the CreateDimensionElement1 method while placing the datapoints to allow for dynamics. Then after the user enters the second datapoint I thow out the element created by the CreateDimensionElement1 method and call this sub to place the note.

    Sub PlaceNoteEnd(pt1 As Point3d, pt2 As Point3d, strArray() As String)
        Dim i As Long
        Dim iStart As Long
        Dim iEnd As Long
       
        iStart = LBound(strArray)
        iEnd = UBound(strArray)
       
        With CadInputQueue
            .SendCommand "WORD PLACE NOTE ICON "
            .SendMessageToApplication "WORDPROC", "firstline " & strArray(iStart)
           
            iStart = iStart + 1
            For i = iStart To iEnd
                .SendMessageToApplication "WORDPROC", "nextline " & strArray(i)
            Next
           
            .SendDataPoint pt1
            .SendDataPoint pt2
        End With
    End Sub

    Rod Wing
    Senior Systems Analyst

Children
No Data