VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to speed up this Autolisp?

1 REPLY 1
SOLVED
Reply
Message 1 of 2
Anonymous
464 Views, 1 Reply

How to speed up this Autolisp?

Hi to all!

 

I´m an Excel-VBA user, trying to control Autocad (2015) from "here"... bear in mind that my knowledge about autocad is quite limited.

 

I have an VBA aplication that opens Autocad, load a file replace some text in the autocad as per a table in an excel sheet then save it with another name and close it.

 

For replacing the text I´m using an AutoLisp code taken from here:

 

http://www.cadtutor.net/forum/showthread.php?14084-Find-amp-Replace-Text/page2

 

So basically in my VBA code I send the commands though the comand line to run the AutoLisp script. I see the speed at which it changes the text and it´s very slow, like 10 seconds for changing 5 texts, so when I have to open hundred of drawings with several changes in each drawing it can take several hours.

 

I tried to put the commands directly in the command line to see if the slow part is taking the data from excel and then sending it to Autocad, or just the script, putting this in the command line the following and running the script directly:

 

(FindReplaceAll "1" "a")

(FindReplaceAll "2" "b")

(FindReplaceAll "3" "c")

(FindReplaceAll "4" "d")

(FindReplaceAll "5" "e")

(FindReplaceAll "6" "f")

(FindReplaceAll "7" "g")

(FindReplaceAll "8" "h")

(FindReplaceAll "9" "i")

 

But by doing this I see that the script is still very slow (ten seconds) so it is somehow something related with Autolisp, the command line and Autocad. I thought about trying to run directly the script through VBA skipping the command line part, or rewritting some code in VBA for not depending of autoLisp, but I don´t know how could I do this and if at the end that would solve the problem.

 

Anyone can do the test by running that Autolisp, in a test drawing with numbers from 1 to 9.

 

Any comment is welcome!

 

Thanks in advance :smileyhappy:

1 REPLY 1
Message 2 of 2
Anonymous
in reply to: Anonymous

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Autodesk Design & Make Report