Macro Wiring And Hoses

These macros support the creation and maintenance of Wires and Hoses.



Background
As part of our other FreeCAD projects we needed some way to document wiring and hoses. This set of macros was developed to meet that need. There is a lot this system doesn't do, but what it does do is provide visual representation of wiring and hoses, either as an isolated system or with the wiring and hoses in the context of a FreeCAD model. The record of all the wires and hoses is kept in a CSV format file outside of FreeCAD. So the file may be loaded into a spreadsheet program or used by other software.

Description
As part of a documentation project we discovered we needed to document wires and hoses. We tried some different scenarios such as creating lines or cylinders as part of the existing model. Due to either problems using or maintaining it we decided to keep the information in a different format and outside of FreeCAD. That way they could be created on their own or created within an existing document. That decision allowed the user to work with the wiring and hoses in the way which suited them. As well they could work with it in different ways at different times as needs changed.

We initially weren't sure how to maintain a list of the hoses and wires and various different approaches were tried. The easiest way seemed to be to use the CSV file format which has been around for a long time. Also there were routines already written for managing CSV files from Python. Some of the advantages were: The next decisions were "how" to define such cables runs. As our purpose was primarily documentation, we chose to run line segments from point to point. Issues such as turn radius are not dealt with. Also cable diameter is not handled. A table of the cable runs is maintained through the CSV file but such things as proximity of cables (for electrical interference issues) and run length are not supported (although it might be possible to add a rudimentary cable run length quite easliy).
 * human readable
 * can be loaded into any spreadsheet
 * can be maintained using a spreadsheet or simple text editor
 * a possible future enhancement would be to use it with the FreeCAD spreadsheet workbench

This set of macros is essentially a "proof of concept", it demonstrates some ideas and their feasibility. Our main goal was documentation, not physical plant management.We decided to maintain a data structure of points, which are the points through which the wires and hoses run. Secondly we set up a data structure which defines the cables and hoses in terms of the points they pass through. So a wire may only be routed where points for it have been defined.

For the 2 data structures we chose the following names:
 * Nexus - a point through which a cable or hose may pass (the plural is Nexi). Nexi are simply points in 3-space, for ease of visualisation the software places toroid rings around the location but this is only for ease of use. The toroid rings can be toggled off or on depending on user preference
 * Flows - generically these are routes comprised of Nexi. A code is associated with each type, the default codes being
 * W - electrical wires
 * C - conduits, intended primarily for wires but able to contain anything
 * H - hoses to carry a variety of liquids
 * G - gas lines
 * K - a camera routing, this is really just reserved for future exploration as per Tour camera animation

Both Nexi and Flows have user assigned names, in addition Nexi have internally assigned IDs to facilitate management. Being points or locations in 3-space Nexi do not have colours but Flows can have one of 48 defined colours. The emphasis on colours ties back to the intended purpose being one of documentation.

The general workflow is
 * define and position Nexi
 * define Flow(s) in term of Nexi
 * for maintenance purposes edit both Nexi and Flows either visually using the FreeCAD GUI or using a tabular approach and the CSV definitions

As the data file which holds both the Nexi and Flow definition is text based it can be used in any text editor or by any other program wishing to access the data.

Navigation Modes
As a large part of the work with these macros depends on manipulating the display of the model to place and verify the placement of point in 3-space, it is essential to be comfortable with the Navigational Modes of FreeCAD which are documented on the page Mouse Model. Being able to rotate the model in 3-space and then perform operations on a stationary model are essential.

Installation
The code for Wiring And Hoses is in multiple macros and a library. 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
There are really two different approaches to working with these macros: the nexi and flows can be defined on their own using 3-space coordinates; or an existing FreeCAD document can be used and the nexi and flows can be defined in the context of that document. This is not an 'either/or' decision but rather both approaches can be used when they are the most appropriate. As the definitions of the nexi and flows are kept in a CSV format file which is stored outside of FreeCAD, the presence or absence of a FreeCAD document does not affect working with the nexi and flow, it makes it easier by providing a visual context. For this description of usage the example will use a previously loaded FreeCAD document as a context as it is easier to place the

The usage of these macros really breaks down into 3 sections:
 * define nexi
 * define flows
 * edit the CSV format file to alter or add nexi and flows

There are alternative ways to perform some of the tasks outlined below and personal preference can decide. This example will apply electrical wiring and cold water plumbing to a house. Our empty house looks like this



and is waiting for cold water and electricity to be installed. For convenience of explanation all the electrical items are in yellow and the water in blue (aside from the 2 sinks).

Define Nexi
The first step is one of creating points in 3-space (called 'nexi' or 'nexus" in the plural). These points will be used in the next step to define a flow. We create these points by clicking on (i.e. selecting) a surface and then supplying a name for the nexi.

 This is asking if you would like to open and load a FreeCAD docuemtn which has the model which you wish to add nexi and flows to. It is not necessary to load one but for this example we will load our empty house
 * 1) click on 
 * 2) the following dialog will appear:


 * 1) select surface
 * 2) click on N
 * 3) define electricity nexi
 * 4) define more nexi
 * 5) save to file

at any point merge project

picture of nexi & flow without house

Define Flow

 * picture of house
 * define water nexi
 * define water flow
 * picture of house

Editing

 * listing of table
 * edit table snapshot
 * snapshot of editing Position for nexus

User Interface
The user interface is a combination of custom screens along with standard parts of the FreeCAD GUI.







Options
At present there aren't really any options for Wiring and Hoses.

Sample Files
blah blah blah

Remarks
blah blah blah

Known Problems
blah blah blah

Future Possibilities
blah blah blah

Glossary
blah blah blah

Links
blah blah blah

Script
blah blah blah