jenncad 1.0.0.pre.alpha9 → 1.0.0.pre.alpha10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 93ed5b4cc8c786d306d9fbaa7c0518a607b20c76f08538a0882584ec34955ac4
4
- data.tar.gz: 5394a9131feb628a3d8f4a1d099ce75b104d0f0674c4dbb9d57db19fc555486a
3
+ metadata.gz: 14729ddf8a7adb190fd55bd555bff63515420acd3468daaa2d254a06069f213d
4
+ data.tar.gz: 41237b37c2a7bb301981fce8a44d7772e37fcd75880dba73b47872d4f9729dbe
5
5
  SHA512:
6
- metadata.gz: 29deaf817dfce550a7a3038454ddbca39c520ae1964526f7f7ebcf06edca9dbe056ec13d1f84e4390d3dbe0f043324f48c220e8bcb5a38e201b47853603bcca2
7
- data.tar.gz: c4e3a0e515ad6586fbc9919a6f0608375bf4d2babf21b8de202b308227050fae25e3db2d44ca0f4271c67854d9f57508aa5dbf04c576d562b6515ed9da6419d4
6
+ metadata.gz: 58e2c3db175c7fdbcdc34817460f44460766c4469dca347fe4a98163c2dd212e9510069f458ee152475385bb56d80f5a62b119002b8debd9c41b7a05ec567fe0
7
+ data.tar.gz: d094fd51199bb1de45d3952f9fc66f4f2aa685177f3c4064c984459b95ad4082d1af52b202bedf71a749e5a9c8347eea334042703aea5c229e591537fb9e2a5b
data/LICENSE ADDED
@@ -0,0 +1,165 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
data/examples/README ADDED
@@ -0,0 +1,4 @@
1
+ Find the examples at:
2
+
3
+ https://github.com/jglauche/jenncad-examples
4
+
data/jenncad.gemspec CHANGED
@@ -25,4 +25,5 @@ Gem::Specification.new do |gem|
25
25
  gem.add_runtime_dependency "dry-cli"
26
26
  gem.add_runtime_dependency "activesupport"
27
27
  gem.add_runtime_dependency "observr"
28
+ gem.add_runtime_dependency "logger"
28
29
  end
@@ -5,7 +5,7 @@ module JennCad
5
5
  MAGIC = "jenncad-append-project-magic"
6
6
 
7
7
  class Run < Dry::CLI::Command
8
- argument :name, required: false
8
+ argument :name, required: false, desc: "project file, defaults to dirname.rb by default"
9
9
 
10
10
  def guess_executable(dir=Dir.pwd)
11
11
  dir.split("/").last.to_s + ".rb"
@@ -42,16 +42,23 @@ module JennCad
42
42
  end
43
43
  end
44
44
 
45
- def build
46
- admesh_installed = system("admesh --version > /dev/null")
47
- unless admesh_installed
48
- puts "Warning: cannot find admesh, stl export will be in ASCII"
45
+ end
46
+
47
+ class Build < Run
48
+ option :binary, type: :boolean, default: false, desc: "run through admesh to create a binary stl"
49
+
50
+ def build(options)
51
+ if options[:binary]
52
+ admesh_installed = system("admesh --version > /dev/null")
53
+ unless admesh_installed
54
+ puts "Warning: cannot find admesh, stl export will be in ASCII"
55
+ end
49
56
  end
50
57
 
51
58
  Dir.glob("output/**/*.scad").each do |file|
52
59
  stl = file.gsub(".scad",".stl")
53
60
  build_stl(file, stl)
54
- convert_to_binary(stl) if admesh_installed
61
+ convert_to_binary(stl) if options[:binary] && admesh_installed
55
62
  end
56
63
  end
57
64
 
@@ -64,16 +71,15 @@ module JennCad
64
71
  system("admesh #{stl} -b #{stl}")
65
72
  end
66
73
 
67
- end
68
74
 
69
- class Build < Run
70
- def call(name: nil, **)
75
+ def call(options)
76
+ name = options[:name]
71
77
  unless name
72
78
  name = guess_executable
73
79
  end
74
80
  if check_executable(name)
75
81
  execute(name)
76
- build
82
+ build(options)
77
83
  end
78
84
  end
79
85
  end
@@ -4,9 +4,12 @@ module JennCad::Features
4
4
 
5
5
  def initialize(name=nil, part=nil)
6
6
  super({})
