Skip to content

Commit

Permalink
Merge dev
Browse files Browse the repository at this point in the history
  • Loading branch information
BrandonPacewic committed Aug 13, 2024
2 parents 1138854 + 309c287 commit f73a9f5
Show file tree
Hide file tree
Showing 70 changed files with 2,966 additions and 1,338 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/FissionUnitTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
with:
path: |
~/.cache/ms-playwright/
key: ${{ runner.os }}-assets-playwright-${{ env.PLAYWRIGHT_VERSION }}
key: ${{ runner.os }}-assets-playwright-${{ env.PLAYWRIGHT_VERSION }}-v2

- name: Install Dependencies
run: |
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "mirabuf"]
path = mirabuf
url = https://github.com/HiceS/mirabuf.git
[submodule "jolt"]
path = jolt
url = https://github.com/HunterBarclay/JoltPhysics.js.git
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ All code is under a configured formatting utility. See each component for more d

Mirabuf is a file format we use to store physical data from Fusion to load into the Synthesis simulator (Fission). This is a separate project that is a submodule of Synthesis. [See Mirabuf](https://github.com/HiceS/mirabuf/)

### Jolt Physics

Jolt is the core physics engine for our web biased simulator. [See JoltPhysics.js](https://github.com/HunterBarclay/JoltPhysics.js) for more information.

### Tutorials

Our source code for the tutorials featured on our [Tutorials Page](https://synthesis.autodesk.com/tutorials.html).
Expand Down
17 changes: 8 additions & 9 deletions exporter/SynthesisFusionAddin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,14 @@ We use `VSCode` Primarily, download it to interact with our code or use your own

### How to Build + Run

1. See root [`README`](/README.md) on how to run `init` script
2. Open `Autodesk Fusion`
3. Select `UTILITIES` from the top bar
4. Click `ADD-INS` Button
5. Click `Add-Ins` tab at the top of Scripts and Add-Ins dialog
6. Press + Button under **My Add-Ins**
7. Navigate to the containing folder for this Addin and click open at bottom - _clone-directory_/synthesis/exporters/SynthesisFusionAddin
8. Synthesis should be an option - select it and click run at the bottom of the dialog
9. There should now be a button that says Synthesis in your utilities menu
1. Open `Autodesk Fusion`
2. Select `UTILITIES` from the top bar
3. Click `ADD-INS` Button
4. Click `Add-Ins` tab at the top of Scripts and Add-Ins dialog
5. Press + Button under **My Add-Ins**
6. Navigate to the containing folder for this Addin and click open at bottom - _clone-directory_/synthesis/exporters/SynthesisFusionAddin
7. Synthesis should be an option - select it and click run at the bottom of the dialog
8. There should now be a button that says Synthesis in your utilities menu
- If there is no button there may be a problem - see below for [checking log file](#debug-non-start)

---
Expand Down
13 changes: 10 additions & 3 deletions exporter/SynthesisFusionAddin/Synthesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

# Required for absolute imports.
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "proto", "proto_out")))

from src.Dependencies import resolveDependencies
from src.Logging import logFailure, setupLogger
Expand All @@ -15,9 +14,17 @@

try:
# Attempt to import required pip dependencies to verify their installation.
import google.protobuf
import requests
except (ImportError, ModuleNotFoundError) as error:

from src.Proto import (
assembly_pb2,
joint_pb2,
material_pb2,
motor_pb2,
signal_pb2,
types_pb2,
)
except (ImportError, ModuleNotFoundError, BaseException) as error: # BaseException required to catch proto.VersionError
logger.warn(f"Running resolve dependencies with error of:\n{error}")
result = resolveDependencies()
if result:
Expand Down
2 changes: 2 additions & 0 deletions exporter/SynthesisFusionAddin/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ skip = [
".vscode/",
"/dist/",
"proto/proto_out",
"src/Proto",
]

[tool.black]
Expand All @@ -30,6 +31,7 @@ exclude = '''
| .vscode
| dist
| proto_out
| src/Proto
)/
)
'''
17 changes: 0 additions & 17 deletions exporter/SynthesisFusionAddin/src/Dependencies.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import importlib.machinery
import importlib.util
import os
import subprocess
import sys
Expand Down Expand Up @@ -56,18 +55,6 @@ def executeCommand(*args: str) -> subprocess.CompletedProcess[str]:
raise error


@logFailure
def verifyCompiledProtoImports() -> bool:
protoModules = ["assembly_pb2", "joint_pb2", "material_pb2", "types_pb2"]
for module in protoModules:
# Absolute imports must be set up by this point for importlib to be able to find each module.
spec = importlib.util.find_spec(f"proto.proto_out.{module}")
if spec is None:
return False

return True


def getInstalledPipPackages(pythonExecutablePath: str) -> dict[str, str]:
result: str = executeCommand(pythonExecutablePath, "-m", "pip", "freeze").stdout
# We don't need to check against packages with a specific hash as those are not required by Synthesis.
Expand All @@ -87,10 +74,6 @@ def packagesOutOfDate(installedPackages: dict[str, str]) -> bool:
def resolveDependencies() -> bool | None:
app = adsk.core.Application.get()
ui = app.userInterface
if not verifyCompiledProtoImports():
ui.messageBox("Missing required compiled protobuf files.")
return False

if app.isOffLine:
# If we have gotten this far that means that an import error was thrown for possible missing
# dependencies... And we can't try to download them because we have no internet... ¯\_(ツ)_/¯
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import adsk.core
import adsk.fusion

from proto.proto_out import assembly_pb2, joint_pb2, material_pb2, types_pb2
from src.Logging import logFailure
from src.Parser.ExporterOptions import ExporterOptions
from src.Parser.SynthesisParser import PhysicalProperties
Expand All @@ -12,6 +11,7 @@
guid_component,
guid_occurrence,
)
from src.Proto import assembly_pb2, joint_pb2, material_pb2, types_pb2
from src.Types import ExportMode

