In a similar vein, an error() function would be useful, to kill a script if some variable or parameter is out-of-bounds.

e.g.

if ($version < "2016") {

error("Requires version 2016.XX");

}]]>

]]>

is there anyway i can somehow create a polygon based on the manArr variable, that would encompass all the cylinders, without cutting through them?

so far the only way i think of is doing somehow a recursive function, but opensCad's restrictions on functions to be one line is driving me insane..]]>

this is my first project in openscad, so go easy ;) ... my question, how can i split the BODY part (the part between holders) ..

the alternative is to print it larger, have it sandwitch between the covers which only they will be bolted.. but i'd rather not, it would be great if i could split the 4 walls separately but even splitting it in the middle, might be ok.]]>

Obviously both functions will get used in any complex design, but do you start by cutting bits out of a lump, or start with a base and stick bits on? Or doesn't it really matter in the long run?]]>

WARNING: Normalized tree is growing past 4000 elements. Aborting normalization. WARNING: Normalized tree is growing past 4000 elements. Aborting normalization. Normalized CSG tree has 101 elementsI guess that I've gone over some OpenSCAD limit, but is there anything I can do about it?]]>

The bezel is 100mm long (x axis), 50mm high (z axis) and 0.8mm thick (y axis). What I would like to do is bend the face of it. So, the x-axis would be curved a bit around the z axis.

I understand how to use a difference to remove the back of a cube with a cylinder. What I

I assume it uses a function that I have not yet been able to discover yet.

Can anyone give any assistance on this?

Thanks

Andy]]>

I keep getting the following error

ERROR: CGAL error in CGALUtils::applyBinaryOperator union: CGAL ERROR: assertion violation! Expr: target(s1).vertex()==target(s2).vertex() File: /opt/mxe/usr/x86_64-w64-mingw32.static/include/CGAL/Nef_3/SNC_FM_decorator.h Line: 218

This works

if (leftfront) {

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

translate([0,20.5,0]) rotate([0,0,0]) mirror([0,1,0]) inlinemount();

translate([68.25,20.25,35.15]) cube([13,3.75,12]);

}

The next 3 do not work

if (rightfront){

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

translate([20.5,0,0]) rotate([0,0,90])inlinemount();

translate([20.25,68.25,35.15]) cube([3.75,13,12]);

}

if (rightrear){

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

difference(){

translate([90.5,190,0]) mirror([0,1,0])rotate([0,0,90]) inlinemount();

translate([60.25,105,-1]) cube([35,13,50]);

translate([60.25,60,44]) cube([35,50,13]);

}

}

if (leftrear){

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

difference(){

translate([189.9,93.98,3.5]) mirror([1,0,0])rotate([90,0,0]) inlinemount();

translate([105.25,40,-1]) cube([15,60,35]);

}

}

this is the inlinemount code

module inlinemount(){

difference(){

translate([84,20.5,0]) mirror([0,1,0])rotate([0,0,0]) import("D:/Core XY/appjaws-Core-XY/files/1-Motor_Mount_Left.stl",convexity=10);

translate([80,-53.5,-1]) cube([70,50,60]);

translate([126,-10.5,-1]) cube([50,50,60]);

}

translate([80.25,-3.5,-0.0]) cube([4,24,47]);

}

Attached files of the 4 stl files

Any help please.

Thanks

Paul]]>

Saved backup file: /Users/Laura/Documents/OpenSCAD/backups/Mockup-backup-xJL50578.scad

Compiling design (CSG Tree generation)...

Rendering Polygon Mesh using CGAL...

ERROR: CGAL error in CGALUtils::applyBinaryOperator union: CGAL ERROR: assertion violation! Expr: itl != it->second.end() File: /Users/kintel/code/OpenSCAD/openscad-2015.03/../libraries/install/include/CGAL/Nef_3/SNC_external_structure.h Line: 1102

Geometries in cache: 66

Geometry cache size in bytes: 19817184

CGAL Polyhedrons in cache: 11

CGAL cache size in bytes: 81062360