7
- @name = name
7
+ @name = name.gsub(".","_")
8
8
  @parts = [part] # NOTE: single length arrayto make checking children easier
9
- @z = part.z
9
+ end
10
+
11
+ def z
12
+ part.z
10
13
  end
11
14
 
12
15
  def part
@@ -7,6 +7,8 @@ module JennCad::Primitives
7
7
  else
8
8
  @parts = parts
9
9
  end
10
+ @parent = @parts.first.parent
11
+
10
12
  after_add
11
13
  end
12
14
 
@@ -46,6 +46,36 @@ module JennCad::Primitives
46
46
  super(z: @opts[:z])
47
47
  @h = @z.dup
48
48
  @calc_h = @z.dup
49
+
50
+ set_anchors
51
+ end
52
+
53
+ def set_anchors
54
+ @anchors = {} # this resets anchors
55
+
56
+ if @opts[:center] || @opts[:center_x]
57
+ left = -@opts[:x] / 2.0
58
+ right = @opts[:x] / 2.0
59
+ else
60
+ left = 0
61
+ right = @opts[:x]
62
+ end
63
+ if @opts[:center] || @opts[:center_y]
64
+ bottom = -@opts[:y] / 2.0
65
+ top = @opts[:y] / 2.0
66
+ else
67
+ bottom = 0
68
+ top = @opts[:y]
69
+ end
70
+
71
+ set_anchor :left, x: left
72
+ set_anchor :right, x: right
73
+ set_anchor :top, y: top
74
+ set_anchor :bottom, y: bottom
75
+ set_anchor :top_left, x: left, y: top
76
+ set_anchor :top_right, x: right, y: top
77
+ set_anchor :bottom_left, x: left, y: bottom
78
+ set_anchor :bottom_right, x: right, y: bottom
49
79
  end
50
80
 
51
81
  # used for openscad export
@@ -55,6 +85,7 @@ module JennCad::Primitives
55
85
 
56
86
  def not_centered
57
87
  @opts[:center] = false
88
+ set_anchors
58
89
  self
59
90
  end
60
91
  alias :nc :not_centered
@@ -62,20 +93,27 @@ module JennCad::Primitives
62
93
  def cx
63
94
  nc
64
95
  @opts[:center_x] = true
96
+ set_anchors
65
97
  self
66
98
  end
99
+ alias :center_x :cx
67
100
 
68
101
  def cy
69
102
  nc
70
103
  @opts[:center_y] = true
104
+ set_anchors
71
105
  self
72
106
  end
107
+ alias :center_y :cy
108
+
73
109
 
74
110
  def cz
75
111
  nc
76
112
  @opts[:center_z] = true
113
+ set_anchors
77
114
  self
78
115
  end
116
+ alias :center_z :cz
79
117
 
80
118
  def centered_axis
81
119
  return [:x, :y] if @opts[:center]
@@ -22,7 +22,7 @@ module JennCad::Primitives
22
22
  y: 0,
23
23
  z: nil,
24
24
  r: nil,
25
- flat_edges: nil,
25
+ flat_edges: [],
26
26
  center: true,
27
27
  center_y: false,
28
28
  center_x: false,
@@ -45,32 +45,42 @@ module JennCad::Primitives
45
45
  # make diameter not bigger than any side
46
46
  d = [@d, @x, @y].min
47
47
  res = HullObject.new(
48
- cylinder(d:d, h:z+z_margin),
49
- cylinder(d:d).move(x: @x - d, y: 0),
50
- cylinder(d:d).move(x: 0, y: @y - d),
51
- cylinder(d:d).move(x: @x - d, y: @y - d),
52
- ).moveh(xy: d)
48
+ cylinder(d: d, h:z+z_margin),
49
+ cylinder(d: d).move(x: @x - d, y: 0),
50
+ cylinder(d: d).move(x: 0, y: @y - d),
51
+ cylinder(d: d).move(x: @x - d, y: @y - d),
52
+ )
53
+ res = res.move(xy: d/2.0)
53
54
 
54
- res += flat_edge(@opts[:flat_edges])
55
+ @opts[:flat_edges].each do |edge|
56
+ res += apply_flat_edge(edge)
57
+ end
55
58
 
59
+ res = union(res) # put everything we have in a parent union that we can apply the transformations of this object of
56
60
  res.transformations = @transformations
61
+
57
62
  res.moveh(centered_axis.to_h{|a| [a, -@opts[a]] })
