[280] Träger/Unterzug als eigenes Bauteil: Project.beams, Plan (gestrichelt mit Achse), Schnitt, Ansicht, 3D, IFC IfcBeam, DXF, Befehl traeger, Objekt-Info, Griffe, Beispiel Musterhaus komplex

This commit is contained in:
Claude committed 2026-11-18 00:54:36 +00:00
1 parent 369df24be0
commit 5bc0370211
97 files changed
+1479 -81

No files matched your search

+3 -3
View File
@@ -514,10 +514,10 @@ impl Builder {
}
/// IfcBuildingElement-Subtyp mit dem üblichen 9-Attribut-Flatten. Das letzte Attribut ist in IFC4 die
/// PredefinedType, in IFC2x3 je Klasse ShapeType/PredefinedType/CompositionType; IfcWall und IfcColumn
/// haben es dort nicht.
/// PredefinedType, in IFC2x3 je Klasse ShapeType/PredefinedType/CompositionType; IfcWall, IfcColumn
/// und IfcBeam haben es dort nicht.
pub(super) fn emit_building_element(&mut self, ty: &str, guid: String, name: &str, placement: usize, shape: usize, predefined: Option<String>) -> usize {
let last = if self.v2() && matches!(ty, "IFCWALL" | "IFCWALLSTANDARDCASE" | "IFCCOLUMN") {
let last = if self.v2() && matches!(ty, "IFCWALL" | "IFCWALLSTANDARDCASE" | "IFCCOLUMN" | "IFCBEAM") {
String::new()
} else {
format!(",{}", predefined.as_deref().unwrap_or("$"))
+14 -7
View File
@@ -91,7 +91,11 @@
// component_name, PSETS ([141] Stütze mit Höhenabschnitten, je Abschnitt ein eigenes beschnittenes
// Profil; EIN IfcColumn mit n Extrusionen in einer SweptSolid-Darstellung, Placement auf dem tiefsten
// Abschnitt; Material und Materialzuordnung wie COLUMN; die Mengen stehen fertig in PSETS)
// END_COLUMNS = 11 (Materialzuordnung der Stützen)
// BEAM = 27 ([280] Träger), Felder wie COLUMN: structure, id, label, PTS (Grundriss-Rechteck), z_rel, depth (Querschnitts-
// höhe), component_id (−1 = keine), component_name, PSETS; IfcBeam (BEAM, in IFC2x3 ohne PredefinedType),
// Profil-Extrusion senkrecht über dem Rechteck; Schlüssel `beam/<id>`; Material wie bei den Stützen
// (steht VOR END_COLUMNS).
// END_COLUMNS = 11 (Materialzuordnung der Stützen und Träger)
// LAYERS = 25, n_refs, (key, layer_name) x n_refs ([259]) IfcPresentationLayerAssignment je Ebene (Name =
// "Code_Bezeichnung" wie im DXF); alle Darstellungen des Bauteils `key` (wie bei CLASSIFICATION, samt
// aggregierter Teile) liegen auf genau einer Ebene. (IFC4 erlaubt bei IfcPresentationLayerWithStyle nur
@@ -176,6 +180,7 @@ pub const REC_LAYERS: f64 = 25.0;
pub const REC_COLUMN_PIECES: f64 = 20.0;
pub const REC_CEILING_ARC: f64 = 21.0;
pub const REC_SPACE_ARC: f64 = 22.0;
pub const REC_BEAM: f64 = 27.0;
mod format;
mod reader;
@@ -1105,11 +1110,13 @@ pub fn build_ifc(flat: &[f64], strings: &str) -> Result<String, String> {
let (placement, shape) = w.emit_triangulated_product(&mesh, w.placement_of(structure));
w.finish_typed("IFCROOF", format!("roof/{id}"), &name, &ty, &psets, structure, placement, shape, Some(enum_(&predefined)), false);
}
c if c == REC_COLUMN || c == REC_COLUMN_PIECES => {
c if c == REC_COLUMN || c == REC_COLUMN_PIECES || c == REC_BEAM => {
let structure = r.structure(n_storeys)?;
let id = r.string()?;
let label = r.string()?;
let pieces: Vec<(Vec<(f64, f64)>, f64, f64)> = if c == REC_COLUMN {
// [280] Träger: gleiche Daten, andere Klasse und anderer Schlüssel.
let (class, kind, predefined) = if c == REC_BEAM { ("IFCBEAM", "beam", "BEAM") } else { ("IFCCOLUMN", "column", "COLUMN") };
let pieces: Vec<(Vec<(f64, f64)>, f64, f64)> = if c == REC_COLUMN || c == REC_BEAM {
let pts = r.pts()?;
vec![(pts, r.f()?, r.f()?)]
} else {
@@ -1132,12 +1139,12 @@ pub fn build_ifc(flat: &[f64], strings: &str) -> Result<String, String> {
} else {
w.emit_pieces_product(&pieces, w.placement_of(structure))
};
let g = w.gid(&format!("column/{id}"));
let entity = w.emit_building_element("IFCCOLUMN", g, &label, placement, shape, Some(enum_("COLUMN")));
let g = w.gid(&format!("{kind}/{id}"));
let entity = w.emit_building_element(class, g, &label, placement, shape, Some(enum_(predefined)));
w.add_to_containment(structure, entity);
w.elements.insert(format!("column/{id}"), entity);
w.elements.insert(format!("{kind}/{id}"), entity);
for p in &psets {
w.add_pset(p, entity, &format!("column/{id}"));
w.add_pset(p, entity, &format!("{kind}/{id}"));
}
if let Some(cid) = component {
if let Some((_, _, v)) = w.column_materials.iter_mut().find(|(c, _, _)| *c == cid) {
+36
View File
@@ -1342,6 +1342,42 @@ fn stuetze_mit_hoehenabschnitten() {
assert!(ifc.contains("IFCCARTESIANPOINT((0.0,0.0,1.5))"), "Versatz des oberen Abschnitts");
}
/// [280] Träger: IfcBeam mit einer Extrusion über dem Grundriss-Rechteck, Material wie bei Stützen, GlobalId aus `beam/<id>`;
/// IFC2x3 ohne PredefinedType (wie IfcColumn).
#[test]
fn traeger_als_ifc_beam() {
let mut b = mini();
b.n(&[REC_BEAM, -1.0]);
b.str("T1");
b.str("Träger 25×40 (HEB 200)");
b.pts(&[(0.0, 0.0), (4.0, 0.0), (4.0, 0.25), (0.0, 0.25)]);
b.n(&[1.95, 0.4]);
b.str("c1");
b.str("Beton");
b.ref_pset("Pset_BeamCommon", "Träger 25×40 (HEB 200)");
b.n(&[REC_END_COLUMNS]);
let ifc = build(&b).unwrap();
check_structure(&ifc);
assert_eq!(count(&ifc, "IFCBEAM"), 1);
assert!(first_line(&ifc, "IFCBEAM").contains(".BEAM."), "{}", first_line(&ifc, "IFCBEAM"));
assert_eq!(count(&ifc, "IFCEXTRUDEDAREASOLID"), 1);
assert!(ifc.contains("IFCCARTESIANPOINT((0.0,0.0,1.95))"), "Unterkante des Trägers");
assert_eq!(count(&ifc, "IFCRELASSOCIATESMATERIAL"), 1);
// IFC2x3: IfcBeam ohne PredefinedType am Ende (wie IfcColumn).
let mut c = mini_in(B::v2());
c.n(&[REC_BEAM, -1.0]);
c.str("T1");
c.str("Träger");
c.pts(&[(0.0, 0.0), (4.0, 0.0), (4.0, 0.25), (0.0, 0.25)]);
c.n(&[1.95, 0.4]);
c.n(&[-1.0, -1.0]);
c.no_psets();
c.n(&[REC_END_COLUMNS]);
let ifc = build(&c).unwrap();
assert_eq!(count(&ifc, "IFCBEAM"), 1);
assert!(first_line(&ifc, "IFCBEAM").ends_with(",$);"), "{}", first_line(&ifc, "IFCBEAM"));
}
/// [259] Dreieckssuppe → verbundenes Netz: gleiche Ecken (auf 6 Stellen) einmal, Dreieck mit doppelter Ecke fällt weg.
#[test]
fn netz_wird_verschweisst() {