add_primitive
Add 3D primitive objects like cubes, spheres, and cylinders to Cinema 4D scenes with customizable names, positions, and dimensions for scene construction.
Instructions
Add a primitive object to the Cinema 4D scene.
Args:
primitive_type: Type of primitive (cube, sphere, cone, cylinder, plane, etc.)
name: Optional name for the new object
position: Optional [x, y, z] position
size: Optional [x, y, z] size or dimensionsInput Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| primitive_type | Yes | ||
| name | No | ||
| position | No | ||
| size | No |
Implementation Reference
- src/cinema4d_mcp/server.py:447-483 (handler)The `add_primitive` handler function in `src/cinema4d_mcp/server.py` implements the tool by preparing a command object and sending it to Cinema 4D via a connection context.
async def add_primitive( primitive_type: str, name: Optional[str] = None, position: Optional[List[float]] = None, size: Optional[List[float]] = None, ctx: Context = None, ) -> str: """ Add a primitive object to the Cinema 4D scene. Args: primitive_type: Type of primitive (cube, sphere, cone, cylinder, plane, etc.) name: Optional name for the new object position: Optional [x, y, z] position size: Optional [x, y, z] size or dimensions """ async with c4d_connection_context() as connection: if not connection.connected: return "❌ Not connected to Cinema 4D" # Prepare command command = { "command": "add_primitive", "type": primitive_type, } if name: command["object_name"] = name if position: command["position"] = position if size: command["size"] = size # Send command to Cinema 4D response = send_to_c4d(connection, command) return format_c4d_response(response, "add_primitive")