discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Split .stl using difference??

CJ
Chris Johnson
Sat, Mar 6, 2021 4:48 PM

I want to print a .stl model (from Thingiverse) that is too long for my 3d
printer bed. If I split it in 2 parts each half will fit on the print bed
I read in a forum post that you should be able to split a model by
creating a shape that covers half of the model to split and using
difference or intersection commands to create 2 halves.

However when I do the difference or intersection operation the remaining
part of the .stl appears to have faces missing.

I'm a noob to opscad having moved from Fusion 360 so any help appreciated.

Here's my scad file

intersection(){
union(){import ("/Users/chrisjohnson/Downloads/1_Single_Dock.stl");

translate([41.5,0,0]){
import ("/Users/chrisjohnson/Downloads/1_Single_Dock.stl");
}
}

union(){
translate([40,68,60]){
color("green",0.5){
cube ([44,120,140], center = true);
}
}
translate([-39,68,60]){
color("green",0.5){
cube ([40,120,140], center = true);
}
}

translate([.5,52.5,61]){
color("blue",0.5){
cube ([40.5,120,140], center = true);
}
}
translate([81,52.5,61]){
color("blue",0.5){
cube ([40.5,120,140], center = true);
}
}

translate([-2,-12,-20]){
color("red",0.5){
cylinder(30,10,10);
}
}

translate([40,3,-20]){
color("red",0.5){
cylinder(30,10,10);
}
}
}
}

and here's the link to the .stl file Download
https://cdn.thingiverse.com/assets/c3/6d/8b/8b/b5/2_Dual_Dock.stl

Chris Johnson

I want to print a .stl model (from Thingiverse) that is too long for my 3d printer bed. If I split it in 2 parts each half will fit on the print bed I read in a forum post that you should be able to split a model by creating a shape that covers half of the model to split and using difference or intersection commands to create 2 halves. However when I do the difference or intersection operation the remaining part of the .stl appears to have faces missing. I'm a noob to opscad having moved from Fusion 360 so any help appreciated. Here's my scad file intersection(){ union(){import ("/Users/chrisjohnson/Downloads/1_Single_Dock.stl"); translate([41.5,0,0]){ import ("/Users/chrisjohnson/Downloads/1_Single_Dock.stl"); } } union(){ translate([40,68,60]){ color("green",0.5){ cube ([44,120,140], center = true); } } translate([-39,68,60]){ color("green",0.5){ cube ([40,120,140], center = true); } } translate([.5,52.5,61]){ color("blue",0.5){ cube ([40.5,120,140], center = true); } } translate([81,52.5,61]){ color("blue",0.5){ cube ([40.5,120,140], center = true); } } translate([-2,-12,-20]){ color("red",0.5){ cylinder(30,10,10); } } translate([40,3,-20]){ color("red",0.5){ cylinder(30,10,10); } } } } and here's the link to the .stl file Download <https://cdn.thingiverse.com/assets/c3/6d/8b/8b/b5/2_Dual_Dock.stl> Chris Johnson
BC
Bob Carter
Sat, Mar 6, 2021 5:29 PM

Try adding  ‘,convexity=10' to the imports (and you can loose a lot of the braces)

On 6 Mar 2021, at 16:48, Chris Johnson via Discuss discuss@lists.openscad.org wrote:

intersection(){
union(){import ("/Users/chrisjohnson/Downloads/1_Single_Dock.stl");

translate([41.5,0,0]){
import ("/Users/chrisjohnson/Downloads/1_Single_Dock.stl");
}
}

union(){
translate([40,68,60]){
color("green",0.5){
cube ([44,120,140], center = true);
}
}
translate([-39,68,60]){
color("green",0.5){
cube ([40,120,140], center = true);
}
}

translate([.5,52.5,61]){
color("blue",0.5){
cube ([40.5,120,140], center = true);
}
}
translate([81,52.5,61]){
color("blue",0.5){
cube ([40.5,120,140], center = true);
}
}

translate([-2,-12,-20]){
color("red",0.5){
cylinder(30,10,10);
}
}

translate([40,3,-20]){
color("red",0.5){
cylinder(30,10,10);
}
}
}
}