Total rendering time: 0 hours, 0 minutes, 45 seconds

Rendering finished.

Anybody any clue of what is wrong ?

Thomas]]>

off course it is not!

What is the problem?

Is DXF a 2d protocol ? If yes, how do I make a 2d object from my model ?

I tried to import the SCAD file into FreeCad, but the FreeCad tutorial also claims that export to DXF is a 2d issue....

Help is appreciated.

Thomas]]>

pathRadius=nnn;

num=5;

for (i=[1:num]) {

translate ([pathRadius*cos(i*(360/num)), pathRadius*sin(i*(360/num)), 0])

rotate ([??????]) // this is the bit I'm stuck with

}

So the translate with pathRadius thing puts them in a circle but my maths isn't good enough to work out what I need to do to rotate them so that they are 28 degrees off the vertical. Obviously they need to be rotated in both X and Y by some amount which varies according to placement around the circle but I'm not clever enough to know what the formula is.

Any help would be very much appreciated.]]>

How do we ask for improvements?

I use openscad all the time and at my age would not want to have to learn a different way of designing parts.]]>

In fact, the question is whether it will use that capacity ...

Thomas]]>

I tried in Freecad, to import the OpenScad generated .STL end export into IGS, but those files were empty.

Anyone knows a way to create either of those files out of my OpenScad sources/.STL ?

Thomas]]>

I have a fairly powerful (8-core) AMD CPU in my Linux Mint 18.1 64-bit machine, but a fairly ordinary graphics card. The system's CPU monitor shows that one CPU core is at 100% when redrawing is taking place, so it doesn't seem to be 'sharing the load'. Rendering also takes quite a while (also only using 1 processor core at 100%) although when complete the on-screen image can be moved and rotated very rapidly and without delay.

Is there anything I can do to minimise the redraw time in preview? Can I increase the number of concurrent threads in use, for example?

Note: I appreciate that preview is slow due to all the work it has to do - but I would like to see it run a bit faster, if changing some system parameters will help.]]>

for instance, to cut-off everything below z=0, I difference the object with a cube that is below z=0.

If I make a generic cut-off module, I could call that one, supply the name of the object module and it will cut the remainder off.

i have more idea's to process other modules ... for instance, punch a hole in them, this way.

Can this be done ?

Thomas]]>

For illustration purpose, I have placed all parts in one source and rendered it as one complex object.

I have done this as an exploded view, which renders ok.

Next I have placed all parts in their proper position.

Now, the rendering is ok, with one warning, being not manifold.

(Each part itself is manifold, so it must be the assembly.

Thisi not a problem, as the STL is ment to be shown on thingiverse, as a mockup.

However: when I want to export the STL, I am asked to supply the folder after which Openscad crashes.

This happens each time so the STL can not be saved.

Is this normal? I think not.

Not being manifold is not a crashworthy condition for saving is it ?

Thomas

]]>

When I want to make a hollow object, with predefined wall thickness,

I design the object and Difference it with a scaled smaller copy, that is translated in Z, to a defined altitude that reflects the wall thickness on the build plate.

However, the thickness of other walls: left, right, front, rear and top , (or with more complex objects all other outside surfaces) is depending on the scale parameters.

Can I calculate the thickness as a function of both the original size and the desired thickness, to get the scale parameter ?

Thomas]]>

lid screw posts, etc) based on a module call with some dimensions in

it.

The other creates the lid for the box, and there are modules for an LCD

window, button and LED holes, etc.

The lid is my problem. It designs a nice lid, except for the top edge.

I would like to round the top edge, but leave the rest square for mating to the

box surfaces. In other words, the outside edge would be a rounded corner

to the top surface. The rest of it is fine as it is in the code presented

below.

I have tried to use hull with spheres, but that didn't work. I'm using hull

now to create the rounded corners as you look at it from the top - those are

fine and match the back box.

Anyone got any idea how I can integrate the rounded edge into the code below?

I would really appreciate any help.

Thanks,

Andy

