weigan
发布于 2024-09-03 / 59 阅读
0
0

Can solidworks export glb files?

Can solidworks export glb files?

Yes!

Has SolidWorks Started Supporting Exports to GLB/GLTF? 📁✨

I once developed a plugin that exports assemblies or parts to GLTF/GLB. While the performance wasn't great and the functionality was limited, it was at least somewhat usable and received a few stars on GitHub. However, SolidWorks itself has actually had an export feature for some time, but it was never detailed in documentation, only mentioned as available for subscription users. Recently, while researching SolidWorks features, I discovered that this functionality is already included in the installation directory. SolidWorks hasn't provided any instructions on how to use it, so I did some research and am sharing the usage method with everyone.

What are GLB/GLTF?

GLB and GLTF are two file formats used for 3D models and scenes, widely applied in the transmission and display of 3D content on the web and in other applications.

GLTF (GL Transmission Format):

  • Description: GLTF is an open-standard file format primarily used for efficiently transmitting and loading 3D models and scenes.
  • File Structure: A GLTF file is usually a JSON file that describes the geometry, materials, textures, animations, etc., of a 3D model. It can reference external binary files (.bin) and image files (such as PNG, JPEG) to store actual geometry data and textures.
  • Advantages: Due to its JSON-based structure, GLTF files are easy to read and edit, making them convenient for network transmission.

GLB:

  • Description: GLB is the binary version of GLTF, packaging all contents of a GLTF file (including JSON descriptions, binary geometry data, textures, etc.) into a single binary file.
  • File Structure: A GLB file embeds all data into one file, making it more suitable for network transmission as it doesn't require managing multiple external files.
  • Advantages: Since all content is contained in one file, GLB files load faster, making them ideal for applications that require efficient transmission and loading.

Why Export to GLB/GLTF?

To achieve better transmission and display.

How to Export to GLB/GLTF Using SolidWorks ➡️📁

Locate and Load SWXRExporter.DLL

  1. First, open your SolidWorks installation directory. I'm using SolidWorks 2024 for this demonstration; older versions might not have this DLL. If it's missing, your version of SolidWorks might not support saving files as GLTF/GLB.

    Screenshot 2024-08-25 233234.png

  2. Then, open SolidWorks and click the Open button.

    find-swxrexporter.png

  3. Select and click Open.

    swxrexporter-loaded.png

    At this point, you'll see a message indicating it has been loaded.

Export to GLB Using "Save As"

  1. Open a part or assembly, then click File -> Save As, and you'll see the GLB/GLTF options available.

    saveas-glb.png

  2. Here, you can also adjust the options to customize what you want to export.

    saveas-glb-options.png

Export Results

<iframe
    id="inlineFrameExample"
    title="Inline Frame Example"
    width="100%"
    height="400"
    src="/upload/gbl-preview.html"
    allow="scripts">
</iframe>

Displaying the Exported File in WPF 🖥️

Now that you have a GLB file, it's easy to display it in web content, as shown above. If you want to display it in a WPF interface, your options are limited. Below are two methods you can refer to:

1. Using Helix Toolkit

Check out: Helix Toolkit - Model Viewer Example

2. Using WebView2

This project is simpler to use:

manifold.png


评论