Importing and exporting shapes

Importing Shapes

CoppeliaSim uses triangular meshes to describe and display shapes. Because of this, CoppeliaSim 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, 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.

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

  • OBJ: Wavefront Technologies file format. This is currently the only format that allows importing of textured meshes in CoppeliaSim.
  • DXF: AutoCAD file format (Autodesk). Non-3D information that might be contained in the file is ignored.
  • STL (ASCII or binary): 3D Systems file format. ASCII and binary files are supported.
  • COLLADA: refer also to the collada plugin for details.
  • URDF: refer to the URDF plugin for details.
  • The import functionality is handled by the Assimp plugin for CoppeliaSim. See here for its API functions. More formats can be supported if the Assimp library (and Assimp plugin) are recompiled with the required flags.

    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. 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 CoppeliaSim 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 (CoppeliaSim'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 CoppeliaSim 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. MeshLab or polygon crunsher). You can also use following CoppeliaSim functions:

  • [Menu bar --> Edit --> Morph selection into convex shapes] : allows to convert the selected shapes into a convex shapes.
  • [Menu bar --> Edit --> Morph selection into its convex decomposition...] : allows to convert the selected shapes into their convex decomposition representation.
  • [Menu bar --> Edit --> Decimate selected shape...] : allows to reduce the number of triangles in the selected shape.
  • [Menu bar --> Edit --> Extract inside of selected shape...] : allows to extract/separate the inside of a shape (i.e. the non-visible parts) from the outside of the same shape (i.e. the visible parts). This functionality is based on vision sensors, and might not always give satisfying results.
  • When exporting shapes from an application that handles shapes as parametric surfaces (e.g. IGES, 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).

    Make also sure to follow the tutorial on how to build a clean simulation model.

    Exporting Shapes

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

  • 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 CoppeliaSim.
  • COLLADA: refer to the collada plugin for details.
  • The export functionality is also handled by the Assimp plugin for CoppeliaSim. See here for its API functions.

    Importing Heightfields

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

  • Image file: an image file (JPEG, PNG, TGA, BMP, TIFF or GIF file) where the various height values are taken from the red-, green-, and blue-color components: height=(red+green+blue)/3.
  • CSV or TXT: 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

  • Related API functions
  • Related Assimp API functions
  • Collada plugin
  • Shapes
  • Shape properties
  • Object common properties
  • User settings dialog
  • Building a clean model tutorial