63
+ res.inherit_color(self)
58
64
  res
59
65
  end
60
66
 
61
- def flat_edge(edge)
67
+ def flat(edge)
68
+ @opts[:flat_edges] ||= []
69
+ @opts[:flat_edges] << edge
70
+ self
71
+ end
72
+
73
+ private
74
+ def apply_flat_edge(edge)
62
75
  case edge
63
- when Array
64
- #ruby2.7 test- edge.map(&self.:flat_edge)
65
- edge.map{|x| flat_edge(x) }
66
76
  when :up
67
- cube(@x, @y/2.0, @z).moveh(y:@y/2.0)
77
+ cube(x: @x, y: @y/2.0, z: @z).nc.moveh(y:@y)
68
78
  when :down
69
- cube(@x, @y/2.0, @z).moveh(y:-@y/2.0)
79
+ cube(x: @x, y: @y/2.0, z: @z).nc
70
80
  when :right
71
- cube(@x/2.0, @y, @z).moveh(x:@x/2.0)
81
+ cube(x: @x/2.0, y: @y, z: @z).nc.moveh(x:@x)
72
82
  when :left
73
- cube(@x/2.0, @y, @z).moveh(x:-@x/2.0)
83
+ cube(x: @x/2.0, y: @y, z: @z).nc
74
84
  else
75
85
  nil
76
86
  end
@@ -1,34 +1,34 @@
1
1
  module JennCad
2
2
  def circle(args)
3
- Circle.new(args)
3
+ Circle.new(args).set_parent(self)
4
4
  end
5
5
 
6
6
  def cylinder(*args)
7
- Cylinder.new(args)
7
+ Cylinder.new(args).set_parent(self)
8
8
  end
9
9
  alias :cy :cylinder
10
10
  alias :cyl :cylinder
11
11
 
12
12
  def sphere(args)
13
- Sphere.new(args)
13
+ Sphere.new(args).set_parent(self)
14
14
  end
15
15
  alias :sp :sphere
16
16
 
17
17
  def polygon(args)
18
- Polygon.new(args)
18
+ Polygon.new(args).set_parent(self)
19
19
  end
20
20
 
21
21
  def slot(*args)
22
- Slot.new(args)
22
+ Slot.new(args).set_parent(self)
23
23
  end
24
24
 
25
25
  def cube(*args)
26
- Cube.new(args)
26
+ Cube.new(args).set_parent(self)
27
27
  end
28
28
  alias :cu :cube
29
29
 
30
30
  def rounded_cube(*args)
31
- RoundedCube.new(args)
31
+ RoundedCube.new(args).set_parent(self)
32
32
  end
33
33
  alias :rcube :rounded_cube
34
34
  alias :rc :rounded_cube
data/lib/jenncad/thing.rb CHANGED
@@ -7,7 +7,8 @@ module JennCad
7
7
  attr_accessor :calc_x, :calc_y, :calc_z, :calc_h
8
8
  attr_accessor :shape
9
9
  attr_accessor :angle, :fn
10
- attr_accessor :anchor
10
+ attr_accessor :anchors
11
+ attr_accessor :parent
11
12
 
12
13
  def initialize(args={})
13
14
  @transformations = []
@@ -16,6 +17,11 @@ module JennCad
16
17
  @calc_y = 0
17
18
  @calc_z = 0
18
19
  @calc_h = args[:z] || 0
20
+ @anchors = {}
21
+ @parent = args[:parent]
22
+ if @parent
23
+ log.info "Parent: #{@parent}"
24
+ end
19
25
  @opts ||= args
20
26
  end
21
27
 
@@ -29,34 +35,30 @@ module JennCad
29
35
  @opts[key] = val
30
36
  end
31
37
 
32
- def set_anchor(args)
33
- self.anchor ||= {}
34
- args.each do |key, val|
35
- self.anchor[key] = val
36
- end
38
+ def set_parent(parent)
39
+ @parent = parent
40
+ self
37
41
  end
38
42
 
39
- def movea(key)
40
- a = self.anchor[key]
41
- unless a
42
- puts "Error: Anchor #{key} not found"
43
- puts "Available anchor: #{self.anchor}"
44
- return self
45
- else
46
- self.movei(a)
43
+ def anchor(name, thing=nil)
44
+ if thing
45
+ return thing.anchor(name)
47
46
  end
