Blame README

Ivan Mahonin 66ba5e
Ivan Mahonin 66ba5e
simu - is the program for generation and simulation gcode (track) files for CNC
Ivan Mahonin 66ba5e
Ivan Mahonin 66ba5e
simu - is the public domain
Ivan Mahonin 66ba5e
Ivan Mahonin 66ba5e
Ivan Mahonin 66ba5e
currently implemented only 4-axis milling (rotate model around X axis)
Ivan Mahonin 66ba5e
simulator simulates all four axes, but generator uses only three: X, Z and Angle
Ivan Mahonin 66ba5e
Ivan Mahonin 66ba5e
in the world exists a lot of opensource XYZ generators but XZA is the rare,
Ivan Mahonin 66ba5e
so i implement it first for my CNC
Ivan Mahonin 66ba5e
Ivan Mahonin 66ba5e
i hope it will easy to implement classic XYZ miling (basreliefs), can you?
Ivan Mahonin 66ba5e
Ivan Mahonin 66ba5e
Ivan Mahonin 66ba5e
requirements:
Ivan Mahonin 66ba5e
    SDL2
Ivan Mahonin 66ba5e
Ivan Mahonin 66ba5e
build:
Ivan Mahonin 66ba5e
    just run build.sh
Ivan Mahonin 66ba5e
    executable file is ./simu
Ivan Mahonin 66ba5e
    
Ivan Mahonin 66ba5e
    if you want to build it for windows (i have not tried)
Ivan Mahonin 66ba5e
    you need to compile and link all *.cpp files in current folder
Ivan Mahonin 66ba5e
    and link libSDL2
Ivan Mahonin 66ba5e
Ivan Mahonin 66ba5e
run:
Ivan Mahonin 66ba5e
    ./simu <file-to-simulate.tap|.> [<model.stl|.> [output-generated-file.tap|.]]
Ivan Mahonin 66ba5e
    
Ivan Mahonin 66ba5e
    in other words first argument is always filename of input gcode for simulation,
Ivan Mahonin 66ba5e
    if you does not need this just set the dot as first arg
Ivan Mahonin 66ba5e
Ivan Mahonin 66ba5e
    second argument is always input model in binary STL format,
Ivan Mahonin 66ba5e
    you may set the dot to do not load model
Ivan Mahonin 66ba5e
Ivan Mahonin 66ba5e
    third argument is always filename for output gcode,
Ivan Mahonin 66ba5e
    you may set the dot too
Ivan Mahonin 66ba5e
    
Ivan Mahonin 66ba5e
    
Ivan Mahonin 66ba5e
    you cannot generate something without a model
Ivan Mahonin 66ba5e
    you cannot generate something if you use simulaton arg
Ivan Mahonin 66ba5e
    
Ivan Mahonin 66ba5e
examples:
Ivan Mahonin 66ba5e
    simulate already generated gcode:
Ivan Mahonin 66ba5e
        ./simu file.tap
Ivan Mahonin 66ba5e
    
Ivan Mahonin 66ba5e
    simulate already generated gcode and show the target model:
Ivan Mahonin 66ba5e
        ./simu file.tap model.stl
Ivan Mahonin 66ba5e
        
Ivan Mahonin 66ba5e
    just show the model:
Ivan Mahonin 66ba5e
        ./simu . model.stl
Ivan Mahonin 66ba5e
        in this mode you can move the tool by W, S, A, D keys
Ivan Mahonin 66ba5e
        to check how collision detection works
Ivan Mahonin 66ba5e
Ivan Mahonin 66ba5e
    generate gcode from model:
Ivan Mahonin 66ba5e
        ./simu . model.stl newfile.tap
Ivan Mahonin 66ba5e
Ivan Mahonin 66ba5e
    
Ivan Mahonin 66ba5e
    in all modes use the left mouse button to rotate camera,
Ivan Mahonin 66ba5e
    right button to zoom and middle button to translate
Ivan Mahonin 66ba5e
Ivan Mahonin 66ba5e
options:
Ivan Mahonin 66ba5e
    - looks easy but where the other options - cutter shape, strateg, layers etc?
Ivan Mahonin 66ba5e
    - in the code
Ivan Mahonin 66ba5e
    
Ivan Mahonin 66ba5e
    first look function main() in main.cpp
Ivan Mahonin 66ba5e
        this line sets the simulatior options:
Ivan Mahonin 66ba5e
            SimulatorXYZA simulator_xyza(400, 360);
Ivan Mahonin 66ba5e
        - simulatior is XYZA with resolution along X axis is 400 samples,
Ivan Mahonin 66ba5e
          angular resolution is 360 samples per round
