Macro Half-Hull Model/it

This macro makes simple models of the hulls of boats and ships. It is intended to aid people modeling or designing hulls by providing the hull surface in a straight forward and timely fashion so they can avoid the time consuming full process.



Background
Since antiquity boat builders have had to design boats and then realise them in a three dimensional environment where very few lines are straight, very few surfaces flat and no angles constant over a distance. Hull models were used to make to-scale models which could then be used to review the design or communicate concepts to other persons. The laws of hydrodynamics demand that any vessel passing through a liquid be symmetrical in the cross-section if it is to track (move in a straight line) accurately. Consequently building one side of the hull in the model was all that was necessary - if the half-hull was perfect then its mirror image would also be perfect. In latter years half-hulls became used for symbolic purposes such as plaques, and nautical art.

This code came out of a project to build a model in FreeCAD of a 12.5 metre sailing boat. The builders no longer had drawings and the son of the original owner doubted there ever were full drawings. Consequently the hull dimensions had to be measured and then a model constructed within the software, Modern software packages like FreeCAD offer many beneficial features like symmetry constraints but when the final measurement is a model that is "easy on the eye", much "massaging" of models is required. This code was written to help automate that process.

The initial purpose of this code was to provide a symmetrical hull which was malleable so it could be fitted to the 3D model being constructed. As the software progressed it was generalised so hopefully it would be of some use to persons:
 * boat designers producing boat diagrams which can be built from
 * boat builders who are trying to model what is described on their diagrams
 * model hull builders.

Certamente i progettisti di imbarcazioni commerciali hanno ogni sorta di software di fascia alta per sviluppare il loro lavoro, questo non ha intenzione di sostituirli. Questo può servire all'hobbista.

I progetti navali hanno una storia diversa rispetto agli edifici e quindi anche la presentazione è un po' diversa. Questo è un esempio di una barca a vela che ha più di un secolo:



Uno degli obiettivi finali di questo software è quello di utilizzare l'ambiente Draft per generare alcuni di questi schemi utilizzano il modello per generare le linee.

Note sulle Unità in FreeCAD:

Al momento, in FreeCAD non c'è nessun Sistema di gestione delle unità, ma ovviamente un costruttore di barche o modellatore ha bisogno di un sistema di dimensionamento accurato. Per utilizzare questa macro, impostare la dimensione della griglia FreeCAD appropriata al lavoro (per esempio mm, cm, pollici, piedi). FreeCAD è coerente, un'unità di FreeCAD sarà sempre uguale a una unità di FreeCAD. Se avete deciso di avere un'unità FreeCAD uguale una specifica lunghezza fisica, allora i vostri disegni rimarranno dimensionati coerentemente. Al momento si sta lavorando su un Sistema di unità per FreeCAD, quindi questa situazione potrebbe cambiare presto.

Descrizione
Per questa macro, le forme della carena sono definite da un minimo di 3 schizzi di FreeCAD: uno nel piano YZ, uno o più nel piano XZ e uno nel piano XY. Qui è presentato lo scafo minimo supportato da questa macro, ha solo 3 schizzi:



Nota: nello schema precedente stiamo guardando direttamente a poppa, la prua è rivolta in direzione opposta al punto di vista.

Da davanti a dietro (da prua a poppa) i 3 schizzi sono:

Forse è più facile da vedere con 7 schizzi (uno nel piano YZ, uno nel piano XY e 5 nel piano XZ):



Con 5 schizzi nel piano XZ è più facile cominciare a percepire la forma dello scafo. Le prossime 2 immagini mostrano le linee di disegno sovrapposte al modello che FreeCAD costruisce,



il secondo è lo stesso modello ruotato di 90 gradi, con la prua è in primo piano:



Alcuni punti da prendere in considerazione:


 * gli schizzi sono solo per:
 * la stemline (o linea di prua) nel piano YZ (rossa nello schema sopra);
 * la parte superiore dello specchio di poppa nel piano XY (blu nel diagramma);
 * diverse sezioni dello scafo nel piano XZ (verde nello schema precedente)
 * negli schizzi è disegnato solo il lato di dritta dello scafo, il lato di babordo verrà generato come immagine speculare
 * ogni linea multisegmento deve essere in uno schizzo separato
 * ogni schizzo deve avere lo stesso numero di segmenti (che è 3 negli esempi precedenti)
 * più segmenti di linea ci sono in ogni Schizzo, più il modello prodotto da FreeCAD si avvicina a uno scafo curvo
 * non vi è alcun limite al numero di segmenti di ciascuno schizzo, qualsiasi numero da uno in poi
 * non vi è alcun limite al numero di schizzi nel piano XZ (cioè le sezioni), qualsiasi numero da uno in poi

