[B5] IFC-Export: Dach als IfcRoof-Aggregat mit IfcSlab ROOF je Dachfläche (Schichten als IfcMaterialLayerSetUsage, Pset_SlabCommon, Qto_SlabBaseQuantities; IFC4 und IFC2x3)
This commit is contained in:
11 files changed
+300
-50
No files matched your search
@@ -123,9 +123,10 @@ describe("Rundreise Export → Import", () => {
|
||||
const ifc = exportIfcSpf(sampleProject, { ebkph: true });
|
||||
const bytes = new TextEncoder().encode(ifc);
|
||||
const { products } = await inspectIfc(bytes);
|
||||
expect(products.find((p) => p.ifcClass === "IfcRoof")?.classifications?.[0]).toMatchObject({ system: "eBKP-H", code: "F" });
|
||||
// [B5] Das Dach ist ein IfcRoof-Aggregat ohne Körper: die Dachflächen (IfcSlab ROOF) erben die Klassifikation.
|
||||
expect(products.find((p) => p.ifcClass === "IfcSlab" && p.classifications?.[0]?.code === "F")?.classifications?.[0]).toMatchObject({ system: "eBKP-H", code: "F" });
|
||||
const r = await importIfcInto(sampleProject, bytes, { group: "product" });
|
||||
const roof = r.meshes.find((m) => m.source === "IFC IfcRoof")!;
|
||||
const roof = r.meshes.find((m) => / \[eBKP-H F\]$/.test(m.name))!;
|
||||
expect(roof.name).toMatch(/ \[eBKP-H F\]$/);
|
||||
// Ohne Klassifikation kein Zusatz.
|
||||
expect(r.meshes.find((m) => m.source === "IFC IfcStairFlight")?.name).not.toMatch(/\[/);
|
||||
|
||||
@@ -89,7 +89,7 @@ for el in m.by_type("IfcElement"):
|
||||
g = shape.geometry
|
||||
v = np.array(g.verts).reshape(-1, 3)
|
||||
item["zExtent"] = float(v[:, 2].max() - v[:, 2].min())
|
||||
if el.is_a("IfcSlab"):
|
||||
if el.is_a("IfcSlab") and el.PredefinedType != "ROOF":
|
||||
prof = [r for r in el.Representation.Representations if r.RepresentationIdentifier == "Body"][0].Items[0].SweptArea
|
||||
holes = []
|
||||
if prof.is_a("IfcArbitraryProfileDefWithVoids"):
|
||||
@@ -215,11 +215,19 @@ describe.skipIf(!hasIfcOpenShell)("Basismengen gegen ifcopenshell", { timeout: 1
|
||||
});
|
||||
|
||||
it("Dach: Grundrissprojektion und geneigte Fläche = nach oben zeigende Netz-Dreiecke", () => {
|
||||
// [B5] IfcRoof ist Aggregat ohne Darstellung; die Dachflächen (IfcSlab ROOF) tragen die Netze.
|
||||
const [roof] = of("IfcRoof");
|
||||
const parts = of("IfcSlab").filter((s) => s.predefined === "ROOF");
|
||||
expect(parts.length).toBeGreaterThan(0);
|
||||
const q = qof(roof, "Qto_RoofBaseQuantities");
|
||||
close(q.GrossArea, roof.up![0]);
|
||||
close(q.ProjectedArea, roof.up![1]);
|
||||
close(q.GrossArea, parts.reduce((a, s) => a + s.up![0], 0));
|
||||
close(q.ProjectedArea, parts.reduce((a, s) => a + s.up![1], 0));
|
||||
expect(q.GrossArea).toBeGreaterThan(q.ProjectedArea);
|
||||
for (const s of parts) {
|
||||
const qs = qof(s, "Qto_SlabBaseQuantities");
|
||||
close(qs.NetVolume, s.volume!);
|
||||
close(qs.GrossArea, s.up![0]);
|
||||
}
|
||||
});
|
||||
|
||||
it("Stütze: Volumen, Querschnitt × Länge", () => {
|
||||
|
||||
@@ -394,4 +394,32 @@ print(json.dumps({"n": len(c), "solids": len(body.Items), "volume": us.get_volum
|
||||
const glassVol = d.items.filter((i) => i.styles[0] === "Glas").reduce((a, i) => a + i.volume, 0);
|
||||
expect(glassVol).toBeCloseTo(2 * leafArea * 0.5 * 0.024, 6);
|
||||
});
|
||||
it("[B5] Dächer als IfcRoof-Aggregat mit IfcSlab ROOF je Dachfläche (IFC4 und IFC2x3), Schema gültig", () => {
|
||||
const PY = `
|
||||
import sys, json, ifcopenshell
|
||||
m = ifcopenshell.open(sys.argv[1])
|
||||
out = []
|
||||
for r in m.by_type("IfcRoof"):
|
||||
kids = [o for rel in r.IsDecomposedBy for o in rel.RelatedObjects]
|
||||
out.append({"pre": getattr(r, "PredefinedType", None) or r.ShapeType, "rep": r.Representation is not None,
|
||||
"kids": [[k.is_a(), k.PredefinedType, k.Representation is not None, any(a.is_a("IfcRelAssociatesMaterial") and a.RelatingMaterial.is_a("IfcMaterialLayerSetUsage") for a in k.HasAssociations)] for k in kids]})
|
||||
print(json.dumps(out))
|
||||
`;
|
||||
const typed = { ...sampleProject, roofs: sampleProject.roofs!.map((r) => ({ ...r, roofTypeId: "roof-warm" })) } as Project;
|
||||
for (const schema of ["IFC4", "IFC2X3"] as const) {
|
||||
const ifc = exportIfcSpf(typed, { schema });
|
||||
const file = writeIfc(`dach-${schema}`, ifc);
|
||||
const r = spawnSync("python3", ["-c", PY, file], { encoding: "utf8" });
|
||||
const roofs = JSON.parse(r.stdout) as { pre: string; rep: boolean; kids: [string, string, boolean, boolean][] }[];
|
||||
expect(roofs.length).toBe(sampleProject.roofs!.length);
|
||||
for (const roof of roofs) {
|
||||
expect(roof.rep).toBe(false);
|
||||
expect(roof.kids.length).toBeGreaterThan(0);
|
||||
for (const k of roof.kids) expect(k).toEqual(["IfcSlab", "ROOF", true, true]);
|
||||
}
|
||||
const v = validate(`dach-${schema}`, ifc);
|
||||
expect(v.out).toContain("0 Befunde");
|
||||
expect(v.status).toBe(0);
|
||||
}
|
||||
}, 240_000);
|
||||
});
|
||||
Reference in new issue
Block a user