@gui-chat-plugin/present3d
v0.0.3
Published
3D shape presentation plugin using ShapeScript for GUI Chat applications
Readme
@gui-chat-plugin/present3d
3D shape presentation plugin using ShapeScript for GUI Chat applications. Create interactive 3D visualizations with a powerful DSL.

Features
- Full ShapeScript language support (variables, expressions, control flow)
- Interactive 3D viewport with camera controls
- Wireframe and grid toggle
- CSG operations (union, difference, intersection)
- Built-in math and trigonometric functions
- Inline script editing
Installation
yarn add @gui-chat-plugin/present3dUsage
Vue Integration
// In src/tools/index.ts
import Present3DPlugin from "@gui-chat-plugin/present3d/vue";
const pluginList = [
// ... other plugins
Present3DPlugin,
];
// In src/main.ts
import "@gui-chat-plugin/present3d/style.css";Core-only Usage
import { executePresent3D, TOOL_DEFINITION } from "@gui-chat-plugin/present3d";
// Create a 3D visualization
const result = await executePresent3D(context, {
title: "Circular Pattern",
script: `
define count 12
for i in 1 to count {
define angle ((i / count) * 6.283)
cube {
position (cos(angle) * 3) 0 (sin(angle) * 3)
color (i / count) 0.5 (1 - i / count)
size 0.5
}
}
`,
});API
Present3DArgs
interface Present3DArgs {
title: string; // Title for the visualization
script: string; // ShapeScript code
}Present3DToolData
interface Present3DToolData {
script: string; // The ShapeScript source code
}ShapeScript Language
Primitives
cube,sphere,cylinder,cone,torus
Properties
position X Y Z- 3D positionrotation X Y Z- Rotation in half-turnssize X Y Z- Scalecolor R G B- RGB color (0-1)opacity- Transparency (0-1)
Variables & Expressions
define radius 2
define red (1 0 0)
sphere { size radius color red }Control Flow
for i in 1 to 5 {
cube { position (i * 2) 0 0 }
}
if condition {
sphere
} else {
cube
}CSG Operations
difference {
sphere { size 2 }
cube { size 1.5 }
}Built-in Functions
- Math:
round,floor,ceil,abs,sqrt,pow,min,max - Trig:
sin,cos,tan,asin,acos,atan,atan2
Development
# Install dependencies
yarn install
# Run demo
yarn dev
# Build
yarn build
# Lint
yarn lintTest Prompts
Try these prompts to test the plugin:
- "Create a 3D visualization of a simple house with a roof"
- "Show me a 3D spiral staircase"
- "Generate a 3D model of the solar system with planets orbiting the sun"
License
MIT
