Machsupport Forum

Mach Discussion => Mach SDK plugin questions and answers. => Topic started by: bdring on July 06, 2009, 07:27:17 PM

Title: Laser Engraving Plugin Source Code
Post by: bdring on July 06, 2009, 07:27:17 PM
Is the laser engraving plugin source code available?  I would like to tweak it a little.  I will post anything I complete.

Thanks
Title: Re: Laser Engraving Plugin Source Code
Post by: bdock on July 29, 2009, 06:22:37 AM
The engraver plugin source code is now available for download, I was the one who requested the code be make available. As good support people they asked Art, the code owner, if it could be released and he said YES!.
I have found the most significant bug relating to the image requiring to be square to work correctly.
There are three variables in the code, length height & width, and they have been mixed up in some of the code.
I now have sone source code which works WITHOUT the image needing to be square.
I have also added a "Maintain Aspect Ratio" checkbox to keep the image the correct shape.
My only major problem is I am attempting to add an "Inverse Image" checkbox and I cannot get it to work.
I am NOT a VC++ programmer and I have had to feel my way through this code so far, normally I code in ANSI C or Codegear (borland) Pascal.

The sourcecode of my version is available at  www.dockerty.co.nz\Engraving.zip (15Mb).

This source is for Microsoft Visual Studio 2003 and includes the source for zlib.lib which I spent a few hours sorting.

I need to work out the remaining bugs and things will be sweet!!!
Title: Re: Laser Engraving Plugin Source Code
Post by: bdring on July 29, 2009, 08:52:08 AM
That's great!

I was patient with this thread because my laser is not on-line yet.  I was going to persue it further when I needed it.

My home built laser cutter/engraver should be ready to go in about 2-3 weeks.

My build log is here...http://www.buildlog.net/cnc_laser/index.html (http://www.buildlog.net/cnc_laser/index.html)
Title: Re: Laser Engraving Plugin Source Code
Post by: bdring on July 30, 2009, 10:37:02 AM
I think I understand the way the code works. 

It appears that it determines the image resolution, figures out the steps per pixel and related info, sets up a zig zag pattern, moving up the Y stepover at each end.  Based on grayscale info, it determines what to do with the beam and feeds some timing info into MachView->Info.Time[].

It would help to understand Mach a little more at this point.  How does Mach use this information?  It appears that Mach can use this as it it is running a line of G-Code to control an output on a per step basis.  Is this documented somewhere?  Is the output pin selectable?

Any help would be appreciated.

Thanks
Title: Re: Laser Engraving Plugin Source Code
Post by: poppabear on July 30, 2009, 11:10:18 AM
bdock,

    If you would send me your source code to:  poppabear@hughes.net
and put in details of what it is your trying to do with the reversal stuff, I can try and help you out.  No promises.... but, perhaps we can make it do the revers image you want?

scott
Title: Re: Laser Engraving Plugin Source Code
Post by: bdring on July 30, 2009, 01:46:35 PM
Thanks for the generous offer poppabear, but that is more than I need.

The reversal idea seems pretty straight forward....just invert the beam value at the right time  You could probably do it in advance anyway with Photoshop, etc. 

I was just hoping to get an overview of how Mach deals with changing the beam while the axis is moving.  What are the hooks exposed to the plugin author that lets you do this.  A quick overview would be helpful.  I think having the source code and bdock's changes address most of what I immediately desire.
Title: Re: Laser Engraving Plugin Source Code
Post by: bdock on July 30, 2009, 05:20:24 PM
poppabear.

The sourcecode of MY VERSION is available at www.dockerty.co.nz\Engraving.zip
and the ORIGINAL SOURCECODE is now avaliable from the MACH3 PLUGIN webpage.

Simply drop the new DLL overtop of the old one!

Hopefully you can locate the stupid errors I have made and get the additional features fully functional with there settings correctly storing to XML.
 
Title: Re: Laser Engraving Plugin Source Code
Post by: poppabear on July 30, 2009, 07:01:24 PM
you link doesnt work, cna you post your source here please
Title: Re: Laser Engraving Plugin Source Code
Post by: bdock on July 30, 2009, 07:14:05 PM
Ok,

 :)
Here is the source for both the Engraver plugin and I also include the zlib.lib source as I also required this.
Title: Re: Laser Engraving Plugin Source Code
Post by: bdring on October 06, 2009, 07:06:13 PM
What do you need to setup in Mach for this to work?  What output/pins need to be setup?  It is driving the X and Y axis correctly, but I need to hook into the power supply.
Title: Re: Laser Engraving Plugin Source Code
Post by: bdock on October 06, 2009, 11:41:09 PM
The ENGRAVING triggering is output on the DIGITAL TRIGGER pin which you will need to assign to a pin and enable.
Title: Re: Laser Engraving Plugin Source Code
Post by: bdring on October 07, 2009, 07:18:37 AM
Thanks a lot.
Title: Re: Laser Engraving Plugin Source Code
Post by: barbera on October 08, 2009, 07:18:50 AM
PLEASE I NEED HELP , WITH C++.
Good morning, I live in Spain My Names is Josep.
Thanks for everything, I built a small laser machine for engraver, Co2 40 w.
 I tested the changes engraver.dll file you left on the forum.
