Files
ViewDesignEngine/docs/reference/API-REFERENCE.md
T
茂之钳 06de5d8b1e
CI / Build & Test (push) Failing after 42s
CI / Release Build (push) Failing after 38s
Build & Test / build-and-test (push) Has been cancelled
Build & Test / python-bindings (push) Has been cancelled
docs: finalize API-REFERENCE for v1.0.0
Replace 6942-line auto-generated reference with concise 150-line manual.
Modules index, code examples, Doxygen link.
2026-07-27 15:00:57 +08:00

3.2 KiB

ViewDesignEngine API 参考手册

v1.0.0-rc.1 · 11 模块 · 完整 API 文档见 Doxygen

模块索引

模块 命名空间 核心类/函数
foundation vde::foundation ToleranceConfig, import_step_file, export_step_file
core vde::core Point3D, Vector3D, AABB3D, Tool, ObjectPool<T>
curves vde::curves NurbsCurve, NurbsSurface, sweep_surface, loft_surface
mesh vde::mesh HalfedgeMesh, marching_cubes, tetrahedral_mesh
spatial vde::spatial BVH, Octree, KDTree, RTree
boolean vde::boolean boolean_union_2d, mesh_union
collision vde::collision gjk_intersect, ray_intersect_triangle
brep vde::brep BrepModel, make_box, brep_union, validate
sdf vde::sdf SdfNode, evaluate, sdf_to_mesh
sketch vde::sketch ConstraintSolver
capi vde::capi C API vde_* 函数

基础类型 (vde::core)

// 3D 点
Point3D p(1.0, 2.0, 3.0);
double x = p.x(), y = p.y(), z = p.z();

// 3D 向量
Vector3D v = p2 - p1;
double len = v.norm();
Vector3D n = v.normalized();
double dot = a.dot(b);
Vector3D cross = a.cross(b);

// 包围盒
AABB3D box(p_min, p_max);
box.expand(point);
bool hit = box.intersects(other);
auto center = box.center();

B-Rep 建模 (vde::brep)

// 创建
auto box = make_box(2, 3, 4);
auto cyl = make_cylinder(1.5, 6, 32);
auto sphere = make_sphere(2, 32, 16);

// 布尔
auto result = brep_union(a, b);
auto result = brep_intersection(a, b);
auto result = brep_difference(a, b);

// 修复
heal_topology(body);
auto report = validate(body);  // ValidationReport

// 直接建模
push_pull(body, face_id, 5.0);
tweak_face(body, face_id, 2.0);

// 转换
auto mesh = body.to_mesh(0.01);  // HalfedgeMesh
auto bb = body.bounds();          // AABB3D
size_t n = body.num_faces();
const auto& f = body.face(id);

曲线曲面 (vde::curves)

// 求值
Point3D p = surf.evaluate(u, v);
Vector3D n = surf.normal(u, v);

// 分析
auto cmap = curvature_map(surf, 64, 64);
auto cont = surface_continuity(a, b, edge);

// 生成
auto swept = sweep_surface(profile, path);
auto lofted = loft_surface(sections);
auto netted = net_surface(u_curves, v_curves);

网格 (vde::mesh)

// 简化
auto simplified = simplify_mesh(mesh, 0.5);

// MC
auto mesh = marching_cubes(sdf, bounds, 64);

// FEA
auto tets = tetrahedral_mesh(body, TetraParams{});
auto hex = mapped_hex_mesh(body, src, tgt);

格式 IO (vde::foundation)

// STEP
auto body = import_step_file("input.step");
export_step_file(body, "output.step");

// IGES
auto body = import_iges_file("input.igs");

// 工业格式
auto body = import_parasolid_xt("model.x_t");
auto body = import_acis_sat("model.sat");
auto body = import_jt("model.jt");

CAM (vde::core)

Tool tool{ToolType::ENDMILL, 10.0, 4, 50.0};

auto rough = roughing_toolpath(body, tool, {});
auto finish = finishing_toolpath(body, tool, {});
auto drill = drilling_toolpath(points, tool, {5, 10});

FanucPost post;
auto gcode = post.generate(toolpath);

完整 API 文档请查看 Doxygen HTML