discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

combine a union child and a difference child in one object.

L
Leef_me
Mon, Nov 30, 2015 8:12 PM

// Is it possible to combine the two lines marked part A and part B,
//  into one object, module or whatever?
//  If so, I'd appreciate an an example.

$fn=16;

difference()
{
cube([5,5,5], center=true);
#cylinder(d=1.5, h=12, center=true); // part A
}

cylinder(d=1, h=15, center=true); // part B

Thanks in advance

Leef_me

// Is it possible to combine the two lines marked part A and part B, // into one object, module or whatever? // If so, I'd appreciate an an example. $fn=16; difference() { cube([5,5,5], center=true); #cylinder(d=1.5, h=12, center=true); // part A } cylinder(d=1, h=15, center=true); // part B Thanks in advance Leef_me
PF
Peter Falke
Mon, Nov 30, 2015 8:28 PM

I'm not sure what you want to use the # for. Its normally only for
diagnostics.

How about this:

$fn=16;

difference()
{
cube([5,5,5], center=true);
wire(); // part A
}

wire();

module wire(){
cylinder(d=1, h=15, center=true); // part B
color("red")cylinder(d=1.5, h=12, center=true); // part A
}

2015-11-30 21:12 GMT+01:00 Leef_me Leef_me@cox.net:

// Is it possible to combine the two lines marked part A and part B,
//  into one object, module or whatever?
//  If so, I'd appreciate an an example.

$fn=16;

difference()
{
cube([5,5,5], center=true);
#cylinder(d=1.5, h=12, center=true); // part A
}

cylinder(d=1, h=15, center=true); // part B

Thanks in advance

Leef_me


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

I'm not sure what you want to use the # for. Its normally only for diagnostics. How about this: $fn=16; difference() { cube([5,5,5], center=true); wire(); // part A } wire(); module wire(){ cylinder(d=1, h=15, center=true); // part B color("red")cylinder(d=1.5, h=12, center=true); // part A } 2015-11-30 21:12 GMT+01:00 Leef_me <Leef_me@cox.net>: > // Is it possible to combine the two lines marked part A and part B, > // into one object, module or whatever? > // If so, I'd appreciate an an example. > > $fn=16; > > > difference() > { > cube([5,5,5], center=true); > #cylinder(d=1.5, h=12, center=true); // part A > } > > cylinder(d=1, h=15, center=true); // part B > > Thanks in advance > > Leef_me > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >
J
jpmendes
Mon, Nov 30, 2015 10:12 PM

Do you want to generate a pipe with those two lines A and B? Or am I missing
something...
I use this generic module to generate my tubes.

DefaultSides=90;

module Tube(Length,Dout,Din,Sides)
{
NSides= (Sides < 3 || Sides==undef)  ?  DefaultSides : Sides;

rotate_extrude(convexity=2, $fn=NSides) translate([Din/2,0,0]) 
    square([(Dout-Din)/2,Length]); 

}
Tube();

Regards

--
View this message in context: http://forum.openscad.org/combine-a-union-child-and-a-difference-child-in-one-object-tp14834p14845.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Do you want to generate a pipe with those two lines A and B? Or am I missing something... I use this generic module to generate my tubes. DefaultSides=90; module Tube(Length,Dout,Din,Sides) { NSides= (Sides < 3 || Sides==undef) ? DefaultSides : Sides; rotate_extrude(convexity=2, $fn=NSides) translate([Din/2,0,0]) square([(Dout-Din)/2,Length]); } Tube(); Regards -- View this message in context: http://forum.openscad.org/combine-a-union-child-and-a-difference-child-in-one-object-tp14834p14845.html Sent from the OpenSCAD mailing list archive at Nabble.com.
N
Neon22
Mon, Nov 30, 2015 10:32 PM

The cube has a cylindrical hole cut vertically through it.
Inside this is a thinner rod.
They are not connected together in any place.
We can't work out what sort of object you are trying to make.

You could add a flattened cube at the bottom and thereby make a mold kind-of
object to perhaps pour goop into to make tubes,  but not sure what this
object is trying to acheive so not sure how to answer your question.

--
View this message in context: http://forum.openscad.org/combine-a-union-child-and-a-difference-child-in-one-object-tp14834p14846.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

The cube has a cylindrical hole cut vertically through it. Inside this is a thinner rod. They are not connected together in any place. We can't work out what sort of object you are trying to make. You could add a flattened cube at the bottom and thereby make a mold kind-of object to perhaps pour goop into to make tubes, but not sure what this object is trying to acheive so not sure how to answer your question. -- View this message in context: http://forum.openscad.org/combine-a-union-child-and-a-difference-child-in-one-object-tp14834p14846.html Sent from the OpenSCAD mailing list archive at Nabble.com.