Git Product home page Git Product logo

roboxslicerextension's People

Contributors

benraay avatar dsendula avatar natdan avatar nebbian avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

natdan benraay

roboxslicerextension's Issues

Absolute extrusion

Hi,

I added a absolute to relative values script inside the Slic3r script.
maybe it should be in a parent class because it is meant to be generic for all slicers.
But the parent class "Slicer" is abstract, can I write some generic code there or is this "not the java way of coding" ?

let me know I will move it if it's better.

Use AM settings

... to start with when using known slicers (i.e. Slic3r). It would need an controller which would be invoked before invoking a slicer and it will in turn read AM details (from wherever they are stored - probably Cura's format and transfer them to target slicer's config file.

For example: before Slic3r is invoked, read ~/CEL Robox/PrintJobs//.roboxprofile and produce slic3r.ini file and then pass that as command line parameter when invoking Slic3r. That way some of the presets from AM would be preserved when Slic3r is inovked. Most importantly material details (what's the point of smart reels if that info is lost in translation).

Windows installer issues

After going through the code, it looks like the installer doesn't handle separate files for different OS's.

At least, I couldn't figure out where it would grab the current CuraEngine.exe from when installing on windows.

Contributing to this is the difficulty in testing an installer that always grabs files from the master branch...

Can someone (@natdan?) let me know how to modify the installer, so that it installs CuraEngine.exe instead of CuraEngine? And also let me know where to put my updated version of CuraEngine.exe so that it will be installed when someone runs the installer?

Thanks.

Control window doesn't remember choice

When opening the control window after saving "Slic3r" the previous time, the window still shows the default Cura. I think the choice is being saved, but it's not prefilling the dropdown box properly.

Merged cura2.7-support to master and setup github as maven repo

Hi guys,
When you get change - could you, please, have a look if master branch is correct and has all your changes from cura2.7-support branch and if you are happy, @nebbian could you delete cura2.7-support (or let me know here and I'll remove it).
With it, hopefully, we can move to pull requests again (smaller and more manageable changes I hope so). That means create a branch here (of master), add your changes and create PR from it. That will give us more visibility and manageability of the project! :)

Also, at the same time, I've added necessary magic in pom.xml so it can now deploy maven artifacts (jar files) to this repository (mvn-repo branch) and I'll update my installer to fetch the latest version from there. It will really be cool if someone can select previous stable version (yes, I think it is time for us to go to 1.0 version!) and the latest development version. Maven repo is giving us that visibility...

Let me know if I've broken anything. I'll try to concentrate now on installer (to read off maven repo) and to see if I can add toolkit into the mix, too. If we have stable mac/windows installer/slicer extension we should 'release' 1.0 and bump version to 1.1-SNAPSHOT.

Flow

I've been thinking walking to work this morning: I think I have clear(er) idea what the code/control flow could be. Let me know if I am closer to what you had in mind.

  • CuraEngine (CuraEngine.exe) is a script that invokes our jar file passing all program arguments to it.
  • the jar file captures arguments (and parses them?) and stores them for later
  • the jar file reads config file .roboxslicerextension file from ~/CEL Robox - file stored by our separate control program (which, BTW I started shaping in UI - will submit something over following days)
  • that config file describes which slicer to start - just by naming it. Those names will correspond to Java classes with more in-depth implementation of transformation of program arguments, knowledge which config file's entry to read to find where's appropriate executable (Slic3r for instance) and will have implementation of gcode transformation so it confirms current Cura's format needed for AM post-processor
  • also config file describes if there is a script (*) to be called after invoking slicer
  • it will then invoke gcode transformation so it conforms to Cura's format for AM post processor
  • further check config if we want/need gcode preview (and which kind)
  • and again check if config has stored another script (*) to be called before returning control back to AM

(*) by script I see any scripting language allowed by Java Scripting framework (JSR 223) or executable on the target system (i.e. shell script of batch file or anything else).

All above to be defined in presets in Robox Slicer Control program (Default AM Cura, Slic3r, Cura 3.0, Simplify 3D, Custom) - where any will allow you to amend default and add your stuff in. With all of that - we'll be able to add any scripting needed for existing AM flow + preview, too, (but not of post-processed code - not in this way!) without going to 'uncharted' territory of other slicers.

Does that make sense to you guys? I don't mind going with it and add more 'skeletal' code which will confirm to above algorithm...

project structure

@nebbian & @Benraay - do you want, maybe, me creating java project structure for you guys? Any ideas what should be project's groupId and artifactId? Package name? I know those are the least important things and the hardest for me to come up with something sensible! O: )

Replacing big if else with regular expressions

@Benraay (and @nebbian): I've been thinking what to do with code in Slic3r.postProcess method. It is quite awful with all the assignments in conditional expression :eek:

I can propose two alternative - but none is ideal (Java is not the best with DSL - had it been Scala or some other language...) and cannot decide which would you like better.

First is simple DSL along the lines:

lineProcessor.add("^(M204\\s+S(\\d+))", (line, group1, group2) -> writeOutput(String.format("M201 X%d Y%d Z%d E2000\n", group2, group2, group2)));
lineProcessor.add("^(M190\\s)", () -> {}));
lineProcessor.add("^(G1\\s+E([\\-0-9\\.]+)\\s+F([0-9]+))", (line, g1, g2, g3) -> {
    double extrusion = Double.parseDouble(g2);
    int feedRate = Integer.parseInt(g3);
    ...
});

As you can see I failed to infer types for parameters - they all have to be String (due to type erasure, etc...)

Second option is to introduce PostProcessor class (AbstractPostProcessor or just public abstract PostProcessor) which is going to process file line by line but we can do type inference by methods. Instead of adding lambdas to lineProcessor DSL utility class we can use annotations and methods! For instance:

public class Slic3rPostProcessor extends PostProcessor {
...
    @Pattern("(X([\\-0-9\\.]+)\\s+Y([\\-0-9\\.]+))")
    public void commandDistance(Object ignore, double newX, double newY) {
        commandDistance = Math.sqrt(Math.pow(newX - currentX, 2) + Math.pow(newY - currentY, 2));
    }

    @Pattern("^(M204\\s+S(\\d+))")
    public void M201(Object ignore, String accel) {
        writeOutput(String.format("M201 X%d Y%d Z%d E2000\n", accel, accel, accel);
    }

    ....

}

I think there's a scope in handing groups 0 (the line) and 1 (which was never used in your regex statements),

Which one do you like better?

Default Cura slicing is broken

After choosing the default Cura slicing engine using the control applet, and then doing a slice, I get this error:

Jun 25, 2017 8:13:56 AM com.roboxing.slicerextension.flow.Main main
SEVERE: Error processing : 
java.io.IOException: Cannot rename '5277df8f0d024756.slicer.gcode' to '5277df8f0d024756.gcode'
	at com.roboxing.slicerextension.flow.DefaultAMCura.postProcess(DefaultAMCura.java:38)
	at com.roboxing.slicerextension.flow.Controller.process(Controller.java:76)
	at com.roboxing.slicerextension.flow.Main.main(Main.java:58)

However, using Slic3r seems to work fine. Could it be that you don't need to postprocess output from the default engine?

Windows Compatibility

Is anyone able to test the windows compatibility of this code?

I'm unable to, there aren't any windows machines in my house. Even my VMs are way out of date.

Java Flow Windows commissioning

I'm trying to get java-flow running on windows. I've gotten java-control working, which is a good start.

I'm using this command:
"c:/Program Files/CEL/AutoMaker/java/bin/java.exe" -jar "c:/Program Files/CEL/Common/robox-slicer-flow-1.0-SNAPSHOT.jar" "-v" "-p" "-c" "b341ca76876f4ed3.roboxprofile" "-o" "b341ca76876f4ed3.gcode" "C:\Users\IEUser\Documents\CEL Robox\PrintJobs\b341ca76876f4ed3\b341ca76876f4ed3-0.stl"

but it just hangs there afterwards saying

Logging to C:\Users\IEUser\CEL Robox\robox-slicer-extension.log
22:38:34.151 INFO    [java.util.logging.LogManager$RootLogger log] Started robox slicer extension
22:38:34.151 INFO    [java.util.logging.LogManager$RootLogger log] Started robox slicer extension

Cura 3 is available

Guys, Cura 3 has enabled relative extrusion if you hit a checkbox. It's working after a filename swap, the default is "RD_file", but if you substitute the STL file less the ".stl" when you save, it will post process lovely in AutoMaker like Slic3r does. Impressively, it seems to be working very well, with my default DM settings, but I have checked teh Relative Extrusions checkbox in Settings.
cura3-the biggy

Installer and control window

@natdan I managed to get it work with the script "CuraEngine" and "install"
work good for development purpose but maybe we need to update your installer script.

@nebbian I made some little changes to the postprocess, added a ? on the speed regex : (F([-0-9.]+)\s?)
because when it is on a single line there is no whitespace at the end !
also added a tiny test to put z value only when needed.
and at the end commented out the "if(totalExtrusion > 0){" for the unretraction.
I looked at the original curaEngine code and the unretractions are there !

I got a quite good print !

next step try with cura 2.5 !!!

Compiling Java Code

I also got stuck compiling the java source in Jar I did it with command line also but when I try to launch it I have a "no main or something" error How do you compile the jar ? Should be easy as there is only one class. My pure java tests are a bit far from me about 7 years But I merged the master update to the safetomerge branch and cause nebbia

Get the latest maven (https://maven.apache.org/download.cgi).

From command line go to java/robox-slicer-extension and type:

mvn clean install

When it finishes in java/robox-slicer-extension/robox-slicer-control/target and java/robox-slicer-extension/robox-slicer-flow/target you can find two jar files like:

original-robox-slicer-control-1.0-SNAPSHOT.jar
robox-slicer-control-1.0-SNAPSHOT.jar

The bottom one is 'executable' jar. In IDE's you don't need any of it. Just import it as maven project (from the top: java/robox-slicer-extension) find 'Main' class in both projects (robox-slicer-control and robox-slicer-flow) and run that class. IDE will do the rest of setting up classpath, etc...

Let me know if you stumble at any point - I'm more than happy to help you set it up!

Updating the java binaries

Hey @natdan,
What's the best way to ensure that the java binaries are kept updated?

Do we manually recompile when the source code changes?

Cura 2.7 support

We're almost there guys. Check this out:

http://www.cel-robox.com/forums/topic/robox-slicer-control-snapshot-jar-cura-2-7/

What would be really helpful would be to scan the printjob folder for the latest modified file in there, check to see that it has a suffix of .gcode, and then copy/move it to to the filename that is expected (xxxxxxxxxx.slicer.gcode).

My java skills are atrocious, do either of you have an hour or so to whip this change out? I can't imagine that it's that difficult.

rbx-toolset

https://github.com/natdan/rbx-toolset

@Benraay To answer forum quesion here:

And yes – check the link! README over there explains just that. Make a bash script with

#!/bin/bash

java -jar /robox-toolset.jar "$@"

Call it rbx with right (executable) permission and you can do:
$ rbx

For example – the most important commands:

$ rbx status
$ rbx -v upload -f xxxx_robox.gcode
$ rbx upload -i myjob < my.gcode
$ rbx pause
$ rbx resume
$ rbx abort

But before we use it we’ll need to check if and how much protocol between AM and Robox changed.

Windows beta testing

I'd appreciate it if anyone who tries to get this working in Windows could post their experiences here.

I've gotten it working with a heavily doctored system, and am wondering how easy it is to get going on a normal windows install.

Try installing using the instructions in the README file, and post here how you go.

Linux support

I tried to get working your beautiful extension for Robox on Linux.
I've found that's needed to define path to slic3r in this file: RoboxSlicerExtension/java/robox-slicer-extension/robox-slicer-flow/src/main/java/com/roboxing/slicerextension/flow/OS.java

Then I compiled the robox-slicer-flow-1.0-SNAPSHOT.jar. Finally I run java -jar robox-extensions-installer.jar which worked quite well.
Now after running automaker, importing .stl and pressing "Make" the slic3r (v1.34.1) is opened but it says "Input file must have .stl, .obj or .amf(.xml) extension" and it closes slic3r itself.

With slic3r v1.36.2 it says the same error two times and then it says "Can't call method objects_count on an undefined value at..... Model.pm line 17" and also error about Multi-part object detected. The slic3r stays opened and I can import STL manually, slice it and export .gcode to folder CEL Robox\PrintJobs\cbe1be0d2ffa4900\cbe1be0d2ffa4900.gcode. However after closing slic3r the Automaker says "Slicing failed".

In the Automaker I can see during slicing this:

2017-09-01 13:56:20,666 [Thread-57] ERROR celtech.roboxbase.services.slicer.h.a(SlicerTask.java:353) - Failure when invoking slicer with command line: /home/diego/CEL/AutoMaker/../Common/Cura/CuraEngine -v -p -c cbe1be0d2ffa4900.roboxprofile -o cbe1be0d2ffa4900.gcode cbe1be0d2ffa4900-0.stl
2017-09-01 13:56:20,667 [Thread-57] ERROR celtech.roboxbase.services.slicer.h.a(SlicerTask.java:355) - Slicer terminated with unknown exit code 1
2017-09-01 13:56:21,702 [JavaFX Application Thread] INFO - Print service is in state:SUCCEEDED

I tried to run command following command manually and it's processed without error:

diego@asterix ~ $ /home/diego/CEL/AutoMaker/../Common/Cura/CuraEngine -v -p -c cbe1be0d2ffa4900.roboxprofile -o cbe1be0d2ffa4900.gcode cbe1be0d2ffa4900-0.stl
14:03:34.400 INFO    [java.util.logging.LogManager$RootLogger log] Started robox slicer extension 
14:03:34.400 INFO    [java.util.logging.LogManager$RootLogger log] Started robox slicer extension 
14:03:34.536 INFO    [com.roboxing.slicerextension.flow.Main main] Finished slicing. 
14:03:34.536 INFO    [com.roboxing.slicerextension.flow.Main main] Finished slicing

Do you have an idea how to get it working in Linux? I expect it's very similar to Mac OS. Maybe the problem is in placing script slic3r_postprocess.pl. I cannot find where it should be placed...

Add path to Slic3r in config window

As title said. Just a reminder.
It would be nice for it to be shown in UI only when Slic3r is selected, to default to platform specific path and at the end it had to be stored in slic3r specific path (json file).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.