1.0.13 • Published 8 months ago

@autoquote3d/3d-thumbnail-renderer v1.0.13

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

@autoquote3d/3d-thumbnail-renderer

A React hook for generating thumbnails from 3D model files (STL and OBJ).

Installation

npm install @autoquote3d/3d-thumbnail-renderer

Usage

import { useModelThumbnail } from "@autoquote3d/3d-thumbnail-renderer";

function ModelPreview() {
  const file = new File();
  const { data, loading, error, progress } = useModelThumbnail({
    url: URL.createObjectURL(file), // or some other valid url
    fileType: "stl",
    color: "#808080", // optional, defaults to gray
  });

  if (loading) {
    return <div>Loading... {progress}%</div>;
  }

  if (error) {
    return <div>Error: {error}</div>;
  }

  return <img src={data} alt="3D Model Thumbnail" />;
}

Props

  • url: URL or path to the 3D model file
  • fileType: Type of the 3D model file ('stl' or 'obj')
  • color: (Optional) Color of the model in hex format. Defaults to '#808080'

Return Values

  • data: Base64 encoded image data URL when complete
  • loading: Boolean indicating if the thumbnail is being generated
  • error: Error message if something goes wrong
  • progress: Number indicating the download progress percentage

License

MIT

1.0.13

8 months ago

1.0.12

8 months ago

1.0.11

8 months ago

1.0.10

8 months ago

1.0.9

8 months ago

1.0.8

8 months ago

1.0.7

8 months ago

1.0.6

8 months ago

1.0.5

8 months ago

1.0.4

8 months ago

1.0.3

8 months ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago

2.4.1

8 months ago