Good evening,
I'd like to interact with Visible Edges Dialog Box.
I wish to set several parameters as view, boundary, output file, method, attributes for Visible and Hidden edge, etc.
I have to implement IModalDialogEvents in a class module and use AddModalDialogEventsHandler before use CadInputQueue.SenCommand "MDL COMMAND EDGE EXPORT" in the module
In the IModalDialogEvents_OnDialogOpened, I don't know the syntax to set parameters on the Visible Edges Dialog Box
I tried searching on Microstation VBA Help and on the web without any results
So I reorded a macro exporting visible edge, but I obtained SetCExpressionValue
Where can I find that sintax? Can yo help me?
Thanks a lot.
Paolo
Paolo Maggiani said:I'd like to interact with Visible Edges Dialog Box with VBA
In general, there is no connection between Visual Basic and MicroStation dialog boxes. They use very different technologies that don't mix well.
Paolo Maggiani said:I wish to set several parameters
The best approach is to record a VBA macro. While recording, open the MicroStation dialog that interests you. Make some changes in that dialog. Stop the recording, then examine the source code.
Paolo Maggiani said:I don't know the syntax to set parameters on the Visible Edges Dialog Box
None of us knows the answer. You have to be like Sherlock Holmes, and make deductions from the available evidence: When you have eliminated the impossible, whatever remains, however improbable, must be the truth.
Paolo Maggiani said:I recorded a macro exporting visible edge, but I obtained SetCExpressionValue
A MicroStation application owns variables. It publishes those variables internally so that they become visible to the Dialog Manager, which is the engine responsible for user interface dialogs and dialog items. The Dialog Manager works with C Expressions. What you see in the recording are the application variables that are available to the Dialog Manager when that app is running.
Paolo Maggiani said:Where can I find that syntax?
App variables are published in a C-style language syntax (C Expressions). The VBA SetCExpressionValue method evaluates a C Expression. I wouldn't attempt to write a C Expression: just use what the VBA macro recorder provides. The essential part of that method is the final argument, that assigns a new value for that C Expression. Unfortunately, we have to guess what that value might be.
SetCExpressionValue
Regards, Jon Summers LA Solutions
Hi Jon,
when you wrote:
Jon Summers said:The VBA SetCExpressionValue method evaluates a C expression. I wouldn't attempt to write a C expression: just use what the VBA macro recorder provides.
what do you mean? I don't understand. You mean I have to copy VBA macro recording expressions avoiding to write them by myself from zero?
Hi Paolo,
Paolo Maggiani said:You mean I have to copy VBA macro recording expressions avoiding to write them by myself from zero?
yes, it's exactly what (I think) Jon recommends.
From MicroStation V8 VBA help (I assume you studied SetCExpressionValue method description already): Effective use of SetCExpressionValue requires a good working knowledge of C and MDL (MicroStation Development Language). It should be used with extreme caution, since none of the safeguards provided by the Visual Basic interface are in place when it is used.
When VBA macro recorded recognizes internal variable, you can assume it's (probably) correct and you will not corrupt MicroStation. But to take a dialog and to start analyze what CExpression should be used is really complicated task and it's not ensured the solution exists (because e.g. variable are not published and are available internally only).
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Ok, Jan. Thanks a lot.
Then, if I am not wrong, some MS dialog boxes are manegeable by IModalDialogEvents others one not. To understand if a dialog box is manageable by IModalDialogEvents, I have to record a macro that uses that window, right?
Paolo Maggiani said:Some MS dialog boxes are manageable by IModalDialogEvents others not
Correct!
Most MicroStation dialogs are modeless (they don't have an OK button). A modeless dialog can stay open while you continue to work.
Some dialogs are modal (they have an OK button). A modal dialog stops you working elsewhere, until you dismiss the dialog with the OK or Cancel button.
The VBA macro recorder creates an IModalDialogEvents class for you when your recording shows a modal dialog. That class lets you, the VBA programmer, simulate a user's response to that dialog.
IModalDialogEvents
Many of MicroStation's settings are modified by modeless dialogs. Many settings are available through the ActiveSettings object. Specialised commands may not use ActiveSettings, and that is when a macro recording is useful: it shows the application variables. What the recording doesn't tell you is (a) what the app variable means or (b) what values the app variable can have. Furthermore, the recording captures C Expressions, which are not always easy to understand. Usually, the C Expression is doing something with the app variable.
ActiveSettings
Hi Paolo Maggiani,
Recording a macro (MicroStation VBA and/or Bentley Macro Recorder) are always good first steps to try and capture global variable settings that may be present and especially in modal dialog boxes. I would also like to suggest if the MicroStation VBA object model does not currently support an area of functionality needed, MicroStation Batch Processing (like: Batch Update Cached Visible Edges) and Key-ins (like: Visible Edges Display Key-ins, or set item toolsettings) may often provide an alternate insights and slightly different ways to accomplish a given task.
HTH,Bob