discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Clipping a cylinder

D
dbvanhorn
Fri, Aug 21, 2015 9:06 PM

I have a problem.  I'm used to CSG in povray where I can use a clipping
plane to throw away anything on one side of the plane.  I could cut a
cylinder on a diagonal by using a rotated plane centered at the appropriate
point.

I am not seeing a similar functionality here.  I want a slice of a cylinder.
When I use a cube, the cube has size which throws everything off.

Inch = 25.4 ; // define inches

MC_ID = 46 ;
Thick = 2  ; //
MC_Len = (2 * Inch);

MC_OD = (MC_ID + (Thick*2));

module MainCyl () {
cylinder(h = MC_Len, r=(MC_OD/2), center = true, $fn=200);
} // End of MainCyl

module MC_Inside () {
cylinder(h = (MC_Len+1), r=(MC_ID/2), center = true, $fn=200);
}

module Clip(){
cube ( size = [(MC_OD+1),(MC_OD+1),100],center = true);
}

difference (){
MainCyl();
MC_Inside();
translate ([0,0,30]){
rotate ([0,45,0]) {
Clip();
} // End of rotate
} // end of translate
}

--
View this message in context: http://forum.openscad.org/Clipping-a-cylinder-tp13578.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

I have a problem. I'm used to CSG in povray where I can use a clipping plane to throw away anything on one side of the plane. I could cut a cylinder on a diagonal by using a rotated plane centered at the appropriate point. I am not seeing a similar functionality here. I want a slice of a cylinder. When I use a cube, the cube has size which throws everything off. Inch = 25.4 ; // define inches MC_ID = 46 ; Thick = 2 ; // MC_Len = (2 * Inch); MC_OD = (MC_ID + (Thick*2)); module MainCyl () { cylinder(h = MC_Len, r=(MC_OD/2), center = true, $fn=200); } // End of MainCyl module MC_Inside () { cylinder(h = (MC_Len+1), r=(MC_ID/2), center = true, $fn=200); } module Clip(){ cube ( size = [(MC_OD+1),(MC_OD+1),100],center = true); } difference (){ MainCyl(); MC_Inside(); translate ([0,0,30]){ rotate ([0,45,0]) { Clip(); } // End of rotate } // end of translate } -- View this message in context: http://forum.openscad.org/Clipping-a-cylinder-tp13578.html Sent from the OpenSCAD mailing list archive at Nabble.com.
DB
don bright
Fri, Aug 21, 2015 9:28 PM

Would this be what you are wanting? I modified two lines, the
translation and the Z size of the cube

Inch = 25.4 ; // define inches

MC_ID = 46 ;
Thick = 2  ; //
MC_Len = (2 * Inch);

MC_OD = (MC_ID + (Thick*2));

module MainCyl () {
cylinder(h = MC_Len, r=(MC_OD/2), center = true, $fn=200);
} // End of MainCyl

module MC_Inside () {
cylinder(h = (MC_Len+1), r=(MC_ID/2), center = true, $fn=200);
}

module Clip(){
cube ( size = [(MC_OD+1),(MC_OD+1),200],center = true);
}

difference (){
MainCyl();
MC_Inside();
translate ([0,0,sqrt(2)/2*MC_OD]){
rotate ([0,45,0]) {
Clip();
} // End of rotate
} // end of translate
}

--
don bright
hmbright@fastmail.fm

On Fri, Aug 21, 2015, at 04:06 PM, dbvanhorn wrote:

I have a problem.  I'm used to CSG in povray where I can use a clipping
plane to throw away anything on one side of the plane.  I could cut a
cylinder on a diagonal by using a rotated plane centered at the
appropriate
point.

I am not seeing a similar functionality here.  I want a slice of a
cylinder.
When I use a cube, the cube has size which throws everything off.

Inch = 25.4 ; // define inches

MC_ID = 46 ;
Thick = 2  ; //
MC_Len = (2 * Inch);

MC_OD = (MC_ID + (Thick*2));

module MainCyl () {
cylinder(h = MC_Len, r=(MC_OD/2), center = true, $fn=200);
} // End of MainCyl

