← 모든 튜토리얼 · Kerfwise

튜토리얼 7 / 21

API와 MCP로 Kerfwise 자동화하기

고급 15분

스크립트와 AI 에이전트에서 Kerfwise 엔진을 호출해 보세요. 캐비닛 빌더, 재단 목록, 판재 네스팅, CNC G-code를 JSON API와 MCP 도구로 제공하며, 실제 요청·응답 예시를 함께 보여 드려요.

작업 공간과 API는 같은 엔진 코드로 동작해요. 모든 usefulweb.site 호스트에서 네 가지 도구를 JSON API(POST /api/v1/tools/<id>/calculate), OpenAPI 문서, MCP 도구(POST /mcp, 도구 이름은 밑줄 사용)로 쓸 수 있어요.

도구 IDMCP 이름하는 일
kerfwise-cabinet-builderkerfwise_cabinet_builder파라미터 → 부품, 재단 치수, 드릴링 개수, 철물, 정면/측면 SVG, DXF, 프로젝트 JSON
kerfwise-cut-listkerfwise_cut_list캐비닛 또는 프로젝트 → 묶은 재단 목록, 밴딩, 철물, 자재별 판재, 비용 견적, CSV
kerfwise-sheet-nestingkerfwise_sheet_nesting부품(L자형, 모서리 따기, 부채꼴 포함) + 판재 + 톱날 두께 → 배치, 수율, 하한 + 차이, 자투리, 재단 길이, SVG + DXF
kerfwise-cnc-gcodekerfwise_cnc_gcode부품 + 구멍 + 판재 + 공구 → 네스팅된 판재, G-code(GRBL / LinuxCNC / Fanuc 방식), 공구 경로 SVG, DXF, 가공 시간

모든 길이는 밀리미터예요. 아래 예시는 실제 서버에서 실행한 것이고, 숫자는 응답에서 그대로 옮겼어요.

1. 판재에 부품 네스팅하기

POST /api/v1/tools/kerfwise-sheet-nesting/calculate
Content-Type: application/json

{"parts":[{"name":"Side","length":720,"width":559,"qty":4,"grain":true},
           {"name":"Shelf","length":562,"width":515,"qty":4,"grain":true}],
 "sheetLength":2800,"sheetWidth":2070,"kerf":4,"trim":10,
 "method":"guillotine","grainedMaterial":true,"sheetPrice":148}

응답(발췌):

{
  "summary": "8 of 8 parts fit on 1 sheet of 2800 × 2070 mm with 47.8 % yield (guillotine).",
  "result": {
    "method": "guillotine",
    "strategy": "guillotine BSSF/LLAS, sorted by area",
    "sheetCount": 1,
    "yieldPct": 47.8,
    "offcutAreaM2": 2.75,
    "cutLengthM": 22.2,
    "cost": 148,
    "sheets": [{
      "index": 1,
      "placements": [
        {"name": "Side", "label": "1.1", "x": 10, "y": 10, "w": 720, "h": 559, "rotated": false},
        {"name": "Side", "label": "1.2", "x": 734, "y": 10, "w": 720, "h": 559, "rotated": false}
      ],
      "offcuts": [{"x": 10, "y": 1136, "w": 2780, "h": 924}, {"x": 2432, "y": 573, "w": 358, "h": 519}]
    }]
  }
}

톱날 두께를 눈여겨보세요. 두 번째 측판은 x = 10 + 720 + 4 = 734에서 시작해요. 응답의 presentation 부분에는 판재별 SVG와 DXF 다운로드도 들어 있어요.

판재 한 장에 부품 16개, 수율 82.8퍼센트인 Kerfwise Sheet Nesting Optimizer 결과

2. 캐비닛 만들기

POST /api/v1/tools/kerfwise-cabinet-builder/calculate
Content-Type: application/json

{"type":"base","width":600,"height":870,"depth":560,"backType":"groove","grooveDepth":8,
 "plinthType":"legs","plinthHeight":150,"doorCount":1,"shelfCount":1,"topType":"rails"}
{
  "summary": "Base cabinet 600 × 870 × 560 mm: 9 parts, 47 hardware items, 2 hinges per door, side height 720 mm.",
  "result": {
    "dimensions": {"sideHeight": 720, "innerWidth": 564, "innerDepth": 536, "backSize": "710 × 580", "doorSize": "717 × 597", "hingesPerDoor": 2},
    "parts": [
      {"label": "A7", "name": "Back panel (grooved)", "L": 710, "W": 580, "T": 8, "cutL": 710, "cutW": 580, "material": "HDF 8 mm (backs, grooved)"}
    ],
    "totals": {"parts": 9, "holes": 112, "areaM2": 2.45, "bandingM": 6.4},
    "openInApp": "https://kerfwise.usefulweb.site/app#project=eyJmb3…"
  }
}

openInApp은 작업 공간에서 캐비닛을 열고, project에는 같은 프로젝트가 JSON으로 들어 있어요.

주요 치수와 부품 표가 있는 Kerfwise Cabinet Builder 결과

3. 여러 캐비닛의 재단 목록과 비용

POST /api/v1/tools/kerfwise-cut-list/calculate
Content-Type: application/json

{"cabinets":[{"type":"base","width":600,"doors":1,"shelves":1},
             {"type":"drawer","width":600,"drawers":3},
             {"type":"wall","width":800,"doors":2}],
 "currency":"EUR","labourRate":45}
{
  "summary": "Cut list: 44 parts in 19 cut-list rows on 4 sheets (yield 44.1 %), 26 m edge banding — estimated total 868.78 EUR.",
  "result": {
    "cost": {"materials": 499, "banding": 19.05, "hardware": 164.2, "labour": 186.53, "labourMinutes": 248.7, "subtotal": 868.78, "total": 868.78, "currency": "EUR"},
    "totals": {"cabinets": 3, "partRows": 19, "pieces": 44, "holes": 266, "sheets": 4, "sheetYieldPct": 44.1, "bandingM": 26}
  }
}

cabinets 표 대신 project에 프로젝트 전체를 문자열로 넘길 수도 있어요(.kerfwise.json 파일이며, 스키마는 Kerfwise 소개 페이지와 OpenAPI 문서에 공개돼 있어요). 프로젝트 안의 설정(톱날 두께, 가격, 인건비)이 폼 필드보다 우선해요.

4. MCP로 똑같이 하기

{"jsonrpc":"2.0","id":1,"method":"tools/call",
 "params":{"name":"kerfwise_sheet_nesting",
   "arguments":{"parts":[{"name":"Panel","length":600,"width":500,"qty":16}],
     "sheetLength":2800,"sheetWidth":2070,"kerf":4,"trim":10,"method":"guillotine","grainedMaterial":false}}}

응답 텍스트는 16 of 16 parts fit on 1 sheet of 2800 × 2070 mm with 82.8 % yield (guillotine).로 시작하고, structuredContent에는 API와 같은 result 객체가 들어 있어요.

5. 사람에게 프로젝트 넘기기

프로젝트 JSON을 만들고(프로젝트 스키마 참고) base64url로 인코딩한 다음 앱 URL 뒤에 붙이세요.

https://kerfwise.usefulweb.site/app#project=<base64url of the JSON>

프래그먼트는 서버로 전송되지 않아요. 앱이 이를 디코딩해 프로젝트를 열고 주소 표시줄에서 지워요.

사용해 볼 준비가 되셨나요?

Kerfwise 실행 →