mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 10:33:20 +00:00
Generate functions for all API usecases for better static code features. See #2693.
This commit is contained in:
@@ -17,31 +17,28 @@
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
class Usecase:
|
||||
def __init__(self, file, layer=None, attributes=None):
|
||||
"""Edits the attributes of an IfcPresentationLayerAssignment
|
||||
def edit_layer(file, layer=None, attributes=None) -> None:
|
||||
"""Edits the attributes of an IfcPresentationLayerAssignment
|
||||
|
||||
For more information about the attributes and data types of an
|
||||
IfcPresentationLayerAssignment, consult the IFC documentation.
|
||||
For more information about the attributes and data types of an
|
||||
IfcPresentationLayerAssignment, consult the IFC documentation.
|
||||
|
||||
:param layer: The IfcPresentationLayerAssignment entity you want to edit
|
||||
:type layer: ifcopenshell.entity_instance
|
||||
:param attributes: a dictionary of attribute names and values.
|
||||
:type attributes: dict, optional
|
||||
:return: None
|
||||
:rtype: None
|
||||
:param layer: The IfcPresentationLayerAssignment entity you want to edit
|
||||
:type layer: ifcopenshell.entity_instance
|
||||
:param attributes: a dictionary of attribute names and values.
|
||||
:type attributes: dict, optional
|
||||
:return: None
|
||||
:rtype: None
|
||||
|
||||
Example:
|
||||
Example:
|
||||
|
||||
.. code:: python
|
||||
.. code:: python
|
||||
|
||||
layer = ifcopenshell.api.run("layer.add_layer", model, Name="AI-WALL")
|
||||
ifcopenshell.api.run("layer.edit_layer", model,
|
||||
layer=layer, attributes={"Description": "All walls, based on the AIA standard."})
|
||||
"""
|
||||
self.file = file
|
||||
self.settings = {"layer": layer, "attributes": attributes or {}}
|
||||
layer = ifcopenshell.api.run("layer.add_layer", model, Name="AI-WALL")
|
||||
ifcopenshell.api.run("layer.edit_layer", model,
|
||||
layer=layer, attributes={"Description": "All walls, based on the AIA standard."})
|
||||
"""
|
||||
settings = {"layer": layer, "attributes": attributes or {}}
|
||||
|
||||
def execute(self):
|
||||
for name, value in self.settings["attributes"].items():
|
||||
setattr(self.settings["layer"], name, value)
|
||||
for name, value in settings["attributes"].items():
|
||||
setattr(settings["layer"], name, value)
|
||||
|
||||
Reference in New Issue
Block a user