[BlenderBIM] IfcMaterial Management

edited July 24 in General


Several questions which are related
1) Is there a possiblity to assign an IfcMaterial on the IFC4 Demo Library? I would like to have a "brick" or "concrete" wall in the library. Or a country specific library.

2) Is there a way to manage multiple IFC materials through a spreadsheet or something similar? Or are people working an an IfcMaterial Library I'm not aware off? With render and hatch preview of surface and section hatch patterns.. Similar to the Revit material library I think.

3) Does IfcOpenshell allow to create a IfcMaterial from scratch programmatically?

I attached a BlenderBIM screenshot, but it would be really cool if be a stand-alone material management thingy exists which is able to communicate with FreeCAD as well.

tlang

Comments

  • 1) video: https://www.dropbox.com/s/cxo1bxuns81wxii/2022-07-21_13-06-28_Blender_blender.mp4?dl=0
    2) not sure... would be cool. Although I think IfcSurfaceStyleShading is supported, I don't think classes like IfcSurfaceStyleWithTextures and IfcFillAreaStyleHatching are yet.
    3) I think here, but i'm a programming noobie.

    brunopostle
  • Also, did you know about this?...

    brunopostleCoen
  • Yes, you can import Materials from a library just like Types:


    Materials are created like so:

        mymaterial = ifcopenshell.api.run("material.add_material", file, name="Lycra")
    

    ..give it a surface style:

        style = ifcopenshell.api.run("style.add_style", file, name="Cold Yellow")
        ifcopenshell.api.run(
            "style.add_surface_style",
            file,
            style=style,
            attributes={
                "SurfaceColour": {
                    "Name": None,
                    "Red": 1.0,
                    "Green": 1.0,
                    "Blue": 0.5,
                },
                "DiffuseColour": {
                    "Name": None,
                    "Red": 1.0,
                    "Green": 1.0,
                    "Blue": 0.5,
                },
                "Transparency": 0.2,
                "ReflectanceMethod": "PLASTIC",
            },
        )
        ifcopenshell.api.run(
            "style.assign_material_style",
            file,
            material=mymaterial,
            style=style,
            context=model_context,
        )
    
    theoryshawAceCoen
  • @theoryshaw @brunopostle
    Thank you for the answers, I did not know about that whole material section.

  • @brunopostle
    What does ``model_context``` do? What value should that variable have? also how do I assign an IfcMaterial to an IfcProduct?
    I tried this, but it does not work:

    ifcopenshell.api.run("geometry.assign_representation", ifcfile, product=ifc_slabtype, representation=shape_representation, material=mymaterial)
    
  • @Coen it would be a reference to a IfcGeometricRepresentationContext (or SubContext, I think, I'm away from a computer) called 'Model'.

    Lots of my code starts with searching all the existing contexts in the model and saving references to these contexts that you need when creating representations.

  • What does ``model_context``` do? What value should that variable have?

    p. 27 goes into a little, here

    also how do I assign an IfcMaterial to an IfcProduct? I tried this, but it does not work:

    Programmatically, i'm not quite sure... could the answer be gleaned from here?

  • @Coen said:
    also how do I assign an IfcMaterial to an IfcProduct?

    I think (don't have any reference to hand), a product can have zero or more representations (each for a different context), the materials are assigned to the representation not the product.

    CoenJesusbill
Sign In or Register to comment.