mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 19:07:57 +00:00
Replace all ifcopenshell.api.run with ifcopenshell.api static functions.
This commit is contained in:
@@ -54,11 +54,11 @@ def add_constituent(
|
||||
# and a glass glazing panel. Notice we are assigning to the type
|
||||
# only, as all occurrences of that type will automatically inherit
|
||||
# the material.
|
||||
window_type = ifcopenshell.api.run("root.create_entity", model, ifc_class="IfcWindowType")
|
||||
window_type = ifcopenshell.api.root.create_entity(model, ifc_class="IfcWindowType")
|
||||
|
||||
# First, let's create a constituent set. This will later be assigned
|
||||
# to our window element.
|
||||
material_set = ifcopenshell.api.run("material.add_material_set", model,
|
||||
material_set = ifcopenshell.api.material.add_material_set(model,
|
||||
name="Window", set_type="IfcMaterialConstituentSet")
|
||||
|
||||
# Let's create a few materials, it's important to also give them
|
||||
@@ -66,13 +66,13 @@ def add_constituent(
|
||||
# like "show me everything made out of aluminium / concrete / steel
|
||||
# / glass / etc". The IFC specification states a list of categories
|
||||
# you can use.
|
||||
aluminium = ifcopenshell.api.run("material.add_material", model, name="AL01", category="aluminium")
|
||||
glass = ifcopenshell.api.run("material.add_material", model, name="GLZ01", category="glass")
|
||||
aluminium = ifcopenshell.api.material.add_material(model, name="AL01", category="aluminium")
|
||||
glass = ifcopenshell.api.material.add_material(model, name="GLZ01", category="glass")
|
||||
|
||||
# Now let's use those materials as two constituents in our set.
|
||||
ifcopenshell.api.run("material.add_constituent", model,
|
||||
ifcopenshell.api.material.add_constituent(model,
|
||||
constituent_set=material_set, material=aluminium)
|
||||
ifcopenshell.api.run("material.add_constituent", model,
|
||||
ifcopenshell.api.material.add_constituent(model,
|
||||
constituent_set=material_set, material=glass)
|
||||
|
||||
# Great! Let's assign our material set to our window type.
|
||||
@@ -80,7 +80,7 @@ def add_constituent(
|
||||
# our window too, but to keep this example simple, geometry is
|
||||
# optional and it is enough to say that this window is made out of
|
||||
# aluminium and glass.
|
||||
ifcopenshell.api.run("material.assign_material", model, products=[window_type], material=material_set)
|
||||
ifcopenshell.api.material.assign_material(model, products=[window_type], material=material_set)
|
||||
"""
|
||||
settings = {"constituent_set": constituent_set, "material": material}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user