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

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


POST/openapi/v1/print/multi-color

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

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

พารามิเตอร์

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

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

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

    จำนวนสีสูงสุดในพาเลตต์ที่ได้

    ช่วงที่ถูกต้อง: 1 ถึง 16

  • Name
    style
    Type
    string
    ค่าเริ่มต้น realistic
    Description

    สไตล์สีภาพของไฟล์ 3MF ที่สร้างขึ้น

    ค่าที่ใช้ได้:

    • realistic: ตัวอย่างสีจากเท็กซ์เจอร์ของโมเดลโดยตรงเพื่อรายละเอียดที่ละเอียดและสมจริง ผลิตไฟล์ที่ใหญ่ขึ้น
    • cartoon: ทำให้สีแบนลงในพื้นที่ที่สะอาดและสม่ำเสมอเพื่อรูปลักษณ์ที่มีสไตล์ ผลิตไฟล์ที่เล็กลง

ผลลัพธ์

คุณสมบัติ result ของการตอบกลับจะมี id ของงานพิมพ์ 3 มิติที่สร้างขึ้นใหม่

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

  • Name
    400 - Bad Request
    Description

    คำขอไม่เป็นที่ยอมรับ สาเหตุทั่วไป:

    • พารามิเตอร์ที่ขาดหาย: ต้องให้ model_url หรือ input_task_id
    • รูปแบบโมเดลไม่ถูกต้อง: model_url ชี้ไปที่ไฟล์ที่มีนามสกุลที่ไม่รองรับ (รองรับเฉพาะ .glb และ .fbx)
    • URL ไม่สามารถเข้าถึงได้: ไม่สามารถดาวน์โหลด model_url
    • งานนำเข้าไม่ถูกต้อง: input_task_id ต้องอ้างอิงถึงงานที่สำเร็จแล้ว
    • max_colors ไม่ถูกต้อง: ค่าต้องอยู่ระหว่าง 1 ถึง 16
    • สไตล์ไม่ถูกต้อง: ค่าต้องเป็น realistic หรือ cartoon
  • 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
  }'

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

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

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

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

  • Name
    id
    Type
    path
    Description

    ID ของงานพิมพ์ 3 มิติหลายสีที่ต้องการลบ

ผลลัพธ์ที่ได้

ส่งคืน 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
}

วัตถุงานพิมพ์ 3 มิติ

  • Name
    id
    Type
    string
    Description

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

  • Name
    type
    Type
    string
    Description

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

  • Name
    model_urls
    Type
    object
    Description

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

    • Name
      3mf
      Type
      string
      Description

      URL สำหรับดาวน์โหลดไฟล์ 3MF หลายสี

  • Name
    progress
    Type
    integer
    Description

    ความคืบหน้าของงาน หากงานยังไม่เริ่ม คุณสมบัตินี้จะเป็น 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
}