Convert STL files to VRML format
the STL file that you specify with
a VRML file.
Converts both ASCII and binary STL files. The resulting files are VRML97 compliant, UTF-8 encoded text files.
VRML files have the same name as the source STL files, except
that the extension is
.WRL instead of
stl2vrml function places the VRML files into
the current folder.
The name of the source STL or Physical Modeling XML file. If
(Optional) Folder in which to create converted files. If the
destination folder does not exist,
These examples use STL files that SimMechanics™ product includes. If you do not have the SimMechanics product installed, then substitute another STL file .
Convert the STL file
a VRML file and place the resulting file in the current folder. The
resulting VRML file (
fourbar-Bar1-1.wrl) has the
same name as the source file, except that it has a
instead of an
stl2vrml('fourbar-Bar1-1.STL') ls . .. fourbar-Bar1-1.wrl % Other files and folders in the current folder appear, as well
Convert the STL file
a VRML file and place the resulting file in a folder called
The resulting VRML file is in the destination folder that you specify.
mkdir('virtualworlds') stl2vrml('fourbar-Bar2-1.STL','virtualworlds') cd virtualworlds ls . .. fourbar-Bar2-1.wrl
You can use the created assembly VRML files as templates for creating virtual scenes in which you can work with objects of the converted assemblies. To work with the scene effectively, edit the scene as necessary. For example, consider whether you need to add lights, viewpoints, and surrounding objects, modify part materials, define navigation speeds, or make other additions and changes.
stl2vrml function converts
individual STL files according to the STL convention, which places
parts in the global coordinate system. If you specify a Physical Modeling
XML file as the
source, the resulting VRML assembly
file reflects the initial positions of the parts defined in the XML
If you use SolidWorks®, then do not use spaces
when naming assemblies and components. Avoiding spaces in assembly
and component names ensures that the assembly VRML file has the same
tree structure as the related source in SolidWorks. You can then
vrphysmod function to process the assembly
VRML file to obtain a Simulink® model with VRML visualization.