Importing and exporting shapes

Related API functions

Importing Shapes

V-REP uses triangular meshes to describe and display shapes. Because of this, V-REP will only import formats that describe objects as triangular meshes. If however you wish to import objects described as parametric surfaces for example (e.g. IGES, STEP, etc.), then you will first have to convert the file to an appropriate triangular mesh format. There are several conversion application that allow for this operation, and most 3D drawing applications support this quite well too. Make sure you read the sections further down to be able to obtain the best triangular mesh description possible for your 3D drawing.

V-REP supports following file-formats for shape import ([Menu bar --> File --> Import...]):

  • DXF: AutoCAD file-format (Autodesk). Non-3D information that might be contained in the file is ignored.
  • OBJ: Wavefront Technologies file-format.
  • 3DS: 3ds Max file-format (Autodesk). Texture information is ignored. See here for acknowledgments and credits related to the used lib3ds library.
  • STL (ASCII or binary): 3D Systems file-format. ASCII and binary files are supported.
  • COLLADA: refer to the collada plugin for details.
  • URDF: refer to the URDF plugin for details.
  • After selecting the file to import, a dialog will open:

    [Shape import options dialog]


  • Preserve texture coordinates: specifies whether the imported meshes should preserve their texture coordinate information (if available). Texture coordinate information can be used at a later stage to apply textures in a non-projection mode. Preserved texture coordinates will be associated with their respective shapes, and used if a texture is attached. This option is currently only supported when importing data from OBJ file-format. Refer also to the texture dialog.
  • Decompose meshes: specifies whether the imported meshes should be divided into their smallest logical elements. This decomposition has the same effect as dividing a shape ([Menu bar --> Edit --> Grouping/Merging --> Divide selected shapes]).
  • Recenter: specifies whether the imported mesh should be centered at coordinates (0,0,0).
  • Scaling coefficient: specifies the scaling coefficient to apply to imported meshes. During the import operation, a value of 1 is considered as 1 meter by V-REP. So if your CAD application you used to export the mesh used a unit of 1 millimeter, then you should apply a scaling coefficient of 0.001. In any case, you can also scale the imported shapes afterwards in the object common properties dialog.
  • Imported shapes will have default visual parameters and a random color so as to be able to distinguish individual shapes. During the import operation, V-REP will make sure mesh objects are consistent and remove unused vertices and merge vertices that are close to each other, etc. The exact behavior can be set in the Vertices/triangles verification settings in the user settings dialog. If after the import operation you can't see any shapes in the scene, but the scene hierarchy indicates the presence of newly added shapes, then most probably your shapes are either too big or too small to be seen. You can then proceed to a scaling operation in the object common properties dialog. Also, when exporting meshes from a CAD application, try to export them as a whole (best is to export them as a single object, later on in V-REP you can then divide the imported shape with [Menu Bar --> Edit --> Grouping/Merging --> Divide selected shapes]); this is to avoid the CAD application repositioning/reorienting individual meshes according to their reference frame during the export operation (V-REP's reference frame is different!), which may result in a broken appearance.

    Make sure that your imported meshes do not contain too many triangles (for a robot, typically between 10000-20000 triangles in total), otherwise V-REP could be drastically slowed down (rendering, calculations, load/save operation, etc.). There are applications allowing to reduce the number of polygons in a mesh (e.g. polygon crunsher)

    When exporting shapes from an application that handles shapes as parametric surfaces (e.g. IGES, STEP, etc.), it might be important to export the objects in several steps when the drawing consists of large and small objects; this is to avoid having large objects too precisely defined (too many triangles) and small objects too roughly defined (too little triangles): simply export large objects first (by adjusting the desired precision settings), then small objects (by adjusting up precision settings).

    Exporting Shapes

    V-REP supports following file-formats for shape export [Menu bar --> File --> Export...] (note: only selected objects will be exported):

  • DXF: AutoCAD file-format (Autodesk).
  • OBJ: Wavefront Technologies file-format.
  • STL (binary): 3D Systems file-format. Only the binary format is supported for export. This is the most compact export option in V-REP.
  • COLLADA: refer to the collada plugin for details.
  • Importing Heightfields

    V-REP supports following file-formats for heightfield shape import ([Menu bar --> File --> Import heightfield...]):

  • TGA: Targa file-format. For now it is only possible to load uncompressed 24 bits/pixel or 32 bits/pixel Targa files ("*.tga" extension). Various applications are able to save bitmaps as Targa format (e.g. the GNU Image Manipulation Program GIMP). The various height values are taken from the red-, green-, and blue-color components: height=(red+green+blue)/3.
  • CSV: Comma-separated values file-format. The file should contain y rows where each has x values separated by commas.
  • After selecting the file to import, a dialog will open:

    [Heightfield import options dialog]


  • X-size / Y-size: specifies the x and y dimensions of the heightfield. Individual heightfield cells are always square.
  • Z-scaling: specifies the scaling to be applied to height values.

  • Recommended topics

  • Collada plugin
  • Shapes
  • Shape dialog
  • Object common properties dialog
  • User settings dialog