48
- end
49
-
50
- def movei(args={})
51
- to = {}
52
- [:x, :y, :z].each do |key|
53
- if args[key]
54
- to[key] = args[key]*-1
55
- end
47
+ @anchors ||= {}
48
+ if anch = @anchors[name]
49
+ return anch
50
+ elsif @parent
51
+ return @parent.anchor(name)
56
52
  end
57
- move(to)
58
53
  end
54
+ alias :a :anchor
59
55
 
56
+ def set_anchor(name, args={})
57
+ @anchors ||= {}
58
+ @anchors[name] = args
59
+ self
60
+ end
61
+ alias :sa :set_anchor
60
62
 
61
63
  def auto_extrude
62
64
  ret = self.extrude
@@ -138,10 +140,18 @@ module JennCad
138
140
  end
139
141
 
140
142
  def parse_xyz_shortcuts(args)
143
+ unless args.kind_of? Hash
144
+ $log.warn "parse_xyz_shortcuts called for type #{args.class} #{args.inspect}"
145
+ return args
146
+ end
141
147
  [:x, :y, :z].each do |key|
142
148
  args[key] ||= 0.0
143
149
  end
144
150
 
151
+ if args[:debug]
152
+ $log.debug "Args: #{args}"
153
+ end
154
+
145
155
  if args[:xy]
146
156
  args[:x] += args[:xy]
147
157
  args[:y] += args[:xy]
@@ -159,7 +169,11 @@ module JennCad
159
169
  args[:y] += args[:yz]
160
170
  args[:z] += args[:yz]
161
171
  end
162
- return args
172
+ if args[:debug]
173
+ $log.debug "After xyz shortcuts #{args}"
174
+ end
175
+
176
+ return args
163
177
  end
164
178
 
165
179
  def move(args={})
@@ -195,6 +209,31 @@ module JennCad
195
209
  move(z:v)
196
210
  end
197
211
 
212
+ # move to anchor
213
+ def movea(key, thing=nil)
214
+ an = anchor(key, thing)
215
+ unless an
216
+ $log.error "Error: Anchor #{key} not found"
217
+ $log.error "Available anchors: #{@anchors}"
218
+ return self
219
+ else
220
+ self.move(an.dup)
221
+ end
222
+ end
223
+
224
+ # move to anchor - inverted
225
+ def moveai(key, thing=nil)
226
+ an = anchor(key, thing)
227
+ unless an
228
+ $log.error "Error: Anchor #{key} not found"
229
+ $log.error "Available anchors: #{@anchors}"
230
+ return self
231
+ else
232
+ self.movei(an.dup)
233
+ end
234
+ end
235
+
236
+
198
237
  # move half
199
238
  def moveh(args={})
200
239
  if args.kind_of? Array
@@ -221,6 +260,16 @@ module JennCad
221
260
  moveh(z:v)
222
261
  end
223
262
 
263
+ def movei(args={})
264
+ to = {}
265
+ [:x, :y, :z, :xy, :xz, :yz, :xyz].each do |key|
266
+ if args[key]
267
+ to[key] = args[key]*-1
268
+ end
269
+ end
270
+ move(to)
271
+ end
272
+
224
273
  def mirror(args={})
225
274
  @transformations ||= []
226
275
  @transformations << Mirror.new(args)
@@ -228,6 +277,19 @@ module JennCad
228
277
  end
229
278
  alias :mi :mirror
230
279
 
280
+ def miz
281
+ mirror(z:1)
282
+ end
283
+
284
+ def miy
285
+ mirror(y:1)
286
+ end
287
+
288
+ def miz
289
+ mirror(z:1)
290
+ end
291
+
292
+
231
293
  def scale(args={})
232
294
  if args.kind_of? Numeric or args.kind_of? Array
233
295
  args = {v:args}
@@ -313,6 +375,11 @@ module JennCad
313
375
  end
314
376
  =end
315
377
 
378
+ def inherit_color(other)
379
+ self.set_option(:color, other.option(:color))
380
+ self.set_option(:auto_color, other.option(:auto_color))
381
+ end
382
+
316
383
  def has_explicit_color?
317
384
  if option(:auto_color) == false
318
385
  return true
@@ -1,4 +1,4 @@
1
1
  module JennCad
2
- VERSION = "1.0.0-alpha9"
2
+ VERSION = "1.0.0-alpha10"
3
3
  end
4
4
 
