Illustrator to LightBurn directly (like CorelDraw macro)

Is it possible to make macro, plugin or button for Illustrator which converts whole drawing to curves and then somehow programatically force LightBurn to import that file with correct layer colors and dimensions (like CorelDraw macro). Of course, all process is done in background, so user don’t see that conversion…etc.

Thank you in advance for your help.

1 Like

Here is the instructions I used to export directly to Lightburn

  1. Create “OpenExternal.vbs” in “C:\Lightburn_data” (create folder if it doesn’t exist)
  2. Code for “OpenExternal.vbs”
    Dim oShell
    Set oShell = WScript.CreateObject (“WScript.Shell”)
    oShell.run “”“C:\Program Files\Lightburn\Lightburn.exe”" ““C:\Lightburn_data\export.svg”” "
  3. Create “SaveDocsAsSVG_Lightburn.jsx” in “C:\Program Files\Adobe\Adobe Illustrator CC
    2014\Presets\en_US\Scripts” or equivalent folder
  4. Code for ““SaveDocsAsSVG_Lightburn.jsx”
    try {
    if (app.documents.length > 0 ) {
    var destFolder = null;
    destFolder = “C://Lightburn_data//”;
    if (destFolder != null) {
    var options, i, sourceDoc, targetFile;
    options = this.getOptions();
    for ( i = 0; i < app.documents.length; i++ ) {
    sourceDoc = app.documents[i];
    targetFile = this.getTargetFile(‘export’, ‘.svg’, destFolder);
    sourceDoc.exportFile(targetFile, ExportType.SVG, options);
    }
    var vbFile = new File(“C:\Lightburn_data\OpenExternal.vbs”)
    vbFile.execute();
    }
    }
    else{
    throw new Error(‘There are no document open!’);
    }
    }
    catch(e) {
    alert( e.message, “Script Alert”, true);
    }
    function getOptions()
    {
    var options = new ExportOptionsSVG();
    return options;
    }
    function getTargetFile(docName, ext, destFolder) {
    var newName = “”;
    if (docName.indexOf(’.’) < 0) {
    newName = docName + ext;
    } else {
    var dot = docName.lastIndexOf(’.’);
    newName += docName.substring(0, dot);
    newName += ext;
    }
    var myFile = new File( destFolder + ‘/’ + newName );
    if (myFile.open(“w”)) {
    myFile.close();
    }
    else {
    throw new Error(‘Access is denied’);
    }
    return myFile;
    }
  5. Script is available within Illustrator from "File->Scripts

David, if you already have this set up and working, there’s a change that can make it smoother. LightBurn includes a small helper app for things like this that will check to see if LightBurn is already running, and if so, will import the file into the existing instance of LightBurn instead of launching a new one.

Instead of doing this:

oShell.run """C:\Program Files\Lightburn\Lightburn.exe"" ""C:\Lightburn_data\export.svg"" "

Do this instead:

oShell.run """C:\Program Files\Lightburn\SendUDP.exe"" ""C:\Lightburn_data\export.svg"" "

That’s the only change you should need.

It’s possible, yes, I just don’t have Illustrator to create or test this with, but it’s on the list to do.

The “with correct layer colors” part is trickier - the palette in LightBurn is fixed. Imported art is mapped to the closest color in the LightBurn palette, but the LightBurn palette won’t change to match. It’s done this way because lots of artwork contains white, used to paint over things you don’t want, and those wouldn’t show up in the LightBurn workspace.

Thanks Oz,
I will make the change. I haven’t used it for awhile.
David

Hi David,

Thank you!
I tried it, but this method can only saving the graphics into an .svg file for me.
I rewrote “LightBurn.exe” to “SendUDP.exe” in the .vbs code (as OZ suggested), but it won’t open LighBurn too. I fixed the syntax errors and checked the filepaths. Seemingly everything is fine, but it doesn’t work. The “export.svg” file is get ready but LightBurn will not open.

What could be the problem?

OZ:
Okay. It is not problem. The only important thing is that LightBurn recognizes Illustrators different colors in differently.
Thank you!

Hi David!

Can you help me?

Hi,
I really don’t have any more information as the script I provided was posted on the FB forum months ago. It works as noted with my version CS6.
Dave

One of the problems I see here is not addressed. The direct export of an illustrator file is rarely if ever right for lasing. Of course Adobe never intended for the software to be doing this but it begs the question about how the file is sent during this export. Many times lines get doubled for whatever reason but they do. I have to “vet” every file before importing. In other words the skillset is about understanding the vector shapes, lines and nodes and preparing the files before ever thinking about exporting them. Fixing things after is a nightmare. Having an import AI file means nothing to me if I haven’t done diligence on what will happen inside the laser. Hope this helps.

Thanks!
But why the above script is better than doing a simple export?
Nothing special happens to me (Illsutrator CC). The script exports the file to *.svg format. It’s easier if I save the graphics as usual and import them into LightBurn.

Why doesn’t the script open LightBurn?

Hello,

I just tried my version CS6 and it does indeed work. Illustrator for me will create the svg export file and then open and load the svg file directly into lightburn. The main command to send the file to lightburn and open the created svg file is the OpenExternal.vbs file, if you do not get the quotations exactly correct the command will not work.

Dim oShell
Set oShell = WScript.CreateObject (“WScript.Shell”)
oShell.run “”“C:\Program Files\Lightburn\SendUDP.exe”" ““C:\Lightburn_data\export.svg”” "

Just copy and paste this into a text file and save as OpenExternal.vbs, this is about all there is to running this script.

Regards,

Dave

I checked the path and syntax. All right, but the opening part still doesn’t work.
I will try and if I can find a solution, I will write it.

Thanks!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.