Running part of Code with Visual Studio Code

Running part of Code with Visual Studio Code

Anonymous
Not applicable
933 Views
5 Replies
Message 1 of 6

Running part of Code with Visual Studio Code

Anonymous
Not applicable

Hi All,

So we just upgraded from AutoCAD 2017 to AutoCAD 2021 this past week and for the first time I tried to go into the Visual LISP Editor and saw that it suggests using Visual Studio Code now instead of the legacy way of editing code so I decided to give it a shot and now I have a question that I haven't been able to find in Visual Studio Code. Is there a way to run a part of your code without running the whole program in AutoCAD? I'm trying to switch over but this is something that I do a lot when I'm working on code is to run a small piece to see if it gives me the desired outcome, or in the case of what I was trying to do today, run a piece of code from a previous program to see it works in a different scenario for making a program for what I'm trying to do.

0 Likes
934 Views
5 Replies
Replies (5)
Message 2 of 6

pbejse
Mentor
Mentor

@Anonymous wrote:

..is to run a small piece to see if it gives me the desired outcome, or in the case of what I was trying to do today, run a piece of code from a previous program to see it works in a different scenario for making a program for what I'm trying to do.


 

You can use Debug Console in VSCODE pretty much the same as visual lisp console as long as you are in debug mode.[ F5 ]

 

pbejse_0-1632623056250.png

 

use "Evaluate at debug console" via mouse right click, 

pbejse_1-1632623547917.png

 

You can type in directly on the debug console or select part of the code and or even copy and paste directly to the console or even at the command prompt

pbejse_2-1632623741323.png

 

HTH

Message 3 of 6

Sea-Haven
Mentor
Mentor

There is a thing called cut and paste, ie copy code and paste to command line. You do though have to be careful what your pasting. No extra space on end of lines. If you indent the code with tabs can do weird things. You have to make sure If's are copied correct.  If you have Notepad++ can copy code to that and use the Notepad++ extension to run the code much like VS. Do an edit run again. 

 

I code this way all the time and have got used to it. Use VLIDE when really stuck finding error.

 

I am working on code now 1167 lines and adding defuns testing 1 at a time. 

0 Likes
Message 4 of 6

diagodose2009
Collaborator
Collaborator

You trace and debug this programe. version.lisp.ascii.txt

Click here3+Sf. Voievod Neagoe Basarab; Dreptul Ghedeon 

After you got the error you type (setmypid)

0 Likes
Message 5 of 6

diagodose2009
Collaborator
Collaborator

Please you type (getmypid) for view Stack-ErrorE

I attached normal-version, without jc10aro.lsp

0 Likes
Message 6 of 6

Anonymous
Not applicable

Thanks pbejse. I will try this next time I have a chance to work on LISP code. I only just saw this reply as apparently the notification decided to not send me an e-mail until today.

0 Likes