jenncad 1.0.0.pre.alpha19 → 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: 2088ad700952d85766093d0d494281c6117c0cf628a6307840131ec38314f832
4
- data.tar.gz: 2a68a98e3fcc5d3c6008f8907ad72eab028e95d8021aa432dec93cd21993dd95
3
+ metadata.gz: 4b40abab4dd5266ab776011e3f74da94297c9dfb0970323c5b9b07dcd6b61e8b
4
+ data.tar.gz: be32b5395b42f0d77d21ab0e6e5494a07d0b0716b5fc995b2838824197439c3c
5
5
  SHA512:
6
- metadata.gz: f96b42ef5e8f8ab836a900c96b83cbee8ed2c91cc0f83631e650adbc27d6e4ec2ba91cf5f94fa8424b420d4951a3a80cae52012e6d7013abdaf8b10e0c141283
7
- data.tar.gz: 80f3f16a02f07b664efed6ba0a25f786720269de165f98532c1ab18b674f11e86fb59cf62bd7a787777e9e71d9dcd9556184b0a637f7ec98aa1b6a494e23dcec
6
+ metadata.gz: e38fafc310e30794502cec692ae8882a8335c24c332e64c13aa242bf9686d5905eef785758bc6862718e8ef8e2255d0fcf6df542dea63062b131a35fe0935adf
7
+ data.tar.gz: 170b50b86a8207e2875fd84943b1af9bad9a528054e947417f1c324578c50d897527d66115aa47b23307d696f205f8cd226268496f50d0ed75b40122b07e9a9e
data/lib/jenncad/part.rb CHANGED
@@ -10,6 +10,8 @@ end
10
10
  module JennCad
11
11
  # Part should be inherited from the user when making parts
12
12
  class Part < Thing
13
+ attr_accessor :d
14
+
13
15
  def self.inherited(subclass)
14
16
  subclass.prepend(AutoName) if subclass.superclass == Part
15
17
  end
@@ -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
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
@@ -1,3 +1,3 @@
1
1
  module JennCad
2
- VERSION = "1.0.0-alpha19"
2
+ VERSION = "1.0.0-alpha20"
3
3
  end
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.alpha19
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-16 00:00:00.000000000 Z
11
+ date: 2022-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: geo3d