Constructing 3D Models from 2D Materials
I’ve found this technique to be really useful for making quick, cheap mock-ups of 3D models, as well as getting some really interesting visual results for artmaking.
The first of the two main techniques I’ve been using is ‘slicing’ models in Rhino using the Contour command, then exporting the curves to Illustrator. The curves are cut out of flat material (usually cardboard or acrylic) on the laser cutter, then re-assembled with glue into a mock-up of the 3D model.
This technique results in an economical model relatively quickly, and allows you a lot of flexibility compared to ‘unfolding’ techniques such as those used with Pepakura. It can, however, be quite tedious to re-assemble all the slices in the proper order/orientation. It is also not the most accurate method, as the shape of the model depends on the orientation of our curves in Rhino matching the orientation of the cut slices.
I’ve written a couple of scripts that take a lot of the grunt-work out of processing files. They are free for you [and everyone] to use. Also, keep in mind that the laser cutter part of the equation is optional. The contours can be cut by hand, although it will be a much bigger pain in the ass.
Here is the basic technique:
In Rhino:
- Create a 3D model in Rhino. It helps if the model is solid (aka a joined polysurface, aka watertight)
- Create topological contour curves of the model using the Contour command. The contours can go in any direction, and the spacing should be equal to the depth of the material you’ll be using.
- Group the curves: use the PlanarSrf command to create surfaces from each ‘level’ of slices. This accounts for contours which are donut-shaped, such as those that would come from a tube or bowl shape. These concentric curves must be grouped together to maintian the profile of the 3D model.
- Flatten the surfaces: use the UnrollSrf command to align each surface to the top viewport. This will prevent the curves from being distorted upon export.
- Convert back to curves: use the Make2D command to transform each surface back into the original curves. This prevents the need for extra editing once the curves are brought into Illustrator.
- Export the curves as Illustrator files (*.ai). Preserve the scale, but since Illustrator does everything in points, convert to points (1 inch = 72 points). This will ensure the scale of the 3D model is preserved.
In Illustrator:
- Open each curve file that we just exported from Rhino.
- Move each curve or set of curves into its own layer in a file that has been templated for the laser cutter.
- Arrange and format the curves, then send them to the laser cutter.
On the laser cutter:
- Use the least amount of material possible.
- Keep track of the pieces you’re cutting out. Numbers can be engraved by the laser cutter, or the cutouts can be kept in their original position and compared to the files.
In real life:
- Assemble the slices, using numbers and/or Illustrator files and/or the Rhino model.
- Bask in the glory.
The Scripts:
These scripts are distributed under a Creative Commons Attribution Noncommercial Share Alike 3.0 License. You must follow the terms of this license if you wish to use these scripts.
Please see http://creativecommons.org/licenses/by-nc-sa/3.0/ for details.
These scripts are not intended to do anything malicious, however I take no responsibility for any ill effects caused by these scripts.
Rhino:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
'************************************************** ' This script takes a joined polysurface in Rhino ' and cuts it up into flat sections, which are then ' exported as Illustrator paths. These paths can be ' sent to a laser cutter and cut from flat material, ' then glued together to form a mock-up of your 3D ' model. ' ' The script creates a folder on the base of ' C:\ drive and exports the files there. A text file ' with the total number of contour curves is saved in ' the same directory. ' ' Cobbled together by Chris Reilly [creilly 4T saic D0T edu] in 2007. ' This script is distributed under a Creative Commons ' Attribution-Noncommercial-Share Alike 3.0 License ' see http://creativecommons.org/licenses/by-nc-sa/3.0/ ' for details '************************************************** Dim strObjects Dim intCount Dim strObj Dim strCmd Dim strFilenm Dim strLayerName Dim strLayerReturn Dim strUserDefinedFolder Dim objFileSys Dim strNewFolder Dim strNewPath Dim objFSO Dim objFolder Dim strDirectory Dim strTxtFile '************************************************** Sub createContours Rhino.Command "Contour" isolateObjectsToNewLayer("Working Surfaces") End Sub '************************************************** Function isolateObjectsToNewLayer(strLayername) Rhino.AddLayer(strLayername) Rhino.Currentlayer(strLayername) Rhino.Command "ChangeToCurrentLayer" Rhino.Command "-OneLayerOn Enter" End Function '************************************************** Function exportCurves(strDirectory) intCount = 0 Rhino.Command "SelNone" Rhino.Command "SelCrv" Rhino.Command "-SetActiveViewport Top" Rhino.Command "PlanarSrf Enter" Rhino.Command "SelNone" Rhino.Command "SelSrf" strObjects = Rhino.SelectedObjects() For Each strObj In strObjects Rhino.Command ("SelNone") strCmd = "SelID " & strObj Rhino.Command strCmd Rhino.Command "UnrollSrf Enter" Rhino.Command "SelNone" Rhino.Command "SelLast" Rhino.Command "-Make2D Enter" Rhino.Command "SelNone" Rhino.Command "SelLast" strFilenm = strDirectory & "\" & intCount & ".ai" strCmd = "-Export " & strFilenm & " PreserveUnits=Yes,AIScale=72,Unit=points,RhinoScale=1 Enter" Rhino.Command strCmd intCount = intCount + 1 Next Set objFSO = CreateObject("Scripting.FileSystemObject") Set strTxtFile = objFSO.CreateTextFile(strDirectory & "\" & "Curve_Count.txt", vbTrue) intCrvCount = UBound(strObjects) + 1 strTxtFile.WriteLine intCrvCount strTxtFile.Close End Function '************************************************* Sub doEverything strLayerReturn = Rhino.CurrentLayer createContours strUserDefinedFolder = Rhino.GetString("Enter a name for the output folder (ALPHANUMERIC, NO SPACES)") strDirectory = "C:\" & strUserDefinedFolder Set objFSO = CreateObject("Scripting.FileSystemObject") If objFSO.FolderExists(strDirectory) Then Set objFolder = objFSO.GetFolder(strDirectory) WScript.Echo strDirectory & " already created " Else Set objFolder = objFSO.CreateFolder(strDirectory) msgbox "Illustrator curves will be exported to : " & strDirectory End If exportCurves(strDirectory) Rhino.CurrentLayer strLayerReturn Rhino.Command "-OneLayerOn Enter" End Sub '************************************************* doEverything |
Illustrator:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
This script works with a Rhino script to combine exported curves into one document. Cobbled together by Chris Reilly [creilly 4T saic D0T edu] in 2007. This script is distributed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 License see http://creativecommons.org/licenses/by-nc-sa/3.0/ for details */ // JavaScript Document //read number of curves from 'Curve_Count.txt' which was output by Rhino. alert ("Select the file 'Curve_Count.txt'"); var textFilePath = File.openDialog("Select the file 'Curve_Count'"); var fileRef = new File(textFilePath); fileRef.open("r"); var curveCount = fileRef.readln(0); //locate and open the laser cutter template file alert ("Select the laser cutter template file"); var templateFilePath = File.openDialog("Select the laser cutter template file"); var laserFile = new File(templateFilePath); open (laserFile); //cycle through the source curve files for (var count = 0; count < curveCount; count++) { var curvePath = new File (fileRef.parent + "/" + count + ".ai"); //the slash may have to be changed for Windows open (curvePath);//open the curve source file count.ai var curvePathConverted = curvePath.name.substr(0,(curvePath.name.length - 3)) + " [Converted].ai"; doc = app.documents.getByName(curvePathConverted); //bring .ai to front. refer to as documents[1] since illustrator does a stupid renaming thing when opening the Rhino curves // = app.activeDocument; //select all paths in curve source files and move to laser cutter template if ( doc.pathItems.length > 0 ) { //cycles through each pathitem in curve source file for ( i = doc.pathItems.length - 1; i >= 0; i-- ) { pathArt = doc.pathItems[i]; pathArt.selected = true; var my_object = doc.pathItems[i]; app.activeDocument = documents[laserFile.name]; var destination_layer = app.activeDocument.layers["Layer " + parseFloat(count + 1)]; my_object.move(destination_layer,ElementPlacement.PLACEATEND); } } //close the last curve source document w/o saving app.activeDocument = app.documents.getByName(curvePathConverted); aiDocument = app.activeDocument; aiDocument.close( SaveOptions.DONOTSAVECHANGES ); aiDocument = null; //create the next layer in the laser cutter template app.activeDocument = documents[laserFile.name]; app.activeDocument.layers.add(); } |
Resources:
- Scripting Adobe Applications – User to User Forums
- Illustrator CS Scripting – Getting Started With Javascript [pdf]
- Rhino Scripting [pdf]
- Rhino Scripting Tutorials
Update [2/7/2013]:
Since originally writing this post, some very useful plugins (namely Rhinonest) for Windows Rhino have come out that accomplish similar goals with more sophistication. Also, Rhino is working towards integrating Python scripting, which would allow for the OSX version to accomplish similar tasks as outlined here.