WARNING: Mixing 2D and 3D objects is not supported, in file , line 30

WARNING: Ignoring 3D child object for 2D operation, in file , line 30

WARNING: Mixing 2D and 3D objects is not supported, in file , line 41

WARNING: Ignoring 2D child object for 3D operation, in file , line 41

Cant use circle

Try this

height = 10; //height radius = 35; angles = [40, 360]; fn = 9; tol = 0.2; a = 180 / fn; r = radius / cos(a); module round(){ difference(){ cylinder(h=height,r=radius+1); translate([0,0,-tol]) cylinder (h=height+2*tol,r=radius-1,$fn=100); } } module sector(radius, angles, fn = 9) { r = radius / cos(180 / fn); step = -360 / fn; //points = concat([[0, 0]], //[for(a = [angles[0] : step : angles[1] - 360]) //[r * cos(a), r * sin(a)] //], //[[r * cos(angles[1]), r * sin(angles[1])]] //); cylinder(h=height, r = radius, $fn = fn); } module cutout(){ difference(){ translate([0,0,-height]) scale([1,1,height])sector(radius, angles, fn); translate([0,0,-height/2]) round(); } } module combine(){ difference(){ cube([80,80,height],center=true); translate ([-2,radius-3,-2])cube([4,10,8]);//cable slot } } difference(){ combine(); rotate([0,0,30]) cutout(); }]]>

What an I doing wrong?

height = 10; //height

radius = 35;

angles = [40, 360];

fn = 9;

tol = 0.2;

a = 180 / fn;

r = radius / cos(a);

module round(){

difference(){

cylinder(h=height,r=radius+1);

translate([0,0,-tol]) cylinder (h=height+2*tol,r=radius-1,$fn=100);

} }

module sector(radius, angles, fn = 9) {

r = radius / cos(180 / fn);

step = -360 / fn;

points = concat([[0, 0]],

[for(a = [angles[0] : step : angles[1] - 360])

[r * cos(a), r * sin(a)]

],

[[r * cos(angles[1]), r * sin(angles[1])]]

);

circle(radius, $fn = fn);

}

module cutout(){

difference(){

scale([1,1,height])sector(radius, angles, fn);

translate([0,0,-height/2]) round();

} }

module combine(){

difference(){

cube([80,80,height],center=true);

translate ([-2,radius-3,-2])cube([4,10,8]);//cable slot

} }

difference(){

combine();

rotate([0,0,30]) cutout();

}]]>

import("D:/Core XY/D-Bot_latest/files/1-Hotend_Clamp_E3Dv6.stl",convexity=10);

translate([0,0,-0.5]) cube([50,20,43]);

translate([0,20,4]) cube([50,30,43]);

}

translate([13,23.5,0]) cube([15,12,4]); //fillin

}

Using F5 this displays properly but F6 render just ends up with the fillin and no Hotend clamp/

This is the error

ERROR: CGAL error in CGAL_Nef_polyhedron3(): CGAL ERROR: assertion violation! Expr: e_below != SHalfedge_handle() File: /mxe/usr/x86_64-w64-mingw32.static.posix/include/CGAL/Nef_3/SNC_FM_decorator.h Line: 426

Am I doing something wrong?]]>

I have been working on a library that implements basic support for layers, keepouts, etc. It's not ready for public release yet but it works pretty well for my own purposes.

Question #1) Is anyone aware of other libraries that implement keepouts, layering, and built-in support for multi-material STL layering?

Question #2) Is anyone interested in messing with my library to give constructive feedback, before I publicly release it?]]>

[github.com]

Sort of a fork of OpenSCAD, sort of a re-write.

Curious if folks tried it and gave up on it, and if so why --- if folks are using it, I'd like to discuss it a bit.]]>

module fillet_cylinder( r, // cylinder radius h, // cylinder height b=0, // bottom chamfer radius (=0 none, >0 outside, <0 inside) t=0, // top chamfer radius (=0 none, >0 outside, <0 inside, deg=10 // degrees per rib of fillet ) rotate_extrude() polygon(concat([[0,h],[0,0]], [for(a=[0:deg:90]) [r-b*(sin(a)-1), abs(b)*(1-cos(a))]], //bottom fillet [for(a=[90:-deg:0]) [r-t*(sin(a)-1), h-abs(t)*(1-cos(a))]])); //top fillet

As an easter egg, if you also pass in $fn=4, you'll get a filletted square prism.]]>

$fn=180; difference(){ rotate_extrude(angle=3)translate([200,0,0])square([24,24]); for(a=[0,90])rotate(a) translate([-300,0,-1])cube([600,600,26]); translate([0,0,3])rotate_extrude(angle=3)translate([203,0,0])square([18,18]); }

]]>

only one radius.

So I just rotate extrude a square ? and than make it hollow ?

Thanks I will try.]]>

This one is composed of 3 sections with [angle,radius] pairs [20,200],[-25,450],[-180,150].

If you only have one section with a constant radius, you can just with a difference of two rotate_extrude(...)square(...).

]]>

What remains is a hollow square beam with a bend according the outer perimeter of the ball.

Now scale up the result to the dimensions of 6 lipo 18650 cells stacked upon each other along their long sides and put it in the box.

Does this help ?]]>

So that will be a beam shaped object. (subtract a cube from a cube will do the math)

However, the remaining box must be slightly curved to follow the shape of the drone landing gear, to which the boxes will be fixed.

Any help in bending a beam , of the resulting box ?

Thomas]]>