module MC_Inside () {
cylinder(h = (MC_Len+1), r=(MC_ID/2), center = true, $fn=200);
}

module Clip(){
cube ( size = [(MC_OD+1),(MC_OD+1),100],center = true);
}

difference (){
MainCyl();
MC_Inside();
translate ([0,0,30]){
rotate ([0,45,0]) {
Clip();
} // End of rotate
} // end of translate
}

--
View this message in context:
http://forum.openscad.org/Clipping-a-cylinder-tp13578.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


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

Would this be what you are wanting? I modified two lines, the translation and the Z size of the cube Inch = 25.4 ; // define inches MC_ID = 46 ; Thick = 2 ; // MC_Len = (2 * Inch); MC_OD = (MC_ID + (Thick*2)); module MainCyl () { cylinder(h = MC_Len, r=(MC_OD/2), center = true, $fn=200); } // End of MainCyl module MC_Inside () { cylinder(h = (MC_Len+1), r=(MC_ID/2), center = true, $fn=200); } module Clip(){ cube ( size = [(MC_OD+1),(MC_OD+1),200],center = true); } difference (){ MainCyl(); MC_Inside(); translate ([0,0,sqrt(2)/2*MC_OD]){ rotate ([0,45,0]) { Clip(); } // End of rotate } // end of translate } -- don bright hmbright@fastmail.fm On Fri, Aug 21, 2015, at 04:06 PM, dbvanhorn wrote: > > I have a problem. I'm used to CSG in povray where I can use a clipping > plane to throw away anything on one side of the plane. I could cut a > cylinder on a diagonal by using a rotated plane centered at the > appropriate > point. > > I am not seeing a similar functionality here. I want a slice of a > cylinder. > When I use a cube, the cube has size which throws everything off. > > Inch = 25.4 ; // define inches > > MC_ID = 46 ; > Thick = 2 ; // > MC_Len = (2 * Inch); > > MC_OD = (MC_ID + (Thick*2)); > > module MainCyl () { > cylinder(h = MC_Len, r=(MC_OD/2), center = true, $fn=200); > } // End of MainCyl > > module MC_Inside () { > cylinder(h = (MC_Len+1), r=(MC_ID/2), center = true, $fn=200); > } > > module Clip(){ > cube ( size = [(MC_OD+1),(MC_OD+1),100],center = true); > } > > difference (){ > MainCyl(); > MC_Inside(); > translate ([0,0,30]){ > rotate ([0,45,0]) { > Clip(); > } // End of rotate > } // end of translate > } > > > > -- > View this message in context: > http://forum.openscad.org/Clipping-a-cylinder-tp13578.html > Sent from the OpenSCAD mailing list archive at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
DV
david vanhorn
Fri, Aug 21, 2015 9:32 PM

That gives the right shape, thank you!  But it doesn't scale.

I know OpenSCAD doesn't have clipping planes, I'm looking for a
replacement, even if it takes the form of a module that I could use as a
clipping plane.

Sizeless objects are powerful.

On Fri, Aug 21, 2015 at 3:28 PM, don bright hmbright@fastmail.fm wrote:

Would this be what you are wanting? I modified two lines, the
translation and the Z size of the cube

Inch = 25.4 ; // define inches

MC_ID = 46 ;
Thick = 2  ; //
MC_Len = (2 * Inch);

MC_OD = (MC_ID + (Thick*2));

module MainCyl () {
cylinder(h = MC_Len, r=(MC_OD/2), center = true, $fn=200);
} // End of MainCyl

module MC_Inside () {
cylinder(h = (MC_Len+1), r=(MC_ID/2), center = true, $fn=200);
}

module Clip(){
cube ( size = [(MC_OD+1),(MC_OD+1),200],center = true);
}

difference (){
MainCyl();
MC_Inside();
translate ([0,0,sqrt(2)/2*MC_OD]){
rotate ([0,45,0]) {
Clip();
} // End of rotate
} // end of translate
}

--
don bright
hmbright@fastmail.fm

