faulty threads after slicing

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

faulty threads after slicing

RajHid
hello i
use a library to generate threads.
in the OpenSCAD 3D-Window it locks OK and in Prusa slicer 2.3.0 as well
After sicing the the body and the Threaded holes got invertet so that there
are an array of threaded bolts and not a body of threaded holes.

when set the number of holes to one, the thing got sliced proberly.
Any number bigger than one resultes in an faulty sliced objekt.

any ideas?

the library i am using is https://github.com/adrianschlatter/threadlib
and the OpenSCAD version is 2021.01.03 on snapcraft.

gretings  



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: faulty threads after slicing

MichaelAtOz
Administrator
You will need to show the code you are using to call the library,
both the single hole, and code which has the problem.



-----
OpenSCAD Admin - email* me if you need anything,  or if I've done something stupid...

* on the Forum, click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.

--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
OpenSCAD Admin - email* me if you need anything, or if I've done something stupid...
* on the Forum, click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain;
to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.
Reply | Threaded
Open this post in threaded view
|

Re: faulty threads after slicing

RajHid
The Variables anz_x and anz_y determine the amount of threaded holes
one each will result in a Single threaded hole that will do fine on slicing
More will cause problems.

I also tested to generate two threads by using translate(){} two times whit
same result.
I tested whit ordinary cylinders that will work like a charm.

I am courious whats wrong.
dosen't make sense.
I think the source is the library.

greetings. R


/*
Generates an Disc shaped insert for a metal box to stor 3D-Printer Nozzles
*/

// ==================================
// = Used Libraries =
// ==================================
// Used Librareis and usage
// == Threads ==

use <threadlib/threadlib.scad>
// LINK:
//// https://github.com/adrianschlatter/threadlib
// USAGE:
//// bolt("M6", turns=10, higbee_arc=30);
//// tap , bolt, nut

//m6();  

module m6(){
    union(){
        difference(){
            cylinder(h=5,d1=25,d2=25, $fn=4);
            bolt("M6", turns=6, higbee_arc=30); // tap , bolt, nut
            translate([12.5,0,5]){
            //cube([25,25,10],center=true);
            }
        }
    }
}


// ==================================
// = Variables =
// ==================================

// == Disc insert ==

Diameter=51.2;              // Disc diameter
Height=10;                  // Disc Height

anz_x=2;                    // count of x holes
anz_y=2;                    // count of y holes
Stepping=1.5;               // amont of distance between holes in hole
diameter

// === 1 ===


// === Nozzle ===
NozzleThread=6;                     // Tread Major diameter
NozzlHex_h=3;                       // Height of hex section
NozzlHex_d=8;                       // Diameter of hex section
NozzlCone_h=2;                      // height of the end Cone
NozzlConeBase_d=4.00;               // Diameter at base of Cone
NozzlConeTip_d=1.00;                // Diameter at tip of Cone
NozzlFilam_d=2;                     // inner Nozzle diemeter
NozzlFilam_h=10;                    // lenght of the bore for the filament
NozzlNozzl_d=0.4;                   // Nozzle diameter for printing
NozzlTreadSection_h=7.50;           // Length of the thread section
NozzlTreadSection_minor_d=4.75;     // Tread Core Diameter

NozzlInnerCone_h=2;                 //
NozzlInnerCone_d=NozzlFilam_d;      

// === 3 ===

// == Positioning Variables ==

// == Dependant Variables ==



// === Facettes Numbers ===
// - $fn Values for Cylinders and Spheres

FN_HexNut=6;
FN_Rough=12;
FN_Medium=36;
FN_Fine=72;

FN_M8=8.00;


// == Calculated Variables

// === 1 ===

// === 2 ===

// === 3 ===

// ==================================
// = Tuning Variables =
// ==================================
// Variables for finetuning (The Slegehammer if something has to be made
fit)

tune_ScaleThread=0;          // widens the M6 Thread of the Nozzle thread
for easy fitting  

// ==================================
// = Test Stage =
// ==================================

//Holes();

// == See me ==
// For Testing and Development

see_me_half();                              // for debugging and stuff
module see_me_half(){
    difference(){
        union(){
          Disc_Insert();
        translate([0,0,0]){
          //Nozzle_Template();              
        }
        }
        translate([5,5,0]){
          cube([20,20,50]);                  // Cutting Cube
    }
   
    }
}


// == Cutting ==

// ==================================
// =
// ==================================