Thanks everything works fine.
took many tests with the plugin, the problem is that I can not different  While grayscale photos.
It would be possible to modify the source code to select different types of output power as a function of the grayscale photo.

The problem is as follows: laser power we modify the PWM input signal on the power supply 0, 5 volts in a train of pulses.

  0 volts, it would be black.
  2.5 volts, 50% black 50% white
  5 volts, it would be white.

It would be possible to change this scale ????? .

http://www.youtube.com/watch?v=L6lRud7RAZQ


Thank you very much.

Barbera Josep.
Title: Re: Laser Engraving Plugin Source Code
Post by: bdring on October 08, 2009, 08:20:52 AM
I don't think it would be possible.  The laser trigger points only control on/off.  I am not sure PWM power control could react fast enough anyway. 

Could you use some photo editing software to make two images?  One would etch at one power level and the second would etch at the other power level?  It would take more time, but maybe worth a try.
Title: Re: Laser Engraving Plugin Source Code
Post by: barbera on October 08, 2009, 02:45:51 PM
UUUUFFFF, the power supply I use is the same as you have on your website.
In  POWER SUPLLY   Pin 5 is the PWM input,


0 volts .... 0% laser output power.
2.5 volts .... 50% Power
5 volts .... 100% Power

The output signal in Mach3 DIGITALITZER TIGGER IS PWM output. 0 ... 5 volts, pulse train


Ok ..

The  Grayscale  seems logical.

 0 volts             Black 100% .          White 0%
2.5 Volts           Black 50%             White 50%
5 volts              Black 0 %             White 100%  


Ok.

barbera.
Title: Re: Laser Engraving Plugin Source Code
Post by: lasersafe on November 29, 2009, 06:19:23 PM
Today I learned an interesting tidbit about the Mach 3 laser engraving plugin.  I had a 1MHz Celeron machine before and the laser plugin wouldn't work well at all.  I kept getting the "Previous Sequence not complete" crashes.  I upgraded my PC to a 3.4 GHz Athelon with 1Meg of RAM and I had the plugin working to my complete satisfaction (well almost complete as I will describe after this tidbit).  With a 3.4GHz machine I found I could turn up the Mach pulsing engine to 100Khz.  Using the plugin I could raster my x stage at 1400 in/min and get up to 1/16" burn depth in black walnut using my 40W CO2 (chinese engraver) with the power set to maximum.  This isn't too shabby considering the speed of the raster and microsecond pulses of the laser.

Ready for the interesting part?  I was playing (working) with the laser setup to finally adjust the table limits.  I crashed my Y stage into the rear wall a few too many times and crushed a wire on my X stage which shorted it to the frame.  This burned up my Allegro driver chip.  I repaired the wire and replaced the x stage motor driver with another driver I had laying around.  My original Allegro driver was set up for half step mode which gave me 500 steps per inch.  The new driver had a much finer microstepping setting that required me to set Mach 3 for 2500 steps per inch.  After the replacement I confirmed that I could indeed get my X stage to run at 1400"/min.  Surely at that point I know that the pulse train coming from Mach 3 for Xstep is screaming.  (58.333 KHz to be exact ).   I then ran the laser engraver plugin again and it wouldn't work worth a darn.  It would lose steps and give me one of those "previous sequence not complete" crash warnings.  So I guess the trajectory planner in the raster software can't keep up if the step rate is super high.  From now on, I'm going to stick with 1/2 step mode on my drivers since this gives the computer more time to think about the next step.  Perhaps high pulse rates have been affecting other users in the past and affected thier results concerning burn depth.  Since there was never an official manual for this plugin (that I know of) it could go as an unseen issue.

Now what still bugs me about the engraver plugin?  It would be cool if it could analyze the incoming image and automatically skip over the areas the do not need engraving by using a rapid Y move.  I am telling the Y to increment in 0.004" steps and it seems ridiculous for it to sit there and raster for two minutes because it hit a a 1/4" area of the image that had nothing to print.
Title: Re: Laser Engraving Plugin Source Code
Post by: obal on October 22, 2010, 09:05:36 AM
Hallo.
Ist neu plugin for laser engraving 2010 year ?
I have old version.

Thanks.
Title: Re: Laser Engraving Plugin Source Code
Post by: Tweakie.CNC on November 11, 2010, 11:39:51 AM
Obal,

Download unzip and transfer the DLL to your mach Plugins folder.

http://www.machsupport.com/forum/index.php/topic,16446.msg111507.html#msg111507

Tweakie.