Convert STL file to virtual world file
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 extension is
places the VRML file in the current folder.
This example uses an STL file in the Simscape™ Multibody™ product.
Convert the STL file
matlab/toolbox/physmod/mech/mechdemos) to a VRML file
and place the resulting file in the current folder.
. .. fourbar-Bar1-1.wrl % Other files and folders in the current folder appear.
This example uses an STL file in the Simscape Multibody product.
Convert the STL file
matlab/toolbox/physmod/mech/mechdemos) to an
XML-encoded virtual world file and place the resulting file in a folder
. .. fourbar-Bar1-1.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,
all STL files referenced in the XML file. It also creates a main
assembly VRML file that contains
to all converted individual VRML files. Inlines are wrapped by
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
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.
stl2vrml function places
assembly parts in the global coordinate system. If the
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
vrphysmod function to
obtain a Simulink® model with VRML visualization.