mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
Bonsai - recognize ifc2sql database argument as filepath #6227
This commit is contained in:
@@ -136,12 +136,13 @@ class UpdateIfcPatchArguments(bpy.types.Operator):
|
|||||||
new_attr = patch_args.add()
|
new_attr = patch_args.add()
|
||||||
data_type = arg_info.get("type", "str")
|
data_type = arg_info.get("type", "str")
|
||||||
|
|
||||||
if tool.Patch.is_filepath_argument(self.recipe, arg_name):
|
is_filepath_argument = tool.Patch.is_filepath_argument(arg_info)
|
||||||
|
if is_filepath_argument:
|
||||||
data_type = "file"
|
data_type = "file"
|
||||||
new_attr.metadata = "single_file"
|
new_attr.metadata = "single_file"
|
||||||
|
|
||||||
if isinstance(data_type, list):
|
if isinstance(data_type, list):
|
||||||
if "file" in data_type or tool.Patch.is_filepath_argument(self.recipe, arg_name):
|
if "file" in data_type or is_filepath_argument:
|
||||||
data_type = ["file"]
|
data_type = ["file"]
|
||||||
|
|
||||||
data_type = [dt for dt in data_type if dt != "NoneType"][0]
|
data_type = [dt for dt in data_type if dt != "NoneType"][0]
|
||||||
|
|||||||
@@ -40,9 +40,9 @@ class Patch(bonsai.core.tool.Patch):
|
|||||||
ifcpatch.write(output, outfile)
|
ifcpatch.write(output, outfile)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def is_filepath_argument(cls, recipe: str, arg_name: str) -> bool:
|
def is_filepath_argument(cls, arg_info: ifcpatch.InputDoc) -> bool:
|
||||||
# There is probably a more explicit way to do this
|
# There is probably a more explicit way to do this
|
||||||
return "filepath" in arg_name
|
return "filepath" in arg_info["name"] or "filter_glob" in arg_info
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def does_patch_has_output(cls, recipe: str) -> bool:
|
def does_patch_has_output(cls, recipe: str) -> bool:
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ class Patcher:
|
|||||||
:param database: Database path to save the SQL database to (already existing or not).
|
:param database: Database path to save the SQL database to (already existing or not).
|
||||||
Could also be a directory, then the database will be stored
|
Could also be a directory, then the database will be stored
|
||||||
using default filename (e.g. 'database.db').
|
using default filename (e.g. 'database.db').
|
||||||
|
:filter_glob database: *.db,*.sqlite
|
||||||
:param full_schema: if True, will create tables for all IFC classes,
|
:param full_schema: if True, will create tables for all IFC classes,
|
||||||
regardless if they are used or not in the dataset. If False, will
|
regardless if they are used or not in the dataset. If False, will
|
||||||
only create tables for classes in the dataset.
|
only create tables for classes in the dataset.
|
||||||
|
|||||||
Reference in New Issue
Block a user