Autodesk-AutoCAD / AutoLispExt

Visual Studio Code Extension for AutoCAD® AutoLISP
https://marketplace.visualstudio.com/items?itemName=Autodesk.autolispext
Apache License 2.0
83 stars 30 forks source link

Not have to restart AutoCAD after an change in code #243

Closed Djwhitelion closed 4 months ago

Djwhitelion commented 4 months ago

Pretty much what the subject says.

I want to reload the lisp without having to: 1 start a new drawing to load a change there. 2 restart AutoCAD.

Sometimes the change is so small because the debugging found something small right in the beginning of the code. And if you have to do preparations for the code. You will have to do that over again in a new drawing.

But if I inside the lisp have a defun called "c:reload". I could run that and reload the lisp. But debugging won't work correctly then. And when pressing "load lisp" in VS code. You get that the code is already running.

Debugging takes so much longer time then nessesery when you start finding small bumps in the code or just have to do small adjustments to it to work just right.

Restarting AutoCAD takes time. Opening a new drawing takes time. Making preparations over and over again. Takes time.

When debugging and fixing already takes time. Can we please eliminate one of the things that takes time on top of that?

The reload button on the debugging sign should meen reloading of lisp in the current drawing.

No matter what settings changes I do. It closes autocad and starts a new session and new drawing to load the lisp over again.

Time better spent on debugging. And not watching the AutoCAD launcher picture. Witch in many cases. Uses more time then the debugging it self.

Sen-real commented 4 months ago

Hi @Djwhitelion, I guess you're using the Launch mode? By using the Attach mode, we don't need to restart ACAD or re-open the drawing. Please have a try:

In VS Code, open a folder that contains .lsp files, and click on the Run and Debug icon on the side bar. Then click on the link create a launch.json file: image

A configuration for the Attach mode will be automatically created: image

Then go back to the Run and Debug panel to make sure the Attach mode is the current selection: image

This way the VS Code won't launch an AutoCAD for debugging. Instead, it will show a list of AutoCAD instances that are currently running. You can pick up one to attach. The debugging is then done with this AutoCAD instance and its current drawing.

BTW after changing the LISP source code, the restart button below will simply detach and then attach to the same AutoCAD instance - it won't restart AutoCAD: image

Djwhitelion commented 4 months ago

OMG. Now I just feel stupid. I had even done the settings. Just not noticed that it was sett to launche mode. I just thought this was the way it was supposed to behave. Sorry for being uninformed 🙏

Sen-real commented 4 months ago

@Djwhitelion glad to know that the problem is gone. Have a nice weekend!