Sharing Plugin Code

This is where you talk about Plugins. How they are made and how they work, show examples.

Sharing Plugin Code

Postby 1.21gigawatts » Fri Dec 24, 2021 6:15 pm

Is there a place where plugin writers are sharing their code? I'm getting started writing a plugin, and going through the documentation and forum posts, I see a LOT of comments that go something like, "You just have to figure it out from the documentation (user provided) and the (ONE!) sample file."

Now, don't get me wrong, I have been designing hardware since the mid 1970s and writing software since 1978 (Z80 assembly code). Much of what I have done is by following examples, and that's very often the best way to put the information in the manuals into some context that makes sense. But in this case, there's only a single C# project and, while that's a pretty good example, it doesn't demonstrate every function.

So what I'm asking about here is whether anyone else would care to share their plugin projects. For sure, I will share mine when there's something worth sharing. How about the rest of you? [Mostly] all of the plugins I've seen are non-commercial (as mine will be), and I don't see any obstacles to sharing and cooperating - if nothing else to save time on the learning curve. It would also lead to better quality as people share what they've figured out.

Anyway, that's what I'm thinking this afternoon. I welcome your thoughts.

Oh, and HO HO HO to you all.
1.21gigawatts
 
Posts: 21
Joined: Mon Jul 29, 2019 12:07 pm

Re: Sharing Plugin Code

Postby eabrust » Fri Dec 24, 2021 7:47 pm

Hi gigawatts,

I'd be happy to package up and share code examples. One of the problems is its pretty easy for a Vis. Studio solution package to be larger than the upload limit for the forum.

But what types of code are you most interested in for plugin? Making UCCNC jog? or Move? Or just update DROs? using 'plugininterface' gets you a bunch of access to UCCNC, but if you want to do movements, etc, you need to pull in the UC100.dll API also. Since I use VB, I made a VB version of the wrapper available here: http://www.forum.cncdrive.com/viewtopic.php?f=4&t=2229&p=17833&hilit=wrapper#p18012

Just an FYI, anything I share will likely be VB. Also, being self taught and still learning as I go (slowly learning..)... I'm sure I can provide lots of examples of how to make something work, it just might not be 'best practices' quality code :D...

regards,
Eric
CraftyCNC: Plugins for UCCNC (and other neat stuff): http://www.craftycnc.com/plugins-for-uccnc/
eabrust
 
Posts: 357
Joined: Fri Sep 16, 2016 2:32 am
Location: Near Shirland IL, USA

Re: Sharing Plugin Code

Postby eabrust » Sun Dec 26, 2021 1:56 pm

1.21Gigawatts and all,

I spent some time learning how to setup Github repositories for some of my plugins. I had been a casual 'surfer' on Github for a while, but never had my own account or understood the process of how people get their code up on there and share. After watching some tutorials, its surprisingly easy, so easy even I figured it out :) . I'm glad I spent a little time figuring it out. Now it is super easy to share projects without much regard for their size or complexity.

I put the source code (Vis Studio solutions) for the UC_Engrave http://www.forum.cncdrive.com/viewtopic.php?f=14&t=3570 and the TurnTable http://www.forum.cncdrive.com/viewtopic.php?f=20&t=2786 lathe tool offsetting plugins up for sharing for the time being. These two plugins are not giant projects of code, but they cover a fair bit of what you may want to try to do in a plugin.

TurnTable includes changing DROs, jogging from screen buttons (so uses UC100 wrapper), setting offsets, changing steps/unit settings, etc, so it covers a lot of bases in a smaller plugin example.

UC_Engrave seemed like a fun one to give some ideas. It really has very little interaction w/ UCCNC other than saving a text file and having UCCNC load it. Its basically its own program that UCCNC just happens to run as a plugin.

I put repositories here: https://github.com/CraftyCNC?tab=repositories. Feel free to copy and use in any way you wish, I tagged them with MIT licensing.

I'll also gladly accept constructive criticism on code I share, suggestions on things to do differently, and suggestions for feature additions so I may learn and become better and make better projects... I still consider myself to be on the pretty steep part of the learning curve :D.

With time, I'll look at cleaning up and sharing some of my other projects. I think it would be fun to share and discuss particular 'how do I...?' sorts of specific questions amongst us forum users with an interest in coding. I code as much for my own hobby enjoyment as I enjoy it as much as I like playing in the shop making things also.

regards
Eric
CraftyCNC: Plugins for UCCNC (and other neat stuff): http://www.craftycnc.com/plugins-for-uccnc/
eabrust
 
Posts: 357
Joined: Fri Sep 16, 2016 2:32 am
Location: Near Shirland IL, USA

Re: Sharing Plugin Code

Postby dezsoe » Mon Jan 24, 2022 7:26 pm

dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Sharing Plugin Code

Postby eabrust » Sat Feb 26, 2022 1:40 am

I put a small 'jog panel' plugin on Git here: https://github.com/CraftyCNC/JogBox-for-UCCNC

I added 'snap to desktop edges', cleaned it up a little, and its fair game to use or modify as you wish.

Pre-compiled and ready to use plugin attached:
JogBox.PNG

JogBox.zip
(214.39 KiB) Downloaded 450 times



regards,
Eric
CraftyCNC: Plugins for UCCNC (and other neat stuff): http://www.craftycnc.com/plugins-for-uccnc/
eabrust
 
Posts: 357
Joined: Fri Sep 16, 2016 2:32 am
Location: Near Shirland IL, USA

Re: Sharing Plugin Code

Postby johnsattuk » Sat Feb 26, 2022 9:56 am

:D
johnsattuk
 
Posts: 79
Joined: Thu Aug 12, 2021 1:24 pm

Re: Sharing Plugin Code

Postby papaathome » Sun Jul 03, 2022 8:59 am

Good idea that needs more followup.

I try to get started with writing a plugin in c#, got the basics working.
Getting anyting done was not without frustrations and a bit time consuming.
So in the process of it I also made a plugin for testing calls and functions.
That plugin was a good idea for me and I would like to share it.

The plugin is as simple as possible, deviding code in regions of releted bits and pieces.
Logging is added to see what exactly is done in what order. And if there are any problems, details about it.
Note: the solution have references to 'Plugininterface.dll' and 'UC100_wrapper.cs' which are not included
in the zip file. See _README_.txt for more details

The zipfile includes the builds for a debug and a release version. You can try the plugin without compiling it the first time.

This version of the plugin has two buttons one for getting statistics and one for asking the current position.
And a MDI line similar to the one in the UCCNC software.

Here is an examle of the log that is produced from that plugin.
Info: UCCNC plugin: action = "Create"; name = Testbed; version = 0.1.1.0; time = 2022/07/03 09:54:20
Warn: UCCNC plugin: This plugin is for the development environment only. It is (inherently) *not safe* to load it by default in a productions environment.
Debug: UCCNC plugin: Getproperties_event(author = "A.H.M. Steenveld", pluginname = "Testbed", pluginversion = 0.1.1.0)
Debug: UCCNC plugin: Init_event(UC)
Warn: UCCNC plugin: Init_event; action = "init repeated event"
Debug: UCCNC plugin: Startup_event()
Form: action = "initialise application"
Debug: UCCNC plugin: Buttonpress_event(buttonnumber = 144, onscreen = True)
GetStatistics(ref result) = UC100_OK; DistX = 289649.000; DistY = 363524.000; DistZ = 112727.000
GetAxisPosition(...) = UC100_OK
GetAxisIndex(...) = UC100_OK
X = 163.328 units; X = 21777 steps
Y = 240.847 units; Y = 32113 steps
Z = -28.230 units; Z = -3764 steps
Debug: UCCNC plugin: Textfieldclick_event(labelnumber = 1000, Ismainscreen = True)
Debug: UCCNC plugin: Textfieldclick_event(labelnumber = 1000, Ismainscreen = True, text = "g0 x0 y0")
GetStatistics(ref result) = UC100_OK; DistX = 289658.997; DistY = 363533.997; DistZ = 112727.000
GetAxisPosition(...) = UC100_OK
GetAxisIndex(...) = UC100_OK
X = 153.330 units; X = 20444 steps
Y = 230.850 units; Y = 30780 steps
Z = -28.230 units; Z = -3764 steps
Plugin: WriteMDI("g0 x10 y10")
GetStatistics(ref result) = UC100_OK; DistX = 289668.997; DistY = 363543.997; DistZ = 112727.000
GetAxisPosition(...) = UC100_OK
GetAxisIndex(...) = UC100_OK
X = 163.328 units; X = 21777 steps
Y = 240.847 units; Y = 32113 steps
Z = -28.230 units; Z = -3764 steps
Debug: UCCNC plugin: Shutdown_event()
Debug: UCCNC plugin: action = "Finalise"
Debug: UCCNC plugin: action = Dispose(False)
Attachments
Testbed-v0.1-20220703.zip
First version of a developers plugin.
(204.52 KiB) Downloaded 371 times
papaathome
 
Posts: 3
Joined: Tue Mar 23, 2021 3:36 pm

Re: Sharing Plugin Code

Postby sigramsik » Mon Apr 01, 2024 9:45 am

Hi,

Can I use the Borland Delphi7 for writing UCCNC plugins?

Thanks.
sigramsik
 
Posts: 1
Joined: Mon Apr 01, 2024 9:42 am


Return to Plugins

Who is online

Users browsing this forum: No registered users and 7 guests