ActiveSettings.CurrentGraphicGroup not adding new text elements to graphic group

Hello,

I am updating a VBA that runs fine in v8i to run in Connect.

The only part not working is adding text elements added by the vba to a graphic group.  It does add new line elements, but text is not added to the GG.

In v8i at the end of the VBA run, all elements are in a GG, but in Connect they are not, only the lines are. If I run it in v8i and then open the file in Connect, the GG is recognized by Connect.

Code is something like this:

ActiveSettings.CurrentGraphicGroup = Application.UpdateGraphicGroupNumber
..Add line and text elements by sending keyins using CadInputQueue
ActiveSettings.CurrentGraphicGroup = 0

TIA,
Tim

Parents Reply Children
  • Hello Geoff,

    This defect will be fixed with one of the following CE Update versions.

    Could you please show the code which still fails?
    I had tested this workaround in CE Update 14 and it worked fine for me.

    Best regards,
    Artur

  • Hi Artur, this the code I am using : 

    ActiveSettings.CurrentGraphicGroup = 21000
    ActiveSettings.LineWeight = 0
    ActiveSettings.LineStyle = ActiveDesignFile.LineStyles(1)
    CadInputQueue.SendCommand "active level 27"
    ActiveSettings.Color = 10
    ActiveSettings.TextStyle.Height = 20
    ActiveSettings.TextStyle.Width = 15
    CadInputQueue.SendKeyin "TEXTSTYLESET FONT ""fonte51.rsc"" ""Style (none)"""
    CadInputQueue.SendKeyin "TEXTSTYLESET SINGLELINEJUST LEFTBOTTOM ""Style (none)"""
    CadInputQueue.SendCommand "PLACE DIALOGTEXT ICON"
    Dim ele As Element
    Set ele = ActiveModelReference.GetLastValidGraphicalElement
    ele.GraphicGroup = ActiveSettings.CurrentGraphicGroup
    ele.Rewrite

  • Hi Geoff,

    the keyin "PLACE DIALOGTEXT ICON" is waiting for input while the VBA code already has executed.
    Also DIALOGTEXT allows to place several text elements,  which means this method to place text cannot be used in combination with the workaround.
    There are other methods which could be used instead, e.g.:
    - keyin "place text"
    - VBA method CreateTextElement1
    - VBA IPrimitiveCommandEvents
    It depends on your needs which method you prefer.

    Best regards,
    Artur