This is perfect - thanks for giving credit :)

Since I am also quite active on Thingiverse, you could -but only if you like!- underlay the word "enif" with a link to my thingiverse account, which is www.thingiverse.com/enif .]]>

Desk cable organiser

Enif - have a look at what I did with your code, and let me know if you're happy with what I've done. Also, if you want a more detailed credit in the code and on Thingiverse then please PM me with your details.

Many thanks to all,

David]]>

]]>Quoteenif

Interesting problem... :)

Here my approach, which is a bit different. Instead of subtracting cylinders to get the chamfer, I construct the cylinder in slices:

-- snip for brevity ---

Quote

**frankvdh**

Right... I'd forgotten that Minkowski with a sphere moves the surface by the radius of the sphere. For sphere of radius 1, you need to subtract 1 from each of your width and height variables.

QuoteDavid J

Right - I tried using minkowski... life is too short... and all of my dimensions were screwed up (as expected); it would be a PITA to make size adjustments to compensate. So, good idea, but too painful.

Right... I'd forgotten that Minkowski with a sphere moves the surface by the radius of the sphere. For sphere of radius 1, you need to subtract 1 from each of your width and height variables.

Correct - and it's not a significant problem if you're dealing with the external measurements of a solid. However, both sides of the holes are also reduced by the radius of the sphere - the calculations just get too complicated. But really the compilation time is the major issue when you have more than 1 hole in the object.]]>

Quote

**David J**

Right - I tried using minkowski... life is too short... and all of my dimensions were screwed up (as expected); it would be a PITA to make size adjustments to compensate. So, good idea, but too painful.

Right - I tried using minkowski... life is too short... and all of my dimensions were screwed up (as expected); it would be a PITA to make size adjustments to compensate. So, good idea, but too painful.

Right... I'd forgotten that Minkowski with a sphere moves the surface by the radius of the sphere. For sphere of radius 1, you need to subtract 1 from each of your width and height variables.]]>

Thanks! :)]]>

Darn that is a good way to do it!!]]>

Here my approach, which is a bit different. Instead of subtracting cylinders to get the chamfer, I construct the cylinder in slices:

// chamfercyl - create a cylinder with round chamfered ends module chamfercyl( r, // cylinder radius h, // cylinder height b=0, // bottom chamfer radius (=0 none, >0 outside, <0 inside) t=0, // top chamfer radius (=0 none, >0 outside, <0 inside) offset=[[0,0]], // optional offsets in X and Y to create // convex hulls at slice level slices=10, // number of slices used for chamfering eps=0.01, // tiny overlap of slices ){ astep=90/slices; hull()for(o = offset) translate([o[0],o[1],abs(b)-eps])cylinder(r=r,h=h-abs(b)-abs(t)+2*eps); if(b)for(a=[0:astep:89.999])hull()for(o = offset) translate([o[0],o[1],abs(b)-abs(b)*sin(a+astep)-eps]) cylinder(r2=r+(1-cos(a))*b,r1=r+(1-cos(a+astep))*b,h=(sin(a+astep)-sin(a))*abs(b)+2*eps); if(t)for(a=[0:astep:89.999])hull()for(o = offset) translate([o[0],o[1],h-abs(t)+abs(t)*sin(a)-eps]) cylinder(r1=r+(1-cos(a))*t,r2=r+(1-cos(a+astep))*t,h=(sin(a+astep)-sin(a))*abs(t)+2*eps); } // now build David's example, the cube with the chamfered hole (viewed from below to make things easy...) $fn=36; difference(){ translate([-12.5,-12.5,0])cube(25); chamfercyl(3,25,3,3,[[-2,0],[2,0]]); }

The module

Here some more simple examples to show the basic working of the module

translate([-60,0,0])chamfercyl(10,50,0,12); translate([-30,0,0])chamfercyl(10,50,-3,-6); translate([0,0,0])chamfercyl(10,50,7,-3); translate([30,0,0])chamfercyl(10,50,-9,2); translate([60,0,0])chamfercyl(10,50,4,4);gives the following cylinders:

]]>

Quote

**Dust**

My code is freeware! do with it what you wish, no strings attached.

My code is freeware! do with it what you wish, no strings attached.

Thank you! If I do create a library then you will be credited in the header... :)-D]]>

I've been trying to develop my own idea, and here's how far I've got:

[attachment 112788 Screenshotat2019-09-2612-50-13.png]

UPDATE 1: I've just look at the code written by 'Dust' - mine follows a similar technique. I didn't copy yours, honest!

UPDATE 2: Dust's approach is better than mine...

Obviously it doesn't yet achieve my original objective, but it's a start. I won't show the code just yet as it's messy and horrible, but I do plan to make it into a library so I'll put it up here for review when it's in decent shape (and when I'm not too ashamed to show it in public!).

Cheers,

David]]>

I hadn't thought about using minkowski when the object has the slots - in the real project I had applied it to the body prior to 'cutting' the slots. I shall have to try that out. However it means re-arranging my code as I have included screw holes in the same part as the slots (not a major crisis).

My other random thought last night was about making the slot itself a better shape - making the cube and two cylinders with 'fat ends' so that a difference with a larger object results in a rounded exit. I suspect that's what the code example is doing, but I'll confirm that later today...

Thanks for all your help - I'll see how it works out.]]>

minkowski() { difference() { cube(bodyWidth); translate( [bodyWidth/2, -1, bodyWidth/2] ) slot(); } sphere(1); }]]>