How to create internal variable to store version number of models

Typically: "How do I... ", "How can I... " questions
Post Reply
Posts: 1
Joined: 22 Jun 2018, 23:03

How to create internal variable to store version number of models

Post by Adrian » 23 Jun 2018, 19:11


I'm looking for a way to store an internal name and version number with my models (.ttm files).

For my project, I would like to create a plugin/add-on that can replace the current model in a scene file with a newer version of it, in case it finds one in a pre-defined folder. To achieve this, the plugin/add-on would simply compare their internal names and version numbers.

So far, the best idea I could come up with, is to add two Script Simulation Parameters to my models (e.g. "internalName" and "version"). These values can easily be read and modified programmatically. However, script simulation parameters are also very prone to being accidentally deleted or modified by the user. I am therefore looking for a safer way to do this.

So I was wondering:
  • Is there any way to create hidden or read-only parameters in V-REP (i.e. values that can only be modified programmatically)?
  • Is it possible to programmatically access the field "Model content acknowledgments/info", which is located in the Model Dialog. If so, I could store my internal values there, which seems to be a "safer" location.
  • Is there any better way to achieve my goal? I am open to any suggestions, even if they are completely different to what I mentioned above (e.g. maybe adding metadata to the .ttm binary file?).
Thank you!

Site Admin
Posts: 6675
Joined: 14 Dec 2012, 00:25

Re: How to create internal variable to store version number of models

Post by coppelia » 27 Jun 2018, 09:53

Hello Adrian,

you can easily achieve this with sim.writeCustomDataBlock and sim.readCustomDataBlock. Something like, e.g.:

Code: Select all

local myDataName='myRobotModelX'
local data=sim.readCustomDataBlock(modelBaseHandle,myDataName)
if data then
    -- Now you can read the data that was stored in the model:
--    data.version
--    data.customVersion
--    ...
    -- no data there yet. Write it:

Post Reply