On Fri, Aug 21, 2015, at 04:06 PM, dbvanhorn wrote:

I have a problem.  I'm used to CSG in povray where I can use a clipping
plane to throw away anything on one side of the plane.  I could cut a
cylinder on a diagonal by using a rotated plane centered at the
appropriate
point.

I am not seeing a similar functionality here.  I want a slice of a
cylinder.
When I use a cube, the cube has size which throws everything off.

Inch = 25.4 ; // define inches

MC_ID = 46 ;
Thick = 2  ; //
MC_Len = (2 * Inch);

MC_OD = (MC_ID + (Thick*2));

module MainCyl () {
cylinder(h = MC_Len, r=(MC_OD/2), center = true, $fn=200);
} // End of MainCyl

module MC_Inside () {
cylinder(h = (MC_Len+1), r=(MC_ID/2), center = true, $fn=200);
}

module Clip(){
cube ( size = [(MC_OD+1),(MC_OD+1),100],center = true);
}

difference (){
MainCyl();
MC_Inside();
translate ([0,0,30]){
rotate ([0,45,0]) {
Clip();
} // End of rotate
} // end of translate
}

--
View this message in context:
http://forum.openscad.org/Clipping-a-cylinder-tp13578.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


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

--
K1FZY (WA4TPW) SK  9/29/37-4/13/15

That gives the right shape, thank you! But it doesn't scale. I know OpenSCAD doesn't have clipping planes, I'm looking for a replacement, even if it takes the form of a module that I could use as a clipping plane. Sizeless objects are powerful. On Fri, Aug 21, 2015 at 3:28 PM, don bright <hmbright@fastmail.fm> wrote: > Would this be what you are wanting? I modified two lines, the > translation and the Z size of the cube > > Inch = 25.4 ; // define inches > > MC_ID = 46 ; > Thick = 2 ; // > MC_Len = (2 * Inch); > > MC_OD = (MC_ID + (Thick*2)); > > module MainCyl () { > cylinder(h = MC_Len, r=(MC_OD/2), center = true, $fn=200); > } // End of MainCyl > > module MC_Inside () { > cylinder(h = (MC_Len+1), r=(MC_ID/2), center = true, $fn=200); > } > > module Clip(){ > cube ( size = [(MC_OD+1),(MC_OD+1),200],center = true); > } > > difference (){ > MainCyl(); > MC_Inside(); > translate ([0,0,sqrt(2)/2*MC_OD]){ > rotate ([0,45,0]) { > Clip(); > } // End of rotate > } // end of translate > } > > > -- > don bright > hmbright@fastmail.fm > > On Fri, Aug 21, 2015, at 04:06 PM, dbvanhorn wrote: > > > > I have a problem. I'm used to CSG in povray where I can use a clipping > > plane to throw away anything on one side of the plane. I could cut a > > cylinder on a diagonal by using a rotated plane centered at the > > appropriate > > point. > > > > I am not seeing a similar functionality here. I want a slice of a > > cylinder. > > When I use a cube, the cube has size which throws everything off. > > > > Inch = 25.4 ; // define inches > > > > MC_ID = 46 ; > > Thick = 2 ; // > > MC_Len = (2 * Inch); > > > > MC_OD = (MC_ID + (Thick*2)); > > > > module MainCyl () { > > cylinder(h = MC_Len, r=(MC_OD/2), center = true, $fn=200); > > } // End of MainCyl > > > > module MC_Inside () { > > cylinder(h = (MC_Len+1), r=(MC_ID/2), center = true, $fn=200); > > } > > > > module Clip(){ > > cube ( size = [(MC_OD+1),(MC_OD+1),100],center = true); > > } > > > > difference (){ > > MainCyl(); > > MC_Inside(); > > translate ([0,0,30]){ > > rotate ([0,45,0]) { > > Clip(); > > } // End of rotate > > } // end of translate > > } > > > > > > > > -- > > View this message in context: > > http://forum.openscad.org/Clipping-a-cylinder-tp13578.html > > Sent from the OpenSCAD mailing list archive at Nabble.com. > > > > _______________________________________________ > > OpenSCAD mailing list > > Discuss@lists.openscad.org > > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > -- K1FZY (WA4TPW) SK 9/29/37-4/13/15
N
Neon22
Fri, Aug 21, 2015 9:34 PM

