wichtig ist eine (am besten csv) Datenbank, in der die möglichen Kombinationen aufgelistet sind. An sich kann dafür die Excel-Datei, die mit dem PythonPart mitgeliefert wird als Grundlage dienen.
Aus meiner Sicht ist es ziemlich unsinnig, für das Ermitteln der Kostengruppe aus 4 Attributwerten eine Datenbank oder Excel-Datei zu bemühen!
Eine 4 stufige if-elif-else-Bedingung reicht völlig aus. Hier mal der Code für die Funktion assignKG:
def assignKG(IfcEntity,IfcType,LoadBearing,IsExternal):
costGroup = "KG 000"
if IfcEntity == "IfcFooting":
if IfcType == "PILE_CAP":
costGroup = "KG 323"
else:
costGroup = "KG 322"
elif IfcEntity == "IfcWall":
if LoadBearing != 0:
if IsExternal == "ja":
costGroup = "KG 331"
else:
costGroup = "KG 341"
else:
if IsExternal == "ja":
costGroup = "KG 332"
else:
costGroup = "KG 342"
elif IfcEntity == "IfcColumn":
if LoadBearing != 0:
if IsExternal == "ja":
costGroup="KG 333"
else:
costGroup = "KG 343"
elif IfcEntity == "IfcSlab":
if LoadBearing != 0:
if IsExternal == "ja":
if IfcType == "BASESLAB":
costGroup = "KG 322"
elif IfcType == "ROOF":
costGroup = "KG 361"
else:
costGroup = "KG 351"
elif IfcEntity == "IfcRoof":
costGroup = "KG 361"
elif IfcEntity == "IfcBeam":
if LoadBearing != 0:
if IsExternal == "ja":
if IfcType == "SPANDREL":
costGroup = "KG 331"
else:
costGroup = "KG 361"
else:
if IfcType == "HOLLOWCORE" and LoadBearing == 0:
costGroup = "KG 355"
else:
costGroup = "KG 351"
elif IfcEntity == "IfcPile":
costGroup="KG 323"
elif IfcEntity == "IfcDoor":
if IsExternal == "ja":
if IfcType == "TRAPDOOR":
costGroup="KG 362"
else:
costGroup="KG 334"
else:
if IfcType == "TRAPDOOR":
costGroup="KG 352"
else:
costGroup="KG 344"
elif IfcEntity == "IfcWindow":
if IsExternal == "ja":
if IfcType == "SKYLIGHT" or IfcType == "LIGHTDOME":
costGroup="KG 362"
else:
costGroup="KG 334"
else:
costGroup="KG 344"
elif IfcEntity == "IfcCovering":
if IsExternal == "ja":
if IfcType == "FLOORING":
costGroup = "KG 324"
elif IfcType == "CLADDING" or IfcType == "USERDEFINED" or IfcType == "NOTDEFINED":
costGroup = "KG 335"
elif IfcType == "INSULATION" or IfcType == "MEMBRANE":
costGroup = "KG 325"
elif IfcType == "ROOFING":
costGroup = "KG 363"
else:
if IfcType == "FLOORING" or IfcType == "SKIRTINGBOARD":
costGroup = "KG 353"
elif IfcType == "CEILING":
costGroup = "KG 354"
else:
costGroup = "KG 345"
elif IfcEntity == "IfcCurtainWall":
if IsExternal == "ja":
costGroup = "KG 337"
else:
costGroup = "KG 346"
elif IfcEntity == "IfcShadingDevice":
if IsExternal == "ja":
if IfcType == "AWNING":
costGroup = "KG 361"
else:
costGroup = "KG 338"
else:
costGroup = "KG 347"
elif IfcEntity == "IfcMember":
if IfcType == "COLLAR" or IfcType == "POST" or IfcType == "PURLIN" or IfcType == "RAFTER":
costGroup = "KG 361"
elif IfcEntity == "IfcRailing":
if IsExternal == "ja":
costGroup = "KG 339"
else:
costGroup = "KG 349"
elif IfcEntity == "IfcStair":
costGroup = "KG 351"
elif IfcEntity == "IfcRamp":
costGroup = "KG 351"
elif IfcEntity == "IfcChimney":
costGroup = "KG 399"
elif IfcEntity == "IfcFurniture":
costGroup = "KG 610"
return costGroup
Diese Funktion ergibt dasselbe, wie ein Look-Up in der Excel oder Datenbank.
Aber: Aus meiner Sicht sind die Kriterien IfcEntity, IfcType, LoadBearing, IsExternal die Falschen.
Das Klassifizieren mit diesen Kriterien setzt voraus, dass diese korrekt an allen Objekten vorhanden sind bzw gesetzt wurden.
Ein Test mit dem Allplan Hello!-Projekt zeigt, dass diese Attribut-Werte von der Formel nicht korrekt erkannt werden.
Beispielsweise wurde die IfcEntity einer Wandschicht mit "IfcWall" angezeigt, in Script kam aber "undefiniert" an!
Dazu habe ich eine Testfunktion readAttr benutzt:
def readAttr(IfcEntity,IfcType,LoadBearing,IsExternal):
return IfcEntity+IfcType+str(LoadBearing)+str(IsExternal)
Diese bringt folgendes Ergebnis für die Wand (s.attr_gesamtwand.png) und für die Wandschicht (s.attr_wandschicht.png)
Bei der Wandschicht kommt statt "IfcWall" "undefiniert" an!
Erst nach Wechseln zu "IfcBeam" und zurück zu "IfcWall" wurde diese auch in das Script "reingereicht".
@Allplan
Das ist ein gravierender Fehler, der behoben werden sollte.