Lisp calls VBA and then ENTMAKE crashes Autocad

Lisp calls VBA and then ENTMAKE crashes Autocad

caddhelp
Explorer Explorer
281 Views
0 Replies
Message 1 of 1

Lisp calls VBA and then ENTMAKE crashes Autocad

caddhelp
Explorer
Explorer

I hope it something to do with VBA rather than Lisp. But then again, if I can't fix it well be many weeks of rewriting somebodies code.

 

There are few dozen lisps that call VBA dialogs to set up different parameters and then, based on these parameters lisp creates all kind of objects in Autocad.

Lisp calls -> VBA Sets parameters -> back to lisp to use entmake or entmakes (both crush Autocad)

 

Here is simplified version of what happens.

 

The first lisp is calling VBA MsgBox. You will need to save dvb file at c:\Temp\msgbox.dvb

The second(NewLine) is crashing on entmake

 

(defun MsgBox ( StringParam / retList ret )
	(setq retList '("None" "OK" "CANCEL" "ABORT" "RETRY" "IGNORE" "YES" "NO")) 
	(vl-vbaload "C:\\Temp\\msbbox.dvb"))
	(setq ret(atoi(getstring(command "-VBARUN" "vbMsgBox" StringParam))))
	(nth ret retList) 
)

(defun NewLine()
  (msgbox "Create a New Line, 64, Title")
  (entmake (list'(0 . "LINE")(cons 10 0 0 0)(cons 11 0 0 0)))
)

 

 

''Here is the VBA code. Create a new VBA project and save it at c:\Temp\msgbox.dvb

 

Sub vbMsgBox()
  Dim arrParam, ret
  Param1 = ThisDrawing.Utility.GetString(False)
  arrParam = Split(Param1, ",")
  ret = MsgBox(arrParam(0), CInt(arrParam(1)), arrParam(2))
  ThisDrawing.SendCommand ret & vbCr
End Sub

 

It will not crash if I exit lisp before entmake and then run:

(entmake (list'(0 . "LINE")(cons 10 0 0 0)(cons 11 0 0 0)))

 

We cannot use C# or VB.net. Only Autodesk VBA or VisualLisp

Any ideas? Does it crash only my 2022 Civil3D?

Thanks.

 

 

0 Likes
282 Views
0 Replies
Replies (0)