data/lib/jenncad.rb CHANGED
@@ -1,3 +1,6 @@
1
+ require "logger"
2
+ $log = Logger.new(STDOUT)
3
+
1
4
  require "geo3d"
2
5
  require "deep_merge"
3
6
  require "fileutils"
data/todo.txt CHANGED
@@ -1,29 +1,59 @@
1
1
  1.0 required features
2
2
  ===================
3
3
 
4
- - cli needs to be a package manager for existing parts from a public library (i.e. bolts, motors go here), able to
5
- -- query
6
- -- download
7
- -- update
8
- (upload? -> probably git pull request for now)
9
- - add external projects into one another (for example: make parts, show arrangement of a shelf in another project)
10
-
11
4
  - slot with square ends -> rounded cube with one side = d + flat_edges does that. Should slot do that in reverse?
12
5
 
13
- - de-centering a cube in one direction sucks, you have to add both center: false, center_x: true
14
- -> decenter ?
15
-
16
6
  - bolt library needs to get a rewrite,
17
7
  - fetching dimensions from the imported Bolt library should be less awful
18
8
 
19
9
  - needs a documentation and showcase
20
10
 
11
+ Features wanted
12
+ ===================
13
+ 28.4.22:
14
+ - Parts often come with 4 holes around a center, and I often do something like:
15
+
16
+ [-1, 1].each do |i|
17
+ [-1, 1].each do |j|
18
+ res += @bolt.cut.move(x: @hole_center*i, y: @hole_center*j)
19
+ end
20
+ end
21
+
22
+ there should be a shorter way to do this.
23
+
24
+
25
+ - instead of moving Bolts output, make it the default to make their positions an anchor
26
+
27
+ - Bolt size data should be in a constant instead of one "Data" constant i.e.
28
+ M2_5.head_dia
29
+ M2_5.head_h
30
+ M2_5_hole
31
+
32
+ - Bolt sizes should follow user configuration that can change margins
33
+ - Bolts should have an easier way to align than mirror them, maybe from :top
34
+ - but also, when you have a part that can be mounted in any top/bottom direction, you always end up having the bolts facing the wrong direction..
35
+ - Bolts should be able to also make thread inserts
36
+
37
+
38
+
39
+
21
40
  other awful things
22
41
  ===================
23
42
 
24
- - command line interface isn't capable of adding parts to the output automatically
43
+ - cli needs to use templates and user defined templates, profile loader needs to have this.
25
44
 
26
45
  - user profile file should be auto generated with examples
27
46
 
28
- - switching back and forth from and to openscad for preview sucks (that being said, switching from vim to something else would be awful to me)
47
+
48
+ Future plans
49
+ ==================
50
+
51
+ - cli needs to be a package manager for existing parts from a public library (i.e. bolts, motors go here), able to
52
+ -- query
53
+ -- download
54
+ -- update
55
+ (upload? -> probably git pull request for now)
56
+ - add external projects into one another (for example: make parts, show arrangement of a shelf in another project)
57
+
58
+
29
59
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jenncad
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.alpha9
4
+ version: 1.0.0.pre.alpha10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jennifer Glauche
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-24 00:00:00.000000000 Z
11
+ date: 2022-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: geo3d
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: logger
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  description: TBD
84
98
  email:
85
99
  - "=^.^=@jenncad.kittenme.ws"
@@ -88,17 +102,11 @@ executables:
88
102
  extensions: []
89
103
  extra_rdoc_files: []
90
104
  files:
105
+ - LICENSE
91
106
  - README.md
92
107
  - Rakefile
93
108
  - bin/jenncad
94
- - examples/old/cube.rb
95
- - examples/old/slot.rb
96
- - examples/old/test.rb
97
- - examples/old/test1.rb
98
- - examples/old/test2.rb
99
- - examples/old/test3.rb
100
- - examples/old/test4.rb
101
- - examples/old/test5.rb
109
+ - examples/README
102
110
  - jenncad.gemspec
103
111
  - lib/jenncad.rb
104
112
  - lib/jenncad/commands.rb
