Auto Split API
將 3D 模型拆分為可分別列印的多個部件——可以自動拆分、依你指定的部件拆分,或依顏色區域拆分——並可選擇加入連接件;切割後留下的薄壁區域會始終獲得加固,以確保每個部件都能以實心方式列印。
Auto Split 目前僅支援未貼圖的模型。對於 Image to 3D 和 Multi-Image to 3D,請在產生輸入時將 should_texture 設為 false。帶貼圖的輸入將返回 400 錯誤並被拒絕。對貼圖模型的支援正在開發中。
建立 Auto Split 任務
此端點會建立一個新的 Auto Split 任務。該任務會將先前任務的模型切割成可獨立列印的部件,並回傳分割後的模型,其中每個部件在檔案中都是獨立的物件。
參數
- Name
- input_task_id
- Type
- string
- 必選
- Description
要分割其模型的成功任務的 ID。支援的任務類型:Image to 3D、Multi-Image to 3D、Text to 3D(預覽)、Remesh、Convert 和 Resize。該任務的狀態必須為
SUCCEEDED,且其模型必須由 Meshy 6 或 Meshy 7 產生(ai_model為meshy-6、meshy-7或latest)。不支援 low-poly 和 Smart Topology(meshy-t2)模型。
- Name
- mode
- Type
- string
- 預設值 auto
- Description
模型劃分為多個部件的方式。
可用值:
auto:由 Meshy 選擇切割方式。prompt將被忽略。by_parts:沿著你在prompt中指定的結構部件(例如頭部、手臂和軀幹)進行切割。by_color:沿著你在prompt中指定的顏色區域進行切割。要求輸入來自上傳圖片產生的結果(Image to 3D 或 Multi-Image to 3D);其他輸入將被拒絕並回傳400。
mode = by_parts or by_color- Name
- prompt
- Type
- string
- 必選
- Description
描述要分割成的部件,可使用任何語言。Meshy 會從中讀取 1 到 10 個部件名稱,因此請命名各個部件,而不是描述整個模型——例如
split into the figure and the base,或head, torso, left arm, right arm, legs。最多 600 個字元。有兩種失敗情形:一種是描述內容讀起來像是要求分割,但命名的部件少於兩個(例如split into individual parts),此時會被拒絕並回傳400,且不會扣除積分;另一種是 Meshy 完全無法解析描述內容,此時會回退到auto,任務仍會執行並計費,且回應中會帶有prompt_ignored: true。
- Name
- target_formats
- Type
- array
- 預設值 ["glb"]
- Description
匯出分割後模型所用的格式。在每種格式中,每個部件都是獨立的物件。系統一律會產生
glb並在model_urls中回傳;如需其他格式,請在此列出。可用值:
glb、obj、fbx、usdz、blend、3mf。3mf是為切片軟體編寫的:每個部件對應一個物件,各自佔用獨立的耗材槽位,因此 Bambu Studio 開啟該檔案時,各部件會顯示為可單獨上色、可單獨選取的部分(該壓縮包中帶有 Bambu Studio 專案設定;其他切片軟體則只讀取幾何體)。與 Meshy 的其他列印格式一樣,該格式以毫米為單位;由於此端點不接受目標尺寸,整個模型會被縮放,使其最長邊為 150 毫米——這與其他列印格式匯出所使用的上限相同,該上限經過選定,可適配所有主流的列印平台。當layout為"on_plate"時,該上限適用於整個排版後的列印板;當為assembled時,各部件保持源模型中的位置,需要你自行在切片軟體中排列。不支援
stl,因為該格式無法承載獨立的部件。
- Name
- layout
- Type
- string
- 預設值 assembled
- Description
各部件在每種輸出格式以及縮圖中的排列方式。
可用值:
assembled:各部件保持源模型中的位置。on_plate:各部件被平放並在列印板上展開排列,可直接用於切片——與網頁應用程式中 On Plate 檢視的排列方式相同。
在這兩種排版方式下,匯出的檔案中每個部件對應一個物件,且不含其他內容:切割後殘留的坍縮薄片或點狀碎片會在匯出前被移除,因此檔案中出現的每個物件都是可列印的。
- Name
- connectors
- Type
- boolean
- 預設值 false
- Description
在每個切割處新增榫卯連接件,使列印出的部件可以拼接在一起。
connectors = true- Name
- connector_type
- Type
- string
- 預設值 cube
- Description
每個切割面處連接件的形狀。
可用值:
cube、cylinder。
- Name
- connector_size
- Type
- number
- 預設值 0.5
- Description
連接件相對於切割面的尺寸。
有效範圍:
0.1到0.8。
- Name
- connector_height
- Type
- number
- 預設值 0.1
- Description
連接件相對於切割面向外延伸的距離。
有效範圍:
0.1到0.8。
回傳值
回應中的 result 屬性包含新建立的 Auto Split 任務的 id。
失敗情形
- Name
400 - Bad Request- Description
請求不可接受。常見原因:
- 缺少 prompt:當
mode為by_parts或by_color時,prompt為必填項。 - prompt 命名的部件少於兩個:
by_parts/by_color至少需要兩個命名的部件(例如head, torso, base);諸如split into individual parts之類的泛化指令將被拒絕。不會產生扣費。 - 不支援的輸入任務:
input_task_id必須指向一個由 Meshy 6 或 Meshy 7 產生的、類型受支援的成功任務。 - 帶紋理的輸入:輸入模型帶有紋理。目前僅支援不帶紋理的模型。
- 缺少參考圖片:
by_color要求輸入來自上傳圖片產生的結果。 - 不支援的格式:
target_formats中包含stl。 - 連接件參數超出範圍:
connector_size或connector_height超出0.1到0.8的範圍。
- 缺少 prompt:當
- Name
401 - Unauthorized- Description
身份驗證失敗。請檢查你的 API 金鑰。
- Name
402 - Payment Required- Description
積分不足,無法執行此任務。
- Name
404 - Not Found- Description
input_task_id不存在,或不屬於你的帳戶。
- Name
429 - Too Many Requests- Description
你已超出速率限制。
by_parts和by_color請求還共用一個 prompt 解析限制,即每個帳戶每分鐘 12 次請求。
- Name
503 - Service Unavailable- Description
基於 prompt 的分割(
by_parts和by_color)暫時無法使用。請稍後重試,或使用不受影響的mode: "auto"。不會產生扣費。
Request
# Simple request: let Meshy choose the cuts
curl https://api.meshy.ai/openapi/v1/print/split \
-X POST \
-H "Authorization: Bearer ${YOUR_API_KEY}" \
-H 'Content-Type: application/json' \
-d '{
"input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578"
}'
# Advanced request: name the parts, add connectors, export glb and obj
curl https://api.meshy.ai/openapi/v1/print/split \
-X POST \
-H "Authorization: Bearer ${YOUR_API_KEY}" \
-H 'Content-Type: application/json' \
-d '{
"input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578",
"mode": "by_parts",
"prompt": "split into the figure and the base",
"target_formats": ["glb", "obj"],
"layout": "on_plate",
"connectors": true,
"connector_type": "cylinder",
"connector_size": 0.4
}'
Response
{
"result": "0193bfc5-ee4f-73f8-8525-44b398884ce9"
}
取得 Auto Split 任務
此端點用於根據 ID 取得 Auto Split 任務。
參數
- Name
- id
- Type
- path
- Description
要取得的 Auto Split 任務的 ID。
回傳值
Auto Split 任務物件。
Request
curl https://api.meshy.ai/openapi/v1/print/split/a43b5c6d-7e8f-901a-234b-567c890d1e2f \
-H "Authorization: Bearer ${YOUR_API_KEY}"
Response
{
"id": "0193bfc5-ee4f-73f8-8525-44b398884ce9",
"type": "print-split",
"model_urls": {
"glb": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.glb?Expires=***",
"obj": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.obj?Expires=***"
},
"thumbnail_url": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/preview.png?Expires=***",
"part_count": 4,
"progress": 100,
"status": "SUCCEEDED",
"created_at": 1699999999000,
"started_at": 1700000000000,
"finished_at": 1700000082000,
"task_error": null,
"consumed_credits": 10
}
刪除一個 Auto Split 任務
此 endpoint 將永久刪除一個 Auto Split 任務,包括所有相關的模型和資料。此操作無法復原。
路徑參數
- Name
- id
- Type
- path
- Description
要刪除的 Auto Split 任務的 ID。
回傳值
成功時回傳 200 OK。
Request
curl --request DELETE \
--url https://api.meshy.ai/openapi/v1/print/split/a43b5c6d-7e8f-901a-234b-567c890d1e2f \
-H "Authorization: Bearer ${YOUR_API_KEY}"
Response
// Returns 200 Ok on success.
List Auto Split Tasks
此端點允許您檢索 Auto Split 任務列表。
參數
可選屬性
- Name
- page_num
- Type
- integer
- Description
用於分頁的頁碼。起始值和預設值均為
1。
- Name
- page_size
- Type
- integer
- Description
每頁數量限制。預設為
10項。最多允許100項;超出的值將被限制為100。
- Name
- sort_by
- Type
- string
- Description
用於排序的欄位。可用值:
+created_at:依建立時間升冪排序。-created_at:依建立時間降冪排序。
回傳值
回傳一個分頁的 Auto Split 任務物件 列表。
Request
curl https://api.meshy.ai/openapi/v1/print/split?page_size=10 \
-H "Authorization: Bearer ${YOUR_API_KEY}"
Response
[
{
"id": "0193bfc5-ee4f-73f8-8525-44b398884ce9",
"type": "print-split",
"model_urls": {
"glb": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.glb?Expires=***"
},
"thumbnail_url": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/preview.png?Expires=***",
"part_count": 4,
"progress": 100,
"status": "SUCCEEDED",
"preceding_tasks": 0,
"created_at": 1699999999000,
"started_at": 1700000000000,
"finished_at": 1700000082000,
"task_error": null,
"consumed_credits": 10
}
]
流式取得 Auto Split 任務
此端點使用 Server-Sent Events(SSE)以串流方式傳輸 Auto Split 任務的即時更新。
參數
- Name
- id
- Type
- path
- Description
要進行串流傳輸的 Auto Split 任務的唯一識別碼。
回傳值
以 Server-Sent Events 的形式回傳一個 Auto Split 任務物件 的串流。
每個 message 事件都會攜帶由 取得 Auto Split 任務 回傳的完整任務物件,包括 consumed_credits、時間戳記以及 prompt_ignored;當任務處於 PENDING 或 IN_PROGRESS 狀態時,帧與帧之間會變化的欄位是 progress、status、started_at 和 preceding_tasks,而 model_urls、thumbnail_url、part_count 和 parts 則會在任務到達 SUCCEEDED 狀態後才出現。error 事件僅攜帶 status_code 和 message,因此在讀取 status 之前,應先依據事件名稱進行分支處理。
Request
curl -N https://api.meshy.ai/openapi/v1/print/split/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 (other task fields omitted here for brevity;
// each frame is the full task object).
event: message
data: {
"id": "a43b5c6d-7e8f-901a-234b-567c890d1e2f",
"progress": 0,
"status": "PENDING"
}
event: message
data: {
"id": "a43b5c6d-7e8f-901a-234b-567c890d1e2f",
"type": "print-split",
"model_urls": {
"glb": "https://assets.meshy.ai/***/tasks/a43b5c6d-7e8f-901a-234b-567c890d1e2f/output/model.glb?Expires=***"
},
"thumbnail_url": "https://assets.meshy.ai/***/tasks/a43b5c6d-7e8f-901a-234b-567c890d1e2f/output/preview.png?Expires=***",
"part_count": 4,
"progress": 100,
"status": "SUCCEEDED",
"preceding_tasks": 0,
"created_at": 1699999999000,
"started_at": 1700000000000,
"finished_at": 1700000082000,
"task_error": null,
"consumed_credits": 10
}
Auto Split 任務物件
一個 Auto Split 任務僅包含以下屬性。其他任務物件中包含的生成提示詞欄位(name、object_prompt、texture_prompt 等)、單一 model_url,以及 texture_urls,在拆分任務中永遠不會被填入,也不會被回傳。隨著任務執行而填入的屬性(thumbnail_url、model_urls、時間戳)始終存在,在沒有值之前為空,因此這些鍵的集合在 PENDING 和 SUCCEEDED 之間不會發生變化。
- Name
- id
- Type
- string
- Description
任務的唯一識別碼。雖然我們在實作細節上使用 k-可排序的 UUID 作為任務 id,但你不應對 id 的格式做任何假設。
- Name
- type
- Type
- string
- Description
任務的類型。此值為
print-split。
- Name
- model_urls
- Type
- object
- Description
拆分模型的可下載 URL,每個請求的格式對應一個。檔案中每個部件都是一個獨立的物件。如果未請求某種格式,則對應該格式的屬性將被省略。
- Name
glb- Type
- string
- Description
GLB 格式拆分模型的可下載 URL。
- Name
obj- Type
- string
- Description
OBJ 格式拆分模型的可下載 URL。
- Name
fbx- Type
- string
- Description
FBX 格式拆分模型的可下載 URL。
- Name
usdz- Type
- string
- Description
USDZ 格式拆分模型的可下載 URL。
- Name
blend- Type
- string
- Description
Blender 格式拆分模型的可下載 URL。
- Name
3mf- Type
- string
- Description
3MF 格式拆分模型的可下載 URL:每個部件對應一個物件,每個物件都位於自己的耗材槽位上,單位為毫米,縮放比例使最長邊為 150 毫米,並附帶 Bambu Studio 專案設定。
- Name
- thumbnail_url
- Type
- string
- Description
拆分模型的渲染預覽圖的可下載 URL,其中每個部件以不同顏色顯示,按所請求的
layout排列。
- Name
- prompt_ignored
- Type
- boolean
- Description
當
by_parts或by_color請求中的prompt未指定任何部件名稱時為true,此時 Meshy 會自動拆分模型 —— 結果中的部件名稱由 Meshy 產生,而非由你指定。從PENDING狀態起就會出現該欄位。對於auto任務,以及在提示詞被遵循時,該欄位會被省略。
- Name
- part_count
- Type
- integer
- Description
拆分模型中可列印部件的數量 —— 每個匯出檔案中的物件對應一個部件。分割過程中無法轉換為可列印部件的坍塌碎片,會在匯出前從檔案中移除,不計入此數量。
- Name
- progress
- Type
- integer
- Description
任務的進度。如果任務尚未開始,此屬性將為
0。一旦任務成功完成,此值將變為100。
- Name
- status
- Type
- string
- Description
任務的狀態。可能的取值為
PENDING、IN_PROGRESS、SUCCEEDED、FAILED、CANCELED之一。
- Name
- preceding_tasks
- Type
- integer
- Description
前置任務的數量。
此欄位的值僅在任務狀態為
PENDING時才有意義。
- 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物件參考請參見 Errors。
- Name
- consumed_credits
- Type
- integer
- Description
此任務消耗的積分數量。此欄位始終存在:一旦任務被接受,其值為
10;對於FAILED任務,其值為0,因為失敗時費用會被退還。在任務仍處於PENDING狀態時刪除該任務,同樣會退還費用。
The Auto Split Task Object
{
"id": "0193bfc5-ee4f-73f8-8525-44b398884ce9",
"type": "print-split",
"model_urls": {
"glb": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.glb?Expires=***",
"obj": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.obj?Expires=***"
},
"thumbnail_url": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/preview.png?Expires=***",
"part_count": 4,
"progress": 100,
"status": "SUCCEEDED",
"preceding_tasks": 0,
"created_at": 1699999999000,
"started_at": 1700000000000,
"finished_at": 1700000082000,
"task_error": null,
"consumed_credits": 10
}