Ivan Mahonin 66ba5e
          see: simulator.h, simulator.cpp
Ivan Mahonin 66ba5e
Ivan Mahonin 66ba5e
        these lines configure a tool:
Ivan Mahonin 66ba5e
            //FlatTool tool(1.5);
Ivan Mahonin 66ba5e
            ConeTool tool(1.25, 10, 0.75);
Ivan Mahonin 66ba5e
        - base radius, height of cone part, small radius at the end of cone (can be zero)
Ivan Mahonin 66ba5e
          see: tool.h, tool.cpp
Ivan Mahonin 66ba5e
          
Ivan Mahonin 66ba5e
        direction of the tool for testing:
Ivan Mahonin 66ba5e
            Vector3 dir(1, 3, -3);
Ivan Mahonin 66ba5e
        - when you pass only model as argument (./simu . model.stl)
Ivan Mahonin 66ba5e
        you can move the tool manually (by WSAD) and see how collision detector works
Ivan Mahonin 66ba5e
        this line determines direction (angle) of the tool
Ivan Mahonin 66ba5e
        
Ivan Mahonin 66ba5e
        look down in parsing third arg there is lines to configure generator:
Ivan Mahonin 66ba5e
            GeneratorRowsZAX generator;
Ivan Mahonin 66ba5e
            //generator.step_z = 1.5;
Ivan Mahonin 66ba5e
            generator.step_z = 0;
Ivan Mahonin 66ba5e
            //generator.step_a = 2*tool.radius*0.5;
Ivan Mahonin 66ba5e
            generator.step_a = 0.5*1.5;
Ivan Mahonin 66ba5e
            generator.step_x = 0.5;
Ivan Mahonin 66ba5e
            //generator.skip_middle_layers = true;
Ivan Mahonin 66ba5e
            generator.feed_speed = 150;
Ivan Mahonin 66ba5e
Ivan Mahonin 66ba5e
        generator supports layered milling (output/example-tux-p1.tap)
Ivan Mahonin 66ba5e
        
Ivan Mahonin 66ba5e
        step_z, mm - determines a maximum height of layer (zero for no layers, output/example-tux-p3.tap)
Ivan Mahonin 66ba5e
        step_a, mm - step along rotation in millimeters! generator will calculate degrees
Ivan Mahonin 66ba5e
        
Ivan Mahonin 66ba5e
        combination of step_z and skip_middle_layers helps to optimize final processing
Ivan Mahonin 66ba5e
        model splits to several layers (layer heigth is near to step_z) and for each layer determines an angular step
Ivan Mahonin 66ba5e
        for points near to axis of rotation angular step is bigger than for that points far from axis
Ivan Mahonin 66ba5e
        (output/example-tux-p2.tap)
Ivan Mahonin 66ba5e
Ivan Mahonin 66ba5e
        - see: generator.h, generator.cpp
Ivan Mahonin 66ba5e
Ivan Mahonin 66ba5e
Ivan Mahonin 66ba5e
    also look constructor Scene::Scene() in scene.cpp
Ivan Mahonin 66ba5e
        here you can set:
Ivan Mahonin 66ba5e
            time_forward, seconds      - draw path to the future for some seconds while path animation
Ivan Mahonin 66ba5e
            time_backward, seconds     - draw path to the past for some seconds while path animation
Ivan Mahonin 66ba5e
            time_speed, positive float - amplifier of animation speed (10 - is 10x time speed)
Ivan Mahonin 66ba5e
            move_tool, bool            - move or do not move the tool while animation
Ivan Mahonin 66ba5e
            rotate_model, bool         - rotate or do not rotate the model while animation
Ivan Mahonin 66ba5e
        
Ivan Mahonin 66ba5e
example files:
Ivan Mahonin 66ba5e
    models:
Ivan Mahonin 66ba5e
        input/example-pyramid.stl - simple shapes
Ivan Mahonin 66ba5e
        input/example-triangle.stl - single triangle
Ivan Mahonin 66ba5e
        input/example-tux-small.stl - Tux model
Ivan Mahonin 66ba5e
    gcode:
Ivan Mahonin 66ba5e
        output/example-tux-p1.tap - preprocessing of tux-small.stl for FlatTool(1.5)
Ivan Mahonin 66ba5e
        output/example-tux-p2.tap - optimized final processing of tux-small.stl for ConeTool(1.25, 10, 0.75)
Ivan Mahonin 66ba5e
        output/example-tux-p3.tap - final processing of tux-small.stl for ConeTool(1.25, 10, 0.75)
Ivan Mahonin 66ba5e