Molior IFC model builder¶
Molior builds 3D models from topologist ‘traces’ and ‘hulls’
Which traces and hulls are used, and how they are used, are defined by files in the ‘share’ folder and subfolders. Access to these style definitions is handled by the molior.style module.
Molior uses IfcOpenShell to generate IFC models of buildings, with some extra helper methods defined in the molior.ifc module. Different building parts need to be constructed differently, so walls, floors, extrusions etc. are each handled by dedicated modules.
Molior is largely derived from the Perl ‘Molior’ module, but has been rewritten in python in order to interface with Topologic and IfcOpenShell.
- class molior.Molior(**args)¶
A Builder, has resources to build
- build_hull(stylename='default', condition='panel', hull=<topologist.ushell.shell object>)¶
Generates IFC data for a single hull and adds to the current building
- build_trace(stylename='default', condition='external', elevation=0.0, height=2.7, chain=<topologist.ugraph.graph object>)¶
Generates IFC data for a single trace and adds to the current building
- connect_spaces()¶
Given objects and boundaries are tagged with Topologic indexes, assign them to correct spaces
- connect_structure()¶
Given Structural Member entities are tagged with Topologic indexes, connect them
- execute()¶
Iterate through ‘traces’ and ‘hulls’ and populate an ifc ‘file’ object
- classmethod from_cellcomplex(file=None, cellcomplex=None, name='My Building', share_dir='share')¶
Create a Molior object from a tagged CellComplex
- classmethod from_faces_and_widgets(file=None, faces=[], widgets=[], name='My Building', share_dir='share')¶
Create a Molior object from lists of Topologic Faces and widgets.
- classmethod from_topology(file=None, topology=None, name='My Building', share_dir='share')¶
Create a Molior object from a tagged Topology
- classmethod get_cellcomplex_from_ifc(entity)¶
Retrieve a CellComplex definition stored by the stash_topology() method
- init_building()¶
Create and relate Site, Building and Storey Spatial Element products, set as current building
- stash_topology()¶
Represent a Topologic model as IFC geometry
Abstract Classes¶
- class molior.baseclass.BaseClass(args=None)¶
A generic building object
- add_psets(product)¶
self.psets is a dictionary of Psets, add them to an Ifc product
- class molior.baseclass.TraceClass(args=None)¶
A building object that follows a path
- angle_segment(index)¶
Angle of segment, degrees anticlockwise from ‘east’
- clipping_plane(index)¶
A plane defined by x, y & z directions and a point on the plane
- corner_coor(index)¶
2D coordinates of a corner
- corner_in(index)¶
offset inside corner
- corner_offset(index, distance)¶
2D coordinates of a corner offset by an arbitrary distance
- corner_out(index)¶
offset outside corner
- direction_segment(index)¶
Normalised 2D direction vector of segment
- extension_end()¶
extend the end of an open path
- extension_start()¶
extend the start of an open path
- length_segment(index)¶
Distance between vertices of this segment
- normal_segment(index)¶
2D normal right-hand side
- segments()¶
Number of segments in the path taking account for being closed or not
Space¶
Wall¶
- class molior.wall.Wall(args=None)¶
A vertical wall, internal or external
- align_openings(id_segment)¶
equally space openings along the wall
- border(id_segment)¶
set border distances if inside corners
- execute()¶
Generate some ifc
- fix_gable(id_segment)¶
Shorten or delete openings that project above roofline
- fix_heights(id_segment)¶
Top of openings need to be lower than ceiling soffit
- fix_overlaps(id_segment)¶
openings don’t want to overlap with each other
- fix_overrun(id_segment)¶
openings can’t go past the end of the segment
- fix_underrun(id_segment)¶
openings can’t start before beginning of segment
- get_family(usage)¶
Retrieve an family definition via the style
- init_openings()¶
We need an array for openings the same size as wall segments array
- length_openings(id_segment)¶
minimum wall length the currently defined openings require
- opening_coor(id_segment, id_opening)¶
rectangle coordinates of an opening on the axis
- populate_exterior_openings(id_segment, interior_type, access)¶
Add initial windows and doors to a segment
- populate_interior_openings(id_segment, type_a, type_b, access)¶
Add an initial door to an interior segment
Extrusion¶
Floor¶
Repeat¶
Stair¶
Shell¶
Grillage¶
Geometry helpers¶
- molior.geometry.map_to_2d(vertices, normal_vector)¶
Transform 3d nodes and their normal to 2d nodes, a return matrix and a vertical vector
- molior.geometry.map_to_2d_simple(vertices, normal)¶
Transform 3d nodes and their normal to 2d nodes and a return matrix
- molior.geometry.matrix_align(A, B)¶
A transform matrix that moves to A and 2D rotates to align the X axis to B
- molior.geometry.matrix_transform(theta, coor)¶
A transform matrix from a rotation in the XY plane and an XYZ shift
- molior.geometry.normal_by_perimeter(vertices)¶
assuming set of vertices represent a planar face, calculate normal
- molior.geometry.transform(matrix, A)¶
Transform a 2d or 3d vector using a 4x4 matrix
IFC helpers¶
Domain-specific extensions to IfcOpenShell
A collection of code for commonly used IFC related tasks
- molior.ifc.add_pset(self, product, name, properties)¶
Helper method to add an Ifc Pset
- molior.ifc.assign_space_byindex(self, entity, building, index)¶
Assign object to a Space by index
- molior.ifc.assign_storey_byindex(self, entity, building, index)¶
Assign object to a storey by index
- molior.ifc.clip_solid(self, solid, start, end)¶
Clip a wall using a half-space solid
- molior.ifc.create_closed_profile_from_points(self, points)¶
Creates a closed 2D profile from list of 2D points
- molior.ifc.create_curve_bounded_plane(self, polygon, matrix)¶
Create a bounded shape in the Z=0 plane
- molior.ifc.create_extruded_area_solid(self, points, height, direction=[0.0, 0.0, 1.0])¶
A simple vertically extruded profile
- molior.ifc.create_face_surface(self, polygon, normal)¶
Create a single-face shape
- molior.ifc.create_storeys(self, parent, elevations)¶
Add Storey Spatial Elements to a Building, given a dictionary of elevations/name
- molior.ifc.create_tessellation_from_mesh(self, vertices, faces)¶
Create a Tessellation from vertex coordinates and faces
- molior.ifc.create_tessellations_from_mesh_split(self, vertices, faces)¶
Create a Tessellation from vertex coordinates and split faces
- molior.ifc.delete_ifc_product(self, product)¶
Recursively delete a product and its children
- molior.ifc.get_building_by_name(self, parent, name)¶
Add a Building to a Site, or retrieve if already there
- molior.ifc.get_context_by_name(self, parent_context_identifier=None, context_identifier=None, target_view=None)¶
Retrieve or create a Representation Context
- molior.ifc.get_library_by_name(self, library_name)¶
Retrieve a Project Library by name, creating it if necessary
- molior.ifc.get_material_by_name(self, style_object, stylename='default', name='Error')¶
Retrieve an IfcMaterial by name, creating it if necessary
- molior.ifc.get_parent_building(entity)¶
Retrieve whatever Building contains this entity, or None
- molior.ifc.get_site_by_name(self, parent, name)¶
Add a Site to a Project, or retrieve if already there
- molior.ifc.get_structural_analysis_model_by_name(self, spatial_element, name)¶
Add a structural model to a building, or retrieve if already there
- molior.ifc.get_thickness(self, product)¶
Gets total thickness for extruded products and types
- molior.ifc.get_type_object(self, style_object, ifc_type='IfcBuildingElementProxyType', stylename='default', name='error')¶
Fetch a Type Object locally, or from an external IFC library
- molior.ifc.init(name='Homemaker Project', file=None)¶
Creates and sets up an ifc ‘file’ object
- molior.ifc.purge_unused(self)¶
Delete some unused entities
Molior Style system¶
A folder tree of inheritable style definitions and resources
A ‘style’ is defined by a collection of YAML configuration files and other file resources in a folder. This module provides methods for accessing this data.
Alternative styles are accessed by a stylename, each represented by a subfolder that inherits data and resources from all parent folders. For example, a style named ‘thin’ may be found in a folder named ${share_dir}/rustic/wood/thin; any query for ‘thin’ data not found in this folder will be sought in ${share_dir}/rustic/wood; failing that it will be sought in ${share_dir}/rustic, and finally in ${share_dir} itself.
Note that styles are accessed by their short stylename _not_ the path, this allows inheritance to be defined entirely by rearrangement of the configuration data. This also means that there may only be one folder called ‘thin’ in the folder tree, all others will be ignored.