Skip to main content

Tree Decoration

OCCT category icon with a stylized logo representation

Overview​

This tutorial demonstrates how to create a 3D printable Christmas tree ornament with a parametric star pattern design. The ornament features decorative openings that can be customized by adjusting the number of rays and vertical divisions. You'll learn how to use OCCT lofting operations, face subdivisions, and interactive GUI controls to create a design you can export for 3D printing.

How It Works​

Geometry Creation​

The ornament starts with a star wire created using createStarWire with customizable rays, outer radius (20mm), and inner radius (12mm). This star profile is then transformed into three variants:

  • Top section: Scaled down to 25% and translated up 30mm
  • Middle section: Scaled to 15% and positioned at 20mm height
  • Bottom section: Scaled to 30% and positioned at -5mm

Surface Construction​

The geometry is built using loft operations that smoothly transition between wire profiles:

  1. Upper loft: Blends from top → middle → base star using standard loft
  2. Lower loft: Creates the bottom section using loftAdvanced with a custom start vertex at (0, -10, 0) for controlled shape flow

Pattern Generation​

The middle section features decorative rectangular openings created by:

  1. Getting faces from the upper loft surface
  2. Using subdivideToRectangleHoles to create a pattern with:
    • Vertical divisions (controlled by slider, default 5)
    • Scale pattern [0.75, 0.5] for varied opening sizes
    • Inclusion pattern [true, false, true, true] for selective hole placement
    • 0.02mm offset from borders for clean geometry

The first face is reversed and sewn to form the bottom cap.

Final Assembly​

The separate surfaces are combined into a closed solid through:

  1. Face collection: Top cap, upper loft, lower loft, patterned surface, and bottom cap
  2. Sewing: sewFaces joins all surfaces with 1e-7 tolerance
  3. Solidification: fromClosedShell converts the sewn shell into a manifold solid
  4. Scaling: Final 0.5x reduction for printable size

Scene Setup​

The visualization includes:

  • Arc rotate camera positioned at (30, 25, 0) looking at (0, 4, 0)
  • City skybox environment with fog for depth
  • Two directional lights (white and blue) for attractive rendering
  • PBR metallic material with blue tones (#94c2ff base, #3b77b0 emissive) and 0.8 metallic/0.29 roughness values

Interactive Controls​

The GUI provides real-time adjustments:

  • Number of Rays slider (3-12): Controls star complexity
  • Vertical Divisions slider (1-25): Adjusts pattern density
  • Export buttons: Download as STEP or STL for 3D printing
  • Sign Up and Source Code buttons for community features

All controls use observable listeners to trigger geometry regeneration when values change.

Bitbybit Platform

Christmas tree ornament

Rete