Document to Model
Use the model_generate_fromdocument template to turn a PDF containing dielines into a 3D asset.
When To Use
- convert existing PDFs containing dielines into 3D assets
- allows for marketing-grade quality of your products
Expected outcome: GLB outputs retrievable by asset_id after flow completion.
Inputs
- required input data type: base64 payload in JSON
- supported format:
application/pdf - optional: PDF contains only one page
Minimal input object:
{
"data": "data:application/pdf;base64,<base64-pdf>"
}
Parameters
| Name | Type | Default | Allowed values | Practical guidance |
|---|---|---|---|---|
quality | string | high | low, high, and ultra | Use ultra when visual fidelity matters. |
texture | boolean | true | true, false | Keep true for textured output in most cases. |
Parameter details are not yet available.
Minimal Runnable Payload
from pathlib import Path
from base64 import b64encode
def document_to_data_url(path: Path) -> str:
encoded = b64encode(path.read_bytes()).decode("ascii")
return f"data:application/pdf;base64,{encoded}"
payload = {
"template": "model_generate_fromdocument",
"parameters": {
"quality": "high",
"texture": True,
},
"inputs": [
{
"data": document_to_data_url(Path("document.pdf"))
}
]
}
Polling And Output Retrieval
- Create flow with
POST /flows. - Poll until
completed,failed, oraborted. - On
completed, list outputs and fetch byasset_id.
Use shared implementation from Template Helpers.
Common Failure Modes
- unsupported MIME type or malformed data URL
- attempting output retrieval before completion
Recovery:
- verify data URL format and MIME
- wait for completed state before download
See Troubleshooting for full error handling guidance.