Replace all ifcopenshell.api.run with ifcopenshell.api static functions.

This commit is contained in:
Dion Moult
2024-06-28 12:36:31 +10:00
parent b5d613989e
commit 07060fc769
432 changed files with 4633 additions and 4856 deletions
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import ifcopenshell.api
import ifcopenshell.api.owner
import ifcopenshell.util.element
from typing import Any
@@ -41,8 +41,8 @@ def edit_attributes(file: ifcopenshell.file, product: ifcopenshell.entity_instan
.. code:: python
element = ifcopenshell.api.run("root.create_entity", model, ifc_class="IfcWall")
ifcopenshell.api.run("attribute.edit_attributes", model,
element = ifcopenshell.api.root.create_entity(model, ifc_class="IfcWall")
ifcopenshell.api.attribute.edit_attributes(model,
product=element, attributes={"Name": "Waldo"})
"""
settings = {"product": product, "attributes": attributes or {}}
@@ -66,4 +66,4 @@ def edit_attributes(file: ifcopenshell.file, product: ifcopenshell.entity_instan
elif settings["product"].ObjectType and settings["product"].PredefinedType != "USERDEFINED":
settings["product"].PredefinedType = "USERDEFINED"
if hasattr(settings["product"], "OwnerHistory"):
ifcopenshell.api.run("owner.update_owner_history", file, **{"element": settings["product"]})
ifcopenshell.api.owner.update_owner_history(file, **{"element": settings["product"]})