diff --git a/bluemira/codes/_freecadapi.py b/bluemira/codes/_freecadapi.py index 22adb94c17..d8fd4d8085 100644 --- a/bluemira/codes/_freecadapi.py +++ b/bluemira/codes/_freecadapi.py @@ -19,10 +19,7 @@ from functools import wraps from pathlib import Path from types import DynamicClassAttribute -from typing import ( - TYPE_CHECKING, - Protocol, -) +from typing import TYPE_CHECKING, Protocol from unittest import mock import FreeCAD @@ -1292,7 +1289,7 @@ def manual_mesh_formats(cls) -> tuple[CADFileType, ...]: @classmethod def not_importable_formats(cls) -> tuple[CADFileType, ...]: - return () + return (cls.ADDITIVE_MANUFACTURING, cls.WEBGL, cls.JSON) @classmethod def mesh_import_formats(cls) -> tuple[CADFileType, ...]: @@ -1348,7 +1345,7 @@ def FreeCADreader(filename, document, **kwargs): # noqa: ARG001 FreeCAD.getDocument(document).mergeProject(filename) return FreeCADreader - if self in {self.ADDITIVE_MANUFACTURING, self.WEBGL, self.JSON}: + if self in self.not_importable_formats(): raise NotImplementedError(f"{self.name} import not implemented in FreeCAD") modlist = self.import_module.split(".") msg = "Unable to import from {} please try through the main FreeCAD GUI" diff --git a/bluemira/codes/_freecadconfig.py b/bluemira/codes/_freecadconfig.py index 9f10df142e..71b89a3111 100644 --- a/bluemira/codes/_freecadconfig.py +++ b/bluemira/codes/_freecadconfig.py @@ -64,6 +64,11 @@ def _freecad_save_config( # Seems to have little effect on anything but its an option to set part_step_prefs.SetInt("Unit", _Unit[unit].value) + part_step_2_prefs = FreeCAD.ParamGet( + "User parameter:BaseApp/Preferences/Mod/Import/hSTEP" + ) + part_step_2_prefs.SetBool("ReadShapeCompoundMode", False) # noqa: FBT003 + part_iges_prefs = FreeCAD.ParamGet( "User parameter:BaseApp/Preferences/Mod/Part/IGES" ) @@ -79,3 +84,4 @@ def _freecad_save_config( import_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Import") import_prefs.SetInt("ImportMode", 0) import_prefs.SetBool("ExportLegacy", False) # noqa: FBT003 + import_prefs.SetBool("ExpandCompound", True) # noqa: FBT003