How to Add 3D Models to PowerPoint Presentations with OfficeCLI: A Complete Guide

OfficeCLI enables embedding GLB 3D models into PowerPoint slides using the --type 3dmodel flag with the add command, supporting rotation, positioning, and Morph transitions for animation across slides.

The iOfficeAI/OfficeCLI repository provides a command-line interface that treats PowerPoint presentations as hierarchical documents, allowing developers to programmatically insert and animate 3D models without manual Office interaction. By representing 3D assets as shapes with type 3dmodel, the tool leverages a built-in Three.js rendering engine to handle GLB files and PowerPoint's native Morph transitions. This guide explains how to add 3D models to PowerPoint presentations with OfficeCLI using path-based addressing and resident mode operations.

Prerequisites and Installation

OfficeCLI distributes as a single binary compatible with macOS, Linux, and Windows. Install the tool using the one-line installer referenced in the source repository.

curl -fsSL https://officecli.ai/install.sh | bash

According to the README.md at line 103, this installation provides the officecli binary required for all subsequent operations. No additional Microsoft Office installation is necessary for model insertion or preview generation.

Understanding the 3D Model Architecture

OfficeCLI implements 3D models as shapes embedded within the presentation's OOXML structure. Each model resides at a specific path such as /slide[2]/3dmodel[1], enabling direct manipulation without parsing raw XML.

Key architectural components include:

  • GLB Compatibility: Only GLB (GL Transmission Format Binary) files are supported, as enforced by the compatibility gate in skills/morph-ppt-3d/SKILL.md at line 28.
  • Three.js Rendering: The binary ships with an HTML/Three.js renderer that generates PNG screenshots or live HTML previews, described in README.md at line 59.
  • Path-Based Addressing: Elements are addressed using XPath-like syntax (e.g., /slide[1]/3dmodel[1]), documented in README.md at line 14.
  • Resident Mode: The deck remains in memory during modifications, requiring a single officecli close command to flush changes, improving performance for batch operations per README.md at line 41.

Step-by-Step Workflow

1. Create the Presentation Deck

Initialize a blank PowerPoint file using the create command. This establishes the document structure that subsequent commands will populate.

officecli create deck.pptx

For batch operations, keep the deck open in resident mode to avoid repeated disk I/O. Close the session explicitly with officecli close after completing all modifications.

2. Configure Slides for 3D Animation

Each slide that will contain or transition 3D models requires specific properties. The Morph transition animates model transformations between slides, but requires identical shape names across slides to pair elements correctly.

Add slides with the required background and transition properties:

officecli add deck.pptx / --type slide \
  --prop background=0A0A0A \
  --prop transition=morph

As documented in README.md at line 183, the morph transition value enables animation of 3D model rotations and positions across consecutive slides.

3. Insert the 3D Model

Use the add command with --type 3dmodel and specify the required properties. The following parameters control model placement and appearance:

Property Description Example
path Filesystem path to the .glb file models/sun.glb
name Shape identifier (must be unique per slide but identical across slides for Morph pairing) sun
x, y Position coordinates (supports cm, in, pt, px, or EMU units per README.md at line 70) 15cm, 0.5cm
width, height Frame dimensions 18cm, 18cm
rotx, roty, rotz Rotation angles in degrees (roty creates orbital rotation, rotx adds tilt) per SKILL.md at line 31 roty=50

Example command adding a model to slide 1:

officecli add deck.pptx '/slide[1]' --type 3dmodel \
  --prop path="models/sun.glb" \
  --prop name=sun \
  --prop x=15cm \
  --prop y=0.5cm \
  --prop width=18cm \
  --prop height=18cm \
  --prop rotx=10

Critical Constraints and Best Practices

Do not clone slides containing 3D models. According to skills/morph-ppt-3d/SKILL.md at line 91, cloning copies the underlying XML and creates duplicate name attributes, corrupting the presentation file structure. Instead, add each slide and 3D model fresh using separate add commands.

Maintain identical shape names across slides when using Morph transitions. The transition engine pairs shapes by their name property; mismatched names prevent interpolation animations.

Use consistent units for positioning. The CLI accepts centimeters (cm), inches (in), points (pt), pixels (px), or English Metric Units (EMU), but mixing units requires careful calculation to avoid layout shifts.

Complete Working Example

The following script creates an eight-slide presentation with an orbiting 3D sun model, mirroring the official demonstration in examples/ppt/3d-model.md:


# Create empty deck

officecli create deck.pptx

# Add eight slides with dark background and Morph transition

for i in $(seq 1 8); do
  officecli add deck.pptx / --type slide \
    --prop background=0A0A0A \
    --prop transition=morph
done

# Slide 1: Initial position

officecli add deck.pptx '/slide[1]' --type 3dmodel \
  --prop path="models/sun.glb" \
  --prop name=sun \
  --prop x=15cm --prop y=0.5cm \
  --prop width=18cm --prop height=18cm \
  --prop rotx=10

# Slide 2: Orbital rotation

officecli add deck.pptx '/slide[2]' --type 3dmodel \
  --prop path="models/sun.glb" \
  --prop name=sun \
  --prop x=0.5cm --prop y=0.5cm \
  --prop width=16cm --prop height=16cm \
  --prop roty=50

# Continue for slides 3-8 with varying rotations and positions

# ...

# Finalize

officecli close deck.pptx

Previewing and Verifying 3D Models

Verify model placement and properties using the get command with JSON output:

officecli get deck.pptx "/slide[1]/3dmodel[1]" --json

Preview the presentation in a browser without Microsoft Office installed using the built-in watch server:

officecli watch deck.pptx

This command opens http://localhost:26315 with auto-refresh capabilities, utilizing the HTML/Three.js rendering engine to display the 3D models exactly as they appear in the final presentation.

Summary

  • Installation: OfficeCLI installs as a single binary supporting GLB 3D model insertion via CLI commands.
  • Model Insertion: Use officecli add ... --type 3dmodel with properties for path, name, position, and rotation.
  • Animation: Enable Morph transitions by setting --prop transition=morph and maintaining identical shape names across slides.
  • Constraints: Never clone slides with 3D models; always add models fresh to avoid XML corruption.
  • Verification: Use officecli get for property inspection and officecli watch for live HTML previews.

Frequently Asked Questions

What 3D file formats does OfficeCLI support?

OfficeCLI supports only GLB (GL Transmission Format Binary) files for 3D model insertion. As specified in skills/morph-ppt-3d/SKILL.md at line 28, the compatibility gate explicitly restricts input to this format, rejecting other common formats like OBJ or FBX.

Why must 3D model names be identical across slides?

The Morph transition pairs shapes between consecutive slides using their name property to determine interpolation targets. According to README.md at line 183, mismatched names prevent the transition engine from recognizing the models as the same object, breaking animation continuity. The name serves as a unique identifier within its slide but must repeat across slides for the effect to function.

Can I duplicate slides containing 3D models?

No. Cloning a slide that contains a 3D model copies the underlying OOXML and creates duplicate name attributes within the presentation structure. As warned in skills/morph-ppt-3d/SKILL.md at line 91, this duplication corrupts the file. You must add each slide and 3D model separately using distinct officecli add commands.

How do I preview 3D models without Microsoft Office installed?

OfficeCLI includes a built-in HTML/Three.js rendering engine that generates live previews. Run officecli watch deck.pptx to start a local server on port 26315, or use officecli view deck.pptx html to generate static HTML files. This capability, described in README.md at line 59, allows AI agents and developers to verify 3D placement and animations without installing Microsoft PowerPoint.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →