Tutorial custom placing of windows and doors

Introduction
This tutorial shows how to place custom designed Arch Windows and Arch Doors in a building model. It uses the Draft Workbench, the Arch Workbench, and the Sketcher Workbench.

Common tools used are: Draft Grid, Draft Snap, Draft Wire, Arch Wall, Arch Window, and Sketcher NewSketch. The user should know how to produce well constrained sketches.

Setup
1. Open FreeCAD, create a new empty document, and switch to the Arch Workbench.

2. Make sure your units are set correctly in the menu. For example, is good for dealing with distances in a typical building; moreover, set the number of decimals to, to consider even the smallest fractions of a meter.

3. Use the Draft ToggleGrid button to show a grid with enough resolution. You can change the grid appearance in the menu. Set lines at every, with major lines every lines (every meter), and  in total (the grid covers an area of 50 m x 50 m).

4. Zoom out of the 3D view if you are too close to the grid.

Now we are ready to create a simple wall on which we can position windows and doors.

Placing a wall
5. Use the Draft Wire tool to create a wire. Go counterclockwise.
 * 5.1. First point in (0, 4, 0); in the dialog enter ,   ,.
 * 5.2. Second point in (2, 0, 0); in the dialog enter ,   ,.
 * 5.3. Third point in (4, 0, 0); in the dialog enter ,   ,.
 * 5.4. Fourth point in (6, 2, 0); in the dialog enter ,   ,.
 * 5.4. Fifth point in (6, 5, 0); in the dialog enter ,   ,.
 * 5.5. In the number pad press to finish the wire.
 * 5.6. In the number pad press to get an axonometric view of the model.
 * make sure the checkbox is disabled if you are giving absolute coordinates.
 * the points can also be defined with the mouse pointer by choosing intersections on the grid, with the help of the Draft Snap toolbar and the Draft Grid method.
 * you can also create shapes programmatically through the Python console.

6. Select the and click the Arch Wall tool; the wall is immediately created with a default width (thickness) of 0.2 m, and height of 3 m.





Placing preset doors and windows
7. Click the Arch Window tool; as preset select, and change the height to 2 m.
 * 7.1. Change the snapping to Draft Midpoint, and try selecting the bottom edge of the frontal wall; rotate the standard view as necessary to help you pick the edge and not the wall face; when the midpoint is active, click to place the door.
 * 7.2. Click the Arch Window tool again, and place another door, but this time in the midpoint of the rightmost wall; rotate the standard view as necessary.




 * the is the distance from the floor to the lower edge of the element. For doors the  is usually 0 m as doors are normally touching the floor; on the other hand, windows have a usual separation of 0.5 m to 1.5 m from the floor. The  can only be set when initially creating the window or door from a preset. Once the window or door is inserted, modify its placement by editing the  vector  of the  underlying Sketcher Sketch.

Creating custom doors and windows
8. Switch to the Sketcher Workbench; select the part of the wall to the right that has no door; click on the Sketcher NewSketch; select as attachment method. If the existing geometry obstructs your view, click on Sketcher ViewSection to remove it.

9. Draw a fancy sketch containing three closed wires. Make sure to provide constraints to all wires.
 * 9.1. The outside wire is the biggest one, and will define the main dimensions of the window object, and the size of the hole created when it's embedded in an Arch Wall. Make sure the dimensions are named appropriately, for example, and . A constraint also defines the curvature of the outer wire; give it an appropriate name, like.
 * 9.2. The second wire is offset from the outer wire, and together with it, they define the width of the fixed frame of the window. Name the offset appropriately, for example, . It will be used for both the top vertical and horizontal offsets. The bottom offset, if set to zero, will result in the fixed frame touching the bottom of the window; this can be used to model a door instead of a window. Give it an appropriate name, like.
 * 9.3. The third, innermost wire is offset from the second wire, and together with it, they define the frame of the window that can open. The innermost wire also defines the size of the glass panel. Give a name to this offset as well, for example,.
 * 9.4. In order to build succesfully the sketch, use horizontal (Sketcher ConstrainHorizontal) and vertical (Sketcher ConstrainVertical) constraints for the straight sides; think about using auxiliary construction geometry (Sketcher ToggleConstruction), and tangential constraints (Sketcher ConstrainTangent) to correctly place the arcs at the top. As the window is symmetrical in this case, consider using equality (Sketcher ConstrainEqual), symmetrical (Sketcher ConstrainSymmetric), and coincidence (Sketcher ConstrainPointOnObject) constraints where it makes sense.





