Creating 3D Models for 3D Printing Using OpenSCAD by Leithauser David
Author:Leithauser, David [Leithauser, David]
Language: eng
Format: epub
Publisher: Leithauser Research
Published: 2020-10-31T16:00:00+00:00
Figure 12.1
â You can see that this makes it much easier to distinguish the individual pieces, including where each piece ends. You can, for example, easily see that the lower cube is actually part way inside the taller cube. If your intent had been to put that cube on the edge of the taller cube, you can see your mistake. Note that if you do not include the color command, the piece defaults to the yellow.
â I want to emphasize that this does not affect your 3D model or exported STL file at all. In fact, when you press the F6 key for the actual rendering, the colors will disappear. The purpose of this color function was originally for other uses for OpenSCAD, like creating pictures, but you can use this as a diagnostic tool in developing your models.
Temporarily remove pieces from your model
â Sometimes when you have created a complex model, it is hard to get a look at individual pieces. You can remove individual pieces from the model temporarily by several methods.
â One way is to put a double slash (//) at the beginning of the line describing the piece. For example, in the following code, the cube will not be shown.
sphere(5);
//cube(8);
cylinder(h = 10, r = 2);
Listing 12.2
However, this can be a rather unreliable. Suppose you have put a line break in the description of the piece, such as in the following code
sphere(5);
translate([20, 0, 0])
cube(8);
cylinder(h = 10, r = 2);
Listing 12.3
If you put the double slash in the beginning of the translate line, only the translation is removed and the cube is still shown, but not translated. If you put a double slash in the beginning of the cube line, the translate command will be applied to the cylinder.
A better way in most cases is to put an asterisk in the beginning of the line. This tells OpenSCAD to ignore the object. In the case of Listing 12.3, putting an asterisk in the beginning of either the translate line or the cube line causes the cube to disappear without affecting any of the other pieces.
There is a situation where you might want to use the remark option to temporarily remove objects. That is where you want to remove a large number of objects. There is another type of remark marker. If you put a slash followed by an asterisk (/*) in the code and later in the code put an asterisk followed by a slash (*/), everything in between will be treated as a remark and not used. For example, in the code in Listing 12.4, all the cubes disappear.
sphere(5);
/*
translate([20, 0, 0]) cube(8);
translate([20, 20, 0]) cube(8);
translate([0, 20, 0]) cube(8);
*/
cylinder(h = 10,r = 2);
Listing 12.4
Making a component transparent
â Instead of removing a component completely, you can make a component transparent and tinted red by putting a pound sign (#) at the beginning of the line describing it. For example, the code in Listing 12.10 gives you the picture in Figure 12.3 when you press F5.
#translate([0, 0, 10]) sphere(10, $fn
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Automotive | Engineering |
Transportation |
Whiskies Galore by Ian Buxton(41488)
Introduction to Aircraft Design (Cambridge Aerospace Series) by John P. Fielding(32852)
Small Unmanned Fixed-wing Aircraft Design by Andrew J. Keane Andras Sobester James P. Scanlan & András Sóbester & James P. Scanlan(32533)
Craft Beer for the Homebrewer by Michael Agnew(17902)
Turbulence by E. J. Noyes(7659)
The Complete Stick Figure Physics Tutorials by Allen Sarah(7096)
Kaplan MCAT General Chemistry Review by Kaplan(6545)
The Thirst by Nesbo Jo(6405)
Bad Blood by John Carreyrou(6245)
Modelling of Convective Heat and Mass Transfer in Rotating Flows by Igor V. Shevchuk(6200)
Learning SQL by Alan Beaulieu(5994)
Weapons of Math Destruction by Cathy O'Neil(5778)
Man-made Catastrophes and Risk Information Concealment by Dmitry Chernov & Didier Sornette(5585)
Digital Minimalism by Cal Newport;(5319)
Life 3.0: Being Human in the Age of Artificial Intelligence by Tegmark Max(5143)
iGen by Jean M. Twenge(5125)
Secrets of Antigravity Propulsion: Tesla, UFOs, and Classified Aerospace Technology by Ph.D. Paul A. Laviolette(4858)
Design of Trajectory Optimization Approach for Space Maneuver Vehicle Skip Entry Problems by Runqi Chai & Al Savvaris & Antonios Tsourdos & Senchun Chai(4805)
Electronic Devices & Circuits by Jacob Millman & Christos C. Halkias(4698)
