mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 18:16:40 +00:00
Write documentation for spatial API module
This commit is contained in:
@@ -21,7 +21,39 @@ import ifcopenshell.api
|
||||
|
||||
|
||||
class Usecase:
|
||||
def __init__(self, file, **settings):
|
||||
def __init__(self, file, product=None):
|
||||
"""Unassigns a container from a product.
|
||||
|
||||
Caution: this API function may be replaced by spatial.unassign_container
|
||||
|
||||
:param product: The IfcProduct to remove the containment from.
|
||||
:type product: ifcopenshell.entity_instance.entity_instance
|
||||
:return: None
|
||||
:rtype: None
|
||||
|
||||
Example::
|
||||
|
||||
project = ifcopenshell.api.run("root.create_entity", model, ifc_class="IfcProject")
|
||||
site = ifcopenshell.api.run("root.create_entity", model, ifc_class="IfcSite")
|
||||
building = ifcopenshell.api.run("root.create_entity", model, ifc_class="IfcBuilding")
|
||||
storey = ifcopenshell.api.run("root.create_entity", model, ifc_class="IfcBuildingStorey")
|
||||
|
||||
# The project contains a site (note that project aggregation is a special case in IFC)
|
||||
ifcopenshell.api.run("aggregate.assign_object", model, product=site, relating_object=project)
|
||||
|
||||
# The site has a building, the building has a storey, and the storey has a space
|
||||
ifcopenshell.api.run("aggregate.assign_object", model, product=building, relating_object=site)
|
||||
ifcopenshell.api.run("aggregate.assign_object", model, product=storey, relating_object=building)
|
||||
|
||||
# Create a wall
|
||||
wall = ifcopenshell.api.run("root.create_entity", model, ifc_class="IfcWall")
|
||||
|
||||
# The wall is in the storey
|
||||
ifcopenshell.api.run("spatial.assign_container", model, product=wall, relating_structure=storey)
|
||||
|
||||
# Not anymore!
|
||||
ifcopenshell.api.run("spatial.remove_container", model, product=wall)
|
||||
"""
|
||||
self.file = file
|
||||
self.settings = {"product": None}
|
||||
for key, value in settings.items():
|
||||
|
||||
Reference in New Issue
Block a user