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

Friction Data Export #1014

Merged
merged 26 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e0c28d9
added friction override to exporter options
azaleacolburn Jun 28, 2024
1a11e52
added friction override to exporter options
azaleacolburn Jul 1, 2024
3e8054c
added friction options exportation to config command
azaleacolburn Jul 1, 2024
7ee0684
Merge branch 'dev' of https://github.com/Autodesk/synthesis into colb…
azaleacolburn Jul 2, 2024
393f618
upload broken code for brandon to debug (tysm)
azaleacolburn Jul 3, 2024
4a3337d
tested and fixed friction override exportation from config command
azaleacolburn Jul 3, 2024
d4d118a
added friction override to mirabuf assembly
azaleacolburn Jul 4, 2024
01aa9dd
added export location
azaleacolburn Jul 5, 2024
4b92b61
Revert "added export location"
azaleacolburn Jul 5, 2024
4cff486
ran formatter
azaleacolburn Jul 8, 2024
64567e7
Merge branch 'dev' of https://github.com/Autodesk/synthesis into colb…
azaleacolburn Jul 11, 2024
be4426c
move friction override serialization
azaleacolburn Jul 12, 2024
0f29963
move friction override to materials
azaleacolburn Jul 12, 2024
ddac7fe
pass in options correctly
azaleacolburn Jul 12, 2024
85ddf0b
export aps auth from strings
azaleacolburn Jul 12, 2024
363438c
add curr_time to another place it was missing
azaleacolburn Jul 12, 2024
0b49cd2
added friction override to parsing
azaleacolburn Jul 18, 2024
c622a42
Merge branch 'dev' of https://github.com/Autodesk/synthesis into colb…
azaleacolburn Jul 22, 2024
9a6cbeb
Merge branch 'dev' of https://github.com/Autodesk/synthesis into colb…
azaleacolburn Jul 24, 2024
42154ce
fixed double button and physical material misnaming
azaleacolburn Jul 24, 2024
c777ef9
ran formatter
azaleacolburn Jul 24, 2024
3b17c5a
fix friction override
azaleacolburn Jul 25, 2024
78fab85
Fixed bug with fusion material overrides
BrandonPacewic Jul 25, 2024
361e25f
Merge `dev`
BrandonPacewic Jul 25, 2024
8c9bb18
General cleanups
BrandonPacewic Jul 25, 2024
b32c9f5
Did not mean to add this
BrandonPacewic Jul 25, 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
3 changes: 3 additions & 0 deletions exporter/SynthesisFusionAddin/src/Parser/ExporterOptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ class ExporterOptions:
# Always stored in kg regardless of 'preferredUnits'
robotWeight: KG = field(default=0.0)

frictionOverride: bool = field(default=False)
frictionOverrideCoeff: float | None = field(default=None)

compressOutput: bool = field(default=True)
exportAsPart: bool = field(default=False)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Should contain Physical and Apperance materials ?
import json
import logging
import math
import traceback
Expand All @@ -7,22 +8,39 @@

from proto.proto_out import material_pb2

from ...general_imports import INTERNAL_ID
from ...general_imports import *
from ...Logging import logFailure, timed
from ..ExporterOptions import ExporterOptions
from .PDMessage import PDMessage
from .Utilities import *

OPACITY_RAMPING_CONSTANT = 14.0

# Update tables as needed for UX and needed materials
STATIC_FRICTION_COEFFS = {
"Aluminum": 1.1,
"Steel, Cast": 0.75,
"Steel, Mild": 0.75,
"Rubber, Nitrile": 1.0,
"ABS Plastic": 0.7,
}

DYNAMIC_FRICTION_COEFFS = {
"Aluminum": 1.1,
"Steel, Cast": 0.75,
"Steel, Mild": 0.75,
"Rubber, Nitrile": 1.0,
"ABS Plastic": 0.7,
}


def _MapAllPhysicalMaterials(
physicalMaterials: list,
materials: material_pb2.Materials,
options: ExporterOptions,
progressDialog: PDMessage,
) -> None:
setDefaultMaterial(materials.physicalMaterials["default"])
setDefaultMaterial(materials.physicalMaterials["default"], options)

