OSArch Community

Batch-Generate a library of IfcWallType with varying thickness

  1. G

    Congrats, that's how I did it, too ! Thanks for sharing :)

  2. C

    I am stuck again, clueless how to assign a color.

    I've been reading this thread: https://community.osarch.org/discussion/1255/

    It's where @Ace and @Moult explain how a style and ifcmaterial is defined and assigned.

    But I am clueless how to do it with the ifcopenshell.api.

    When I import my ifcwalltype instance from running the script, the ifcwalltype has the ifcmateriallayer assigned, but the instance has no material assigned. I think I am still missing a crucial step.

  3. G

    @Coen I would try

    
                style = run("style.add_style", ifc_file, name=ifc_material.Name)
    
                run(
    
                    "style.add_surface_style",
    
                    ifc_file,
    
                    style=style,
    
                    attributes={
    
                        "SurfaceColour": {
    
                            "Name": ifc_material.Name,
    
                            "Red": 0.8,
    
                            "Green": 0.5,
    
                            "Blue": 0.2,
    
                        },
    
                        "Transparency": 0,
    
                        "ReflectanceMethod": "PLASTIC",
    
                    },
    
                )
    
                run(
    
                    "style.assign_material_style",
    
                    ifc_file,
    
                    material=ifc_material,
    
                    style=style,
    
                    context=context,
    
                )
    
  4. T

    Nice, created this PR with @Gorgious's patch.

    Also fixed the wall to walltype assignment--wasn't working the other way, on my end.

    Also used IfcWall vs. IfcWallStandardCase... as IfcWallStandardCase is deprecated. Not sure if that was your intention, however.

    Also added a little routine, here, to remove materials with your load_ifc_automatically function.

  5. C

    @Gorgious

    Thanks, that worked, however when opening the file in BIMvision it appears as green.

    Following the comment in this thread.

    https://community.osarch.org/discussion/comment/13735#Comment_13735

    It seems I should leave the Surface color alone, how would I do something like Ace's comment with python? I just would like to appear it with the same color as it does in BIMVision.

  6. C

    @theoryshaw said:

    Nice, created this PR with @Gorgious's patch.

    Also fixed the wall to walltype assignment--wasn't working the other way, on my end.

    Also used IfcWall vs. IfcWallStandardCase... as IfcWallStandardCase is deprecated. Not sure if that was your intention, however.

    Also added a little routine, here, to remove materials with your load_ifc_automatically function.

    Thanks, using IfcWallStandardCase was my intention , did not know it's deprecated.

  7. G
  8. C
  9. G

    Hehe at least that way you should remember it for next time :p

  10. C

    @Gorgious Thanks, my wall is red now.

    Just one more question, I have seen @vpajic made it possible to filter by the predefined types, how would I defined the predefined type with the ifcopenshell.api?

  11. G

    It's an optional argument of root.create_entity

    ifc_walltype = run("root.create_entity", ifc_file, ifc_class="IfcWallType", name="wall_demo", predefined_type="STANDARD")

    See https://github.com/IfcOpenShell/IfcOpenShell/blob/v0.7.0/src/ifcopenshell-python/ifcopenshell/api/root/create_entity.py

    You can change the predefined type after entity creation with https://github.com/IfcOpenShell/IfcOpenShell/blob/v0.7.0/src/ifcopenshell-python/ifcopenshell/api/root/reassign_class.py

    run("root.reassign_class", ifc_file, ifc_class="IfcWallType", product=ifc_walltype, predefined_type="STANDARD")

    (not tested, you might have to tweak a bit)

  12. T

    I wonder too, if adding ifc_class = "IfcSurfaceStyleShading" has an affect on things...

    As it's in other examples out there in the wild.

  13. G

    So after a bit of digging here are the docs for IfcSurfaceStyleRendering and IfcSurfaceStyleShading and a link to the ifcopenshell API

    IfcSurfaceStyleRendering is a subclass of IfcSurfaceStyleShading.

    As far as I understand, IfcSurfaceStyleShading is limited to very simple shading functionality, basically a color and a transparency. It won't be affected by the lights in your scene, for instance.

    IfcSurfaceStyleRendering (used by default if you don't use the ifc_class argument), lets you define how this surface will react to its environment. In addition to the color and transparency, you can also define how the light will reflect when hitting the surface of the object, and how the light will act when it traverses the object (for glass, for example).

  14. T
  1. Page 1
  2. 2

Login or Register to reply.