2026-07-27 22:13:00 +08:00
|
|
|
|
---
|
|
|
|
|
|
id: VDE-011
|
2026-07-27 22:56:29 +08:00
|
|
|
|
status: fixed
|
2026-07-27 22:13:00 +08:00
|
|
|
|
severity: medium
|
|
|
|
|
|
category: api
|
|
|
|
|
|
date: 2026-07-27
|
|
|
|
|
|
reporter: ViewDesign
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
# VDE-011: write_stl / write_stl_ascii 返回 void
|
|
|
|
|
|
|
|
|
|
|
|
## 问题描述
|
|
|
|
|
|
|
|
|
|
|
|
write_stl() 和 write_stl_ascii() 的返回类型为 void,调用者无法判断写入是否成功。规范的做法是返回 bool 或抛出异常(如 read_stl 所做的)。函数签名:
|
|
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
|
void write_stl(const std::string& filepath, const std::vector<StlTriangle>& tris);
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## 影响文件
|
|
|
|
|
|
|
|
|
|
|
|
- include/vde/foundation/io_stl.h
|
|
|
|
|
|
|
|
|
|
|
|
## ViewDesign 侧 Workaround
|
|
|
|
|
|
|
|
|
|
|
|
调用后假定成功,返回 true。
|
|
|
|
|
|
|
|
|
|
|
|
## 建议修复方向
|
|
|
|
|
|
|
|
|
|
|
|
1. 改为返回 bool(或 std::expected<void, Error> 在 C++23)
|
|
|
|
|
|
2. 像 read_stl 一样在失败时抛出 std::runtime_error
|
|
|
|
|
|
3. 至少应在文档中说明该函数如何报告写入失败
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
*此文件由 ViewDesign 工程自动生成。处理完成后请更新 status 字段。*
|