/* Variable size back box lid. Use the same dimensions as the box you programmed earlier. You do not need to specify height as it will use wall thickness to determine it. Input format: lid(length,width,wall thickness,screw hole diameter); */ $fn=100; //# of facets in curves lid(100,90,3,3); module lid(xdim,ydim,wall,screw) { xdim1 = xdim + (wall*2) + ((screw + 6) * 2); //full box x dimension ydim1 = ydim + (wall*2) + ((screw + 6) * 2); //full box y dimension difference() //screw holes { union() //bottom and top halves of lid { translate([wall+0.2,wall+0.2,0]) roundedrect((xdim1 - (wall*2) - 0.4),(ydim1 - (wall*2) - 0.4),wall-0.2,(wall-1)); //inner lid translate([0,0,wall-0.3]) roundedrect(xdim1,ydim1,wall,(wall-1)); //outer lid } translate([(wall + 3 + (screw / 2)),(wall + 3 + (screw / 2)),0]) cylinder(wall,(screw/2),(screw/2)); //X0, Y0 hole translate([(wall + 3 + (screw / 2)),(wall + 3 + (screw / 2)),wall]) cylinder(wall,screw/2,(screw * 1.5)); //X0 Y0 hole flare translate([(wall + 3 + (screw / 2)),((wall*2) + ydim + screw + 9 + (screw/2)),0]) cylinder(wall,(screw/2),(screw/2)); //X0, Y+ hole translate([(wall + 3 + (screw / 2)),((wall*2) + ydim + screw + 9 + (screw/2)),wall]) cylinder(wall,screw/2,(screw * 1.5)); //X0 Y+ hole flare translate([(wall + xdim + screw + 9 + (screw/2) + 0.1),(wall + 3 + (screw / 2)),0]) cylinder(wall,(screw/2),(screw/2)); //X+, Y0 hole translate([(wall + xdim + screw + 9 + (screw/2) + 0.1),(wall + 3 + (screw / 2)),wall]) cylinder(wall,screw/2,(screw * 1.5)); //X+ Y0 hole flare translate([(wall + xdim + screw + 9 + (screw/2) + 0.1),((wall*2) + ydim + screw + 9 + (screw/2)),0]) cylinder(wall,(screw/2),(screw/2)); //X+, Y+ hole translate([(wall + xdim + screw + 9 + (screw/2) + 0.1),((wall*2) + ydim + screw + 9 + (screw/2)),wall]) cylinder(wall,screw/2,(screw * 1.5)); //X+ Y+ hole flare /* LCD is a module to create a hole for an LCD in the lid. Specify the width (X) and the height (y) and any offest from center required (X and Y). A negative offset takes you closer to zero on that axis. If no offest is required, use zero. Format: LCD(width,height,xoffset,yoffset,xdim1,ydim1,wall); */ lcd(41.5,13.5,-3,20,xdim1,ydim1,wall); /* LCDHoles is the mounting holes for the LCD (if necessary). Specify the X and Y dimensions between hole centers, the offsets used for the LCD window, and the hole diameter. Format: lcdholes(xdim,ydim,xoffset,yoffset,hole diameter,xdim1,ydim1,wall); */ //lcdholes(30.48,17.78,-3,20,3,xdim1,ydim1,wall); /* Holes is a module that creates a single hole, Specify x,y location and the diameter of the hole. Repeat the call as many times as you need. */ holes((xdim1 / 2),35,14,wall); //pushbutton hole holes(30,35,7,wall); //power switch } } module roundedrect(xdim2,ydim2,zdim2,rdim) { hull() { translate([rdim,rdim,0]) cylinder(zdim2,rdim,rdim); //left front translate([rdim,ydim2,0]) cylinder(zdim2,rdim,rdim); //left rear translate([xdim2-rdim,rdim,0]) cylinder(zdim2,rdim,rdim); //right front translate([xdim2-rdim,ydim2,0]) cylinder(zdim2,rdim,rdim); //left rear } } module lcd(xdim2,ydim2,xoffset,yoffset,xtot2,ytot2,wall2) { side = ((xtot2 - xdim2) / 2) + xoffset + wall2; up = ((ytot2 - ydim2) / 2) + yoffset + wall2; translate([side,up,0]) cube([xdim2,ydim2,(wall2 * 2) +1]); } module lcdholes(xdim3,ydim3,xoffset1,yoffset1,hole,xtot1,ytot1,wall1) { side1 = ((xtot1 - xdim3) / 2) + xoffset1; up1 = ((ytot1 - ydim3) / 2) + yoffset1; translate([side1,up1,0]) cylinder(wall1,hole / 2,hole / 2); //X0 Y0 hole translate([side1,up1,wall1]) cylinder(wall1,hole / 2,hole * 1.5); //X0 Y0 hole flare translate([side1,wall1 + up1 + ydim3,0]) cylinder(wall1,hole / 2,hole / 2); //X0 Y+ hole translate([side1,wall1 + up1 + ydim3,wall1]) cylinder(wall1,hole / 2,hole * 1.5); //X0 Y+ hole flare translate([(wall1 + side1 + xdim3),up1,0]) cylinder(wall1,hole / 2,hole / 2); //X+ Y0 hole translate([(wall1 + side1 + xdim3),up1,wall1]) cylinder(wall1,hole / 2,hole * 1.5); //X+ Y0 hole flare translate([(wall1 + side1 + xdim3),wall1 + up1 + ydim3,0]) cylinder(wall1,hole / 2,hole / 2); //X+ Y+ hole translate([(wall1 + side1 + xdim3),wall1 + up1 + ydim3,wall1]) cylinder(wall1,hole / 2,hole * 1.5); //X+ Y+ hole flare } module holes(x2,y2,d2,wall3) { translate([x2,y2,0]) cylinder((wall3 * 2) + 1,(d2 /2),(d2 /2)); }]]>