Con sufficienti schizzi il modello generato può anche diventare somigliante:



La macro HalfHull genera 4 modelli:


 * mezzo scafo di dritta
 * mezzo scafo di babordo
 * scafo completo
 * paratie per lo scafo completo, sia con una ponte raso o con cassero

Questi modelli sono tutti prodotti nella posizione unificata dello spazio di FreeCAD in modo che possano essere assemblati - per esempio le paratie possono essere inserite perfettamente nello scafo completo. Questa è una foto delle paratie di un modello di barca durante la costruzione:



Così come le paratie generate dalla macro (notare che queste paratie sono per un cassero e non per un ponte raso):



L'immagine composita sottostante mostra i principali risultati prodotti da questo software (attualmente il mezzo scafo di babordo non è mostrato ma è lo specchio del mezzo scafo di dritta che è mostrato). I prodotti sono in senso orario dall'alto a sinistra:
 * mezzo scafo di dritta
 * scafo completo
 * paratie (per ponte raso, le paratie dell'immagine precedente erano per un ponte con cassero)
 * lo scafo completo con le paratie inserite



Come nuove caratteristiche, opzionalmente la macro può anche produrre targhe per i mezzi-scafi, o una bottiglia per lo scafo completo:





Installazione
Tutto il codice di halfHullModel.FCMacro è contenuto in una macro, quindi per installarla basta copiare il suo codice nella appropriata directory delle Macro. Dopo, si può invocare halfHullModel.FCMacro dal menu Macro, dalla console Python o da un pulsante della barra degli strumenti (il metodo preferito).
 * per informazioni su come installare il codice delle macro vedere la pagina Come installare le macro
 * per informazioni su come installarla abbinata a un pulsante in una barra degli strumenti vedere la pagina Personalizzare la barra degli strumenti

Utilizzo
Le operazioni FreeCAD coinvolte nella generazione del modello dello scafo sono piuttosto complesse e numerose. Alcune cose come, ad esempio, la direzione in cui viene disegnata una linea possono portare FreeCAD alla costruzione dello scafo o al fallimento o a produrre deformazioni come:



Di conseguenza, i passaggi successivi devono essere seguiti attentamente. La macro non consente certe incongruenze di dati, ma in generale se i dati (cioè gli schizzi) non sono corretti il prodotto è simile a una grattugia o il riempimento della macro fallisce con un errore.

Le seguenti istruzioni si riferiscono ai quadranti del grafico XY, questo si riferisce ai 4 quadranti del grafico XY e sono etichettati come segue:



Create a New Document

The very first thing is to create a new document in FreeCAD. This document will hold all the Sketches that make up your hull definition.

Create the Stemline
The first step is one of creating data for the hull model to be made from. The data is supplied in the form of Sketches within FreeCAD. After the hull model is generated, if changes are to be made then the Sketches are simply edited, and the second step of running the macro repeated.


 * 1) create a new sketch [[Image:Sketcher_NewSketch.svg|24px]], in the YZ-Plane
 * 2) start at origin (0,0) and draw upwards into Quadrant I
 * 1) the bottom end of the stemline is at the origin (0,0) - this will be the point from where the placement of all the cross-sections and transom will be made
 * 2) the number of line segments in this Sketch determines the number which will be required in each other Sketch
 * 3) save sketch [[Image:Sketcher_LeaveSketch.svg|24px]]
 * 4) for ease of identification it is probably worth naming the Sketch something like "stemline sketch"

