mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 18:43:26 +00:00
Fix bug where IFC patch didn't work on case insensitive file extensions
This commit is contained in:
@@ -67,7 +67,7 @@ class ExecuteIfcPatch(bpy.types.Operator):
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
input_file = context.scene.BIMPatchProperties.ifc_patch_input
|
||||
return os.path.isfile(input_file) and "ifc" in os.path.splitext(input_file)[1]
|
||||
return os.path.isfile(input_file) and "ifc" in os.path.splitext(input_file)[1].lower()
|
||||
|
||||
def execute(self, context):
|
||||
props = context.scene.BIMPatchProperties
|
||||
|
||||
@@ -42,7 +42,7 @@ def purge():
|
||||
ifcpatchrecipes_enum = []
|
||||
|
||||
|
||||
def getIfcPatchRecipes(self, context):
|
||||
def get_ifcpatch_recipes(self, context):
|
||||
global ifcpatchrecipes_enum
|
||||
if len(ifcpatchrecipes_enum) < 1:
|
||||
ifcpatchrecipes_enum.clear()
|
||||
@@ -61,7 +61,7 @@ def update_ifc_patch_recipe(self, context):
|
||||
|
||||
|
||||
class BIMPatchProperties(PropertyGroup):
|
||||
ifc_patch_recipes: EnumProperty(items=getIfcPatchRecipes, name="Recipes", update=update_ifc_patch_recipe)
|
||||
ifc_patch_recipes: EnumProperty(items=get_ifcpatch_recipes, name="Recipes", update=update_ifc_patch_recipe)
|
||||
ifc_patch_input: StringProperty(default="", name="IFC Patch Input IFC")
|
||||
ifc_patch_output: StringProperty(default="", name="IFC Patch Output IFC")
|
||||
ifc_patch_args: StringProperty(default="", name="Arguments")
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
# BlenderBIM Add-on - OpenBIM Blender Add-on
|
||||
# Copyright (C) 2021 Dion Moult <dion@thinkmoult.com>
|
||||
#
|
||||
# This file is part of BlenderBIM Add-on.
|
||||
#
|
||||
# BlenderBIM Add-on is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# BlenderBIM Add-on 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import test.bim.bootstrap
|
||||
|
||||
|
||||
class TestExecuteIfcPatch(test.bim.bootstrap.NewFile):
|
||||
@test.bim.bootstrap.scenario
|
||||
def test_executing_ifcpatch(self):
|
||||
return """
|
||||
Given I set "scene.BIMPatchProperties.ifc_patch_recipes" to "OffsetObjectPlacements"
|
||||
And I set "scene.BIMPatchProperties.ifc_patch_input" to "{cwd}/test/files/basic.ifc"
|
||||
And I set "scene.BIMPatchProperties.ifc_patch_output" to "{cwd}/test/files/basic-patched.ifc"
|
||||
And I set "scene.BIMPatchProperties.ifc_patch_args" to "[123454321,0,0,0]"
|
||||
When I press "bim.execute_ifc_patch"
|
||||
Then the file "{cwd}/test/files/basic-patched.ifc" should contain "123454321"
|
||||
"""
|
||||
Reference in New Issue
Block a user