Exporting to STL Discrepancy? (Different STL file size when exported manually in Fusion vs with the API)

Exporting to STL Discrepancy? (Different STL file size when exported manually in Fusion vs with the API)

knightsAHN63
Participant Participant
2,527 Views
8 Replies
Message 1 of 9

Exporting to STL Discrepancy? (Different STL file size when exported manually in Fusion vs with the API)

knightsAHN63
Participant
Participant

Hello! We are running into some file size issues when running an add-in we are developing. The goal is to export the main body (‘ShellBody’) as an STL with custom export settings. When this is done directly in Fusion, we get a resultant STL file with a size of ~4MB. When the same action is done via the API, we get a resultant STL file with a size of ~58MB. I’ve included screenshots of the settings used in Fusion and the code in our add-in script. Screenshots are attached of the addin code vs manual selection on Fusion. Does anyone know why there is such a large discrepancy between the two methods? Insight it would be much appreciated!

0 Likes
Accepted solutions (1)
2,528 Views
8 Replies
Replies (8)
Message 2 of 9

JeromeBriot
Mentor
Mentor

Hello,

 

Did you try to import the two STL files into Meshmixer to compare the meshes?

 

Can you share the two STL files?

 

Message 3 of 9

MichaelT_123
Advisor
Advisor

Hi Mrs. KinghtsAHN63,

 

 STL files came in two forms: binary and ASCII.

How to select the proper one?

STLExportOptions Object

isBinaryFormatIndicates if the STL file is to be an ASCII or binary STL format. The default is true.

 

Regards

MichaelT

 

MichaelT
0 Likes
Message 4 of 9

knightsAHN63
Participant
Participant

Hi Michael,

Both STL files were exported in Binary format, you can see the line of code in the second screenshot that I attached. I have attached two 'cube' examples to this reply as well, you can see the one exported in Fusion with the same settings is 57kb and the one using the API is 4,895kb.
Code is:
stlExportOptions = exportManager.createSTLExportOptions(root, fileName)
stlExportOptions.isBinaryFormat = True
stlExportOptions.meshRefinement = 3
stlExportOptions.surfaceDeviation = 0.004 # Units: Centimeters
stlExportOptions.normalDeviation = 0.199927 # Units: Radians
stlExportOptions.maximumEdgeLength = 2.1 # Units: Centimeters
stlExportOptions.aspectRatio = 3.795

File exported from Fusion has same settings as described above^

0 Likes
Message 5 of 9

knightsAHN63
Participant
Participant

Hi Jerome,

For sure, please find attached! Just opened in Meshmixer and definitely the API one looks 'crisper'... trying to understand what is causing the discrepancy. Here are two 'cube' examples, the one directly from Fusion is 57KB and the one from the API is 4,895KB. Please let me know if you have any ideas, thank you!

Code is:
stlExportOptions = exportManager.createSTLExportOptions(root, fileName)
stlExportOptions.isBinaryFormat = True
stlExportOptions.meshRefinement = 3
stlExportOptions.surfaceDeviation = 0.004 # Units: Centimeters
stlExportOptions.normalDeviation = 0.199927 # Units: Radians
stlExportOptions.maximumEdgeLength = 2.1 # Units: Centimeters
stlExportOptions.aspectRatio = 3.795

File exported from Fusion has same settings as described above^

0 Likes
Message 6 of 9

JeromeBriot
Mentor
Mentor
Accepted solution

Try specifying the length values in millimeters instead of centimeters :

 

stlExportOptions.maximumEdgeLength = 21 # Units: Millimeters 

 

This is a bug because according to the documentation, these values must be expressed in centimeters…

 

Message 7 of 9

hfcandrew
Advisor
Advisor

Look at the wire frame: https://autode.sk/3KYLULa

 

1156 triangles vs 100244 triangles

Message 8 of 9

knightsAHN63
Participant
Participant

This was it! Thank you so much for catching this! Definitely a bug... but put in the mm equivalent and Voilà, matching files. Thank you again!

0 Likes
Message 9 of 9

knightsAHN63
Participant
Participant

Thanks for the heads up on what to look for! Replicated this, so definitely a difference in the files, and then tried using mm for the edge length (stlExportOptions.maximumEdgeLength) and fixed the problem. Phew! Great to know how to use the wireframe feature in MeshMixer for future checking though.

0 Likes