Argomento |
---|
Architettura |
Livello di difficoltà |
Intermedio |
Tempo di esecuzione |
60 minuti |
Autori |
vocx |
Versione di FreeCAD |
0.18 o superiore |
Files di esempio |
nessuno |
Vedere anche |
Nessuno |
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 be familiar with constraining sketches.
This tutorial was inspired by the tutorials by jpg87 posted in the FreeCAD forums.
See also the following thread for more information on the position of windows and doors.
See also the following page for some videos on how to align windows.
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 Edit → Preferences → General → Units. For example, MKS (m/kg/s/degree)
is good for dealing with distances in a typical building; moreover, set the number of decimals to 4
, 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 Edit → Preferences → Draft → Grid and snapping → Grid. Set lines at every 50 mm
, with major lines every 20
lines (every meter), and 1000 lines
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.
5. Use the Draft Wire tool to create a wire. Go counterclockwise.
import FreeCAD
import Draft
p = [FreeCAD.Vector(0.0, 4000.0, 0),
FreeCAD.Vector(2000.0, 0.0, 0.0),
FreeCAD.Vector(4000.0, 0.0, 0.0),
FreeCAD.Vector(6000.0, 2000.0, 0.0),
FreeCAD.Vector(6000.0, 5000.0, 0.0)]
w = Draft.makeWire(p, closed=False)
6. Select the DWire
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.
Base wire for the wall
Wall constructed from the wire
7. Click the Arch Window tool; as preset select Simple door
, and change the height to 2 m.
Snapping to the midpoint of the bottom edge of the wall to place the door
Sill height
is the distance from the floor to the lower edge of the element. For doors the Sill height
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 Sill height
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 DatiPosition vector [x, y, z]
of the underlying Sketcher Sketch.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 FlatFace 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.
Width
and Height
. A constraint also defines the curvature of the outer wire; give it an appropriate name, like HeightCurve
.FrameFixedOffset
. 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 FrameFixedBottom
.FrameInnerOffset
and FrameInnerBottom
.Constraints for the outer wires of the sketch that form the window
Constraints for the inner wires of the sketch that form the window
10. Once the sketch is fully constrained, press Close to exit the sketch (Sketcher LeaveSketch).
[4 m, 1 m, 0 m]
so the sketch is centered in the wall, and it is one meter above the floor level.Window sketch moved to the desired position on the wall
Named constraints of the sketch, which can be modified without going inside the sketch
11. Change back to the Arch Workbench and, with the new Sketch002
selected, use Arch Window. A window will be created, and will make a hole in the wall. The window is made from a custom sketch, and not from a preset, 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.
Custom window created from the sketch; it still doesn't have a proper frame, nor glass
12. In the tree view select Sketch002
underlying Window
, and press Space, or change the property VistaVisibility to true
.
13. Double click Window
in the tree view to start editing it.
Window elements
dialog there are two panes, Wires
and Components
. There are three wires, Wire0
, Wire1
, and Wire2
, and one component, Default
. The wires refer to the closed loops that were drawn in the sketch; the components define the areas in the sketch that will be extruded to create frame or glass panels with real thicknesses; these areas are delimited by the wires. A window created from a preset already has two components, OuterFrame
and Glass
. The custom window needs to be edited to have a similar structure.Dialog to edit a window or a door
Default
, and click the Remove button to eliminate it.Name
, Type
, Wires
, Thickness
, Offset
, Hinge
, and Opening mode
. Give a name, such as OuterFrame
, choose Frame
for Type
, and click on Wire0
and then Wire1
; they should highlight in the 3D viewport. Add a small value for Thickness
, 15 mm
, and check the checkbox to add the default value. This default value is the length assigned to the DatiFrame property; a similar default can be assigned to the DatiOffset property. Click the +Create/update component button to finish editing the component.InnerFrame
, choose Frame
for Type
, and click on Wire1
and then Wire2
. Add a sensible Thickness
, 60 mm
, and Offset
, 15 mm
. Then click the +Create/update component button.Glass
, choose Glass panel
for Type
, and click on Wire2
. Add a sensible Thickness
, 10 mm
, and Offset
, 40 mm
. Then click the +Create/update component button. If any of the three components needs to be modified, select it and press Edit; modifications are only saved after pressing the +Create/update component button.Editing a previously defined component of a window or a door
OuterFrame
, the InnerFrame
, and the Glass
. Give a value of 100 mm
to DatiFrame to assign a default thickness, which will be added to the value specified in the OuterFrame
component.Property view of the window to add default Frame length, Offset length, and other options
Finished window with appropriate components embedded in the wall
14. In the tree view, select Window
and its underlying Sketch002
. Then go to Edit → Duplicate selection, and answer No if asked to duplicate unselected dependencies. A new Window001
and Sketch003
will appear in the same position as the original elements.
15. Select the new Sketch003
. Go to the DatiMap Mode property, and click on the ellipsis next to the FlatFace
value. In the 3D viewport select the left side of the wall which doesn't have any element; rotate the standard view as necessary. Change the Attachment offset
to [-1 m, 0 m, 0 m] to center the window, and click OK. The sketch and the window should appear in a new position.
Dialog to edit the attachment plane of the sketch
16. You may adjust the dimensions of the new window by changing the named parameters in Sketch003
under DatiConstraints, for example, set Height
to 2 m
, and Frame Fixed Bottom
to 0 m
. Then press Ctrl+R 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 Mark to recompute
, then press Ctrl+R again.
17. These operations have changed the position of the new window, but the opening in the wall doesn't look correct. It is slanted, that is, the hole is not perpendicular to the face of the wall, and it may even cut other parts of the wall. The problem is that Window001
has retained the DatiNormal information of the original Window
.
Incorrect opening in the wall due to bad Normal of the window
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 DatiNormal.
The normal is a vector [x, y, z]
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 first two objects, Door
and Door001
, 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 to the sketch. This was the case with the third object, the custom Window
.
If the window already exists and needs to be moved, as was the case with the duplicated Window001
object, the sketch needs to be remapped to another plane; doing this moves both the sketch and the window, but the latter doesn't automatically update its normal, so it has incorrect extrusion information. The normal needs to be calculated manually and written to DatiNormal.
The three values of the normal vector are calculated as following.
x = -sin(angle)
y = cos(angle)
z = 0
Where angle
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 mapped on the global XZ or global YZ planes, as is common with windows and doors (the sketches are "standing up"), then the local Z (blue) forms an angle with the global Y axis; this angle 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.
Local coordinates of a sketch that is "standing up", that is, mapped to the global XZ plane
Intended directions of the normals for each door and window
If we look at the geometry created so far, we see the following normals.
Door
angle
is zero. The normal vector isx = -sin(0) = 0
y = cos(0) = 1
z = 0
or DatiNormal is [0, 1, 0]
.
Door001
angle
is 90 (positive, because it opens counterclockwise). The normal vector isx = -sin(90) = -1
y = cos(90) = 0
z = 0
or DatiNormal is [-1, 0, 0]
.
Window
angle
is 45 (positive, because it opens counterclockwise). The normal vector isx = -sin(45) = -0.7071
y = cos(45) = 0.7071
z = 0
or DatiNormal is [-0.7071, 0.7071, 0]
.
Window001
Wire
) makes with the global Y axis, or any line aligned to it. This angle is 26.57
; the desired angle is the complement to this, so 90 - 26.57 = 63.43
.This means the local Z axis is rotated 63.43 degrees from the global Y, therefore, the angle
is -63.46 (negative, because it opens clockwise). The normal vector is
x = -sin(-63.43) = 0.8943
y = cos(-63.43) = 0.4472
z = 0
Therefore DatiNormal should be changed to [0.8943, 0.4472, 0]
.
After doing these changes, recompute the model with Ctrl+R. If the wall doesn't update the hole, select it in the tree view, right click and choose Mark to recompute
, then press Ctrl+R again.
19. The orientation of the extrusion of the window is resolved, together with the opening in the wall.
Correct opening in the wall due to proper Normal of the window
20. As demonstrated, the initial placement of the Arch Window is very important. The user should either
If a window already exists, and it needs to be moved, the supporting sketch should be remapped to a new plane, and the DatiNormal 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 this angle is positive (counterclockwise) or negative (clockwise), and using a simple formula.
x = -sin(angle)
y = cos(angle)
z = 0
To confirm that the operations are correct, the absolute magnitude of the normal vector should be one. That is,
abs(N) = 1 = sqrt(x^2 + y^2 + z^2)
abs(N) = 1 = sqrt(sin^2(angle) + cos^2(angle) + z^2)