Set Design File vba or key-in highlight color and Selection Color V8i is the program I use.

Tried this  a few moments ago and it lockup and I lost my message.

 

 

 

 

 

 The two items are what I want to change. I have a VBA macro that will preform this, but It seems so involved. I know someone with the knowledge can do it easy. I will post the macro.

 

 

'  1112133 - Modified, removed the Dim commands at top, removed CommandState.StartDefaultCommand
' 11/02/11 - Made New Replacement for the Older version. Deleted older
' macro and re-named new one to match older one. removed Macro 3 Handler 11
    'Dim startPoint As Point3d
    'Dim point As Point3d, point2 As Point3d
    'Dim lngTemp As Long

    Dim modalHandler As New Macro3ModalHandler11                                         SEE BELOW THE Macro3 Handler11
    AddModalDialogEventsHandler modalHandler

'   The following statement opens modal dialog "Design File Settings"

'   Start a command
    CadInputQueue.SendCommand "MDL SILENTLOAD DGNSET"

    CadInputQueue.SendCommand "MDL SILENTUNLOAD DGNSET"

    RemoveModalDialogEventsHandler modalHandler

 

 

Private Sub IModalDialogEvents_OnDialogOpened(ByVal DialogBoxName As String, DialogResult As MsdDialogBoxResult)

    If DialogBoxName = "Design File Settings" Then

    '   Set a variable associated with a dialog box
        SetCExpressionValue "dgnSet.hiliteColor", 8, "DGNSET"

        SetCExpressionValue "dgnSet.selSetColor", 5, "DGNSET"

    '   Remove the following line to let the user close the dialog box.
        DialogResult = msdDialogBoxResultOK

    End If  ' Design File Settings

End Sub

This seems an awful lot just to change two colors, I searched and read for a while, but did not find the answer?

 

 

 

 

 

 

 

