(To be removed) Convert STL file to virtual world file
stl2vrml will be removed in a future release. For more information,
stl2vrml( converts an ASCII or
binary STL file that you specify with
source to a
VRML97-compliant, UTF-8 encoded text file.
The converted VRML file has the same name as the source STL file, except that the
.wrl instead of
stl2vrml function places the VRML file in the current
Convert STL File to VRML File
This example uses an STL file in the Simscape™ Multibody™ product.
Convert the STL file
Bar1DefaultSLDPRT.STL to a VRML
file and place the resulting file in the current folder. To access the STL
openExample ImportedFourBarExample in
MATLAB® command window and open the folder
. .. Bar1DefaultSLDPRT.wrl % Other files and folders in the current folder appear.
Convert STL File to X3D File
This example uses an STL file in the Simscape Multibody product.
Convert the STL file
Bar1DefaultSLDPRT.STL to an
XML-encoded virtual world file and place the resulting file in a folder
virtualworlds. To access the STL file, type
openExample ImportedFourBarExample in MATLAB command window and open the folder
. .. Bar1DefaultSLDPRT.x3d % Other files and folders in the current folder appear, as well.
source — STL source file path
STL source file path, specified as a string. The STL file can be either ASCII or binary.
If the source file is a Physical Modeling XML file,
stl2vrml converts all STL files referenced in the XML
file. It also creates a main assembly VRML file that contains
Inline references to all converted individual VRML
files. Inlines are wrapped by
Transform nodes with
DEF names corresponding to the part names defined in
their respective STL source files.
destination — Path to folder for converted file
Path to the destination folder for converted file, specified as a string.
If the destination folder does not exist, the
function attempts to create it.
format — File format for converted virtual world file
'wrl' (VRML) (default) |
'x3d' (XML-encoded X3D file) |
'x3dv' (Classic VRML-encoded X3D file)
File format for converted virtual world file, specified as a string.
Use the created assembly virtual world files as templates for creating virtual scenes. Edit the scenes. For example, add lights, viewpoints, or surrounding objects, modify part materials, define navigation speeds, and so on.
stl2vrmlfunction places assembly parts in the global coordinate system. If the
sourceis a physical modeling XML file, the resulting virtual world assembly file reflects the initial positions of parts defined in the XML file.
To use the tree structure of the related SolidWorks® source file in the assembly virtual world file, avoid spaces in assembly and component names. To process the assembly VRML files (but not X3D files), you can use the
vrphysmodfunction to obtain a Simulink® model with VRML visualization.