Matching KiriMoto App settings to API

Within the excellent Kirimoto app I am able to use these settings to nicely clear the pocket in the top of this part:

But when I try to replicate that behavior using the Kiri engine API I’m getting some funky behavior where it want’s to cut the entire part out of existence :grin:

I have my process set up like:

      eng.setProcess({
        processName: "default",
        camLevelTool: 1000,
        camLevelSpindle: 1000,
        camLevelOver: 0.5,
        camLevelSpeed: 1000,
        camLevelDown: 0,
        camLevelStock: true,
        camRoughTool: 1000,
        camRoughSpindle: 1000,
        camRoughDown: z / passes,
        camRoughOver: 0.4,
        camRoughSpeed: speed,
        camRoughPlunge: 250,
        camRoughStock: 0,
        camRoughStockZ: 0,
        camRoughAll: false,
        camRoughVoid: true,
        camRoughFlat: false,
        camRoughTop: false,
        camRoughIn: false,
        camRoughOn: false,

And then my opp set up like this:

        ops: [
            {
              type: "rough",
              tool: 1000,
              spindle: 1000,
              step: 0.4,
              down: 3,
              rate: 1000,
              plunge: 250,
              leave: 0,
              leavez: 0,
              top: false,
              inside: true,
              voids: true,
              outside: false,
            },  

I’m sure that I’m doing something silly.

Thanks!

Pocket-Gcode-Test.stl (6.9 KB)

Here is my .stl file if that helps

Bumping this for visibility :grin:

Does anyone have any thoughts on how I could cut a pocket with the Kiri engine?

Thanks!

haven’t forgotten about this. will review tonight.

1 Like

Thank you, I appreciate it :grinning_face:

I spent quite a while on this tonight and found several bugs, changes in internal behavior that broke the engine api, and several omissions. I still haven’t cracked why roughing fails if an outline op doesn’t run before it (which is not a good prerequisite). I’ll need more time to work out all the issues at play. if you could drop your entire engine setup, it would be helpful. This is where I am with testing. It uses some updated apis that are not yet pushed to github.

setOrigin() is a new (required for now) call
setStock() needs a change to set some new internal vars
there is a hack to set the widget.track.top which should be derived from the model (but the UI sometimes overrides this)
camOriginCenter is being ignored because the internal code depends on the UI updating the origin
…and the list goes on

kiri.newEngine()
    .setListener(display_message)
    .load("/obj/pocket-test.stl")
    .then(eng => {
        eng.widget.track.top = 18;
        return eng;  
    })
    .then(eng => eng.setMode('CAM'))
    .then(eng => eng.setStock({
        x: 150,
        y: 150,
        z: 25,
    }))
    .then(eng => eng.setOrigin(-50, 50, 0))
    .then(eng => eng.setTools([{
        id: 1000,
        number: 1,
        type: "endmill",
        name: "end 1/8",
        metric: false,
        shaft_diam: 0.125,
        shaft_len:  1,
        flute_diam: 0.125,
        flute_len:  2,
        taper_tip: 0,
    }]))
    .then(eng => eng.setProcess({
        processName: "default",
        camLevelTool: 1000,
        camLevelSpindle: 1000,
        camLevelOver: 0.5,
        camLevelSpeed: 1000,
        camLevelDown: 0,
        camLevelStock: true,
        camRoughTool: 1000,
        camRoughSpindle: 1000,
        camRoughDown: 1,
        camRoughOver: 0.4,
        camRoughSpeed: 1000,
        camRoughPlunge: 250,
        camRoughStock: 0,
        camRoughStockZ: 0,
        camRoughAll: false,
        camRoughVoid: true,
        camRoughFlat: false,
        camRoughTop: false,
        camRoughIn: false,
        camRoughOn: false,
        camZBottom: 0,
        camZThru: 0,
        camOriginTop: true,
        camOriginCenter: false,
        camStockOffset: false,
        camStockIndexed: false,
        ops: [{
            "type": "outline",
            "tool": 1000,
            "spindle": 15000,
            "step": 0.4,
            "steps": 1,
            "down": 3.75,
            "rate": 2500,
            "plunge": 150,
            "dogbones": false,
            "omitvoid": false,
            "omitthru": false,
            "outside": false,
            "inside": false,
            "wide": false,
            "top": true,
            "ov_topz": 0,
            "ov_botz": 0,
            "ov_conv": false,
            "disabled": false
        },{
            "type": "rough",
            "tool": 1000,
            "spindle": 15000,
            "down": 3.75,
            "step": 0.5,
            "rate": 1000,
            "plunge": 150,
            "leave": 0,
            "leavez": 0,
            "all": false,
            "voids": false,
            "flats": false,
            "inside": false,
            "ov_topz": 0,
            "ov_botz": 0,
            "ov_conv": false,
            "disabled": false
        }]
    }))
    .then(eng => eng.setDevice({
        gcodePre: [ "M82", "M104 S220" ],
        gcodePost: [ "M107" ]
    }))
    .then(eng => eng.slice())
    .then(eng => eng.prepare())
    .then(eng => eng.export())
    .then(display_gcode);
3 Likes

You can check out our entire engine setup here but the whole project is quite involved so to save you from having to build and dig through the whole thing, I threw together a minimal example of using the engine to imbed in a web page here:

(I was soooo close to posting a link to local host there :joy:)

Launching that page will bring up a minimal interface which currently generates a profile cut around the outside of the shape.

The dream would be to be able to first cut the pocket in the middle of the shape.

1 Like

I have a fix for these issues that will go out with the next release. If you’re running from a clone of the repo, you can get the fixes now.

3 Likes

Excellent! We’re just importing it so I’ll have to wait for the next update, but there is no big rush on that.

Thank you so much for the work to get it fixed!

1 Like