Hello,
I have made a custom folder in eCat under ‘My Models’ with template models of the track segment components I modelled. My aim is to generate an automated track from these models using add-on files (init.pyfile andCommandfile) and instead of xml file i am using a JSON config file with segment details but no x,y,z positions. Placement is done using the segment lengths and zero position values of each segments in the config file and connection using interfaces.
The segments are being generated but their placement in the world is not correct or being correctly translated, its like they have a pose lock. Can anyone give me a hint or insights on how to tackle this problem or point out any mistakes in my approach?
Thank you
fystro February 17, 2026, 10:12am2
Hello,
Could you maybe provide the Code you are using to set the position of the segments. It’s hard to problemshoot the issue without this.
Also make sure to update the simulation after changing the PositionMatrix of a Component otherwise the changes won’t be visible. To do this you can use the following Code:
sim.update()
app.render()
sim.setInitialState()
Dylan_7 February 17, 2026, 11:56am3
Thank you for the reply
For initial segment placement:
pm = vcMatrix.new()
pm.P.X = 0.0; pm.P.Y = 0.0; pm.P.Z = 0.0
c.PositionMatrix = pm
For following segments placement:
pm = vcMatrix.new(prev_comp.WorldPositionMatrix)
nm = vcMatrix.new(next_comp.PositionMatrix)
nm.P.X = pm.P.X + delta
nm.P.Y = pm.P.Y
nm.P.Z = pm.P.Z
next_comp.PositionMatrix = nm
Currently I have only tried with app.render() as my understanding was the changes in script will get updated when I close and reopen the script. I am generating the track into an empty world.
keke February 17, 2026, 12:38pm4
Note that nm.P.X = 10.0 doesn’t work. That’s beacuse nm.P creates a new vcVector instance with the position value but it’s not tied to nm after its creation. So this sets the X of that copy while original matrix position remains the same. So try:
P = nm.P
P.X = 10.0
nm.P = P
This is quite common mistake and something to user needs to get used to in VC API.
-k
2 Likes
Dylan_7 February 17, 2026, 1:13pm5
Thank you, that solved the placement issue.