Scripting to load "Tires"

Hi. I have managed to uncover a way to script the loading of a vehicle (Car::Load, which I did not see in the manuals), but now want to do the same to programmatically override the TestRun tyres (or “Tires” in CarMaker). I haven’t been so lucky as to happen upon the right syntax for this, and can’t find reference to it in the manuals. Can someone assist please?

Hi Chris,

I assume you are referring to ScriptControl commands. If that’s the case then I think the command you require is IFileModify or IFileModifyTxt depending on the key value type. Note that IFileFlush should also be called after to propagate the changes to the main GUI.

Section 23.4.5 of the Programmers Guide discusses how to access infofile parameters. You can open the programmers guide from the main CarMaker GUI under Help > Programmers Guide.

To load a test run, change the 4 tires and then start the simulation would be something like this:

LoadTestRun "MyTestRun"
IFileModify Vehicle "Tire.0" "Examples/RT_165_70R13"
IFileModify Vehicle "Tire.1" "Examples/RT_165_70R13"
IFileModify Vehicle "Tire.2" "Examples/RT_165_70R13"
IFileModify Vehicle "Tire.3" "Examples/RT_165_70R13"
IFileFlush
StartSim

Note that this will override the original values. You may want to store a copy of the original values and reset them back again afterwards. You can retrieve a value using IFileRead.

David

1 Like

Hi David,

Many thanks for the solution offered, which would work to override the tyres in the base Vehicle file. For my specific request, I am attempting to override the tyres set directly in the TestRun, which supersede those in the Vehicle itself. Something perhaps analogous to the “Car::Load” command which can load the full vehicle. The reason being that some TestRuns already have an override tyre set applied, so in this instance modifying only the Vehicle tyres using “IFileModify” likely would not have the desired outcome of changing the tyres that the simulation uses at runtime.

Hi Chris,

IFileModify can also modify the TestRun. Just replace the word Vehicle for TestRun.

IFileModify TestRun "key" "value"

Dave

2 Likes

Ok great, that sounds like it’ll do the job. Many thanks.