which will assign 40 to fan_mount_dist if fan_width=50 else it will assign 32 to fan_mount_dist.

What I need to do is have a selection of 4 items(32,40,02,70 which will depend on the value of fan_width of 40,50,60,80.

any ideas how to accomplish this?]]>

What am I doing wrong?

//generating coordinates for a helix radius=100; height=150; num_circles=10; step=10; pitch=height/(num_circles*(360/step)); z=0; echo(pitch=pitch); echo("G1 F2000 Z1"); for(i=[1:1:num_circles]){ for(angle=[0:step:360-step]){ echo("X",radius*sin(angle)," Y",radius*cos(angle),"Z",z);]]>z=z+pitch;} }

I attached the files I tried using]]>

There is enough photo material of that ship available and I am confident that I can design all upper structures with my moderate skills in OpenScad,

but I am afraid that the hull will be a problem.

Has anyone ever designed a ship's hull ?

What would the 'plan of attack' be ?

It is not a simple addition of cubes and spheres.

Maybe try to manually design a number of cross sections and hull them together ?

It will probably not be fluent.....

Any help is appreciated

Thomas]]>

ERROR: CGAL error in CGAL_Nef_polyhedron3(): CGAL ERROR: assertion violation! Expr: pe_prev->is_border() || !internal::Plane_constructor::get_plane(pe_prev->facet(),pe_prev->facet()->plane()).is_degenerate() File: /opt/mxe/usr/x86_64-w64-mingw32.static/include/CGAL/Nef_3/polyhedron_3_to_nef_3.h Line: 251

This is the code (Wheel_Guide.stl is attached)

difference(){

union(){

translate([12.5,7.7,4.4]) cube([40,2,20.6]);

translate([52.55,24,15]) rotate([0,90,0]) cylinder(h=4.8,r=3,$fn=60);

import("Wheel_Guide.stl",convexity=10);

}

translate([11.6,13,4.8]) cube([41,1.1,22]);

translate([52,23,15]) rotate([0,90,0]) cylinder(h=6,r=2.65,$fn=60);

translate([40,32,-0.1]) cube([20,2,30]);

}]]>

