openscad_util 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 39e291f04499fc758aa83ea0ba1d73a15733953617efdc18ae93f178709476e5
4
+ data.tar.gz: c214252b3669d9f58a366e65b062fb008dfe62e513d3252caf4ddeccaf75c8e4
5
+ SHA512:
6
+ metadata.gz: bba6639f4633fbda5a01a8b6e76f16857022d02783bd06e57f369ee9d7152ce771c5af00af2cb7b7482b055494084e799392f9ad325162ea10facd79c5049cc5
7
+ data.tar.gz: 1949065c65f9311ad69fd344e1fba86f4ca02ee819343e27045cf49c07820b47f1c5eb2ae1ed9510fd565cebde90ad4212ce38ce51458730621b1fc06f6f8a3c
@@ -0,0 +1,4 @@
1
+ include <constants/all.scad>
2
+ use <3d_print/heatset_insert.scad>
3
+
4
+ heatset_insert_hole(0.25*inch);
@@ -0,0 +1,13 @@
1
+ use <soften/hole.scad>
2
+ use <3d_print/heatset_insert_geometry.scad>
3
+
4
+ module heatset_insert_hole(size) {
5
+ h = heatset_hole_depth(size);
6
+ d = heatset_hole_diameter(size);
7
+
8
+ stretch_length=0.15; // how much free space in bottom of hole to make
9
+ hole(h=h*(1+stretch_length),
10
+ d1=d[0],
11
+ d2=d[1]+(d[0]-d[1])*stretch_length,
12
+ top_chamfer=d[0]*0.1);
13
+ }
@@ -0,0 +1,36 @@
1
+ include <constants/all.scad>
2
+
3
+ // FIXME: migrate this all into one vector and update functions to match
4
+ heatset_hole_top_diameters = [
5
+ [2, 3.6],
6
+ [2.5, 4.2],
7
+ [3, 5.3],
8
+ [5, 8],
9
+ [0.25*inch, 0.363*inch]
10
+ ];
11
+
12
+ heatset_hole_bottom_diameters = [
13
+ [2, 3.1],
14
+ [2.5, 3.9],
15
+ [3, 5.1],
16
+ [5, 7.7],
17
+ [0.25*inch, 0.349*inch]
18
+ ];
19
+
20
+ heatset_hole_depths = [
21
+ [2, 2.9],
22
+ [2.5, 3.4],
23
+ [3, 3.8],
24
+ [5, 6.7],
25
+ [0.25*inch, 0.3*inch]
26
+ ];
27
+
28
+ // returns the diameter
29
+
30
+ function heatset_hole_diameter(size) = [
31
+ lookup(size, heatset_hole_top_diameters),
32
+ lookup(size, heatset_hole_bottom_diameters)
33
+ ];
34
+
35
+ function heatset_hole_depth(size) = lookup(size, heatset_hole_depths);
36
+ function heatset_hole_clearance_diameter(size) = size + 0.5;
@@ -0,0 +1,22 @@
1
+ module helper_disk(diameter=15,height=1) {
2
+ cylinder(d=diameter,h=height);
3
+ }
4
+
5
+ module helper_disks_for_rectangle(size, diameter=15, center=true) {
6
+ x_size = size[0];
7
+ y_size = size[1];
8
+ outset = diameter*0.1; // amount to move disk off-center
9
+ // FIXME: use mirror_xy() to replace most of this logic
10
+ disc_offsets = [[-outset, -outset, 0],
11
+ [-outset, y_size + outset, 0],
12
+ [x_size + outset, y_size + outset, 0],
13
+ [x_size + outset, -outset, 0]];
14
+
15
+ centering_offset = center ? [-x_size/2, -y_size/2, 0] : [0, 0, 0];
16
+ translate(centering_offset)
17
+ for(offset = disc_offsets) {
18
+ translate(offset) helper_disk();
19
+ }
20
+ }
21
+
22
+ // FIXME: create demo for this module
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Joe Francis
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,9 @@
1
+ epsilon = 0.05; // overlap adjacent volumes by this amount
2
+ inch = 25.4; // 25.4 mm per inch
3
+
4
+ x_axis=0;
5
+ y_axis=1;
6
+ z_axis=2;
7
+
8
+ // FIXME: this is not a constant
9
+ function fn(r) = $fn > 0 ? $fn : max(5, ceil(min(360/$fa, r*2*PI/$fs)));
@@ -0,0 +1,42 @@
1
+ module mirror_x() {
2
+ children();
3
+ mirror([1, 0, 0]) children();
4
+ }
5
+
6
+ module mirror_y() {
7
+ children();
8
+ mirror([0, 1, 0]) children();
9
+ }
10
+
11
+ module mirror_z() {
12
+ children();
13
+ mirror([0, 0, 1]) children();
14
+ }
15
+
16
+ module mirror_xy() {
17
+ mirror_x() mirror_y() children();
18
+ }
19
+
20
+ module mirror_xz() {
21
+ mirror_x() mirror_z() children();
22
+ }
23
+
24
+ module mirror_yz() {
25
+ mirror_y() mirror_z() children();
26
+ }
27
+
28
+ module mirror_xyz() {
29
+ mirror_x() mirror_y() mirror_z() children();
30
+ }
31
+
32
+ module repeat_with_offset(offset, copies=1) {
33
+ for(i = [0:copies-1]) {
34
+ translate(offset * i)
35
+ children();
36
+ }
37
+ }
38
+
39
+ //repeat_with_offset([10,0,0], 3) {
40
+ // $fn=100;
41
+ // cylinder(d=5,h=10);
42
+ //}[ 0.00, 0.00, 0.00 ]
@@ -0,0 +1,18 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "openscad_util"
7
+ spec.version = '0.1.0'
8
+ spec.authors = ["Joe Francis"]
9
+ spec.email = ["joe@lostapathy.com"]
10
+
11
+ spec.summary = %q{A collection of OpenSCAD utility code}
12
+ spec.homepage = "https://github.com/lostapathy/openscad-libs/"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
16
+ f.match(%r{^(test|spec|features)/})
17
+ end
18
+ end
@@ -0,0 +1,14 @@
1
+ module validate(valid, message) {
2
+ // It would be great if this was more like a stack trace
3
+ module print_error(string) {
4
+ echo(str("<br/><font color='red'>", string, "<br/> in module <b>", parent_module(2), "</b> called from <b>", parent_module(3), "</b><br/>"));
5
+ }
6
+
7
+ if(!valid) {
8
+ print_error(str("Error: <b>", message, "</b>"));
9
+
10
+ if(version()[0] >= 2017) {
11
+ assert(false);
12
+ }
13
+ }
14
+ }
metadata ADDED
@@ -0,0 +1,53 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: openscad_util
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Joe Francis
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-03-10 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ - joe@lostapathy.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - 3d_print/demo/heatset_insert-demo.scad
21
+ - 3d_print/heatset_insert.scad
22
+ - 3d_print/heatset_insert_geometry.scad
23
+ - 3d_print/helper_disk.scad
24
+ - LICENSE.txt
25
+ - constants/all.scad
26
+ - layout/layout.scad
27
+ - openscad_util.gemspec
28
+ - validation/validate.scad
29
+ homepage: https://github.com/lostapathy/openscad-libs/
30
+ licenses:
31
+ - MIT
32
+ metadata: {}
33
+ post_install_message:
34
+ rdoc_options: []
35
+ require_paths:
36
+ - lib
37
+ required_ruby_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ required_rubygems_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ requirements: []
48
+ rubyforge_project:
49
+ rubygems_version: 2.7.3
50
+ signing_key:
51
+ specification_version: 4
52
+ summary: A collection of OpenSCAD utility code
53
+ test_files: []