discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

How to extract DXF files from this OpenSCAD code

B
beasponge@protonmail.com
Thu, Apr 21, 2022 1:59 PM

Hello Everyone.

side note: I did try and ask this in the Libera Chat but for some reason it booted me out and I couldn’t get back in. Apologies if you read this again.

I am very new to OpenSCAD. As In like 1 day old. I have been watching hours of tutorials and read quite a lot - I think my head is about to explode with all the information I am trying to absorb. I have very little coding/ programming experience - I have played around with Python a little and that is it.

Anyhow, I made a parametric coffee table and just WOW! I can’t believe how easy it was as compared to my attempts in other CAD programs but I am a little stuck.

I have modeled it (or assume I have - remember I am still a noob) so that each cube is a separate part of the coffee table and now I would like export each piece as a dxf with its dimensions so that it can be used to create a cut list or be used in a CAM program for CNC work - can anyone advise me on how to go about this?

Thanks in advance

Here is the code:

Length = 1200;
Width = 600;
Thickness = 16;
TrimThickness = 32;
Height = 400;
LegWidth = 100;
//table top
cube([Length,Width,Thickness]);
//Leftside trim
translate([0,0,-TrimThickness])
cube([Length, Thickness,TrimThickness]);
//FrontSideTrim
translate([Length-Thickness,Thickness,-TrimThickness])
cube([Thickness, Width-Thickness*2, TrimThickness]);
//RightSideTrim
translate([0,Width-Thickness,-TrimThickness])
cube([Length, Thickness,TrimThickness]);
//BackSideTrim
translate([0,Thickness,-TrimThickness])
cube([Thickness, Width-Thickness*2, TrimThickness]);
//LeftBacklegassembly
translate([Thickness,Thickness,-Height])
cube([LegWidth, Thickness, Height]);
translate([Thickness,Thickness,-Height])
//This is the back piece which is a little shorterwidth wise to accomodate the thickness of the other leg
cube([Thickness,LegWidth-Thickness,Height]);
//RightBackLegAssembly
translate([Thickness,Width-Thickness*2,-Height])
cube([LegWidth, Thickness, Height]);
translate([Thickness,Width-LegWidth-Thickness,-Height])
//This is the back piece which is a little shorterwidth wise to accomodate the thickness of the other leg
cube([Thickness,LegWidth-Thickness,Height]);
//LeftFrontlegassembly
translate([Length-LegWidth -Thickness,Thickness,-Height])
cube([LegWidth, Thickness, Height]);
translate([Length-Thickness*2,Thickness,-Height])
//This is the back piece which is a little shorterwidth wise to accomodate the thickness of the other leg
cube([Thickness,LegWidth-Thickness,Height]);
//RightFrontLegAssembly
translate([Length-LegWidth-Thickness,Width-Thickness*2,-Height])
cube([LegWidth, Thickness, Height]);
translate([Length-Thickness*2,Width-LegWidth-Thickness,-Height])
//This is the back piece which is a little shorterwidth wise to accomodate the thickness of the other leg
cube([Thickness,LegWidth-Thickness,Height]);
//BottomShelf
translate([Thickness*2,Thickness*2,-Height+100])
cube([Length-Thickness*4,Width-Thickness*4,Thickness]);
Hello Everyone. *side note: I did try and ask this in the Libera Chat but for some reason it booted me out and I couldn’t get back in. Apologies if you read this again.* I am very new to OpenSCAD. As In like 1 day old. I have been watching hours of tutorials and read quite a lot - I think my head is about to explode with all the information I am trying to absorb. I have very little coding/ programming experience - I have played around with Python a little and that is it. Anyhow, I made a parametric coffee table and just WOW! I can’t believe how easy it was as compared to my attempts in other CAD programs but I am a little stuck. I have modeled it (or assume I have - remember I am still a noob) so that each cube is a separate part of the coffee table and now I would like export each piece as a dxf with its dimensions so that it can be used to create a cut list or be used in a CAM program for CNC work - can anyone advise me on how to go about this? Thanks in advance Here is the code: ``` Length = 1200; ``` ``` Width = 600; ``` ``` Thickness = 16; ``` ``` TrimThickness = 32; ``` ``` Height = 400; ``` ``` LegWidth = 100; ``` ``` //table top ``` ``` cube([Length,Width,Thickness]); ``` ``` //Leftside trim ``` ``` translate([0,0,-TrimThickness]) ``` ``` cube([Length, Thickness,TrimThickness]); ``` ``` //FrontSideTrim ``` ``` translate([Length-Thickness,Thickness,-TrimThickness]) ``` ``` cube([Thickness, Width-Thickness*2, TrimThickness]); ``` ``` //RightSideTrim ``` ``` translate([0,Width-Thickness,-TrimThickness]) ``` ``` cube([Length, Thickness,TrimThickness]); ``` ``` //BackSideTrim ``` ``` translate([0,Thickness,-TrimThickness]) ``` ``` cube([Thickness, Width-Thickness*2, TrimThickness]); ``` ``` //LeftBacklegassembly ``` ``` translate([Thickness,Thickness,-Height]) ``` ``` cube([LegWidth, Thickness, Height]); ``` ``` translate([Thickness,Thickness,-Height]) ``` ``` //This is the back piece which is a little shorterwidth wise to accomodate the thickness of the other leg ``` ``` cube([Thickness,LegWidth-Thickness,Height]); ``` ``` //RightBackLegAssembly ``` ``` translate([Thickness,Width-Thickness*2,-Height]) ``` ``` cube([LegWidth, Thickness, Height]); ``` ``` translate([Thickness,Width-LegWidth-Thickness,-Height]) ``` ``` //This is the back piece which is a little shorterwidth wise to accomodate the thickness of the other leg ``` ``` cube([Thickness,LegWidth-Thickness,Height]); ``` ``` //LeftFrontlegassembly ``` ``` translate([Length-LegWidth -Thickness,Thickness,-Height]) ``` ``` cube([LegWidth, Thickness, Height]); ``` ``` translate([Length-Thickness*2,Thickness,-Height]) ``` ``` //This is the back piece which is a little shorterwidth wise to accomodate the thickness of the other leg ``` ``` cube([Thickness,LegWidth-Thickness,Height]); ``` ``` //RightFrontLegAssembly ``` ``` translate([Length-LegWidth-Thickness,Width-Thickness*2,-Height]) ``` ``` cube([LegWidth, Thickness, Height]); ``` ``` translate([Length-Thickness*2,Width-LegWidth-Thickness,-Height]) ``` ``` //This is the back piece which is a little shorterwidth wise to accomodate the thickness of the other leg ``` ``` cube([Thickness,LegWidth-Thickness,Height]); ``` ``` //BottomShelf ``` ``` translate([Thickness*2,Thickness*2,-Height+100]) ``` ``` cube([Length-Thickness*4,Width-Thickness*4,Thickness]); ```