diff --git a/src/ifcpatch/ifcpatch/recipes/AddGeometricRepresentationToAlignment.py b/src/ifcpatch/ifcpatch/recipes/AddGeometricRepresentationToAlignment.py new file mode 100644 index 0000000000..cf67f2e6ba --- /dev/null +++ b/src/ifcpatch/ifcpatch/recipes/AddGeometricRepresentationToAlignment.py @@ -0,0 +1,45 @@ +# IfcPatch - IFC patching utiliy +# Copyright (C) 2020, 2021 Dion Moult +# +# This file is part of IfcPatch. +# +# IfcPatch is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# IfcPatch is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with IfcPatch. If not, see . + +import ifcopenshell +import ifcopenshell.util.alignment +import ifcpatch +from logging import Logger + +import typing +from typing import Union + +class Patcher(ifcpatch.BasePatcher): + def __init__( + self, + file: ifcopenshell.file, + logger: Union[Logger, None] = None + ): + """Adds the geometric representation to a layout + + Example: + + .. code:: python + + model = ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "AddGeometricRepresentationAlignment"}) + """ + super().__init__(file, logger) + self.file_patched: ifcopenshell.file + + def patch(self): + self.file_patched = ifcopenshell.util.alignment.create_alignment_geometry(self.file) diff --git a/src/ifcpatch/ifcpatch/recipes/AddLinearPlacementFallbackPosition.py b/src/ifcpatch/ifcpatch/recipes/AddLinearPlacementFallbackPosition.py new file mode 100644 index 0000000000..e644afdcbf --- /dev/null +++ b/src/ifcpatch/ifcpatch/recipes/AddLinearPlacementFallbackPosition.py @@ -0,0 +1,45 @@ +# IfcPatch - IFC patching utiliy +# Copyright (C) 2020, 2021 Dion Moult +# +# This file is part of IfcPatch. +# +# IfcPatch is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# IfcPatch is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with IfcPatch. If not, see . + +import ifcopenshell +import ifcopenshell.util.alignment +import ifcpatch +from logging import Logger + +import typing +from typing import Union + +class Patcher(ifcpatch.BasePatcher): + def __init__( + self, + file: ifcopenshell.file, + logger: Union[Logger, None] = None + ): + """Adds the IfcLinearPlacement.CartesianPosition fallback position to all of the IfcLinearPlacement objects in the file + + Example: + + .. code:: python + + model = ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "AddLinearPlacementFallbackPosition"}) + """ + super().__init__(file, logger) + self.file_patched: ifcopenshell.file + + def patch(self): + self.file_patched = ifcopenshell.util.alignment.add_linear_placement_fallback_position(self.file) diff --git a/src/ifcpatch/ifcpatch/recipes/AddZeroLengthSegmentToAlignment.py b/src/ifcpatch/ifcpatch/recipes/AddZeroLengthSegmentToAlignment.py new file mode 100644 index 0000000000..3c197a289d --- /dev/null +++ b/src/ifcpatch/ifcpatch/recipes/AddZeroLengthSegmentToAlignment.py @@ -0,0 +1,45 @@ +# IfcPatch - IFC patching utiliy +# Copyright (C) 2020, 2021 Dion Moult +# +# This file is part of IfcPatch. +# +# IfcPatch is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# IfcPatch is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with IfcPatch. If not, see . + +import ifcopenshell +import ifcopenshell.util.alignment +import ifcpatch +from logging import Logger + +import typing +from typing import Union + +class Patcher(ifcpatch.BasePatcher): + def __init__( + self, + file: ifcopenshell.file, + logger: Union[Logger, None] = None + ): + """Adds a zero length segments to alignment layouts + + Example: + + .. code:: python + + model = ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "AddZeroLengthSegmentToAlignment"}) + """ + super().__init__(file, logger) + self.file_patched: ifcopenshell.file + + def patch(self): + self.file_patched = ifcopenshell.util.alignment.append_zero_length_segments(self.file)