Set Line spacing on textnode using VBA

I am placing textnodes in a drawing using VBA and having issues in setting the line spacing value and type.  Seeing as textnodeelementtype does not have a textstyle property, I cannot set it directly.  I need to set the active text settings prior to adding my text node.  This is where my problem exists, as it seems when I try to set the height, width, nodespacingtype and nodespacing, MicroStation changes the spacing to be different by itself.

I want to set the values to be exact, and 0.5, which will make my line spacing half the text height.  but as soon as I change the text height, it changes my spacing.  Once the spacing has been adjusted by MicroStation, any repeated attempts in my code to change the spacing are ignored.

After studying the result Mstn changes my spacing to, it seems it is factoring the current spacing by the factor of the text height change.  changing text height from 1.0 to 3.5 will cause the nodespacing to change from 0.5 to 0.142857  (ie 1 / 3.5 * 0.5).  My drawing is metric.

The VBA code I am using to set Mstn settings is ....

  CadInputQueue.SendKeyin "textstyle active none "
  ActiveSettings.TextStyle.Height = 3.5
  ActiveSettings.TextStyle.Width = 3.5
  ActiveSettings.TextStyle.NodeLineSpacingType = msdTextNodeLineSpacingTypeExact
  ActiveSettings.TextStyle.NodeLineSpacing = 0.5

I have attempted to use other code here on the forum using a propertyhandler, to fix the element before adding to the drawing, but it refuses on the setvalue line.
 have no info on the propertyhandler structure until running the debugger, and that is only structure not explanations.

    Dim tnPH As PropertyHandler
    
        Set tnPH = CreatePropertyHandler(oTextNodeElement)
        tnPH.SelectByAccessString "LineSpacing"
        tnPH.SetValue 0.5
        tnPH.SelectByAccessString "LineSpacingType"
        tnPH.SetValue 0

Any help would be appreciated.

Parents Reply Children
No Data