mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
Replace all ifcopenshell.api.run with ifcopenshell.api static functions.
This commit is contained in:
@@ -42,7 +42,7 @@ def add_georeferencing(file: ifcopenshell.file, ifc_class: str = "IfcMapConversi
|
||||
|
||||
.. code:: python
|
||||
|
||||
ifcopenshell.api.run("georeference.add_georeferencing", model)
|
||||
ifcopenshell.api.georeference.add_georeferencing(model)
|
||||
"""
|
||||
if file.schema == "IFC2X3":
|
||||
if not (project := file.by_type("IfcProject")):
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import ifcopenshell
|
||||
import ifcopenshell.api.pset
|
||||
from typing import Optional, Any
|
||||
|
||||
|
||||
@@ -52,12 +53,12 @@ def edit_georeferencing(
|
||||
|
||||
.. code:: python
|
||||
|
||||
ifcopenshell.api.run("georeference.add_georeferencing", model)
|
||||
ifcopenshell.api.georeference.add_georeferencing(model)
|
||||
# This is the simplest scenario, a defined CRS (GDA2020 / MGA Zone
|
||||
# 56, typically used in Sydney, Australia) but with no local
|
||||
# coordinates. This is only recommended for horizontal construction
|
||||
# projects, not for vertical construction (such as buildings).
|
||||
ifcopenshell.api.run("georeference.edit_georeferencing", model,
|
||||
ifcopenshell.api.georeference.edit_georeferencing(model,
|
||||
projected_crs={"Name": "EPSG:7856"})
|
||||
|
||||
# For buildings, it is almost always recommended to specify map
|
||||
@@ -65,7 +66,7 @@ def edit_georeferencing(
|
||||
# north. See the diagram in the BlenderBIM Add-on Georeferencing
|
||||
# documentation for correct calculation of the X Axis Abcissa and
|
||||
# Ordinate.
|
||||
ifcopenshell.api.run("georeference.edit_georeferencing", model,
|
||||
ifcopenshell.api.georeference.edit_georeferencing(model,
|
||||
projected_crs={"Name": "EPSG:7856"},
|
||||
coordinate_operation={
|
||||
"Eastings": 335087.17, # The architect nominates a false origin
|
||||
|
||||
@@ -44,11 +44,11 @@ def edit_true_north(file: ifcopenshell.file, true_north: Optional[Union[tuple[fl
|
||||
# Both of these are identical, and indicate that:
|
||||
# - If project north is up the page, true north is in the top left
|
||||
# - The building is therefore facing north east
|
||||
ifcopenshell.api.run("georeference.edit_true_north", model, true_north=30)
|
||||
ifcopenshell.api.run("georeference.edit_true_north", model, true_north=(-0.5, 0.8660254))
|
||||
ifcopenshell.api.georeference.edit_true_north(model, true_north=30)
|
||||
ifcopenshell.api.georeference.edit_true_north(model, true_north=(-0.5, 0.8660254))
|
||||
|
||||
# This unsets true north
|
||||
ifcopenshell.api.run("georeference.edit_true_north", model, true_north=None)
|
||||
ifcopenshell.api.georeference.edit_true_north(model, true_north=None)
|
||||
"""
|
||||
if isinstance(true_north, (float, int)):
|
||||
x, y = ifcopenshell.util.geolocation.angle2yaxis(true_north)
|
||||
|
||||
@@ -58,7 +58,7 @@ def edit_wcs(
|
||||
.. code:: python
|
||||
|
||||
# This is the simplest scenario, resetting the WCS to 0,0,0 with no rotation (recommended)
|
||||
ifcopenshell.api.run("georeference.edit_wcs", model)
|
||||
ifcopenshell.api.georeference.edit_wcs(model)
|
||||
"""
|
||||
unit_scale = ifcopenshell.util.unit.calculate_unit_scale(file)
|
||||
if np.isclose(rotation, 0):
|
||||
|
||||
@@ -31,9 +31,9 @@ def remove_georeferencing(file: ifcopenshell.file) -> None:
|
||||
|
||||
Example:
|
||||
|
||||
ifcopenshell.api.run("georeference.add_georeferencing", model)
|
||||
ifcopenshell.api.georeference.add_georeferencing(model)
|
||||
# Let's change our mind
|
||||
ifcopenshell.api.run("georeference.remove_georeferencing", model)
|
||||
ifcopenshell.api.georeference.remove_georeferencing(model)
|
||||
"""
|
||||
if file.schema == "IFC2X3":
|
||||
project = file.by_type("IfcProject")[0]
|
||||
|
||||
Reference in New Issue
Block a user