Wikihouse porting tutorial/it

Introduzione
Questo tutorial spiega come convertire in FreeCAD i file SketchUp utilizzati dal progetto WikiHouse, avvalendosi dello strumento Pannello di FreeCAD. Il risultato è una copia completa dell'originale file SketchUp, tranne che è diventato completamente parametrico. Il livello di parametricità del file finale dipende dal lavoro ad esso dedicato, come spiegato di seguito. Ma è possibile fare le cose passo dopo passo, e ricostruire il file Wikihouse abbastanza rapidamente, e rimandare a dopo il più lungo lavoro di conversione dei profili di base da schizzi.

Questo tutorial richiede una conoscenza intermedia di FreeCAD, cioè, di sapersi destreggiare tra gli ambienti di lavoro e gli strumenti, di essere già in grado di modellare oggetti semplici, e, soprattutto, di essere a proprio agio con Draft Sposta e Draft Ruota. Si utilizzeranno principalmente gli strumenti di Draft e Arch, ma la conoscenza di Sketcher diventerà necessaria per convertire gli schizzi in profili di base.

Dato che il progetto Wikihouse è aperto per natura, è facile trovare i file sul sito del progetto, ma anche in SketchUp 3D Warehouse o nel repositorio repositorio github del progetto. Il formato preferito utilizzato dal progetto è Sketchup, quindi la maggior parte dei file che troverete sono in tale formato.

Nel seguente tutorial abbiamo utilizzato il file Chassis del sotto-progetto Wikihouse's Microhouse.

Preparare il file di Sketchup
La prima cosa da fare è aprire il file in SketchUp ed eliminare tutto ciò che non si desidera esportare. Si esporta solo una parte della Microhouse, quindi tutto il resto deve essere eliminato.



In SketchUp, gli elementi Wikihouse sono realizzati in un determinato modo specifico: aggiungendo un po alla volta piccoli "pezzi" per creare i diversi componenti:



Questo non è il modo in cui si procederà in FreeCAD. Dato che una delle caratteristiche più potenti di FreeCAD sono gli Schizzi vincolati, è meglio approfittare di questo, e basare tutti i nostri elementi Wikihouse su schizzi. In questo modo, si può modificare qualsiasi parte in Sketcher, il che è molto più comodo.

Per trasformare gli oggetti di SketchUp in schizzi di FreeCAD, che possono poi essere utilizzati per creare degli Pannello, bisogna estrarre una faccia piatta da ogni pezzo Wikihouse. Lo spessore sarà nuovamente aggiunto in seguito, in FreeCAD, direttamente nelle proprietà del pannello Arch. In questo modo, sarà anche esso parametrico. Per convertire ciascun componente Wikihouse in una unica faccia piatta, entrare in ogni componente facendo doppio clic su di esso, quindi selezionare ogni sotto-componente, e fare clic destro -> esplodere, fino a quando tutti i sottocomponenti sono esplosi, e il componente è composto solo da facce e spigoli:



Fatto questo, selezionare tutto nel componente, e deselezionare, con Shift + doppio clic, ogni faccia frontale del componente. Essere sicuri di fare doppio clic, invece di un solo clic, perché altrimenti si deseleziona solo la faccia e non i suoi bordi di confine (che sono anche necessari). Con questo, avremo deselezionato tutto ciò non vogliamo mantenere, quindi basta premere il tasto di cancellazione. Ora il nostro componente è una sola grande faccia piatta.



Ripetere questa operazione per ogni componente. Dato che molti sono dei duplicati, questo non è un compito così enorme come sembra. Inoltre, se non si ha familiarità con il sistema Wikihouse, questo passaggio dà una buona comprensione di come funziona.

Quando il pezzo di casa è completamente fatto di elementi piani, possiamo selezionare tutto ed esportare in un file .dae, e quindi importare questo file in FreeCAD. Assicurarsi di segnare "triangulate all"

Solving the double faces bug
There is a nasty problem for which I haven't found a better solution: Meshes exported from SketchUp to the .dae format have their faces duplicated. Each face becomes actually two faces. The easiest way I have found so far is to open the exported file in Blender for repair:


 * 1) Open the dae file in Blender (File -> Import -> Collada)
 * 2) Select a component, and hit TAB to enter edit mode
 * 3) Press A to deselect everything, then A again to select everything
 * 4) Press W -> Remove doubles
 * 5) Press TAB to exit edit mode
 * 6) Repeat for all the components
 * 7) Save a new dae file (File -> Export -> Collada)

Normally the above operation shouldn't change the scale, but it is always wise to verify, using the measuring tools, that the imported geometry is at correct scale before going further. You might need to tweak Blender's Collada export settings if needed.

Importing and converting to wires
Note that it might be easier to go by parts and treat + export objects group by group, as we did below, we exported only the first layer, made of yellow elements in SketchUp. These elements will come into FreeCAD as Mesh objects:



The next step is to create wires from each of our meshes. There is a convenient Macro named Macro Extract Wires from Mesh that does just that. Install it (Refer to the Macros page for instructions), then one by one (you can do them all at once, but this macro takes some time), convert all our meshes to wire objects:



We could now already make Arch Panel objects from each of these wire-like objects, simply by selecting them and pressing the Arch Panel button. However, their base shape wouldn't be parametric. We now have several options: We could turn each component into a sketch, using the Draft Draft2Sketch tool, but these will be rather heavy sketches, and might not be very manageable on a slow machine, or we could turn each individual wire (the outline and each hole) of the sketch into a separate sketch. This would allow us, for example, to reuse a typical hole, make it only once, then duplicate it with Draft Clone to make the other holes. This way, you would only need to edit one to edit them all.

The Extract Wires from Mesh macro also sometimes fails in finding closed wires inside a mesh, which will not produce correct Panels. An easy procedure to recompose the wires of a component is this:


 * 1) Select the component, optionally hide everything else to see better
 * 2) Draft Downgrade it. It will be exploded into a series of individual edges
 * 3) Start selecting the holes with Ctrl or by using Shift + B to box-select
 * 4) Press Draft Upgrade to turn back each hole into an individual wire
 * 5) Finally select all the remaining individual edges in the tree, which form the outline, and Draft Upgrade them
 * 6) Select Part->make Compound to join back all these wires into one object
 * 7) Select the compound and press the Arch Panel button



There are many possible strategies here, depending on how editable and precise you need the result. The Arch Panel object needs a base object made of wires. It doesn't matter how this object is made, if it is a single sketch, or, like in the example above, a compound of different sketches or draft object.

Converting to Sketches
It is also possible to do that part later, you could already create Panels from each of the component, but let's see already how to to convert a wire-like object to a sketch:


 * 1) Create a copy of your wire-like object with Ctrl+C, Ctrl+V. This si so we can modify it but still keep one in its correct location
 * 2) Move and rotate it so it lies in the XY plane, using Draft Move and Draft Rotate. This is not indispensable, but the next point sometimes fails otherwise
 * 3) Use Draft Draft2Sketch to turn the wire into a sketch. Be warned, this can fail or take a very long time for huge wires. It is best to decompose your object into individual wires as shown above.
 * 4) If the command above fails, using Draft Upgrade twice on a wire-like object, to convert it to a Face then to a Draft Wire, before using Draft Draft2Sketch, usually works better, because the Draft Wire keeps a better track of the order of vertices inside a wire.
 * 5) Curves are made of several small segments. They can be left as is, but they introduce a lot of endpoint constraints. It is better to replace them by arcs. It is fairly easy to do, just delete the small segments and replace them by an arc. The arc can then be made tangential to the neighbouring segments, but make sure the position of those segments is locked before doing this, as this operation will make them move.
 * 6) If you worked with several sketches, make a Part Compound of them
 * 7) Create an Arch Panel from it
 * 8) Rotate/move it back into position with Draft Move and Draft Rotate



Rebuilding the wikihouse and exporting cut sheets
Also, make sure you don't redo any duplicated part. Instead, select the Draft Clone tool to duplicate parts based on the same profile, so they will all share one same profile object. Then, since we have the outline at the correct place to use as a guide, it is fairly easy to rotate and move the clone into its correct position with Draft Rotate and Draft Move.

After a while, all our Microhouse section is done.



We can now easily create the cut sheets, which are DXF files that will be sent to the shop that will cut the actual panels. The easiest way to do this is to select everything in your document with Ctrl+A, and then use the Arch Panel Cut tool. This will produce one Panel Cut object for each Panel object found in the selection. By moving them apart, we get a clear view of all our pieces:



We must then "nest" our pieces, that is, move and rotate them so they occupy as much as possible to space of a given panel, to generate as little material loss as possible. This operation unfortunately needs to be done by hand, but if you are using a Wikihouse project that already has produced cut sheets, copying them goes pretty fast:


 * 1) To make sure everything will stay in the XY plane, it is advised to set the Workign Plane to XY (top)
 * 2) Create an Arch Panel Sheet
 * 3) Give it the desired width and height values (Wikihouses are typically printed on 122x244cm plywood sheets)
 * 4) Move it to a convenient place with Draft Move
 * 5) Optionally, set its margin values to help you position the cut pieces
 * 6) Move and rotate the individual Arch Panel Cut objects so they fit inside the Panel Sheet
 * 7) When you are more or less ready, select the Panel Sheet, and double click it in the tree view to enter Edit mode
 * 8) Select all the Panel Cuts you wish to insert in it (you may want to switch the tree view to the "project" tab to select in the tree)
 * 9) Select the "group" section in the Panel Sheet's Task view
 * 10) Press the "Add" button
 * 11) Press the "OK" button

In the Panel Sheet's Task view, there is also a button that allows you to move the individual Panel Cuts after they've been inserted inside the sheet. After a while, we have our sheets ready:



The last step is simply to select all the sheets, then export them to DXF from menu File -> Export. The sheets contents will be exported separated in different layers, with the same color coding commonly used by the Wikihouse project:



These files are ready to send to the shops that will do the actual cut. It would be possible to generate the G-Code to be sent to the CNC machine directly from FreeCAD too, but that is matter for another tutorial.