// ==================================
// = Stage =
// ==================================
// Final module for Produktion


//
===============================================================================
// =--------------------------------- Modules
-----------------------------------=
//
===============================================================================

module Disc_Insert(){
  difference(){
    cylinder(h=Height,d1=Diameter, d2=Diameter);
    translate([ -NozzleThread*Stepping*anz_x/2+NozzleThread*Stepping/2,
                -NozzleThread*Stepping*anz_y/2+NozzleThread*Stepping/2,
                0                                                       ]){
      //debug_Holes();
      Holes();
    }
  }
}
module Nozzle_Template(){                   // a Template of a Nozzle
  difference(){
      union(){
        bolt("M6", turns=6, higbee_arc=30);
        translate(          [0,0,0]){   cylinder(
                                        h=NozzlTreadSection_h,
                                        d1=NozzlTreadSection_minor_d,
                                        d2=NozzlTreadSection_minor_d,
                                        $fn=FN_Fine);        
            translate(      [0,0,NozzlTreadSection_h]){ cylinder(
                                                        h=NozzlHex_h,
                                                        d1=NozzlHex_d,
                                                        d2=NozzlHex_d,
                                                        $fn=FN_HexNut);
              translate(    [0,0,NozzlHex_h]){  cylinder(
                                                h=NozzlCone_h,
                                                d1=NozzlConeBase_d,
                                                d2=NozzlConeTip_d,
                                                $fn=FN_Fine);
              }
            }
          }
        }
        translate([0,0,NozzlFilam_h+NozzlInnerCone_h]){
         
#cylinder(h=NozzlInnerCone_h,d1=NozzlNozzl_d,d2=NozzlNozzl_d,$fn=FN_Fine);
            translate([0,0,0]){
             
//cylinder(h=NozzlFilam_h,d1=NozzlFilam_d,d2=NozzlFilam_d,$fn=FN_Fine);
            }
          }
        translate([0,0,NozzlFilam_h]){
           
#cylinder(h=NozzlInnerCone_h,d1=NozzlFilam_d,d2=NozzlNozzl_d,$fn=FN_Fine);
        }
        translate([0,0,0]){
             
#cylinder(h=NozzlFilam_h,d1=NozzlFilam_d,d2=NozzlFilam_d,$fn=FN_Fine);
            }
        translate([0,0,-0.5]){
            cube([10,10,1],center=true);
        }
    }
}

//
===============================================================================
// ---------------------------------- Cutting Modules
----------------------------
//
===============================================================================



//Holes();

module debug_Holes(){           // generates two holes whitout using a loop
    translate([0,20,0]){
        Thread_Nozzle();
        }
    translate([0,-20,0]){
        Thread_Nozzle();
        }
   
    }
module Holes(){                 // generates an array of anz_x times anz_y
objekts
    difference(){
        union(){
            for(j=[0:1:anz_y-1]){
                for(i=[0:1:anz_x-1]){
                    translate([     NozzleThread*Stepping*i,
                                    0,
                                    0                           ]){
                    //echo(i);
                        translate([ 0,
                                    NozzleThread*Stepping*j,
                                    0                           ]){
                           
//cylinder(h=12,d1=NozzleThread,d2=NozzleThread);

                            scale([ 1+tune_ScaleThread,
                                    1+tune_ScaleThread,
                                    1                           ]){
                                translate([0,0,Height]){
                                   
cylinder(h=Height,d1=NozzleThread*1.2,d2=NozzleThread*1.2,center=true,$fn=FN_Fine);
                                }
                                //bolt("M6", turns=15, higbee_arc=30);
                                Thread_Nozzle();    
                            }
                        }
                    }//NozzleThread*Stepping:Stepping*anz
                }
            }
        }
    }
}



module Thread_Nozzle(){
    difference(){
        bolt("M8", turns=15, higbee_arc=30);
        cube(10);
    }
}
//
===============================================================================
// ---------------------------------- Linear Extrude Modules
---------------------
//
===============================================================================



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: faulty threads after slicing

MichaelAtOz'

Unfortunately it looks like threadlib had degenerate faces in the bolt.

 

 

and also on the other end.

 

With 2019.05 your model gets a CGAL error.

With 2021.01.03 it doesn't, but the export has degenerate faces.

 

 

and also on the other side.

 

 

 

> -----Original Message-----

> From: Discuss [mailto:[hidden email]] On Behalf Of RajHid

> Sent: Wed, 6 Jan 2021 09:37

