Wood Sets

© 2002 Winston Mitchell

Why This Tool?

When working on complex designs that will be realized in wood, materials can be a real drag on productivity. Projects can easily contain dozens of parts. Applying materials to all of them can be very tedious. If you want to be able to edit the materials efficiently, you are forced to draw all parts in the orientation of the material. While this is efficient in terms of the ability to update materials, it can make drawing more difficult than it otherwise would be. In addition, it is very painful to get the appearance of rift-sawn wood with this method.

What is needed is an easy way to generate "wood sets" to facilitate assigning materials, no matter how a part was drawn, and to experiment with different wood designs and their effect on the rendered drawing. To solve this problem I have written a macro that is suitable for use in both TurboCAD Professional v7.1 and v8. (See the "Wood Materials" thread on IMSI's TurboCAD v8 forum.)

Special note for people whose PCs use the "x.xxx,xx" number format:
Versions prior to 2.2 fail because this localized number format results in woodset files being written that are not compatible with TurboCAD's material system. This has been fixed in v2.2. Special thanks to user Stefan Lutz who pointed out the problem and assisted me in developing and testing the fix.

Installation note:
When installing this macro, if you use "WoodGen" as the project name, the macro will not execute. For more info, see the Macro Won't Run tip. Thanks to user Michael Hall for reporting this problem.

Functional Summary:
With a user-selected material in a user-specified file, the macro creates a set of nine materials, all variants of the selected material. The variants are materials aligned with each of the three axes (x, y, and z) in three versions (flat, quarter, and rift-sawn). This material set is written to a new user-specified "wood set" file or replaces the content of a file of the user's choosing. The name of the wood set is the same as wood set's category as seen in the Materials Editor after it is loaded into the materials system. You load the new materials into the TurboCAD's material system with the "Load Materials..." command found in the "Options" menu (v7.1) and in the "Options/Materials" menu (v8.2 and v9). After the materials are loaded, the nine materials will appear in their category with the names "X-Flat, X-Qrtr, X-Rift, Y-Flat and so on...through Z-Rift.

Boards

The only requirement of the base material is that it use the "Simple Wood" shader as found in v7, v8, and v9 or the more complex and flexible wood shaders (Birch, Cherry, Maple, Oak, Pine, and Wood) found in v8 and v9. The v8 and v9 wood-floor shaders are not supported. The image nearby (click on it for a larger view) shows nine boards all drawn with the Box tool. Their orientation is as originally drawn on the world plane. Each is labeled with the applied variant from a wood set created by this macro.

Details of the Transformation:
Using the y and z tree position information as the base location, the quarter-sawn variant is made by rotating this location 90°. Similarly, the rift-sawn variant is made by rotating this location 45°.

The xyz transformation uses two 90° rotations to go from x to y, y to z, and z to x. In each case, the material is rotated about y to z and then about x to y. Three such rotation pairs returns the material to its original alignment. Pictorially this produces the following results:

Taking advantage of the tool:
Before starting on your drawing, develop some suitable flat-sawn materials aligned with the x-axis and then use this macro to generate "wood sets" with unique file names. Do not be overly concerned with getting the material "just right" as it is easily changed later. Furniture designers may want to develop three or more base materials and corresponding material sets. For example: one base material to produce "WoodSet1" as a primary wood, another base material to produce "Woodset2" for drawer sides/backs and glue blocks, and a third base material for drawer bottoms and case backs. Fancy furniture might need more than one primary wood. Using a scheme like this allows for updating the material for some parts in a drawing without affecting the others. Keep in mind that you do not need to generate different woodset names for each drawing as the drawing retains the materials and their settings when the file is saved. When opening a drawing, be sure to select "Replace all" to resolve any material conflicts in favor of the drawing you are opening. Note: when using this kind of scheme, it is not a good idea to have two drawings with common woodset names open unless you intend that the wood materials to be the same in both drawings.

Develop your furniture, fence, spoonduck, or what have you, and assign the materials from the wood set as you go along or after your drawing is finished. As you make parts, it is easy to forget its alignment as drawn and copies may be moved and rotated further confusing the issue. To easily discern the orientation of a part from a material perspective, set the 3D selector to "Extents CS" = "Entity CS" and the "Coordinate System" = "Extents CS". Now, when you select a part, the selector will indicate the part's orientation relative to material assignment so you can select the needed material variant. For instance: if the long axis of the board is aligned with the selector's z-axis then you need a z variant material.

If at any time you want to change any aspect of a material set, edit the X-Flat variant or make an entirely new one. Run the macro on the new or edited material using the same output file you used originally. Then load the file into the materials system, choose "Replace all" at the prompt and your drawing is updated with the new materials and ready to render.

Contents of the Wood Generator Help Window

Dialog

All buttons, check boxes, and list boxes are accessible with the tab and accelerator ([Alt] + underlined letter) keys. The tab key moves from one control to the next in logical sequence.

The "Help" button brings up a new dialog box containing a text box (scrollable with the arrow keys) containing this article. The dialog is closed with [Esc] or [Enter].

The "Read Propin.dat" check box toggles the input file between Propin.dat and a file of your choosing from the list box ("Read This File") that appears when the check box is off. Propin.dat contains the current working set of materials that appear in the Materials Editor. The list box shows an alpha-sorted list of all available material files except wood set files created by this macro.

Similarly, the "Write New Wood Set" check box toggles between writing a new "wood set" file or overwriting one of your choosing from the list box ("Overwrite This Wood Set") that appears when the check box is turned off. The list box shows an alpha-sorted list of all existing wood sets.

The "Woods in File" list holds an alpha-sorted list of all the wood materials that exist in Propin.dat or the high-lighted file in the list that appears if the "Read Propin.dat" check box is turned off. If the selected file has no wood materials, the list box is not shown. If a material in this list box is double-clicked, a new window appears showing the details of that wood material.

The "Cancel" button ([Esc]) terminates the dialog and presents a new one asking if you really mean it. This is done in case you got there by accident. The [Enter] key returns you to the main dialog in the state you left it. [Esc] terminates the macro.

The "Write Set" button ([Enter]) causes the macro to write a "wood set" file. If you have selected "Write New Woodset", you will be asked for the file name. A file extension is not necessary. If you provide one, you will get an information message. You will also get the same message if you use any characters other than alpha, numeric, hyphens, underscores, parentheses, and spaces. If you provide the name of a wood set that already exists, you will be asked for confirmation before it is overwritten. If the name you provide is for a material file that is not a wood set, you will get an information message. If you choose to overwrite an existing wood set, you will be asked for confirmation before the file you specified in the list box is overwritten. Once a file is written, you get a confirmation message. You can then write another file or quit.

The "Delete Set" button deletes a wood set file that you choose in wood set list. You will be asked for confirmation. If the list is not visible, you can make it visible by clicking the button or the "Write New Wood Set" check box.

You may encounter a short delay when the macro starts as it reads and sorts the file names into their respective lists.
###

If you have problems, questions, or ideas for improvement please post them on IMSI's TurboCAD forum.

Download: Wood Sets v2.3

Revisions:

1/13/02
v1.0, Original post
1/15/02
v1.1, Updated to allow for input other than from propin.dat
1/17/02
v1.2, Updated interface, added pick-list for the input file.
1/27/02
v1.3, More robust error checking, added pick-list for output file, new help file.
2/2/02
v2.0, Replaced text boxes with list box, added file viewer and delete function.
2/13/02
v2.1, Tweaked interface and added wood set viewer function.
5/5/02
v2.2 Fixed "x.xxx,xx" number format problem
8/3/02
Functional summary: added some clarity (hopefully) about loading materials into the material system
1/18/03
Added installation note.
10/4/04
v2.3, Updated for TurboCAD v10

Valid XHTML 1.0! Top of page