for material in physicalMaterials:
progressDialog.addMaterial(material.name)
Expand All @@ -34,15 +52,19 @@ def _MapAllPhysicalMaterials(
getPhysicalMaterialData(material, newmaterial, options)


def setDefaultMaterial(physical_material: material_pb2.PhysicalMaterial):
def setDefaultMaterial(physical_material: material_pb2.PhysicalMaterial, options: ExporterOptions):
construct_info("default", physical_material)

physical_material.description = "A default physical material"
physical_material.dynamic_friction = 0.5
physical_material.static_friction = 0.5
if options.frictionOverride:
physical_material.dynamic_friction = options.frictionOverrideCoeff
physical_material.static_friction = options.frictionOverrideCoeff
else:
physical_material.dynamic_friction = 0.5
physical_material.static_friction = 0.5

physical_material.restitution = 0.5
physical_material.deformable = False

physical_material.matType = 0


Expand All @@ -66,10 +88,14 @@ def getPhysicalMaterialData(fusion_material, proto_material, options):
mechanicalProperties = proto_material.mechanical
strengthProperties = proto_material.strength

proto_material.dynamic_friction = 0.5
proto_material.static_friction = 0.5
proto_material.restitution = 0.5
if options.frictionOverride:
proto_material.dynamic_friction = options.frictionOverrideCoeff
proto_material.static_friction = options.frictionOverrideCoeff
else:
proto_material.dynamic_friction = DYNAMIC_FRICTION_COEFFS.get(fusion_material.name, 0.5)
proto_material.static_friction = STATIC_FRICTION_COEFFS.get(fusion_material.name, 0.5)

proto_material.restitution = 0.5
proto_material.description = f"{fusion_material.name} exported from FUSION"

"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ def export(self) -> None:

# Physical Props here when ready

# ts = time()

progressDialog = app.userInterface.createProgressDialog()
progressDialog.cancelButtonText = "Cancel"
progressDialog.isBackgroundTranslucent = False
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 13 additions & 2 deletions exporter/SynthesisFusionAddin/src/UI/ConfigCommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

import os
import pathlib
import traceback
from enum import Enum

import adsk.core
Expand Down Expand Up @@ -461,7 +461,7 @@ def notify(self, args):
"friction_override",
"Friction Override",
physics_settings,
checked=True, # object is missing attribute
checked=True,
tooltip="Manually override the default friction values on the bodies in the assembly.",
enabled=True,
isCheckBox=False,
Expand Down Expand Up @@ -874,6 +874,15 @@ def notify(self, args):
.children.itemById("export_as_part")
).value

frictionOverrideSlider = (
eventArgs.command.commandInputs.itemById("advanced_settings")
.children.itemById("physics_settings")
.children.itemById("friction_override_coeff")
)

frictionOverride = frictionOverrideSlider.isVisible
frictionOverrideCoeff = frictionOverrideSlider.valueOne

exporterOptions = ExporterOptions(
savepath,
name,
Expand All @@ -888,6 +897,8 @@ def notify(self, args):
exportLocation=_location,
compressOutput=compress,
exportAsPart=export_as_part_boolean,
frictionOverride=frictionOverride,
frictionOverrideCoeff=frictionOverrideCoeff,
)

Parser(exporterOptions).export()
Expand Down
9 changes: 9 additions & 0 deletions fission/src/mirabuf/MirabufParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,15 @@ class MirabufParser {
directedRecursive(this._rigidNodes[0].id)
}
this._directedGraph = directedGraph

// Transition: GH-1014
const partDefinitions: { [k: string]: mirabuf.IPartDefinition } | null | undefined =
this.assembly.data?.parts?.partDefinitions
if (!partDefinitions) {
console.log("Failed to get part definitions")
return
}
console.log(partDefinitions)
}

private NewRigidNode(suffix?: string): RigidNode {
Expand Down
Loading