discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: Export to .stl or .3mf - Error - nothing to export.

AM
Adrian Mariano
Tue, May 3, 2022 10:37 AM

Your model has a polygon statement which mixes 2d and 3d.  After that
is fixed you get a CGAL error, showing that you have invalid geometry.
Your statement

path_sweep( section, path, closed=false)

produces invalid geometry---the profiles cross in points4.  You can
use path_sweep2d instead, or you need to have a larger radius on that
corner.

Note also that wall() is producing an extra level of nesting in
output.  You might want to run flatten() on section.

On Tue, May 3, 2022 at 2:14 AM Jan Öhman via Discuss
discuss@lists.openscad.org wrote:

---------- Forwarded message ----------
From: "Jan Öhman" jan_ohman@yahoo.com
To: OpenSCAD general discussion discuss@lists.openscad.org
Cc:
Bcc:
Date: Tue, 3 May 2022 06:17:02 +0000 (UTC)
Subject: [OpenSCAD] Re: Export to .stl or .3mf - Error - nothing to export.
The 3D-product can probably be created in a more efficient way, but this is what this code looks like now.

=======================
include <BOSL2/std.scad>
fn = 150;

placering="left";
// placering="right"

box(0, 0, 0, placering, "#C0C0C0", fn); // (X, Y, Z, left/right, colorName)

// Monteringsplattan
// mountingPlate(0, 0, 0, placering);

// LED belysning
// LEDlampa(0, 0, 0, placering);

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// - - - - m o d u l e r - - - - - - - - - - - - - - - - - -

//

---================
//======  box

---===
module box(posX=0, posY=0, posZ=0, mountSide="left", colorName="#00FF00", fn=24)
{
side = mountSide == "left" ? 0
: mountSide == "right" ? 1
: assert(false,"invalid moutSide value");  // message if no case worked

color(colorName)
translate([posX, posY, posZ])
mirror([side, 0, 0])
difference()
{
union()
{
// Skapa konturer på bottenplattan - x, y, r, angles, [grader], början
// Rotation medurs - vänster lamphållare (bakant saknas)
points1 = circSect( 140,  0,  0, [0, 0], "right",  1, fn);  // böj nere till höger
points2 = circSect(  60,  5,  5, [0, 5], "bottom",  1, fn); // brytpunkt längst ned
points3 = circSect(  10, 13,  10, [0, 90], "bottom", 1, fn); // böj nere till vänster
points4 = circSect(  5, 80,  5, [0, 90], "left",  1, fn); // böj uppe till vänster
points5 = circSect( 140, 80,  5, [0, 1], "top",  1, fn);  // böj uppe till höger
edge = concat(points1, points2, points3, points4, points5);
path = path3d(reverse(edge));
section = wall();
path_sweep( section, path, closed=false);

// Skapa bakkant lite högre och smalare i topp
bottom1 = concat(points5, points1);
polygon(bottom1);
path1 = path3d(reverse(bottom1));
section1 = wall1(); // lite högre bakvägg wall(b=4, f=8, h=15, t=3.5)
path_sweep( section1, path1, closed=false);

// fyll upp bottenplattansbaksida
linear_extrude(4) // Bottomplate - fill up
polygon(concat(points1, points2, points3, points4, points5));

// skapa Utskjutande del under (tänk spegelvänt)
pt1 = circSect(  19.5, 85, 0, [0, 50], "top", 1, fn);  // Uppe till höger - moturs
pt2 = circSect(  39, 1.35,  .1, [-5, 90], "right", 1, fn);  // Nere till höger
pt3 = circSect(  10, 13.05,  10, [0, 90], "bottom", 1, fn);  // Nere till vänster
pt4 = circSect(  5, 80, 5, [0, 90], "left",  1, fn);  // Uppe till vänster
translate([0, 0, -2])
linear_extrude(2.1)
polygon(concat(pt1, pt2, pt3, pt4));

// utgången för kabeln på baksidan (diam 10mm) - pekar lite nedåt
cableExit(65, 35, 0, 15, "cyan", $fn=100);
}

// skapa ett borrhål i bakkant
translate([132,60,15])
{ rotate([0, 90, 0])
{ cylinder(h=10, d=2, $fn=100);
cylinder(h=4, d=9, $fn=100);
}
}

// skapa en borrmarkering i bakkant
translate([139,25,15])
{ rotate([0, 90, 0])
cylinder(h=2, d1=1, d2=2.5, $fn=100);
}

// ingravera årtalet på baksidan
translate([10, 80, -0.5])
{ mirror([side, 0, 0])
{ rotate([0, 180, 0])
{ linear_extrude(3)
text("2022", size=12, direction="ttb", font="Comic Sans MS:style=Bold");
}
}
}

/*
// Markera skruvhål på bakkant
borr=3;
bredd=140;
hojd=8;
avstNed=20;
translate([bredd, avstNed, hojd])
{ rotate([0,90,0])
cylinder(h=2, d1=0.5, d2=borr, center=true, $fn=50);
}
*/

// borrhål
mountingHole(20, 36, 0, 7, 90.1, 15); // posX, posY, posZ, diam, dist, deep, $fn=50

}
}
//========  Slut box
---=============================

//

---================
//======  cableExit
---==============================
module cableExit(posX, posY, posZ, angle, colorName)
{ diamHole = 7;
diamHolder = 9.8;
hight = 12;
topRad = diamHolder/2;
topDiam = diamHolder/2-topRad/2;
bowRad = 7;
offs1 = 0.1;

color(colorName)
translate([posX, posY, posZ])
{  rotate([180, 0, 180-angle])
{ difference()
{ hull()
{ cylinder(h=hight, d=diamHolder, center=false);
translate([0, 0, hight])        // rundad topp
rotate_extrude(angle=360, convexity=2)
translate([topDiam, 0, 0])  // yttre diam topp
circle(d=topRad);        // radie topp
}

     inpHight  =  2;   // ett värde som styr var utgångshålet hamnar
     translate([0, 0, -offs1])
       cylinder(h=inpHight+offs1, d=diamHole, center=false); // Bottenhål

     translate([-bowRad, 0, inpHight-offs1]) // böjen
     { rotate([90, 0, 0])
         rotate_extrude(angle=90, convexity=10)
           translate([bowRad, 0, 0]) // ställ in radien på kabelböjen
             circle(d=diamHole);
     }
   }
 }

}
}
//======  slut cableExit
---=========================

//

---================
//======  mountingHole
---===========================
module mountingHole(posX=0, posY=0, posZ=0, diam=7, dist=90, deep=5, $fn=50)
{ // diam =  6;  // [mm]
// dist = 90;  // [mm]
// deep =  12;  // [mm]

translate([posX, posY, posZ])
{ translate([0, 0, -10])
cylinder(h=deep, d=diam);  // fästhål 1

 //cableHold1(dist/2, 0, .2, "#D5D5D5");  // Kabelgenomföring
 translate([dist/2, 0, 0])
 {  hull()
   { cylinder(h=5, d=6);  // fästhål 1
     sphere(d=7.5);
   }
 }

 translate([dist, 0, -10])
   cylinder(h=deep, d=diam); // fästhål 2

}
}
//======  slut mountingHole
---======================

//

---================
//======  LEDlampa
---===============================
// module LEDlampa(posX=8, posY=10, posZ=0)
module LEDlampa(posX=0, posY=0, posZ=0, mountSide="left")
{ side = mountSide == "left" ? 0
: mountSide == "right" ? 1
: assert(false,"invalid moutSide value");  // message if no case worked

xpos = mountSide == "left" ? 121
: mountSide == "right" ? -10
: assert(false,"invalid moutSide value");  // message if no case worked
/*
ypos = mountSide == "left" ? 10.5
: mountSide == "right" ? 10.5
: assert(false,"invalid moutSide value");  // message if no case worked

zpos = mountSide == "left" ? 5
: mountSide == "right" ? 5
: assert(false,"invalid moutSide value");  // message if no case worked
*/
// echo(xpos,ypos,zpos);
// translate([xpos, ypos, zpos])
translate([xpos, 10.5, 5])
mirror([1, 0, 0])
translate([posX, posY, posZ])
{ LEDbottom();
translate([0, 0, 11])
LEDglas();
}
}
//======  Slut LEDlampa
---==========================

//

---================
//======  LEDglas
---================================
module LEDglas()
{
// Variabler botten
length  = 111;  // längd mm
wideMid = 50.5;  // bredd i mitten mm

cornRad = 10;    // Radien i alla hörn
wideCorn = 48;  // Bredd i kanterna

diamHole = 6;    // håldiameter i mm

colorBot = "gray";
colorTop = "orange";

// Variabler top
cornHigh = 5;  //Höjd i ändarna
midHigh  = 8;
highTop = cornHigh + 1;  // höjd mm

p1tx = 10;      // the start value
p1ty = 49.25;
p2tx = 55.5;    // the middle value
p2ty = 50.5;
p3tx = 101;    // the end value
p3ty = p1ty;

p4tx = 101;    // the start value
p4ty = 1.25;
p5tx = 55.5;    // the middle value
p5ty = 0.0;
p6tx = 10;      // the end value
p6ty = p4ty;
// Ger ovalt glas
points1 = 3points_arc([p1tx,p1ty], [p2tx,p2ty], [p3tx,p3ty], fn=100);
points2 = 3points_arc([p4tx,p4ty], [p5tx,p5ty], [p6tx,p6ty], fn=100);

color("orange")
linear_extrude(height=cornHigh+.1)
difference()
{ polygon(concat(points1, points2));

 translate([length-10 , wideMid / 2, -.2])
   circle(d=6);
 translate([10 , wideMid / 2, -.2])
   circle(d=6);

}

// Top
color(colorTop)
difference()
{ hull()
{ // hörn1
translate([cornRad, wideMid - ((wideMid-wideCorn)/2) - cornRad, 0]) // [10,39]
cylinder(h=cornHigh, d=cornRad2, center=false);
// hörn2
translate([cornRad, cornRad + ((wideMid-wideCorn)/2), 0])          // [10,12]
cylinder(h=cornHigh, d=cornRad
2, center=false);
// hörn3
translate([length - cornRad, wideMid - ((wideMid-wideCorn)/2) - cornRad, 0]) // [101 ,39]
cylinder(h=cornHigh, d=cornRad2, center=false);
// hörn4
translate([length - cornRad, cornRad + ((wideMid-wideCorn)/2), 0])  //
cylinder(h=cornHigh, d=cornRad
2, center=false);
}

 union()
 { // Monteringshål 1 & 2
   translate([length-10 , wideMid / 2, -.2])
     cylinder(d=diamHole, h=highTop+.5, center=false);
   translate([10 , wideMid / 2, -.2])
     cylinder(d=diamHole, h=highTop+.5, center=false);
 }

}
}
//========  Slut LEDglas
---=========================

//

---================
//======  LEDbottom
---==============================
module LEDbottom()
{ p1x = 10;      // the start value
p1y = 49.25;
p2x = 55.5;    // the middle value
p2y = 50.5;
p3x = 101;    // the end value
p3y = p1y;

p4x = 101;    // the start value
p4y = 1.25;
p5x = 55.5;    // the middle value
p5y = 0.0;
p6x = 10;      // the end value
p6y = p4y;

// Variabler botten för borrhålen
length  = 111;  // längd mm
wideMid = 50.5;  // bredd i mitten mm
diamHole = 6;    // håldiameter i mm
cornHigh = 5;  //Höjd i ändarna
midHigh  = 8;
highTop = cornHigh + 1;  // höjd mm
// offs1 = 0.1;
heightHole = 15; //mm
height = 11; //mm

points1 = circSect(  10, 11.25,  10, [0, 90], "bottom", 1, fn); // Hörn nere till vänster
points2 = circSect(  10, 39.25,  10, [0, 90], "left",  1, fn); // Hörn uppe till vänster
points3 = 3points_arc([p1x,p1y], [p2x,p2y], [p3x,p3y], fn);
points4 = circSect( 101, 39.25,  10, [0, 90], "top",    1, fn); // Hörn uppe till höger
points5 = circSect( 101, 11.25,  10, [0, 90], "right",  1, fn); // Hörn nere till höger
points6 = 3points_arc([p4x,p4y], [p5x,p5y], [p6x,p6y], fn);

// The base plate for the LED lamp

difference()
{ color("gray", 0.5)
linear_extrude(height=height)
polygon(concat(points1, points2, points3, points4, points5, points6));

// union()
 { // Monteringshål 1 & 2
   translate([length-10 , wideMid / 2, -.2])
     cylinder(d=diamHole, h=heightHole, center=false);
   translate([10 , wideMid / 2, -.2])
     cylinder(d=diamHole, h=heightHole, center=false);
 }

}
}
//========  Slut LEDbottom
---=======================

//

---================
//======  circleSect
---=============================
// Create rounded corners 2D
// https://openhome.cc/eGossip/OpenSCAD/SectorArc.html
// ange .:  x, y, radien,
//          [från, till] vinkel,
//          var vinkeln startar, (left, bottom, right, top)
//          vilken rotation (-1=medsol, 1=motsols)
function circSect(x=0, y=0, radius=10, angles=[0,270], startRef="bottom", rotate=1, fn=24)  =
let(
startAngel  = (startRef == "left")  ?  0
: (startRef == "bottom") ?  90
: (startRef == "right")  ? 180
: (startRef == "top")    ? 270
: startRef,  // valfri vinkel
// : assert(false,"invalid moutSide value");  // Error message if no case worked
//: undef,
r = radius,
//r = radius / cos(180 / fn),
step = 360 / fn,
// points = [[x, y],
points = [
for(a = [angles[0]-startAngel : step : angles[1]-startAngel])
[-rotate * r * cos(a)+x, r * sin(a)+y]]
) points;
//========  Slut circleSect
---======================

//

---================
//======  3points_arc
---============================
// Create an arc with three points 2D
function 3points_arc(p0, p1, p2, fn=10) =
// an alternative expression for D
// D  = 2 * ( (p1-p0).x * (p2-p0).y - (p1-p0).y * (p2-p0).x )
let( D  = 2 * cross(p1-p0, (p2-p0)) )
assert( abs(D)>1e-9, "The 3 points should not be collinear." )
let(
Ux    = ( (p2-p0).y*(p1-p0)(p1-p0) - (p1-p0).y(p2-p0)(p2-p0) )/D,
Uy    = ( (p1-p0).x
(p2-p0)(p2-p0) - (p2-p0).x(p1-p0)(p1-p0) )/D,
radius = norm([Ux,Uy]),
center = [Ux,Uy] + p0,
ang0  = atan2( (p0-center).y, (p0-center).x ),
ang2  = atan2( (p2-center).y, (p2-center).x ),
// the points are in a cw winding iff D<0
// the angular difference between vectors p2-center and p0-center
// measured from p0-center; dang is positive iff D is negative
dang  = D<0  ? ang2<ang0 ? ang2-ang0 : ang2-ang0-360
: ang2>ang0 ? ang2-ang0 : ang2-ang0+360
)
[ for(i=[0:fn-1])
let( ang = ang0 + i
dang/(fn-1) )
center + radius*[cos(ang),sin(ang)] ];
//========  Slut 3points_arc
---=====================

//

---================
//======  Wall som ett "L"
---=======================
// Normal vägghöjd
function wall() =
let(
b =  4,    // botten - tjocklek
f =  8,    // Foten
h = 15,    // Höjd
t =  3.5,  // Top
x = (b+(t/2) - (h - ( (-h / (f-t)) *t) )) / (-h / (f-t))
)
let(
points = [[0,0], [f,0], [t,h], [0,h]] ,
top = move([t/2, h, 0], circle(d=t, $fn=20)),
sqr = square([10, b]),
diff =
difference([
move([x, b], square([t/2, t/2])),
move([x+(t/2), b+(t/2), 0], circle(d = t, $fn=20) ) ])
)
union([points, top, sqr, diff]);
//========  Slut Wall
---============================

//

