## Creating Parametric Objects

The Packer object and its derivative Replicator provide tools for parametric object creation. Parametric objects can be rescaled and they keep the desired component dimensions. A kitchen cabinet is a good example of an object, which is frequently needed in various sizes. Rescaling a cabinet must not change the thickness of the construction material (wooden boards).

Modeling a parametric object is not a simple or automatic process. The shape must be divided into horizontal, vertical and depth layers. Behavior of each component must be defined. Inclusion of material mapping objects is wisest to plan in advance. These additional efforts in the modeling phase are rewarded later, because the reusability of the object is much greater than of models, whose dimensions are fixed.

 As an example, we will create a complete window object shown in the attached image. Tutorial level: Medium/Advanced Example project: tutorprojects/modeling/packer/step1-step9 A window can be divided into depth layers in a natural way: Outer frame (mouldings outside the house) Panes and the surrounding panels Interior mouldings

### Outer Frame

Take a front view and enable parallel projection. Drag and drop a suitable grid, say 1 cm, from the grids tab of the select window into the view window. Zoom the view so that you see approximately one meter of space. We will model the window in its minimal size.

The topmost board of the outer frame of our example window has beveled edges. The beveling angle, 45 degrees, must not change when the window is resized. Therefore, we must split the board into 3 sections.

 Activate the Analytic/Polyhedron tool from the tool bar. Draw the left end of the board as shown in the picture on the right. After the fifth point, click Accept to finish the tool. Change the depth of the board to 0.02 meters using the tool bar control.

Activate the Analytic/Cube tool and draw the middle section. Make it 30 cm wide and 10 cm high. When the cube is drawn, change its depth to 0.02 meters. Then duplicate the polyhedron at the left end and use the Transformation/Mirror tool to flip it horizontally. The gaps between the parts can be 0.05 meters at this stage. Do not make them much wider because they will contribute in the minimal width of the frame.

Let's rename the components so that it will be easier to manage them. Slowly double click the name of the first polyhedron in the select window and rename it as 'left'. Rename the cube as 'mid' and the second polyhedron as 'right'.

 Multi select all three objects (selection order is not important). To make sure that geometry will be arranged in the correct direction, open the MiscTools bar below the select window, click the little triangle at the right side of the Norm tool and select Rotate from the list. The coordinate handles of all three objects become aligned with world's directions. Especially polyhedrons may have unusual handle directions because they include some diagonal lines. The packer tool, which we will apply next, will take its packing directions from the first selected object. Make sure packed objects have proper handle directions

Having all three objects selected, go to the Measure tool tab and activate the Packer tool. The default options are suitable; Orientation=Detect means that the tool will examine how the selected objects are initially arranged and pack them accordingly. In our case, the objects are placed side by side along the X axis, and the tool will select X directed packing accordingly. Hit the Accept button to finish the tool.

Note Packing order is defined by the pivot points of selected objects. Pivot point is the center point of the transformation handles (3 RGB colored circles and axis lines), which become visible when the object is selected. The pivot point can be moved by dragging it with the mouse. You can guide the packer tool by arranging the pivot points in a suitable way.

A new item packer appears to the select window. The selected parts were placed to its sub hierarchy. In the view window, you will see a box-like container, which includes the components. Little arrows labeled with X and Y show the orientation of packing. Objects are packed along X direction as planned. Select the packer and rename it as 'top_board'.

 Make sure the packer object is still selected and open the property window. Go to the Spec tab and open the Packing Options frame. The Target selector lists the three components managed by the packer. Select Target=left. Then clear the Expand option, if it is set. The packer will not expand the space reserved for the leftmost part proportionally to fill the packer space. The left part will occupy only the minimal space. Consequently, the left part is placed to the left end of the packer. Pick the 'right' object from the Target list of the packer gadget and clear the Expand option if set. Then select 'mid' from the Target list. Enable Expand, as the middle part should indeed expand to fill the gap between the left and right ends. Furthermore, activate the Fill X Option, so that not only the container space of the middle part but also the actual geometry expands. Packing options for the leftmost part

The top board packing is now ready. The three parts should now be joined without gaps. The tool bar shows the width of the packer. Try changing it from the current value (should be about 0.6 meters) to say 1 meter. The middle part stretches to fill the increased dimension. Then set the width to 0.6 meters.

We have so far created a very simple object, but it already shows the essence of the packer object: ability to easily control stretching and placement of components in rescaling. The top board needs a couple of finishing touches before it is ready for use. First of all, let's hide the packer box to make the wireframe simpler and cleaner. In the property window, go to the Wire tab and activate the Hide Geometry option.

Next we will assign a material to the board. Unselect all objects by clicking empty area on select window. Take a side view. Switch to the material tab of the select window. Select wood from the library, and then activate Map/Parallel from the popup menu. Press the Shift key down and draw a symmetric cube in the view window. Shift key helps to keep all edges of the map cube equally long, which is important for the procedural wood material. Draw the cube about 0.05 meters wide and high. The second click finishes the parallel map tool.

 Take a front view and hit the render button to make sure that the board is made of pine wood. You will probably see some unexpected seams in the wood pattern. This is because the procedural wood is configured for parquet floors and other similar wide surfaces made of several parts. To fix the problem, use the property window and change the Block size of the wood material to ' 0 0 0 '. The board will become like cut out of from a single trunk. Continuous wood

Hint: Rotating the parallel map slightly from the top view may improve the look of the pine wood pattern, because the board is no longer cut perfectly along the wood grains. Real planks are cut that way because of the conical tapering of trunks.

 Switch back to the leftmost Geometry tab of the select window. Drag the parallel mapping object into the hierarchy of the top_board packer. Select the parallel map and apply WF-inv tool, which is in the MiscTools bar below the select window. This hides the wireframe of the material map object. We do not want it to clutter the clean wireframe of the finished object. The board element is now ready. The hierarchy of the finished top board

We will need three more boards for the lower part of the frame. This time we will not make any corner cuts or other decorations, so the modeling process is a just a simpler version of the steps above. Take the front view, activate the Analytic/Cube tool and draw a cube, which is 0.1 meters wide and 0.4 meters high. Remember to set its depth to 0.02 meters.

The new cube selected, activate the packer tool. Click Accept to finish the tool with the default options. Rename the new packer as 'board1'. Open the property window and enable Packing Options/Fill Y and Expand for the new cube. Set Wire tab's Hide Geometry option for the new packer.

Go to the select window and select the parallel map object under the top_board packer. Press Ctrl key down and drag the parallel map into the board1 packer. Ctrl dragging creates a copy of the object. Find and select the created copy from the hierarchy of the board1 packer. Apply MiscTools/WF-Inv button to make it visible again. Use the circular transformation handles to rotate the parallel map 90 degrees, so that wood grains match the direction of the board. Move the mapping on top of the new board. Make the map WF-invisible again.

Duplicate the board1 by Ctrl-dragging its red translation handle in the view window. Place the copy to the opposite side of the frame and rename it as 'board2'.

Hit Ctrl-d hotkey to duplicate board2. Press shift key down and rotate the new board 90 degrees using the circular rotate handle (Shift locks rotation to 45 degree steps). Rename the new horizontal board as mid_board and place it between the vertical boards.

 The horizontal board is most likely too long to match the gap. Try entering the correct measure to the Height control in the tool bar (Height controls the length of the rotated board). The board does not become shorter. This is because the packer defines a minimal size, to prevent accidental overlapping of packed parts. To redefine the size, open the Geometry Managing frame in the property window and set the Min. Height value of mid_board to 0.2 meters. Then select the child cube of the mid_board packer and change its Height to 0.2 meters. Now the middle part matches the gap. Three new boards added

Select board1, which has a proper orientation, then multi select board2 and mid_board, too. Activate the Packer tool and Accept it. Note how the new packer moves the middle board upward, because the default alignment option is Center.

 Rename the new packer as lower_frame. In the property window's Spec tab, set Target=board1. The leftmost board should not expand in the packing direction. Therefore, make sure that the Expand option is not set. Set Fill Y option, because we want the board to fill the packer vertically. Then set Target=board2 and apply the same options: Expand off, Fill Y enabled. Select mid_board from the Target gadget. The middle part will be the expanding component, so enable Expand. This part is supposed to stretch horizontally, so enable the Fill X option. Select Anchor=North from the bottom of the property window. The mid_board moves to the bottom of the packer. To add a suitable offset, set Pad Y = 0.05 meters. Structure of the lower frame

Try changing width and height of the lower_frame packer from 0.4 meters to say 0.6 meters, just to test that rescaling works as expected. Do not worry if lower frame expand over the top board; the next packer level will fix that. If scaling does not work as expected, recheck all packing options of sub objects and make sure they match the instructions above.

Restore the dimensions back to the original size 0.4 * 0.4 meters. Use the wire tab of the property window to hide the wire frame box of the packer.

The next step is to combine the lower frame and the board on the top. Make sure that the pivot points of these two objects are properly centered. In other words, pivots should be approximately on the same vertical line, so that the packer tool will understand that the parts should be packed vertically. Drag the pivots to the center points if necessary, or use the Center Pivot tool.

 Select both objects, activate the Packer tool and click Accept. Rename the new packer as 'outer_frame'. Set the packing options of its child objects as follows: Set Target=top_board, clear Expand and enable Fill X Set Target=lower_frame, enable Expand, set Pad X=0.1 and then enable Fill X and Fill Y As usual, hide the geometry of the new packer Outer frame of the window finished

The outer frame is now ready. Change the width and height dimensions to w=0.8 m, h=0.65 m. Check that the frame scales properly. Save the project to backup your work.

### Window Panes

 The frames of the window panes can be modeled easiest using NURBS modeling tools. Take a top view and zoom in to see the left edge of the exterior frame better. Activate the NURBS/Curve tool. On the second row of the toolbar, set Order=Polygonal and enable the Closed option. Draw the profile of the window frame for example as shown in the picture below. After the 4th point, click Accept. You can naturally define a more sophisticated profile, if you like. Our example profile is 3 cm wide and 4 cm deep.
 The upper profile curve is skewed 45 degrees Take a front view. Move the created profile curve to the window corner. We will join frames using a diagonal beveling. Packer-managed assembly needs a corner piece, which is modeled as follows. Duplicate the created profile 2 times (Ctrl-d hotkey). Move the first copy 3 cm (=width of the profile) down from the window edge. Select the second copy, activate the Transformation/Skew tool, click on the left end of the profile and then on the right end. Move the mouse down until the profile is skewed 45 degrees. Click third time to finish the tool.
 Select the two duplicates of the profile curve. The right end of the second toolbar row shows X-Sect tool. Activate it and click Accept. A new NURBS mesh appears to the select window. Rename it as 'corner'. Duplicate the original profile again. Move the original profile below the corner piece, and the new copy about 5 cm below the original profile. Select both curves, and use the X-Sect tool to create a new surface. Rename it as 'mid_part'. Duplicate the corner object. Use the tool Transformation/Mirror to flip the copy vertically. Place the mirrored copy exactly below the other two parts, as in the illustration. Select all three NURBS meshes. The beveled corner pieces may have strange object space orientation. Go to the MiscTools bar, open the side menu of the Norm tool and select Rotate to fix this. Then activate the packer tool and click Accept. Rename the new packer as 'vertical_unit'. Set the Hide Geometry option in the property window's wire tab. Three NURBS meshes

Select the new vertical_unit packer, open the property window and go to the Spec tab's Packing Options frame. The child objects should be packed as follows:

• Set Target=corner and clear the Expand option.
• Set Target=copy of corner and clear the Expand option
• Set Target=mid_part and enable the Fill Y option. Expand should also be enabled.

As usual, test the packer by increasing the height. Only the middle unit should stretch. Reset height back to the original value (0.11 m).

Deselect all objects, take a top view and switch to the material tab. Select wood material and start the Map/Parallel tool from the popup menu. Draw a 5 cm * 5cm box around the vertical_unit. Remember to hold Shift key down so that parallel map becomes symmetric in all dimensions. When the parallel map is drawn, switch to the geometry tab of the select window and drag and drop the parallel map object into the hierarchy of vertical_unit. Finally make the parallel map WF-Invisible from the MicsTools bar.

 Go back to the front view. Duplicate vertical_unit, rotate the copy 90 degrees and move it so that the units form one half of the frame, as shown in the picture below. Rename the copy as 'horizontal_unit'. Joining diagonally beveled pieces using a packer is a bit problematic. The control boxes of the two packers actually overlap in their current position. Normally, packer places the child objects side by side. We can pack the overlapping parts together permanently as follows.

