Skip to content

Commit e0d9dbd

Browse files
committed
fix: no grounded joint -> progressDialog closes & no traceback
1 parent 75bfa24 commit e0d9dbd

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

exporter/SynthesisFusionAddin/src/ErrorHandling.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ def handle_err_top(func: Callable[..., Result[None]]) -> Callable[..., None]:
129129

130130
def wrapper(*args, **kwargs): # type: ignore
131131
result = func(*args, **kwargs)
132+
132133
if result.is_err():
133134
message, severity = result.unwrap_err()
134135
if severity == ErrorSeverity.Fatal:

exporter/SynthesisFusionAddin/src/Parser/SynthesisParser/JointHierarchy.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import enum
22
import sys
33
from logging import ERROR
4+
from os import error
45
from typing import Any, Iterator, cast
56

67
import adsk.core
@@ -221,7 +222,7 @@ def __init__(self, design: adsk.fusion.Design) -> None:
221222
self.grounded = searchForGrounded(design.rootComponent)
222223

223224
if self.grounded is None:
224-
message = "These is no grounded component in this assembly, aborting kinematic export."
225+
message = "There is not a grounded component in this assembly, aborting kinematic export."
225226
gm.ui.messageBox(message)
226227
_____: Err[None] = Err(message, ErrorSeverity.Fatal)
227228
raise RuntimeError()
@@ -522,12 +523,11 @@ def buildJointPartHierarchy(
522523

523524
return Ok(None)
524525

525-
# I'm fairly certain bubbling this back up is the way to go
526-
except Warning:
527-
return Err(
528-
"Instantiation of the JointParser failed, likely due to a lack of a grounded component in the assembly",
529-
ErrorSeverity.Fatal,
530-
)
526+
# I'm fairly certain bubbling this back up is the way to go <- Actually it's ugly but doesn't really matter and there isn't a better option
527+
except:
528+
progressDialog.progressDialog.hide()
529+
# We don't want two errors to pop up, we exit to prevent dealing with two error messages for the same issue and with re-exporting an empty file
530+
sys.exit(1)
531531

532532

533533
def populateJoint(simNode: SimulationNode, joints: joint_pb2.Joints, progressDialog: PDMessage) -> Result[None]:

exporter/SynthesisFusionAddin/src/UI/ConfigCommand.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,10 @@ def export(exporterOptions: moduleExporterOptions.ExporterOptions) -> None:
361361
exporterOptions.version = docVersion
362362
exporterOptions.materials = 0
363363

364-
Parser.Parser(exporterOptions).export()
364+
try:
365+
Parser.Parser(exporterOptions).export()
366+
except:
367+
return
365368
exporterOptions.writeToDesign()
366369

367370
if exporterOptions.openSynthesisUponExport:
@@ -431,7 +434,10 @@ def notify(self, _: adsk.core.CommandEventArgs) -> None:
431434
try:
432435
Parser.Parser(exporterOptions).export()
433436
except:
434-
pass
437+
jointConfigTab.reset()
438+
gamepieceConfigTab.reset()
439+
440+
return
435441
exporterOptions.writeToDesign()
436442
jointConfigTab.reset()
437443
gamepieceConfigTab.reset()

0 commit comments

Comments
 (0)