Skip to content

Commit

Permalink
rename 'asset' to 'family' and assets.yml to families.yml #52
Browse files Browse the repository at this point in the history
  • Loading branch information
brunopostle committed Jan 24, 2023
1 parent de7754a commit bb6234e
Show file tree
Hide file tree
Showing 19 changed files with 47 additions and 52 deletions.
4 changes: 2 additions & 2 deletions molior/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ def build_trace(
"style": stylename,
"level": level,
"style_openings": myconfig["openings"],
"style_assets": myconfig["assets"],
"style_families": myconfig["families"],
"style_object": Molior.style,
}
vals.update(config)
Expand Down Expand Up @@ -906,7 +906,7 @@ def build_hull(self, stylename="default", condition="panel", hull=ushell.shell()
"normal_set": "bottom",
"style": stylename,
"hull": hull,
"style_assets": myconfig["assets"],
"style_families": myconfig["families"],
"style_object": Molior.style,
}
vals.update(config)
Expand Down
4 changes: 2 additions & 2 deletions molior/grillage.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def execute(self):
"parent_aggregate": face_aggregate,
"style": self.style,
"hull": myhull[0],
"style_assets": self.style_assets,
"style_families": self.style_families,
"style_object": self.style_object,
}
vals.update(config)
Expand Down Expand Up @@ -257,7 +257,7 @@ def execute(self):
"building": self.building,
"structural_analysis_model": self.structural_analysis_model,
"level": self.level,
"style_assets": self.style_assets,
"style_families": self.style_families,
"style_object": self.style_object,
}
vals.update(config)
Expand Down
10 changes: 5 additions & 5 deletions molior/repeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ def execute(self):
)
style = molior.Molior.style
myconfig = style.get(self.style)
if self.asset in self.style_assets:
for index in range(len(self.style_assets[self.asset])):
height = self.style_assets[self.asset][index]["height"]
if self.family in self.style_families:
for index in range(len(self.style_families[self.family])):
height = self.style_families[self.family][index]["height"]
if height >= self.height - self.ceiling:
break
asset_name = self.style_assets[self.asset][index]["file"]
asset_name = self.style_families[self.family][index]["file"]
else:
asset_name = "error"

Expand Down Expand Up @@ -172,7 +172,7 @@ def execute(self):
"building": self.building,
"structural_analysis_model": self.structural_analysis_model,
"level": self.level,
"style_assets": self.style_assets,
"style_families": self.style_families,
"style_object": self.style_object,
}
vals.update(config)
Expand Down
59 changes: 27 additions & 32 deletions molior/wall.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ def __init__(self, args=None):
self.party_wall = False
self.structural_material = "Masonry"
self.structural_thickness = 0.2
self.opening_material = "Timber"
self.openings = []
self.path = []
for arg in args:
Expand Down Expand Up @@ -475,7 +474,7 @@ def execute(self):

segment = self.openings[id_segment]
for id_opening in range(len(self.openings[id_segment])):
db = self.get_opening(segment[id_opening]["name"])
db = self.get_family(segment[id_opening]["name"])
opening = db["list"][segment[id_opening]["size"]]
name = opening["file"]

Expand Down Expand Up @@ -708,7 +707,7 @@ def init_openings(self):
def opening_coor(self, id_segment, id_opening):
"""rectangle coordinates of an opening on the axis"""
opening = self.openings[id_segment][id_opening]
db = self.get_opening(opening["name"])
db = self.get_family(opening["name"])
width = db["list"][opening["size"]]["width"]
height = db["list"][opening["size"]]["height"]
up = opening["up"]
Expand Down Expand Up @@ -768,19 +767,15 @@ def populate_interior_openings(self, id_segment, type_a, type_b, access):
{"name": "living inside door", "along": 0.5, "size": 0}
)