I added a # to your clip module to see the cube.
http://forum.openscad.org/file/n13581/OpenSCAD_clip_001030.png
It shows that perhaps you need to resize the cube so it clips the entire
cylinder.
I find making the cube a large margin bigger than the diameter of the
cylinder is easiest to ensure you cut all the way through.
http://forum.openscad.org/file/n13581/OpenSCAD_clip_001032.png
However you could just multiply the cyl size by cos/sin of suitable angles
and add Delta to ensure the cube is of a suitable dimension and is only
slightly larger than required.

module Clip(){
#cube ( size = [(MC_OD+1),(MC_OD+1),120],center = true);
}

see this one:
http://www.thingiverse.com/thing:942124
Open it in customizer and see visualisation clip.
Look in code for sin/cos associated with positioning the internal filament
cut hole.

--
View this message in context: http://forum.openscad.org/Clipping-a-cylinder-tp13578p13581.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

I added a # to your clip module to see the cube. <http://forum.openscad.org/file/n13581/OpenSCAD_clip_001030.png> It shows that perhaps you need to resize the cube so it clips the entire cylinder. I find making the cube a large margin bigger than the diameter of the cylinder is easiest to ensure you cut all the way through. <http://forum.openscad.org/file/n13581/OpenSCAD_clip_001032.png> However you could just multiply the cyl size by cos/sin of suitable angles and add Delta to ensure the cube is of a suitable dimension and is only slightly larger than required. module Clip(){ #cube ( size = [(MC_OD+1),(MC_OD+1),120],center = true); } see this one: http://www.thingiverse.com/thing:942124 Open it in customizer and see visualisation clip. Look in code for sin/cos associated with positioning the internal filament cut hole. -- View this message in context: http://forum.openscad.org/Clipping-a-cylinder-tp13578p13581.html Sent from the OpenSCAD mailing list archive at Nabble.com.
W
wolf
Fri, Aug 21, 2015 10:02 PM

Your question is unclear. Does "I want to slice a cylinder" mean

  1. "I want to cut a slice off a cylinder", or
  2. "I want to cut a slice out of a cylinder", or . . .

Be that as it may, you are probably not aware that you can make shapes
transparent. In the code, I have disabled difference() and made Clip()
transparent. This way, you can see what you are doing and decide for
yourself how to adapt the code to your needs.

Inch = 25.4 ; // define inches

MC_ID = 46 ;
Thick = 2  ; //
MC_Len = (2 * Inch);

MC_OD = (MC_ID + (Thick*2));

module MainCyl () {
cylinder(h = MC_Len, r=(MC_OD/2), center = true, $fn=200);
} // End of MainCyl

module MC_Inside () {
cylinder(h = (MC_Len+1), r=(MC_ID/2), center = true, $fn=200);
}

module Clip(){
cube ( size = [(MC_OD+1),(MC_OD+1),100],center = true);
}

//difference (){
MainCyl();
MC_Inside();
translate ([0,0,30]){
rotate ([0,45,0]) {
#  Clip();
} // End of rotate
} // end of translate
//}

--
View this message in context: http://forum.openscad.org/Clipping-a-cylinder-tp13578p13583.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Your question is unclear. Does "I want to slice a cylinder" mean 1. "I want to cut a slice off a cylinder", or 2. "I want to cut a slice out of a cylinder", or . . . Be that as it may, you are probably not aware that you can make shapes transparent. In the code, I have disabled difference() and made Clip() transparent. This way, you can see what you are doing and decide for yourself how to adapt the code to your needs. Inch = 25.4 ; // define inches MC_ID = 46 ; Thick = 2 ; // MC_Len = (2 * Inch); MC_OD = (MC_ID + (Thick*2)); module MainCyl () { cylinder(h = MC_Len, r=(MC_OD/2), center = true, $fn=200); } // End of MainCyl module MC_Inside () { cylinder(h = (MC_Len+1), r=(MC_ID/2), center = true, $fn=200); } module Clip(){ cube ( size = [(MC_OD+1),(MC_OD+1),100],center = true); } //difference (){ MainCyl(); MC_Inside(); translate ([0,0,30]){ rotate ([0,45,0]) { # Clip(); } // End of rotate } // end of translate //} -- View this message in context: http://forum.openscad.org/Clipping-a-cylinder-tp13578p13583.html Sent from the OpenSCAD mailing list archive at Nabble.com.
JL
Jean-Paul Louis
Sat, Aug 22, 2015 12:27 AM

