fix: remove view_direction field refs from brep_drawing.cpp
CI / Build & Test (push) Failing after 33s
CI / Release Build (push) Failing after 28s
Build & Test / build-and-test (push) Has been cancelled
Build & Test / python-bindings (push) Has been cancelled

This commit is contained in:
茂之钳
2026-07-24 15:25:11 +00:00
parent d2c628215d
commit 033538013e
2 changed files with 270 additions and 139 deletions
+34 -24
View File
@@ -1,4 +1,14 @@
#pragma once
/**
* @file brep_drawing.h
* @brief Engineering drawing: 2D projection views + section + DXF export
*
* Orthographic projection views from B-Rep models with hidden-line
* removal via mesh ray-casting. Supports section (cross-section) views
* and AutoCAD R12 DXF format export.
*
* @ingroup brep
*/
#include "vde/brep/brep.h"
#include "vde/core/point.h"
#include <vector>
@@ -9,40 +19,40 @@ namespace vde::brep {
/// 2D line segment for drawing output
struct DrawSegment {
double x1, y1, x2, y2;
bool hidden = false;
bool hidden = false; ///< true = dashed hidden line
};
/// Projection view of a B-Rep body
struct ProjectionView {
std::string name;
std::vector<DrawSegment> segments;
std::vector<DrawSegment> hidden_lines;
std::string name; ///< "front", "top", "right", "iso"
std::vector<DrawSegment> segments; ///< visible lines
std::vector<DrawSegment> hidden_lines; ///< dashed hidden lines
double scale = 1.0;
[[nodiscard]] size_t total_segments() const { return segments.size() + hidden_lines.size(); }
core::Point3D view_direction; ///< camera direction
[[nodiscard]] size_t total_segments() const {
return segments.size() + hidden_lines.size();
}
};
/// Generate orthographic projection views (front, top, right)
/// Generate orthographic projection views
/// @param body B-Rep model to project
/// @return Vector of projection views (front, top, right, iso)
[[nodiscard]] std::vector<ProjectionView> generate_views(const BrepModel& body);
/// Generate a section view
/// Generate a section view (cross-section)
/// @param body Body to slice
/// @param point Point on section plane
/// @param normal Section plane normal
/// @return Section view with cut edges and hatch lines
[[nodiscard]] ProjectionView section_view(const BrepModel& body,
const core::Point3D& point, const core::Vector3D& normal);
/// Export to DXF R12 format
bool export_dxf(const std::string& filepath, const std::vector<ProjectionView>& views);
/// Export views to DXF format (R12 compatible)
/// @param filepath Output file path (.dxf)
/// @param views Vector of views to export
/// @return true on success
bool export_dxf(const std::string& filepath,
const std::vector<ProjectionView>& views);
/// Dimension type
enum class DimType { Linear, Radius, Diameter };
/// A dimension annotation
struct Dimension {
DimType type = DimType::Linear;
double x1 = 0, y1 = 0, x2 = 0, y2 = 0;
std::string text;
};
/// Auto-generate dimensions for a view
[[nodiscard]] std::vector<Dimension> auto_dimension(const ProjectionView& view);
} // namespace vde::brep
} // namespace vde::brep