10. Once the sketch is fully constrained, press to exit the sketch ((Sketcher LeaveSketch).
 * 10.1. Since a face of the wall was selected during the initial step of creating the sketch, the sketch is co-planar with that face but it may be in the wrong position. Change the X coordinate of in, in order to place the sketch centered in the wall. Use  so the sketch is centered in the wall, and it is one meter above the ground level.
 * 10.2. You can see the named constraints under . The values can be modified to see the sketch change shape immediately.





11. Change back to the Arch Workbench and, with the new selected, use Arch Window. A window will be created, and will make a hole in the wall. The window is based on a custom sketch, so it needs to be edited in order to correctly display its components, that is, the fixed frame, the inner frame, and the glass panel.



Setting up the custom window
12. In the tree view select underlying, and press , or change the property  to.

13. Double click in the tree view to start editing it.


 * 13.1. Inside the frame there are two panes,  and . There are three wires,, , and , and one component, . It is these components the ones that define the physical thickness of the frame and the solid or glass panels. A window created from a preset already has two components,  and . The custom window needs to be edited to follow this same structure.




 * 13.2. Click on, and click the button to eliminate it.


 * 13.3. Click ; this shows the properties of a new component like, , , , , , and . Give a name, such as , choose as , and click on  and then ; they should be highlighted in the 3D viewport. Add a small value for , , and check the checkbox to add the default value. This default value is the one assigned to the  property. Then click the  button.


 * 13.4. Click ; give another name, such as, choose  as , and click on  and then ; they should be highlighted in the 3D viewport. Add a sensible , , and , . Then click the  button.


 * 13.5. Click ; give another name, such as, choose as , and click on ; it should be highlighted in the 3D viewport. Add a sensible , , and , . Then click the  button. If any of the three components needs to be modified, select it and press ; every modification should be confirmed by pressing the  button.




 * 13.6. If everything is set, click to finish editing the window. The sketch may become hidden again, but the window will show distinct solid elements for the outer frame, the inner frame, and the glass. Give a value to  of  to assign a real thickness to the frame, which will be added to the value previously defined for the  component.





Duplicating the custom window
14. In the tree view select and its underlying. Then go to, and answer if asked to duplicate unselected dependencies. A new and  will appear in the same position as the original elements.

15. Select the new. Go to the property, and click on the ellipsis next to the  value. In the 3D viewport select the outer face of the wall which doesn't have any element, to the left of the first door that was created; rotate the standard view as necessary. Change the to [-1 m, 0 m, 0 m] to center the window, and click. The sketch and the window should appear in a new position.



16. You may adjust the dimensions of the new window by changing the named parameters in under, for example, ,. Then press + to recompute the model. If the wall doesn't show a bigger hole for the new window, select the wall in the tree view, right click and choose, then press + again.

17. These operations have changed the postion of the new window, but the opening in the wall doesn't look correct. It is slanted, that is, the hole is not perpedicular to the face of the wall. The problem is that has retained the  information of the original.



Normals of windows
18. Each Arch Window object controls the extrusion of its body and the opening that is created in its host wall by means of the.

The normal is a vector that indicates a direction perpedicular to a wall. When a window or door preset is created with the Arch Window tool directly over an Arch Wall, the normal is automatically calculated, and the resulting window or door is correctly aligned; the and  objects were created in this way.

In similar way, when a Sketch is created by selecting a planar surface, it is oriented on this plane. Then when the Arch Window tool is used, the window will use as normal the perpendicular direction of the sketch. This was the case with the object.

If the window is already created and needs to be moved to another place, as was the case with the duplicated object, the sketch needs to be remapped to another plane; doing this moves both the sketch and window, but the window doesn't automatically update its normal, so it has incorrect extrusion direction. The normal data needs to be calculated manually and input manually in the fields.

The three values of the normal vector are calculated as following.

Where the is the angle of the local Z axis of the sketch with respect to the global Y axis. When a sketch is created, it always has two axes, a local X (red) and a local Y (green). If the sketch is mapped to the global XY working plane, then these axes are aligned; but if the sketch is mappend on the global XZ or YZ planes, as is common with windows and doors (the sketches are "standing up"), then there is an angle that varies from -180 to 180 degrees. The angle is considered positive if it opens counterclockwise, and it is negative if it opens clockwise, starting from the global Y axis.





If we look at the geometry created so far, we see the following normals.


 * The local Z is aligned with the global Y, therefore, the is zero. The normal vector is
 * The local Z is aligned with the global Y, therefore, the is zero. The normal vector is

or is.


 * The local Z is rotated 90 degrees from the global Y, therefore, the is 90 (positive counterclockwise). The normal vector is
 * The local Z is rotated 90 degrees from the global Y, therefore, the is 90 (positive counterclockwise). The normal vector is

or is.


 * The local Z is rotated 45 degrees from the global Y, therefore, the is 45 (positive because it opens counterclockwise). The normal vector is
 * The local Z is rotated 45 degrees from the global Y, therefore, the is 45 (positive because it opens counterclockwise). The normal vector is

or is.


 * The local Z direction is found by using Draft Dimension and measuring the angle that the wall trace makes with the global Y axis, or any line aligned to it. This angle is, and the desired angle is the complement of this, so.
 * The local Z direction is found by using Draft Dimension and measuring the angle that the wall trace makes with the global Y axis, or any line aligned to it. This angle is, and the desired angle is the complement of this, so.

This means the local Z axis is rotated 63.43 degrees from the global Y, therefore, the is -63.46 (negative because it opens clockwise). The normal vector is

Therefore should be changed to.

After doing these changes, recompute the model with +. If the wall doesn't update the hole, select it in the tree view, right click and choose, then press + again.

19. The orientation of the extrusion of the window is resolved, together with the opening in the wall.

600px|center

Final remarks
20. As demonstrated, the initial placement of the Arch Window is very important. The user should either use the Arch Window tool that creates a preset that automatically aligns to a wall, or map the initial sketch on a planar surface, and build the window after that. If moving the window is necessary, the sketch should be remapped to a new plane, but the normal direction of the window needs to be recalculated.

The new normal direction can be obtained by measuring the angle of the new wall with respect to the global Y axis, considering whether the angle is positive (counterclockwise) or negative (clockwise), and using a simple formula.

The absolute magnitude of the normal vector should be one. That is, N

Resources
This tutorial was inspired by the tutorials from jpg87 in the FreeCAD forums.
 * Arch Create a custom window
 * Arch : How to use your custom Window