Anim8or Community

General Category => ASL Scripts => Topic started by: NickD on December 15, 2008, 04:48:43 am

Title: Customizable 3D ship hull script (demo included)
Post by: NickD on December 15, 2008, 04:48:43 am
Hello!
Looking at the SpringSharp software http://www.springsharp.com/ (http://www.springsharp.com/) (used to design virtual warships), i've got following idea: It will be good to have visual 3D model of the designed ship (ShpringSharp gives only text data), and i've realised that it is possible.
I'm writing a script, where by specifying  few ship's parameters, you can receive a 3D model of this ship.

Here is the current version of the script. I'm still working on it. Later will be implemented calculation of different block coefficients ("fatness") of the ship (for now block coefficient can be only 0.523 - corresponding to a cruiser).
This version implement "Cruiser stern". In later versions, i'll try to implement also transom and round sterns as a choice.

To create your own ship 3D model, open the script file , and modify the parameters on top of the  script:

float $WLL; $WLL = 192; /*waterline length*/
float $WLB; $WLB = 20.8; /*beam*/
float $WLD; $WLD = 4.9; /*drought*/
float $BCF; $BCF = 6.1; /*Board Forecastle Front*/
float $BCA; $BCA = 5.3; /*Board Forecastle Aft*/
float $BFF; $BFF = 5.3; /*Board Fore Deck Front*/
float $BFA; $BFA = 5.3; /*Boatd Fore Deck Aft*/
float $BAF; $BAF = 3.0; /*Board Aft Deck Front*/
float $BAA; $BAA = 3.0; /*Boatd Aft Deck Aft*/
float $BQF; $BQF = 3.0; /*Board Quarterdeck Front*/
float $BQA; $BQA = 3.0; /*Boatd Quarterdeck Aft*/

float $ANGB; $ANGB = 20; /*bow angle*/

float $PFC; $PFC = 20; /*forecastle as percent of the hull length*/
float $PFD; $PFD = 30;/*fore deck as percent of the hull length*/
float $PQD; $PQD = 20;/*quarterdeck as percent of the hull length*/
float $PAD; $PAD = 100 - $PFC - $PFD - $PQD; /*aft deck as percent of the hull length*/

All data is in meters.
Title: Re: Customizable 3D ship hull script (demo included)
Post by: Kubajzz on December 17, 2008, 06:46:28 pm
Nice plugin NickD!

I have one suggestion:

Try to make a parametric shape plugin from this script. If you do, it will be possible to edit the parameters of the ship directly in Anim8or without editing and reloading the script file. The only disadvantage is that parametric shape plugins cannot have more than 10 parameters, but it's better than nothing... If you don't know how to create a parametric shape plugin, try downloading several parametric plugin samples from the scripts page (http://www.anim8or.com/scripts/index.html) or read something about parametric plugins in the ASL specification (http://www.anim8or.com/scripts/spec/Anim8or_Scripting_Language.html)... Or just ask :)

Good luck!
Title: Re: Customizable 3D ship hull script (demo included)
Post by: NickD on December 18, 2008, 08:48:50 am
Unfortunately, the critical parameters are 17 - 4 for hull and 13 for freeboard.
I thought to make one plugin for hull and one for freeboard, but parameter count is still larger than 10.
The other option is to make a plugin with predefined board shape, but then the generated ship ill not be fully customizable.
Title: Re: Customizable 3D ship hull script (demo included)
Post by: Francesco on December 19, 2008, 01:20:23 pm
Very useful script NickD, well done.

My two cents are about getting around the insufficient input features: you can keep it as a normal script and rely on object's attributes to allow customization - the user sets one or more attributes and runs the script which will use attributes for custom parameters keeping the others to default values.

Keep on, scripts like this are a good thrust toward quick production.