We have a number of VBA macros that were written prior to V8i and they have, for the most part, migrated to V8i with not too much recoding. The same cannot be said about migrating to Connect. We are primarily InRoads/Open Roads users, so our version of connect is buried in the ORD version. And we are still in the "getting our workspace up and running mode" so the version installed is ORD 2019 R2.
We have a tool that creates a cell containing some shapes and text. The code uses CreateTextNodeElement1 relying on ActiveSettings.TextStyle.NoteJustification and .NodeLineSpacing. The code adds 4 lines of text to the textNode but the justification and line spacing seem off compared to what we got out of V8i. And if we edit the text in the cell, the editor opens with all of the text appearing on a single line.And if not fixed to restore the four lines before accepting the text, it will become a single line of text in the file.
The only justification that seems to work even close to what V8i creates are Center Top, Middle or Bottom. Using the Right or Left justifications sends the text way off the screen (one must zoom way out to even know the text is still being created).
The code creates a dummy piece of text and uses the Boundary property to approximate its length and then uses that value to build parts of the shape around the text. It also appears to use it for shifting the text node origin away from the center of the shape. The tool uses the center of the shape as its dynamic placement origin. It is able to use the height of the text, line spacing, an arbitrary padding value and the number of lines of text to calculate the height of the box it creates.
Could this be caused by a scaling issue, related to annotation scale?
Are some values automatically adjusted for annotation scale, and if so, which ones?
I tested the same tool with Annotation scale off and set to full size and the tool works much closer to what comes out of V8i.
The text node still ends up as a single line of text if loaded into the text editor. The element info dialog box and even the legacy analyze element dialog box recognize it contains four text elements.
caddcop said:We have a tool that creates a cell containing some shapes and text. The code uses CreateTextNodeElement1
Under the hood, the text API (i.e. the C++ MicroStationAPI) changed radically in MicroStation CONNECT compared to previous 32-bit versions of MicroStation. That's not an excuse — more of an explanation for different behaviour.
A workaround would be to eliminate the text node and create text as discrete text elements in your cell. When creating text in a cell, the cell provides a reference frame, so the text node is redundant.
Regards, Jon Summers LA Solutions
The tool allows the user to place the graphics as a cell or as primitive elements via a checkbox on the dialog box.
Toggling it off results in two shapes and a text node being placed. The Text Node is still flawed. Placed with Middle Center justification, the text elements do not line up centered in the horizontal direction. Editing the text node seems to convert it to a single line of text which if carriage returns are restored in the editor and the edit accepted, the revised text node is properly aligned.
Clearly, the .AddTextLine Method contains bugs.
Other issues appear related to scaling logic either in our code or how VB is affected by annotation scale or possibly both.
Charles (Chuck) Rheault CADD Manager
MDOT State Highway Administration
caddcop said:The only justification that seems to work
There are vba & non-vba justification issues. I have put in several service requests regarding these...