jenncad 1.0.0.pre.alpha17 → 1.0.0.pre.alpha20
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b40abab4dd5266ab776011e3f74da94297c9dfb0970323c5b9b07dcd6b61e8b
|
4
|
+
data.tar.gz: be32b5395b42f0d77d21ab0e6e5494a07d0b0716b5fc995b2838824197439c3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e38fafc310e30794502cec692ae8882a8335c24c332e64c13aa242bf9686d5905eef785758bc6862718e8ef8e2255d0fcf6df542dea63062b131a35fe0935adf
|
7
|
+
data.tar.gz: 170b50b86a8207e2875fd84943b1af9bad9a528054e947417f1c324578c50d897527d66115aa47b23307d696f205f8cd226268496f50d0ed75b40122b07e9a9e
|
data/lib/jenncad/part.rb
CHANGED
@@ -7,6 +7,11 @@ module JennCad::Primitives
|
|
7
7
|
else
|
8
8
|
@parts = parts
|
9
9
|
end
|
10
|
+
|
11
|
+
if @parts.first.respond_to? :anchors
|
12
|
+
@anchors = @parts.first.anchors
|
13
|
+
end
|
14
|
+
|
10
15
|
if parts.first && parts.first.respond_to?(:debug?) && parts.first.debug?
|
11
16
|
$log.debug("Creating new #{self.class} for part #{parts}")
|
12
17
|
end
|
@@ -10,10 +10,15 @@ module JennCad::Primitives
|
|
10
10
|
@twist = args[:twist]
|
11
11
|
@slices = args[:slices]
|
12
12
|
@fn = args[:fn]
|
13
|
+
@opts = {
|
14
|
+
margins: {
|
15
|
+
z: 0,
|
16
|
+
}
|
17
|
+
}.deep_merge(args)
|
13
18
|
end
|
14
19
|
|
15
20
|
def height
|
16
|
-
@z
|
21
|
+
@z.to_d + @opts[:margins][:z].to_d
|
17
22
|
end
|
18
23
|
|
19
24
|
def openscad_params
|
@@ -45,7 +45,6 @@ module JennCad::Primitives
|
|
45
45
|
end
|
46
46
|
init(args)
|
47
47
|
|
48
|
-
|
49
48
|
handle_margins
|
50
49
|
handle_diameter
|
51
50
|
if @opts[:z] && opts[:z].to_d > 0
|
@@ -53,7 +52,7 @@ module JennCad::Primitives
|
|
53
52
|
else
|
54
53
|
@dimensions = [:x, :y]
|
55
54
|
end
|
56
|
-
|
55
|
+
set_anchors
|
57
56
|
end
|
58
57
|
|
59
58
|
def to_openscad
|
data/lib/jenncad/thing.rb
CHANGED
@@ -47,7 +47,6 @@ module JennCad
|
|
47
47
|
self
|
48
48
|
end
|
49
49
|
|
50
|
-
|
51
50
|
def cut_to(face, part=nil, args={})
|
52
51
|
an = anchor(face, part)
|
53
52
|
unless an
|
@@ -145,6 +144,20 @@ module JennCad
|
|
145
144
|
end
|
146
145
|
alias :sa :set_anchor
|
147
146
|
|
147
|
+
def copy_anchors(thing)
|
148
|
+
@anchors = thing.anchors
|
149
|
+
end
|
150
|
+
|
151
|
+
def copy_anchor(name, thing=nil)
|
152
|
+
# since it might be confusing to use / use shortcuts for copy_anchor and copy_anchors, let copy_anchor copy all of them when only one parameter is given
|
153
|
+
if thing.nil?
|
154
|
+
return copy_anchors(name)
|
155
|
+
end
|
156
|
+
@anchors ||= {}
|
157
|
+
@anchors[name] = thing.anchor(name)
|
158
|
+
end
|
159
|
+
alias :cpa :copy_anchor
|
160
|
+
|
148
161
|
def set_anchor_from(name, new_name, args={})
|
149
162
|
unless name.kind_of? Symbol or name.kind_of? String
|
150
163
|
$log.error "set_anchor_from: name must be a string or symbol. Supplied: #{name}"
|
@@ -363,6 +376,29 @@ module JennCad
|
|
363
376
|
move(z:v)
|
364
377
|
end
|
365
378
|
|
379
|
+
# Perform something at an anchor location block
|
380
|
+
def at(keys, thing=nil, args={}, &block)
|
381
|
+
unless keys.kind_of? Array
|
382
|
+
keys = [keys]
|
383
|
+
end
|
384
|
+
|
385
|
+
part = self
|
386
|
+
keys.each do |key|
|
387
|
+
if key.kind_of? Hash
|
388
|
+
an = key
|
389
|
+
else
|
390
|
+
an = anchor(key, thing, args)
|
391
|
+
end
|
392
|
+
unless an
|
393
|
+
$log.error "at on #{thing.class} could not find anchor #{key}"
|
394
|
+
an = {} # this will move by 0,0 and still display the block
|
395
|
+
end
|
396
|
+
part.movei(an)
|
397
|
+
part = block.yield.move(an)
|
398
|
+
end
|
399
|
+
part
|
400
|
+
end
|
401
|
+
|
366
402
|
# move to anchor
|
367
403
|
def movea(key, thing=nil, args={})
|
368
404
|
if thing.kind_of? Hash # if you leave out thing, args may be interpreted as thing
|
@@ -445,8 +481,8 @@ module JennCad
|
|
445
481
|
end
|
446
482
|
alias :mi :mirror
|
447
483
|
|
448
|
-
def
|
449
|
-
mirror(
|
484
|
+
def mix
|
485
|
+
mirror(x:1)
|
450
486
|
end
|
451
487
|
|
452
488
|
def miy
|
data/lib/jenncad/version.rb
CHANGED
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.
|
4
|
+
version: 1.0.0.pre.alpha20
|
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-05-
|
11
|
+
date: 2022-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: geo3d
|