# Matching KiriMoto App settings to API

**URL:** <https://forum.grid.space/t/matching-kirimoto-app-settings-to-api/2580>\
**Category:** Uncategorized\
**Created:** [June 18, 2025, 6:34pm UTC](https://forum.grid.space/t/matching-kirimoto-app-settings-to-api/2580 "2025-06-18T18:34:53Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bar](https://forum.grid.space/letter_avatar_proxy/v4/letter/b/b77776/32.png) [@Bar](https://forum.grid.space/u/Bar)\
**Post date:** [June 18, 2025, 6:34pm UTC](https://forum.grid.space/t/matching-kirimoto-app-settings-to-api/2580/1 "2025-06-18T18:34:53Z")

</div>

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

 ![image](https://forum.grid.space/uploads/default/original/2X/b/b7517f17f1cdb715400df9fd1006c6aa276df116.jpeg)

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 😁

 ![image](https://forum.grid.space/uploads/default/original/2X/4/4fdd0ed5ad78671bc782f6a959e2268f12e0e4b2.jpeg)

I have my process set up like:

```auto
      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:

```auto
        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!

---

<div class="post-metadata">

**Author:** ![Bar](https://forum.grid.space/letter_avatar_proxy/v4/letter/b/b77776/32.png) [@Bar](https://forum.grid.space/u/Bar)\
**Post date:** [June 18, 2025, 6:43pm UTC](https://forum.grid.space/t/matching-kirimoto-app-settings-to-api/2580/2 "2025-06-18T18:43:02Z")

</div>

[Pocket-Gcode-Test.stl](https://forum.grid.space/uploads/short-url/mcqGDBJnpedf1HSwrAbiexOY454.stl) (6.9 KB)

Here is my .stl file if that helps

---

<div class="post-metadata">

**Author:** ![Bar](https://forum.grid.space/letter_avatar_proxy/v4/letter/b/b77776/32.png) [@Bar](https://forum.grid.space/u/Bar)\
**Post date:** [June 23, 2025, 4:51pm UTC](https://forum.grid.space/t/matching-kirimoto-app-settings-to-api/2580/3 "2025-06-23T16:51:54Z")

</div>

Bumping this for visibility 😁

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

Thanks!

---

<div class="post-metadata">

**Author:** ![stewart](https://forum.grid.space/user_avatar/forum.grid.space/stewart/32/21_2.png) [@stewart](https://forum.grid.space/u/stewart)\
**Post date:** [June 23, 2025, 6:26pm UTC](https://forum.grid.space/t/matching-kirimoto-app-settings-to-api/2580/4 "2025-06-23T18:26:56Z")

</div>

haven’t forgotten about this. will review tonight.

---

<div class="post-metadata">

**Author:** ![Bar](https://forum.grid.space/letter_avatar_proxy/v4/letter/b/b77776/32.png) [@Bar](https://forum.grid.space/u/Bar)\
**Post date:** [June 23, 2025, 6:37pm UTC](https://forum.grid.space/t/matching-kirimoto-app-settings-to-api/2580/5 "2025-06-23T18:37:54Z")

</div>

Thank you, I appreciate it 😀

---

<div class="post-metadata">

**Author:** ![stewart](https://forum.grid.space/user_avatar/forum.grid.space/stewart/32/21_2.png) [@stewart](https://forum.grid.space/u/stewart)\
**Post date:** [June 24, 2025, 3:03am UTC](https://forum.grid.space/t/matching-kirimoto-app-settings-to-api/2580/6 "2025-06-24T03:03:16Z")

</div>

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

```auto
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);

```

---

<div class="post-metadata">

**Author:** ![Bar](https://forum.grid.space/letter_avatar_proxy/v4/letter/b/b77776/32.png) [@Bar](https://forum.grid.space/u/Bar)\
**Post date:** [June 24, 2025, 5:56pm UTC](https://forum.grid.space/t/matching-kirimoto-app-settings-to-api/2580/7 "2025-06-24T17:56:30Z")

</div>

You can check out our entire engine setup [here](https://github.com/BarbourSmith/Abundance/blob/main/src/components/secondary/Kirimoto.js) 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:

> **[GitHub - BarbourSmith/Kiri-Minimal-Example](https://github.com/BarbourSmith/Kiri-Minimal-Example)**
>
> Contribute to BarbourSmith/Kiri-Minimal-Example development by creating an account on GitHub.

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

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

 ![image](https://forum.grid.space/uploads/default/original/2X/7/73e0081edb7c50d41d9adb8ba0b2d5630bded48e.png)

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

---

<div class="post-metadata">

**Author:** ![stewart](https://forum.grid.space/user_avatar/forum.grid.space/stewart/32/21_2.png) [@stewart](https://forum.grid.space/u/stewart)\
**Post date:** [June 24, 2025, 6:01pm UTC](https://forum.grid.space/t/matching-kirimoto-app-settings-to-api/2580/8 "2025-06-24T18:01:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Bar](https://forum.grid.space/letter_avatar_proxy/v4/letter/b/b77776/32.png) [@Bar](https://forum.grid.space/u/Bar)\
**Post date:** [June 24, 2025, 7:58pm UTC](https://forum.grid.space/t/matching-kirimoto-app-settings-to-api/2580/9 "2025-06-24T19:58:31Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Bar](https://forum.grid.space/letter_avatar_proxy/v4/letter/b/b77776/32.png) [@Bar](https://forum.grid.space/u/Bar)\
**Post date:** [October 30, 2025, 5:17am UTC](https://forum.grid.space/t/matching-kirimoto-app-settings-to-api/2580/10 "2025-10-30T05:17:24Z")

</div>

I’m circling back to this and I’ve almost got it figured out. The goal is the same, basically I’d like to use an outline and a roughing operation to cut out the pocket in the center here first, and then cut around the edge.

 ![image](https://forum.grid.space/uploads/default/original/2X/e/ed64f0e3074e9e38c7620aac3c96ae63285c3946.jpeg)

The outline operation works phenomenally, no issues there, but I’m struggling with the roughing operation.

It does the pocket OK, but the issue is that it really wants to surface the whole top of the part which isn’t what I’m looking for.

 ![image](https://forum.grid.space/uploads/default/original/2X/f/f4ee493f008ad133694fef8d165323d7f87d2a8f.png)

Any ideas where I’m going wrong?

This is what my setup looks like now:

`return eng.setProcess({`  
`camEaseAngle: 10,`  
`camEaseDown: true,`  
`camZAnchor: “bottom”,`  
`camDepthFirst: false,`  
`camZThru: 0,`  
`camZClearance: 3,`  
`camZTop: 1, //top of stock`  
`camStockOffset: true,`  
`camZBottom: -1000, //-zBottom, // temp hack to get around setTopZ bug`  
`camToolInit: true,`  
`camOutlineSpeed: speed,`  
`camRetractFeed: 300,`  
`camSpindleSpeed: speed,`  
`camFastFeed: 6000,`  
`camFastFeedZ: speed, // Match Z feed to speed to maintain feedrate during ramp down`  
`ops: [`  
`{`  
`type: “rough”,`  
`tool: 1000,`  
`spindle: 1000,`  
`down: down,`  
`step: 3,`  
`rate: speed,`  
`plunge: speed,`  
`leave: 0,`  
`leavez: 0,`  
`all: false,`  
`voids: true,`  
`flats: true,`  
`inside: true,`  
`omitthru: true,`  
`ov_topz: 0,`  
`ov_botz: 0,`  
`ov_conv: false,`  
`},`  
`{`  
`type: “outline”,`  
`tool: 1000,`  
`spindle: 1000,`  
`step: 0.4,`  
`steps: 1,`  
`down: down, // ` [CAM kirimoto API help - #22 by Bar](https://forum.grid.space/t/cam-kirimoto-api-help/2511/22)  
`rate: speed,`  
`plunge: speed, // Match plunge rate to XY feedrate for consistent speed during ramp down`  
`dogbones: false,`  
`omitvoid: false,`  
`omitthru: true,`  
`outside: false,`  
`inside: false,`  
`wide: false,`  
`top: false,`  
`ov_topz: 0,`  
`ov_botz: 0,`  
`ov_conv: true,`  
`},`  
`],`  
`});`  
`})`
