Macro Half-Hull Model

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.

Certainly commercial boat designers have all sorts of high end software to assist their work, this isn't supposed to replace that. Rather this is for hte hobbyist or home builder to tinker around with.

Nautical blueprints have a distinct history with respect to buildings and so are somewhat different in presentation. This is an example of a sailing boat which is more than a century old:



One of the end goals of this software is to use the Draft workbench to generate some of these diagrams using the model to generate the lines.

Note on Units in FreeCAD:

At present there isn't really any units management system within FreeCAD, but obviously a boat builder or modeller will need an accurate dimensioning system. To use this macro, decide to set the FreeCAD grid size to what ever is appropriate for your work (e.g. mm, cm, inch, foot). FreeCAD is consistent, one FreeCAD unit will constantly equal to one FreeCAD unit. And if you have decided to have a FreeCAD unit equal a specific physical length, then your drawings will remain consistently dimensioned. At present there is work on a units system for FreeCAD so this situation may change soon.

Description
For this macro the hull shapes are defined by a minimum of 3 FreeCAD Sketches: one in the YZ plane, one or more in the XZ plane, one in the XY plane. Here is the minimum hull supported by this macro, it has only 3 Sketches:



Note: in the above digram we are looking directly at the stern, the bow is pointing away from the viewpoint.

From front to back (bow to stern) the 3 Sketches are:

Perhaps it is easier to see with 7 Sketches (one in YZ plane, one in XY plane and 5 in the XZ plane):



With 5 Sketches in the XZ plane it is becoming easier to perceive the shape of the hull. The next 2 pictures show the Sketch lines superimposed on the model FreeCAD constructs,



the second is the same model rotated 90 degrees so the bow is in the foreground:



Some points to consider:


 * the Sketches are only for:
 * the stemline (or bow line) in the YZ plane (red in the above diagram);
 * the top of the transom in the XY plane (blue in the above diagram);
 * multiple cross-sections of the hull in the XZ plane (green in the above diagram)
 * only the starboard side of the hull is drawn in the Sketches, the port side will be generated as a mirror image
 * each multiple-segment line must be in a separate Sketch
 * each Sketch must have the same number of line segments (which is 3 in the previous examples)
 * the more line segments in each Sketch, the closer the FreeCAD generated model will approximate a curved hull
 * there is no limit to the number of line segment in each Sketch
 * there is no limit to the number of Sketches in the XZ plane (i.e. cross-sections)

With enough Sketches the model generated may even approach:



The HalfHull macro generates 4 models:


 * starboard half-hull
 * port half-hull
 * complete hull
 * bulkheads for the complete hull, either with a flush deck or with a coachhouse

These models are all output in the unified location space of FreeCAD so they can be fitted together - for example the bulkheads can be inserted into the complete hull seamlessly. This is a picture of bulkheads in a boat model during construction:



As well as the bulkheads generated by the macro (note that these bulkheads are for a coachhouse rather than a flush deck):



The composite image below shows the main outputs from this software (the port side half-hull is actually not shown but it is the mirror of the starboard half-hull which is shown). The outputs are in clockwise order from the upper left corner:
 * starboard half-hull
 * complete hull
 * bulkheads (for flush deck, the bulkheads in the previous image were for a coachhouse deck)
 * the complete hull with the bulkheads inserted



As novelty features, the macro will also optionally produce plaques for the half-hulls, and even a bottle for the complete hull:





Installation
All the code for halfHullModel.FCMacro is in one macro. So installation is comprised of copying the code to the appropriate Macro directory and invoking the Build Utility from the Macro menu, the Python console or a toolbar button (the preferred method).
 * see Macro_Install_HowTo for information on how to install this macro code
 * see Customize_ToolsBar for information how to install as a button on a toolbar

Usage
The FreeCAD operations involved in generating the hull model are rather complex and numerous. Things like the direction a line is drawn can cause the FreeCAD construction of the hull to either abort or turn out like:



Consequently the steps below need to be followed closely. The macro does allow for certain data inconsistencies but generally if the data (i.e. the Sketches) are incorrect then the output will look like a cheese grater or the macro fill fail with an error.

The following instructions refer to the quadrants of the XY graph, this refers to the 4 quarters of the XY graph and they are labelled as follows:



Step 1

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 document in FreeCAD [[Image:Document-new.svg|24px]]. This document will hold all the Sketches that make up your hull definition.
 * 2) Stemline Sketch:
 * 3) create a new sketch [[Image:Sketcher_NewSketch.svg|24px]], in the YZ-Plane
 * 4) start at origin (0,0) and draw upwards into Quadrant I [[File:Macro_Half-Hull_ModelUsage3.jpg]]
 * 5) 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
 * 6) the number of line segments in this Sketch determines the number which will be required in each other Sketch
 * 7) save sketch [[Image:Sketcher_LeaveSketch.svg|24px]]
 * 8) for ease of identification it is probably worth naming the Sketch something like "stemline sketch"
 * 9) Cross-section Sketch(es):
 * 10) create a new sketch [[Image:Sketcher_NewSketch.svg|24px]], in the XZ-Plane
 * 11) the following dialog will appear: [[File:Macro_Half-Hull_ModelScreenSnapshot1.jpg]] 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.
 * 12) start at origin (0,0) and draw upwards into Quadrant I [[File:Macro_Half-Hull_ModelUsage3.jpg]]
 * 13) use the same number of line segments as in the Stemline Sketch
 * 14) save sketch [[Image:Sketcher_LeaveSketch.svg|24px]]
 * 15) 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
 * 16) 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)
 * 17) Transom-XY:
 * 18) create a new sketch [[Image:Sketcher_NewSketch.svg|24px]], in the XY-Plane
 * 19) 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 [[File:Macro_Half-Hull_ModelUsage4.jpg]]
 * 20) use the same number of line segments as in the stemline Sketch
 * 21) save sketch [[Image:Sketcher_LeaveSketch.svg|24px]]
 * 22) for ease of identification it is probably worth naming the Sketch something like "transom sketch"
 * 23) now save the document [[Image:Document-save.svg|24px]], 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
Step 2

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:


 * Starboard half-hull - checking this will cause the macro to produce a starboard half-hull model
 * Mounting plaque - if checked the macro will mount the half-hull on a plaque
 * Allow space for keel - 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
 * Port half-hull - checking this will cause the macro to produce a port half-hull model
 * Mounting plaque - if checked the macro will mount the half-hull on a plaque
 * Allow space for keel - 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
 * Complete hull - checking this will cause the macro to produce a complete model
 * Bottle for complete hull - if checked the macro will place the complete hull inside a transparent bottle (complete with cork)
 * Allow space for keel - 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
 * Bulkheads for flush deck - 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
 * Bulkheads for coachhouse - checking this will cause the macro to produce bulkheads whose tops are possibly above the top of the hull.
 * 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: [[File:Macro_Half-Hull_ModelUi1.jpg]]

Sample Files
These files are samples of Sketch data to use with the macro:
 * hull with bare minimum (stemline, one cross-section, transom)
 * hull with 5 cross-sections

Options

 * canoe stern
 * sheer stern
 * sugar-scoop stern
 * trireme bow?

Remarks

 * doesn't do keels (yet)
 * doesn't do submarines (although it will do the lower half of a submarine)

Future Possibilities

 * option to automatically space the cross-sections
 * replace line segments of cross-sections with curved line
 * integrate with Draft workbench to produce drawings from models
 * handle keels

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)