How can I synchronize my LISP functions with VBA m

  • Detail

How can I synchronize my LISP functions with VBA macros

question: I have written a VisualLISP function and a VBA macro. This VBA macro displays a dialog box, and there are buttons that allow user input (for example, enter a string). Now I call this VBA macro from VisualLISP with (VL vbarun). When AutoCAD executes to this line, LISP stops at this line. However, once I use a user input function in this macro, LISP will continue to execute the following LISP function without waiting for VBA dialog researchers to co-exist L – LA with GA or DL – la. Sometimes, the input function of LISP is even executed first, and then the input statement in VBA macro is executed. How can I synchronize my LISP functions with VBA macros

answer: there is only one solution now. In your LISP function (VL vbarun) function must be called last. When closing the VBA dialog box or returning from the VBA macro, you have to call another LISP function that you want to continue. You can do it like this

first of all: you need a lisp function to call this VBA fixture, which is the combination of these structures; Macro:

(defun c:test()

;; Call a VBA macro which displays

;; a dialog and writes a file.

(vl-vbarun "test")

;; If you uncomment the following line, then AutoCAD will prompt you

;; to select an entity first, input a string second.

;; (entsel)



then you need a second LISP function to call when your VBA macro returns:

(defun c:test_cont()

;; Here you can continue.

(print " I am continuing.")



the following is an example of this VBA macro:

sub test()

'show a dialog which uses some

' user input functions


' Call the lisp function which should

' be now executed.

' You can use the SendCommand method:

' ndCommand ("test_cont ")

' or use the ActiveX interface of VisualLisp:

' In order to use it, please remember to reference b file which is in Acad2000 folder

' into your VBA pr2. The vibration of the testing machine is mostly caused by the problems of sensors and controllers. Item 442 of the oject an approval standard D execute (VL load com) on the AutoCAD command line first

Dim vl As Object

Set vl = CreateObject("plication.1")

em("c:test_cont"). funcall

End Sub

Copyright © 2011 JIN SHI