Issues with AddDisplayText Method of IDisplayDimension

Hello,

I was using this method when I encountered two unexpected behaviors. See the code below:

Dim swApp As SldWorks.SldWorks
Dim model As SldWorks.ModelDoc2
Dim selMgr As SldWorks.SelectionMgr
Dim skMgr As SldWorks.SketchManager
Dim dispDim As SldWorks.DisplayDimension
Dim textLoc(0 To 2) As Double
Dim point1 As SldWorks.SketchPoint
Dim point2 As SldWorks.SketchPoint

Sub main()

Set swApp = Application.SldWorks
Set model = swApp.NewPart
Set selMgr = model.SelectionManager
Set skMgr = model.SketchManager

skMgr.Insert3DSketch True

Set point1 = skMgr.CreatePoint(0, 0, 0)
Set point2 = skMgr.CreatePoint(0, 1, 0)

point1.Select4 True, Nothing
point2.Select4 True, Nothing

Set dispDim = skMgr.AddAlongYDimension(0, 0.5, 0)


textLoc(0) = 0
textLoc(1) = 0.5
textLoc(2) = 0
textString = "Text line" + Chr(13) + "Second text line"
Set textFont = model.GetUserPreferenceTextFormat(SwConst.swDetailingDimensionTextFormat)

dispDim.AddDisplayText textString, textLoc, textFont, swTextJustificationCenter, 1


skMgr.Insert3DSketch True

End Sub
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Basically, I create a new file, add two points into a 3D sketch, then add a display dimension between them. Then I use the AddDisplayText method to modify the dimension text. The issues I'm having are:

  1. When the text is more than one line, the justification doesn't work. I set the justification to be centered, but the text comes left aligned. It does work for single line texts.
  2. As per the remarks section of the documentation, this text should revert back to a standard dimension if the dimension is manually edited by the user. That's exactly what I want, so that user can tell if the dimension was modified or not, after it was added by the macro. This behavior works on one way of editing the dimension, but not the other:
    1. If the dimension is edited by double clicking the text, and using the little dimension modify window, the above behavior doesn't occur.
    2. If the dimension is edited by selecting the dimension text, and editing it from the Property Manager, the behavior occurs.

Any comment/suggestion is appreciated. Thanks in advance!

SolidworksApi/macros