Try the script below and change from union() to intersection() to difference() to see what you want

Good luck and fun with OpenSCAD

Jean-Paul
AC9GH

Inch = 25.4 ; // define inches

MC_ID = 46;
Thick = 2;
MC_Len = 3 * Inch;
Angle = 45;
Height = 19;

MC_OD = MC_ID + 2 * Thick;

module MainTube() {
difference() {
cylinder(h = MC_Len, r=(MC_OD/2), center = true, $fn=200);
cylinder(h = (MC_Len+1), r=(MC_ID/2), center = true, $fn=200);
} // End of difference()
} // End of MainTube

module Clip(){
cube ([2MC_OD,2MC_OD,Height],center = true);
}

//union() {
intersection() {
//difference() {
MainTube();
rotate ([0,Angle,0]) Clip();
}

On Aug 21, 2015, at 6:02 PM, wolf wv99999@gmail.com wrote:

Your question is unclear. Does "I want to slice a cylinder" mean

  1. "I want to cut a slice off a cylinder", or
  2. "I want to cut a slice out of a cylinder", or . . .

Be that as it may, you are probably not aware that you can make shapes
transparent. In the code, I have disabled difference() and made Clip()
transparent. This way, you can see what you are doing and decide for
yourself how to adapt the code to your needs.

Inch = 25.4 ; // define inches

MC_ID = 46 ;
Thick = 2  ; //
MC_Len = (2 * Inch);

MC_OD = (MC_ID + (Thick*2));

module MainCyl () {
cylinder(h = MC_Len, r=(MC_OD/2), center = true, $fn=200);
} // End of MainCyl

module MC_Inside () {
cylinder(h = (MC_Len+1), r=(MC_ID/2), center = true, $fn=200);
}

module Clip(){
cube ( size = [(MC_OD+1),(MC_OD+1),100],center = true);
}

//difference (){
MainCyl();
MC_Inside();
translate ([0,0,30]){
rotate ([0,45,0]) {
#  Clip();
} // End of rotate
} // end of translate
//}

--
View this message in context: http://forum.openscad.org/Clipping-a-cylinder-tp13578p13583.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


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

Try the script below and change from union() to intersection() to difference() to see what you want Good luck and fun with OpenSCAD Jean-Paul AC9GH Inch = 25.4 ; // define inches MC_ID = 46; Thick = 2; MC_Len = 3 * Inch; Angle = 45; Height = 19; MC_OD = MC_ID + 2 * Thick; module MainTube() { difference() { cylinder(h = MC_Len, r=(MC_OD/2), center = true, $fn=200); cylinder(h = (MC_Len+1), r=(MC_ID/2), center = true, $fn=200); } // End of difference() } // End of MainTube module Clip(){ cube ([2*MC_OD,2*MC_OD,Height],center = true); } //union() { intersection() { //difference() { MainTube(); rotate ([0,Angle,0]) Clip(); } > On Aug 21, 2015, at 6:02 PM, wolf <wv99999@gmail.com> wrote: > > Your question is unclear. Does "I want to slice a cylinder" mean > 1. "I want to cut a slice off a cylinder", or > 2. "I want to cut a slice out of a cylinder", or . . . > > Be that as it may, you are probably not aware that you can make shapes > transparent. In the code, I have disabled difference() and made Clip() > transparent. This way, you can see what you are doing and decide for > yourself how to adapt the code to your needs. > > Inch = 25.4 ; // define inches > > MC_ID = 46 ; > Thick = 2 ; // > MC_Len = (2 * Inch); > > MC_OD = (MC_ID + (Thick*2)); > > module MainCyl () { > cylinder(h = MC_Len, r=(MC_OD/2), center = true, $fn=200); > } // End of MainCyl > > module MC_Inside () { > cylinder(h = (MC_Len+1), r=(MC_ID/2), center = true, $fn=200); > } > > module Clip(){ > cube ( size = [(MC_OD+1),(MC_OD+1),100],center = true); > } > > //difference (){ > MainCyl(); > MC_Inside(); > translate ([0,0,30]){ > rotate ([0,45,0]) { > # Clip(); > } // End of rotate > } // end of translate > //} > > > > > > -- > View this message in context: http://forum.openscad.org/Clipping-a-cylinder-tp13578p13583.html > Sent from the OpenSCAD mailing list archive at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
DB
don bright
Wed, Aug 26, 2015 2:49 AM

