3d boolean diff

This commit is contained in:
Lev Nikonov 2025-11-26 21:10:42 +05:00
parent fdf8ad9b0f
commit 69f6056350
5 changed files with 79 additions and 20 deletions

View file

@ -5,7 +5,6 @@ version: 2.427
file_version: 2.427
project_name: "Driver-01"
library_folder: "d:\works\fp_lib"
full_library_folder: "d:\works\fp_lib\lib"
CAM_folder: "D:\Works\Projects\duxahtech\Led\version-01\CAM(Driver-01)(11-9-2025)"
ses_file_path: ""
netlist_completed: "1"
@ -25,7 +24,7 @@ m_client_rect_left: 110
m_client_rect_right: 1487
m_client_rect_bottom: 593
m_client_rect_top: 0
m_org_x: -11530
m_org_x: -11528
m_org_y: -4624
m_scale_factor: 21282
part_line_visible: 1
@ -263,6 +262,17 @@ package: "CD54"
ref_text: 1270000 0 -4000000 0 177800
value_text: 1270000 0 -6540000 0 177800
centroid: 0 0 0 0
openscad_code: "translate([0,0,0]) // (automatic adjustment when moving the footprint origin)"
openscad_code: "scale([1,1,1]) // (automatic adjustment when changing the project units)"
openscad_code: "{"
openscad_code: " //-------------------"
openscad_code: " // add your code here, for example:"
openscad_code: " //color(`Aqua`)"
openscad_code: " //translate([0,0,0])"
openscad_code: " //rotate([0,0,0])"
openscad_code: " //import(`knob.stl`);"
openscad_code: " //-------------------"
openscad_code: "}"
openscad_hole: "translate([-1.950,0.000,0.000]) // (automatic adjustment when moving the footprint origin)"
openscad_hole: "scale([1.000,1.000,1.000]) // (automatic adjustment when changing the project units)"
openscad_hole: "{"
@ -275,6 +285,8 @@ package: "CD54"
openscad_hole: " text(`22uH`,1);"
openscad_hole: " //-------------------"
openscad_hole: "}"
openscad_module: "// include <Driver_01_CD54.lib>"
openscad_module: "// include <Package.lib>"
outline_polyline: 177800 -3450000 -2300000 1 0 4
next_corner: 3450000 -2300000 0
next_corner: 3450000 2300000 0

View file

@ -16,25 +16,28 @@ MODE = 1; // 1: full 3D view
// 3: projection of bottom copper
// 4: projection of top packages
// 5: projection of bottom packages
// 6: lateral projection
// 7: frontal projection
// 6: lateral pcb projection
// 7: frontal pcb projection.
// Set the origin in the pcb editor to the
// location where you want the cut to be:
// 8: custom lateral projection
// 9: custom frontal projection
// 10: custom combo projection.
// 10: custom combo projection
// 11: frontal 3D section
// 12: lateral 3D section
// 13: boolean difference.
dir = 1; // view direction for 6...10 modes
pdist = 20; // distance between projections for mode 10
dir = 0; // view direction for 6...12 modes
pdist = 0; // distance between projections for mode 10
//// Drawing control
E = true;
drw_board_outline = (MODE<4||MODE>5)?1:0;
drw_copper = MODE<4?1:0;
drw_holes = MODE<4?1:0;
drw_pads = MODE<4?1:0;
drw_board_outline = (MODE!=4&&MODE!=5&&MODE!=13)?1:0;
drw_copper = (MODE<4||MODE>10)?1:0;
drw_holes = (MODE<4||MODE>10)?1:0;
drw_pads = (MODE<4||MODE>10)?1:0;
drw_Driver_01_C0402 = E;
drw_Driver_01_RTLECS = E;
drw_Driver_01_CD54 = E;
@ -46,7 +49,7 @@ drw_Driver_01_CC0805 = E;
//// Drawing modules
/*
coordinates:*/frozen = 0;/* Wherever you move
coordinates:*/frozen = false;/* Wherever you move
the PCB in the PCB editor, the position of the 3D
model will remain the same. Make true if you want
to use this option*/
@ -74,7 +77,7 @@ module Custom ()
// add any PCB from the project folder,
// any pcb in the project folder will require
// the <.lib> header (See top) to be included:
render()
render(Convexity)
translate([-6,-3.5,-9.000])
Pcb_Package (1);
@ -85,9 +88,9 @@ module Custom ()
//// Drawing
cube_scaleX = 1.0;// option for mode 4...5
cube_scaleY = 1.0;// option for mode 4...5
cube_scaleZ = 1.0;// option for mode 4...5
cube_scaleX = 2.0;// option for 4,5,11,12 modes
cube_scaleY = 1.0;// option for 4,5,11,12 modes
cube_scaleZ = 1.0;// option for 4,5,11,12 modes
if (MODE == 1)
Main();
else if (MODE == 2)
@ -128,7 +131,7 @@ else if (MODE == 9)
Main();
else if (MODE == 10)
{
translate([frozen?-pdist:originX_Driver_01+originY_Driver_01-pdist, 0, 0])
translate([frozen?-pdist:(originX_Driver_01+originY_Driver_01-pdist), 0, 0])
rotate(90)
{
projection(true)
@ -139,12 +142,41 @@ else if (MODE == 10)
rotate([0, dir?-90:90, 0])
Main(0);
}
render()// combines intersecting projections
{
projection(true)
translate([0, 0, frozen?(dir?originY_Driver_01:-originY_Driver_01):0])
rotate([dir?90:-90, 0, 0])
Custom();
projection()
rotate([dir?90:-90, 0, 0])
Main(0);
Main(0);
}
projection(true)
translate([0, frozen?10.000-pdist:(10.000-pdist-originY_Driver_01), board_h/2])
Main();
}
else if (MODE == 11)
{
difference(){
Custom();
color("white")
translate([0, frozen?-originY_Driver_01:0, frozen?(dir?-max_height_Driver_01/2:max_height_Driver_01/2):0])
rotate([dir?90:-90, 0, 0])
Draw_Driver_01_CUBE(0, frozen);}
Main(0);
}
else if (MODE == 12)
{
difference(){
Custom();
color("white")
translate([frozen?-originX_Driver_01:0, 0, frozen?(dir?max_height_Driver_01/2:-max_height_Driver_01/2):0])
rotate([0, dir?90:-90, 0])
Draw_Driver_01_CUBE(0, frozen);}
Main(0);
}
else if (MODE == 13)
difference(){
Custom();
Main(0);}

View file

@ -6,6 +6,9 @@
//============================================
// include <Driver_01_CD54.lib>
// include <Package.lib>
// Polylines
module Poly1_Driver_01_CD54 ()
{
@ -166,6 +169,18 @@ module FDriver_01_CD54 ()
circle( d=1.000 );
// end of pins
}
translate([0,0,0]) // (automatic adjustment when moving the footprint origin)
scale([1,1,1]) // (automatic adjustment when changing the project units)
{
//-------------------
// add your code here, for example:
//color("Aqua")
//translate([0,0,0])
//rotate([0,0,0])
//import("knob.stl");
//-------------------
}
// end of union
}

View file

@ -12,7 +12,7 @@
// Footprint
module fp_Driver_01_RTLECS ()
{
union()
hull()/*fill the space*/
{
// end of union
}

Binary file not shown.