From 7f27785927538fa228fd11d37b6a36f00f3527ad Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Mon, 3 Mar 2025 13:23:49 +0500 Subject: [PATCH] docs fixes 1) material.add_profile_set doesn't exist 2) usecase.file is not defined, use `model` instead` 3) Specify material for material.assign_material --- .../ifcopenshell/api/material/add_profile.py | 2 +- .../ifcopenshell/api/material/assign_profile.py | 6 +++--- .../ifcopenshell/api/material/edit_profile.py | 2 +- .../ifcopenshell/api/material/edit_profile_usage.py | 6 +++--- .../ifcopenshell/api/material/remove_profile.py | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/ifcopenshell-python/ifcopenshell/api/material/add_profile.py b/src/ifcopenshell-python/ifcopenshell/api/material/add_profile.py index b62d5e2ef3..160f79e453 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/material/add_profile.py +++ b/src/ifcopenshell-python/ifcopenshell/api/material/add_profile.py @@ -67,7 +67,7 @@ def add_profile( # First, let's create a material set. This will later be assigned # to our beam type element. - material_set = ifcopenshell.api.material.add_profile_set(model, + material_set = ifcopenshell.api.material.add_material_set(model, name="B1", set_type="IfcMaterialProfileSet") # Create a steel material. diff --git a/src/ifcopenshell-python/ifcopenshell/api/material/assign_profile.py b/src/ifcopenshell-python/ifcopenshell/api/material/assign_profile.py index 1e7c209e6c..bca30a36c2 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/material/assign_profile.py +++ b/src/ifcopenshell-python/ifcopenshell/api/material/assign_profile.py @@ -48,7 +48,7 @@ def assign_profile( # First, let's create a material set. This will later be assigned # to our beam type element. - material_set = ifcopenshell.api.material.add_profile_set(model, + material_set = ifcopenshell.api.material.add_material_set(model, name="B1", set_type="IfcMaterialProfileSet") # Create a steel material. @@ -56,7 +56,7 @@ def assign_profile( # Create an I-beam profile curve. Notice how we name our profiles # based on standardised steel profile names. - hea100 = usecase.file.create_entity( + hea100 = model.create_entity( "IfcIShapeProfileDef", ProfileName="HEA100", ProfileType="AREA", OverallWidth=100, OverallDepth=96, WebThickness=5, FlangeThickness=8, FilletRadius=12, ) @@ -84,7 +84,7 @@ def assign_profile( # Now let's change the profile to a HEA200 standard profile instead. # This will automatically change the body representation that we # just added as well to a HEA200 profile. - hea200 = usecase.file.create_entity( + hea200 = model.create_entity( "IfcIShapeProfileDef", ProfileName="HEA200", ProfileType="AREA", OverallWidth=200, OverallDepth=190, WebThickness=6.5, FlangeThickness=10, FilletRadius=18, ) diff --git a/src/ifcopenshell-python/ifcopenshell/api/material/edit_profile.py b/src/ifcopenshell-python/ifcopenshell/api/material/edit_profile.py index c35755a960..3bc7479388 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/material/edit_profile.py +++ b/src/ifcopenshell-python/ifcopenshell/api/material/edit_profile.py @@ -46,7 +46,7 @@ def edit_profile( .. code:: python # Let's create a material set to store our profiles. - material_set = ifcopenshell.api.material.add_profile_set(model, + material_set = ifcopenshell.api.material.add_material_set(model, name="B1", set_type="IfcMaterialProfileSet") # Create a couple steel materials. diff --git a/src/ifcopenshell-python/ifcopenshell/api/material/edit_profile_usage.py b/src/ifcopenshell-python/ifcopenshell/api/material/edit_profile_usage.py index d02ad167fb..0fc5cccdf9 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/material/edit_profile_usage.py +++ b/src/ifcopenshell-python/ifcopenshell/api/material/edit_profile_usage.py @@ -50,7 +50,7 @@ def edit_profile_usage( # First, let's create a material set. This will later be assigned # to our beam type element. - material_set = ifcopenshell.api.material.add_profile_set(model, + material_set = ifcopenshell.api.material.add_material_set(model, name="B1", set_type="IfcMaterialProfileSet") # Create a steel material. @@ -58,7 +58,7 @@ def edit_profile_usage( # Create an I-beam profile curve. Notice how we name our profiles # based on standardised steel profile names. - hea100 = usecase.file.create_entity( + hea100 = model.create_entity( "IfcIShapeProfileDef", ProfileName="HEA100", ProfileType="AREA", OverallWidth=100, OverallDepth=96, WebThickness=5, FlangeThickness=8, FilletRadius=12, ) @@ -74,7 +74,7 @@ def edit_profile_usage( # Let's create an occurrence of this beam. beam = ifcopenshell.api.root.create_entity(model, ifc_class="IfcBeam", name="B1.01") - rel = ifcopenshell.api.material.assign_material(model, + rel = ifcopenshell.api.material.assign_material(model, material=material_set, products=[beam], type="IfcMaterialProfileSetUsage") # Let's give a 1000mm long beam body representation. diff --git a/src/ifcopenshell-python/ifcopenshell/api/material/remove_profile.py b/src/ifcopenshell-python/ifcopenshell/api/material/remove_profile.py index 2883f21e41..1314bf209e 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/material/remove_profile.py +++ b/src/ifcopenshell-python/ifcopenshell/api/material/remove_profile.py @@ -40,7 +40,7 @@ def remove_profile( .. code:: python # First, let's create a material set. - material_set = ifcopenshell.api.material.add_profile_set(model, + material_set = ifcopenshell.api.material.add_material_set(model, name="B1", set_type="IfcMaterialProfileSet") # Create a steel material.