Skip to content

Commit

Permalink
🎨 Minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
je-cook committed Jun 24, 2024
1 parent 9afe676 commit c6d2c18
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
9 changes: 3 additions & 6 deletions bluemira/codes/_freecadapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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, ...]:
Expand Down Expand Up @@ -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")

Check warning on line 1349 in bluemira/codes/_freecadapi.py

View check run for this annotation

Codecov / codecov/patch

bluemira/codes/_freecadapi.py#L1349

Added line #L1349 was not covered by tests
modlist = self.import_module.split(".")
msg = "Unable to import from {} please try through the main FreeCAD GUI"
Expand Down
6 changes: 6 additions & 0 deletions bluemira/codes/_freecadconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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

0 comments on commit c6d2c18

Please sign in to comment.