Create the Cross-section Sketch(es)
The dialog is asking how far from the origin the Sketch should be placed. This will refer to how far the cross-section is from the bottom of the stemline (which was placed at (0,0)). The cross-sections can be equally spaced but need not be. The forward-most cross-section will be at Y=0 (i.e. the origin where the stemline bottom ends) or at Y<=0. The cross-sections will be at increasingly negative Y values until the transom is at the most negative Y value. In the example above, the cross-section Sketch will be placed 50 FreeCAD units from the origin on the negative Y axis. - the first (i.e. foremost) cross-section should start at origin (0,0) (or it will look odd as the stemline ends at 0,0) but other cross-sections need only start on the Y axis.
 * 1) create a new sketch [[Image:Sketcher_NewSketch.svg|24px]], in the XZ-Plane
 * 2) the following dialog will appear:
 * 1) start on the Y axis and draw upwards into Quadrant I
 * 1) use the same number of line segments as in the Stemline Sketch
 * 2) save sketch [[Image:Sketcher_LeaveSketch.svg|24px]]
 * 3) repeat as this step necessary, it may be quicker to copy this sketch and then space the copies on the Y-axis, modifications may be made to the individual Sketches as required
 * 4) for naming, it will make things easier to give some sort of sequence to the cross-sections, starting at the bow (i.e. the stemline) and increasing towards the stern (i.e. the transom)

Create the Transom Sketch in the XY Plane

 * 1) create a new sketch [[Image:Sketcher_NewSketch.svg|24px]], in the XY-Plane
 * 2) start on the Y axis between quadrant III and IV, and draw upwards into Quadrant IV so that the end point is coincident with the rightmost point of the lowest cross-section Sketch in the YZ-plane
 * 1) use the same number of line segments as in the stemline Sketch
 * 2) save sketch [[Image:Sketcher_LeaveSketch.svg|24px]]
 * 3) for ease of identification it is probably worth naming the Sketch something like "transom sketch"

Save the New Document

Now save the document which contains the Sketches that will define the hull shape, giving it some name that is descriptive

Once the Sketches have all been created and positioned, the document should look like this from the top view :



The principal limitations for constructing the model are:
 * the stemline bottom should end at (0,0)
 * the bottom centremost end of each cross-section should end at the Y axis - note that it can have any Z value

This concludes the first step which is one of creating the data which the macro will use to create both half-hulls and complete-hulls. The second step is described in the following section which is titled User Interface

User Interface
In this step the macro will gather some information from the user and then process the input Sketches to generate the desired hull models. This is the only GUI image for the macro and is primarily configuration details for the production of the hull models from the Sketches:



The choices on the GUI window are:

- checking this will cause the macro to produce a starboard half-hull model - if checked the macro will mount the half-hull on a plaque - if checked will cause the half hull to be mounted higher on the plaque than the centre position, this is so a separately generated keel could be placed below the hull - checking this will cause the macro to produce a port half-hull model - if checked the macro will mount the half-hull on a plaque - if checked will cause the half hull to be mounted higher on the plaque than the centre position, this is so a separately generated keel could be placed below the hull - checking this will cause the macro to produce a complete model - if checked the macro will place the complete hull inside a transparent bottle (complete with cork) - if checked will cause the half hull to be positioned higher in the bottle than the centre position, this is so a separately generated keel could be placed below the hull - checking this will cause the macro to produce bulkheads whose tops are level with the top of the hull, bulkheads will not be generated for the most forward 2 cross-sections or the aft-most 2 cross-sections - checking this will cause the macro to produce bulkheads whose tops are possibly above the top of the hull. - the execution is halted and the window closes - the execution uses the data file AND SETTINGS from the the last run, any changes to settings are ignored - the standard Open File window is opened where the user can either select a file or Cancel and exit
 * Starboard half-hull
 * Mounting plaque
 * Allow space for keel
 * Port half-hull
 * Mounting plaque
 * Allow space for keel
 * Complete hull
 * Bottle for complete hull
 * Allow space for keel
 * Bulkheads for flush deck
 * Bulkheads for coachhouse
 * Bulkheads to skip at bow determines how many cross-sections will be left without a bulkhead at the bow
 * Bulkheads to skip at stern determines how many cross-sections will be left without a bulkhead at the stern
 * The dimensions of the top of the bulkheads will be configured as per the following diagram:
 * Cancel button
 * Re-Use Last File button
 * Select File button

When the macro runs it takes configuring data from the user and then reads Sketcher sketches in the selected input file.

Note: As the macro works through the Sketches it prints out any exceptions as well as some milestones on the Report View. If you get unexpected results or some parts are missing, that is probably the first place to check.

Options
There are various types of bows and sterns for boats, with sterns having much more variety than bows. Here are examples of transoms and bows from the real world alongside the similar macro output:

Sheer Stern

