VBA changing Text Style

Running MicroStation V8I Select series 3

This is what I get after running the VBA Recorded Macro. I did add a few lines to see if it would solve problem. Manually when changing Text Styles if you double click on the new selection the previous highlight goes off and the new one comes on. I set it to active and the Font, Height, Width change. Using the Macro they both  stay highlighted ? The Snipit picture shows

how they are both on and  the Change Text Attributes not matching what was just done. in the upper portion of the picture 0.1 and  0.075, it stayed on the previous value 0.25 0.25

but doing it manually they both change. I have to do this enough times the VBA would really save time or Key-in if it was possible..

 This is from Macro

This is manually even without using the , Active

Hope this explains my Problem:

Sub MacroSetTextStyle1()
' 013119 - Testing

' Start a command
CadInputQueue.SendCommand "MDL KEYIN textstyle textstyle dialog open"

CadInputQueue.SendCommand "TEXTSTYLE DESELECT ALL"
CadInputQueue.SendCommand "TEXTSTYLE DESELECT ALL"
CadInputQueue.SendCommand "TEXTSTYLE SELECT ""Style (none)"""
CadInputQueue.SendCommand "TEXTSTYLE DESELECT ALL"
CadInputQueue.SendCommand "TEXTSTYLE SELECT ""Style (none)"""

CadInputQueue.SendCommand "TEXTSTYLE SELECT "" Dupont84_100x075"""
CadInputQueue.SendCommand "TEXTSTYLE Active"

' CommandState.StartDefaultCommand
End Sub

Parents
  • Hi Richard,

    honestly , I have to say I do not understand what do you want to achieve and where the real problem is.

    What do you want to do? Modify and save some text style? Or something else? Just one sentence please, not lengthy description with plenty of not relevant facts.

    Key-in "textstyle deselect all" is not described anywhere and is not listed in key-ins tree, so I guess it's something captured by macro recorder internally.

    If you want to modify text style, use text style API (TextStyle class), not dialogs and key-ins.

    With regards,

      Jan

  • Jan, so appreciate you help, I finally got by trial and error for 3 hrs

    Sub SetDPF100x100()
    ' 020119 - Modified, Tested and Worked
    ' 012119 - New Macro Testing again seems to be working MDL must be loaded MSMTOOLS
    ' SET DUPONT_STD_FONT, SET 0.1 Height and 0.1 Width [33]

    CadInputQueue.SendKeyin "textstyle active=Dupont84_100x100"

    '{Note} Add Enable Change A, 8 ChangeTextAttributes
    CTA ' Subroutine {2} Turns on and off selected tic boxes

    CommandState.StartDefaultCommand

    End Sub

    One simple line did it all the CTA Subroutine just ticks or unticks all the boxes in the change text attributes

    So simple, do appreciate someone trying to assist me. Not very good in the VBA, trying to learn. Well 3:30am  my time.

    Version: MicroStation V8i SS 10

    RJB Phillips III (Richard) Praise the Lord for His Mercy and grace in Christ Jesus

  • Well, I really do not understand what you are trying to do. This discussion started about Text Style dialog, but has ended with Change Text Attributes. Really weird and confusing.

    I also do not understand what are you doing with Change Text Attributes tool parameters. To set any tool parameters (exceptions exist), standard key-in "set item toolsettings <parameter>=<value>" for many years, is described in documentation and have been discussed many times.

    So to start Change Text Attributes tool with own configuration, the key-in chain similar to this should be used (split to separate lines for readability):

    modify text;
    set item toolsettings changetextfontnumtoggle=1;
    set item toolsettings textfontname=DUPONT_STD_FONT;
    set item toolsettings changetextjustificationtoggle=0

    Regards,

      Jan

Reply
  • Well, I really do not understand what you are trying to do. This discussion started about Text Style dialog, but has ended with Change Text Attributes. Really weird and confusing.

    I also do not understand what are you doing with Change Text Attributes tool parameters. To set any tool parameters (exceptions exist), standard key-in "set item toolsettings <parameter>=<value>" for many years, is described in documentation and have been discussed many times.

    So to start Change Text Attributes tool with own configuration, the key-in chain similar to this should be used (split to separate lines for readability):

    modify text;
    set item toolsettings changetextfontnumtoggle=1;
    set item toolsettings textfontname=DUPONT_STD_FONT;
    set item toolsettings changetextjustificationtoggle=0

    Regards,

      Jan

Children
No Data