mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 02:02:22 +00:00
Run black, and add black to a "qa" target to make it a standardised process.
This commit is contained in:
@@ -63,8 +63,8 @@ class Usecase:
|
||||
def get_styled_representation(self, definition_representation):
|
||||
representations = [
|
||||
r
|
||||
for r in definition_representation.Representations if r.is_a("IfcStyledRepresentation")
|
||||
and r.ContextOfItems == self.settings["context"]
|
||||
for r in definition_representation.Representations
|
||||
if r.is_a("IfcStyledRepresentation") and r.ContextOfItems == self.settings["context"]
|
||||
]
|
||||
if representations:
|
||||
return representations[0]
|
||||
|
||||
@@ -3,20 +3,16 @@ class Usecase:
|
||||
self.file = file
|
||||
self.settings = {
|
||||
"style": None,
|
||||
"surface_colour": [], # RGB
|
||||
"diffuse_colour": [], # RGB
|
||||
"surface_colour": [], # RGB
|
||||
"diffuse_colour": [], # RGB
|
||||
"transparency": 0,
|
||||
"external_definition": {
|
||||
"location": None,
|
||||
"identification": None,
|
||||
"name": "Name"
|
||||
},
|
||||
"external_definition": {"location": None, "identification": None, "name": "Name"},
|
||||
}
|
||||
for key, value in settings.items():
|
||||
self.settings[key] = value
|
||||
|
||||
def execute(self):
|
||||
#has_external_definition = None
|
||||
# has_external_definition = None
|
||||
for element in self.file.traverse(self.settings["style"]):
|
||||
if element.is_a("IfcSurfaceStyleShading"):
|
||||
if element.SurfaceColour:
|
||||
@@ -30,28 +26,32 @@ class Usecase:
|
||||
else:
|
||||
element.DiffuseColour = self.create_colour_rgb(self.settings["diffuse_colour"])
|
||||
# TODO: Move to separate usecase
|
||||
#if element.is_a("IfcExternallyDefinedSurfaceStyle"):
|
||||
# if element.is_a("IfcExternallyDefinedSurfaceStyle"):
|
||||
# element.Location = self.settings["location"]
|
||||
# element.Identification = self.settings["identification"]
|
||||
# element.Name = self.settings["name"]
|
||||
# has_external_definition = True
|
||||
#if not has_external_definition:
|
||||
# if not has_external_definition:
|
||||
# styles = list(self.settings["style"].Styles)
|
||||
# styles.append(self.create_externally_defined_surface_style())
|
||||
# self.settings["style"].Styles = styles
|
||||
return self.settings["style"]
|
||||
|
||||
def create_surface_style_rendering(self):
|
||||
return self.file.create_entity("IfcSurfaceStyleRendering", **{
|
||||
"SurfaceColour": self.create_colour_rgb(self.settings["surface_colour"]),
|
||||
"Transparency": self.settings["transparency"],
|
||||
"ReflectanceMethod": "NOTDEFINED",
|
||||
"DiffuseColour": self.create_colour_rgb(self.settings["diffuse_colour"])
|
||||
})
|
||||
return self.file.create_entity(
|
||||
"IfcSurfaceStyleRendering",
|
||||
**{
|
||||
"SurfaceColour": self.create_colour_rgb(self.settings["surface_colour"]),
|
||||
"Transparency": self.settings["transparency"],
|
||||
"ReflectanceMethod": "NOTDEFINED",
|
||||
"DiffuseColour": self.create_colour_rgb(self.settings["diffuse_colour"]),
|
||||
}
|
||||
)
|
||||
|
||||
def create_externally_defined_surface_style(self):
|
||||
self.file.create_entity(
|
||||
"IfcExternallyDefinedSurfaceStyle", **{
|
||||
"IfcExternallyDefinedSurfaceStyle",
|
||||
**{
|
||||
"Location": self.settings["location"],
|
||||
"Identification": self.settings["identification"],
|
||||
"Name": self.settings["name"],
|
||||
|
||||
Reference in New Issue
Block a user