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

AARD-1685: Joint Config Panel #995

Merged
merged 24 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
55acf65
Working new joint config tab
BrandonPacewic Jun 25, 2024
fdb0076
Updated transition comments and removed replaced code
BrandonPacewic Jun 25, 2024
84ad27c
Merge `dev`
BrandonPacewic Jun 25, 2024
837d83c
Handled transition tags
BrandonPacewic Jun 25, 2024
90f96c9
Readabliity cleanups
BrandonPacewic Jun 25, 2024
f77570e
Load saved joint settings
BrandonPacewic Jun 26, 2024
57d6b93
Restored unintentional formatting changes
BrandonPacewic Jun 26, 2024
5adcd67
Added confirm joint removal prompt
BrandonPacewic Jun 26, 2024
7c2c2a9
Added joint select cancel button
BrandonPacewic Jun 26, 2024
818e784
Created new table under joint select that autopopulates with selected…
BrandonPacewic Jun 27, 2024
5cd297e
Working link between joints and wheels
BrandonPacewic Jun 28, 2024
c3b3638
Merge `dev`
BrandonPacewic Jun 28, 2024
4ca5692
Moved event handles into seperate files
BrandonPacewic Jul 1, 2024
0f88cee
Classified Joint config table
BrandonPacewic Jul 1, 2024
f1c318b
Removed replaced code and handled transition tags
BrandonPacewic Jul 1, 2024
3bfb556
Bogus bug fixes
BrandonPacewic Jul 1, 2024
35c3820
Added typing and improved comments + formatting
BrandonPacewic Jul 1, 2024
19abf60
Last bit of formatting
BrandonPacewic Jul 1, 2024
004f857
Cleanup catches and try except logging
BrandonPacewic Jul 1, 2024
9a099f2
Helper module logging updates
BrandonPacewic Jul 1, 2024
b30c1f5
Fixed a bug for Hunter's computer only :(
BrandonPacewic Jul 12, 2024
9a35c0a
Fix: Reset select cursor back to normal after joint selection
BrandonPacewic Jul 18, 2024
6d438c4
Merge `dev`
BrandonPacewic Jul 19, 2024
5285fad
Resolve merge conflict from `dev`
BrandonPacewic Jul 19, 2024
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
38 changes: 25 additions & 13 deletions exporter/SynthesisFusionAddin/src/Parser/ExporterOptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# Not 100% sure what this is for - Brandon
JointParentType = Enum("JointParentType", ["ROOT", "END"])

WheelType = Enum("WheelType", ["STANDARD", "OMNI"])
WheelType = Enum("WheelType", ["STANDARD", "OMNI", "MECANUM"])
SignalType = Enum("SignalType", ["PWM", "CAN", "PASSIVE"])
ExportMode = Enum("ExportMode", ["ROBOT", "FIELD"]) # Dynamic / Static export
PreferredUnits = Enum("PreferredUnits", ["METRIC", "IMPERIAL"])
Expand All @@ -39,6 +39,12 @@ class Joint:
speed: float = field(default=None)
force: float = field(default=None)

# Transition: AARD-1865
# Should consider changing how the parser handles wheels and joints as there is overlap between
# `Joint` and `Wheel` that should be avoided
# This overlap also presents itself in 'ConfigCommand.py' and 'JointConfigTab.py'
isWheel: bool = field(default=False)


@dataclass
class Gamepiece:
Expand Down Expand Up @@ -77,7 +83,10 @@ class ModelHierarchy(Enum):

@dataclass
class ExporterOptions:
fileLocation: str = field(
# Python's `os` module can return `None` when attempting to find the home directory if the
# user's computer has conflicting configs of some sort. This has happened and should be accounted
# for accordingly.
fileLocation: str | None = field(
default=(os.getenv("HOME") if platform.system() == "Windows" else os.path.expanduser("~"))
)
name: str = field(default=None)
Expand All @@ -100,18 +109,21 @@ class ExporterOptions:
physicalDepth: PhysicalDepth = field(default=PhysicalDepth.AllOccurrence)
physicalCalculationLevel: CalculationAccuracy = field(default=CalculationAccuracy.LowCalculationAccuracy)

def readFromDesign(self) -> None:
designAttributes = adsk.core.Application.get().activeProduct.attributes
for field in fields(self):
attribute = designAttributes.itemByName(INTERNAL_ID, field.name)
if attribute:
setattr(
self,
field.name,
self._makeObjectFromJson(field.type, json.loads(attribute.value)),
)
def readFromDesign(self) -> "ExporterOptions":
try:
designAttributes = adsk.core.Application.get().activeProduct.attributes
for field in fields(self):
attribute = designAttributes.itemByName(INTERNAL_ID, field.name)
if attribute:
setattr(
self,
field.name,
self._makeObjectFromJson(field.type, json.loads(attribute.value)),
)

return self
return self
except:
return ExporterOptions()

def writeToDesign(self) -> None:
designAttributes = adsk.core.Application.get().activeProduct.attributes
Expand Down
Loading
Loading