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

NameTypeDefaultAllowed valuesPractical guidance
qualitystringhighlow, high, and ultraUse ultra when visual fidelity matters.
texturebooleantruetrue, falseKeep 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

  1. Create flow with POST /flows.
  2. Poll until completed, failed, or aborted.
  3. On completed, list outputs and fetch by asset_id.

Use shared implementation from Template Helpers.

Common Failure Modes

  • unsupported MIME type or malformed data URL
  • attempting output retrieval before completion

Recovery:

  1. verify data URL format and MIME
  2. wait for completed state before download

See Troubleshooting for full error handling guidance.