Example Code

Add an STL file to 3D scene using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview
This VI demonstrates how to use the "Load STL Geometry" VI to load an STL file into a 3D picture.

 

Description
Here is a brief description of the example:

This is an updated version of the LabVIEW 8.6 code written by NKannen - https://decibel.ni.com/content/docs/DOC-6033

Some of the 3D picture functionality has changed since LV 8.6. Instead of adding an STL file using the "SceneObjectSmiley Frustratedet Geometry" invoke node, it is now added as a scene object using the "SceneObjectSmiley Frustratedet Drawable" method.

This VI also demonstrates how to add the STL file to a scene that already contains objects.

Solidworks and ASCII STL files are included with the example.

NOTE: "Load STL Geometry" VI only works for ASCII STL files - most CAD software packages output BINARY STL by default.

STL files can be converted from BINARY to ASCII using the open source software "Meshlab".

 

Requirements

  1. LabVIEW 2014 (or compatible)


Steps to Implement or Execute Code

  1. Download "STL viewer.vi" and "hemisphere.stl" and save in a common directory
  2. Open and run "STL viewer.vi"

Additional Information or References

VI Snippet

 STL Viewer 2014 NIVerified.png 

 **This document has been updated to meet the current required format for the NI Code Exchange.**

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
alexderjuengere
Active Participant
Active Participant
on
NOTE: "Load STL Geometry" VI only works for ASCII STL files - most CAD software packages output BINARY STL by default. Furthermore, the ASCII STL file must be formatted or rather encoded as
alexderjuengere
Active Participant
Active Participant
on
... encoded as UTF-8 without BOM https://en.wikipedia.org/wiki/Byte_order_mark#UTF-8