discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: [OpenSCAD] Is it possible to use shapes as variables?

I
Ivo
Wed, Feb 24, 2016 11:50 PM

Aetig wrote

..
myShape = difference()  {cube(12, center=true); sphere(8);};
myShape = union()  {myShape; cylinder(15, 7);};
..

The second myShape is unclear in meaning. If it's a new object it should
have a new name. If it is a geometry-modifier (i'm trying to avoid the word
"function") than it should have a new name as well, but then you can
actually use it as a generic geometry modifier.

module myShape() difference()  {cube(12, center=true); sphere(8);};
module cylinderiser() union()  {children(0); cylinder(15, 7);};

cylinderiser(){
myShape();
};

Openscad doesn't have variables, but it can pass modules to other modules.

--
View this message in context: http://forum.openscad.org/Is-it-possible-to-use-shapes-as-variables-tp16223p16232.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Aetig wrote > .. > myShape = difference() {cube(12, center=true); sphere(8);}; > myShape = union() {myShape; cylinder(15, 7);}; > .. The second myShape is unclear in meaning. If it's a new object it should have a new name. If it is a geometry-modifier (i'm trying to avoid the word "function") than it should have a new name as well, but then you can actually use it as a generic geometry modifier. module myShape() difference() {cube(12, center=true); sphere(8);}; module cylinderiser() union() {children(0); cylinder(15, 7);}; cylinderiser(){ myShape(); }; Openscad doesn't have variables, but it can pass modules to other modules. -- View this message in context: http://forum.openscad.org/Is-it-possible-to-use-shapes-as-variables-tp16223p16232.html Sent from the OpenSCAD mailing list archive at Nabble.com.