Try adding ‘,convexity=10' to the imports (and you can loose a lot of the braces) > On 6 Mar 2021, at 16:48, Chris Johnson via Discuss <discuss@lists.openscad.org> wrote: > > intersection(){ > union(){import ("/Users/chrisjohnson/Downloads/1_Single_Dock.stl"); > > translate([41.5,0,0]){ > import ("/Users/chrisjohnson/Downloads/1_Single_Dock.stl"); > } > } > > > union(){ > translate([40,68,60]){ > color("green",0.5){ > cube ([44,120,140], center = true); > } > } > translate([-39,68,60]){ > color("green",0.5){ > cube ([40,120,140], center = true); > } > } > > > translate([.5,52.5,61]){ > color("blue",0.5){ > cube ([40.5,120,140], center = true); > } > } > translate([81,52.5,61]){ > color("blue",0.5){ > cube ([40.5,120,140], center = true); > } > } > > > translate([-2,-12,-20]){ > color("red",0.5){ > cylinder(30,10,10); > } > } > > translate([40,3,-20]){ > color("red",0.5){ > cylinder(30,10,10); > } > } > } > }
JB
Jordan Brown
Sat, Mar 6, 2021 6:50 PM

On 3/6/2021 9:29 AM, Bob Carter wrote:

Try adding  ‘,convexity=10' to the imports (and you can loose a lot of
the braces)

Yes, convexity is the problem here.

Indeed, many of the braces are unnecessary, but always always always
indent.  If you're inside braces, indent.

For instance, for this segment:

intersection(){
union(){import ("/Users/chrisjohnson/Downloads/1_Single_Dock.stl");

translate([41.5,0,0]){
import ("/Users/chrisjohnson/Downloads/1_Single_Dock.stl");
}
}
...

indent it like so:

intersection() {
    union() {
        import ("/Users/chrisjohnson/Downloads/1_Single_Dock.stl");

        translate([41.5,0,0]) {
            import ("/Users/chrisjohnson/Downloads/1_Single_Dock.stl");
        }
    }
    ...

Use the indentation to show the structure; don't make the reader match
up the braces.

Any particular reason that you're constructing your own dual dock by
unioning two single docks, instead of using the dual dock provided?  Not
that it matters to this question.

Strangely, the first time that I previewed this model, the intersection
... didn't.  It showed the original docks and the cubes for the
intersection, and the intersection acted like a union.  Subsequent
previews, including after restarting, got it right.  (Give or take the
convexity issue.)  This is on 2021.01 on Windows.

On 3/6/2021 9:29 AM, Bob Carter wrote: > Try adding  ‘,convexity=10' to the imports (and you can loose a lot of > the braces) Yes, convexity is the problem here. Indeed, many of the braces are unnecessary, but always always always indent.  If you're inside braces, indent. For instance, for this segment: intersection(){ union(){import ("/Users/chrisjohnson/Downloads/1_Single_Dock.stl"); translate([41.5,0,0]){ import ("/Users/chrisjohnson/Downloads/1_Single_Dock.stl"); } } ... indent it like so: intersection() { union() { import ("/Users/chrisjohnson/Downloads/1_Single_Dock.stl"); translate([41.5,0,0]) { import ("/Users/chrisjohnson/Downloads/1_Single_Dock.stl"); } } ... Use the indentation to show the structure; don't make the reader match up the braces. Any particular reason that you're constructing your own dual dock by unioning two single docks, instead of using the dual dock provided?  Not that it matters to this question. Strangely, the first time that I previewed this model, the intersection ... didn't.  It showed the original docks and the cubes for the intersection, and the intersection acted like a union.  Subsequent previews, including after restarting, got it right.  (Give or take the convexity issue.)  This is on 2021.01 on Windows.
M
MichaelAtOz
Sun, Mar 7, 2021 4:43 AM

OpenSCAD mailing list-2 wrote

and here's the link to the .stl file Download
<https://cdn.thingiverse.com/assets/c3/6d/8b/8b/b5/2_Dual_Dock.stl>

Note that the STL has one self-intersection.
http://forum.openscad.org/file/t359/Capture-td32103-SI-in-stl.jpg
It could result in CGAL errors.

What thingi is that from?


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-2 wrote > and here's the link to the .stl file Download > &lt;https://cdn.thingiverse.com/assets/c3/6d/8b/8b/b5/2_Dual_Dock.stl&gt; Note that the STL has one self-intersection. <http://forum.openscad.org/file/t359/Capture-td32103-SI-in-stl.jpg> It could result in CGAL errors. What thingi is that from? ----- 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/