API การพิมพ์หลายสี

แปลงโมเดล 3 มิติเป็นรูปแบบ 3MF หลายสีสำหรับการพิมพ์ 3 มิติ พร้อมจานสีที่กำหนดค่าได้สูงสุด 16 สี


POST/openapi/v1/print/multi-color

สร้างงานพิมพ์ 3D หลายสี

เอนด์พอยต์นี้สร้างงานพิมพ์ 3D หลายสีใหม่ งานนี้จะแปลงโมเดล 3D เป็นไฟล์ 3MF หลายสีที่เหมาะสำหรับการพิมพ์ 3 มิติ

พารามิเตอร์

  • Name
    model_url
    Type
    string
    จำเป็น
    Description

    URL ที่เข้าถึงได้แบบสาธารณะหรือ Data URI ของโมเดล 3D ปัจจุบันเรารองรับรูปแบบ .glb และ .fbx

  • Name
    max_colors
    Type
    integer
    ค่าเริ่มต้น 4
    Description

    จำนวนสีสูงสุดในพาเลตเอาต์พุต

    ช่วงที่ใช้ได้: 1 ถึง 16

  • Name
    max_depth
    Type
    integer
    ค่าเริ่มต้น 4
    Description

    ความลึกของ Quadtree สำหรับความแม่นยำของสี ค่าที่สูงขึ้นจะสร้างขอบเขตสีที่ละเอียดขึ้น แต่จะเพิ่มขนาดไฟล์

    ช่วงที่ใช้ได้: 3 ถึง 6

ค่าที่ส่งคืน

พร็อพเพอร์ตี result ของการตอบกลับประกอบด้วย id ของงานพิมพ์ 3D ที่สร้างขึ้นใหม่

โหมดความล้มเหลว

  • Name
    400 - Bad Request
    Description

    คำขอไม่สามารถยอมรับได้ สาเหตุที่พบบ่อย:

    • พารามิเตอร์ขาดหาย: ต้องระบุ model_url หรือ input_task_id
    • รูปแบบโมเดลไม่ถูกต้อง: model_url ชี้ไปยังไฟล์ที่มีนามสกุลที่ไม่รองรับ (รองรับเฉพาะ .glb และ .fbx)
    • URL ไม่สามารถเข้าถึงได้: ไม่สามารถดาวน์โหลด model_url ได้
    • งานอินพุตไม่ถูกต้อง: input_task_id ต้องอ้างอิงถึงงานที่สำเร็จ
    • max_colors ไม่ถูกต้อง: ค่าต้องอยู่ระหว่าง 1 ถึง 16
    • max_depth ไม่ถูกต้อง: ค่าต้องอยู่ระหว่าง 3 ถึง 6
  • Name
    401 - Unauthorized
    Description

    การยืนยันตัวตนล้มเหลว โปรดตรวจสอบ API คีย์ของคุณ

  • Name
    402 - Payment Required
    Description

    เครดิตไม่เพียงพอสำหรับการทำงานนี้

  • Name
    429 - Too Many Requests
    Description

    คุณใช้เกินการจำกัดอัตราของคุณแล้ว

Request

POST
/openapi/v1/print/multi-color
# Convert a 3D model to multi-color 3MF for printing
curl https://api.meshy.ai/openapi/v1/print/multi-color \
-X POST \
-H "Authorization: Bearer ${YOUR_API_KEY}" \
-H 'Content-Type: application/json' \
-d '{
    "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578",
    "max_colors": 8,
    "max_depth": 5
  }'

Response

{
  "result": "0193bfc5-ee4f-73f8-8525-44b398884ce9"
}

GET/openapi/v1/print/multi-color/:id

ดึงข้อมูลงานพิมพ์ 3D หลายสี

เอนด์พอยต์นี้ดึงข้อมูลงานพิมพ์ 3D หลายสีตาม ID ของงาน

พารามิเตอร์

  • Name
    id
    Type
    path
    Description

    ID ของงานพิมพ์ 3D ที่ต้องการดึงข้อมูล

ค่าที่ส่งคืน

ออบเจ็กต์งานพิมพ์ 3D

Request

GET
/openapi/v1/print/multi-color/a43b5c6d-7e8f-901a-234b-567c890d1e2f
curl https://api.meshy.ai/openapi/v1/print/multi-color/a43b5c6d-7e8f-901a-234b-567c890d1e2f \
-H "Authorization: Bearer ${YOUR_API_KEY}"

Response

