Skip to content

Commit 6f2a8a4

Browse files
committed
fix: no grounded joint -> progressDialog closes & no trackback
1 parent ba33075 commit 6f2a8a4

File tree

4 files changed

+26
-10
lines changed

4 files changed

+26
-10
lines changed

exporter/SynthesisFusionAddin/src/ErrorHandling.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,19 @@ 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:
136+
logger.debug("Testing1")
137+
logger.log(ErrorSeverity.Error.value, "Testing1")
135138
app = adsk.core.Application.get()
136139
app.userInterface.messageBox(f"Fatal Error Encountered {message}")
140+
logger.debug(f"Failed Function name: {func.__name__}" )
141+
logger.debug("Testing")
142+
if func.__name__ == "__init__":
143+
dialog = arg[5]
144+
if dialog is not None:
145+
dialog.hide()
137146

138147
return wrapper

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import enum
2+
from os import error
23
import sys
34
from logging import ERROR
45
from typing import Any, Iterator, cast
@@ -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,13 +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-
)
531-
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)
532531

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

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def export(self) -> None:
6868

6969
# Physical Props here when ready
7070

71+
global progressDialog
7172
progressDialog = app.userInterface.createProgressDialog()
7273
progressDialog.cancelButtonText = "Cancel"
7374
progressDialog.isBackgroundTranslucent = False
@@ -89,6 +90,7 @@ def export(self) -> None:
8990
design.appearances.count, # this is very high for some reason
9091
progressDialog,
9192
)
93+
9294

9395
Materials.mapAllAppearances(
9496
design.appearances,

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)