> To: [hidden email]

> Subject: Re: [OpenSCAD] faulty threads after slicing

>

> The Variables anz_x and anz_y determine the amount of threaded holes

> one each will result in a Single threaded hole that will do fine on slicing

> More will cause problems.

>

> I also tested to generate two threads by using translate(){} two times whit

> same result.

> I tested whit ordinary cylinders that will work like a charm.

>

> I am courious whats wrong.

> dosen't make sense.

> I think the source is the library.

>

> greetings. R

>

>

> /*

> Generates an Disc shaped insert for a metal box to stor 3D-Printer Nozzles

> */

>

> // ==================================

> // = Used Libraries =

> // ==================================

> // Used Librareis and usage

> // == Threads ==

>

> use <threadlib/threadlib.scad>

> // LINK:

> //// https://github.com/adrianschlatter/threadlib

> // USAGE:

> //// bolt("M6", turns=10, higbee_arc=30);

> //// tap , bolt, nut

>

> //m6();

>

> module m6(){

>     union(){

>         difference(){

>             cylinder(h=5,d1=25,d2=25, $fn=4);

>             bolt("M6", turns=6, higbee_arc=30); // tap , bolt, nut

>             translate([12.5,0,5]){

>             //cube([25,25,10],center=true);

>             }

>         }

>     }

> }

>

>

> // ==================================

> // = Variables =

> // ==================================

>

> // == Disc insert ==

>

> Diameter=51.2;              // Disc diameter

> Height=10;                  // Disc Height

>

> anz_x=2;                    // count of x holes

> anz_y=2;                    // count of y holes

> Stepping=1.5;               // amont of distance between holes in hole

> diameter

>

> // === 1 ===

>

>

> // === Nozzle ===

> NozzleThread=6;                     // Tread Major diameter

> NozzlHex_h=3;                       // Height of hex section

> NozzlHex_d=8;                       // Diameter of hex section

> NozzlCone_h=2;                      // height of the end Cone

> NozzlConeBase_d=4.00;               // Diameter at base of Cone

> NozzlConeTip_d=1.00;                // Diameter at tip of Cone

> NozzlFilam_d=2;                     // inner Nozzle diemeter

> NozzlFilam_h=10;                    // lenght of the bore for the filament

> NozzlNozzl_d=0.4;                   // Nozzle diameter for printing

> NozzlTreadSection_h=7.50;           // Length of the thread section

> NozzlTreadSection_minor_d=4.75;     // Tread Core Diameter

>

> NozzlInnerCone_h=2;                 //

> NozzlInnerCone_d=NozzlFilam_d;

>

> // === 3 ===

>

> // == Positioning Variables ==

>

> // == Dependant Variables ==

>

>

>

> // === Facettes Numbers ===

> // - $fn Values for Cylinders and Spheres

>

> FN_HexNut=6;

> FN_Rough=12;

> FN_Medium=36;

> FN_Fine=72;

>

> FN_M8=8.00;

>

>

> // == Calculated Variables

>

> // === 1 ===

>

> // === 2 ===

>

> // === 3 ===

>

> // ==================================

> // = Tuning Variables =

> // ==================================

> // Variables for finetuning (The Slegehammer if something has to be made

> fit)

>

> tune_ScaleThread=0;          // widens the M6 Thread of the Nozzle thread

> for easy fitting

>

> // ==================================

> // = Test Stage =

> // ==================================

>

> //Holes();

>

> // == See me ==

> // For Testing and Development

>

> see_me_half();                              // for debugging and stuff

> module see_me_half(){

>     difference(){

>         union(){

>           Disc_Insert();

>         translate([0,0,0]){

>           //Nozzle_Template();

>         }

>         }

>         translate([5,5,0]){

>           cube([20,20,50]);                  // Cutting Cube

>     }

>

>     }

> }

>

>

> // == Cutting ==

>

> // ==================================

> // =

> // ==================================

>

> // ==================================

> // = Stage =

> // ==================================

> // Final module for Produktion

>

>

> //

> ===============================================================================

> // =--------------------------------- Modules

> -----------------------------------=

> //

> ===============================================================================

>

> module Disc_Insert(){

>   difference(){

>     cylinder(h=Height,d1=Diameter, d2=Diameter);

>     translate([ -NozzleThread*Stepping*anz_x/2+NozzleThread*Stepping/2,

>                 -NozzleThread*Stepping*anz_y/2+NozzleThread*Stepping/2,

>                 0                                                       ]){

>       //debug_Holes();

>       Holes();

>     }

>   }

> }

