Regular API function

simAddDrawingObject / sim.addDrawingObject

Description Adds a drawing object that will be displayed in the scene. Drawing objects are containers that hold several items of a given type. This can be used for several different applications (simulation of paint, simulation of welding seam, display of 3D objects, etc.). Drawing objects created in a simulation script will be automatically removed at simulation end. See also sim.addDrawingObjectItem, sim.removeDrawingObject and the point cloud functionality.
C synopsis simInt simAddDrawingObject(simInt objectType,simFloat size,simFloat duplicateTolerance,simInt parentObjectHandle,simInt maxItemCount,const simFloat* ambient_diffuse,const simFloat* setToNULL,const simFloat* specular,const simFloat* emission)
C parameters
size: size of the item (width of lines or size of points are in pixels, other sizes are in meters
duplicateTolerance: if different from 0.0, then a call to simAddDrawingObjectItem will only add the item if there is no other item within duplicateTolerance distance. Useful to avoid adding a too high density of points, is however not appropriate when using a large number of points (slower operation). Applicable only for single vertex items.
parentObjectHandle: handle of the scene object where the drawing items should keep attached to (if the scene object moves, the drawing items will also move), or -1 if the drawing items are relative to the world (fixed)
maxItemCount: maximum number of items this object can hold.
ambient_diffuse: default ambient/diffuse color (pointer to 3 rgb values). Can be nullptr
setToNULL: not used, set to nullptr
specular: default specular color (pointer to 3 rgb values). Can be nullptr
emission: default emissive color (pointer to 3 rgb values). Can be nullptr
C return value
handle of the drawing object if successful, -1 otherwise
Lua synopsis int drawingObjectHandle=sim.addDrawingObject(int objectType,float size,float duplicateTolerance,int parentObjectHandle,int maxItemCount,table[3] ambient_diffuse=nil,nil,table[3] specular=nil,table[3] emission=nil)
Lua parameters
Similar to the C-function counterpart
Lua return values
Similar to the C-function counterpart
Remote API equiv.
Legacy remote API: -