Probably the most common stern, typical of all sizes of vessels from commercial ships through to rowing boats.


 * the XY transom should be as close to the aftmost cross-section as is possible.

Sugar-Scoop Stern

Most likely to be found on a sailing yacht, it is a product of designing to maximise the length of the waterline to benefit from class rules for racing under sail.


 * place the aftmost 2 cross-sections as close as is feasible, then rotate the aftmost of the two through to an angle of 45 degrees (or whatever is called for) around the X-axis

Canoe Stern

Found on all sizes of water craft, power and sail, pleasure and commercial.


 * place the aftmost 2 cross-sections as close as is feasible, then rotate the aftmost of the two through to an angle of 45 degrees around the X-axis

Normal Bow

There is a lot less variety in bow shapes than with transoms:

Trireme Bow

Although not seen very frequently in the last 2 millenia, this was once the definitive bow profile for war-making vessels:


 * in order for the bow to be correct the poly-line for the stemline needs to be drawn from the bottom to the top which will mean right to left in the Sketcher

Sample Files
These files are samples of Sketch data to use with the macro, mainly they are the models for the screen snapshots in the Options section above. The files work with the Macro and so can be downloaded and played with to adapt to your specific requirements. The prefix of 5x3 (for example) means the model has 5 cross-sections and 3 line segments per sketch


 * 3x3 hull with the minimum number of Sketches (stemline, one cross-section, transom) and 3 line segments per Sketch
 * 5x3 with sheer transom
 * 5x3 with sugar scoop transom
 * 5x3 with canoe transom
 * 5x3 with trireme bow
 * 12x3 sailing yacht

Remarks

 * almost all the examples on this page are generated with only 3 line segments defining the side of the hull which gives a very faceted appearance, increasing the number of segments in each Sketch would generate a much smoother surface which would increase the realsism
 * doesn't do keels, skegs or rudders, in other words, it doesn't do any of the wet area
 * doesn't do square bows like push-boats or towed barges
 * doesn't do submarines (although it will do the lower half of a submarine)

Known Problems
The 'Ruled Surface' feature of FreeCAD is used to generate the hull sections from the Sketches. It can sometimes generate the wrong result and display a grater like surface instead of a smooth planar one. This will typically occur when the Sketches are rotated such as when a Sugar Scoop stern is modeled. Also angling a Sheer Transom stern can cause this. If it occurs then typically it will do so in either the half-hull models or the complete hull model - it never seems to occur in all three models for the same hull. Also it usually only happens at the extreme bow or stern. If it happens to section in the middle of the boat then most likely one of the Sketches was drawn in the wrong direction (i.e. either random sequence or top-down where as all lines should be drawn bottom-up)

It can usually be removed by using the following steps:
 * in the Model tab of the Combo View, click on the faulty segment to select it, the faulty segment will show as highlighted on the display
 * select the Data tab on the bottom half of the Combo View, the lower part of the window will have a Label "Ruled Surface" with a single parameter 'Orientation'
 * there is a popup menu to the right which has the values 'Automatic', 'Forward', 'Reversed', it will initially be set to 'Automatic'
 * try one of the other settings (remembering the faulty segment must still be selected in the upper part of the Combo View) which will usually correct the problem

The following screen snapshot shows the relevant portion of the screen:



Future Possibilities
- this is just at the idea stage but would give a much smoother surface in the vertical dimension, however the horizontal surface would still be faceted as it is now - an initial goal, but the feasibility has not been investigated - one work around for keels with the present system is to model the keel as a half-hull on it's own and then assemble it onto the bottom of the main hull; this would still do nothing for rudders and skegs though
 * replace line segments of cross-sections with curved lines
 * integrate with Draft workbench to produce drawings from models
 * handle keels, skegs and rudders

Glossary
As with any ancient and practiced trade, a rich and sometimes confusing vocabulary has developed around ships, boats and nautical practices. In describing this macro it is both awkward and inefficient to describe the process without using the correct and accurate terms. The obvious problem is that the average lay person will be unfamiliar with such terminology, hence this vocabulary:

Links

 * Half Hull Model Ship (Wikipedia)
 * Why Half Hulls (Maritime Half Hull Ship Models and Nautical Art website)
 * Traditional Model Yacht Design (US Vintage Model Yacht Group)

Script
This code is running bug free. But due to the large range of possible inputs it may fail for some inputs. If so please report it.