Tracker implementation

I am moving an object in VC 3D environment. I want to tract the path it follows. I want a line to be made as the object moves. How can this be realized?

In the tutorial this is done by adding a robot to the simulation, send signal 81 and the component which you want to trace in the properties.
Tutorial link is below:
http://academy.visualcomponents.com/lessons/visualize-vehicle-path/?display_lessons=1

Instead of using swept volume, you could create a dummy component with a Geometry feature. In the container of that feature, create a vcCompactLine set with the initial point the location of the component you want to track. When the simulation is running, you can add more lines to the compact line set by reading several properties in the vcComponent object you want to track, e.g. its WorldPositionMatrix and path velocity when traveling on a conveyor.

Let me make one thing clear: you do not need a robot to create swept volume. You can create the swept volume using Python API, vcSweptVolume. In that approach, you have to provide a node list of the geometry you want to swept, a node that will contain the swept geometry, and the method for sweeping the geometry. The vcSweptVolume topic in API reference has some examples.

This script plots a motion of a component in the scene. Notice that this code keeps adding lines even if the object is stationary so you might want to filter those out for better performance.

Place a component in the world origin and add this script to it.

from vcScript import *
import vcVector 

def OnRun():
  app = getApplication() 
  color = app.findMaterial('red') 
  comp = getComponent() 
  geo = comp.UserGeometry 
  geo.clear() 
  lineset = geo.createGeometrySet(VC_COMPACTLINESET) 
  lineset.Material = color 
  lineset.LineWidth = 2.0 
  c = app.findComponent('TheComp') 
  m0 = None 
  
  while True: 
    delay(0.1)
    c.update() 
    ml = c.WorldPositionMatrix 
    if m0:
      line = [m0.P, ml.P] 
      lineset.addLine(line) 
      lineset.update() 
    m0 = ml

 

This thread is related to similar topic

https://forum.visualcomponents.com/forums/topic/illustrating-a-path-spaghetti-diagram/