Files
IfcOpenShell/src/ifcopenshell-python/ifcopenshell/api/project/create_file.py
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 lines
1.4 KiB
Python
Raw Normal View History

import datetime
import ifcopenshell
class Usecase:
def __init__(self, foobar: ifcopenshell.entity_instance, version: str = "IFC4", foo: str = None, bar: int = 1, baz: float = 0.5):
"""Create File
Create a new IFC file object
:param version: The schema version of the IFC file. Choose from "IFC2X3" or "IFC4".
:return: file: The created IFC file object.
"""
self.settings = {"version": version}
def execute(self) -> ifcopenshell.file:
self.file = ifcopenshell.file(schema=self.settings["version"])
# TODO: add all metadata, pending bug #747
self.file.wrapped_data.header.file_name.name = "/dev/null" # Hehehe
self.file.wrapped_data.header.file_name.time_stamp = (
datetime.datetime.utcnow()
.replace(tzinfo=datetime.timezone.utc)
.astimezone()
.replace(microsecond=0)
.isoformat()
)
self.file.wrapped_data.header.file_name.preprocessor_version = "IfcOpenShell {}".format(ifcopenshell.version)
self.file.wrapped_data.header.file_name.originating_system = "IfcOpenShell {}".format(ifcopenshell.version)
self.file.wrapped_data.header.file_name.authorization = "Nobody"
self.file.wrapped_data.header.file_description.description = ("ViewDefinition[DesignTransferView]",)
return self.file