Files
ViewDesignEngine/docs/getting-started.md
T

80 lines
2.2 KiB
Markdown
Raw Normal View History

# 快速入门
> 5 分钟跑起 ViewDesignEngine
## 1. 编译
```bash
# Docker(推荐,开箱即用)
docker run --rm -v $(pwd):/ws -w /ws vde-builder:latest \
bash -c "cmake -B build && cmake --build build -j$(nproc)"
# 本地(需要 CMake 3.16+, GCC 11+/Clang 16+, Eigen3
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j$(nproc)
```
## 2. 运行测试
```bash
cd build && ctest --output-on-failure -E Benchmark
```
## 3. 第一个程序
```cpp
#include <vde/brep/modeling.h>
#include <vde/brep/brep_boolean.h>
#include <vde/foundation/io_step.h>
#include <iostream>
using namespace vde::brep;
int main() {
// 创建两个实体
auto box = make_box(2, 2, 2); // 2×2×2 立方体
auto sphere = make_sphere(1.5, 32); // 半径1.5球体
// 布尔并集
auto result = brep_union(box, sphere);
// 验证结果
auto report = validate(result);
std::cout << "Faces: " << result.num_faces()
<< " Valid: " << report.valid << std::endl;
// 导出 STEP
export_step_file(result, "output.step");
return 0;
}
```
编译运行:
```bash
g++ -std=c++17 -I include -L build/src \
my_program.cpp -lvde_brep -lvde_curves -lvde_foundation \
-lvde_core -o my_program
./my_program
```
## 4. 核心头文件速查
| 功能 | 头文件 | 关键 API |
|------|--------|---------|
| 创建基本体 | `vde/brep/modeling.h` | `make_box`, `make_cylinder`, `make_sphere` |
| 布尔运算 | `vde/brep/brep_boolean.h` | `brep_union`, `brep_intersection`, `brep_difference` |
| 拓扑修复 | `vde/brep/brep_heal.h` | `heal_topology`, `heal_gaps` |
| 验证 | `vde/brep/brep_validate.h` | `validate` |
| STEP 读写 | `vde/foundation/io_step.h` | `import_step_file`, `export_step_file` |
| 网格转换 | `vde/brep/brep.h` | `body.to_mesh()` |
| SDF 建模 | `vde/sdf/sdf_tree.h` | SDF 隐式曲面 |
| CAM 加工 | `vde/core/cam_strategies.h` | `roughing_toolpath`, `finishing_toolpath` |
| 装配体 | `vde/brep/assembly.h` | `Assembly`, `AssemblyNode` |
## 5. 下一步
- [模块说明书](guides/module-manual.md) — 了解所有模块的能力
- [API 使用手册](guides/api-usage.md) — 详细 API 使用示例
- [examples/](../examples/) — 完整可运行示例