def get_opening(self, usage):
"""Retrieve an opening definition via the style"""
def get_family(self, usage):
"""Retrieve an family definition via the style"""
if usage in self.style_openings:
opening = self.style_openings[usage]
if opening["name"] in self.style_assets:
opening_material = self.opening_material
if "material" in opening:
opening_material = opening["material"]
family = self.style_openings[usage]
if family["name"] in self.style_families:
return {
"list": self.style_assets[opening["name"]],
"type": opening["type"],
"cill": opening["cill"],
"material": opening_material,
"list": self.style_families[family["name"]],
"type": family["type"],
"cill": family["cill"],
}
return {
"list": [
Expand Down Expand Up @@ -826,7 +821,7 @@ def fix_heights(self, id_segment):
openings_new = []

for opening in openings:
db = self.get_opening(opening["name"])
db = self.get_family(opening["name"])
mylist = db["list"]
opening["up"] = db["cill"]
width_original = mylist[opening["size"]]["width"]
Expand Down Expand Up @@ -870,13 +865,13 @@ def fix_overlaps(self, id_segment):
for id_opening in range(len(openings) - 1):
# this opening has a width and side space
opening = openings[id_opening]
db = self.get_opening(opening["name"])
db = self.get_family(opening["name"])
width = db["list"][opening["size"]]["width"]
side = db["list"][opening["size"]]["side"]

# how much side space does the next opening need
opening_next = openings[id_opening + 1]
db_next = self.get_opening(opening_next["name"])
db_next = self.get_family(opening_next["name"])
side_next = db_next["list"][opening_next["size"]]["side"]

# minimum allowable space between this opening and the next
Expand All @@ -897,7 +892,7 @@ def fix_overrun(self, id_segment):
# this is the furthest an opening can go
length = self.length_segment(id_segment) - self.border(id_segment)[1]

db_last = self.get_opening(openings[-1]["name"])
db_last = self.get_family(openings[-1]["name"])
width_last = db_last["list"][openings[-1]["size"]]["width"]
end_last = db_last["list"][openings[-1]["size"]]["end"]

Expand All @@ -913,7 +908,7 @@ def fix_underrun(self, id_segment):
"""openings can't start before beginning of segment"""
openings = self.openings[id_segment]

db_first = self.get_opening(openings[0]["name"])
db_first = self.get_family(openings[0]["name"])
end_first = db_first["list"][openings[0]["size"]]["end"]

underrun = self.border(id_segment)[0] + end_first - openings[0]["along"]
Expand All @@ -925,13 +920,13 @@ def fix_underrun(self, id_segment):
for id_opening in reversed(range(len(openings) - 1)):
# this opening has a width and side space
opening = openings[id_opening]
db = self.get_opening(opening["name"])
db = self.get_family(opening["name"])
width = db["list"][opening["size"]]["width"]
side = db["list"][opening["size"]]["side"]

# how much side space does the next opening need
opening_next = openings[id_opening + 1]
db_next = self.get_opening(opening_next["name"])
db_next = self.get_family(opening_next["name"])
side_next = db_next["list"][opening_next["size"]]["side"]

# minimum allowable space between this opening and the next
Expand Down Expand Up @@ -993,27 +988,27 @@ def length_openings(self, id_segment):
if len(openings) == 0:
return 0.0

db_first = self.get_opening(openings[0]["name"])
db_first = self.get_family(openings[0]["name"])
end_first = db_first["list"][openings[0]["size"]]["end"]
db_last = self.get_opening(openings[-1]["name"])
db_last = self.get_family(openings[-1]["name"])
end_last = db_last["list"][openings[-1]["size"]]["end"]

# start with end spacing
length_openings = end_first + end_last
# add width of all the openings
for id_opening in range(len(openings)):
db = self.get_opening(openings[id_opening]["name"])
db = self.get_family(openings[id_opening]["name"])
width = db["list"][openings[id_opening]["size"]]["width"]
length_openings += width

# add wall between openings
for id_opening in range(len(openings) - 1):
if not len(openings) > 1:
continue
db = self.get_opening(openings[id_opening]["name"])
db = self.get_family(openings[id_opening]["name"])
side = db["list"][openings[id_opening]["size"]]["side"]

db_next = self.get_opening(openings[id_opening + 1]["name"])
db_next = self.get_family(openings[id_opening + 1]["name"])
side_next = db_next["list"][openings[id_opening + 1]["size"]]["side"]

if side_next > side:
Expand All @@ -1040,7 +1035,7 @@ def fix_segment(self, id_segment):
found_window = False
new_openings = []
for opening in openings:
db = self.get_opening(opening["name"])
db = self.get_family(opening["name"])
if db["type"] == "door" and not found_door:
new_openings.append(opening)
found_door = True
Expand Down Expand Up @@ -1072,7 +1067,7 @@ def fix_segment(self, id_segment):

# find a door, fit the widest of this height
for opening in openings:
db = self.get_opening(opening["name"])
db = self.get_family(opening["name"])
if db["type"] == "door":
mylist = db["list"]
height_original = mylist[opening["size"]]["height"]
Expand Down Expand Up @@ -1100,7 +1095,7 @@ def fix_segment(self, id_segment):

# find a window, fit the widest of this height
for opening in openings:
db = self.get_opening(opening["name"])
db = self.get_family(opening["name"])
if db["type"] == "window":
mylist = db["list"]
height_original = mylist[opening["size"]]["height"]
Expand Down Expand Up @@ -1143,7 +1138,7 @@ def fix_segment(self, id_segment):
self.openings[id_segment] = []
return

db_last = self.get_opening(openings[-1]["name"])
db_last = self.get_family(openings[-1]["name"])

if db_last["type"] == "door":
self.openings[id_segment].pop(0)
Expand Down Expand Up @@ -1171,7 +1166,7 @@ def align_openings(self, id_segment):

along = module / 2
for id_opening in range(len(openings)):
db = self.get_opening(openings[id_opening]["name"])
db = self.get_family(openings[id_opening]["name"])
width = db["list"][openings[id_opening]["size"]]["width"]
openings[id_opening]["along"] = along - (width / 2)
along += module
Expand Down Expand Up @@ -1201,7 +1196,7 @@ def fix_gable(self, id_segment):
) or not FaceUtility.IsInside(face, right_top, 0.001):
# try and find a shorter window
opening = openings[id_opening]
db = self.get_opening(opening["name"])
db = self.get_family(opening["name"])
mylist = db["list"]
width_original = mylist[opening["size"]]["width"]
height_original = mylist[opening["size"]]["height"]
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion share/cinema/traces.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Cinema row:
Cinema seats:
class: Repeat
ifc: IfcFurniture
asset: 'Cinema seat'
family: 'Cinema seat'
condition: noop
outer: 0.0
extension: 0.0
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion share/fancy/pantsy/traces.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
brackets:
class: Repeat
ifc: IfcRoof
asset: bracket
family: bracket
condition: top-backward-up
outer: 0.25
xshift: 0.0
Expand Down
6 changes: 3 additions & 3 deletions share/fancy/traces.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
brackets:
class: Repeat
ifc: IfcRoof
asset: bracket
family: bracket
condition: top-backward-up
outer: 0.25
xshift: 0.0
Expand All @@ -14,7 +14,7 @@ brackets:
low-brackets:
class: Repeat
ifc: IfcRoof
asset: bracket
family: bracket
condition: na
outer: -0.05
xshift: 0.0
Expand All @@ -26,7 +26,7 @@ low-brackets:
monkey:
class: Repeat
ifc: IfcRoof
asset: monkey
family: monkey
condition: na
outer: 0.05
xshift: 0.0
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions share/halifax/rustic/traces.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ exterior:
colonnade:
class: Repeat
ifc: IfcColumn
asset: column
family: column
condition: open
outer: 0.0
inset: 0.0
Expand Down Expand Up @@ -43,7 +43,7 @@ handrail:
balustrade_large:
class: Repeat
ifc: IfcRailing
asset: balustrade_large
family: balustrade_large
condition: none
outer: 0.0
inset: 0.4
Expand Down
2 changes: 1 addition & 1 deletion share/halifax/traces.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
balustrade_small:
class: Repeat
ifc: IfcRailing
asset: balustrade_small
family: balustrade_small
condition: none
xshift: 0.0
yshift: 0.12
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions share/halifax/tuscan/traces.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ column:
colonnade:
class: Repeat
ifc: IfcColumn
asset: column
family: column
condition: open
outer: 0.0
inset: 0.0
Expand All @@ -34,7 +34,7 @@ handrail:
balustrade_large:
class: Repeat
ifc: IfcRailing
asset: balustrade_large
family: balustrade_large
condition: none
outer: 0.0
inset: 0.3
Expand Down
2 changes: 1 addition & 1 deletion share/traces.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ external beam:
column:
class: Repeat
ifc: IfcColumn
asset: column
family: column
ceiling: 0.3
condition: open
outer: 0.2
Expand Down

0 comments on commit bb6234e

Please sign in to comment.