Saving surface specular roughness values to IFC is now supported.

This commit is contained in:
Dion Moult
2022-02-02 15:09:37 +11:00
parent 77821caae4
commit 72397f3aff
3 changed files with 117 additions and 49 deletions
@@ -28,12 +28,19 @@ class Usecase:
for key, value in self.settings["attributes"].items():
if key == "SurfaceColour":
self.edit_surface_colour(value)
elif key == "SpecularHighlight":
self.edit_specular_highlight(value)
elif self.is_colour_or_factor(key):
self.edit_colour_or_factor(key, value)
else:
setattr(self.settings["style"], key, value)
def edit_surface_colour(self, value):
if not self.settings["style"].SurfaceColour:
self.settings["style"].SurfaceColour = self.file.createIfcColourRgb(
value.get("Name", None), value["Red"], value["Green"], value["Blue"]
)
self.settings["style"].SurfaceColour[0] = value.get("Name", None)
self.settings["style"].SurfaceColour[1] = value["Red"]
self.settings["style"].SurfaceColour[2] = value["Green"]
self.settings["style"].SurfaceColour[3] = value["Blue"]
@@ -62,3 +69,13 @@ class Usecase:
if existing_value and existing_value.id():
self.file.remove(existing_value)
setattr(self.settings["style"], name, self.file.createIfcNormalisedRatioMeasure(value))
def edit_specular_highlight(self, value):
if value is None:
self.settings["style"].SpecularHighlight = None
elif value.get("IfcSpecularExponent", None):
self.settings["style"].SpecularHighlight = self.file.createIfcSpecularExponent(value["IfcSpecularExponent"])
elif value.get("IfcSpecularRoughness", None):
self.settings["style"].SpecularHighlight = self.file.createIfcSpecularRoughness(
value["IfcSpecularRoughness"]
)