{
  "id": "0193bfc5-ee4f-73f8-8525-44b398884ce9",
  "type": "print-multi-color",
  "model_urls": {
      "3mf": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.3mf?Expires=***"
},
  "progress": 100,
  "status": "SUCCEEDED",
  "created_at": 1699999999000,
  "started_at": 1700000000000,
  "finished_at": 1700000001000,
  "task_error": null,
"consumed_credits": 10
}

DELETE/openapi/v1/print/multi-color/:id

ลบงานพิมพ์ 3D หลายสี

เอนด์พอยต์นี้จะลบงานพิมพ์ 3D หลายสีอย่างถาวร รวมถึงโมเดลและข้อมูลที่เกี่ยวข้องทั้งหมด การดำเนินการนี้ไม่สามารถย้อนกลับได้

พารามิเตอร์เส้นทาง

  • Name
    id
    Type
    path
    Description

    ID ของงานพิมพ์ 3D หลายสีที่จะลบ

ค่าที่ส่งคืน

ส่งคืน 200 OK เมื่อสำเร็จ

Request

DELETE
/openapi/v1/print/multi-color/a43b5c6d-7e8f-901a-234b-567c890d1e2f
curl --request DELETE \
  --url https://api.meshy.ai/openapi/v1/print/multi-color/a43b5c6d-7e8f-901a-234b-567c890d1e2f \
  -H "Authorization: Bearer ${YOUR_API_KEY}"

Response

// Returns 200 Ok on success.

GET/openapi/v1/print/multi-color

แสดงรายการงานพิมพ์ 3D หลายสี

เอนด์พอยต์นี้ช่วยให้คุณดึงรายการงานพิมพ์ 3D หลายสีได้

พารามิเตอร์

แอตทริบิวต์ที่ไม่บังคับ

  • Name
    page_num
    Type
    integer
    Description

    หมายเลขหน้าสำหรับการแบ่งหน้า เริ่มต้นและมีค่าเริ่มต้นเป็น 1

  • Name
    page_size
    Type
    integer
    Description

    ขีดจำกัดขนาดหน้า ค่าเริ่มต้นคือ 10 รายการ จำนวนสูงสุดที่อนุญาตคือ 50 รายการ

  • Name
    sort_by
    Type
    string
    Description

    ฟิลด์ที่ใช้จัดเรียง ค่าที่ใช้ได้:

    • +created_at: จัดเรียงตามเวลาที่สร้างในลำดับจากน้อยไปมาก
    • -created_at: จัดเรียงตามเวลาที่สร้างในลำดับจากมากไปน้อย

ส่งคืน

ส่งคืนรายการแบบแบ่งหน้าของ อ็อบเจ็กต์งานพิมพ์ 3D

Request

GET
/openapi/v1/print/multi-color
curl https://api.meshy.ai/openapi/v1/print/multi-color?page_size=10 \
-H "Authorization: Bearer ${YOUR_API_KEY}"

Response

[
  {
    "id": "0193bfc5-ee4f-73f8-8525-44b398884ce9",
    "type": "print-multi-color",
    "model_urls": {
      "3mf": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.3mf?Expires=***"
    },
    "progress": 100,
    "status": "SUCCEEDED",
    "preceding_tasks": 0,
    "created_at": 1699999999000,
    "started_at": 1700000000000,
    "finished_at": 1700000001000,
    "task_error": null,
  "consumed_credits": 10
  }
]

GET/openapi/v1/print/multi-color/:id/stream

สตรีมงานพิมพ์ 3D หลายสี

เอนด์พอยต์นี้สตรีมการอัปเดตแบบเรียลไทม์สำหรับงานพิมพ์ 3D หลายสีโดยใช้ Server-Sent Events (SSE)

พารามิเตอร์

  • Name
    id
    Type
    path
    Description

    ตัวระบุที่ไม่ซ้ำกันสำหรับงานพิมพ์ 3D หลายสีที่จะสตรีม

การส่งคืน

ส่งคืนสตรีมของ ออบเจ็กต์งานพิมพ์ 3D เป็น Server-Sent Events

สำหรับงาน PENDING หรือ IN_PROGRESS สตรีมการตอบกลับจะมีเฉพาะฟิลด์ progress และ status ที่จำเป็นเท่านั้น

Request

GET
/openapi/v1/print/multi-color/a43b5c6d-7e8f-901a-234b-567c890d1e2f/stream
curl -N https://api.meshy.ai/openapi/v1/print/multi-color/a43b5c6d-7e8f-901a-234b-567c890d1e2f/stream \
-H "Authorization: Bearer ${YOUR_API_KEY}"

Response Stream