data/examples/old/cube.rb DELETED
@@ -1,12 +0,0 @@
1
- require 'rubygems'
2
- require 'jenncad'
3
- include JennCad
4
-
5
- # cubes are centered in x,y and flat to z=0 by default
6
- res = cube(40,30,20)
7
- # if symbols are omitted first argument of cylinder is d (diameter), second is height
8
- # if height is omitted, it will assume height of first suitable parent object. This only works for z direction
9
- # if height is omitted, it will also reward you with automatic z-fighting. For other cuts it'll try to do the same but is not so smart
10
- res -= cylinder(5)
11
-
12
- res.openscad("cube.scad")
data/examples/old/slot.rb DELETED
@@ -1,10 +0,0 @@
1
- require 'rubygems'
2
- require 'jenncad'
3
- include JennCad
4
-
5
- res = cube(30,30,10)
6
-
7
- res -= slot(d:10, x:20, a:30).move(x:5)
8
- res -= slot(d:10, x:20, a:-30).move(x:5)
9
-
10
- res.openscad("slot.scad")
data/examples/old/test.rb DELETED
@@ -1,18 +0,0 @@
1
- require 'jenncad'
2
- include JennCad
3
- include JennCad::Extras
4
- Nut = Din934
5
-
6
- res = cylinder(d:40,h:20)
7
-
8
- n = Nut.new(4)
9
- res -= n.cut
10
-
11
- n = Nut.new(4)
12
- res -= n.cut.translate(x:20)
13
- res += n.show.translate(x:20)
14
-
15
-
16
-
17
- a = OpenScad.new(res)
18
- a.save("examples/test1.scad")
@@ -1,21 +0,0 @@
1
- require 'rubygems'
2
- require 'jenncad'
3
- include JennCad
4
- include JennCad::Extras
5
- Nut = Din934
6
-
7
- h1 = 10
8
- h2 = 20
9
- res = cube([10,20,h1])
10
- res += cylinder(d:40,h:h2).move(z:h1)
11
-
12
-
13
- n = Nut.new(4)
14
- res -= n.cut
15
-
16
- n = Nut.new(4)
17
- res -= n.cut.move(z:h1+h2-n.height)
18
-
19
-
20
-
21
- res.openscad("examples/test1.scad")
@@ -1,9 +0,0 @@
1
- require 'jenncad'
2
- include JennCad
3
-
4
- res = import("involute_gears","bevel_gear",number_of_teeth:13, bore_diameter:10)
5
- res += import("involute_gears","bevel_gear",number_of_teeth:6, bore_diameter:5).rotate(x:90).translate(y:50,z:30)
6
-
7
-
8
- a = OpenScad.new(res)
9
- a.save("examples/test2.scad")
@@ -1,15 +0,0 @@
1
- require 'rubygems'
2
- require 'jenncad'
3
- include JennCad
4
- include JennCad::Extras
5
- Nut = Din934
6
-
7
- res = cylinder(d:40,h:20)
8
- res &= cylinder(d:40,h:20).translate(x:20)
9
- res &= cube([20,20,20]).translate(y:20)
10
-
11
- res.skew(y:-0.3)
12
-
13
-
14
- a = OpenScad.new(res)
15
- a.save("examples/test3.scad")
@@ -1,17 +0,0 @@
1
- require 'rubygems'
2
- require 'jenncad'
3
- include JennCad
4
- include JennCad::Extras
5
- Nut = Din934
6
-
7
- res = cube([30,30,10]).center_xy
8
- res -= cylinder(d:20,h:2)
9
-
10
- cyl = cylinder(d:10,h:5).translate(z:5)
11
- res -= cyl
12
-
13
- puts cyl.calc_z+cyl.calc_h
14
-
15
-
16
- a = OpenScad.new(res)
17
- a.save("examples/test4.scad")
@@ -1,31 +0,0 @@
1
- require 'rubygems'
2
- require 'jenncad'
3
- include JennCad
4
- include JennCad::Extras
5
- Nut = Din934
6
-
7
- res = cube([30,30,10]).center_xy
8
- # at this moment, res is a cube
9
- res.color = "Blue"
10
-
11
- res += cylinder(d:10,h:20)
12
- # with the += operator, res is now a union boolean object
13
- res.color [120,20,13,200]
14
-
15
- # everything added to the union will remain this color
16
- res += cylinder(d:6,h:25)
17
-
18
- # unless specified otherwise
19
- res += cylinder(d:5, h:30).color("red")
20
-
21
-
22
-
23
- # subtracting will change res to a subtraction object
24
- res -= cylinder(d:4, h:30)
25
- res += cylinder(d:2, h:40)
26
- res.color("green")
27
-
28
-
29
-
30
- a = OpenScad.new(res)
31
- a.save("examples/test5.scad")