Parametric Hull Workflow
Overview
Generate hull geometry from naval architecture parameters using the HullProfile → FreeCADHullGenerator → ManifoldChecker pipeline.
Pipeline Steps
- Define HullProfile — stations with (z, y) waterline offsets
- Generate NURBS surface — FreeCADHullGenerator interpolates stations
- Validate geometry — ManifoldChecker verifies watertight + no self-intersection
- Export STEP — solid body for downstream FEM or CAD use (requires FreeCAD)
Code Example
from digitalmodel.hydrodynamics.hull_library.profile_schema import (
HullProfile, HullStation, HullType,
)
from digitalmodel.visualization.design_tools.freecad_hull import FreeCADHullGenerator
from digitalmodel.visualization.design_tools.manifold_check import ManifoldChecker
# 1. Define hull
stations = [
HullStation(x_position=x, waterline_offsets=[(0, y), (10, y)])
for x, y in [(0, 0), (25, 8), (50, 10), (75, 8), (100, 0)]
]
profile = HullProfile(
name="example", hull_type=HullType.SHIP,
stations=stations, length_bp=100, beam=20, draft=8, depth=10,
source="example",
)
# 2. Generate surface
gen = FreeCADHullGenerator(profile)
surface = gen.generate_nurbs_surface()
# surface["surface_type"] = "freecad" or "scipy"
# 3. Validate
checker = ManifoldChecker(surface["surface_points"])
result = checker.run_all_checks()
assert result["pass"] # watertight + no self-intersection + consistent normals
# 4. Export (FreeCAD only)
gen.export_step(Path("hull.step"))
Key Classes
| Class |
Module |
Purpose |
HullProfile |
hydrodynamics.hull_library.profile_schema |
Hull definition with stations |
HullStation |
same |
Single cross-section (z, y) offsets |
FreeCADHullGenerator |
visualization.design_tools.freecad_hull |
NURBS surface + STEP export |
ManifoldChecker |
visualization.design_tools.manifold_check |
Geometry validation |
Conventions
- Keel-up: z=0 at keel, z=draft at waterline, z=depth at deck
- Half-breadth: y is distance from centreline (starboard side)
- Stations sorted by x_position (aft perpendicular = 0)
- Without FreeCAD: scipy-mode NURBS grid (numpy array) — no STEP export
1---2name: freecad-automation-parametric-hull-workflow3description: Sub-skill of freecad-automation: Parametric hull generation workflow — HullProfile definition, NURBS surface creation, STEP export, and manifold validation.4---56# Parametric Hull Workflow78## Overview910Generate hull geometry from naval architecture parameters using the HullProfile → FreeCADHullGenerator → ManifoldChecker pipeline.1112## Pipeline Steps13141. **Define HullProfile** — stations with (z, y) waterline offsets152. **Generate NURBS surface** — FreeCADHullGenerator interpolates stations163. **Validate geometry** — ManifoldChecker verifies watertight + no self-intersection174. **Export STEP** — solid body for downstream FEM or CAD use (requires FreeCAD)1819## Code Example2021```python22from digitalmodel.hydrodynamics.hull_library.profile_schema import (23 HullProfile, HullStation, HullType,24)25from digitalmodel.visualization.design_tools.freecad_hull import FreeCADHullGenerator26from digitalmodel.visualization.design_tools.manifold_check import ManifoldChecker2728# 1. Define hull29stations = [30 HullStation(x_position=x, waterline_offsets=[(0, y), (10, y)])31 for x, y in [(0, 0), (25, 8), (50, 10), (75, 8), (100, 0)]32]33profile = HullProfile(34 name="example", hull_type=HullType.SHIP,35 stations=stations, length_bp=100, beam=20, draft=8, depth=10,36 source="example",37)3839# 2. Generate surface40gen = FreeCADHullGenerator(profile)41surface = gen.generate_nurbs_surface()42# surface["surface_type"] = "freecad" or "scipy"4344# 3. Validate45checker = ManifoldChecker(surface["surface_points"])46result = checker.run_all_checks()47assert result["pass"] # watertight + no self-intersection + consistent normals4849# 4. Export (FreeCAD only)50gen.export_step(Path("hull.step"))51```5253## Key Classes5455| Class | Module | Purpose |56|-------|--------|---------|57| `HullProfile` | `hydrodynamics.hull_library.profile_schema` | Hull definition with stations |58| `HullStation` | same | Single cross-section (z, y) offsets |59| `FreeCADHullGenerator` | `visualization.design_tools.freecad_hull` | NURBS surface + STEP export |60| `ManifoldChecker` | `visualization.design_tools.manifold_check` | Geometry validation |6162## Conventions6364- **Keel-up**: z=0 at keel, z=draft at waterline, z=depth at deck65- **Half-breadth**: y is distance from centreline (starboard side)66- **Stations sorted by x_position** (aft perpendicular = 0)67- Without FreeCAD: scipy-mode NURBS grid (numpy array) — no STEP export