Files
ViewDesignEngine/include/vde/brep/brep_drawing.h
T

49 lines
1.3 KiB
C++
Raw Normal View History

#pragma once
#include "vde/brep/brep.h"
#include "vde/core/point.h"
#include <vector>
#include <string>
namespace vde::brep {
/// 2D line segment for drawing output
struct DrawSegment {
double x1, y1, x2, y2;
bool hidden = false;
};
/// Projection view of a B-Rep body
struct ProjectionView {
std::string name;
std::vector<DrawSegment> segments;
std::vector<DrawSegment> hidden_lines;
double scale = 1.0;
[[nodiscard]] size_t total_segments() const { return segments.size() + hidden_lines.size(); }
};
/// Generate orthographic projection views (front, top, right)
[[nodiscard]] std::vector<ProjectionView> generate_views(const BrepModel& body);
/// Generate a section view
[[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);
/// 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