Parents
  • Another option would be to use "key-ins":

    set hilite white
    mdl keyin calculat calc tcb->selectionHiliteOverride=1
    mdl keyin calculat calc tcb->selectionHiliteColor=5

    The number at the end of the last statement is the number (from the top) of the color in the picklist. The second statement is needed in instances where the Element Hilite color and Selection Set color are different. You can concatenate those by putting them on one statement separated by ; semi-colons.

     

      

    Answer Verified By: RJB 

  • Thanks again, Phil.  This is just what I was looking for:

    The only lines I need are the {mdl keyin calculate calc tcb->selectionHiliteOverride=1 and the one below it to change the two colors? I noticed the Macro Handler referenced

            SetCExpressionValue "dgnSet.hiliteColor", 3, "DGNSET"

           SetCExpressionValue "dgnSet.selSetColor", 5, "DGNSET"

    So I kept looking for a Key-in command with Set Color or Change color or Color change. Thanks to all who try to help this old guy keep a job.

    RJB Phillips III - Praise the Lord for His Mercy and Grace

  • Phil, I could not get the Highlight to change? I  tried the command three ways

    mdl keyin calculat calc tcb->selectionHiliteOverride=1;mdl keyin calculat calc tcb->selectionHiliteColor=3        selection change only

    mdl keyin calculat calc tcb->selectionHiliteOverride=1;mdl keyin calculat calc tcb->selectionHiliteColor=5        selection changed only

    mdl keyin calculat calc tcb->selectionHiliteOverride=7;mdl keyin calculat calc tcb->selectionHiliteColor=5        Nothing seemed to work

     

    I never mess with the center selection only the top one and bottom one. It seemed the command only worked on the Selection Set Color and not on the Element highlight color?

    RJB Phillips III - Praise the Lord for His Mercy and Grace

  • There are three commands:

    set hilite white

    1. That sets the Element Hilite color.

    mdl keyin calculat calc tcb->selectionHiliteOverride=1

    2. That is a logical TRUE or FALSE and can only be 1 (enabled) or 0 (disabled). Enabling that ensures that the Element Hilite and Selection Set Hilite can be different values. Disabling that "locks" the Element Hilite and Selection Set Hilite to be the same. The user interface "hides" the fact that setting the two Hilite colors to different values enables that in the background. BTW, this is a single bit value, with bit 0 of any number it is set to being the only thing it looks at. Since all even positive integers (e.g. 2, 4, 8, 1024, etc.) have bit 0 as 0, that disables it. All odd positive integers (e.g. 1, 3, 5, 255, etc.) have bit 0 as 1, when enables it.

    mdl keyin calculat calc tcb->selectionHiliteColor=5

    3. That sets the Selection Set Hilite color.

    In your concatenated command, you only have the 2nd and 3rd commands. If you include the 1st, you will likely see the behavior you want.

      

  • Special Thanks to Phil, who bails me out so many times. Due to the help toward Key-in commands I was able to figure out the following for setting Layers via Key-in,

    '   Start a command

       CadInputQueue.SendCommand "ACTIVE LEVEL ""Level 4"""

    '   Set a variable associated with a dialog box

       CadInputQueue.SendCommand "ACTIVE Color Orange"

       CadInputQueue.SendCommand "ACTIVE STYLE 0"

       CadInputQueue.SendCommand "ACTIVE WEIGHT 1"

       CadInputQueue.SendCommand "m,ms    Active Level=4    Color 4,  Style 0, Weight 1"  'Send Msg Center Box

    but I  cannot figure out how to add the Script file location to the search path. I know it is in configuration, but do now know where.

    RJB Phillips III - Praise the Lord for His Mercy and Grace

  • Hi Richard,

    I'd like to ask why do you use VBA to send key-ins to MicroStation? If there is not some specific requirement not discussed in this thread, it's bad approach to do it this way ... it's general rule: If CadInputQueue.SendCommand is used in VBA code, it's very often (exceptions exist of course) bad use of VBA and a mistake in the macro design.

    Compare this:

    • Your solution: To change active attributes, MicroStation VBA engine has to be started, it has to load mvba file and the code is processed. And the only thing the code does is to simulate user's key-ins. It's like to use start nuclear power station to light up one bulb.
    • "Good old MicroStation way": The key-in is lv="Level 4";co=orange;lc=0;wt=1;m,ms Active Level=4 | Color 4 | Style 0 | Weight 1 ... the same result, simple, no extra cost to call any other module.

     

    RJB said:
    but I  cannot figure out how to add the Script file location to the search path. I know it is in configuration, but do now know where.

    Not quite sure what you are asking for, probably because of misuse of terms (and it's really necessary to use the right terms!). Your post is about VBA code and script files are note mentioned at all. So please specify better your question: Are you interested in script files use (key-in @<script_file>) or in VBA load?

    RJB said:

    '   Start a command
       CadInputQueue.SendCommand "ACTIVE LEVEL ""Level 4"""

    The key-in active level doesn't start any command, it set a proper active attribute (level in this case) in the same way as other active <something> key-ins. So the comments in your code are not correct.

    With regards,

      Jan

  • Jan, thank you for the reply. I try to cut down on time and typing. Phil gave me a way to change the VBA and I was able to drop all the MacroHandlers from them. But I have tool bar Icons that change level and all the settings and then some to change the hilite and select commands. My job is all about time/productivity. I was blessed to learn about the  lock section being available in the Level Manager. That is working real fast for me and I get to check several at one time. you folks are patient and kind. Sometimes the VBA record will not pickup anything, so I resorted to using the Keyin command in the macro to do what I could not figure out. I even tried some of the things in the old BASIC, but same problem It did not pickup some of the mouse clicks and values. I really like the VBA the best, the scripts was just something I was trying to learn so I could evaluate which was the best.

    Just giving you and example:

    Just trying to give you an example, the LCL are Cell Lib's for various things

    RJB Phillips III - Praise the Lord for His Mercy and Grace

  • I will try and use your example and see if I can make a script and tie that to the button and skip the VBA. But I like the F8 feature, and it finds my errors the script I have to put in a line at a time to test and move on??

    RJB Phillips III - Praise the Lord for His Mercy and Grace

  • Compare this:

    • Your solution: To change active attributes, MicroStation VBA engine has to be started, it has to load mvba file and the code is processed. And the only thing the code does is to simulate user's key-ins. It's like to use start nuclear power station to light up one bulb.
    • "Good old MicroStation way": The key-in is lv="Level 4";co=orange;lc=0;wt=1;m,ms Active Level=4 | Color 4 | Style 0 | Weight 1 ... the same result, simple, no extra cost to call any other module.

    The above response was tried, it did not all work?

    The above was the Message section Red X ??? the text looked ok, next the actual Key-in command used

     I believe I got the key in the way it was outlined? as you see, Orange worked, style also and the weight did fine, but the Level stayed on 1

    Any further assistance I might get on how I could correct it? oh, I see a space missing , will try again. Sorry.

    RJB Phillips III - Praise the Lord for His Mercy and Grace

    Answer Verified By: RJB 

  • Jan, I need 1 more item to make this command complete, When I run key-in LL5, I need the Lock turned on for that level at the same time, what command would I add?

    Here is the Script file LL5, I tried the separate lines like some of the script files run, this seemed not to work, so I took your suggestion and used the repeated semi colon.

    I think I failed to edit the bottom line and put \LL4.txt

    this why I always have to turn the lock on Level 5,  then it will not move or stretch as I use it.

    RJB Phillips III - Praise the Lord for His Mercy and Grace

  • Hi Richard,

    the key-in to lock a particular level is level set lock on <level name>, it's not difficult to find it in MicroStation help file (search for Level lock or Level Key-in Format).

    In your case, the key-in would be level set lock on "Level 5".

    With regards,

      Jan

Reply Children
No Data