Gcode Unit Converter Plugin

Here is where you can drop off Examples of WORKING macros,plugins,Gcode programs , macro Wizards etc.
Please give a brief description of what it is and how it works.

Gcode Unit Converter Plugin

Postby Dan911 » Sun Sep 16, 2018 10:51 am

This plugin will convert gcode units inch to mm or mm to inch used in the UCCNC version release 1.2047. Any gcode not used in this version plugin won't recognize or convert. Will update with new official release versions upon request.


To use this plugin.

1. Put file in your UCCNC plugin folder and start UCCNC, go to configuration/general settings/configure plugins and check enable, restart.
2. You can create a button on your screen and give it button# 55555, or create a hotkey with Function # 55555, or create a macro and put "exec.Callbutton(55555);" in it. Call macro with mdi or multiple Macro Button plugin.

The plugin converted a file with 1,490,000 lines (46mb) without issue in testing. Hope some can find use.

Dan

gcuc.JPG



Gcode Unit Converterr.zip
(7.32 KiB) Downloaded 34 times
Dan911
 
Posts: 472
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Re: Gcode Unit Converter Plugin

Postby Vmax549 » Sun Sep 16, 2018 12:40 pm

Hi Dan great job. Could you add one more unit conversion ?

Scaling

(;-)TP
Vmax549
 
Posts: 1380
Joined: Sun Nov 22, 2015 3:25 am
Location: USA

Re: Gcode Unit Converter Plugin

Postby Dan911 » Sun Sep 16, 2018 2:44 pm

Would be happy to but never used Scaling so not sure what needs to be done, the plugin is going to convert x,y,z ,a,b,c to mm or inch depending on what's configured. What I'm I missing?

Do you mean a different plugin to convert the scale?

Dan
Dan911
 
Posts: 472
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Re: Gcode Unit Converter Plugin

Postby ger21 » Sun Sep 16, 2018 4:11 pm

He wants to be able to make the code larger or smaller. Instead of 25.4x larger (inch to mm), maybe 2x larger.
Same code, just user specified scale factor.
Gerry
UCCNC 2017 Screenset - http://www.thecncwoodworker.com/2017.html
ger21
 
Posts: 1156
Joined: Sat Sep 03, 2016 2:17 am

Re: Gcode Unit Converter Plugin

Postby Vmax549 » Sun Sep 16, 2018 5:19 pm

Yes to what Ger said. Scale everything up or down.

x1.5 = 1 and 1/2 times larger
x.5 = 1/2 the size

Also what I did for mach3 plasma was create a function to take a extents value of either X or Y and then set a new size and it gave you teh scale factor to use

For example:

Old size ( 12.000 ) New size (24.000) = scale factor of 2.000

(;-) TP
Vmax549
 
Posts: 1380
Joined: Sun Nov 22, 2015 3:25 am
Location: USA

Re: Gcode Unit Converter Plugin

Postby Dan911 » Sun Sep 16, 2018 5:40 pm

Oh boy do I feel stupid! I was thinking G51 which I'm sure works same way but I only quickly googled, after just reading your PM it clicked what your after.

This can easily be done with this plugin by making 25.4 an editable variable. If you are working on this I can certainly help, or I can easily edit this plugin to do it...LMK

Dan
Dan911
 
Posts: 472
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Re: Gcode Unit Converter Plugin

Postby Vmax549 » Sun Sep 16, 2018 5:44 pm

The plugin would be very useful AND teaching this old dog HOW to fish would be helpful as well :)

I would not change teh bascis you already have just add in another function to your plugin

(x) SCALE ( ??.??? ) Scale Factor

Old Size ( ??.??? ) New Size ( ??.??? ) = ( ??? . ??? ) Scale Factor

(;-) TP
Vmax549
 
Posts: 1380
Joined: Sun Nov 22, 2015 3:25 am
Location: USA

Re: Gcode Unit Converter Plugin

Postby Dan911 » Mon Sep 17, 2018 8:54 pm

Vmax549 wrote:Yes to what Ger said. Scale everything up or down.

x1.5 = 1 and 1/2 times larger
x.5 = 1/2 the size

Also what I did for mach3 plasma was create a function to take a extents value of either X or Y and then set a new size and it gave you teh scale factor to use

For example:

Old size ( 12.000 ) New size (24.000) = scale factor of 2.000

(;-) TP


Hi Terry,

Since your idea and help was hoping you can test and suggest any ideas/recommendations to make more useful.

Vmax549.zip
Dan911
 
Posts: 472
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Re: Gcode Unit Converter Plugin

Postby Vmax549 » Mon Sep 17, 2018 9:56 pm

The basics work well.

I would reset teh Tab order to go from top to bottom. That way it can run mouseless and be very easy to use.

The cancel button does not work here.

Have you ever worked with SaveFileDialog() to be able to select the save to file,folder and drive ? It works very similar to windows explorer. I am trying to get it to work in a macro Wizard but no luck yet. It should work very well in a plugin/Form function.

That way you can save it ANYWHERE the user wants to.

Good Job , (;-) TP
Vmax549
 
Posts: 1380
Joined: Sun Nov 22, 2015 3:25 am
Location: USA

Re: Gcode Unit Converter Plugin

Postby Dan911 » Tue Sep 18, 2018 1:41 am

Thanks for your help Terry much appreciated!

The tab order is a simple fix and something I always overlook...LOL. The Cancel button is to stop the backgroundworker thread, you really wouldn't see it work unless it's a really large file and you wanted it stop before the conversion is finished.

Yes I worked with SaveFileDialog(), VS makes it very simple to implement. The plugin creates a folder in the UCCNC directory and saves files there, I use the same file for all plugins and feel it keeps all files in 1 place and makes it easier to remember where to find, also eliminates another step.

To use SaveFileDialog() in a macro is also simple, I uploaded in a test form to see. Write in textbox and press save button.

SaveFileDialog Macro.txt
(1.54 KiB) Downloaded 29 times



Dan
Dan911
 
Posts: 472
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Next

Return to UCCNC TOOL BOX

Who is online

Users browsing this forum: No registered users and 3 guests