Skip to content

Fixed Cross Product Being Zero on Mesh Export#8

Open
OliverW1986 wants to merge 1 commit into
Virtual-FTC:mainfrom
OliverW1986:main
Open

Fixed Cross Product Being Zero on Mesh Export#8
OliverW1986 wants to merge 1 commit into
Virtual-FTC:mainfrom
OliverW1986:main

Conversation

@OliverW1986

Copy link
Copy Markdown

Integrated a fix that gets the correct X, Y, and Z vectors when exporting the meshes, properly captures the camera positions, resets them along with a check for whether the cross product is zero, and returns false if it is.

Copilot AI review requested due to automatic review settings June 11, 2026 21:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the mesh export workflow to use explicit Fusion 360 view orientation enums, ensure viewport updates before capturing camera vectors, and add validation for degenerate coordinate systems.

Changes:

  • Replaced numeric viewOrientation values with adsk.core.ViewOrientations constants.
  • Forced viewport event processing/refresh after camera changes before fitting/capturing vectors.
  • Added a guard for degenerate yVector × zVector when building the alignment transform.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread MeshExporter.py
app.activeViewport.fit()
# Capture Up
cam = app.activeViewport.camera
yVector = returnNormalVector(cam.eye)
Comment thread MeshExporter.py
global newTransform, inverseTransform
newTransform = adsk.core.Matrix3D.create()
origin = adsk.core.Point3D.create(0, 0, 0)
xVector = yVector.crossProduct(zVector)
Comment thread MeshExporter.py
f"yVector: {yVector.x}, {yVector.y}, {yVector.z}\n"
f"zVector: {zVector.x}, {zVector.y}, {zVector.z}")
return False
newTransform.setToAlignCoordinateSystems(origin, yVector.crossProduct(zVector), yVector, zVector, origin,
Comment thread MeshExporter.py
Comment on lines +218 to +222
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants