### 宿主复测闭环
- VDE-1249/VDE-1250 标记 Fixed(宿主 1.0.68 复测记录:0 error、13,030/0 ctest、n42 82s、n49/n50/n60、save-load match=1);
- VDE-1251(dense pattern,1.0.72 修复)待宿主复测;
### P3-15c ui/pdm bridge TU 迁移
- geometric_snap/snap_ext→vde_ui、structural_profiles→vde_pdm;规范头 + 旧 brep 兼容转发头(不进 kernel SDK);
- check_kernel_boundary allowlist 清零;默认 build 0 error、定向 170/170、kernel-only 971 步 0 undefined;
### P3-15d/e 模块包
- 新增 vde-cam/vde-cae/vde-ui/vde-pdm 包(共 8 个模块包);独立 consumer:
CAM_CONSUMER_PASS segments=1006 gcode=1011、CAE_CONSUMER_PASS tet=384 patches=6、
UI_CONSUMER_PASS layouts=4 picked=1、PDM_CONSUMER_PASS materials=21 profiles=32 bom=1;
- 默认构建/聚合不变;docs module-packaging-split §7.1/§7.2;剩余 assembly/PMI/钣金;
### P3-14c 外部服务容器运行时抽象
- sandbox.container{runtime auto|docker|podman,image,network,read_only};argv 构造 docker/podman run(仅挂载 workdir、
--network none、--read-only/tmpfs、env 白名单、超时/失败清理);无 runtime 默认 unsupported_sandbox,allow_unsandboxed 降级;
- fake runtime 测试 5/5;docs §7.3/§12.9;真实 docker e2e 需环境;
### P3-16c largeMesh O(F²) 修复
- display_conforming_patch 每体一次统计 sphere 面数;8192 面球 >600s→~2s(261k tris、deg/open/zeroArea=0);
- degenerate_triangles 语义澄清 + 回退场景用 B-Rep wireframe 的宿主指引;test_vde1250_large_mesh 3/3;
### P3-17 插件 SDK scaffold + 远程索引
- tool scaffold 四类模板(独立 build/--check/--list PASS)+ --fetch-index(本地/http WinHTTP,签名/路径/ABI/哈希校验);
### 工程
- 版本 1.0.74;全量构建 0 error(375 targets);全量 ctest 7540 注册、7445/7445 PASS(0 failed,25 skipped,224.07s)。
554 lines
24 KiB
C++
554 lines
24 KiB
C++
#pragma once
|
||
/**
|
||
* @file structural_profiles.h
|
||
* @brief 焊接几何与结构型材生成库
|
||
*
|
||
/// 提供标准结构型材(工字钢、槽钢、角钢、方管、圆管)的 B-Rep 生成,
|
||
/// 以及焊道几何创建功能。对标 SolidWorks Weldments。
|
||
///
|
||
/// ## 功能概览
|
||
///
|
||
/// | 函数 | 说明 |
|
||
/// |------------------------|------------------------|
|
||
/// | make_i_beam | 工字钢 (I-beam) |
|
||
/// | make_c_channel | 槽钢 (C-channel) |
|
||
/// | make_angle | 角钢 (L-angle) |
|
||
/// | make_rectangular_tube | 矩形方管 |
|
||
/// | make_round_tube | 圆形管 |
|
||
/// | make_weld_bead | 焊道(沿边圆柱体) |
|
||
/// | trim_to_length | 型材按长度裁剪 |
|
||
/// | miter_corner | 型材斜接角 |
|
||
///
|
||
/// 标准型材规格目录(profile_library / ProfileSpec,GB/T·JIS·ISO 等标准与
|
||
/// mass_per_meter 等行业产品数据)已移至 @ref vde_pdm/structural_profile_catalog.h。
|
||
///
|
||
/// @ingroup brep
|
||
*/
|
||
|
||
#include "vde/brep/brep.h"
|
||
#include "vde/core/point.h"
|
||
#include "vde/core/plane.h"
|
||
|
||
#include <string>
|
||
#include <vector>
|
||
|
||
namespace vde::brep {
|
||
|
||
using core::Point3D;
|
||
using core::Vector3D;
|
||
|
||
// ═══════════════════════════════════════════════════════════
|
||
// 结构型材
|
||
// ═══════════════════════════════════════════════════════════
|
||
|
||
/**
|
||
* @brief 创建工字钢 (I-beam)
|
||
*
|
||
* 标准工字形截面,沿 X 轴挤出 length 长度。
|
||
* 腹板位于 XZ 平面,翼缘平行于 XY 平面。
|
||
*
|
||
* @param height 总高度 (Y 方向),必须 > 0
|
||
* @param width 翼缘宽度 (Z 方向),必须 > 0
|
||
* @param web_thk 腹板厚度 (Z 方向),必须 > 0 且 < width
|
||
* @param flange_thk 翼缘厚度 (Y 方向),必须 > 0 且 < height/2
|
||
* @param length 长度 (X 方向),必须 > 0
|
||
* @return 工字钢 B-Rep 实体
|
||
*
|
||
* @code{.cpp}
|
||
* auto beam = make_i_beam(200, 100, 8, 12, 3000);
|
||
* // H200×100×8×12 工字钢,3m 长
|
||
* @endcode
|
||
*/
|
||
[[nodiscard]] BrepModel make_i_beam(double height, double width,
|
||
double web_thk, double flange_thk,
|
||
double length);
|
||
|
||
/**
|
||
* @brief 创建槽钢 (C-channel)
|
||
*
|
||
* C 形截面,开口朝 +Z 方向,沿 X 轴挤出。
|
||
*
|
||
* @param height 总高度 (Y 方向)
|
||
* @param width 翼缘宽度 (Z 方向)
|
||
* @param web_thk 腹板厚度 (Z 方向)
|
||
* @param flange_thk 翼缘厚度 (Y 方向)
|
||
* @param length 长度 (X 方向)
|
||
* @return 槽钢 B-Rep 实体
|
||
*
|
||
* @code{.cpp}
|
||
* auto channel = make_c_channel(150, 75, 6, 10, 2500);
|
||
* @endcode
|
||
*/
|
||
[[nodiscard]] BrepModel make_c_channel(double height, double width,
|
||
double web_thk, double flange_thk,
|
||
double length);
|
||
|
||
/**
|
||
* @brief 创建角钢 (L-angle / equal-leg angle)
|
||
*
|
||
* L 形截面(等边),沿 X 轴挤出。
|
||
*
|
||
* @param width 肢宽 (Y 和 Z 方向),必须 > 0
|
||
* @param height 肢高 (Y 和 Z 方向),目前与 width 相同 (等边)
|
||
* @param thickness 肢厚,必须 > 0 且 < min(width, height)
|
||
* @param length 长度 (X 方向),必须 > 0
|
||
* @return 角钢 B-Rep 实体
|
||
*
|
||
* @code{.cpp}
|
||
* auto angle = make_angle(50, 50, 6, 2000);
|
||
* // L50×50×6 等边角钢,2m 长
|
||
* @endcode
|
||
*/
|
||
[[nodiscard]] BrepModel make_angle(double width, double height,
|
||
double thickness, double length);
|
||
|
||
/**
|
||
* @brief 创建矩形方管 (Rectangular Hollow Section)
|
||
*
|
||
* 矩形空心截面,沿 X 轴挤出。
|
||
*
|
||
* @param width 外宽 (Y 方向)
|
||
* @param height 外高 (Z 方向)
|
||
* @param wall_thk 壁厚,必须 > 0 且 < min(width, height)/2
|
||
* @param length 长度 (X 方向)
|
||
* @return 方管 B-Rep 实体
|
||
*
|
||
* @code{.cpp}
|
||
* auto tube = make_rectangular_tube(100, 50, 4, 3000);
|
||
* // 100×50×4 矩形管
|
||
* @endcode
|
||
*/
|
||
[[nodiscard]] BrepModel make_rectangular_tube(double width, double height,
|
||
double wall_thk, double length);
|
||
|
||
/**
|
||
* @brief 创建圆形管 (Circular Hollow Section)
|
||
*
|
||
* 圆形空心截面,沿 X 轴挤出。
|
||
*
|
||
* @param outer_diameter 外径,必须 > 0
|
||
* @param wall_thk 壁厚,必须 > 0 且 < outer_diameter/2
|
||
* @param length 长度 (X 方向)
|
||
* @return 圆管 B-Rep 实体
|
||
*
|
||
* @code{.cpp}
|
||
* auto pipe = make_round_tube(60.3, 3.2, 6000);
|
||
* // ∅60.3×3.2 圆管,6m 长
|
||
* @endcode
|
||
*/
|
||
[[nodiscard]] BrepModel make_round_tube(double outer_diameter,
|
||
double wall_thk, double length);
|
||
|
||
// ═══════════════════════════════════════════════════════════
|
||
// 焊道几何
|
||
// ═══════════════════════════════════════════════════════════
|
||
/**
|
||
*在两实体的指定边之间生成焊道几何体(圆柱体/三角形截面扫掠)。
|
||
* 焊道沿 edge_a 的几何曲线放置,bead_size 控制焊脚尺寸。
|
||
*
|
||
* 算法:
|
||
* 1. 提取两边的几何曲线
|
||
* 2. 以 bead_size 为半径的圆形截面沿边扫掠
|
||
* 3. 生成的焊道作为独立 BrepModel 返回
|
||
*
|
||
* @param body_a 第一实体
|
||
* @param body_b 第二实体
|
||
* @param edge_a body_a 中的边 ID
|
||
* @param edge_b body_b 中的边 ID
|
||
* @param bead_size 焊脚尺寸/焊道半径
|
||
* @return 焊道 B-Rep 实体(可独立或后续与主体布尔合并)
|
||
*
|
||
* @note 当前实现生成沿边 cylindrically swept 的焊道近似。
|
||
* 精确角焊缝(三角形截面)需要沿边法向定位,待后续增强。
|
||
*
|
||
* @code{.cpp}
|
||
* auto bead = make_weld_bead(plate_a, plate_b, 3, 1, 5.0);
|
||
* // 在 plate_a 的边 3 和 plate_b 的边 1 之间创建 5mm 焊道
|
||
* @endcode
|
||
*/
|
||
|
||
/// @brief 焊道(沿边圆柱体)
|
||
/// @ingroup brep
|
||
[[nodiscard]] BrepModel make_weld_bead(const BrepModel& body_a,
|
||
const BrepModel& body_b,
|
||
int edge_a, int edge_b,
|
||
double bead_size);
|
||
|
||
// ═══════════════════════════════════════════════════════════
|
||
// VDE-249: 型材成员相交检测 / 焊道几何 / 选型推荐
|
||
// ═══════════════════════════════════════════════════════════
|
||
|
||
/**
|
||
* @brief 两根型材成员轴线的几何关系(VDE-249)
|
||
*
|
||
* 轴线由各成员的 AABB 最长轴推断(近轴对齐直线型材有效,与 miter_corner /
|
||
* trim_profile_end 同一口径)。
|
||
*/
|
||
enum class IntersectionType {
|
||
None, ///< 不相交:包围盒间隔 > gap,或公共体积为空
|
||
Perpendicular, ///< 轴线正交(|cos| < 0.001)
|
||
Skew, ///< 轴线异面(既不平行,轴线上最近点距离 > 容差)
|
||
Parallel, ///< 轴线平行(|cos| > 0.999)
|
||
Coplanar ///< 轴线共面且相交(非平行、非正交的一般夹角)
|
||
};
|
||
|
||
/**
|
||
* @brief 型材成员相交检测结果(VDE-249 item1)
|
||
*
|
||
* 由 @ref find_member_intersection 返回。`intersectionPoints` 为两成员重叠区
|
||
* 的顶点集合(默认取公共包围盒 8 角点;布尔交集成功时精化为公共体积的真实
|
||
* 顶点),可直接用于角部处理/裁剪定位;`overlapLength` 为重叠区沿 member1
|
||
* 轴向的最大跨度,供 trim/extend 决定裁剪量。
|
||
*
|
||
* @note 工单提案中的 `intersectionCurves`(任意 Curve 对象)未提供通用曲线
|
||
* 容器,改以重叠区顶点集合 `intersectionPoints` 等价表达交线位置。
|
||
*/
|
||
struct MemberIntersection {
|
||
int member1Id = 0; ///< 第一成员序号(= 第 1 个实参)
|
||
int member2Id = 1; ///< 第二成员序号(= 第 2 个实参)
|
||
std::vector<Point3D> intersectionPoints; ///< 公共体积顶点集合
|
||
double overlapLength = 0.0; ///< 公共体积沿 member1 轴向跨度 (mm)
|
||
IntersectionType type = IntersectionType::None; ///< 轴线关系分类
|
||
|
||
/// 两成员是否存在公共体积(真正重叠)
|
||
[[nodiscard]] bool intersects() const { return overlapLength > 0.0; }
|
||
/// 是否有交线定位点
|
||
[[nodiscard]] bool empty() const { return intersectionPoints.empty(); }
|
||
};
|
||
|
||
/**
|
||
* @brief 检测两根型材成员的相交关系(VDE-249 item1)
|
||
*
|
||
* 算法:先以 AABB 间隔快速剔除(间隔 > gap 判不相交),再按各成员 AABB 最长
|
||
* 轴推断轴线并分类(平行/正交/共面/异面),最后用 B-Rep 布尔交集求公共体积,
|
||
* 以交集体顶点与沿 member1 轴向跨度作为相交证据。
|
||
*
|
||
* @param member1 第一根型材
|
||
* @param member2 第二根型材
|
||
* @param gap 相邻判定的间隔容差 (mm):两成员包围盒最小间隔超过 gap 即判
|
||
* 不相交(供 trim/extend 的裁剪间隙口径使用)
|
||
* @return 相交检测结果;空体或超距时 `type == None`、`overlapLength == 0`
|
||
*/
|
||
[[nodiscard]] MemberIntersection find_member_intersection(
|
||
const BrepModel& member1, const BrepModel& member2, double gap = 1.0);
|
||
|
||
/**
|
||
* @brief 焊道几何体(VDE-249 item2)
|
||
*
|
||
* 以独立 B-Rep 实体表示焊缝(对标 SolidWorks 将焊缝作为切料单中独立实体),
|
||
* 并携带体积/重量/焊接符号,供切料单与质量统计使用。
|
||
*/
|
||
struct WeldBeadGeometry {
|
||
BrepModel beadBody; ///< 焊道实体(可独立或后续与主体布尔并)
|
||
double volume = 0.0; ///< 焊道体积 (mm³)
|
||
double weight = 0.0; ///< 焊道重量 (kg),按钢密度 7.85 g/cm³ 换算
|
||
std::string weldSymbol; ///< 焊接符号(AWS/ISO 文字描述)
|
||
|
||
[[nodiscard]] bool is_valid() const { return beadBody.num_faces() > 0; }
|
||
};
|
||
|
||
/**
|
||
* @brief 创建角焊缝焊道几何(VDE-249 item2)
|
||
*
|
||
* 以等腰直角三角形截面(焊脚尺寸 legSize)沿两成员接缝方向扫掠成实体:
|
||
* - 接缝方向 = 两成员轴线叉积(平行时退回 member1 轴线);
|
||
* - 接缝位置 = 两成员轴线最近点连线的中点;
|
||
* - 截面两直角边分别对齐两成员轴线在接缝法平面内的投影方向。
|
||
*
|
||
* 断续焊(intermittent=true)时按 numSegments 段、每段 segmentLength 沿总长
|
||
* length 均匀分布(段间留空),各段并为一个焊道实体。
|
||
*
|
||
* @param member1 第一根型材
|
||
* @param member2 第二根型材
|
||
* @param legSize 焊脚尺寸 (mm),必须 > 0
|
||
* @param length 焊道总长 (mm),必须 > 0
|
||
* @param intermittent 是否断续焊
|
||
* @param segmentLength 断续焊单段长度 (mm)
|
||
* @param numSegments 断续焊段数(< 2 时按连续焊处理)
|
||
* @return 焊道几何(含体积/重量/符号);非法输入返回空结果
|
||
*/
|
||
[[nodiscard]] WeldBeadGeometry create_fillet_weld(
|
||
const BrepModel& member1, const BrepModel& member2,
|
||
double legSize, double length,
|
||
bool intermittent = false, double segmentLength = 50.0,
|
||
int numSegments = 1);
|
||
|
||
/**
|
||
* @brief 创建坡口焊焊道几何(VDE-249 item2)
|
||
*
|
||
* 以 V 形(顶角 60°)截面沿接缝方向扫掠成实体:熔深 = throatSize,顶部
|
||
* 开口宽 = 2·throatSize·tan(30°);接缝方向/位置与 @ref create_fillet_weld
|
||
* 同一口径。
|
||
*
|
||
* @param member1 第一根型材
|
||
* @param member2 第二根型材
|
||
* @param throatSize 焊喉尺寸 (mm),必须 > 0
|
||
* @param length 焊道长度 (mm),必须 > 0
|
||
* @return 焊道几何;非法输入返回空结果
|
||
*/
|
||
[[nodiscard]] WeldBeadGeometry create_groove_weld(
|
||
const BrepModel& member1, const BrepModel& member2,
|
||
double throatSize, double length);
|
||
|
||
/// 选型推荐的截面形状(VDE-249 item3)
|
||
enum class ProfileShape {
|
||
IBeam, ///< 工字钢 / H 型钢
|
||
Channel, ///< 槽钢
|
||
Angle, ///< 角钢
|
||
RectTube, ///< 矩形方管
|
||
RoundTube ///< 圆管
|
||
};
|
||
|
||
/**
|
||
* @brief 型材选型推荐条目(VDE-249 item3)
|
||
*
|
||
* `utilizationRatio` 为需求/承载力比(≤ 1 表示承载力足够)。
|
||
*/
|
||
struct SizeRecommendation {
|
||
std::string designation; ///< 牌号
|
||
double utilizationRatio = 0.0; ///< 利用率 = 弯矩需求 / 抗弯承载力
|
||
double weightPerMeter = 0.0; ///< 单位长度重量 (kg/m)
|
||
std::string standard; ///< 标准
|
||
};
|
||
|
||
/**
|
||
* @brief 按跨长/荷载推荐型材规格(VDE-249 item3)
|
||
*
|
||
* 简化简支梁(跨中集中荷载)校核:M = maxLoad·spanLength / 4,抗弯承载力
|
||
* = Sx·σ_allow(σ_allow = 165 N/mm²,AISC ASD 常用 Q235 容许弯曲应力)。
|
||
* 返回所选形状/标准下利用率 ≤ 1(承载力足够)的规格,按单位重量升序
|
||
* (轻者优先)。桥接 SolidWorks Weldments 的"按长度/荷载自动选型"。
|
||
*
|
||
* @param spanLength 跨长 (mm),必须 > 0
|
||
* @param maxLoad 跨中集中荷载 (N),必须 ≥ 0
|
||
* @param shape 截面形状
|
||
* @param standard 标准子串过滤(默认 "AISC",匹配 "ANSI/AISC")
|
||
* @return 适量规格的推荐列表(重量升序);无满足规格或输入非法时为空
|
||
*/
|
||
[[nodiscard]] std::vector<SizeRecommendation> recommend_profiles(
|
||
double spanLength, double maxLoad, ProfileShape shape,
|
||
const std::string& standard = "AISC");
|
||
|
||
// ═══════════════════════════════════════════════════════════
|
||
// VDE-398: trim_to_length + miter_corner
|
||
// (standard_library / ProfileSpec 已移至 vde_pdm/structural_profile_catalog.h)
|
||
// ═══════════════════════════════════════════════════════════
|
||
|
||
/// Trim a structural profile to exact length
|
||
/// @param body Profile body (extruded along X axis)
|
||
/// @param length Target length (mm)
|
||
/// @return Trimmed profile
|
||
[[nodiscard]] BrepModel trim_to_length(const BrepModel& body, double length);
|
||
|
||
/// Create a miter corner between two profiles
|
||
///
|
||
/// 两根型材的轴线在接头处相交、夹角为 angle_deg(90 = 标准直角)。实现:
|
||
/// 由各自包围盒最长轴推断轴向 da/db → 求两轴线最近点作为接头 J →
|
||
/// 构造过 J、法向 n = 归一化(da - db) 的斜接平面(与两轴线各成
|
||
/// angle_deg/2)→ 以半空间盒体对每根型材做布尔交集,保留"含远端"的一侧,
|
||
/// 使两端面共面(flush)并对接。
|
||
///
|
||
/// @param body_a First profile
|
||
/// @param body_b Second profile
|
||
/// @param angle_deg Angle between profiles (degrees, 90 = standard corner)
|
||
/// @return Array of two trimmed profiles forming a miter joint
|
||
///
|
||
/// @note 轴线由 AABB 最长轴识别,适用于近轴对齐的直线型材;两轴线平行或
|
||
/// angle_deg ∈ {≤0, ≥180}(含 NaN)等非法输入时,原样返回输入。
|
||
[[nodiscard]] std::array<BrepModel, 2> miter_corner(
|
||
const BrepModel& body_a, const BrepModel& body_b, double angle_deg);
|
||
|
||
// ═══════════════════════════════════════════════════════════
|
||
// VDE-339: 标准型材库 + T 型钢 / 扁钢 + 型材修剪/延伸
|
||
// ═══════════════════════════════════════════════════════════
|
||
|
||
/// 结构标准代码
|
||
enum class ProfileStandard {
|
||
AISC, ///< 美国钢结构协会 (ANSI/AISC)
|
||
EN, ///< 欧洲标准 (DIN/EN)
|
||
JIS, ///< 日本工业标准
|
||
GB, ///< 中国国家标准 (GB/T)
|
||
AS, ///< 澳大利亚标准
|
||
BS ///< 英国标准
|
||
};
|
||
|
||
/// 预定义的型材规格条目
|
||
///
|
||
/// designation / mass_per_meter 来自 @ref vde::pdm::profile_library 的产品数据;
|
||
/// section_area / Ix,Iy / Sx,Sy 由截面尺寸按等厚矩形组合的解析公式计算
|
||
/// (钢密度 7.85 g/cm³ 仅用于换算,不参与截面特性)。
|
||
struct ProfileSize {
|
||
std::string designation; ///< e.g. "IPE 200" (EN) / "W8x10" (AISC)
|
||
double height = 0.0; ///< mm
|
||
double width = 0.0; ///< mm
|
||
double web_thickness = 0.0; ///< mm
|
||
double flange_thickness = 0.0;///< mm
|
||
double mass_per_meter = 0.0; ///< kg/m
|
||
double section_area = 0.0; ///< cm²
|
||
double Ix = 0.0, Iy = 0.0; ///< 惯性矩 (cm⁴)
|
||
double Sx = 0.0, Sy = 0.0; ///< 截面模量 (cm³)
|
||
};
|
||
|
||
/// 查询某标准下的工字钢/H 型钢规格表(无该标准数据时返回空表)
|
||
[[nodiscard]] std::vector<ProfileSize> i_beam_sizes(ProfileStandard standard);
|
||
|
||
/// 查询某标准下的槽钢规格表
|
||
[[nodiscard]] std::vector<ProfileSize> c_channel_sizes(ProfileStandard standard);
|
||
|
||
/// 查询某标准下的角钢规格表
|
||
[[nodiscard]] std::vector<ProfileSize> angle_sizes(ProfileStandard standard);
|
||
|
||
/// 按标准 + 牌号创建工字钢/H 型钢
|
||
/// @param standard 标准代码
|
||
/// @param designation 牌号,如 "IPE 200"、"W8x10"、"I20a"
|
||
/// @param length 梁长度
|
||
/// @return B-Rep 实体;未找到匹配牌号时返回空模型
|
||
[[nodiscard]] BrepModel make_i_beam_from_standard(
|
||
ProfileStandard standard, const std::string& designation, double length);
|
||
|
||
/**
|
||
* @brief 创建 T 型钢 (T-section,工字钢的一半)
|
||
*
|
||
* 上翼缘水平(Y 向厚 flange_thk、Z 向宽 width),腹板垂直自上翼缘下缘
|
||
* 延伸至 -height/2,沿 X 轴挤出 length。
|
||
*
|
||
* @param height 总高 (Y)
|
||
* @param width 翼缘宽 (Z)
|
||
* @param web_thk 腹板厚 (Z)
|
||
* @param flange_thk 翼缘厚 (Y)
|
||
* @param length 长度 (X)
|
||
*/
|
||
[[nodiscard]] BrepModel make_t_section(double height, double width,
|
||
double web_thk, double flange_thk,
|
||
double length);
|
||
|
||
/**
|
||
* @brief 创建扁钢 (flat bar) —— 简单矩形截面
|
||
*
|
||
* 截面 Y 向宽 width、Z 向厚 thickness,沿 X 轴挤出 length。
|
||
*/
|
||
[[nodiscard]] BrepModel make_flat_bar(double width, double thickness,
|
||
double length);
|
||
|
||
/**
|
||
* @brief 将型材修剪到一个平面上
|
||
*
|
||
* 以平面为界裁剪型材,保留法向负侧(n·(p - plane_point) ≤ 0)的部分。
|
||
*
|
||
* @param profile 待修剪型材
|
||
* @param plane_point 平面上的点
|
||
* @param plane_normal 平面法向(无需单位化;退化时原样返回输入)
|
||
* @return 修剪后的型材
|
||
*/
|
||
[[nodiscard]] BrepModel trim_profile_to_plane(const BrepModel& profile,
|
||
const core::Point3D& plane_point,
|
||
const core::Vector3D& plane_normal);
|
||
|
||
/**
|
||
* @brief 沿型材轴向延伸至与目标体相接
|
||
*
|
||
* 由 AABB 最长轴推断型材轴向,向目标体一侧延伸出"端面尺寸等截面"的
|
||
* 棱柱直到触及目标体(沿轴向最近点),再与型材求并。
|
||
*
|
||
* @param profile 待延伸型材
|
||
* @param target_body 目标实体
|
||
* @return 延伸后的型材;已接触或输入为空时原样返回
|
||
*
|
||
* @note 适用于近轴对齐的直线型材(与 miter_corner 同一 AABB 轴向口径)。
|
||
*/
|
||
[[nodiscard]] BrepModel extend_profile_to_body(const BrepModel& profile,
|
||
const BrepModel& target_body);
|
||
|
||
// ═══════════════════════════════════════════════════════════
|
||
// VDE-398: 标准库直取、端部裁剪、变高(锥形)梁、端板连接
|
||
// ═══════════════════════════════════════════════════════════
|
||
|
||
/**
|
||
* @brief 依据标准牌号(designation)直接从型材库生成 B-Rep
|
||
*
|
||
* 在 @ref vde_pdm::profile_library 中查找牌号完全匹配的规格并生成实体;
|
||
* 完全匹配失败时退回子串匹配(取首个命中)。大小写敏感。
|
||
*
|
||
* @param profile_id 牌号字符串,如 "H200x100x5.5x8"、"IPE 200"、"W8x10"
|
||
* @param length 梁长度(X 方向),必须 > 0
|
||
* @return 型材 B-Rep 实体;库中无此牌号时返回空模型
|
||
*
|
||
* @code{.cpp}
|
||
* auto h = make_from_library("H200x100x5.5x8", 3000);
|
||
* @endcode
|
||
*
|
||
* @ingroup brep
|
||
*/
|
||
[[nodiscard]] BrepModel make_from_library(const std::string& profile_id,
|
||
double length);
|
||
|
||
/// 端部裁剪类型(VDE-398)
|
||
enum class TrimType {
|
||
Flat, ///< 平面斜切:以平面为界裁去端部余料
|
||
Miter, ///< 斜接:与 Flat 同一半空间裁剪,语义上用于两构件拼接角
|
||
Coping ///< 让位缺口:在端部切出与横穿构件的凹弧(管-管相贯近似)
|
||
};
|
||
|
||
/**
|
||
* @brief 型材端部裁剪(VDE-398)
|
||
*
|
||
* - Flat / Miter:保留平面法向负侧(`n·(p - p0) ≤ 0`)的部分,删除越过
|
||
* 平面的端部余料;保留侧由型材质心相对平面的位置自动判定。
|
||
* - Coping:在指定端切出与横穿构件相贯的凹弧——用一个与该端垂直的圆柱
|
||
* 作为刀具做布尔差集(圆柱半径取端面横向半宽,轴向垂直于型材轴向)。
|
||
*
|
||
* @param profile 待处理的型材
|
||
* @param end_face 端别:0 = 轴向最小端,1 = 轴向最大端(其余值按 1 处理)
|
||
* @param cutting_plane 切割平面(Hessian 法式:normal·p + d = 0)
|
||
* @param type 裁剪类型
|
||
* @return 裁剪后的型材;输入为空时原样返回
|
||
*
|
||
* @ingroup brep
|
||
*/
|
||
[[nodiscard]] BrepModel trim_profile_end(const BrepModel& profile,
|
||
int end_face,
|
||
const core::Plane3D& cutting_plane,
|
||
TrimType type = TrimType::Flat);
|
||
|
||
/**
|
||
* @brief 创建变高(锥形)工字梁(VDE-398)
|
||
*
|
||
* 沿 X 轴长度方向,截面高度由 h_start 线性过渡到 h_end,翼缘宽度、腹板
|
||
* 厚度、翼缘厚度保持不变。由两片 I 形截面轮廓放样(loft)生成。
|
||
*
|
||
* @param h_start 起始端高度(Y 方向),必须 > 0
|
||
* @param h_end 结束端高度(Y 方向),必须 > 0
|
||
* @param width 翼缘宽度(Z 方向),必须 > 0
|
||
* @param web_thk 腹板厚度(Z 方向),必须 > 0 且 < width
|
||
* @param flange_thk 翼缘厚度(Y 方向),必须 > 0 且 < min(h_start,h_end)/2
|
||
* @param length 长度(X 方向),必须 > 0
|
||
* @return 锥形工字梁 B-Rep 实体
|
||
*
|
||
* @ingroup brep
|
||
*/
|
||
[[nodiscard]] BrepModel make_tapered_i_beam(double h_start, double h_end,
|
||
double width, double web_thk,
|
||
double flange_thk, double length);
|
||
|
||
/**
|
||
* @brief 在型材端面添加端板(VDE-398)
|
||
*
|
||
* 在指定端生成一块矩形连接端板(略大于型材截面),并与型材求并。端板
|
||
* 内外两侧各嵌入极小量以保证布尔缝接可靠。
|
||
*
|
||
* @param profile 目标型材
|
||
* @param end_face 端别:0 = 轴向最小端,1 = 轴向最大端(其余值按 1 处理)
|
||
* @param plate_thk 端板厚度(沿型材轴向),必须 > 0
|
||
* @param width_overhang 端板在截面"宽"方向每侧超出量(默认 10)
|
||
* @param height_overhang 端板在截面"高"方向每侧超出量(默认 10)
|
||
* @return 含端板的型材;输入为空或参数非法时原样返回型材
|
||
*
|
||
* @ingroup brep
|
||
*/
|
||
[[nodiscard]] BrepModel add_end_plate(const BrepModel& profile,
|
||
int end_face, double plate_thk,
|
||
double width_overhang = 10.0,
|
||
double height_overhang = 10.0);
|
||
|
||
} // namespace vde::brep
|