Select the vertical_unit packer. Start the Packer tool and Accept. Rename the new packer as vertical1. Open the property window and select vertical_unit as Target and set the Packing Options as follows:

• Expand enabled
• Set Pad Y = -0.03 meters (=width of the profile)
• Enable the Fill Y option

Thanks to the negative Y padding, the corner pieces stick out from the control box of the packer. Hide the geometry of the new packer in the Wire tab of the property window. The height of the vertical1 increased when Y padding was changed, so move the pieces to match them seamlessly again. Then duplicate the vertical1 packer, rotate or mirror the copy 180 degrees and place it to the other side of the pane. Rename it as vertical2. Duplicate the horizontal_unit as well, rotate the copy 180 degrees and move it to the bottom to complete the frame. Rename the last item as horizontal_unit2.

Activate Analytic/Cube tool and draw a cube, which fills the hole inside the frame. Use the Depth control of the second row of the tool bar to make the cube thinner, for example to 0.005 meters (=5 mm). While the cube is selected, go to the material tab of the select window, drag the material glass and drop it into the view window. This assigns the glass to the cube. Switch back to the geometry tab of the select window. Take a side view and move the cube in the middle of the frame. Rename the level, which contains the cube and the glass material map as 'glass'.

Select both vertical pieces and the glass level. Apply MiscTools/Norm/Rotate to make sure that object spaces are properly aligned. Then start the Packer tool and click Accept. Rename the new packer as mid_frame. Hide its control box geometry in the Wire tab of the property window. The packing options of the children are:

• vertical1: Expand disabled, Fill Y enabled
• glass: Expand, Fill X and Fill Y enabled
• vertical2: Expand disabled, Fill Y enabled

Note If the frame profile includes a groove for the glass, wrap the glass object into a packer and apply negative X and Y padding to it. Then the glass extends out from the packer into the groove of the surrounding frame.
 Finally, select horizontal_unit, mid_frame and horizontal_unit2. Apply MiscTools/Norm/Rotate. Create a new packer with the default options. The packing options are: horizontal_unit: Expand disabled, Fill X enabled mid_frame: Expand, Fill X and Fill Y enabled horizontal_unit2: Expand disabled, Fill X enabled

One window pane is now ready. Rename it as 'pane' and adjust its Width and Height to fill one quarter of the whole window (0.2 * 0.2 meters in our example). Set Hide Geometry for the pane packer to keep the wireframe clean and simple.

Duplicate the pane and move the copy to the right side of the first pane. Select both panes, and create a packer called top_row. Using the property window, enable Expand, Fill X and Fill Y for both child objects of the packer. Duplicate the top_row, move it below the top panes, then rename the copy as bottom_row. Select both rows and create a new packer. Rename it as 'panes'. Enable Expand, Fill X and Fill Y for its child objects (top and bottom rows). As before, hide the geometry of the created packers. Test the quad pane system by adjusting its width and height to, say, 0.6*0.8 meters. Then reset the size back to width=0.4 m, height=0.4 m.

### Window Edges

 The next parts are simple to create. We will add 4 cubes (wooden boards) around the panes. The purpose of these cubes is to cover the edges of the window hole. Therefore, the board depth must be adjustable so that it can be matched with the thickness of the wall. In order to achieve desired z-direction packing, the board layer is split into two parts, as explained below. The first part consisting of 4 packed cubes surrounds the panes, as shown in the picture below.
 Take a front view and create a 2 cm wide cube. The height should match the height of the window panes (40 cm), and depth the depth of the pane profile (4 cm). Take a side view and move the cube so that it matches the side of the panes. The cube selected, activate the packer tool and accept it. Rename the packer as board_left. Deselect the board and switch to the top view. Go to the materials tab, make sure wood is still selected and activate the Parallel Map tool from the popup menu. Draw the mapping cube (5cm*5cm) around the board. Switch back to the geometry tab and drag and drop the parallel map into the new board_left packer. Make the parallel map WF-invisible. Select the board_left packer, open the property window, set Target=cubeX and set the Fill Y and Expand options. First board added

Duplicate the board_left packer and move it to the opposite side of the panes. Rename it as board_right. Make two copies of the board_left, rotate them 90 degrees and move them above and below the panes. Rename the copies as board_top and board_bottom. Note that the top and bottom boards are not long enough yet, but the parent packers will later fix this.