> module Nozzle_Template(){                   // a Template of a Nozzle

>   difference(){

>       union(){

>         bolt("M6", turns=6, higbee_arc=30);

>         translate(          [0,0,0]){   cylinder(

>                                         h=NozzlTreadSection_h,

>                                         d1=NozzlTreadSection_minor_d,

>                                         d2=NozzlTreadSection_minor_d,

>                                         $fn=FN_Fine);

>             translate(      [0,0,NozzlTreadSection_h]){ cylinder(

>                                                         h=NozzlHex_h,

>                                                         d1=NozzlHex_d,

>                                                         d2=NozzlHex_d,

>                                                         $fn=FN_HexNut);

>               translate(    [0,0,NozzlHex_h]){  cylinder(

>                                                 h=NozzlCone_h,

>                                                 d1=NozzlConeBase_d,

>                                                 d2=NozzlConeTip_d,

>                                                 $fn=FN_Fine);

>               }

>             }

>           }

>         }

>         translate([0,0,NozzlFilam_h+NozzlInnerCone_h]){

>

> #cylinder(h=NozzlInnerCone_h,d1=NozzlNozzl_d,d2=NozzlNozzl_d,$fn=FN_Fine);

>             translate([0,0,0]){

>

> //cylinder(h=NozzlFilam_h,d1=NozzlFilam_d,d2=NozzlFilam_d,$fn=FN_Fine);

>             }

>           }

>         translate([0,0,NozzlFilam_h]){

>

> #cylinder(h=NozzlInnerCone_h,d1=NozzlFilam_d,d2=NozzlNozzl_d,$fn=FN_Fine);

>         }

>         translate([0,0,0]){

>

> #cylinder(h=NozzlFilam_h,d1=NozzlFilam_d,d2=NozzlFilam_d,$fn=FN_Fine);

>             }

>         translate([0,0,-0.5]){

>             cube([10,10,1],center=true);

>         }

>     }

> }

>

> //

> ===============================================================================

> // ---------------------------------- Cutting Modules

> ----------------------------

> //

> ===============================================================================

>

>

>

> //Holes();

>

> module debug_Holes(){           // generates two holes whitout using a loop

>     translate([0,20,0]){

>         Thread_Nozzle();

>         }

>     translate([0,-20,0]){

>         Thread_Nozzle();

>         }

>

>     }

> module Holes(){                 // generates an array of anz_x times anz_y

> objekts

>     difference(){

>         union(){

>             for(j=[0:1:anz_y-1]){

>                 for(i=[0:1:anz_x-1]){

>                     translate([     NozzleThread*Stepping*i,

>                                     0,

>                                     0                           ]){

>                     //echo(i);

>                         translate([ 0,

>                                     NozzleThread*Stepping*j,

>                                     0                           ]){

>

> //cylinder(h=12,d1=NozzleThread,d2=NozzleThread);

>

>                             scale([ 1+tune_ScaleThread,

>                                     1+tune_ScaleThread,

>                                     1                           ]){

>                                 translate([0,0,Height]){

>

> cylinder(h=Height,d1=NozzleThread*1.2,d2=NozzleThread*1.2,center=true,$fn=FN_Fine);

>                                 }

>                                 //bolt("M6", turns=15, higbee_arc=30);

>                                 Thread_Nozzle();

>                             }

>                         }

>                     }//NozzleThread*Stepping:Stepping*anz

>                 }

>             }

>         }

>     }

> }

>

>

>

> module Thread_Nozzle(){

>     difference(){

>         bolt("M8", turns=15, higbee_arc=30);

>         cube(10);

>     }

> }

> //

> ===============================================================================

> // ---------------------------------- Linear Extrude Modules

> ---------------------

> //

> ===============================================================================

>

>

>

> --

> Sent from: http://forum.openscad.org/

>

> _______________________________________________

> OpenSCAD mailing list

> [hidden email]

> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


Virus-free. www.avg.com

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: faulty threads after slicing

RajHid
OK. thanks

So how do one solve the issue?
And why one Thread will be generated fine and more dosen't

what kind of Program you were using.
I have MeshLab available and what i have to do?




--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: faulty threads after slicing

MichaelAtOz
Administrator

It happens with one thread too

 

That is Netfabb.

A degenerate triangle is tiny, needle like, being so small means

that the points can be affected by floating point inaccuracy.

