Can you safely run a Macro without having to have the Last line read CommandState.StartDefaultCommand
This was only for an example, not for an actual VBA Macro. I see that CommandState.StartDefaultCommand at the bottom of the different Macros, but I really do not always want to go back to the default command if something else is already active. Sorry if this is a poor question, but I do have a reason. I know how to load the Element Selection when I need it, but do not always like going back to that command?
Short Example: 1
Sub Macro002() ' 092813 - Testing running a Macro from this macro. It sets Level 7, Then Place Cloud ' Dim startPoint As Point3d Dim point As Point3d, point2 As Point3d Dim lngTemp As Long
' Start a command
CadInputQueue.SendCommand "place revcloud points" CommandState.StartDefaultCommand
End Sub
Would it be ok to comment out the last line as in Example: 2
' Run SetLevel 7 Macro First ActiveLayerSet7 Use No ()
' Start a command Added Level Command and Color Command then the RevcloudActiveLayerSet7
CadInputQueue.SendCommand "place revcloud points" ' CommandState.StartDefaultCommandEnd Sub
RJB said:Can you safely run a Macro without having to have the Last line read CommandState.StartDefaultCommand?
Yes. It's up to you whether to include that statement or not.
The reason that many people finish a macro with that statement is to ensure that no MicroStation command is left active when the macro terminates. You can appreciate that, were a command to be left active, in some cases that might lead to user confusion. In other cases you may want to leave a command active. I would include a comment in your source code to document why you have included/excluded that statement.
Regards, Jon Summers LA Solutions
RJB said:Would it be ok to comment out the last line as in Example: 2
What happens if you do it. Does the VBA what you want? If yes, you have your own answer!
Regards
Frank
since 1985: GIS, CAD, Engineering (Civil) Senior Consultant : [Autodesk Civil 3D , Esri ArcGIS, VertiGIS: in previous days : Bentley MS V4 - V8i, GeoGraphics, Bentley Map V8i, InRoads, HHK Geograf, IBr DAVID] : Dev: [C, C++, .NET, Java, SQL, FORTRAN, UML][direct quote by: http://en.wikipedia.org/wiki/Helmut_Schmidt]: "Wer Kritik übel nimmt, hat etwas zu verbergen"Wer Grammatik- und/oder Rechtschreibfehler findet, der darf sie behalten :-)
Hi,
I assume that you are a newbie in VBA programming...
Do you know the VBA debugging mode? that is very useful to see step by step what your macro does with your Microstartion.
Regards, Stefan
The only reason for the last StartDefaultCommand is to leave Microstation in a "nice clean state" when giving it back to the user. All it really does is start the Choose Element (Power Selector) tool. So, in your routine, you should omit that because you are wanting the user to continue the command to Place RevCloud Points.
--Robert