Skip to content

Demo App Phase 3: Polish, Examples & Export #28

@gsdali

Description

@gsdali

Overview

Polish the demo app with syntax highlighting, examples, and export.

Parent issue: #25
Depends on: #26, #27

Goals

  • Add syntax highlighting to code editor
  • Create example library with presets
  • Add properties panel (volume, area, faces)
  • Implement save/load scripts
  • Add export functionality (STEP, STL)

Features

Syntax Highlighting

struct SyntaxHighlighter {
    // Keywords: Workplane, result, true, false
    // Methods: .box, .cylinder, .fillet, .union
    // Numbers: 10, 3.14, -5
    // Strings: "XY", ">Z"
    // Comments: // comment
}

Example Library

Example Description Concepts
Basic Box Simple box with fillet Primitives, fillet
Mounting Bracket L-bracket with holes Workplanes, holes, fillet
Pipe Fitting Hollow cylinder Boolean cut
Gear Extruded polygon Polygon, extrude
Enclosure Box with shell Shell, fillet

Properties Panel

Display for current model:

  • Volume (mm³)
  • Surface area (mm²)
  • Center of mass
  • Bounding box dimensions
  • Face count
  • Edge count
  • Vertex count

Export Options

  • STEP file (CAD interchange)
  • STL file (3D printing)
  • Copy JavaScript code

UI Enhancements

┌─────────────────────────────────────────────────────────────┐
│  OCCTSwift Playground            [Examples ▼] [Export] [▶]  │
├─────────────────────┬───────────────────────────────────────┤
│  // Syntax colored  │     ┌─────────────────────┐           │
│  result = Workplane │     │                     │           │
│    .box(10, 20, 5)  │     │   [3D Viewport]     │           │
│    .fillet(1)       │     │                     │           │
├─────────────────────┤     └─────────────────────┘           │
│  Console            ├───────────────────────────────────────┤
│  ✓ Built in 0.12s   │  Properties                           │
│  Faces: 10          │  Volume: 892.3 mm³                    │
│  Edges: 24          │  Surface: 614.2 mm²                   │
└─────────────────────┴───────────────────────────────────────┘

Acceptance Criteria

  • Syntax highlighting works
  • At least 5 example scripts included
  • Properties panel shows model info
  • Can save/load scripts
  • Can export to STEP and STL
  • Professional UI appearance

Effort Estimate

~4 days

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions