I a trying to make a hole into this box, iv done like this:
difference () {
color ("black", 1)
cube ([233,533,451]);
translate ([5,5,5]) cube ([243,523,441]);
translate ([56.5,95,440]) cylinder_array(21,5,25) cylinder(r=2, h=15);
}
module cylinder_array( count, distance, rows )
for (i = [0 : count - 1], h = [0 : rows-1])
translate([distance * h, distance * i, 0])
children();
This works, but i want less code by include a file by doing this:
difference () {
color ("black", 1)
cube ([233,533,451]);
translate ([5,5,5]) cube ([243,523,441]);
translate ([56.5,95,440]) include <pin.scad>;
}
This aint working why?
Does this means you cannot difference a include file?
--
View this message in context: http://forum.openscad.org/difference-a-include-file-does-it-work-tp21743.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Try putting braces around the include statement. "Include" just does macro
substitution.
On Sunday, 25 June 2017, Droidene koford@gmail.com wrote:
I a trying to make a hole into this box, iv done like this:
difference () {
color ("black", 1)
cube ([233,533,451]);
translate ([5,5,5]) cube ([243,523,441]);
translate ([56.5,95,440]) cylinder_array(21,5,25) cylinder(r=2, h=15);
}
module cylinder_array( count, distance, rows )
for (i = [0 : count - 1], h = [0 : rows-1])
translate([distance * h, distance * i, 0])
children();
This works, but i want less code by include a file by doing this:
difference () {
color ("black", 1)
cube ([233,533,451]);
translate ([5,5,5]) cube ([243,523,441]);
translate ([56.5,95,440]) include <pin.scad>;
}
This aint working why?
Does this means you cannot difference a include file?
--
View this message in context: http://forum.openscad.org/
difference-a-include-file-does-it-work-tp21743.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org javascript:;
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
On 2017-06-25 15:40, Droidene wrote:
Does this means you cannot difference a include file?
It doesn't really make much sense TBH. Define a module in the include
file and difference that module.
The suggested way of doing this would be to define the parts as
module in the other file and load it via use<>.
Example:
--- file: part.scad
module part() {
cube(10);
}
--- file: main.scad
use <part.scad>
module array( count, distance, rows )
for (i = [0 : count - 1], h = [0 : rows-1])
translate([distance * h, distance * i, 0])
children();
array(10, 20, 2) part();
ciao,
Torsten.
Thank you all, yea i made module in that include and just simple difference
that cylinder.
It works.
Awsome guys.
Im sure to be back with another post later on, iv learned a lot already.
--
View this message in context: http://forum.openscad.org/difference-a-include-file-does-it-work-tp21743p21747.html
Sent from the OpenSCAD mailing list archive at Nabble.com.