Skip to content

Commit

Permalink
grillage elements now only drawn as traces #25
Browse files Browse the repository at this point in the history
  • Loading branch information
brunopostle committed Dec 29, 2022
1 parent a7d7e92 commit f544c16
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 88 deletions.
81 changes: 2 additions & 79 deletions molior/grillage.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@
from molior.ifc import (
add_face_topology_epsets,
create_face_surface,
create_extruded_area_solid2,
assign_storey_byindex,
get_material_by_name,
get_context_by_name,
get_type_object,
)
from molior.extrusion import Extrusion
from molior.repeat import Repeat
Expand All @@ -27,7 +25,6 @@ def __init__(self, args=None):
if args is None:
args = {}
super().__init__(args)
self.ifc = "IfcBuildingElementProxy"
self.structural_material = "Concrete"
self.spacing = 0.45
self.angle = 90.0
Expand All @@ -45,7 +42,6 @@ def execute(self):
reference_context = get_context_by_name(
self.file, context_identifier="Reference"
)
body_context = get_context_by_name(self.file, context_identifier="Body")

myconfig = self.style_object.get(self.style)

Expand Down Expand Up @@ -165,89 +161,16 @@ def execute(self):
self.spacing, numpy.deg2rad(self.angle)
)

type_product = get_type_object(
self.file,
self.style_object,
ifc_type=self.ifc + "Type",
stylename=self.style,
name=self.name,
)

# retrieve the Material Profile Set from the Product Type
material_profiles = []
profile_set = None
for association in type_product.HasAssociations:
if association.is_a(
"IfcRelAssociatesMaterial"
) and association.RelatingMaterial.is_a("IfcMaterialProfileSet"):
profile_set = association.RelatingMaterial
material_profiles = profile_set.MaterialProfiles

# multiple linear elements on this Face
for cropped_edge in cropped_edges:
# create an element to host all extrusions
linear_element = run(
"root.create_entity",
self.file,
ifc_class=self.ifc,
name=self.name,
)

run(
"type.assign_type",
self.file,
related_object=linear_element,
relating_type=type_product,
)
for cropped_edge in cropped_edges:

start = cropped_edge.StartVertex().Coordinates()
direction = cropped_edge.NormalisedVector()
length = cropped_edge.Length()

# extrude each profile in the profile set
extrusion_list = []
for material_profile in material_profiles:
extrusion = create_extruded_area_solid2(
self.file, material_profile, start, direction, length
)
extrusion_list.append(extrusion)

# stuff extrusions into a Shape Representation for the Element
shape_representation = self.file.createIfcShapeRepresentation(
body_context,
body_context.ContextIdentifier,
"SweptSolid",
extrusion_list,
)
# TODO Axis Representation
run(
"geometry.assign_representation",
self.file,
product=linear_element,
representation=shape_representation,
)
run(
"material.assign_material",
self.file,
product=linear_element,
material=profile_set,
)

run(
"geometry.edit_object_placement",
self.file,
product=linear_element,
)

# stuff the element into the face aggregate
run(
"aggregate.assign_object",
self.file,
product=linear_element,
relating_object=face_aggregate,
)
# edges are drawn with traces

# test
for condition in self.traces:
for name in myconfig["traces"]:
if name == condition:
Expand Down
15 changes: 6 additions & 9 deletions share/framing/hulls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,21 @@ pitched-roof:
class: Shell
condition: roof
ifc: IfcVirtualElement
purlin:
purlins:
class: Grillage
ifc: IfcMember
condition: roof
angle: 0.0
spacing: 1.8
inner: 0.0
joist:
traces: [purlin]
joists:
class: Grillage
ifc: IfcMember
condition: roof
angle: 90.0
spacing: 0.45
inner: 0.0
batten:
traces: [joist]
battens:
class: Grillage
ifc: IfcBuildingElementProxy
condition: roof
angle: 0.0
spacing: 0.20
inner: 0.0
traces: [batten]
19 changes: 19 additions & 0 deletions share/framing/traces.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
joist:
class: Extrusion
ifc: IfcMember
condition: noop
outer: 0.0
extension: 0.05
purlin:
class: Extrusion
ifc: IfcMember
condition: noop
outer: 0.0
extension: 0.0
batten:
class: Extrusion
ifc: IfcBuildingElementProxy
condition: noop
outer: 0.0
extension: 0.0

0 comments on commit f544c16

Please sign in to comment.