// Error event example
event: error
data: {
  "status_code": 404,
  "message": "Task not found"
}

// Message event examples illustrate task progress.
// For PENDING or IN_PROGRESS tasks, the response stream will not include all fields.
event: message
data: {
  "id": "a43b5c6d-7e8f-901a-234b-567c890d1e2f",
  "progress": 0,
  "status": "PENDING"
}

event: message
data: {
  "id": "a43b5c6d-7e8f-901a-234b-567c890d1e2f",
  "type": "print-multi-color",
  "model_urls": {
    "3mf": "https://assets.meshy.ai/***/tasks/a43b5c6d-7e8f-901a-234b-567c890d1e2f/output/model.3mf?Expires=***"
  },
  "progress": 100,
  "status": "SUCCEEDED",
  "preceding_tasks": 0,
  "created_at": 1699999999000,
  "started_at": 1700000000000,
  "finished_at": 1700000001000,
  "task_error": null,
"consumed_credits": 10
}

ออบเจ็กต์งานพิมพ์ 3D

  • Name
    id
    Type
    string
    Description

    ตัวระบุที่ไม่ซ้ำสำหรับงาน แม้ว่าเราจะใช้ UUID แบบ k-sortable สำหรับ id ของงานเป็น รายละเอียดการใช้งานภายใน คุณ ไม่ควร ตั้งสมมติฐานใด ๆ เกี่ยวกับรูปแบบของ id

  • Name
    type
    Type
    string
    Description

    ประเภทของงานพิมพ์ 3D ค่าคือ print-multi-color

  • Name
    model_urls
    Type
    object
    Description

    URL ที่ดาวน์โหลดได้ไปยังไฟล์โมเดล 3D ที่สร้างโดย Meshy พร็อพเพอร์ตี้สำหรับรูปแบบหนึ่งจะถูกละไว้หากรูปแบบนั้นไม่ได้ถูกสร้าง แทนที่จะส่งคืนสตริงว่าง

    • Name
      3mf
      Type
      string
      Description

      URL ที่ดาวน์โหลดได้ไปยังไฟล์ 3MF หลายสี

  • Name
    progress
    Type
    integer
    Description

    progress ของงาน หากงานยังไม่เริ่ม พร็อพเพอร์ตี้นี้จะเป็น 0 เมื่องานสำเร็จแล้ว ค่านี้จะกลายเป็น 100

  • Name
    status
    Type
    string
    Description

    สถานะของงาน ค่าที่เป็นไปได้คือหนึ่งใน PENDING, IN_PROGRESS, SUCCEEDED, FAILED

  • Name
    preceding_tasks
    Type
    integer
    Description

    จำนวนงานก่อนหน้า

  • Name
    created_at
    Type
    timestamp
    Description

    ไทม์สแตมป์ของเวลาที่สร้างงาน หน่วยเป็นมิลลิวินาที

  • Name
    started_at
    Type
    timestamp
    Description

    ไทม์สแตมป์ของเวลาที่งานเริ่มต้น หน่วยเป็นมิลลิวินาที หากงานยังไม่เริ่ม พร็อพเพอร์ตี้นี้จะเป็น 0

  • Name
    finished_at
    Type
    timestamp
    Description

    ไทม์สแตมป์ของเวลาที่งานเสร็จสิ้น หน่วยเป็นมิลลิวินาที หากงานยังไม่เสร็จสิ้น พร็อพเพอร์ตี้นี้จะเป็น 0

  • Name
    task_error
    Type
    object
    Description

    รายละเอียดข้อผิดพลาดสำหรับงานที่ล้มเหลว ดูข้อมูลอ้างอิงออบเจ็กต์ task_error แบบเต็มได้ที่ ข้อผิดพลาด

  • Name
    consumed_credits
    Type
    integer
    Description

    จำนวนเครดิตที่งานนี้ใช้ มีอยู่เมื่อสถานะงานเป็น PENDING, IN_PROGRESS หรือ SUCCEEDED ส่งคืน 0 สำหรับงาน FAILED (เครดิตจะถูกคืนเมื่อเกิดความล้มเหลว)

The 3D Print Task Object

{
  "id": "0193bfc5-ee4f-73f8-8525-44b398884ce9",
  "type": "print-multi-color",
  "model_urls": {
      "3mf": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.3mf?Expires=***"
},
  "progress": 100,
  "status": "SUCCEEDED",
  "preceding_tasks": 0,
  "created_at": 1699999999000,
  "started_at": 1700000000000,
  "finished_at": 1700000001000,
  "task_error": null,
"consumed_credits": 10
}