From 8c1d9858936cb05e0fc9be9f80f9307ddfd0778d Mon Sep 17 00:00:00 2001 From: BrandonPacewic <92102436+BrandonPacewic@users.noreply.github.com> Date: Wed, 28 Aug 2024 20:23:51 -0700 Subject: [PATCH] Updated file naming to account for multi word design names --- exporter/SynthesisFusionAddin/src/UI/ConfigCommand.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/exporter/SynthesisFusionAddin/src/UI/ConfigCommand.py b/exporter/SynthesisFusionAddin/src/UI/ConfigCommand.py index 1474c4090..5f4704b84 100644 --- a/exporter/SynthesisFusionAddin/src/UI/ConfigCommand.py +++ b/exporter/SynthesisFusionAddin/src/UI/ConfigCommand.py @@ -3,6 +3,7 @@ """ import os +import re import webbrowser from typing import Any @@ -123,12 +124,10 @@ def notify(self, _: adsk.core.CommandEventArgs) -> None: design = adsk.fusion.Design.cast(adsk.core.Application.get().activeProduct) exporterOptions = ExporterOptions().readFromDesign() - designNameSplit = design.rootComponent.name.split(" ") - if len(designNameSplit) > 1: - docName, docVersion = designNameSplit[:2] - else: - docName = designNameSplit[0] - docVersion = "v0" + fullName = design.rootComponent.name + versionMatch = re.search(r"v\d+", fullName) + docName = (fullName[: versionMatch.start()].strip() if versionMatch else fullName).replace(" ", "_") + docVersion = versionMatch.group() if versionMatch else "v0" processedFileName = gm.app.activeDocument.name.replace(" ", "_") defaultFileName = f"{'_'.join([docName, docVersion])}.mira"