Congrats, that's how I did it, too ! Thanks for sharing :)
Congrats, that's how I did it, too ! Thanks for sharing :)
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.
@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,
)
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.
@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.
@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.
Try with a red value between 0 and 1. Basically you can copy / paste the r,g and b values that you get when clicking on the color field in blender
See https://community.osarch.org/discussion/comment/13894#Comment_13894 for an extended explanation :)
@Gorgious said:
Try with a red value between 0 and 1. Basically you can copy / paste the r,g and b values that you get when clicking on the color field in blender
See https://community.osarch.org/discussion/comment/13894#Comment_13894 for an extended explanation :)
I'm an idiot, I should read until the end of the thread...
Hehe at least that way you should remember it for next time :p
@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?
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")
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)
I wonder too, if adding ifc_class = "IfcSurfaceStyleShading"
has an affect on things...
As it's in other examples out there in the wild.
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).
Dion's opus on color should probably be inserted here: https://community.osarch.org/discussion/comment/13744/#Comment_13744
Login or Register to reply.