Select board_left, panes and board_right. Activate the packer tool and accept. Set the packing options as follows:

• Target=board_left: Expand=Off, Fill Y enabled
• Target=board_right: Expand=Off, Fill Y enabled
• Target=panes: Expand=On, Fill X and Fill Y enabled

Rename the new packer as mid_part.

 Then select the board_top, mid_part and board_bottom packers. Apply MiscTools/Norm/Rotate to fix the object space orientation. Then create a new packer, which packs the three selected components. Rename it as wrapped_panes and set the packing options for its sub objects as follows: Target=board_top: Expand=Off, Fill X enabled Target=board_bottom: Expand=Off, Fill X enabled Target=mid_part: Expand=On, Fill X and Fill Y enabled Next we create the z-expandable layer of the wrapping boards. To make things simpler, just duplicate the wrapped_panes object and rename it as expanding_wrap. Move it behind the panes from the side view, so that it matches the other parts seamlessly. wrapped_panes copied and moved

Open the hierarchy of the new duplicated packer expanding_wrap. Find the packer called panes and delete it. Removing sub objects of a packer usually changes the way how children are packed, so select the parent packer (called as mid_part) of the deleted panes and make sure that the children have correct packing options. Both boards should have Fill Y enabled, and Fill X and Expand disabled. Do not worry if the vertical boards move when you deleted the panes. We will next add a new component, which restores the shape.

 If the window will be used with the building construction tools, it needs a hole cutting feature. Take a top view, activate the Building tool and create a straight wall behind the window. The direction should match the window. Click Accept to finish the building tool after the second point. Take a front view and activate the hole tool. Draw a hole, which matches the panes (40 cm * 40 cm). When the hole is added, explore the hierarchy of the building object to find the hole item (it is placed in a sub folder called holes). Drag and drop the hole to the hierarchy of the mid_part packer, between the board_left and board_right objects (that's the hierarchy position where panes were before we deleted it). You can also make the hole WF-invisible; it's wireframe does not show any information that is not already available from other parts of the window. Select the new parent of the hole (packer mid_part), set Target=hole and enable Expand, Fill X and Fill Y. In other words, the hole fills the middle area of the expanding_wrap packer.
 You can now delete the building object; it was just used for obtaining the hole. To save some work, you can naturally save a hole object, reload and scale it whenever you create new hole-cutting library objects. Select the top level packer 'expanding_wrap'. On the property window, set Target=[All] and activate Fill Z option. Z filling is now used first time. After that, select each child packer from the select window and set the Fill Z option to all their sub objects. You should go trough all nested levels of packers and activate Fill Z for all children of all packers. Then try changing the depth of expanding_wrap packer from the current value 4 cm to say 10 cm. Make sure that all boards expand properly. If not, recheck that all Fill Z options are enabled. Finally, reset depth back to 4 cm. expanding_wrap packer hierarchy

### Interior Mouldings

 The last part of the window system is interior mouldings. First create four wooden boards, approximately 4 cm wide and 1 cm thick, which surround the window as in the example picture. Each board is a packer, which includes the geometry and the wood map. The geometry is packed using Fill X or Fill Y and Expand options. We do not repeat the creation steps here; they are identical with the steps for creating the edge wrapping boards above. In the example picture, the mouldings are joined in 90 degree angle. You can also use 45 degree beveled cuts between the mouldings, just like for the window panes. They are a bit more laborious to set up, though.

For the sake of clarity, rename the interior moulding items as moulding_left, moulding_right, moulding_top and moulding_bottom. Select moulding_left and moulding_right. Make sure the red object axis is horizontal when seen from the front view; if not, apply MiscTools/Norm/Rotate. Then create a new packer, which includes the two vertical mouldings. Rename the new packer as vertical_mouldings.

After the creation, the vertical mouldings jump slightly from their original positions. Open the property window and change the packing options as follows:

• Target=moulding_left: Expand and Fill Y enabled, Anchor=West
• Target=moulding_right: Expand and Fill Y enabled, Anchor=East

Now the mouldings return back to their correct positions.

Next select moulding_top, vertical_mouldings and moulding_bottom. Apply MiscTools/Norm/Rotate to fix the object spaces. Then create a new packer including these 3 components and rename it as mouldings. The packing options of the children are:

• Target=moulding_top: Expand off, Fill X on
• Target=moulding_bottom: Expand off, Fill X on
• Target=vertical_mouldings: Expand, Fill X and Fill Y enabled

### Component Assembly

The window components are ready. We need to assemble them into a single packer. This phase requires some planning, because the components are not all symmetric. Simple centering is not enough - the outer frame must have certain offset values with respect to the other window.

First we pack the panes, the edge boards and the interior mouldings. These are symmetric and can be managed in a simple manner. Take a front view and select the three above-mentioned objects one by one. Object handles should be centered in the middle of the window (exactly in the middle crossing of the 4 panes). If not, drag the handle center (pivot point) into the center of the window. Take a side view and ensure that each component has its handles inside the geometry. The packer tool uses the pivot points to detect the direction of packing. Move the components so that they fit together seamlessly. Select all 3 parts (wrapped_panes, expanding_wrap, mouldings) and create a new packer. Rename it as window.

Set the following packing options for the children of the new window packer:

• Target=mouldings: Expand off, Fill X and Fill Y on
• Target=wrapped_panes: Expand off, Pad X = Pad Y = 0.02 meters, Fill X and Fill Y on
• Target=expanding_wrap: Pad X = Pad Y = 0.02 meters, Expand on, Fill X, Fill Y, Fill Z enabled

 Next we pack the outer frame and the window together. To solve the asymmetric vertical positioning problem, take a front view and create two cubes. The first cube (rename it as 'fill cube1') should fill the gap between the top edge of the interior mouldings and the top edge of the outer frame. The second cube ('fill cube2') fills the respective area below the window; see the attached picture. Take a side view and make sure the cubes are aligned with the window packer. Decrease the depth of cubes so that they match the depth of the window packer (9 cm). Select both cubes and make them WF- and RT-invisible using the MiscTools tab. The only purpose of the cubes is to reserve some space in packing. Two highlighted 'place holder' cubes define asymmetric packing offsets from edges

Select the cubes and the window packer. Create a new packer and rename it as window. Set the packing options:

• Target = fill cube1: Expand off, Fill X and Fill Z may be enabled (filling is not relevant for invisible cubes)
• Target = fill cube2: Expand off, Fill X and Fill Z on
• Target = window: Expand on, Fill X, Fill Y, Fill Z on

The final packing in depth direction needs some special attention. So far, we have created packers using the automatic Detect option. The packer tool has figured out the packing arrangement and orientation itself. Next, we will guide the highest packing orientation manually, because we want to define, which point is the fixed anchor when dimensions change. For a door, the anchor point should be in the bottom front edge of the door. Then the door elevation will not change when the door height changes. For a window, the anchor point should probably be at the top, so that top edges of several windows remain aligned regardless of applied height changes.

Take a front view. Select the outer_frame first, then multi select the window. This time the selection order is important! Start the packer tool. Do not click Accept right away. Instead, change Orientation control in the toolbar to Z (we did not bother lining up the pivot points above). Click first time on the top left corner of the whole window object. Then move the mouse down and to the right, until the packer box matches exactly the width and height of the window. Click second time to finish the packer tool. The new packer has its anchor set to the top left corner of the view, as the XY arrows indicate. Hide the control box of the packer from the Wire tab's Hide Geometry option of the property window.

Rename the new packer as window; this will be the final window object. Pack the children objects as follows:

• Target = outer_frame: Expand off, Fill X and Fill Y on
• Target = window: X Pad = 0.16 m, Expand on, Fill X, Fill Y and Fill Z on

The parametric structure of the window is now ready.

### Drag and Drop Settings

The final step of the tutorial is to set convenient properties for the window object considering its later use in house construction projects.

Select the complete window object (highest packer level). Make sure that its sub hierarchy folder is closed in the select window. This ensures that you can select the complete window object simply by clicking its wireframe on a view window. If the sub hierarchy is opened, view selections would activate sub objects, which is inconvenient considering possible transformations to new positions.

Open the property window. Go to its leftmost Gen tab. Set Hit-Invisible option for the window. This will make snap operations in complex models - with tens or even hundreds of windows - faster.

Note Objects, which snap together (for example kitchen cabinets) should not be totally Hit invisible. However, their internal parts, such as shelves and minor details (handles, decorations) can be made Hit invisible to improve performance.

Switch to the Spec tab in the property window. Open the Drag and Drop Snapping frame. Here you can define what happens when the window object is dropped from the object browser to a view. The following options are suitable, when the window object handles are aligned with the world space. You can check the alignment by taking a front view while the window is selected. Red axis should point to the right, green axis up and blue axis towards the viewer. If the space is not like this, apply the MiscTools/Norm/Rotate to fix it.

• Space = Object. Snap targets are searched in directions defined by the window geometry.
• Dir1 = XZ. Window snaps to the nearest wall in XZ direction (horizontally). It does not snap to roof or floor.
• Dir2, Dir3 = None. Secondary snap directions can be inactive. These options are usually activated for corner searching. Our general purpose window object is not corner specific.
• Rotate=H,P. Object is first rotated around its y axis (Heading angle) to match the snap surface. Then it is rotated by its x axis (Pitching angle). Walls are usually vertical, so pure H (Heading) rotation would be appropriate for most cases, too.
• Axis=Z. The positive Z axis of the object will be rotated to match the surface normal of the wall. In our window, positive Z axis corresponds to the outer side of the window. Therefore, the outer window frame is rotated to the drop side of the wall. With these settings, the window should always be dropped outside the wall.
• Fit=Pivot. The object is moved so that its pivot point matches the snap position.
• Range=2 meters. This is a suitable finite snapping range. You can temporarily disable snapping by dropping objects farther away from the walls than this limit. On the other hand, it is easy to drop the window quickly within this snap range from a desired target wall.

 Take a side view and make sure that pivot point is placed between the outer frame and the rest of the window - see the picture below. If not, drag the pivot point there. From the front view, drag the pivot point to the center of the window. Move the window object up/down so that the window is placed vertically to a suitable default height. For example, the pivot point can be 1.5 meters above the ground level. The elevation of windows in each building project will naturally depend on the wall and base heights, but this kind of default elevation ensures that wall-window snapping will work. Windows, which have been quickly drop-snapped to walls, can later be moved up or down. Set the default size of the window using the dimension controls (Width/Height/Depth) of the toolbar. The window was modeled above to a minimal size w=0.8m h=0.65m d=0.11 m. A more common size might be 1.2*1.2*0.23 meters. Place the pivot behind the outer frame
Note The dimensions include the mouldings. If you want to control the size using the actual hole dimensions, drop the window into a new packer level and add some negative X and Y padding, which compensates the mouldings.

We can also optimize the real-time drawing of the window. When shaded OpenGL mode is enabled, the program computes up to several hundreds of pixels wide preview texture for each component of the window. The window object we created is actually not that simple; it includes almost 100 sub objects! Accurate preview computation will take long time when several tens of windows have been added to the scene.

We can conveniently change all objects using the powerful advanced selection tool. The tool is available below the select window; click the toolbar to open it. First clear all selection by hitting the Clear button. Switch to the Class tab of the Advanced Selection window. It shows all object types included in the current scene. Find Polyhedron from the tree and click it to activate the class. Then click the Select button to select all polyhedrons of the window. Next activate Rectangle from the class tree and click Select. Then activate Cube class and click Select. Finally activate Nurbs Mesh class and click Select. Now all geometric surface items included in the window object have been selected. Click the Advanced Selector bar to shrink the window back to its original size.

Go to the property window's Wire tab. Change the texture Quality to a low value, for example 8. You can also reduce Shaded Quality to 1 or 2 to achieve even faster OpenGL drawing.

### Saving with a Thumbnail and Materials

Let's create a nice thumbnail image for the window. Take a side view, zoom out and create a point light source above and in front of the window. Navigate the view to find a nice viewing position, which shows the shape of the window well (maybe a direct front view is OK). Zoom in so that window fills most of the view. Hit zero hotkey '0' to render the view. Open File/Save As window and click the Thumbnail image square to record the image from the view. You can also fill in the author and the comment information.

 Close the Save Dialog without saving. Instead, open the File Browser window. Select a suitable target folder for saving in the browser window. Then drag the window object from the select window and drop it to the browser's object thumbnail area at the right side of the window. Drag and drop to the browser window saves the dropped object with the current project thumbnail and all materials that were used in the object. It is a quick way to save all relevant object information. You can now find the created object from the browser window and start using it in your house construction projects.