execute VBA from menu

Hello everybody,I use the following Menu-String to execute a VBA-Routine with german Bricscad (V 9.1.23):(command "_-vbarun" "basKanalDb.getSchacht")If I use this command the following codeline produces an error: on the screen appears "Schachtkoordinaten waehlen:NIL" Bricscad crashes (i.e. it does not react to any userinput anymor).

varKoords = ActiveDocument.Utility.getPoint(, "Schacht-Koordinaten waehlen:")

If I execute the routine via the macros-Menu everything works fine.I had this error befor but cannot remember how I solved it.Can anybody help?

Comments

  • Interesting as it is not limited to Utility.getPoint or version 9! I run an English V8.2.12 and if I execute the following code with the command(command "_-vbarun" "DEFAULT.COORDINATES2TEXT.LINECOORDINATES2TEXT")I get Select entities: NILwhile if I use my assigned command bar button, or the menu Marcos-menu I don't get the NIL resultI think this is unexpected behaviour of Bricscad and might be useful to send in a support request.

    Set thisDrawing = ActiveDocument Set ssLine = thisDrawing.ActiveSelectionSet ssLine.SelectOnScreen 0, "line,polyline,LWpolyline,Spline"

    Gerrit

  • By the way, the crach might be caused by your code assuming varKoords contains valid point coodinates, while it is actually empty. Try to check on that with VBA.IsNull and repeat the selection command

    redo: varKoords = ActiveDocument.Utility.getPoint(, "Schacht-Koordinaten waehlen:") If VBA.IsNull(varKoord) the GoTo redo
  • This bug is fixed in version 9.2, which will be released soon.

  • Hello again,found the solution by myself:If I Put the menu-string as follows everything runs as it should - (I got the workaround sometime ago from Bricscad):_-vbarun;basKanalDb.getSchachtThanks for your answersregards Helmut

This discussion has been closed.