Skip to content
Open
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
24 changes: 19 additions & 5 deletions MeshExporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,10 @@ def runMesh(wheelNames):
# Leave this here in case I need to debug again

# Create a graphics group on the root component.
#graphics = rootComp.customGraphicsGroups.add()
# graphics = rootComp.customGraphicsGroups.add()
# Adds Point Graphic
#coord = adsk.fusion.CustomGraphicsCoordinates.create(point.asArray())
#point = graphics.addPointSet(coord, [0], adsk.fusion.CustomGraphicsPointTypes.UserDefinedCustomGraphicsPointType,
# coord = adsk.fusion.CustomGraphicsCoordinates.create(point.asArray())
# point = graphics.addPointSet(coord, [0], adsk.fusion.CustomGraphicsPointTypes.UserDefinedCustomGraphicsPointType,
# 'SelectJoint.png')


Expand All @@ -184,17 +184,25 @@ def runMesh(wheelNames):
originalCam = app.activeViewport.camera
# Move to Up
cam = app.activeViewport.camera
cam.viewOrientation = 10
cam.viewOrientation = adsk.core.ViewOrientations.TopViewOrientation
cam.isSmoothTransition = False
app.activeViewport.camera = cam

adsk.doEvents()
app.activeViewport.refresh()

app.activeViewport.fit()
# Capture Up
cam = app.activeViewport.camera
yVector = returnNormalVector(cam.eye)
# Move to Forward
cam.viewOrientation = 3
cam.viewOrientation = adsk.core.ViewOrientations.FrontViewOrientation
cam.isSmoothTransition = False
app.activeViewport.camera = cam

adsk.doEvents()
app.activeViewport.refresh()

app.activeViewport.fit()
# Capture Forward
cam = app.activeViewport.camera
Expand All @@ -206,6 +214,12 @@ def runMesh(wheelNames):
global newTransform, inverseTransform
newTransform = adsk.core.Matrix3D.create()
origin = adsk.core.Point3D.create(0, 0, 0)
xVector = yVector.crossProduct(zVector)
if xVector.length < 1e-6:
ui.messageBox(f"Invalid coordinate system.\n"
f"yVector: {yVector.x}, {yVector.y}, {yVector.z}\n"
f"zVector: {zVector.x}, {zVector.y}, {zVector.z}")
return False
Comment on lines +218 to +222
newTransform.setToAlignCoordinateSystems(origin, yVector.crossProduct(zVector), yVector, zVector, origin,
adsk.core.Vector3D.create(-1, 0, 0), adsk.core.Vector3D.create(0, 1, 0), adsk.core.Vector3D.create(0, 0, -1))
# Adds on origin as well
Expand Down