However, when I use the difference () to create to parts that fit into each other, they will never fit after printing.

Example, difference a small cube from a large cube, print them both, they will not fit. I need to print the small cube approx 1mm smaller for a nice tight fit.

I calculate these problems with a 0.5mm marge at all sides and that will often work... not always :(

When the shape is more complex, f.i. to create a shaped box in which you store an item by differencing that complex item, you can not just subtract 0.5 mm at all perimeters, nor can you scale down, as the inner spaces will also scale down, not fitting at their complements.

Is there a general way of defining the size of components so that after the difference has been executed, both parts will fit ?

Or could a function be developed to manipulate the 'to subtract' object so that it will fit after the difference () ?

Just a silly question , which makes sense to me..

Thomas]]>

I made a small error, calling a module recursve, which gave me 4 messages in the concole after which the program went into hangup, as did my mac ... out of memory.

Thus, al my last programming was lost after killing the OpenScad......

Should the detection routine not stop rendering and gve control back to me ?

Thomas]]>

The f5 will do ok, but the f6 will error:

Rendering Polygon Mesh using CGAL...

ERROR: CGAL error in CGAL_Nef_polyhedron3(): CGAL ERROR: assertion violation! Expr: pe_prev->is_border() || !internal::Plane_constructor::get_plane(pe_prev->facet(),pe_prev->facet()->plane()).is_degenerate() File: /Users/kintel/code/OpenSCAD/openscad-2015.03/../libraries/install/include/CGAL/Nef_3/polyhedron_3_to_nef_3.h Line: 251

Geometries in cache: 12

Geometry cache size in bytes: 14020224

CGAL Polyhedrons in cache: 2

CGAL cache size in bytes: 95693744

Total rendering time: 0 hours, 0 minutes, 24 seconds

Top level object is a 3D object:

Simple: yes

Vertices: 19267

Halfedges: 113836

Edges: 56918

Halffacets: 75304

Facets: 37652

Volumes: 2

Rendering finished.

Than the first object will appear and the second object will not, also the diference has not been done.

any idea what might have hapened ?

Be advised that I have run both objects through NetFabb before.

advise appreciated

Thomas]]>

Matrix inversion code works most of the time, except I just detected a bug I can not solve. A simple dual rotation matrix, 90º around Y then 90º around Z, is yielding nan+inf on all elements of the inverse. Works nicely for other angles, though...

M = m4rz(90) * m4ry(90); // Rotates around Y first, then Z Minv = m4inv(M); // Fails

I managed to narrow it down to m4inv_solve(...) which does diagonal zero detection.

M = m4rz(90)*m4ry(90); // Test matrix echo( // Failing m4inv_solve(0, // Solve row 0: Detect diagonal zero, swap rows, calls solve2(...). m4inv_mx(M) // Expand to Row-Reduced Echelon Format ) ); echo( // Working by bypassing m4inv_solve(...) m4inv_solve2(0, // Solve row 0 (normalize, scale and subtract from all other rows) m4inv_rowswap(0,2, // Swap rows 0 and 2 by hand m4inv_mx(M) // Expand to Row-Reduced Echelon Format ) ) );

I looked at the code for m4inv_solve(...) for a while, but don't get why it is failing... Any ideas?

// Solve one step, ensure nonzero at diagonal element. function m4inv_zero(x) = abs(x) < 1e-5; function m4inv_solve(i,mx) = !m4inv_zero(mx[ i ][i ]) ? m4inv_solve2(i, mx ) : i+1<4 && !m4inv_zero(mx[ i ][i+1]) ? m4inv_solve2(i, m4inv_rowswap(i,i+1,mx)) : i+2<4 && !m4inv_zero(mx[ i ][i+2]) ? m4inv_solve2(i, m4inv_rowswap(i,i+2,mx)) : i+3<4 && !m4inv_zero(mx[ i ][i+3]) ? m4inv_solve2(i, m4inv_rowswap(i,i+3,mx)) : m4identity(); // Singular matrix, reset to identity]]>