They can make a hole in the mesh.

The triangle could face the wrong way, ie inside-out.

 

How particular software copes or not is not easily predictable.

 

How you described it:

"After sicing the the body and the Threaded holes got invertet so that there are an array of threaded bolts and not a body of threaded holes."

 

Seems that Prusa followed a hole and ended up treating the inside as the outside.

 

Netfabb can fix these sometimes.

I've never been able to fix them with MeshLab.

 

 

 

> -----Original Message-----

> From: Discuss [mailto:[hidden email]] On Behalf Of RajHid

> Sent: Thu, 7 Jan 2021 21:39

> To: [hidden email]

> Subject: Re: [OpenSCAD] faulty threads after slicing

>

> OK. thanks

>

> So how do one solve the issue?

> And why one Thread will be generated fine and more dosen't

>

> what kind of Program you were using.

> I have MeshLab available and what i have to do?

>

>

>

>

> --

> Sent from: http://forum.openscad.org/

>

> _______________________________________________

> OpenSCAD mailing list

> [hidden email]

> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


Virus-free. www.avg.com

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
OpenSCAD Admin - email* me if you need anything, or if I've done something stupid...
* on the Forum, click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain;
to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.
Reply | Threaded
Open this post in threaded view
|

Re: faulty threads after slicing

Roel Vanhout
I don't have a solution for this particular issue, but I had something similar which I solved by manually using 'dissolve edges' in Blender to create more straightforward (from a human pov - of course this creates ngons) geometry. After doing that, I could use Blender's 'Make manifold' and 'Fill holes' to clean up my model.

This is of course not a generalizable solution (not to mention very time consuming), but that process did make me think about whether it would be possible to automate the most tedious parts of it. If I would have had a tool that could replace all groups of triangles in a mesh in which at least two triangles share at least one edge, and of which all the vertices are coplanar within a customizable epsilon, with the concave hull of those triangles, that would have cut down at least 50% of my work. And I think that could solve this particular thread problem too, or at least make it much more obvious where things are going wrong and how to fix it.

Similarly, a tool that could 'snap' vertices to say 0.1 model unit increments would have helped a lot (although I imagine that would only make things worse for the thread example).

I haven't really thought about whether there are computationally feasible methods of achieving the above, but does anyone know of tools like this? Or maybe there is a way to influence the OpenSCAD STL exporter so that it doesn't triangulate everything in the first place? (I only started using OpenSCAD a few days ago so maybe this is not possible, I can imagine various reasons for why it might not be...) (And of course I understand why ngons for large values of n are frowned upon in mesh models, it's just that I've found that for 3d printing one wants to make different trade offs as for 3d rendering & animation, and that I prefer to slice my ngons manually in some complex cases).

cheers

Roel


On Fri, Jan 8, 2021 at 2:50 AM MichaelAtOz <[hidden email]> wrote:

It happens with one thread too

 

That is Netfabb.

A degenerate triangle is tiny, needle like, being so small means

that the points can be affected by floating point inaccuracy.

They can make a hole in the mesh.

The triangle could face the wrong way, ie inside-out.

 

How particular software copes or not is not easily predictable.

 

How you described it:

"After sicing the the body and the Threaded holes got invertet so that there are an array of threaded bolts and not a body of threaded holes."

 

Seems that Prusa followed a hole and ended up treating the inside as the outside.

 

Netfabb can fix these sometimes.

I've never been able to fix them with MeshLab.

 

 

 

> -----Original Message-----

> From: Discuss [mailto:[hidden email]] On Behalf Of RajHid

> Sent: Thu, 7 Jan 2021 21:39

> To: [hidden email]

> Subject: Re: [OpenSCAD] faulty threads after slicing

>

> OK. thanks

>

> So how do one solve the issue?

> And why one Thread will be generated fine and more dosen't

>

> what kind of Program you were using.

> I have MeshLab available and what i have to do?

>

>

>

>

> --

> Sent from: http://forum.openscad.org/

>

> _______________________________________________

> OpenSCAD mailing list

> [hidden email]

> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


Virus-free. www.avg.com
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: faulty threads after slicing

Parkinbot
In reply to this post by RajHid
1. It is usually a good idea to contact the author of the lib and point out
the issue to him/her and wait for an update.
Without having had a closer look at the code, to me the issue looks like a
[0:n] loop that better should be [0:n-1] loop.

2. Of course there are also other libs in the net that do a similar job.  



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org