Skip to content

Shapes

read_shape_file

Adds the shapes of a file to the shape collection. It can be called as many times as needed; reading the same shape twice creates a duplicate (two shapes with the same name stop the simulation). Shapes are ordered by reading order: type 0 is the first shape of the first file. A ParaView polydata is created for each shape, used to display the polyhedra.

Parameter Default Description
filename required input file
scale_factor rescales the shapes (OBB, volume, vertices and inertia are recomputed); one value per shape, in reading order, e.g. [1.2, 1, 5.2]
rename renames the shapes, e.g. [Shape1, Shape2, Shape3]
rescale_minkowski true set to false to keep the Minkowski radius when scale_factor is applied
verbosity true prints the type names and ids
vtk true writes a .vtk file per shape, for visualization

Warning

  • The file must be ascii.
  • The reader is not typo-proof and ignores problematic values.
  • Do not define large "driven" shapes such as walls or cylinders with this operator: the cell size and the cutoff radius of the neighbor lists are derived from the shapes. Use the drivers: analytical drivers, or RShape drivers (.shp or .stl) for shapes with many faces.
- read_shape_file:
   filename: shapes.shp

- read_shape_file:
   filename: shapes.shp
   rename: [PolyR, Octahedron]

- read_shape_file:
   filename: shapes.shp
   rename:       [ PolyRSize2, OctahedronSize2]
   scale_factor: [        2.0,             2.0]

The file format is described in Polyhedra.

Note

The ParaView file does not include the "spherical" part of the polyhedra: faces connect the vertex centers, edges are straight lines (instead of cylinders) and vertices are points (instead of spheres).

Octahedron.vtk in ParaView:

Octahedron