I am working with several foils geometries and would like to automatically change some parameters of the foils defined in the *.bic file (notably bearings position) when I select the foils in the Gomboc GUI. How do you handle the foil configurations?
First of all, when opening a Gomboc model (*.boc file), you can switch between several configurations using the configuration dropdown menus located in the Commands window. Those configuration menus are defined in the *.boc and *.bic files and can be tailored to your needs. For instance, in a Foil0X.bic file, you can create a configuration menu gathering all *.foil files located at the same level as Foil0X.bic. In the lines below, the function ‘filelist’ creates an array made of all those *.foil files and create a configuration named “Foil” which replaces the ‘File’ property.
filelist(spec.ownPath, ["*.foil"]).forEach(function(fileName) {
var foilName = fileName.substr(0, fileName.indexOf('.'));
R.merge('Configurations.Foil.'+foilName+'.Blocks.Boat.'+PtSt, {
"Foil" : {
"File" : spec.ownPath + fileName,
},
});
});
It is possible to replace other properties (e.g. bearing) using similar code, but it can get complicated if you want to apply that property only on a given number of foils. There are several configuration options:
- Add an ‘if (foilName === …)’ which changes the bearing according to the *.foil name
- Create a folder for each type of foil. Then, inside each folder, create a ‘filelist’ dealing with the bearing positions for that particular foil type.
- Make unique *.foil/*.bic couples for each foil, and create a ‘filelist’ for the list of all *.bic files. You will probably want to put that ‘filelist’ at the *.boc level.
- Avoid using configurations and create a group of one *.boc, one *.bic and one *.foil file for each foil. It requires creating 3 files for each new foil but avoid issues about configuration structure.
When testing small variations of the same foil, it is very handy to use the “Foil” configuration menu described above. However, when working with very different foils (varying bearing, T-Foil vs L-Foil, etc.), options 3 and 4 are preferred.