mirror of
https://github.com/nophead/NopSCADlib.git
synced 2025-09-20 20:21:33 +02:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
f9b06c855c | ||
|
05bfe9b159 | ||
|
f961874ce3 | ||
|
8649d59e8a | ||
|
e9bc300b8d | ||
|
dcb1e74894 | ||
|
ad3e8d85af |
76
readme.md
76
readme.md
@@ -38,16 +38,17 @@ See [usage](docs/usage.md) for requirements, installation instructions and a usa
|
|||||||
<tr><td> <a href = "#Iecs">Iecs</a> </td><td> <a href = "#Spades">Spades</a> </td><td> <a href = "#Ssr_shroud">Ssr_shroud</a> </td><td></td><td></td></tr>
|
<tr><td> <a href = "#Iecs">Iecs</a> </td><td> <a href = "#Spades">Spades</a> </td><td> <a href = "#Ssr_shroud">Ssr_shroud</a> </td><td></td><td></td></tr>
|
||||||
<tr><td> <a href = "#Inserts">Inserts</a> </td><td> <a href = "#Spools">Spools</a> </td><td> <a href = "#Strap_handle">Strap_handle</a> </td><td></td><td></td></tr>
|
<tr><td> <a href = "#Inserts">Inserts</a> </td><td> <a href = "#Spools">Spools</a> </td><td> <a href = "#Strap_handle">Strap_handle</a> </td><td></td><td></td></tr>
|
||||||
<tr><td> <a href = "#Jack">Jack</a> </td><td> <a href = "#Springs">Springs</a> </td><td></td><td></td><td></td></tr>
|
<tr><td> <a href = "#Jack">Jack</a> </td><td> <a href = "#Springs">Springs</a> </td><td></td><td></td><td></td></tr>
|
||||||
<tr><td> <a href = "#Ldrs">Ldrs</a> </td><td> <a href = "#Ssrs">Ssrs</a> </td><td></td><td></td><td></td></tr>
|
<tr><td> <a href = "#Kp_pillow_blocks">Kp_pillow_blocks</a> </td><td> <a href = "#Ssrs">Ssrs</a> </td><td></td><td></td><td></td></tr>
|
||||||
<tr><td> <a href = "#Leadnuts">Leadnuts</a> </td><td> <a href = "#Stepper_motors">Stepper_motors</a> </td><td></td><td></td><td></td></tr>
|
<tr><td> <a href = "#Ldrs">Ldrs</a> </td><td> <a href = "#Stepper_motors">Stepper_motors</a> </td><td></td><td></td><td></td></tr>
|
||||||
<tr><td> <a href = "#Leds">Leds</a> </td><td> <a href = "#Toggles">Toggles</a> </td><td></td><td></td><td></td></tr>
|
<tr><td> <a href = "#Leadnuts">Leadnuts</a> </td><td> <a href = "#Toggles">Toggles</a> </td><td></td><td></td><td></td></tr>
|
||||||
<tr><td> <a href = "#Light_strips">Light_strips</a> </td><td> <a href = "#Transformers">Transformers</a> </td><td></td><td></td><td></td></tr>
|
<tr><td> <a href = "#Leds">Leds</a> </td><td> <a href = "#Transformers">Transformers</a> </td><td></td><td></td><td></td></tr>
|
||||||
<tr><td> <a href = "#Linear_bearings">Linear_bearings</a> </td><td> <a href = "#Tubings">Tubings</a> </td><td></td><td></td><td></td></tr>
|
<tr><td> <a href = "#Light_strips">Light_strips</a> </td><td> <a href = "#Tubings">Tubings</a> </td><td></td><td></td><td></td></tr>
|
||||||
<tr><td> <a href = "#Mains_sockets">Mains_sockets</a> </td><td> <a href = "#Variacs">Variacs</a> </td><td></td><td></td><td></td></tr>
|
<tr><td> <a href = "#Linear_bearings">Linear_bearings</a> </td><td> <a href = "#Variacs">Variacs</a> </td><td></td><td></td><td></td></tr>
|
||||||
<tr><td> <a href = "#Meter">Meter</a> </td><td> <a href = "#Veroboard">Veroboard</a> </td><td></td><td></td><td></td></tr>
|
<tr><td> <a href = "#Mains_sockets">Mains_sockets</a> </td><td> <a href = "#Veroboard">Veroboard</a> </td><td></td><td></td><td></td></tr>
|
||||||
<tr><td> <a href = "#Microswitches">Microswitches</a> </td><td> <a href = "#Washers">Washers</a> </td><td></td><td></td><td></td></tr>
|
<tr><td> <a href = "#Meter">Meter</a> </td><td> <a href = "#Washers">Washers</a> </td><td></td><td></td><td></td></tr>
|
||||||
<tr><td> <a href = "#Microview">Microview</a> </td><td> <a href = "#Wire">Wire</a> </td><td></td><td></td><td></td></tr>
|
<tr><td> <a href = "#Microswitches">Microswitches</a> </td><td> <a href = "#Wire">Wire</a> </td><td></td><td></td><td></td></tr>
|
||||||
<tr><td> <a href = "#Modules">Modules</a> </td><td> <a href = "#Zipties">Zipties</a> </td><td></td><td></td><td></td></tr>
|
<tr><td> <a href = "#Microview">Microview</a> </td><td> <a href = "#Zipties">Zipties</a> </td><td></td><td></td><td></td></tr>
|
||||||
|
<tr><td> <a href = "#Modules">Modules</a> </td><td></td><td></td><td></td><td></td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -93,8 +94,10 @@ Also single bearing balls are modelled as just a silver sphere and a BOM entry.
|
|||||||
| Qty | Module call | BOM entry |
|
| Qty | Module call | BOM entry |
|
||||||
| ---:|:--- |:---|
|
| ---:|:--- |:---|
|
||||||
| 1 | ```ball_bearing(BB608)``` | Ball bearing 608-2RS 8mm x 22mm x 7mm |
|
| 1 | ```ball_bearing(BB608)``` | Ball bearing 608-2RS 8mm x 22mm x 7mm |
|
||||||
|
| 1 | ```ball_bearing(BB6200)``` | Ball bearing 6200-2RS 10mm x 30mm x 9mm |
|
||||||
|
| 1 | ```ball_bearing(BB6201)``` | Ball bearing 6201-2RS 12mm x 32mm x 10mm |
|
||||||
| 1 | ```ball_bearing(BB624)``` | Ball bearing 624-2RS 4mm x 13mm x 5mm |
|
| 1 | ```ball_bearing(BB624)``` | Ball bearing 624-2RS 4mm x 13mm x 5mm |
|
||||||
| 2 | ``` bearing_ball(3)``` | Steel ball 3mm |
|
| 4 | ``` bearing_ball(3)``` | Steel ball 3mm |
|
||||||
|
|
||||||
|
|
||||||
<a href="#top">Top</a>
|
<a href="#top">Top</a>
|
||||||
@@ -1087,6 +1090,57 @@ E.g. a "brown" socket for mains live needs to be displayed as "sienna" to look r
|
|||||||
| 1 | ```jack_4mm_shielded("brown", 3, "sienna")``` | 4mm shielded jack socket brown |
|
| 1 | ```jack_4mm_shielded("brown", 3, "sienna")``` | 4mm shielded jack socket brown |
|
||||||
|
|
||||||
|
|
||||||
|
<a href="#top">Top</a>
|
||||||
|
|
||||||
|
---
|
||||||
|
<a name="Kp_pillow_blocks"></a>
|
||||||
|
## Kp_pillow_blocks
|
||||||
|
KP pillow block bearings
|
||||||
|
|
||||||
|
|
||||||
|
[vitamins/kp_pillow_blocks.scad](vitamins/kp_pillow_blocks.scad) Object definitions.
|
||||||
|
|
||||||
|
[vitamins/kp_pillow_block.scad](vitamins/kp_pillow_block.scad) Implementation.
|
||||||
|
|
||||||
|
[tests/kp_pillow_blocks.scad](tests/kp_pillow_blocks.scad) Code for this example.
|
||||||
|
|
||||||
|
### Properties
|
||||||
|
| Function | Description |
|
||||||
|
|:--- |:--- |
|
||||||
|
| ```kp_base_height(type)``` | Height of base containing the bolts |
|
||||||
|
| ```kp_diameter(type)``` | Rod hole diameter |
|
||||||
|
| ```kp_hole_offset(type)``` | Rod hole offset |
|
||||||
|
| ```kp_screw_separation(type)``` | Separation of bolts in the base |
|
||||||
|
|
||||||
|
### Functions
|
||||||
|
| Function | Description |
|
||||||
|
|:--- |:--- |
|
||||||
|
| ```kp_size(type)``` | Size of bracket |
|
||||||
|
|
||||||
|
### Modules
|
||||||
|
| Module | Description |
|
||||||
|
|:--- |:--- |
|
||||||
|
| ```kp_pillow_block(type)``` | Draw the KP pillow block |
|
||||||
|
| ```kp_pillow_block_assembly(type, part_thickness = 2, screw_type = M5_cap_screw, nut_type = undef)``` | Assembly with fasteners in place |
|
||||||
|
| ```kp_pillow_block_hole_positions(type)``` | Place children at hole positions |
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Vitamins
|
||||||
|
| Qty | Module call | BOM entry |
|
||||||
|
| ---:|:--- |:---|
|
||||||
|
| 1 | ```kp_pillow_block(KP000)``` | KP000 pillow block |
|
||||||
|
| 1 | ```kp_pillow_block(KP001)``` | KP001 pillow block |
|
||||||
|
| 1 | ```kp_pillow_block(KP08)``` | KP08 pillow block |
|
||||||
|
| 2 | ```sliding_t_nut(M4_sliding_t_nut)``` | Nut M4 sliding T |
|
||||||
|
| 2 | ```sliding_t_nut(M5_sliding_t_nut)``` | Nut M5 sliding T |
|
||||||
|
| 2 | ```nut(M5_nut, nyloc = undef)``` | Nut M5 x 4mm |
|
||||||
|
| 2 | ```screw(M4_cap_screw, 10)``` | Screw M4 cap x 10mm |
|
||||||
|
| 4 | ```screw(M5_cap_screw, 12)``` | Screw M5 cap x 12mm |
|
||||||
|
| 2 | ```washer(M4_washer)``` | Washer M4 x 9mm x 0.8mm |
|
||||||
|
| 6 | ```washer(M5_washer)``` | Washer M5 x 10mm x 1mm |
|
||||||
|
|
||||||
|
|
||||||
<a href="#top">Top</a>
|
<a href="#top">Top</a>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
@@ -85,48 +85,49 @@ def make_parts(target, part_type, parts = None):
|
|||||||
#
|
#
|
||||||
lib_dir = os.environ['OPENSCADPATH'] + '/NopSCADlib/printed'
|
lib_dir = os.environ['OPENSCADPATH'] + '/NopSCADlib/printed'
|
||||||
module_suffix = '_dxf' if part_type == 'svg' else '_' + part_type
|
module_suffix = '_dxf' if part_type == 'svg' else '_' + part_type
|
||||||
for dir in [source_dir, lib_dir]:
|
for dir in [source_dir, source_dir + '/printed', lib_dir]:
|
||||||
for filename in os.listdir(dir):
|
if os.path.isdir(dir):
|
||||||
if filename[-5:] == ".scad":
|
for filename in os.listdir(dir):
|
||||||
#
|
if filename[-5:] == ".scad":
|
||||||
# find any modules ending in _<part_type>
|
#
|
||||||
#
|
# find any modules ending in _<part_type>
|
||||||
with open(dir + "/" + filename, "r") as f:
|
#
|
||||||
for line in f.readlines():
|
with open(dir + "/" + filename, "r") as f:
|
||||||
words = line.split()
|
for line in f.readlines():
|
||||||
if(len(words) and words[0] == "module"):
|
words = line.split()
|
||||||
module = words[1].split('(')[0]
|
if(len(words) and words[0] == "module"):
|
||||||
if module.endswith(module_suffix):
|
module = words[1].split('(')[0]
|
||||||
base_name = module[:-4]
|
if module.endswith(module_suffix):
|
||||||
part = base_name + '.' + part_type
|
base_name = module[:-4]
|
||||||
if part in targets:
|
part = base_name + '.' + part_type
|
||||||
#
|
if part in targets:
|
||||||
# make a file to use the module
|
#
|
||||||
#
|
# make a file to use the module
|
||||||
part_maker_name = part_type + ".scad"
|
#
|
||||||
with open(part_maker_name, "w") as f:
|
part_maker_name = part_type + ".scad"
|
||||||
f.write("use <%s/%s>\n" % (dir, filename))
|
with open(part_maker_name, "w") as f:
|
||||||
f.write("%s();\n" % module);
|
f.write("use <%s/%s>\n" % (dir, filename))
|
||||||
#
|
f.write("%s();\n" % module);
|
||||||
# Run openscad on the created file
|
#
|
||||||
#
|
# Run openscad on the created file
|
||||||
part_file = target_dir + "/" + part
|
#
|
||||||
dname = deps_name(deps_dir, filename)
|
part_file = target_dir + "/" + part
|
||||||
changed = check_deps(part_file, dname)
|
dname = deps_name(deps_dir, filename)
|
||||||
changed = times.check_have_time(changed, part)
|
changed = check_deps(part_file, dname)
|
||||||
if part_type == 'stl' and not changed and not part in bounds_map:
|
changed = times.check_have_time(changed, part)
|
||||||
changed = "No bounds"
|
if part_type == 'stl' and not changed and not part in bounds_map:
|
||||||
if changed:
|
changed = "No bounds"
|
||||||
print(changed)
|
if changed:
|
||||||
t = time.time()
|
print(changed)
|
||||||
openscad.run("-D$bom=1", "-d", dname, "-o", part_file, part_maker_name)
|
t = time.time()
|
||||||
times.add_time(part, t)
|
openscad.run("-D$bom=1", "-d", dname, "-o", part_file, part_maker_name)
|
||||||
if part_type == 'stl':
|
times.add_time(part, t)
|
||||||
bounds = c14n_stl.canonicalise(part_file)
|
if part_type == 'stl':
|
||||||
bounds_map[part] = bounds
|
bounds = c14n_stl.canonicalise(part_file)
|
||||||
|
bounds_map[part] = bounds
|
||||||
|
|
||||||
targets.remove(part)
|
targets.remove(part)
|
||||||
os.remove(part_maker_name)
|
os.remove(part_maker_name)
|
||||||
#
|
#
|
||||||
# Write new bounds file
|
# Write new bounds file
|
||||||
#
|
#
|
||||||
|
117
scripts/views.py
117
scripts/views.py
@@ -124,66 +124,67 @@ def views(target, do_assemblies = None):
|
|||||||
#
|
#
|
||||||
main_blurb = None
|
main_blurb = None
|
||||||
lib_dir = os.environ['OPENSCADPATH'] + '/NopSCADlib/printed'
|
lib_dir = os.environ['OPENSCADPATH'] + '/NopSCADlib/printed'
|
||||||
for dir in [source_dir, lib_dir]:
|
for dir in [source_dir, source_dir + '/printed', lib_dir]:
|
||||||
for filename in os.listdir(dir):
|
if os.path.isdir(dir):
|
||||||
if filename.endswith('.scad'):
|
for filename in os.listdir(dir):
|
||||||
#
|
if filename.endswith('.scad'):
|
||||||
# find any modules with names ending in _assembly
|
#
|
||||||
#
|
# find any modules with names ending in _assembly
|
||||||
with open(dir + "/" + filename, "r") as f:
|
#
|
||||||
lines = f.readlines()
|
with open(dir + "/" + filename, "r") as f:
|
||||||
line_no = 0
|
lines = f.readlines()
|
||||||
for line in lines:
|
line_no = 0
|
||||||
words = line.split()
|
for line in lines:
|
||||||
if len(words) and words[0] == "module":
|
words = line.split()
|
||||||
module = words[1].split('(')[0]
|
if len(words) and words[0] == "module":
|
||||||
if is_assembly(module):
|
module = words[1].split('(')[0]
|
||||||
if module in assemblies:
|
if is_assembly(module):
|
||||||
#
|
if module in assemblies:
|
||||||
# Scrape the assembly instructions
|
|
||||||
#
|
|
||||||
for ass in flat_bom:
|
|
||||||
if ass["name"] == module:
|
|
||||||
if not "blurb" in ass:
|
|
||||||
ass["blurb"] = blurb.scrape_module_blurb(lines[:line_no])
|
|
||||||
break
|
|
||||||
if not do_assemblies or module in do_assemblies:
|
|
||||||
#
|
#
|
||||||
# make a file to use the module
|
# Scrape the assembly instructions
|
||||||
#
|
#
|
||||||
png_maker_name = 'png.scad'
|
for ass in flat_bom:
|
||||||
with open(png_maker_name, "w") as f:
|
if ass["name"] == module:
|
||||||
f.write("use <%s/%s>\n" % (dir, filename))
|
if not "blurb" in ass:
|
||||||
f.write("%s();\n" % module);
|
ass["blurb"] = blurb.scrape_module_blurb(lines[:line_no])
|
||||||
#
|
break
|
||||||
# Run openscad on the created file
|
if not do_assemblies or module in do_assemblies:
|
||||||
#
|
#
|
||||||
dname = deps_name(deps_dir, filename)
|
# make a file to use the module
|
||||||
for explode in [0, 1]:
|
#
|
||||||
png_name = target_dir + '/' + module + '.png'
|
png_maker_name = 'png.scad'
|
||||||
if not explode:
|
with open(png_maker_name, "w") as f:
|
||||||
png_name = png_name.replace('_assembly', '_assembled')
|
f.write("use <%s/%s>\n" % (dir, filename))
|
||||||
changed = check_deps(png_name, dname)
|
f.write("%s();\n" % module);
|
||||||
changed = times.check_have_time(changed, png_name)
|
#
|
||||||
changed = options.have_changed(changed, png_name)
|
# Run openscad on the created file
|
||||||
tmp_name = 'tmp.png'
|
#
|
||||||
if changed:
|
dname = deps_name(deps_dir, filename)
|
||||||
print(changed)
|
for explode in [0, 1]:
|
||||||
t = time.time()
|
png_name = target_dir + '/' + module + '.png'
|
||||||
openscad.run_list(options.list() + ["-D$pose=1", "-D$explode=%d" % explode, colour_scheme, "--projection=p", "--imgsize=4096,4096", "--autocenter", "--viewall", "-d", dname, "-o", tmp_name, png_maker_name]);
|
if not explode:
|
||||||
times.add_time(png_name, t)
|
png_name = png_name.replace('_assembly', '_assembled')
|
||||||
do_cmd(["magick", tmp_name, "-trim", "-resize", "1004x1004", "-bordercolor", background, "-border", "10", tmp_name])
|
changed = check_deps(png_name, dname)
|
||||||
update_image(tmp_name, png_name)
|
changed = times.check_have_time(changed, png_name)
|
||||||
tn_name = png_name.replace('.png', '_tn.png')
|
changed = options.have_changed(changed, png_name)
|
||||||
if mtime(png_name) > mtime(tn_name):
|
tmp_name = 'tmp.png'
|
||||||
do_cmd(("magick "+ png_name + " -trim -resize 280x280 -background " + background + " -gravity Center -extent 280x280 -bordercolor " + background + " -border 10 " + tmp_name).split())
|
if changed:
|
||||||
update_image(tmp_name, tn_name)
|
print(changed)
|
||||||
os.remove(png_maker_name)
|
t = time.time()
|
||||||
done_assemblies.append(module)
|
openscad.run_list(options.list() + ["-D$pose=1", "-D$explode=%d" % explode, colour_scheme, "--projection=p", "--imgsize=4096,4096", "--autocenter", "--viewall", "-d", dname, "-o", tmp_name, png_maker_name]);
|
||||||
else:
|
times.add_time(png_name, t)
|
||||||
if module == 'main_assembly':
|
do_cmd(["magick", tmp_name, "-trim", "-resize", "1004x1004", "-bordercolor", background, "-border", "10", tmp_name])
|
||||||
main_blurb = blurb.scrape_module_blurb(lines[:line_no])
|
update_image(tmp_name, png_name)
|
||||||
line_no += 1
|
tn_name = png_name.replace('.png', '_tn.png')
|
||||||
|
if mtime(png_name) > mtime(tn_name):
|
||||||
|
do_cmd(("magick "+ png_name + " -trim -resize 280x280 -background " + background + " -gravity Center -extent 280x280 -bordercolor " + background + " -border 10 " + tmp_name).split())
|
||||||
|
update_image(tmp_name, tn_name)
|
||||||
|
os.remove(png_maker_name)
|
||||||
|
done_assemblies.append(module)
|
||||||
|
else:
|
||||||
|
if module == 'main_assembly':
|
||||||
|
main_blurb = blurb.scrape_module_blurb(lines[:line_no])
|
||||||
|
line_no += 1
|
||||||
times.print_times()
|
times.print_times()
|
||||||
#
|
#
|
||||||
# Build the document
|
# Build the document
|
||||||
|
34
tests/kp_pillow_blocks.scad
Normal file
34
tests/kp_pillow_blocks.scad
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
//
|
||||||
|
// NopSCADlib Copyright Chris Palmer 2018
|
||||||
|
// nop.head@gmail.com
|
||||||
|
// hydraraptor.blogspot.com
|
||||||
|
//
|
||||||
|
// This file is part of NopSCADlib.
|
||||||
|
//
|
||||||
|
// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the
|
||||||
|
// GNU General Public License as published by the Free Software Foundation, either version 3 of
|
||||||
|
// the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||||
|
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
// See the GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License along with NopSCADlib.
|
||||||
|
// If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
include <../core.scad>
|
||||||
|
use <../utils/layout.scad>
|
||||||
|
|
||||||
|
include <../vitamins/kp_pillow_blocks.scad>
|
||||||
|
include <../vitamins/nuts.scad>
|
||||||
|
|
||||||
|
module kp_pillow_blocks() {
|
||||||
|
screws = [M4_cap_screw, M5_cap_screw, M5_cap_screw];
|
||||||
|
nuts = [M4_sliding_t_nut, M5_sliding_t_nut, M5_nut];
|
||||||
|
layout([for(k = kp_pillow_blocks) 2 * kp_size(k)[1]])
|
||||||
|
kp_pillow_block_assembly(kp_pillow_blocks[$i], screw_type = screws[$i], nut_type = nuts[$i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($preview)
|
||||||
|
kp_pillow_blocks();
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 92 KiB After Width: | Height: | Size: 86 KiB |
BIN
tests/png/kp_pillow_blocks.png
Normal file
BIN
tests/png/kp_pillow_blocks.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 88 KiB |
@@ -18,7 +18,9 @@
|
|||||||
//
|
//
|
||||||
BB624 = ["624", 4, 13, 5, "blue"]; // 624 ball bearing for idlers
|
BB624 = ["624", 4, 13, 5, "blue"]; // 624 ball bearing for idlers
|
||||||
BB608 = ["608", 8, 22, 7, "OrangeRed"]; // 608 bearings for wades
|
BB608 = ["608", 8, 22, 7, "OrangeRed"]; // 608 bearings for wades
|
||||||
|
BB6200 = ["6200", 10, 30, 9, "black"]; // 6200 bearings for KP pillow blocks
|
||||||
|
BB6201 = ["6201", 12, 32, 10, "black"]; // 6201 bearings for KP pillow blocks
|
||||||
|
|
||||||
ball_bearings = [BB624, BB608];
|
ball_bearings = [BB624, BB608, BB6200, BB6201];
|
||||||
|
|
||||||
use <ball_bearing.scad>
|
use <ball_bearing.scad>
|
||||||
|
117
vitamins/kp_pillow_block.scad
Normal file
117
vitamins/kp_pillow_block.scad
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
//
|
||||||
|
// NopSCADlib Copyright Chris Palmer 2018
|
||||||
|
// nop.head@gmail.com
|
||||||
|
// hydraraptor.blogspot.com
|
||||||
|
//
|
||||||
|
// This file is part of NopSCADlib.
|
||||||
|
//
|
||||||
|
// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the
|
||||||
|
// GNU General Public License as published by the Free Software Foundation, either version 3 of
|
||||||
|
// the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||||
|
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
// See the GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License along with NopSCADlib.
|
||||||
|
// If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//
|
||||||
|
//! KP pillow block bearings
|
||||||
|
//
|
||||||
|
include <../core.scad>
|
||||||
|
use <../utils/tube.scad>
|
||||||
|
|
||||||
|
include <screws.scad>
|
||||||
|
use <washer.scad>
|
||||||
|
use <ball_bearing.scad>
|
||||||
|
|
||||||
|
kp_pillow_block_color = grey70;
|
||||||
|
|
||||||
|
function kp_diameter(type) = type[1]; //! Rod hole diameter
|
||||||
|
function kp_hole_offset(type) = type[2]; //! Rod hole offset
|
||||||
|
function kp_size(type) = [type[3],type[8],type[5]]; //! Size of bracket
|
||||||
|
function kp_base_height(type) = type[7]; //! Height of base containing the bolts
|
||||||
|
function kp_screw_separation(type) = type[4]; //! Separation of bolts in the base
|
||||||
|
|
||||||
|
|
||||||
|
module kp_pillow_block(type) { //! Draw the KP pillow block
|
||||||
|
vitamin(str("kp_pillow_block(", type[0], "): ", type[0], " pillow block"));
|
||||||
|
|
||||||
|
d = kp_diameter(type);
|
||||||
|
H = kp_hole_offset(type);
|
||||||
|
L = kp_size(type)[0];
|
||||||
|
J = kp_screw_separation(type);
|
||||||
|
A = kp_size(type)[2];// sizeZ, includes protruding center
|
||||||
|
N = type[6];
|
||||||
|
H1 = kp_base_height(type);
|
||||||
|
H0 = kp_size(type)[1];
|
||||||
|
K = type[9];
|
||||||
|
S = type[10];
|
||||||
|
b = type[11];
|
||||||
|
bolthole_radius = type[12];
|
||||||
|
|
||||||
|
color(kp_pillow_block_color)
|
||||||
|
translate([0, -H, 0]) {
|
||||||
|
fillet = 1;
|
||||||
|
squareSizeX = (L - H0) / 2 + fillet;
|
||||||
|
rotate([-90, 0, 0])
|
||||||
|
linear_extrude(H1)
|
||||||
|
difference() {
|
||||||
|
union() {
|
||||||
|
for(i = [-L / 2, L / 2 - squareSizeX])
|
||||||
|
translate([i, -A / 2])
|
||||||
|
rounded_square([squareSizeX, A], fillet, center = false);
|
||||||
|
}
|
||||||
|
for(i = [-J / 2, J / 2])
|
||||||
|
translate([i, 0])
|
||||||
|
circle(r = bolthole_radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
translate_z(-A / 2) {
|
||||||
|
for(x = [- L / 2 + squareSizeX - fillet, L / 2 - squareSizeX + fillet - 2])
|
||||||
|
translate([x, 0, 0])
|
||||||
|
cube([2, H, A]);
|
||||||
|
stripLength = J - 2 * bolthole_radius;
|
||||||
|
stripThickness = 4;
|
||||||
|
translate([-stripLength / 2, 0, (H1 + stripThickness) / 2])
|
||||||
|
cube([stripLength, H1, stripThickness]);
|
||||||
|
translate([0 , H, 0])
|
||||||
|
tube(H0 / 2, b / 2, A, center = false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
not_on_bom() no_explode()
|
||||||
|
ball_bearing(type[13]);
|
||||||
|
}
|
||||||
|
|
||||||
|
module kp_pillow_block_hole_positions(type) { //! Place children at hole positions
|
||||||
|
for(x = [-kp_screw_separation(type), kp_screw_separation(type)])
|
||||||
|
translate([x / 2, kp_base_height(type) - kp_hole_offset(type), 0])
|
||||||
|
rotate([-90,0,0])
|
||||||
|
children();
|
||||||
|
}
|
||||||
|
|
||||||
|
module kp_pillow_block_assembly(type, part_thickness = 2, screw_type = M5_cap_screw, nut_type = undef) { //! Assembly with fasteners in place
|
||||||
|
kp_pillow_block(type);
|
||||||
|
|
||||||
|
screw_washer_thickness = washer_thickness(screw_washer(screw_type));
|
||||||
|
nut_type = is_undef(nut_type) ? screw_nut(screw_type) : nut_type;
|
||||||
|
nut_washer_type = nut_washer(nut_type);
|
||||||
|
nut_washer_thickness = nut_washer_type ? washer_thickness(nut_washer_type) : 0;
|
||||||
|
|
||||||
|
nut_offset = kp_base_height(type) + part_thickness;
|
||||||
|
screw_length = screw_shorter_than(nut_offset + screw_washer_thickness + nut_thickness(nut_type) + nut_washer_thickness);
|
||||||
|
|
||||||
|
kp_pillow_block_hole_positions(type) {
|
||||||
|
screw_and_washer(screw_type, screw_length);
|
||||||
|
|
||||||
|
translate_z(-nut_offset)
|
||||||
|
vflip()
|
||||||
|
if(nut_washer_type)
|
||||||
|
nut_and_washer(nut_type);
|
||||||
|
else
|
||||||
|
sliding_t_nut(nut_type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
35
vitamins/kp_pillow_blocks.scad
Normal file
35
vitamins/kp_pillow_blocks.scad
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
//
|
||||||
|
// NopSCADlib Copyright Chris Palmer 2018
|
||||||
|
// nop.head@gmail.com
|
||||||
|
// hydraraptor.blogspot.com
|
||||||
|
//
|
||||||
|
// This file is part of NopSCADlib.
|
||||||
|
//
|
||||||
|
// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the
|
||||||
|
// GNU General Public License as published by the Free Software Foundation, either version 3 of
|
||||||
|
// the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||||
|
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
// See the GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License along with NopSCADlib.
|
||||||
|
// If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
//! KP pillow block bearings
|
||||||
|
//
|
||||||
|
|
||||||
|
include <../core.scad>
|
||||||
|
include <screws.scad>
|
||||||
|
include <ball_bearings.scad>
|
||||||
|
|
||||||
|
// d H L J A N H1 H0 K S b bolthole bearing
|
||||||
|
KP08 = ["KP08", 8, 18, 55, 42, 13, 4.5, 5, 29, 0.0, 0, 22, M4_clearance_radius, BB608];
|
||||||
|
KP000 = ["KP000", 10, 18, 67, 53, 16, 7.0, 6, 35, 14.0, 4, 30, M6_clearance_radius, BB6200];
|
||||||
|
KP001 = ["KP001", 12, 19, 71, 56, 16, 7.0, 6, 38, 14.5, 4, 32, M6_clearance_radius, BB6201];
|
||||||
|
|
||||||
|
kp_pillow_blocks = [KP08, KP000, KP001];
|
||||||
|
|
||||||
|
use <kp_pillow_block.scad>
|
Reference in New Issue
Block a user