Visual Studio tools

This is where you talk about Macros, show examples of your macro scripting and SHARE handy segments of script code as examples.

Visual Studio tools

Postby fsli » Fri Nov 18, 2022 3:21 am

I know there is a Notepad++ template available for editing UCCNC macros, but I'm already comfortable with Visual Studio. I didn't find much on the forums, though, that supports Visual Studio development. So, I put together some VS Project templates and am making them available to anyone else that uses (or might want to use) Visual Studio.

The attached PDF contains instructions and a link to the installation files on Google Drive. I would appreciate suggestions for corrections, improvements, or other feedback -- good or bad.
Attachments
UCCNC Macro Tools.pdf
(1.03 MiB) Downloaded 419 times
Frank
fsli
 
Posts: 97
Joined: Mon Jul 11, 2022 12:36 am

Re: Visual Studio tools

Postby fsli » Fri Nov 18, 2022 12:24 pm

I added a note to the PDF indicating that you don't extract the contents of the project template ZIP files. The complete ZIP files themselves just remain in the ProjectTemplates folder.
Attachments
UCCNC Macro Tools.pdf
(1.03 MiB) Downloaded 436 times
Frank
fsli
 
Posts: 97
Joined: Mon Jul 11, 2022 12:36 am

Re: Visual Studio tools

Postby fsli » Mon Feb 20, 2023 12:13 am

In case anyone has been using these tools, I've added support for writing macros which use Windows Forms. There have been some other changes as well (read the Release Notes). The documentation in the previous two posts under this topic is now outdated, and updated documentation is available in the Google Drive folder.

https://drive.google.com/drive/folders/1FzjDcvGU_I5E2FebyoIbafR1-ILOgAdS?usp=share_link
Frank
fsli
 
Posts: 97
Joined: Mon Jul 11, 2022 12:36 am

Re: Visual Studio tools

Postby mark68 » Mon Feb 20, 2023 9:15 pm

Hi Frank, forgive my ignorance as I'm very new to programming but will these tools help a novice write macros for UCNC and can you run a macro within Visual Studio to test it or do you still have to run on the machine
mark68
 
Posts: 59
Joined: Tue Oct 22, 2019 10:42 pm
Location: Yorkshire Uk

Re: Visual Studio tools

Postby fsli » Fri Feb 24, 2023 10:58 pm

mark68 wrote:Hi Frank, forgive my ignorance as I'm very new to programming but will these tools help a novice write macros for UCNC and can you run a macro within Visual Studio to test it or do you still have to run on the machine

Mark,

By developing the macros using Visual Studio, you'll have full compiler support. This means that using the tools I've provided, all the references you are likely to make when writing a macro can be resolved, and if it compiles in Visual Studio then it will compile when running in UCCNC*. However, you cannot run the macro in Visual Studio. You have to export it to a text file and test its execution on the machine.

Even for simple macros, I would say it would much better for you to develop within Visual Studio rather than a simple text editor, and it's also better than the Notepad++ extensions. For complex macros, I really don't see any point in using anything other than Visual Studio as a development tool. All of these statements are my opinion.

* The caveat is that Visual Studio 2019 provides a newer version of both the C# and Visual Basic languages. If you use the newer syntax features in your macro, it will compile in Visual Studio, but it won't compile in UCCNC. The only hope is that someday UCCNC will support the syntax features of VS 2019 or 2022, rather than (I'm guessing) VS 2010.
Frank
fsli
 
Posts: 97
Joined: Mon Jul 11, 2022 12:36 am

Re: Visual Studio tools

Postby cncdrive » Sat Feb 25, 2023 2:47 am

Hi Frank,

The compatibility problem with VS2019 you see I think is that in VS2019 the .Net framework 4.0 is no more supported by default.
You can still install the .Net framework 4.0 though and then there is no problem, but installing it is kind of a painful process.

The UCCNC still supports the 4.0 framework because on Windows XP the highest .Net framework version which can work is the 4.0.
Higher .net frameworks do not work on Windows XP and there are several customers who still running XP.

On the other hand it would be only a matter of a few mouse clicks for us in Visual Studio to upgrade to a higher .Net framework version to support VS2019 properly.
cncdrive
Site Admin
 
Posts: 4926
Joined: Tue Aug 12, 2014 11:17 pm

Re: Visual Studio tools

Postby fsli » Sun Feb 26, 2023 1:18 am

cncdrive wrote:The compatibility problem with VS2019 you see I think is that in VS2019 the .Net framework 4.0 is no more supported by default.

No, I don't mean the framework. I'm referring to new language features in C# and VB.

For example, the following C# code compiles in VS 2019, but will not compile in UCCNC:
Code: Select all
string myName = "Frank";
Console.WriteLine($"My name is {myName}");

String interpolation (above) was introduced with VS 2015. Based on other experimenting, I can see that UCCNC only supports language features that were introduced in VS 2012 (which was C# Version 5) and earlier. In VS 2019, we can cause the compiler to report syntax errors if any language features newer than C# Version 5 are used, but it requires a text change to the .csproj file.
Frank
fsli
 
Posts: 97
Joined: Mon Jul 11, 2022 12:36 am


Return to Macros

Who is online

Users browsing this forum: No registered users and 6 guests