large_assembly: LODSwitchConfig/compute_lightweight_lod/auto_switch_lod → vde_render/large_assembly_render.h structural_profiles: ProfileSpec/profile_library → vde_pdm/structural_profile_catalog.h geometric_snap: live_cursor_snap/aperture → vde_ui/geometric_snap_ui.h brep_drawing: DrawingSheet/Annotation → vde_drafting/drawing_sheet.h pmi_mbd: export_3d_pdf/auto_generate_pmi → vde_drafting/pmi_export.h All modules compile. Core geometry code retained in kernel.
125 lines
5.3 KiB
C++
125 lines
5.3 KiB
C++
#pragma once
|
|
/**
|
|
* @file drawing_sheet.h
|
|
* @brief 工程图纸图幅与标注定义(VDE-380)
|
|
*
|
|
* 从 brep::brep_drawing 中拆分出的"图纸级"概念:
|
|
* - DrawingSheet: 图幅尺寸 / 页边距 / 标题栏 / 作者 / 修订
|
|
* - Annotation / AnnotationType: 视图上的标注(尺寸 / 注释 / 指引线 / 粗糙度符号等)
|
|
* - ViewLayout / ViewPlacement: 视图在图纸上的布局
|
|
* - AnnotationView: 带标注的投影视图
|
|
*
|
|
* 纯几何投影算法(generate_views / section_view / offset_section_view /
|
|
* export_dxf)仍保留在内核 vde::brep::brep_drawing 中;本头文件通过
|
|
* using brep::ProjectionView 复用内核的投影视图类型。
|
|
*
|
|
* @ingroup drafting
|
|
*/
|
|
#include "vde/brep/brep.h"
|
|
#include "vde/brep/brep_drawing.h"
|
|
#include "vde/core/point.h"
|
|
#include <vector>
|
|
#include <string>
|
|
|
|
namespace vde::drafting {
|
|
|
|
// 复用内核的投影视图与 B-Rep 模型类型
|
|
using brep::ProjectionView;
|
|
using brep::BrepModel;
|
|
|
|
// ═══════════════════════════════════════════════════════════
|
|
// 图幅定义
|
|
// ═══════════════════════════════════════════════════════════
|
|
|
|
/// Sheet size enumeration
|
|
enum class SheetSize { A0, A1, A2, A3, A4, Letter, Tabloid, Custom };
|
|
|
|
/// Sheet orientation
|
|
enum class SheetOrientation { Portrait, Landscape };
|
|
|
|
/// Drawing sheet definition
|
|
struct DrawingSheet {
|
|
SheetSize size = SheetSize::A3;
|
|
SheetOrientation orientation = SheetOrientation::Landscape;
|
|
double custom_width = 0.0;
|
|
double custom_height = 0.0;
|
|
double margin_left = 20.0;
|
|
double margin_right = 10.0;
|
|
double margin_top = 10.0;
|
|
double margin_bottom = 10.0;
|
|
std::string title;
|
|
std::string author;
|
|
std::string revision = "A";
|
|
double scale = 1.0;
|
|
};
|
|
|
|
// ═══════════════════════════════════════════════════════════
|
|
// 视图布局
|
|
// ═══════════════════════════════════════════════════════════
|
|
|
|
/// Viewport layout: where each view sits on the sheet
|
|
struct ViewLayout {
|
|
struct ViewPlacement {
|
|
std::string view_name; ///< "front", "top", "right", "iso"
|
|
double pos_x, pos_y; ///< position on sheet (mm from bottom-left)
|
|
double width, height; ///< viewport size (mm)
|
|
double scale = 1.0;
|
|
bool visible = true;
|
|
};
|
|
std::vector<ViewPlacement> placements;
|
|
DrawingSheet sheet;
|
|
};
|
|
|
|
// ═══════════════════════════════════════════════════════════
|
|
// 标注
|
|
// ═══════════════════════════════════════════════════════════
|
|
|
|
/// Annotation types for drawing views
|
|
enum class AnnotationType { Dimension, Note, Leader, SurfaceFinish, WeldSymbol, Datum, FeatureControlFrame };
|
|
|
|
/// A single annotation on a drawing view
|
|
struct Annotation {
|
|
AnnotationType type;
|
|
std::string text;
|
|
double x, y; ///< position in view coordinates
|
|
double angle = 0.0; ///< text rotation angle (degrees)
|
|
double text_height = 3.5;
|
|
std::string style; ///< dimension style name
|
|
};
|
|
|
|
/// Annotation view: a projection view with annotations
|
|
struct AnnotationView {
|
|
ProjectionView base_view;
|
|
std::vector<Annotation> annotations;
|
|
std::string view_name;
|
|
};
|
|
|
|
// ═══════════════════════════════════════════════════════════
|
|
// 图纸布局 API
|
|
// ═══════════════════════════════════════════════════════════
|
|
|
|
/// Create a standard view layout on a drawing sheet
|
|
/// @param views The projection views to place
|
|
/// @param sheet_size Sheet size (default A3)
|
|
/// @return ViewLayout with auto-positioned views
|
|
[[nodiscard]] ViewLayout view_layout(const std::vector<ProjectionView>& views,
|
|
SheetSize sheet_size = SheetSize::A3);
|
|
|
|
/// Create an annotation view with automatically generated dimensions
|
|
/// @param view Base projection view
|
|
/// @param body B-Rep model (for dimension extraction)
|
|
/// @return AnnotationView with dimensions, notes, and center marks
|
|
[[nodiscard]] AnnotationView annotation_view(const ProjectionView& view,
|
|
const BrepModel& body);
|
|
|
|
/// Setup a complete drawing sheet with views, layout, title block
|
|
/// @param views All projection views
|
|
/// @param body B-Rep model
|
|
/// @param sheet Drawing sheet configuration
|
|
/// @return Fully configured ViewLayout with annotations
|
|
[[nodiscard]] ViewLayout drawing_sheet_setup(const std::vector<ProjectionView>& views,
|
|
const BrepModel& body,
|
|
const DrawingSheet& sheet);
|
|
|
|
} // namespace vde::drafting
|