# TODO: Impelement Material overrides
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
import adsk.core
import adsk.fusion

from proto.proto_out import joint_pb2, types_pb2
from src import gm
from src.Logging import getLogger, logFailure
from src.Parser.ExporterOptions import ExporterOptions
from src.Parser.SynthesisParser.PDMessage import PDMessage
from src.Parser.SynthesisParser.Utilities import guid_component, guid_occurrence
from src.Proto import joint_pb2, types_pb2

logger = getLogger()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import adsk.core
import adsk.fusion

from proto.proto_out import assembly_pb2, joint_pb2, signal_pb2, types_pb2
from src.Logging import getLogger
from src.Parser.ExporterOptions import ExporterOptions
from src.Parser.SynthesisParser.PDMessage import PDMessage
Expand All @@ -38,6 +37,7 @@
fill_info,
guid_occurrence,
)
from src.Proto import assembly_pb2, joint_pb2, signal_pb2, types_pb2
from src.Types import Joint, JointParentType, SignalType, Wheel

logger = getLogger()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import adsk.core

from proto.proto_out import material_pb2
from src.Logging import logFailure
from src.Parser.ExporterOptions import ExporterOptions
from src.Parser.SynthesisParser.PDMessage import PDMessage
from src.Parser.SynthesisParser.Utilities import construct_info, fill_info
from src.Proto import material_pb2

OPACITY_RAMPING_CONSTANT = 14.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import adsk.fusion
from google.protobuf.json_format import MessageToJson

from proto.proto_out import assembly_pb2, types_pb2
from src import gm
from src.APS.APS import getAuth, upload_mirabuf
from src.Logging import getLogger, logFailure, timed
Expand All @@ -18,6 +17,7 @@
PDMessage,
)
from src.Parser.SynthesisParser.Utilities import fill_info
from src.Proto import assembly_pb2, types_pb2
from src.Types import ExportLocation, ExportMode
from src.UI.Camera import captureThumbnail, clearIconCache

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

import adsk

from proto.proto_out import types_pb2
from src.Logging import logFailure
from src.Proto import types_pb2


@logFailure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import adsk.core
import adsk.fusion

from proto.proto_out import assembly_pb2
from src.Logging import logFailure
from src.Proto import assembly_pb2


# Transition: AARD-1765
Expand Down
4 changes: 4 additions & 0 deletions exporter/SynthesisFusionAddin/src/Proto/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import os
import sys

sys.path.append(os.path.dirname(os.path.abspath(__file__)))
65 changes: 65 additions & 0 deletions exporter/SynthesisFusionAddin/src/Proto/assembly_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f73a9f5

Please sign in to comment.