markwanted
markwanted

Reputation: 51

Im trying to subtract a cylinder from a intersection in openscad

This is what i have so far. I haven't been able to figure out how to subtract the cylinder from the intersected piece.


    union(1){
    intersection(){
    cylinder(h=2,d=5, center=true);
    cube([7,2,2], center=true);
    }}
    difference(){
    cylinder(h=3,d=1,center=true);
    union(1);
    }

Upvotes: 2

Views: 7390

Answers (2)

jinhwanlazy
jinhwanlazy

Reputation: 3581

I think you are little confused. There is no reason for not able to subtract cylinder from an intersected object.

 $fn=48;
 difference()
 {
    intersection()
    {
        cylinder(h=2,d=4, center=true);
        cube([7,2,2], center=true);
    }
    cylinder(h=3,d=1.5,center=true);
}

Upvotes: 1

markwanted
markwanted

Reputation: 51

This is the solution to my problem. If it helps anyone can use as you want since i answered my own question.


    difference(){
    cylinder(h=2,d=4,$fn=48,center=true);
    cylinder(h=3,d=1.5,$fn=48,center=true);
    translate([0,2,0]){
    cube([5,2,3],center=true);//right side
    translate([0,-4,0]){
    cube([5,2,3],center=true);//left side
    }}}

Upvotes: 3

Related Questions