A cross-platform, modular application for 3D visualization of geometric shapes with plugin support.
Prism Viewer is a comprehensive application that provides:
- Desktop Application → Python (PySide2) with 3D visualization
- Web Application → Django (backend) + React (frontend)
- Shared Core → Business logic, calculations, and database access
- Plugin System → Install new shapes at runtime
- 3D Visualization → Both desktop and web platforms
- CI/CD Pipeline → Automated testing and deployment
/src/
├── core/ # Shared business logic
│ ├── models.py # Data models
│ ├── database.py # Database management
│ ├── plugin_manager.py # Plugin system
│ └── plugins/ # Default plugins
├── desktop/ # PySide2 desktop app
│ ├── main_window.py # Main application window
│ └── cad_renderer.py # 3D rendering with pythonOCC
└── web/ # Web application
├── backend/ # Django REST API
└── frontend/ # React frontend
- Python 3.8+
- Node.js 16+
- SQLite (for desktop) or PostgreSQL/MySQL (for web)
# Install dependencies
pip install -r requirements.txt
# Run desktop application
python src/desktop/main_window.pycd src/web/backend
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Run migrations
python manage.py migrate
# Populate sample data
python manage.py populate_prisms
# Start development server
python manage.py runservercd src/web/frontend
# Install dependencies
npm install
# Start development server
npm startThe web application will be available at:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
The Django backend provides the following REST API endpoints:
GET /api/prisms/→ List all prism designationsGET /api/prisms/<id>/→ Get prism dimensions and detailsGET /api/prisms/<id>/compute/→ Get calculated volume and surface areaGET /api/prisms/<id>/cad/→ Get CAD model data for 3D visualizationPOST /api/prisms/→ Create a new prismPUT /api/prisms/<id>/→ Update an existing prismDELETE /api/prisms/<id>/→ Delete a prism
The application supports a modular plugin system for adding new geometric shapes:
- Inherit from
ShapePluginbase class - Implement required methods:
calculate_volume()calculate_surface_area()generate_cad_data()get_parameters()
from core.plugin_interface import ShapePlugin
class CylinderPlugin(ShapePlugin):
@property
def name(self):
return "Cylinder"
def calculate_volume(self, **parameters):
radius = parameters['radius']
height = parameters['height']
return 3.14159 * radius * radius * height
# ... implement other required methodsPlugins can be installed at runtime from GitHub repositories:
plugin_manager.install_plugin_from_repo(
"https://github.com/user/cylinder-plugin",
"CylinderPlugin"
)- Home Screen → Select shape type (Rectangular Prism, or installed plugins)
- Shape Selection → Choose specific prism/shape instance
- Calculations → View volume and surface area
- 3D Visualization → Display interactive 3D model
The project uses:
- Black for Python code formatting
- isort for import sorting
- flake8 for linting
- ESLint for JavaScript/React code
# Format Python code
black src/ tests/
# Sort imports
isort src/ tests/
# Lint Python code
flake8 src/ tests/# Install PyInstaller
pip install pyinstaller
# Build executable
pyinstaller --onefile --windowed --name PrismViewer src/desktop/main_window.pyThe web application can be deployed using:
- Backend: Django with Gunicorn + Nginx
- Frontend: React build served by Nginx
- Database: PostgreSQL or MySQL for production
The desktop application can be packaged using:
- PyInstaller for cross-platform executables
- GitHub Actions for automated builds