Hi David,

Below is a gist link to an OpenSCAD module that will fake a clipping
plane using the cube object. It is based on POV-ray syntax. For example:

difference() { sphere(3); fakeclipplane([1,1,2],2,10); }

This will 'clip' a sphere of radius 3 using a plane with normal
vector 1,1,2 at distance '2' from origin, using a 'cube' of size 10
to fake the plane

https://gist.github.com/donbright/0ba2934c6c9b7b69c411

Please let me know if it is what you were looking for.

--
  don bright
  http://github.com/donbright
  hmbright@fastmail.fm

On Fri, Aug 21, 2015, at 04:32 PM, david vanhorn wrote:

That gives the right shape, thank you!   But it doesn't scale. 

I know OpenSCAD doesn't have clipping planes, I'm looking for a replacement, even if it takes the form of a module that I could use as a clipping plane.
Sizeless objects are powerful.

On Fri, Aug 21, 2015 at 3:28 PM, don bright hmbright@fastmail.fm wrote:

Would this be what you are wanting? I modified two lines, the
translation and the Z size of the cube

Inch = 25.4 ; // define inches

MC_ID = 46 ;

Thick = 2   ; //

MC_Len = (2 * Inch);

MC_OD = (MC_ID + (Thick*2));

module MainCyl () {

    cylinder(h = MC_Len, r=(MC_OD/2), center = true, $fn=200);

} // End of MainCyl

module MC_Inside () {

    cylinder(h = (MC_Len+1), r=(MC_ID/2), center = true, $fn=200);

}

module Clip(){

     cube ( size = [(MC_OD+1),(MC_OD+1),200],center = true);
}

difference (){
    MainCyl();
    MC_Inside();
    translate ([0,0,sqrt(2)/2*MC_OD]){
        rotate ([0,45,0]) {

            Clip();

        } // End of rotate

    } // end of translate

}

--

  don bright
hmbright@fastmail.fm

On Fri, Aug 21, 2015, at 04:06 PM, dbvanhorn wrote:

I have a problem.   I'm used to CSG in povray where I can use a clipping
plane to throw away anything on one side of the plane.  I could cut a
cylinder on a diagonal by using a rotated plane centered at the
appropriate
point.

I am not seeing a similar functionality here.  I want a slice of a
cylinder.
When I use a cube, the cube has size which throws everything off.

Inch = 25.4 ; // define inches

MC_ID = 46 ;
Thick = 2   ; //
MC_Len = (2 * Inch);

MC_OD = (MC_ID + (Thick*2));

module MainCyl () {
     cylinder(h = MC_Len, r=(MC_OD/2), center = true, $fn=200);
} // End of MainCyl

module MC_Inside () {
     cylinder(h = (MC_Len+1), r=(MC_ID/2), center = true, $fn=200);
}

module Clip(){
      cube ( size = [(MC_OD+1),(MC_OD+1),100],center = true);
}

difference (){
     MainCyl();
     MC_Inside();
     translate ([0,0,30]){
         rotate ([0,45,0]) {
             Clip();
         } // End of rotate
     } // end of translate
}

--
View this message in context:
http://forum.openscad.org/Clipping-a-cylinder-tp13578.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


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

Hi David, Below is a gist link to an OpenSCAD module that will fake a clipping plane using the cube object. It is based on POV-ray syntax. For example: difference() { sphere(3); fakeclipplane([1,1,2],2,10); } This will 'clip' a sphere of radius 3 using a plane with normal vector 1,1,2 at distance '2' from origin, using a 'cube' of size 10 to fake the plane https://gist.github.com/donbright/0ba2934c6c9b7b69c411 Please let me know if it is what you were looking for. --   don bright   http://github.com/donbright   hmbright@fastmail.fm On Fri, Aug 21, 2015, at 04:32 PM, david vanhorn wrote: > > That gives the right shape, thank you!   But it doesn't scale.  > > I know OpenSCAD doesn't have clipping planes, I'm looking for a replacement, even if it takes the form of a module that I could use as a clipping plane. > Sizeless objects are powerful. > > On Fri, Aug 21, 2015 at 3:28 PM, don bright <hmbright@fastmail.fm> wrote: >> Would this be what you are wanting? I modified two lines, the >> translation and the Z size of the cube >> >> Inch = 25.4 ; // define inches >> >> MC_ID = 46 ; >> Thick = 2   ; // >> MC_Len = (2 * Inch); >> >> MC_OD = (MC_ID + (Thick*2)); >> >> module MainCyl () { >>     cylinder(h = MC_Len, r=(MC_OD/2), center = true, $fn=200); >> } // End of MainCyl >> >> module MC_Inside () { >>     cylinder(h = (MC_Len+1), r=(MC_ID/2), center = true, $fn=200); >> } >> >> module Clip(){ >>      cube ( size = [(MC_OD+1),(MC_OD+1),200],center = true); >> } >> >> difference (){ >>     MainCyl(); >>     MC_Inside(); >>     translate ([0,0,sqrt(2)/2*MC_OD]){ >>         rotate ([0,45,0]) { >>             Clip(); >>         } // End of rotate >>     } // end of translate >> } >> >> >> -- >>   don bright >> hmbright@fastmail.fm >> >> On Fri, Aug 21, 2015, at 04:06 PM, dbvanhorn wrote: >> > >> > I have a problem.   I'm used to CSG in povray where I can use a clipping >> > plane to throw away anything on one side of the plane.  I could cut a >> > cylinder on a diagonal by using a rotated plane centered at the >> > appropriate >> > point. >> > >> > I am not seeing a similar functionality here.  I want a slice of a >> > cylinder. >> > When I use a cube, the cube has size which throws everything off. >> > >> > Inch = 25.4 ; // define inches >> > >> > MC_ID = 46 ; >> > Thick = 2   ; // >> > MC_Len = (2 * Inch); >> > >> > MC_OD = (MC_ID + (Thick*2)); >> > >> > module MainCyl () { >> >     cylinder(h = MC_Len, r=(MC_OD/2), center = true, $fn=200); >> > } // End of MainCyl >> > >> > module MC_Inside () { >> >     cylinder(h = (MC_Len+1), r=(MC_ID/2), center = true, $fn=200); >> > } >> > >> > module Clip(){ >> >      cube ( size = [(MC_OD+1),(MC_OD+1),100],center = true); >> > } >> > >> > difference (){ >> >     MainCyl(); >> >     MC_Inside(); >> >     translate ([0,0,30]){ >> >         rotate ([0,45,0]) { >> >             Clip(); >> >         } // End of rotate >> >     } // end of translate >> > } >> > >> > >> > >> > -- >> > View this message in context: >> > http://forum.openscad.org/Clipping-a-cylinder-tp13578.html >> > Sent from the OpenSCAD mailing list archive at Nabble.com. >> > >> > _______________________________________________ >> > OpenSCAD mailing list >> > Discuss@lists.openscad.org >> > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > > > -- > K1FZY (WA4TPW) SK  9/29/37-4/13/15 > _________________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org