---================
//======  Wall1 som ett "L"
---======================
// En högre vägg
function wall1() =
let(
b =  4,    // botten - tjocklek
f =  7,    // Foten
h = 25,    // Höjd
t =  3,  // Top
x = (b+(t/2) - (h - ((-h / (f-t)) *t))) / (-h / (f-t))
)
let(
points = [[0,0], [f,0], [t,h], [0,h]] ,
top = move([t/2, h, 0], circle(d=t, $fn=20)),
sqr = square([10, b]),
diff =
difference([
move([x, b], square([t/2, t/2])),
move([x+(t/2), b+(t/2), 0], circle(d = t, $fn=20) ) ])
)
union([points, top, sqr, diff]);
//========  Slut Wall1
---===========================

//

---================
//======  Plåt på släp
---===========================
module mountingPlate(posX=0, posY=0, posZ=0, mountSide="left", colorName="#C0C0C0", $fn=50)
{ // Hörnpositionerna
posX1 = 120;
posY1 = 0;
posX2 = posX1;
posY2 = -200;
posX3 = 120 - 75;
posY3 = -200;
posX4 = 0;
posY4 = 0;
thick=2;  // tjocklek

side = mountSide == "left" ? 0
: mountSide == "right" ? 1
: assert(false,"invalid moutSide value");  // message if no case worked

xpos = mountSide == "left" ? 20
: mountSide == "right" ? -20
: assert(false,"invalid moutSide value");  // message if no case worked
/*
ypos = mountSide == "left" ? 85
: mountSide == "right" ? 85
: assert(false,"invalid moutSide value");  // message if no case worked

zpos = mountSide == "left" ? -thick
: mountSide == "right" ? -thick
: assert(false,"invalid moutSide value");  // message if no case worked
*/
color(colorName)
{  translate([posX, posY, posZ])
translate([xpos, 85, -thick])
{ mirror([side, 0, 0])
{ linear_extrude(thick)
hull()
{ translate([posX1, posY1, 0])
square(0.1, center = true);
translate([posX2, posY2, 0])
square(0.1, center = true);
translate([posX3, posY3, 0])
square(0.1, center = true);
translate([posX4, posY4, 0])
square(0.1, center = true);
}
}
}
}
}

---========

Den tisdag 3 maj 2022 01:49:27 CEST, Father Horton fatherhorton@gmail.com skrev:

Is the OpenSCAD file small enough to share?

On Mon, May 2, 2022 at 5:23 PM Jan Öhman via Discuss discuss@lists.openscad.org wrote:

