Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open Synthesis Upon Export [AARD-1772] #1102

Merged
merged 2 commits into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class ExporterOptions:
exportAsPart: bool = field(default=False)

exportLocation: ExportLocation = field(default=ExportLocation.UPLOAD)
openSynthesisUponExport: bool = field(default=False)

hierarchy: ModelHierarchy = field(default=ModelHierarchy.FusionAssembly)
visualQuality: TriangleMeshQualityOptions = field(default=TriangleMeshQualityOptions.LowQualityTriangleMesh)
Expand Down
9 changes: 8 additions & 1 deletion exporter/SynthesisFusionAddin/src/UI/ConfigCommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@

import os
import pathlib
import webbrowser
from enum import Enum
from typing import Any

import adsk.core
import adsk.fusion

from src import gm
from src import APP_WEBSITE_URL, gm
from src.APS.APS import getAuth, getUserInfo
from src.Logging import getLogger, logFailure
from src.Parser.ExporterOptions import ExporterOptions
Expand Down Expand Up @@ -348,6 +349,7 @@ def notify(self, args: adsk.core.CommandEventArgs) -> None:
exportAsPart=generalConfigTab.exportAsPart,
frictionOverride=generalConfigTab.overrideFriction,
frictionOverrideCoeff=generalConfigTab.frictionOverrideCoeff,
openSynthesisUponExport=generalConfigTab.openSynthesisUponExport,
)

Parser(exporterOptions).export()
Expand All @@ -359,6 +361,11 @@ def notify(self, args: adsk.core.CommandEventArgs) -> None:
jointConfigTab.reset()
gamepieceConfigTab.reset()

if generalConfigTab.openSynthesisUponExport:
res = webbrowser.open(APP_WEBSITE_URL)
if not res:
gm.ui.messageBox("Failed to open Synthesis in your default browser.")


class CommandExecutePreviewHandler(adsk.core.CommandEventHandler):
"""### Gets an event that is fired when the command has completed gathering the required input and now needs to perform a preview.
Expand Down
15 changes: 15 additions & 0 deletions exporter/SynthesisFusionAddin/src/UI/GeneralConfigTab.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@ def __init__(self, args: adsk.core.CommandCreatedEventArgs, exporterOptions: Exp
frictionCoefficient.tooltip = "<i>Friction coefficients range from 0 (ice) to 1 (rubber).</i>"
frictionCoefficient.isVisible = exporterOptions.frictionOverride

createBooleanInput(
"openSynthesisOnExportButton",
"Open Synthesis on Export",
generalTabInputs,
checked=exporterOptions.openSynthesisUponExport,
tooltip="Launch the Synthesis website upon export.",
)

if exporterOptions.exportMode == ExportMode.FIELD:
autoCalcWeightButton.isVisible = False
exportAsPartButton.isVisible = False
Expand Down Expand Up @@ -231,6 +239,13 @@ def frictionOverrideCoeff(self) -> float:
)
return frictionSlider.valueOne or -1.0

@property
def openSynthesisUponExport(self) -> bool:
openSynthesisButton: adsk.core.BoolValueCommandInput = self.generalOptionsTab.children.itemById(
"openSynthesisOnExportButton"
)
return openSynthesisButton.value or False

@logFailure
def handleInputChanged(self, args: adsk.core.InputChangedEventArgs) -> None:
autoCalcWeightButton: adsk.core.BoolValueCommandInput = args.inputs.itemById("autoCalcWeightButton")
Expand Down
1 change: 1 addition & 0 deletions exporter/SynthesisFusionAddin/src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

APP_NAME = "Synthesis"
APP_TITLE = "Synthesis Robot Exporter"
APP_WEBSITE_URL = "https://synthesis.autodesk.com/fission/"

Check notice on line 10 in exporter/SynthesisFusionAddin/src/__init__.py

View check run for this annotation

Autodesk Chorus / privacy/bearer

internal_service.: https://synthesis.autodesk.com/fission/

This check is currently in beta. - Personal Data at Autodesk: https://share.autodesk.com/:b:/r/sites/LegalTopicsToolkits/Shared%20Documents/Personal%20Data%20at%20Autodesk.pdf - Data Privacy & Governance Policies at Autodesk: https://share.autodesk.com/sites/DPG/SitePages/Policies-%26-Guidelines.aspx
DESCRIPTION = "Exports files from Fusion into the Synthesis Format"
INTERNAL_ID = "Synthesis"
ADDIN_PATH = os.path.dirname(os.path.realpath(__file__))
Expand Down
Loading