Results 1 to 10 of 72
Thread: OpenScad Help Centre
Hybrid View
-
11-28-2014, 04:18 PM #1
Please list the Primitives available in OpenScad
Most of the tutorials show two primitives : cube and sphere. Are there any other Primitives?
Old Man Emu
-
11-28-2014, 06:00 PM #2
Section 3.1 of the Wikipedia User Manual says:
3.1 Primitive Solids - cube, sphere, cylinder & polyhedron
http://en.wikibooks.org/wiki/OpenSCA...imitive_Solids
The Polyhedron is difficult to use. The points used to construct it have to be carefully ordered. But the other three are very straight forward to use.Last edited by Roxy; 11-28-2014 at 06:07 PM.
-
11-29-2014, 12:19 AM #3
What do the round and curly brackets mean?
Here is a random bit of code I found in a tutorial:
difference() {
union() {
// teardrop shape
sphere(r = 20);
translate([0, 0, 20 * sin(30)])
cylinder(h = 30, r1 = 20 * cos(30), r2 = 0);
// dollop
translate([0, 0, 30 + 20 * sin(30)])
sphere(r = 6);
}
//cut out slot
rotate([45, 0, 0])
translate([-20, 0, 0])
cube([40, 5, 40]);
}
What is the meaning or function of:
1. the round brackets - Difference () Union ()
2. Wiggly brackets {lines of code}
3. stuff inside square brackets [ ]
I know that // indicates a coder's comment that does not get read when the code is run.
OME
-
11-29-2014, 09:46 AM #4
OpenScad evolved and was never really well thought out in advance. The syntax of the language shows that. They wanted it to look like C but the fundamentals of the language are different. OpenScad does not even allow variables to change value during 'execution'. The parts of the language where it looks like that is happening are not real. For example the 'for' loops. The compiler is just in-line compiling the code blocks with different values of the index 'variable'.
Probably, the round brackets on Difference() and Union() are just to denote that you are performing a 'function'. But that deviates from their usage in C where you are passing in parameters within the ().
The square brackets are more consistent. If you see square brackets [], the contents is going to be used as a vector (or a point).
OpenScad is a great tool. But IMHO it is an abomination from a syntax perspective. Just as people study different spoken languages to understand how one language or dialect evolved from another and influenced thought on this subject or that one... OpenScad provides a Computer Language equivalent. Somebody could write a PhD thesis on the subject.
The syntax is chaotic and a mess.... (But I do like OpenScad!!!!)
-
11-29-2014, 04:25 PM #5
Thanks for those comments, but I think I asked the wrong question to get the answer I needed.
The more correct questions would be:
1. What does each type of bracket enclose, and what is the order of precedence?
2. What would the example read like if it was written like a paragraph of text in a novel? In other words, what is the long hand version of this?
OME
Ender 3 Neo - Jam Problem
05-08-2024, 03:06 PM in Tips, Tricks and Tech Help