---------- Forwarded message ----------
From: "Jan Öhman" jan_ohman@yahoo.com
To: OpenSCAD General Discussion discuss@lists.openscad.org
Cc:
Bcc:
Date: Mon, 2 May 2022 22:23:28 +0000 (UTC)
Subject: [OpenSCAD] Export to .stl or .3mf - Error - nothing to export.
Thought to check out what a 3D print from openSCAD would cost.
The company can only handle .stl, .3mf, stp
The openSCAD can export to .stl and .3mf
(I don't know the difference).

When "F5" is pressed - no problems occur.

When I select "File" / "Export" / "Export as STL" (F7)
The following message is displayed .:
"ERROR: Nothing to export! Try rendering first (press F6)"

I press "F6"
The following message is displayed .:
"WARNING: No top level geometry to render"

The same thing happens when I try to export to ".3MF"
Why / What to do?

---------- Forwarded message ----------
From: "Jan Öhman via Discuss" discuss@lists.openscad.org
To: OpenSCAD General Discussion discuss@lists.openscad.org
Cc: "Jan Öhman" jan_ohman@yahoo.com
Bcc:
Date: Mon, 2 May 2022 22:23:28 +0000 (UTC)
Subject: [OpenSCAD] Export to .stl or .3mf - Error - nothing to export.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

---------- Forwarded message ----------
From: "Jan Öhman via Discuss" discuss@lists.openscad.org
To: OpenSCAD general discussion discuss@lists.openscad.org
Cc: "Jan Öhman" jan_ohman@yahoo.com
Bcc:
Date: Tue, 3 May 2022 06:17:02 +0000 (UTC)
Subject: [OpenSCAD] Re: Export to .stl or .3mf - Error - nothing to export.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Your model has a polygon statement which mixes 2d and 3d. After that is fixed you get a CGAL error, showing that you have invalid geometry. Your statement path_sweep( section, path, closed=false) produces invalid geometry---the profiles cross in points4. You can use path_sweep2d instead, or you need to have a larger radius on that corner. Note also that wall() is producing an extra level of nesting in output. You might want to run flatten() on section. On Tue, May 3, 2022 at 2:14 AM Jan Öhman via Discuss <discuss@lists.openscad.org> wrote: > > > > > ---------- Forwarded message ---------- > From: "Jan Öhman" <jan_ohman@yahoo.com> > To: OpenSCAD general discussion <discuss@lists.openscad.org> > Cc: > Bcc: > Date: Tue, 3 May 2022 06:17:02 +0000 (UTC) > Subject: [OpenSCAD] Re: Export to .stl or .3mf - Error - nothing to export. > The 3D-product can probably be created in a more efficient way, but this is what this code looks like now. > > ======================= > include <BOSL2/std.scad> > fn = 150; > > placering="left"; > // placering="right" > > box(0, 0, 0, placering, "#C0C0C0", fn); // (X, Y, Z, left/right, colorName) > > > // Monteringsplattan > // mountingPlate(0, 0, 0, placering); > > > // LED belysning > // LEDlampa(0, 0, 0, placering); > > > // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > // - - - - m o d u l e r - - - - - - - - - - - - - - - - - - > > > //================================================================================== > //====== box ===================================================================== > module box(posX=0, posY=0, posZ=0, mountSide="left", colorName="#00FF00", fn=24) > { > side = mountSide == "left" ? 0 > : mountSide == "right" ? 1 > : assert(false,"invalid moutSide value"); // message if no case worked > > color(colorName) > translate([posX, posY, posZ]) > mirror([side, 0, 0]) > difference() > { > union() > { > // Skapa konturer på bottenplattan - x, y, r, angles, [grader], början > // Rotation medurs - vänster lamphållare (bakant saknas) > points1 = circSect( 140, 0, 0, [0, 0], "right", 1, fn); // böj nere till höger > points2 = circSect( 60, 5, 5, [0, 5], "bottom", 1, fn); // brytpunkt längst ned > points3 = circSect( 10, 13, 10, [0, 90], "bottom", 1, fn); // böj nere till vänster > points4 = circSect( 5, 80, 5, [0, 90], "left", 1, fn); // böj uppe till vänster > points5 = circSect( 140, 80, 5, [0, 1], "top", 1, fn); // böj uppe till höger > edge = concat(points1, points2, points3, points4, points5); > path = path3d(reverse(edge)); > section = wall(); > path_sweep( section, path, closed=false); > > > // Skapa bakkant lite högre och smalare i topp > bottom1 = concat(points5, points1); > polygon(bottom1); > path1 = path3d(reverse(bottom1)); > section1 = wall1(); // lite högre bakvägg wall(b=4, f=8, h=15, t=3.5) > path_sweep( section1, path1, closed=false); > > // fyll upp bottenplattansbaksida > linear_extrude(4) // Bottomplate - fill up > polygon(concat(points1, points2, points3, points4, points5)); > > > // skapa Utskjutande del under (tänk spegelvänt) > pt1 = circSect( 19.5, 85, 0, [0, 50], "top", 1, fn); // Uppe till höger - moturs > pt2 = circSect( 39, 1.35, .1, [-5, 90], "right", 1, fn); // Nere till höger > pt3 = circSect( 10, 13.05, 10, [0, 90], "bottom", 1, fn); // Nere till vänster > pt4 = circSect( 5, 80, 5, [0, 90], "left", 1, fn); // Uppe till vänster > translate([0, 0, -2]) > linear_extrude(2.1) > polygon(concat(pt1, pt2, pt3, pt4)); > > // utgången för kabeln på baksidan (diam 10mm) - pekar lite nedåt > cableExit(65, 35, 0, 15, "cyan", $fn=100); > } > > // skapa ett borrhål i bakkant > translate([132,60,15]) > { rotate([0, 90, 0]) > { cylinder(h=10, d=2, $fn=100); > cylinder(h=4, d=9, $fn=100); > } > } > > // skapa en borrmarkering i bakkant > translate([139,25,15]) > { rotate([0, 90, 0]) > cylinder(h=2, d1=1, d2=2.5, $fn=100); > } > > > // ingravera årtalet på baksidan > translate([10, 80, -0.5]) > { mirror([side, 0, 0]) > { rotate([0, 180, 0]) > { linear_extrude(3) > text("2022", size=12, direction="ttb", font="Comic Sans MS:style=Bold"); > } > } > } > > /* > // Markera skruvhål på bakkant > borr=3; > bredd=140; > hojd=8; > avstNed=20; > translate([bredd, avstNed, hojd]) > { rotate([0,90,0]) > cylinder(h=2, d1=0.5, d2=borr, center=true, $fn=50); > } > */ > > // borrhål > mountingHole(20, 36, 0, 7, 90.1, 15); // posX, posY, posZ, diam, dist, deep, $fn=50 > > } > } > //======== Slut box ============================================================== > > > //================================================================================== > //====== cableExit =============================================================== > module cableExit(posX, posY, posZ, angle, colorName) > { diamHole = 7; > diamHolder = 9.8; > hight = 12; > topRad = diamHolder/2; > topDiam = diamHolder/2-topRad/2; > bowRad = 7; > offs1 = 0.1; > > color(colorName) > translate([posX, posY, posZ]) > { rotate([180, 0, 180-angle]) > { difference() > { hull() > { cylinder(h=hight, d=diamHolder, center=false); > translate([0, 0, hight]) // rundad topp > rotate_extrude(angle=360, convexity=2) > translate([topDiam, 0, 0]) // yttre diam topp > circle(d=topRad); // radie topp > } > > > inpHight = 2; // ett värde som styr var utgångshålet hamnar > translate([0, 0, -offs1]) > cylinder(h=inpHight+offs1, d=diamHole, center=false); // Bottenhål > > translate([-bowRad, 0, inpHight-offs1]) // böjen > { rotate([90, 0, 0]) > rotate_extrude(angle=90, convexity=10) > translate([bowRad, 0, 0]) // ställ in radien på kabelböjen > circle(d=diamHole); > } > } > } > } > } > //====== slut cableExit ========================================================== > > > //================================================================================== > //====== mountingHole ============================================================ > module mountingHole(posX=0, posY=0, posZ=0, diam=7, dist=90, deep=5, $fn=50) > { // diam = 6; // [mm] > // dist = 90; // [mm] > // deep = 12; // [mm] > > translate([posX, posY, posZ]) > { translate([0, 0, -10]) > cylinder(h=deep, d=diam); // fästhål 1 > > //cableHold1(dist/2, 0, .2, "#D5D5D5"); // Kabelgenomföring > translate([dist/2, 0, 0]) > { hull() > { cylinder(h=5, d=6); // fästhål 1 > sphere(d=7.5); > } > } > > translate([dist, 0, -10]) > cylinder(h=deep, d=diam); // fästhål 2 > } > } > //====== slut mountingHole ======================================================= > > > //================================================================================== > //====== LEDlampa ================================================================ > // module LEDlampa(posX=8, posY=10, posZ=0) > module LEDlampa(posX=0, posY=0, posZ=0, mountSide="left") > { side = mountSide == "left" ? 0 > : mountSide == "right" ? 1 > : assert(false,"invalid moutSide value"); // message if no case worked > > xpos = mountSide == "left" ? 121 > : mountSide == "right" ? -10 > : assert(false,"invalid moutSide value"); // message if no case worked > /* > ypos = mountSide == "left" ? 10.5 > : mountSide == "right" ? 10.5 > : assert(false,"invalid moutSide value"); // message if no case worked > > zpos = mountSide == "left" ? 5 > : mountSide == "right" ? 5 > : assert(false,"invalid moutSide value"); // message if no case worked > */ > // echo(xpos,ypos,zpos); > // translate([xpos, ypos, zpos]) > translate([xpos, 10.5, 5]) > mirror([1, 0, 0]) > translate([posX, posY, posZ]) > { LEDbottom(); > translate([0, 0, 11]) > LEDglas(); > } > } > //====== Slut LEDlampa =========================================================== > > > //================================================================================== > //====== LEDglas ================================================================= > module LEDglas() > { > // Variabler botten > length = 111; // längd mm > wideMid = 50.5; // bredd i mitten mm > > cornRad = 10; // Radien i alla hörn > wideCorn = 48; // Bredd i kanterna > > diamHole = 6; // håldiameter i mm > > colorBot = "gray"; > colorTop = "orange"; > > // Variabler top > cornHigh = 5; //Höjd i ändarna > midHigh = 8; > highTop = cornHigh + 1; // höjd mm > > p1tx = 10; // the start value > p1ty = 49.25; > p2tx = 55.5; // the middle value > p2ty = 50.5; > p3tx = 101; // the end value > p3ty = p1ty; > > p4tx = 101; // the start value > p4ty = 1.25; > p5tx = 55.5; // the middle value > p5ty = 0.0; > p6tx = 10; // the end value > p6ty = p4ty; > // Ger ovalt glas > points1 = 3points_arc([p1tx,p1ty], [p2tx,p2ty], [p3tx,p3ty], fn=100); > points2 = 3points_arc([p4tx,p4ty], [p5tx,p5ty], [p6tx,p6ty], fn=100); > > color("orange") > linear_extrude(height=cornHigh+.1) > difference() > { polygon(concat(points1, points2)); > > translate([length-10 , wideMid / 2, -.2]) > circle(d=6); > translate([10 , wideMid / 2, -.2]) > circle(d=6); > } > > // Top > color(colorTop) > difference() > { hull() > { // hörn1 > translate([cornRad, wideMid - ((wideMid-wideCorn)/2) - cornRad, 0]) // [10,39] > cylinder(h=cornHigh, d=cornRad*2, center=false); > // hörn2 > translate([cornRad, cornRad + ((wideMid-wideCorn)/2), 0]) // [10,12] > cylinder(h=cornHigh, d=cornRad*2, center=false); > // hörn3 > translate([length - cornRad, wideMid - ((wideMid-wideCorn)/2) - cornRad, 0]) // [101 ,39] > cylinder(h=cornHigh, d=cornRad*2, center=false); > // hörn4 > translate([length - cornRad, cornRad + ((wideMid-wideCorn)/2), 0]) // > cylinder(h=cornHigh, d=cornRad*2, center=false); > } > > union() > { // Monteringshål 1 & 2 > translate([length-10 , wideMid / 2, -.2]) > cylinder(d=diamHole, h=highTop+.5, center=false); > translate([10 , wideMid / 2, -.2]) > cylinder(d=diamHole, h=highTop+.5, center=false); > } > } > } > //======== Slut LEDglas ========================================================== > > > //================================================================================== > //====== LEDbottom =============================================================== > module LEDbottom() > { p1x = 10; // the start value > p1y = 49.25; > p2x = 55.5; // the middle value > p2y = 50.5; > p3x = 101; // the end value > p3y = p1y; > > p4x = 101; // the start value > p4y = 1.25; > p5x = 55.5; // the middle value > p5y = 0.0; > p6x = 10; // the end value > p6y = p4y; > > // Variabler botten för borrhålen > length = 111; // längd mm > wideMid = 50.5; // bredd i mitten mm > diamHole = 6; // håldiameter i mm > cornHigh = 5; //Höjd i ändarna > midHigh = 8; > highTop = cornHigh + 1; // höjd mm > // offs1 = 0.1; > heightHole = 15; //mm > height = 11; //mm > > points1 = circSect( 10, 11.25, 10, [0, 90], "bottom", 1, fn); // Hörn nere till vänster > points2 = circSect( 10, 39.25, 10, [0, 90], "left", 1, fn); // Hörn uppe till vänster > points3 = 3points_arc([p1x,p1y], [p2x,p2y], [p3x,p3y], fn); > points4 = circSect( 101, 39.25, 10, [0, 90], "top", 1, fn); // Hörn uppe till höger > points5 = circSect( 101, 11.25, 10, [0, 90], "right", 1, fn); // Hörn nere till höger > points6 = 3points_arc([p4x,p4y], [p5x,p5y], [p6x,p6y], fn); > > // The base plate for the LED lamp > > > difference() > { color("gray", 0.5) > linear_extrude(height=height) > polygon(concat(points1, points2, points3, points4, points5, points6)); > > > // union() > { // Monteringshål 1 & 2 > translate([length-10 , wideMid / 2, -.2]) > cylinder(d=diamHole, h=heightHole, center=false); > translate([10 , wideMid / 2, -.2]) > cylinder(d=diamHole, h=heightHole, center=false); > } > } > } > //======== Slut LEDbottom ======================================================== > > > > //================================================================================== > //====== circleSect ============================================================== > // Create rounded corners 2D > // https://openhome.cc/eGossip/OpenSCAD/SectorArc.html > // ange .: x, y, radien, > // [från, till] vinkel, > // var vinkeln startar, (left, bottom, right, top) > // vilken rotation (-1=medsol, 1=motsols) > function circSect(x=0, y=0, radius=10, angles=[0,270], startRef="bottom", rotate=1, fn=24) = > let( > startAngel = (startRef == "left") ? 0 > : (startRef == "bottom") ? 90 > : (startRef == "right") ? 180 > : (startRef == "top") ? 270 > : startRef, // valfri vinkel > // : assert(false,"invalid moutSide value"); // Error message if no case worked > //: undef, > r = radius, > //r = radius / cos(180 / fn), > step = 360 / fn, > // points = [[x, y], > points = [ > for(a = [angles[0]-startAngel : step : angles[1]-startAngel]) > [-rotate * r * cos(a)+x, r * sin(a)+y]] > ) points; > //======== Slut circleSect ======================================================= > > > //================================================================================== > //====== 3points_arc ============================================================= > // Create an arc with three points 2D > function 3points_arc(p0, p1, p2, fn=10) = > // an alternative expression for D > // D = 2 * ( (p1-p0).x * (p2-p0).y - (p1-p0).y * (p2-p0).x ) > let( D = 2 * cross(p1-p0, (p2-p0)) ) > assert( abs(D)>1e-9, "The 3 points should not be collinear." ) > let( > Ux = ( (p2-p0).y*(p1-p0)*(p1-p0) - (p1-p0).y*(p2-p0)*(p2-p0) )/D, > Uy = ( (p1-p0).x*(p2-p0)*(p2-p0) - (p2-p0).x*(p1-p0)*(p1-p0) )/D, > radius = norm([Ux,Uy]), > center = [Ux,Uy] + p0, > ang0 = atan2( (p0-center).y, (p0-center).x ), > ang2 = atan2( (p2-center).y, (p2-center).x ), > // the points are in a cw winding iff D<0 > // the angular difference between vectors p2-center and p0-center > // measured from p0-center; dang is positive iff D is negative > dang = D<0 ? ang2<ang0 ? ang2-ang0 : ang2-ang0-360 > : ang2>ang0 ? ang2-ang0 : ang2-ang0+360 > ) > [ for(i=[0:fn-1]) > let( ang = ang0 + i*dang/(fn-1) ) > center + radius*[cos(ang),sin(ang)] ]; > //======== Slut 3points_arc ====================================================== > > > //================================================================================== > //====== Wall som ett "L" ======================================================== > // Normal vägghöjd > function wall() = > let( > b = 4, // botten - tjocklek > f = 8, // Foten > h = 15, // Höjd > t = 3.5, // Top > x = (b+(t/2) - (h - ( (-h / (f-t)) *t) )) / (-h / (f-t)) > ) > let( > points = [[0,0], [f,0], [t,h], [0,h]] , > top = move([t/2, h, 0], circle(d=t, $fn=20)), > sqr = square([10, b]), > diff = > difference([ > move([x, b], square([t/2, t/2])), > move([x+(t/2), b+(t/2), 0], circle(d = t, $fn=20) ) ]) > ) > union([points, top, sqr, diff]); > //======== Slut Wall ============================================================= > > > > //================================================================================== > //====== Wall1 som ett "L" ======================================================= > // En högre vägg > function wall1() = > let( > b = 4, // botten - tjocklek > f = 7, // Foten > h = 25, // Höjd > t = 3, // Top > x = (b+(t/2) - (h - ((-h / (f-t)) *t))) / (-h / (f-t)) > ) > let( > points = [[0,0], [f,0], [t,h], [0,h]] , > top = move([t/2, h, 0], circle(d=t, $fn=20)), > sqr = square([10, b]), > diff = > difference([ > move([x, b], square([t/2, t/2])), > move([x+(t/2), b+(t/2), 0], circle(d = t, $fn=20) ) ]) > ) > union([points, top, sqr, diff]); > //======== Slut Wall1 ============================================================ > > > //================================================================================== > //====== Plåt på släp ============================================================ > module mountingPlate(posX=0, posY=0, posZ=0, mountSide="left", colorName="#C0C0C0", $fn=50) > { // Hörnpositionerna > posX1 = 120; > posY1 = 0; > posX2 = posX1; > posY2 = -200; > posX3 = 120 - 75; > posY3 = -200; > posX4 = 0; > posY4 = 0; > thick=2; // tjocklek > > side = mountSide == "left" ? 0 > : mountSide == "right" ? 1 > : assert(false,"invalid moutSide value"); // message if no case worked > > xpos = mountSide == "left" ? 20 > : mountSide == "right" ? -20 > : assert(false,"invalid moutSide value"); // message if no case worked > /* > ypos = mountSide == "left" ? 85 > : mountSide == "right" ? 85 > : assert(false,"invalid moutSide value"); // message if no case worked > > zpos = mountSide == "left" ? -thick > : mountSide == "right" ? -thick > : assert(false,"invalid moutSide value"); // message if no case worked > */ > color(colorName) > { translate([posX, posY, posZ]) > translate([xpos, 85, -thick]) > { mirror([side, 0, 0]) > { linear_extrude(thick) > hull() > { translate([posX1, posY1, 0]) > square(0.1, center = true); > translate([posX2, posY2, 0]) > square(0.1, center = true); > translate([posX3, posY3, 0]) > square(0.1, center = true); > translate([posX4, posY4, 0]) > square(0.1, center = true); > } > } > } > } > } > ========================================= > > Den tisdag 3 maj 2022 01:49:27 CEST, Father Horton <fatherhorton@gmail.com> skrev: > > > Is the OpenSCAD file small enough to share? > > On Mon, May 2, 2022 at 5:23 PM Jan Öhman via Discuss <discuss@lists.openscad.org> wrote: > > > > > ---------- Forwarded message ---------- > From: "Jan Öhman" <jan_ohman@yahoo.com> > To: OpenSCAD General Discussion <discuss@lists.openscad.org> > Cc: > Bcc: > Date: Mon, 2 May 2022 22:23:28 +0000 (UTC) > Subject: [OpenSCAD] Export to .stl or .3mf - Error - nothing to export. > Thought to check out what a 3D print from openSCAD would cost. > The company can only handle .stl, .3mf, stp > The openSCAD can export to .stl and .3mf > (I don't know the difference). > > When "F5" is pressed - no problems occur. > > When I select "File" / "Export" / "Export as STL" (F7) > The following message is displayed .: > "ERROR: Nothing to export! Try rendering first (press F6)" > > I press "F6" > The following message is displayed .: > "WARNING: No top level geometry to render" > > The same thing happens when I try to export to ".3MF" > Why / What to do? > > > > > ---------- Forwarded message ---------- > From: "Jan Öhman via Discuss" <discuss@lists.openscad.org> > To: OpenSCAD General Discussion <discuss@lists.openscad.org> > Cc: "Jan Öhman" <jan_ohman@yahoo.com> > Bcc: > Date: Mon, 2 May 2022 22:23:28 +0000 (UTC) > Subject: [OpenSCAD] Export to .stl or .3mf - Error - nothing to export. > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > > > > ---------- Forwarded message ---------- > From: "Jan Öhman via Discuss" <discuss@lists.openscad.org> > To: OpenSCAD general discussion <discuss@lists.openscad.org> > Cc: "Jan Öhman" <jan_ohman@yahoo.com> > Bcc: > Date: Tue, 3 May 2022 06:17:02 +0000 (UTC) > Subject: [OpenSCAD] Re: Export to .stl or .3mf - Error - nothing to export. > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
AM
Adrian Mariano
Tue, May 3, 2022 11:23 AM

Actually ignore what I said about flatten() unless you're trying to
use the profiles=true option of path_sweep.  There's a bug where it
doesn't work with regions.

On Tue, May 3, 2022 at 6:37 AM Adrian Mariano avm4@cornell.edu wrote:

Your model has a polygon statement which mixes 2d and 3d.  After that
is fixed you get a CGAL error, showing that you have invalid geometry.
Your statement

path_sweep( section, path, closed=false)

produces invalid geometry---the profiles cross in points4.  You can
use path_sweep2d instead, or you need to have a larger radius on that
corner.

Note also that wall() is producing an extra level of nesting in
output.  You might want to run flatten() on section.

On Tue, May 3, 2022 at 2:14 AM Jan Öhman via Discuss
discuss@lists.openscad.org wrote:

---------- Forwarded message ----------
From: "Jan Öhman" jan_ohman@yahoo.com
To: OpenSCAD general discussion discuss@lists.openscad.org
Cc:
Bcc:
Date: Tue, 3 May 2022 06:17:02 +0000 (UTC)
Subject: [OpenSCAD] Re: Export to .stl or .3mf - Error - nothing to export.
The 3D-product can probably be created in a more efficient way, but this is what this code looks like now.

=======================
include <BOSL2/std.scad>
fn = 150;

placering="left";
// placering="right"

box(0, 0, 0, placering, "#C0C0C0", fn); // (X, Y, Z, left/right, colorName)

// Monteringsplattan
// mountingPlate(0, 0, 0, placering);

// LED belysning
// LEDlampa(0, 0, 0, placering);

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// - - - - m o d u l e r - - - - - - - - - - - - - - - - - -

//


---================

//======  box


---===

module box(posX=0, posY=0, posZ=0, mountSide="left", colorName="#00FF00", fn=24)
{
side = mountSide == "left" ? 0
: mountSide == "right" ? 1
: assert(false,"invalid moutSide value");  // message if no case worked

color(colorName)
translate([posX, posY, posZ])
mirror([side, 0, 0])
difference()
{
union()
{
// Skapa konturer på bottenplattan - x, y, r, angles, [grader], början
// Rotation medurs - vänster lamphållare (bakant saknas)
points1 = circSect( 140,  0,  0, [0, 0], "right",  1, fn);  // böj nere till höger
points2 = circSect(  60,  5,  5, [0, 5], "bottom",  1, fn); // brytpunkt längst ned
points3 = circSect(  10, 13,  10, [0, 90], "bottom", 1, fn); // böj nere till vänster
points4 = circSect(  5, 80,  5, [0, 90], "left",  1, fn); // böj uppe till vänster
points5 = circSect( 140, 80,  5, [0, 1], "top",  1, fn);  // böj uppe till höger
edge = concat(points1, points2, points3, points4, points5);
path = path3d(reverse(edge));
section = wall();
path_sweep( section, path, closed=false);

// Skapa bakkant lite högre och smalare i topp
bottom1 = concat(points5, points1);
polygon(bottom1);
path1 = path3d(reverse(bottom1));
section1 = wall1(); // lite högre bakvägg wall(b=4, f=8, h=15, t=3.5)
path_sweep( section1, path1, closed=false);

// fyll upp bottenplattansbaksida
linear_extrude(4) // Bottomplate - fill up
polygon(concat(points1, points2, points3, points4, points5));

// skapa Utskjutande del under (tänk spegelvänt)
pt1 = circSect(  19.5, 85, 0, [0, 50], "top", 1, fn);  // Uppe till höger - moturs
pt2 = circSect(  39, 1.35,  .1, [-5, 90], "right", 1, fn);  // Nere till höger
pt3 = circSect(  10, 13.05,  10, [0, 90], "bottom", 1, fn);  // Nere till vänster
pt4 = circSect(  5, 80, 5, [0, 90], "left",  1, fn);  // Uppe till vänster
translate([0, 0, -2])
linear_extrude(2.1)
polygon(concat(pt1, pt2, pt3, pt4));

// utgången för kabeln på baksidan (diam 10mm) - pekar lite nedåt
cableExit(65, 35, 0, 15, "cyan", $fn=100);
}

// skapa ett borrhål i bakkant
translate([132,60,15])
{ rotate([0, 90, 0])
{ cylinder(h=10, d=2, $fn=100);
cylinder(h=4, d=9, $fn=100);
}
}

// skapa en borrmarkering i bakkant
translate([139,25,15])
{ rotate([0, 90, 0])
cylinder(h=2, d1=1, d2=2.5, $fn=100);
}

// ingravera årtalet på baksidan
translate([10, 80, -0.5])
{ mirror([side, 0, 0])
{ rotate([0, 180, 0])
{ linear_extrude(3)
text("2022", size=12, direction="ttb", font="Comic Sans MS:style=Bold");
}
}
}

/*
// Markera skruvhål på bakkant
borr=3;
bredd=140;
hojd=8;
avstNed=20;
translate([bredd, avstNed, hojd])
{ rotate([0,90,0])
cylinder(h=2, d1=0.5, d2=borr, center=true, $fn=50);
}
*/

// borrhål
mountingHole(20, 36, 0, 7, 90.1, 15); // posX, posY, posZ, diam, dist, deep, $fn=50

}
}
//========  Slut box
---=============================

//


---================

//======  cableExit
---==============================
module cableExit(posX, posY, posZ, angle, colorName)
{ diamHole = 7;
diamHolder = 9.8;
hight = 12;
topRad = diamHolder/2;
topDiam = diamHolder/2-topRad/2;
bowRad = 7;
offs1 = 0.1;

color(colorName)
translate([posX, posY, posZ])
{  rotate([180, 0, 180-angle])
{ difference()
{ hull()
{ cylinder(h=hight, d=diamHolder, center=false);
translate([0, 0, hight])        // rundad topp
rotate_extrude(angle=360, convexity=2)
translate([topDiam, 0, 0])  // yttre diam topp
circle(d=topRad);        // radie topp
}

    inpHight  =  2;   // ett värde som styr var utgångshålet hamnar
    translate([0, 0, -offs1])
      cylinder(h=inpHight+offs1, d=diamHole, center=false); // Bottenhål

    translate([-bowRad, 0, inpHight-offs1]) // böjen
    { rotate([90, 0, 0])
        rotate_extrude(angle=90, convexity=10)
          translate([bowRad, 0, 0]) // ställ in radien på kabelböjen
            circle(d=diamHole);
    }
  }
}

}
}
//======  slut cableExit
---=========================

//


---================

//======  mountingHole
---===========================
module mountingHole(posX=0, posY=0, posZ=0, diam=7, dist=90, deep=5, $fn=50)
{ // diam =  6;  // [mm]
// dist = 90;  // [mm]
// deep =  12;  // [mm]

translate([posX, posY, posZ])
{ translate([0, 0, -10])
cylinder(h=deep, d=diam);  // fästhål 1

//cableHold1(dist/2, 0, .2, "#D5D5D5");  // Kabelgenomföring
translate([dist/2, 0, 0])
{  hull()
  { cylinder(h=5, d=6);  // fästhål 1
    sphere(d=7.5);
  }
}

translate([dist, 0, -10])
  cylinder(h=deep, d=diam); // fästhål 2

}
}
//======  slut mountingHole
---======================

//


---================

//======  LEDlampa
---===============================
// module LEDlampa(posX=8, posY=10, posZ=0)
module LEDlampa(posX=0, posY=0, posZ=0, mountSide="left")
{ side = mountSide == "left" ? 0
: mountSide == "right" ? 1
: assert(false,"invalid moutSide value");  // message if no case worked

xpos = mountSide == "left" ? 121
: mountSide == "right" ? -10
: assert(false,"invalid moutSide value");  // message if no case worked
/*
ypos = mountSide == "left" ? 10.5
: mountSide == "right" ? 10.5
: assert(false,"invalid moutSide value");  // message if no case worked

zpos = mountSide == "left" ? 5
: mountSide == "right" ? 5
: assert(false,"invalid moutSide value");  // message if no case worked
*/
// echo(xpos,ypos,zpos);
// translate([xpos, ypos, zpos])
translate([xpos, 10.5, 5])
mirror([1, 0, 0])
translate([posX, posY, posZ])
{ LEDbottom();
translate([0, 0, 11])
LEDglas();
}
}
//======  Slut LEDlampa
---==========================

//


---================

//======  LEDglas
---================================
module LEDglas()
{
// Variabler botten
length  = 111;  // längd mm
wideMid = 50.5;  // bredd i mitten mm

cornRad = 10;    // Radien i alla hörn
wideCorn = 48;  // Bredd i kanterna

diamHole = 6;    // håldiameter i mm

colorBot = "gray";
colorTop = "orange";

// Variabler top
cornHigh = 5;  //Höjd i ändarna
midHigh  = 8;
highTop = cornHigh + 1;  // höjd mm

p1tx = 10;      // the start value
p1ty = 49.25;
p2tx = 55.5;    // the middle value
p2ty = 50.5;
p3tx = 101;    // the end value
p3ty = p1ty;

p4tx = 101;    // the start value
p4ty = 1.25;
p5tx = 55.5;    // the middle value
p5ty = 0.0;
p6tx = 10;      // the end value
p6ty = p4ty;
// Ger ovalt glas
points1 = 3points_arc([p1tx,p1ty], [p2tx,p2ty], [p3tx,p3ty], fn=100);
points2 = 3points_arc([p4tx,p4ty], [p5tx,p5ty], [p6tx,p6ty], fn=100);

color("orange")
linear_extrude(height=cornHigh+.1)
difference()
{ polygon(concat(points1, points2));

translate([length-10 , wideMid / 2, -.2])
  circle(d=6);
translate([10 , wideMid / 2, -.2])
  circle(d=6);

}

// Top
color(colorTop)
difference()
{ hull()
{ // hörn1
translate([cornRad, wideMid - ((wideMid-wideCorn)/2) - cornRad, 0]) // [10,39]
cylinder(h=cornHigh, d=cornRad2, center=false);
// hörn2
translate([cornRad, cornRad + ((wideMid-wideCorn)/2), 0])          // [10,12]
cylinder(h=cornHigh, d=cornRad
2, center=false);
// hörn3
translate([length - cornRad, wideMid - ((wideMid-wideCorn)/2) - cornRad, 0]) // [101 ,39]
cylinder(h=cornHigh, d=cornRad2, center=false);
// hörn4
translate([length - cornRad, cornRad + ((wideMid-wideCorn)/2), 0])  //
cylinder(h=cornHigh, d=cornRad
2, center=false);
}

union()
{ // Monteringshål 1 & 2
  translate([length-10 , wideMid / 2, -.2])
    cylinder(d=diamHole, h=highTop+.5, center=false);
  translate([10 , wideMid / 2, -.2])
    cylinder(d=diamHole, h=highTop+.5, center=false);
}

}
}
//========  Slut LEDglas
---=========================

//


---================

//======  LEDbottom
---==============================
module LEDbottom()
{ p1x = 10;      // the start value
p1y = 49.25;
p2x = 55.5;    // the middle value
p2y = 50.5;
p3x = 101;    // the end value
p3y = p1y;

p4x = 101;    // the start value
p4y = 1.25;
p5x = 55.5;    // the middle value
p5y = 0.0;
p6x = 10;      // the end value
p6y = p4y;

// Variabler botten för borrhålen
length  = 111;  // längd mm
wideMid = 50.5;  // bredd i mitten mm
diamHole = 6;    // håldiameter i mm
cornHigh = 5;  //Höjd i ändarna
midHigh  = 8;
highTop = cornHigh + 1;  // höjd mm
// offs1 = 0.1;
heightHole = 15; //mm
height = 11; //mm

points1 = circSect(  10, 11.25,  10, [0, 90], "bottom", 1, fn); // Hörn nere till vänster
points2 = circSect(  10, 39.25,  10, [0, 90], "left",  1, fn); // Hörn uppe till vänster
points3 = 3points_arc([p1x,p1y], [p2x,p2y], [p3x,p3y], fn);
points4 = circSect( 101, 39.25,  10, [0, 90], "top",    1, fn); // Hörn uppe till höger
points5 = circSect( 101, 11.25,  10, [0, 90], "right",  1, fn); // Hörn nere till höger
points6 = 3points_arc([p4x,p4y], [p5x,p5y], [p6x,p6y], fn);

// The base plate for the LED lamp

difference()
{ color("gray", 0.5)
linear_extrude(height=height)
polygon(concat(points1, points2, points3, points4, points5, points6));

// union()
{ // Monteringshål 1 & 2
translate([length-10 , wideMid / 2, -.2])
cylinder(d=diamHole, h=heightHole, center=false);
translate([10 , wideMid / 2, -.2])
cylinder(d=diamHole, h=heightHole, center=false);
}
}
}
//========  Slut LEDbottom
---=======================

//


---================

//======  circleSect
---=============================
// Create rounded corners 2D
// https://openhome.cc/eGossip/OpenSCAD/SectorArc.html
// ange .:  x, y, radien,
//          [från, till] vinkel,
//          var vinkeln startar, (left, bottom, right, top)
//          vilken rotation (-1=medsol, 1=motsols)
function circSect(x=0, y=0, radius=10, angles=[0,270], startRef="bottom", rotate=1, fn=24)  =
let(
startAngel  = (startRef == "left")  ?  0
: (startRef == "bottom") ?  90
: (startRef == "right")  ? 180
: (startRef == "top")    ? 270
: startRef,  // valfri vinkel
// : assert(false,"invalid moutSide value");  // Error message if no case worked
//: undef,
r = radius,
//r = radius / cos(180 / fn),
step = 360 / fn,
// points = [[x, y],
points = [
for(a = [angles[0]-startAngel : step : angles[1]-startAngel])
[-rotate * r * cos(a)+x, r * sin(a)+y]]
) points;
//========  Slut circleSect
---======================

//


---================

//======  3points_arc
---============================
// Create an arc with three points 2D
function 3points_arc(p0, p1, p2, fn=10) =
// an alternative expression for D
// D  = 2 * ( (p1-p0).x * (p2-p0).y - (p1-p0).y * (p2-p0).x )
let( D  = 2 * cross(p1-p0, (p2-p0)) )
assert( abs(D)>1e-9, "The 3 points should not be collinear." )
let(
Ux    = ( (p2-p0).y*(p1-p0)(p1-p0) - (p1-p0).y(p2-p0)(p2-p0) )/D,
Uy    = ( (p1-p0).x
(p2-p0)(p2-p0) - (p2-p0).x(p1-p0)(p1-p0) )/D,
radius = norm([Ux,Uy]),
center = [Ux,Uy] + p0,
ang0  = atan2( (p0-center).y, (p0-center).x ),
ang2  = atan2( (p2-center).y, (p2-center).x ),
// the points are in a cw winding iff D<0
// the angular difference between vectors p2-center and p0-center
// measured from p0-center; dang is positive iff D is negative
dang  = D<0  ? ang2<ang0 ? ang2-ang0 : ang2-ang0-360
: ang2>ang0 ? ang2-ang0 : ang2-ang0+360
)
[ for(i=[0:fn-1])
let( ang = ang0 + i
dang/(fn-1) )
center + radius*[cos(ang),sin(ang)] ];
//========  Slut 3points_arc
---=====================

//


---================

//======  Wall som ett "L"
---=======================
// Normal vägghöjd
function wall() =
let(
b =  4,    // botten - tjocklek
f =  8,    // Foten
h = 15,    // Höjd
t =  3.5,  // Top
x = (b+(t/2) - (h - ( (-h / (f-t)) *t) )) / (-h / (f-t))
)
let(
points = [[0,0], [f,0], [t,h], [0,h]] ,
top = move([t/2, h, 0], circle(d=t, $fn=20)),
sqr = square([10, b]),
diff =
difference([
move([x, b], square([t/2, t/2])),
move([x+(t/2), b+(t/2), 0], circle(d = t, $fn=20) ) ])
)
union([points, top, sqr, diff]);
//========  Slut Wall
---============================

//


---================

//======  Wall1 som ett "L"
---======================
// En högre vägg
function wall1() =
let(
b =  4,    // botten - tjocklek
f =  7,    // Foten
h = 25,    // Höjd
t =  3,  // Top
x = (b+(t/2) - (h - ((-h / (f-t)) *t))) / (-h / (f-t))
)
let(
points = [[0,0], [f,0], [t,h], [0,h]] ,
top = move([t/2, h, 0], circle(d=t, $fn=20)),
sqr = square([10, b]),
diff =
difference([
move([x, b], square([t/2, t/2])),
move([x+(t/2), b+(t/2), 0], circle(d = t, $fn=20) ) ])
)
union([points, top, sqr, diff]);
//========  Slut Wall1
---===========================

//


---================

//======  Plåt på släp
---===========================
module mountingPlate(posX=0, posY=0, posZ=0, mountSide="left", colorName="#C0C0C0", $fn=50)
{ // Hörnpositionerna
posX1 = 120;
posY1 = 0;
posX2 = posX1;
posY2 = -200;
posX3 = 120 - 75;
posY3 = -200;
posX4 = 0;
posY4 = 0;
thick=2;  // tjocklek

side = mountSide == "left" ? 0
: mountSide == "right" ? 1
: assert(false,"invalid moutSide value");  // message if no case worked

xpos = mountSide == "left" ? 20
: mountSide == "right" ? -20
: assert(false,"invalid moutSide value");  // message if no case worked
/*
ypos = mountSide == "left" ? 85
: mountSide == "right" ? 85
: assert(false,"invalid moutSide value");  // message if no case worked

zpos = mountSide == "left" ? -thick
: mountSide == "right" ? -thick
: assert(false,"invalid moutSide value");  // message if no case worked
*/
color(colorName)
{  translate([posX, posY, posZ])
translate([xpos, 85, -thick])
{ mirror([side, 0, 0])
{ linear_extrude(thick)
hull()
{ translate([posX1, posY1, 0])
square(0.1, center = true);
translate([posX2, posY2, 0])
square(0.1, center = true);
translate([posX3, posY3, 0])
square(0.1, center = true);
translate([posX4, posY4, 0])
square(0.1, center = true);
}
}
}
}
}

---========

Den tisdag 3 maj 2022 01:49:27 CEST, Father Horton fatherhorton@gmail.com skrev:

Is the OpenSCAD file small enough to share?

On Mon, May 2, 2022 at 5:23 PM Jan Öhman via Discuss discuss@lists.openscad.org wrote:

---------- Forwarded message ----------
From: "Jan Öhman" jan_ohman@yahoo.com
To: OpenSCAD General Discussion discuss@lists.openscad.org
Cc:
Bcc:
Date: Mon, 2 May 2022 22:23:28 +0000 (UTC)
Subject: [OpenSCAD] Export to .stl or .3mf - Error - nothing to export.
Thought to check out what a 3D print from openSCAD would cost.
The company can only handle .stl, .3mf, stp
The openSCAD can export to .stl and .3mf
(I don't know the difference).

When "F5" is pressed - no problems occur.

When I select "File" / "Export" / "Export as STL" (F7)
The following message is displayed .:
"ERROR: Nothing to export! Try rendering first (press F6)"

I press "F6"
The following message is displayed .:
"WARNING: No top level geometry to render"

The same thing happens when I try to export to ".3MF"
Why / What to do?

---------- Forwarded message ----------
From: "Jan Öhman via Discuss" discuss@lists.openscad.org
To: OpenSCAD General Discussion discuss@lists.openscad.org
Cc: "Jan Öhman" jan_ohman@yahoo.com
Bcc:
Date: Mon, 2 May 2022 22:23:28 +0000 (UTC)
Subject: [OpenSCAD] Export to .stl or .3mf - Error - nothing to export.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

---------- Forwarded message ----------
From: "Jan Öhman via Discuss" discuss@lists.openscad.org
To: OpenSCAD general discussion discuss@lists.openscad.org
Cc: "Jan Öhman" jan_ohman@yahoo.com
Bcc:
Date: Tue, 3 May 2022 06:17:02 +0000 (UTC)
Subject: [OpenSCAD] Re: Export to .stl or .3mf - Error - nothing to export.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Actually ignore what I said about flatten() unless you're trying to use the profiles=true option of path_sweep. There's a bug where it doesn't work with regions. On Tue, May 3, 2022 at 6:37 AM Adrian Mariano <avm4@cornell.edu> wrote: > > Your model has a polygon statement which mixes 2d and 3d. After that > is fixed you get a CGAL error, showing that you have invalid geometry. > Your statement > > path_sweep( section, path, closed=false) > > produces invalid geometry---the profiles cross in points4. You can > use path_sweep2d instead, or you need to have a larger radius on that > corner. > > Note also that wall() is producing an extra level of nesting in > output. You might want to run flatten() on section. > > On Tue, May 3, 2022 at 2:14 AM Jan Öhman via Discuss > <discuss@lists.openscad.org> wrote: > > > > > > > > > > ---------- Forwarded message ---------- > > From: "Jan Öhman" <jan_ohman@yahoo.com> > > To: OpenSCAD general discussion <discuss@lists.openscad.org> > > Cc: > > Bcc: > > Date: Tue, 3 May 2022 06:17:02 +0000 (UTC) > > Subject: [OpenSCAD] Re: Export to .stl or .3mf - Error - nothing to export. > > The 3D-product can probably be created in a more efficient way, but this is what this code looks like now. > > > > ======================= > > include <BOSL2/std.scad> > > fn = 150; > > > > placering="left"; > > // placering="right" > > > > box(0, 0, 0, placering, "#C0C0C0", fn); // (X, Y, Z, left/right, colorName) > > > > > > // Monteringsplattan > > // mountingPlate(0, 0, 0, placering); > > > > > > // LED belysning > > // LEDlampa(0, 0, 0, placering); > > > > > > // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > > // - - - - m o d u l e r - - - - - - - - - - - - - - - - - - > > > > > > //================================================================================== > > //====== box ===================================================================== > > module box(posX=0, posY=0, posZ=0, mountSide="left", colorName="#00FF00", fn=24) > > { > > side = mountSide == "left" ? 0 > > : mountSide == "right" ? 1 > > : assert(false,"invalid moutSide value"); // message if no case worked > > > > color(colorName) > > translate([posX, posY, posZ]) > > mirror([side, 0, 0]) > > difference() > > { > > union() > > { > > // Skapa konturer på bottenplattan - x, y, r, angles, [grader], början > > // Rotation medurs - vänster lamphållare (bakant saknas) > > points1 = circSect( 140, 0, 0, [0, 0], "right", 1, fn); // böj nere till höger > > points2 = circSect( 60, 5, 5, [0, 5], "bottom", 1, fn); // brytpunkt längst ned > > points3 = circSect( 10, 13, 10, [0, 90], "bottom", 1, fn); // böj nere till vänster > > points4 = circSect( 5, 80, 5, [0, 90], "left", 1, fn); // böj uppe till vänster > > points5 = circSect( 140, 80, 5, [0, 1], "top", 1, fn); // böj uppe till höger > > edge = concat(points1, points2, points3, points4, points5); > > path = path3d(reverse(edge)); > > section = wall(); > > path_sweep( section, path, closed=false); > > > > > > // Skapa bakkant lite högre och smalare i topp > > bottom1 = concat(points5, points1); > > polygon(bottom1); > > path1 = path3d(reverse(bottom1)); > > section1 = wall1(); // lite högre bakvägg wall(b=4, f=8, h=15, t=3.5) > > path_sweep( section1, path1, closed=false); > > > > // fyll upp bottenplattansbaksida > > linear_extrude(4) // Bottomplate - fill up > > polygon(concat(points1, points2, points3, points4, points5)); > > > > > > // skapa Utskjutande del under (tänk spegelvänt) > > pt1 = circSect( 19.5, 85, 0, [0, 50], "top", 1, fn); // Uppe till höger - moturs > > pt2 = circSect( 39, 1.35, .1, [-5, 90], "right", 1, fn); // Nere till höger > > pt3 = circSect( 10, 13.05, 10, [0, 90], "bottom", 1, fn); // Nere till vänster > > pt4 = circSect( 5, 80, 5, [0, 90], "left", 1, fn); // Uppe till vänster > > translate([0, 0, -2]) > > linear_extrude(2.1) > > polygon(concat(pt1, pt2, pt3, pt4)); > > > > // utgången för kabeln på baksidan (diam 10mm) - pekar lite nedåt > > cableExit(65, 35, 0, 15, "cyan", $fn=100); > > } > > > > // skapa ett borrhål i bakkant > > translate([132,60,15]) > > { rotate([0, 90, 0]) > > { cylinder(h=10, d=2, $fn=100); > > cylinder(h=4, d=9, $fn=100); > > } > > } > > > > // skapa en borrmarkering i bakkant > > translate([139,25,15]) > > { rotate([0, 90, 0]) > > cylinder(h=2, d1=1, d2=2.5, $fn=100); > > } > > > > > > // ingravera årtalet på baksidan > > translate([10, 80, -0.5]) > > { mirror([side, 0, 0]) > > { rotate([0, 180, 0]) > > { linear_extrude(3) > > text("2022", size=12, direction="ttb", font="Comic Sans MS:style=Bold"); > > } > > } > > } > > > > /* > > // Markera skruvhål på bakkant > > borr=3; > > bredd=140; > > hojd=8; > > avstNed=20; > > translate([bredd, avstNed, hojd]) > > { rotate([0,90,0]) > > cylinder(h=2, d1=0.5, d2=borr, center=true, $fn=50); > > } > > */ > > > > // borrhål > > mountingHole(20, 36, 0, 7, 90.1, 15); // posX, posY, posZ, diam, dist, deep, $fn=50 > > > > } > > } > > //======== Slut box ============================================================== > > > > > > //================================================================================== > > //====== cableExit =============================================================== > > module cableExit(posX, posY, posZ, angle, colorName) > > { diamHole = 7; > > diamHolder = 9.8; > > hight = 12; > > topRad = diamHolder/2; > > topDiam = diamHolder/2-topRad/2; > > bowRad = 7; > > offs1 = 0.1; > > > > color(colorName) > > translate([posX, posY, posZ]) > > { rotate([180, 0, 180-angle]) > > { difference() > > { hull() > > { cylinder(h=hight, d=diamHolder, center=false); > > translate([0, 0, hight]) // rundad topp > > rotate_extrude(angle=360, convexity=2) > > translate([topDiam, 0, 0]) // yttre diam topp > > circle(d=topRad); // radie topp > > } > > > > > > inpHight = 2; // ett värde som styr var utgångshålet hamnar > > translate([0, 0, -offs1]) > > cylinder(h=inpHight+offs1, d=diamHole, center=false); // Bottenhål > > > > translate([-bowRad, 0, inpHight-offs1]) // böjen > > { rotate([90, 0, 0]) > > rotate_extrude(angle=90, convexity=10) > > translate([bowRad, 0, 0]) // ställ in radien på kabelböjen > > circle(d=diamHole); > > } > > } > > } > > } > > } > > //====== slut cableExit ========================================================== > > > > > > //================================================================================== > > //====== mountingHole ============================================================ > > module mountingHole(posX=0, posY=0, posZ=0, diam=7, dist=90, deep=5, $fn=50) > > { // diam = 6; // [mm] > > // dist = 90; // [mm] > > // deep = 12; // [mm] > > > > translate([posX, posY, posZ]) > > { translate([0, 0, -10]) > > cylinder(h=deep, d=diam); // fästhål 1 > > > > //cableHold1(dist/2, 0, .2, "#D5D5D5"); // Kabelgenomföring > > translate([dist/2, 0, 0]) > > { hull() > > { cylinder(h=5, d=6); // fästhål 1 > > sphere(d=7.5); > > } > > } > > > > translate([dist, 0, -10]) > > cylinder(h=deep, d=diam); // fästhål 2 > > } > > } > > //====== slut mountingHole ======================================================= > > > > > > //================================================================================== > > //====== LEDlampa ================================================================ > > // module LEDlampa(posX=8, posY=10, posZ=0) > > module LEDlampa(posX=0, posY=0, posZ=0, mountSide="left") > > { side = mountSide == "left" ? 0 > > : mountSide == "right" ? 1 > > : assert(false,"invalid moutSide value"); // message if no case worked > > > > xpos = mountSide == "left" ? 121 > > : mountSide == "right" ? -10 > > : assert(false,"invalid moutSide value"); // message if no case worked > > /* > > ypos = mountSide == "left" ? 10.5 > > : mountSide == "right" ? 10.5 > > : assert(false,"invalid moutSide value"); // message if no case worked > > > > zpos = mountSide == "left" ? 5 > > : mountSide == "right" ? 5 > > : assert(false,"invalid moutSide value"); // message if no case worked > > */ > > // echo(xpos,ypos,zpos); > > // translate([xpos, ypos, zpos]) > > translate([xpos, 10.5, 5]) > > mirror([1, 0, 0]) > > translate([posX, posY, posZ]) > > { LEDbottom(); > > translate([0, 0, 11]) > > LEDglas(); > > } > > } > > //====== Slut LEDlampa =========================================================== > > > > > > //================================================================================== > > //====== LEDglas ================================================================= > > module LEDglas() > > { > > // Variabler botten > > length = 111; // längd mm > > wideMid = 50.5; // bredd i mitten mm > > > > cornRad = 10; // Radien i alla hörn > > wideCorn = 48; // Bredd i kanterna > > > > diamHole = 6; // håldiameter i mm > > > > colorBot = "gray"; > > colorTop = "orange"; > > > > // Variabler top > > cornHigh = 5; //Höjd i ändarna > > midHigh = 8; > > highTop = cornHigh + 1; // höjd mm > > > > p1tx = 10; // the start value > > p1ty = 49.25; > > p2tx = 55.5; // the middle value > > p2ty = 50.5; > > p3tx = 101; // the end value > > p3ty = p1ty; > > > > p4tx = 101; // the start value > > p4ty = 1.25; > > p5tx = 55.5; // the middle value > > p5ty = 0.0; > > p6tx = 10; // the end value > > p6ty = p4ty; > > // Ger ovalt glas > > points1 = 3points_arc([p1tx,p1ty], [p2tx,p2ty], [p3tx,p3ty], fn=100); > > points2 = 3points_arc([p4tx,p4ty], [p5tx,p5ty], [p6tx,p6ty], fn=100); > > > > color("orange") > > linear_extrude(height=cornHigh+.1) > > difference() > > { polygon(concat(points1, points2)); > > > > translate([length-10 , wideMid / 2, -.2]) > > circle(d=6); > > translate([10 , wideMid / 2, -.2]) > > circle(d=6); > > } > > > > // Top > > color(colorTop) > > difference() > > { hull() > > { // hörn1 > > translate([cornRad, wideMid - ((wideMid-wideCorn)/2) - cornRad, 0]) // [10,39] > > cylinder(h=cornHigh, d=cornRad*2, center=false); > > // hörn2 > > translate([cornRad, cornRad + ((wideMid-wideCorn)/2), 0]) // [10,12] > > cylinder(h=cornHigh, d=cornRad*2, center=false); > > // hörn3 > > translate([length - cornRad, wideMid - ((wideMid-wideCorn)/2) - cornRad, 0]) // [101 ,39] > > cylinder(h=cornHigh, d=cornRad*2, center=false); > > // hörn4 > > translate([length - cornRad, cornRad + ((wideMid-wideCorn)/2), 0]) // > > cylinder(h=cornHigh, d=cornRad*2, center=false); > > } > > > > union() > > { // Monteringshål 1 & 2 > > translate([length-10 , wideMid / 2, -.2]) > > cylinder(d=diamHole, h=highTop+.5, center=false); > > translate([10 , wideMid / 2, -.2]) > > cylinder(d=diamHole, h=highTop+.5, center=false); > > } > > } > > } > > //======== Slut LEDglas ========================================================== > > > > > > //================================================================================== > > //====== LEDbottom =============================================================== > > module LEDbottom() > > { p1x = 10; // the start value > > p1y = 49.25; > > p2x = 55.5; // the middle value > > p2y = 50.5; > > p3x = 101; // the end value > > p3y = p1y; > > > > p4x = 101; // the start value > > p4y = 1.25; > > p5x = 55.5; // the middle value > > p5y = 0.0; > > p6x = 10; // the end value > > p6y = p4y; > > > > // Variabler botten för borrhålen > > length = 111; // längd mm > > wideMid = 50.5; // bredd i mitten mm > > diamHole = 6; // håldiameter i mm > > cornHigh = 5; //Höjd i ändarna > > midHigh = 8; > > highTop = cornHigh + 1; // höjd mm > > // offs1 = 0.1; > > heightHole = 15; //mm > > height = 11; //mm > > > > points1 = circSect( 10, 11.25, 10, [0, 90], "bottom", 1, fn); // Hörn nere till vänster > > points2 = circSect( 10, 39.25, 10, [0, 90], "left", 1, fn); // Hörn uppe till vänster > > points3 = 3points_arc([p1x,p1y], [p2x,p2y], [p3x,p3y], fn); > > points4 = circSect( 101, 39.25, 10, [0, 90], "top", 1, fn); // Hörn uppe till höger > > points5 = circSect( 101, 11.25, 10, [0, 90], "right", 1, fn); // Hörn nere till höger > > points6 = 3points_arc([p4x,p4y], [p5x,p5y], [p6x,p6y], fn); > > > > // The base plate for the LED lamp > > > > > > difference() > > { color("gray", 0.5) > > linear_extrude(height=height) > > polygon(concat(points1, points2, points3, points4, points5, points6)); > > > > > > // union() > > { // Monteringshål 1 & 2 > > translate([length-10 , wideMid / 2, -.2]) > > cylinder(d=diamHole, h=heightHole, center=false); > > translate([10 , wideMid / 2, -.2]) > > cylinder(d=diamHole, h=heightHole, center=false); > > } > > } > > } > > //======== Slut LEDbottom ======================================================== > > > > > > > > //================================================================================== > > //====== circleSect ============================================================== > > // Create rounded corners 2D > > // https://openhome.cc/eGossip/OpenSCAD/SectorArc.html > > // ange .: x, y, radien, > > // [från, till] vinkel, > > // var vinkeln startar, (left, bottom, right, top) > > // vilken rotation (-1=medsol, 1=motsols) > > function circSect(x=0, y=0, radius=10, angles=[0,270], startRef="bottom", rotate=1, fn=24) = > > let( > > startAngel = (startRef == "left") ? 0 > > : (startRef == "bottom") ? 90 > > : (startRef == "right") ? 180 > > : (startRef == "top") ? 270 > > : startRef, // valfri vinkel > > // : assert(false,"invalid moutSide value"); // Error message if no case worked > > //: undef, > > r = radius, > > //r = radius / cos(180 / fn), > > step = 360 / fn, > > // points = [[x, y], > > points = [ > > for(a = [angles[0]-startAngel : step : angles[1]-startAngel]) > > [-rotate * r * cos(a)+x, r * sin(a)+y]] > > ) points; > > //======== Slut circleSect ======================================================= > > > > > > //================================================================================== > > //====== 3points_arc ============================================================= > > // Create an arc with three points 2D > > function 3points_arc(p0, p1, p2, fn=10) = > > // an alternative expression for D > > // D = 2 * ( (p1-p0).x * (p2-p0).y - (p1-p0).y * (p2-p0).x ) > > let( D = 2 * cross(p1-p0, (p2-p0)) ) > > assert( abs(D)>1e-9, "The 3 points should not be collinear." ) > > let( > > Ux = ( (p2-p0).y*(p1-p0)*(p1-p0) - (p1-p0).y*(p2-p0)*(p2-p0) )/D, > > Uy = ( (p1-p0).x*(p2-p0)*(p2-p0) - (p2-p0).x*(p1-p0)*(p1-p0) )/D, > > radius = norm([Ux,Uy]), > > center = [Ux,Uy] + p0, > > ang0 = atan2( (p0-center).y, (p0-center).x ), > > ang2 = atan2( (p2-center).y, (p2-center).x ), > > // the points are in a cw winding iff D<0 > > // the angular difference between vectors p2-center and p0-center > > // measured from p0-center; dang is positive iff D is negative > > dang = D<0 ? ang2<ang0 ? ang2-ang0 : ang2-ang0-360 > > : ang2>ang0 ? ang2-ang0 : ang2-ang0+360 > > ) > > [ for(i=[0:fn-1]) > > let( ang = ang0 + i*dang/(fn-1) ) > > center + radius*[cos(ang),sin(ang)] ]; > > //======== Slut 3points_arc ====================================================== > > > > > > //================================================================================== > > //====== Wall som ett "L" ======================================================== > > // Normal vägghöjd > > function wall() = > > let( > > b = 4, // botten - tjocklek > > f = 8, // Foten > > h = 15, // Höjd > > t = 3.5, // Top > > x = (b+(t/2) - (h - ( (-h / (f-t)) *t) )) / (-h / (f-t)) > > ) > > let( > > points = [[0,0], [f,0], [t,h], [0,h]] , > > top = move([t/2, h, 0], circle(d=t, $fn=20)), > > sqr = square([10, b]), > > diff = > > difference([ > > move([x, b], square([t/2, t/2])), > > move([x+(t/2), b+(t/2), 0], circle(d = t, $fn=20) ) ]) > > ) > > union([points, top, sqr, diff]); > > //======== Slut Wall ============================================================= > > > > > > > > //================================================================================== > > //====== Wall1 som ett "L" ======================================================= > > // En högre vägg > > function wall1() = > > let( > > b = 4, // botten - tjocklek > > f = 7, // Foten > > h = 25, // Höjd > > t = 3, // Top > > x = (b+(t/2) - (h - ((-h / (f-t)) *t))) / (-h / (f-t)) > > ) > > let( > > points = [[0,0], [f,0], [t,h], [0,h]] , > > top = move([t/2, h, 0], circle(d=t, $fn=20)), > > sqr = square([10, b]), > > diff = > > difference([ > > move([x, b], square([t/2, t/2])), > > move([x+(t/2), b+(t/2), 0], circle(d = t, $fn=20) ) ]) > > ) > > union([points, top, sqr, diff]); > > //======== Slut Wall1 ============================================================ > > > > > > //================================================================================== > > //====== Plåt på släp ============================================================ > > module mountingPlate(posX=0, posY=0, posZ=0, mountSide="left", colorName="#C0C0C0", $fn=50) > > { // Hörnpositionerna > > posX1 = 120; > > posY1 = 0; > > posX2 = posX1; > > posY2 = -200; > > posX3 = 120 - 75; > > posY3 = -200; > > posX4 = 0; > > posY4 = 0; > > thick=2; // tjocklek > > > > side = mountSide == "left" ? 0 > > : mountSide == "right" ? 1 > > : assert(false,"invalid moutSide value"); // message if no case worked > > > > xpos = mountSide == "left" ? 20 > > : mountSide == "right" ? -20 > > : assert(false,"invalid moutSide value"); // message if no case worked > > /* > > ypos = mountSide == "left" ? 85 > > : mountSide == "right" ? 85 > > : assert(false,"invalid moutSide value"); // message if no case worked > > > > zpos = mountSide == "left" ? -thick > > : mountSide == "right" ? -thick > > : assert(false,"invalid moutSide value"); // message if no case worked > > */ > > color(colorName) > > { translate([posX, posY, posZ]) > > translate([xpos, 85, -thick]) > > { mirror([side, 0, 0]) > > { linear_extrude(thick) > > hull() > > { translate([posX1, posY1, 0]) > > square(0.1, center = true); > > translate([posX2, posY2, 0]) > > square(0.1, center = true); > > translate([posX3, posY3, 0]) > > square(0.1, center = true); > > translate([posX4, posY4, 0]) > > square(0.1, center = true); > > } > > } > > } > > } > > } > > ========================================= > > > > Den tisdag 3 maj 2022 01:49:27 CEST, Father Horton <fatherhorton@gmail.com> skrev: > > > > > > Is the OpenSCAD file small enough to share? > > > > On Mon, May 2, 2022 at 5:23 PM Jan Öhman via Discuss <discuss@lists.openscad.org> wrote: > > > > > > > > > > ---------- Forwarded message ---------- > > From: "Jan Öhman" <jan_ohman@yahoo.com> > > To: OpenSCAD General Discussion <discuss@lists.openscad.org> > > Cc: > > Bcc: > > Date: Mon, 2 May 2022 22:23:28 +0000 (UTC) > > Subject: [OpenSCAD] Export to .stl or .3mf - Error - nothing to export. > > Thought to check out what a 3D print from openSCAD would cost. > > The company can only handle .stl, .3mf, stp > > The openSCAD can export to .stl and .3mf > > (I don't know the difference). > > > > When "F5" is pressed - no problems occur. > > > > When I select "File" / "Export" / "Export as STL" (F7) > > The following message is displayed .: > > "ERROR: Nothing to export! Try rendering first (press F6)" > > > > I press "F6" > > The following message is displayed .: > > "WARNING: No top level geometry to render" > > > > The same thing happens when I try to export to ".3MF" > > Why / What to do? > > > > > > > > > > ---------- Forwarded message ---------- > > From: "Jan Öhman via Discuss" <discuss@lists.openscad.org> > > To: OpenSCAD General Discussion <discuss@lists.openscad.org> > > Cc: "Jan Öhman" <jan_ohman@yahoo.com> > > Bcc: > > Date: Mon, 2 May 2022 22:23:28 +0000 (UTC) > > Subject: [OpenSCAD] Export to .stl or .3mf - Error - nothing to export. > > _______________________________________________ > > OpenSCAD mailing list > > To unsubscribe send an email to discuss-leave@lists.openscad.org > > > > _______________________________________________ > > OpenSCAD mailing list > > To unsubscribe send an email to discuss-leave@lists.openscad.org > > > > > > > > ---------- Forwarded message ---------- > > From: "Jan Öhman via Discuss" <discuss@lists.openscad.org> > > To: OpenSCAD general discussion <discuss@lists.openscad.org> > > Cc: "Jan Öhman" <jan_ohman@yahoo.com> > > Bcc: > > Date: Tue, 3 May 2022 06:17:02 +0000 (UTC) > > Subject: [OpenSCAD] Re: Export to .stl or .3mf - Error - nothing to export. > > _______________________________________________ > > OpenSCAD mailing list > > To unsubscribe send an email to discuss-leave@lists.openscad.org
Jan Öhman
Tue, May 3, 2022 7:19 PM

We start again (did not understand much of the suggestions I received)
"polygon statement which mixes 2d and 3d" - yes
(but I don't know how to solve it on another way)
What can I do?

Den tisdag 3 maj 2022 13:23:19 CEST, Adrian Mariano <avm4@cornell.edu> skrev:  

Actually ignore what I said about flatten() unless you're trying to
use the profiles=true option of path_sweep.  There's a bug where it
doesn't work with regions.

On Tue, May 3, 2022 at 6:37 AM Adrian Mariano avm4@cornell.edu wrote:

Your model has a polygon statement which mixes 2d and 3d.  After that
is fixed you get a CGAL error, showing that you have invalid geometry.
Your statement

path_sweep( section, path, closed=false)

produces invalid geometry---the profiles cross in points4.  You can
use path_sweep2d instead, or you need to have a larger radius on that
corner.

Note also that wall() is producing an extra level of nesting in
output.  You might want to run flatten() on section.

On Tue, May 3, 2022 at 2:14 AM Jan Öhman via Discuss
discuss@lists.openscad.org wrote:

---------- Forwarded message ----------
From: "Jan Öhman" jan_ohman@yahoo.com
To: OpenSCAD general discussion discuss@lists.openscad.org
Cc:
Bcc:
Date: Tue, 3 May 2022 06:17:02 +0000 (UTC)
Subject: [OpenSCAD] Re: Export to .stl or .3mf - Error - nothing to export.
The 3D-product can probably be created in a more efficient way, but this is what this code looks like now.

=======================
include <BOSL2/std.scad>
fn = 150;

placering="left";
// placering="right"

box(0, 0, 0, placering, "#C0C0C0", fn); // (X, Y, Z, left/right, colorName)

// Monteringsplattan
// mountingPlate(0, 0, 0, placering);

// LED belysning
// LEDlampa(0, 0, 0, placering);

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// - - - - m o d u l e r - - - - - - - - - - - - - - - - - -

//

---================
//======  box 

---===
module box(posX=0, posY=0, posZ=0, mountSide="left", colorName="#00FF00", fn=24)
{
  side = mountSide == "left" ? 0
        : mountSide == "right" ? 1
        : assert(false,"invalid moutSide value");  // message if no case worked

  color(colorName)
  translate([posX, posY, posZ])
  mirror([side, 0, 0])
  difference()
  {
  union()
  {
  // Skapa konturer på bottenplattan - x, y, r, angles, [grader], början
  // Rotation medurs - vänster lamphållare (bakant saknas)
  points1 = circSect( 140,  0,  0, [0, 0], "right",  1, fn);  // böj nere till höger
  points2 = circSect(  60,  5,  5, [0, 5], "bottom",  1, fn); // brytpunkt längst ned
  points3 = circSect(  10, 13,  10, [0, 90], "bottom", 1, fn); // böj nere till vänster
  points4 = circSect(  5, 80,  5, [0, 90], "left",  1, fn); // böj uppe till vänster
  points5 = circSect( 140, 80,  5, [0, 1], "top",  1, fn);  // böj uppe till höger
  edge = concat(points1, points2, points3, points4, points5);
  path = path3d(reverse(edge));
  section = wall();
  path_sweep( section, path, closed=false);

  // Skapa bakkant lite högre och smalare i topp
  bottom1 = concat(points5, points1);
  polygon(bottom1);
  path1 = path3d(reverse(bottom1));
  section1 = wall1(); // lite högre bakvägg wall(b=4, f=8, h=15, t=3.5)
  path_sweep( section1, path1, closed=false);

  // fyll upp bottenplattansbaksida
  linear_extrude(4) // Bottomplate - fill up
    polygon(concat(points1, points2, points3, points4, points5));

  // skapa Utskjutande del under (tänk spegelvänt)
  pt1 = circSect(  19.5, 85, 0, [0, 50], "top", 1, fn);  // Uppe till höger - moturs
  pt2 = circSect(  39, 1.35,  .1, [-5, 90], "right", 1, fn);  // Nere till höger
  pt3 = circSect(  10, 13.05,  10, [0, 90], "bottom", 1, fn);  // Nere till vänster
  pt4 = circSect(  5, 80, 5, [0, 90], "left",  1, fn);  // Uppe till vänster
  translate([0, 0, -2])
    linear_extrude(2.1)
      polygon(concat(pt1, pt2, pt3, pt4));

  // utgången för kabeln på baksidan (diam 10mm) - pekar lite nedåt
  cableExit(65, 35, 0, 15, "cyan", $fn=100);
  }

  // skapa ett borrhål i bakkant
  translate([132,60,15])
  { rotate([0, 90, 0])
    { cylinder(h=10, d=2, $fn=100);
      cylinder(h=4, d=9, $fn=100);
    }
  }

  // skapa en borrmarkering i bakkant
  translate([139,25,15])
  { rotate([0, 90, 0])
      cylinder(h=2, d1=1, d2=2.5, $fn=100);
  }

  // ingravera årtalet på baksidan
  translate([10, 80, -0.5])
  { mirror([side, 0, 0])
    { rotate([0, 180, 0])
      { linear_extrude(3)
          text("2022", size=12, direction="ttb", font="Comic Sans MS:style=Bold");
      }
    }
  }

  /*
  // Markera skruvhål på bakkant
  borr=3;
  bredd=140;
  hojd=8;
  avstNed=20;
  translate([bredd, avstNed, hojd])
  { rotate([0,90,0])
      cylinder(h=2, d1=0.5, d2=borr, center=true, $fn=50);
  }
  */

  // borrhål
  mountingHole(20, 36, 0, 7, 90.1, 15); // posX, posY, posZ, diam, dist, deep, $fn=50

  }
}
//========  Slut box 
---=============================

//

---================
//======  cableExit 
---==============================
module cableExit(posX, posY, posZ, angle, colorName)
{ diamHole = 7;
  diamHolder = 9.8;
  hight = 12;
  topRad = diamHolder/2;
  topDiam = diamHolder/2-topRad/2;
  bowRad = 7;
  offs1 = 0.1;

  color(colorName)
  translate([posX, posY, posZ])
  {  rotate([180, 0, 180-angle])
    { difference()
      { hull()
        { cylinder(h=hight, d=diamHolder, center=false);
          translate([0, 0, hight])        // rundad topp
            rotate_extrude(angle=360, convexity=2)
              translate([topDiam, 0, 0])  // yttre diam topp
                circle(d=topRad);        // radie topp
        }

        inpHight  =  2;  // ett värde som styr var utgångshålet hamnar
        translate([0, 0, -offs1])
          cylinder(h=inpHight+offs1, d=diamHole, center=false); // Bottenhål

        translate([-bowRad, 0, inpHight-offs1]) // böjen
        { rotate([90, 0, 0])
            rotate_extrude(angle=90, convexity=10)
              translate([bowRad, 0, 0]) // ställ in radien på kabelböjen
                circle(d=diamHole);
        }
      }
    }
  }
}
//======  slut cableExit 
---=========================

//

---================
//======  mountingHole 
---===========================
module mountingHole(posX=0, posY=0, posZ=0, diam=7, dist=90, deep=5, $fn=50)
{ // diam =  6;  // [mm]
  // dist = 90;  // [mm]
  // deep =  12;  // [mm]

  translate([posX, posY, posZ])
  { translate([0, 0, -10])
      cylinder(h=deep, d=diam);  // fästhål 1

    //cableHold1(dist/2, 0, .2, "#D5D5D5");  // Kabelgenomföring
    translate([dist/2, 0, 0])
    {  hull()
      { cylinder(h=5, d=6);  // fästhål 1
        sphere(d=7.5);
      }
    }

    translate([dist, 0, -10])
      cylinder(h=deep, d=diam); // fästhål 2
  }
}
//======  slut mountingHole 
---======================

//

---================
//======  LEDlampa 
---===============================
// module LEDlampa(posX=8, posY=10, posZ=0)
module LEDlampa(posX=0, posY=0, posZ=0, mountSide="left")
{ side = mountSide == "left" ? 0
        : mountSide == "right" ? 1
        : assert(false,"invalid moutSide value");  // message if no case worked

  xpos = mountSide == "left" ? 121
        : mountSide == "right" ? -10
        : assert(false,"invalid moutSide value");  // message if no case worked
  /*
  ypos = mountSide == "left" ? 10.5
        : mountSide == "right" ? 10.5
        : assert(false,"invalid moutSide value");  // message if no case worked

  zpos = mountSide == "left" ? 5
        : mountSide == "right" ? 5
        : assert(false,"invalid moutSide value");  // message if no case worked
*/
// echo(xpos,ypos,zpos);
  // translate([xpos, ypos, zpos])
  translate([xpos, 10.5, 5])
  mirror([1, 0, 0])
  translate([posX, posY, posZ])
  { LEDbottom();
      translate([0, 0, 11])
        LEDglas();
  }
}
//======  Slut LEDlampa 
---==========================

//

---================
//======  LEDglas 
---================================
module LEDglas()
{
  // Variabler botten
  length  = 111;  // längd mm
  wideMid = 50.5;  // bredd i mitten mm

  cornRad = 10;    // Radien i alla hörn
  wideCorn = 48;  // Bredd i kanterna

  diamHole = 6;    // håldiameter i mm

  colorBot = "gray";
  colorTop = "orange";

  // Variabler top
  cornHigh = 5;  //Höjd i ändarna
  midHigh  = 8;
  highTop = cornHigh + 1;  // höjd mm

  p1tx = 10;      // the start value
  p1ty = 49.25;
  p2tx = 55.5;    // the middle value
  p2ty = 50.5;
  p3tx = 101;    // the end value
  p3ty = p1ty;

  p4tx = 101;    // the start value
  p4ty = 1.25;
  p5tx = 55.5;    // the middle value
  p5ty = 0.0;
  p6tx = 10;      // the end value
  p6ty = p4ty;
  // Ger ovalt glas
  points1 = 3points_arc([p1tx,p1ty], [p2tx,p2ty], [p3tx,p3ty], fn=100);
  points2 = 3points_arc([p4tx,p4ty], [p5tx,p5ty], [p6tx,p6ty], fn=100);

  color("orange")
  linear_extrude(height=cornHigh+.1)
  difference()
  { polygon(concat(points1, points2));

    translate([length-10 , wideMid / 2, -.2])
      circle(d=6);
    translate([10 , wideMid / 2, -.2])
      circle(d=6);
  }

  // Top
  color(colorTop)
  difference()
  { hull()
    { // hörn1
      translate([cornRad, wideMid - ((wideMid-wideCorn)/2) - cornRad, 0]) // [10,39]
        cylinder(h=cornHigh, d=cornRad2, center=false);
      // hörn2
      translate([cornRad, cornRad + ((wideMid-wideCorn)/2), 0])          // [10,12]
        cylinder(h=cornHigh, d=cornRad
2, center=false);
      // hörn3
      translate([length - cornRad, wideMid - ((wideMid-wideCorn)/2) - cornRad, 0]) // [101 ,39]
        cylinder(h=cornHigh, d=cornRad2, center=false);
      // hörn4
      translate([length - cornRad, cornRad + ((wideMid-wideCorn)/2), 0])  //
        cylinder(h=cornHigh, d=cornRad
2, center=false);
    }

    union()
    { // Monteringshål 1 & 2
      translate([length-10 , wideMid / 2, -.2])
        cylinder(d=diamHole, h=highTop+.5, center=false);
      translate([10 , wideMid / 2, -.2])
        cylinder(d=diamHole, h=highTop+.5, center=false);
    }
  }
}
//========  Slut LEDglas 
---=========================

//

---================
//======  LEDbottom 
---==============================
module LEDbottom()
{ p1x = 10;      // the start value
  p1y = 49.25;
  p2x = 55.5;    // the middle value
  p2y = 50.5;
  p3x = 101;    // the end value
  p3y = p1y;

  p4x = 101;    // the start value
  p4y = 1.25;
  p5x = 55.5;    // the middle value
  p5y = 0.0;
  p6x = 10;      // the end value
  p6y = p4y;

  // Variabler botten för borrhålen
  length  = 111;  // längd mm
  wideMid = 50.5;  // bredd i mitten mm
  diamHole = 6;    // håldiameter i mm
  cornHigh = 5;  //Höjd i ändarna
  midHigh  = 8;
  highTop = cornHigh + 1;  // höjd mm
  // offs1 = 0.1;
  heightHole = 15; //mm
  height = 11; //mm

  points1 = circSect(  10, 11.25,  10, [0, 90], "bottom", 1, fn); // Hörn nere till vänster
  points2 = circSect(  10, 39.25,  10, [0, 90], "left",  1, fn); // Hörn uppe till vänster
  points3 = 3points_arc([p1x,p1y], [p2x,p2y], [p3x,p3y], fn);
  points4 = circSect( 101, 39.25,  10, [0, 90], "top",    1, fn); // Hörn uppe till höger
  points5 = circSect( 101, 11.25,  10, [0, 90], "right",  1, fn); // Hörn nere till höger
  points6 = 3points_arc([p4x,p4y], [p5x,p5y], [p6x,p6y], fn);

  // The base plate for the LED lamp

  difference()
  { color("gray", 0.5)
    linear_extrude(height=height)
      polygon(concat(points1, points2, points3, points4, points5, points6));

    // union()
    { // Monteringshål 1 & 2
      translate([length-10 , wideMid / 2, -.2])
        cylinder(d=diamHole, h=heightHole, center=false);
      translate([10 , wideMid / 2, -.2])
        cylinder(d=diamHole, h=heightHole, center=false);
    }
  }
}
//========  Slut LEDbottom 
---=======================

//

---================
//======  circleSect 
---=============================
// Create rounded corners 2D
// https://openhome.cc/eGossip/OpenSCAD/SectorArc.html
// ange .:  x, y, radien,
//          [från, till] vinkel,
//          var vinkeln startar, (left, bottom, right, top)
//          vilken rotation (-1=medsol, 1=motsols)
function circSect(x=0, y=0, radius=10, angles=[0,270], startRef="bottom", rotate=1, fn=24)  =
    let(
        startAngel  = (startRef == "left")  ?  0
                    : (startRef == "bottom") ?  90
                    : (startRef == "right")  ? 180
                    : (startRef == "top")    ? 270
                    : startRef,  // valfri vinkel
                  // : assert(false,"invalid moutSide value");  // Error message if no case worked
                  //: undef,
        r = radius,
        //r = radius / cos(180 / fn),
        step = 360 / fn,
        // points = [[x, y],
        points = [
            for(a = [angles[0]-startAngel : step : angles[1]-startAngel])
                [-rotate * r * cos(a)+x, r * sin(a)+y]]
    ) points;
//========  Slut circleSect 
---======================

//

---================
//======  3points_arc 
---============================
// Create an arc with three points 2D
function 3points_arc(p0, p1, p2, fn=10) =
  // an alternative expression for D
  // D  = 2 * ( (p1-p0).x * (p2-p0).y - (p1-p0).y * (p2-p0).x )
  let( D  = 2 * cross(p1-p0, (p2-p0)) )
  assert( abs(D)>1e-9, "The 3 points should not be collinear." )
  let(
      Ux    = ( (p2-p0).y*(p1-p0)(p1-p0) - (p1-p0).y(p2-p0)(p2-p0) )/D,
      Uy    = ( (p1-p0).x
(p2-p0)(p2-p0) - (p2-p0).x(p1-p0)(p1-p0) )/D,
      radius = norm([Ux,Uy]),
      center = [Ux,Uy] + p0,
      ang0  = atan2( (p0-center).y, (p0-center).x ),
      ang2  = atan2( (p2-center).y, (p2-center).x ),
      // the points are in a cw winding iff D<0
      // the angular difference between vectors p2-center and p0-center
      // measured from p0-center; dang is positive iff D is negative
      dang  = D<0  ? ang2<ang0 ? ang2-ang0 : ang2-ang0-360
                    : ang2>ang0 ? ang2-ang0 : ang2-ang0+360
  )
  [ for(i=[0:fn-1])
      let( ang = ang0 + i
dang/(fn-1) )
      center + radius*[cos(ang),sin(ang)] ];
//========  Slut 3points_arc 
---=====================

//

---================
//======  Wall som ett "L" 
---=======================
// Normal vägghöjd
function wall() =
  let(
        b =  4,    // botten - tjocklek
        f =  8,    // Foten
        h = 15,    // Höjd
        t =  3.5,  // Top
        x = (b+(t/2) - (h - ( (-h / (f-t)) *t) )) / (-h / (f-t))
    )
    let(
        points = [[0,0], [f,0], [t,h], [0,h]] ,
        top = move([t/2, h, 0], circle(d=t, $fn=20)),
        sqr = square([10, b]),
        diff =
            difference([
                  move([x, b], square([t/2, t/2])),
                  move([x+(t/2), b+(t/2), 0], circle(d = t, $fn=20) ) ])
        )
    union([points, top, sqr, diff]);
//========  Slut Wall 
---============================

//

---================
//======  Wall1 som ett "L" 
---======================
// En högre vägg
function wall1() =
  let(
    b =  4,    // botten - tjocklek
    f =  7,    // Foten
    h = 25,    // Höjd
    t =  3,  // Top
    x = (b+(t/2) - (h - ((-h / (f-t)) *t))) / (-h / (f-t))
  )
  let(
    points = [[0,0], [f,0], [t,h], [0,h]] ,
    top = move([t/2, h, 0], circle(d=t, $fn=20)),
    sqr = square([10, b]),
    diff =
      difference([
        move([x, b], square([t/2, t/2])),
        move([x+(t/2), b+(t/2), 0], circle(d = t, $fn=20) ) ])
    )
    union([points, top, sqr, diff]);
//========  Slut Wall1 
---===========================

//

---================
//======  Plåt på släp 
---===========================
module mountingPlate(posX=0, posY=0, posZ=0, mountSide="left", colorName="#C0C0C0", $fn=50)
{ // Hörnpositionerna
  posX1 = 120;
  posY1 = 0;
  posX2 = posX1;
  posY2 = -200;
  posX3 = 120 - 75;
  posY3 = -200;
  posX4 = 0;
  posY4 = 0;
  thick=2;  // tjocklek

  side = mountSide == "left" ? 0
        : mountSide == "right" ? 1
        : assert(false,"invalid moutSide value");  // message if no case worked

  xpos = mountSide == "left" ? 20
        : mountSide == "right" ? -20
        : assert(false,"invalid moutSide value");  // message if no case worked
/*
  ypos = mountSide == "left" ? 85
        : mountSide == "right" ? 85
        : assert(false,"invalid moutSide value");  // message if no case worked

  zpos = mountSide == "left" ? -thick
        : mountSide == "right" ? -thick
        : assert(false,"invalid moutSide value");  // message if no case worked
*/
  color(colorName)
  {  translate([posX, posY, posZ])
      translate([xpos, 85, -thick])
    { mirror([side, 0, 0])
      { linear_extrude(thick)
        hull()
        { translate([posX1, posY1, 0])
            square(0.1, center = true);
          translate([posX2, posY2, 0])
            square(0.1, center = true);
          translate([posX3, posY3, 0])
            square(0.1, center = true);
          translate([posX4, posY4, 0])
            square(0.1, center = true);
        }
      }
    }
  }
}

---========

Den tisdag 3 maj 2022 01:49:27 CEST, Father Horton fatherhorton@gmail.com skrev:

Is the OpenSCAD file small enough to share?

On Mon, May 2, 2022 at 5:23 PM Jan Öhman via Discuss discuss@lists.openscad.org wrote:

---------- Forwarded message ----------
From: "Jan Öhman" jan_ohman@yahoo.com
To: OpenSCAD General Discussion discuss@lists.openscad.org
Cc:
Bcc:
Date: Mon, 2 May 2022 22:23:28 +0000 (UTC)
Subject: [OpenSCAD] Export to .stl or .3mf - Error - nothing to export.
Thought to check out what a 3D print from openSCAD would cost.
The company can only handle .stl, .3mf, stp
The openSCAD can export to .stl and .3mf
(I don't know the difference).

When "F5" is pressed - no problems occur.

When I select "File" / "Export" / "Export as STL" (F7)
The following message is displayed .:
"ERROR: Nothing to export! Try rendering first (press F6)"

I press "F6"
The following message is displayed .:
"WARNING: No top level geometry to render"

The same thing happens when I try to export to ".3MF"
Why / What to do?

---------- Forwarded message ----------
From: "Jan Öhman via Discuss" discuss@lists.openscad.org
To: OpenSCAD General Discussion discuss@lists.openscad.org
Cc: "Jan Öhman" jan_ohman@yahoo.com
Bcc:
Date: Mon, 2 May 2022 22:23:28 +0000 (UTC)
Subject: [OpenSCAD] Export to .stl or .3mf - Error - nothing to export.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

---------- Forwarded message ----------
From: "Jan Öhman via Discuss" discuss@lists.openscad.org
To: OpenSCAD general discussion discuss@lists.openscad.org
Cc: "Jan Öhman" jan_ohman@yahoo.com
Bcc:
Date: Tue, 3 May 2022 06:17:02 +0000 (UTC)
Subject: [OpenSCAD] Re: Export to .stl or .3mf - Error - nothing to export.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

We start again (did not understand much of the suggestions I received) "polygon statement which mixes 2d and 3d" - yes (but I don't know how to solve it on another way) What can I do? Den tisdag 3 maj 2022 13:23:19 CEST, Adrian Mariano <avm4@cornell.edu> skrev: Actually ignore what I said about flatten() unless you're trying to use the profiles=true option of path_sweep.  There's a bug where it doesn't work with regions. On Tue, May 3, 2022 at 6:37 AM Adrian Mariano <avm4@cornell.edu> wrote: > > Your model has a polygon statement which mixes 2d and 3d.  After that > is fixed you get a CGAL error, showing that you have invalid geometry. > Your statement > > path_sweep( section, path, closed=false) > > produces invalid geometry---the profiles cross in points4.  You can > use path_sweep2d instead, or you need to have a larger radius on that > corner. > > Note also that wall() is producing an extra level of nesting in > output.  You might want to run flatten() on section. > > On Tue, May 3, 2022 at 2:14 AM Jan Öhman via Discuss > <discuss@lists.openscad.org> wrote: > > > > > > > > > > ---------- Forwarded message ---------- > > From: "Jan Öhman" <jan_ohman@yahoo.com> > > To: OpenSCAD general discussion <discuss@lists.openscad.org> > > Cc: > > Bcc: > > Date: Tue, 3 May 2022 06:17:02 +0000 (UTC) > > Subject: [OpenSCAD] Re: Export to .stl or .3mf - Error - nothing to export. > > The 3D-product can probably be created in a more efficient way, but this is what this code looks like now. > > > > ======================= > > include <BOSL2/std.scad> > > fn = 150; > > > > placering="left"; > > // placering="right" > > > > box(0, 0, 0, placering, "#C0C0C0", fn); // (X, Y, Z, left/right, colorName) > > > > > > // Monteringsplattan > > // mountingPlate(0, 0, 0, placering); > > > > > > // LED belysning > > // LEDlampa(0, 0, 0, placering); > > > > > > // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > > // - - - - m o d u l e r - - - - - - - - - - - - - - - - - - > > > > > > //================================================================================== > > //======  box  ===================================================================== > > module box(posX=0, posY=0, posZ=0, mountSide="left", colorName="#00FF00", fn=24) > > { > >  side = mountSide == "left" ? 0 > >        : mountSide == "right" ? 1 > >        : assert(false,"invalid moutSide value");  // message if no case worked > > > >  color(colorName) > >  translate([posX, posY, posZ]) > >  mirror([side, 0, 0]) > >  difference() > >  { > >  union() > >  { > >  // Skapa konturer på bottenplattan - x, y, r, angles, [grader], början > >  // Rotation medurs - vänster lamphållare (bakant saknas) > >  points1 = circSect( 140,  0,  0, [0, 0], "right",  1, fn);  // böj nere till höger > >  points2 = circSect(  60,  5,  5, [0, 5], "bottom",  1, fn); // brytpunkt längst ned > >  points3 = circSect(  10, 13,  10, [0, 90], "bottom", 1, fn); // böj nere till vänster > >  points4 = circSect(  5, 80,  5, [0, 90], "left",  1, fn); // böj uppe till vänster > >  points5 = circSect( 140, 80,  5, [0, 1], "top",  1, fn);  // böj uppe till höger > >  edge = concat(points1, points2, points3, points4, points5); > >  path = path3d(reverse(edge)); > >  section = wall(); > >  path_sweep( section, path, closed=false); > > > > > >  // Skapa bakkant lite högre och smalare i topp > >  bottom1 = concat(points5, points1); > >  polygon(bottom1); > >  path1 = path3d(reverse(bottom1)); > >  section1 = wall1(); // lite högre bakvägg wall(b=4, f=8, h=15, t=3.5) > >  path_sweep( section1, path1, closed=false); > > > >  // fyll upp bottenplattansbaksida > >  linear_extrude(4) // Bottomplate - fill up > >    polygon(concat(points1, points2, points3, points4, points5)); > > > > > >  // skapa Utskjutande del under (tänk spegelvänt) > >  pt1 = circSect(  19.5, 85, 0, [0, 50], "top", 1, fn);  // Uppe till höger - moturs > >  pt2 = circSect(  39, 1.35,  .1, [-5, 90], "right", 1, fn);  // Nere till höger > >  pt3 = circSect(  10, 13.05,  10, [0, 90], "bottom", 1, fn);  // Nere till vänster > >  pt4 = circSect(  5, 80, 5, [0, 90], "left",  1, fn);  // Uppe till vänster > >  translate([0, 0, -2]) > >    linear_extrude(2.1) > >      polygon(concat(pt1, pt2, pt3, pt4)); > > > >  // utgången för kabeln på baksidan (diam 10mm) - pekar lite nedåt > >  cableExit(65, 35, 0, 15, "cyan", $fn=100); > >  } > > > >  // skapa ett borrhål i bakkant > >  translate([132,60,15]) > >  { rotate([0, 90, 0]) > >    { cylinder(h=10, d=2, $fn=100); > >      cylinder(h=4, d=9, $fn=100); > >    } > >  } > > > >  // skapa en borrmarkering i bakkant > >  translate([139,25,15]) > >  { rotate([0, 90, 0]) > >      cylinder(h=2, d1=1, d2=2.5, $fn=100); > >  } > > > > > >  // ingravera årtalet på baksidan > >  translate([10, 80, -0.5]) > >  { mirror([side, 0, 0]) > >    { rotate([0, 180, 0]) > >      { linear_extrude(3) > >          text("2022", size=12, direction="ttb", font="Comic Sans MS:style=Bold"); > >      } > >    } > >  } > > > >  /* > >  // Markera skruvhål på bakkant > >  borr=3; > >  bredd=140; > >  hojd=8; > >  avstNed=20; > >  translate([bredd, avstNed, hojd]) > >  { rotate([0,90,0]) > >      cylinder(h=2, d1=0.5, d2=borr, center=true, $fn=50); > >  } > >  */ > > > >  // borrhål > >  mountingHole(20, 36, 0, 7, 90.1, 15); // posX, posY, posZ, diam, dist, deep, $fn=50 > > > >  } > > } > > //========  Slut box  ============================================================== > > > > > > //================================================================================== > > //======  cableExit  =============================================================== > > module cableExit(posX, posY, posZ, angle, colorName) > > { diamHole = 7; > >  diamHolder = 9.8; > >  hight = 12; > >  topRad = diamHolder/2; > >  topDiam = diamHolder/2-topRad/2; > >  bowRad = 7; > >  offs1 = 0.1; > > > >  color(colorName) > >  translate([posX, posY, posZ]) > >  {  rotate([180, 0, 180-angle]) > >    { difference() > >      { hull() > >        { cylinder(h=hight, d=diamHolder, center=false); > >          translate([0, 0, hight])        // rundad topp > >            rotate_extrude(angle=360, convexity=2) > >              translate([topDiam, 0, 0])  // yttre diam topp > >                circle(d=topRad);        // radie topp > >        } > > > > > >        inpHight  =  2;  // ett värde som styr var utgångshålet hamnar > >        translate([0, 0, -offs1]) > >          cylinder(h=inpHight+offs1, d=diamHole, center=false); // Bottenhål > > > >        translate([-bowRad, 0, inpHight-offs1]) // böjen > >        { rotate([90, 0, 0]) > >            rotate_extrude(angle=90, convexity=10) > >              translate([bowRad, 0, 0]) // ställ in radien på kabelböjen > >                circle(d=diamHole); > >        } > >      } > >    } > >  } > > } > > //======  slut cableExit  ========================================================== > > > > > > //================================================================================== > > //======  mountingHole  ============================================================ > > module mountingHole(posX=0, posY=0, posZ=0, diam=7, dist=90, deep=5, $fn=50) > > { // diam =  6;  // [mm] > >  // dist = 90;  // [mm] > >  // deep =  12;  // [mm] > > > >  translate([posX, posY, posZ]) > >  { translate([0, 0, -10]) > >      cylinder(h=deep, d=diam);  // fästhål 1 > > > >    //cableHold1(dist/2, 0, .2, "#D5D5D5");  // Kabelgenomföring > >    translate([dist/2, 0, 0]) > >    {  hull() > >      { cylinder(h=5, d=6);  // fästhål 1 > >        sphere(d=7.5); > >      } > >    } > > > >    translate([dist, 0, -10]) > >      cylinder(h=deep, d=diam); // fästhål 2 > >  } > > } > > //======  slut mountingHole  ======================================================= > > > > > > //================================================================================== > > //======  LEDlampa  ================================================================ > > // module LEDlampa(posX=8, posY=10, posZ=0) > > module LEDlampa(posX=0, posY=0, posZ=0, mountSide="left") > > { side = mountSide == "left" ? 0 > >        : mountSide == "right" ? 1 > >        : assert(false,"invalid moutSide value");  // message if no case worked > > > >  xpos = mountSide == "left" ? 121 > >        : mountSide == "right" ? -10 > >        : assert(false,"invalid moutSide value");  // message if no case worked > >  /* > >  ypos = mountSide == "left" ? 10.5 > >        : mountSide == "right" ? 10.5 > >        : assert(false,"invalid moutSide value");  // message if no case worked > > > >  zpos = mountSide == "left" ? 5 > >        : mountSide == "right" ? 5 > >        : assert(false,"invalid moutSide value");  // message if no case worked > > */ > > // echo(xpos,ypos,zpos); > >  // translate([xpos, ypos, zpos]) > >  translate([xpos, 10.5, 5]) > >  mirror([1, 0, 0]) > >  translate([posX, posY, posZ]) > >  { LEDbottom(); > >      translate([0, 0, 11]) > >        LEDglas(); > >  } > > } > > //======  Slut LEDlampa  =========================================================== > > > > > > //================================================================================== > > //======  LEDglas  ================================================================= > > module LEDglas() > > { > >  // Variabler botten > >  length  = 111;  // längd mm > >  wideMid = 50.5;  // bredd i mitten mm > > > >  cornRad = 10;    // Radien i alla hörn > >  wideCorn = 48;  // Bredd i kanterna > > > >  diamHole = 6;    // håldiameter i mm > > > >  colorBot = "gray"; > >  colorTop = "orange"; > > > >  // Variabler top > >  cornHigh = 5;  //Höjd i ändarna > >  midHigh  = 8; > >  highTop = cornHigh + 1;  // höjd mm > > > >  p1tx = 10;      // the start value > >  p1ty = 49.25; > >  p2tx = 55.5;    // the middle value > >  p2ty = 50.5; > >  p3tx = 101;    // the end value > >  p3ty = p1ty; > > > >  p4tx = 101;    // the start value > >  p4ty = 1.25; > >  p5tx = 55.5;    // the middle value > >  p5ty = 0.0; > >  p6tx = 10;      // the end value > >  p6ty = p4ty; > >  // Ger ovalt glas > >  points1 = 3points_arc([p1tx,p1ty], [p2tx,p2ty], [p3tx,p3ty], fn=100); > >  points2 = 3points_arc([p4tx,p4ty], [p5tx,p5ty], [p6tx,p6ty], fn=100); > > > >  color("orange") > >  linear_extrude(height=cornHigh+.1) > >  difference() > >  { polygon(concat(points1, points2)); > > > >    translate([length-10 , wideMid / 2, -.2]) > >      circle(d=6); > >    translate([10 , wideMid / 2, -.2]) > >      circle(d=6); > >  } > > > >  // Top > >  color(colorTop) > >  difference() > >  { hull() > >    { // hörn1 > >      translate([cornRad, wideMid - ((wideMid-wideCorn)/2) - cornRad, 0]) // [10,39] > >        cylinder(h=cornHigh, d=cornRad*2, center=false); > >      // hörn2 > >      translate([cornRad, cornRad + ((wideMid-wideCorn)/2), 0])          // [10,12] > >        cylinder(h=cornHigh, d=cornRad*2, center=false); > >      // hörn3 > >      translate([length - cornRad, wideMid - ((wideMid-wideCorn)/2) - cornRad, 0]) // [101 ,39] > >        cylinder(h=cornHigh, d=cornRad*2, center=false); > >      // hörn4 > >      translate([length - cornRad, cornRad + ((wideMid-wideCorn)/2), 0])  // > >        cylinder(h=cornHigh, d=cornRad*2, center=false); > >    } > > > >    union() > >    { // Monteringshål 1 & 2 > >      translate([length-10 , wideMid / 2, -.2]) > >        cylinder(d=diamHole, h=highTop+.5, center=false); > >      translate([10 , wideMid / 2, -.2]) > >        cylinder(d=diamHole, h=highTop+.5, center=false); > >    } > >  } > > } > > //========  Slut LEDglas  ========================================================== > > > > > > //================================================================================== > > //======  LEDbottom  =============================================================== > > module LEDbottom() > > { p1x = 10;      // the start value > >  p1y = 49.25; > >  p2x = 55.5;    // the middle value > >  p2y = 50.5; > >  p3x = 101;    // the end value > >  p3y = p1y; > > > >  p4x = 101;    // the start value > >  p4y = 1.25; > >  p5x = 55.5;    // the middle value > >  p5y = 0.0; > >  p6x = 10;      // the end value > >  p6y = p4y; > > > >  // Variabler botten för borrhålen > >  length  = 111;  // längd mm > >  wideMid = 50.5;  // bredd i mitten mm > >  diamHole = 6;    // håldiameter i mm > >  cornHigh = 5;  //Höjd i ändarna > >  midHigh  = 8; > >  highTop = cornHigh + 1;  // höjd mm > >  // offs1 = 0.1; > >  heightHole = 15; //mm > >  height = 11; //mm > > > >  points1 = circSect(  10, 11.25,  10, [0, 90], "bottom", 1, fn); // Hörn nere till vänster > >  points2 = circSect(  10, 39.25,  10, [0, 90], "left",  1, fn); // Hörn uppe till vänster > >  points3 = 3points_arc([p1x,p1y], [p2x,p2y], [p3x,p3y], fn); > >  points4 = circSect( 101, 39.25,  10, [0, 90], "top",    1, fn); // Hörn uppe till höger > >  points5 = circSect( 101, 11.25,  10, [0, 90], "right",  1, fn); // Hörn nere till höger > >  points6 = 3points_arc([p4x,p4y], [p5x,p5y], [p6x,p6y], fn); > > > >  // The base plate for the LED lamp > > > > > >  difference() > >  { color("gray", 0.5) > >    linear_extrude(height=height) > >      polygon(concat(points1, points2, points3, points4, points5, points6)); > > > > > >    // union() > >    { // Monteringshål 1 & 2 > >      translate([length-10 , wideMid / 2, -.2]) > >        cylinder(d=diamHole, h=heightHole, center=false); > >      translate([10 , wideMid / 2, -.2]) > >        cylinder(d=diamHole, h=heightHole, center=false); > >    } > >  } > > } > > //========  Slut LEDbottom  ======================================================== > > > > > > > > //================================================================================== > > //======  circleSect  ============================================================== > > // Create rounded corners 2D > > // https://openhome.cc/eGossip/OpenSCAD/SectorArc.html > > // ange .:  x, y, radien, > > //          [från, till] vinkel, > > //          var vinkeln startar, (left, bottom, right, top) > > //          vilken rotation (-1=medsol, 1=motsols) > > function circSect(x=0, y=0, radius=10, angles=[0,270], startRef="bottom", rotate=1, fn=24)  = > >    let( > >        startAngel  = (startRef == "left")  ?  0 > >                    : (startRef == "bottom") ?  90 > >                    : (startRef == "right")  ? 180 > >                    : (startRef == "top")    ? 270 > >                    : startRef,  // valfri vinkel > >                  // : assert(false,"invalid moutSide value");  // Error message if no case worked > >                  //: undef, > >        r = radius, > >        //r = radius / cos(180 / fn), > >        step = 360 / fn, > >        // points = [[x, y], > >        points = [ > >            for(a = [angles[0]-startAngel : step : angles[1]-startAngel]) > >                [-rotate * r * cos(a)+x, r * sin(a)+y]] > >    ) points; > > //========  Slut circleSect  ======================================================= > > > > > > //================================================================================== > > //======  3points_arc  ============================================================= > > // Create an arc with three points 2D > > function 3points_arc(p0, p1, p2, fn=10) = > >  // an alternative expression for D > >  // D  = 2 * ( (p1-p0).x * (p2-p0).y - (p1-p0).y * (p2-p0).x ) > >  let( D  = 2 * cross(p1-p0, (p2-p0)) ) > >  assert( abs(D)>1e-9, "The 3 points should not be collinear." ) > >  let( > >      Ux    = ( (p2-p0).y*(p1-p0)*(p1-p0) - (p1-p0).y*(p2-p0)*(p2-p0) )/D, > >      Uy    = ( (p1-p0).x*(p2-p0)*(p2-p0) - (p2-p0).x*(p1-p0)*(p1-p0) )/D, > >      radius = norm([Ux,Uy]), > >      center = [Ux,Uy] + p0, > >      ang0  = atan2( (p0-center).y, (p0-center).x ), > >      ang2  = atan2( (p2-center).y, (p2-center).x ), > >      // the points are in a cw winding iff D<0 > >      // the angular difference between vectors p2-center and p0-center > >      // measured from p0-center; dang is positive iff D is negative > >      dang  = D<0  ? ang2<ang0 ? ang2-ang0 : ang2-ang0-360 > >                    : ang2>ang0 ? ang2-ang0 : ang2-ang0+360 > >  ) > >  [ for(i=[0:fn-1]) > >      let( ang = ang0 + i*dang/(fn-1) ) > >      center + radius*[cos(ang),sin(ang)] ]; > > //========  Slut 3points_arc  ====================================================== > > > > > > //================================================================================== > > //======  Wall som ett "L"  ======================================================== > > // Normal vägghöjd > > function wall() = > >  let( > >        b =  4,    // botten - tjocklek > >        f =  8,    // Foten > >        h = 15,    // Höjd > >        t =  3.5,  // Top > >        x = (b+(t/2) - (h - ( (-h / (f-t)) *t) )) / (-h / (f-t)) > >    ) > >    let( > >        points = [[0,0], [f,0], [t,h], [0,h]] , > >        top = move([t/2, h, 0], circle(d=t, $fn=20)), > >        sqr = square([10, b]), > >        diff = > >            difference([ > >                  move([x, b], square([t/2, t/2])), > >                  move([x+(t/2), b+(t/2), 0], circle(d = t, $fn=20) ) ]) > >        ) > >    union([points, top, sqr, diff]); > > //========  Slut Wall  ============================================================= > > > > > > > > //================================================================================== > > //======  Wall1 som ett "L"  ======================================================= > > // En högre vägg > > function wall1() = > >  let( > >    b =  4,    // botten - tjocklek > >    f =  7,    // Foten > >    h = 25,    // Höjd > >    t =  3,  // Top > >    x = (b+(t/2) - (h - ((-h / (f-t)) *t))) / (-h / (f-t)) > >  ) > >  let( > >    points = [[0,0], [f,0], [t,h], [0,h]] , > >    top = move([t/2, h, 0], circle(d=t, $fn=20)), > >    sqr = square([10, b]), > >    diff = > >      difference([ > >        move([x, b], square([t/2, t/2])), > >        move([x+(t/2), b+(t/2), 0], circle(d = t, $fn=20) ) ]) > >    ) > >    union([points, top, sqr, diff]); > > //========  Slut Wall1  ============================================================ > > > > > > //================================================================================== > > //======  Plåt på släp  ============================================================ > > module mountingPlate(posX=0, posY=0, posZ=0, mountSide="left", colorName="#C0C0C0", $fn=50) > > { // Hörnpositionerna > >  posX1 = 120; > >  posY1 = 0; > >  posX2 = posX1; > >  posY2 = -200; > >  posX3 = 120 - 75; > >  posY3 = -200; > >  posX4 = 0; > >  posY4 = 0; > >  thick=2;  // tjocklek > > > >  side = mountSide == "left" ? 0 > >        : mountSide == "right" ? 1 > >        : assert(false,"invalid moutSide value");  // message if no case worked > > > >  xpos = mountSide == "left" ? 20 > >        : mountSide == "right" ? -20 > >        : assert(false,"invalid moutSide value");  // message if no case worked > > /* > >  ypos = mountSide == "left" ? 85 > >        : mountSide == "right" ? 85 > >        : assert(false,"invalid moutSide value");  // message if no case worked > > > >  zpos = mountSide == "left" ? -thick > >        : mountSide == "right" ? -thick > >        : assert(false,"invalid moutSide value");  // message if no case worked > > */ > >  color(colorName) > >  {  translate([posX, posY, posZ]) > >      translate([xpos, 85, -thick]) > >    { mirror([side, 0, 0]) > >      { linear_extrude(thick) > >        hull() > >        { translate([posX1, posY1, 0]) > >            square(0.1, center = true); > >          translate([posX2, posY2, 0]) > >            square(0.1, center = true); > >          translate([posX3, posY3, 0]) > >            square(0.1, center = true); > >          translate([posX4, posY4, 0]) > >            square(0.1, center = true); > >        } > >      } > >    } > >  } > > } > > ========================================= > > > > Den tisdag 3 maj 2022 01:49:27 CEST, Father Horton <fatherhorton@gmail.com> skrev: > > > > > > Is the OpenSCAD file small enough to share? > > > > On Mon, May 2, 2022 at 5:23 PM Jan Öhman via Discuss <discuss@lists.openscad.org> wrote: > > > > > > > > > > ---------- Forwarded message ---------- > > From: "Jan Öhman" <jan_ohman@yahoo.com> > > To: OpenSCAD General Discussion <discuss@lists.openscad.org> > > Cc: > > Bcc: > > Date: Mon, 2 May 2022 22:23:28 +0000 (UTC) > > Subject: [OpenSCAD] Export to .stl or .3mf - Error - nothing to export. > > Thought to check out what a 3D print from openSCAD would cost. > > The company can only handle .stl, .3mf, stp > > The openSCAD can export to .stl and .3mf > > (I don't know the difference). > > > > When "F5" is pressed - no problems occur. > > > > When I select "File" / "Export" / "Export as STL" (F7) > > The following message is displayed .: > > "ERROR: Nothing to export! Try rendering first (press F6)" > > > > I press "F6" > > The following message is displayed .: > > "WARNING: No top level geometry to render" > > > > The same thing happens when I try to export to ".3MF" > > Why / What to do? > > > > > > > > > > ---------- Forwarded message ---------- > > From: "Jan Öhman via Discuss" <discuss@lists.openscad.org> > > To: OpenSCAD General Discussion <discuss@lists.openscad.org> > > Cc: "Jan Öhman" <jan_ohman@yahoo.com> > > Bcc: > > Date: Mon, 2 May 2022 22:23:28 +0000 (UTC) > > Subject: [OpenSCAD] Export to .stl or .3mf - Error - nothing to export. > > _______________________________________________ > > OpenSCAD mailing list > > To unsubscribe send an email to discuss-leave@lists.openscad.org > > > > _______________________________________________ > > OpenSCAD mailing list > > To unsubscribe send an email to discuss-leave@lists.openscad.org > > > > > > > > ---------- Forwarded message ---------- > > From: "Jan Öhman via Discuss" <discuss@lists.openscad.org> > > To: OpenSCAD general discussion <discuss@lists.openscad.org> > > Cc: "Jan Öhman" <jan_ohman@yahoo.com> > > Bcc: > > Date: Tue, 3 May 2022 06:17:02 +0000 (UTC) > > Subject: [OpenSCAD] Re: Export to .stl or .3mf - Error - nothing to export. > > _______________________________________________ > > OpenSCAD mailing list > > To unsubscribe send an email to discuss-leave@lists.openscad.org _______________________________________________ OpenSCAD mailing list To unsubscribe send an email to discuss-leave@lists.openscad.org