circuitdata 0.8.0 → 0.9.0

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: c49e6b15e75ca8c402c0807a9d241ba30cd9dd207c125fe3f1f6ae87da303960
4
- data.tar.gz: cd912f52fb9c29398623954865938385f44a20fe0e1135d439d1a99e667c85f3
3
+ metadata.gz: e70e5e3c4070c9ebe96c6aa365547551226bc5cb5e4c3c9f37ad95422dbb3aff
4
+ data.tar.gz: 12f7b26c99c0ff549cea2c05f2ea197f5190bb3752f9b625b1336fb39d690b64
5
5
  SHA512:
6
- metadata.gz: 547b8febd516827f0c4c91b4d5849d7f36d0b5683a5ea2bed706c33a882568ad05859a88c049fc788e0a99d90dd37df215f75bdd6c9b9e0bc577a133102804f9
7
- data.tar.gz: a052c9c068b168c7316c4763a17bde9d2298c15484a4502f870e292ca4bb51e342d04a12cbdcd668886cd1d4b8b2e89f4dcc01aabb43aad186fb5d757213d20c
6
+ metadata.gz: e4dda4f6ba82769c6c0050a63587d971f41eeb4b3fe508e0c954775cdc1326241fa3648afad01feb5a7ae60dc269d7118274f5d394108cf01b4c1f9c23700329
7
+ data.tar.gz: 0f6c9336a9b67492bdce5a9a1ba6602abb8e2ac3b211038476186f418628f7c4a90c45a94a96efb2b9151631a3be99dee5a55eb5ca84ba8741f18ae9f81703d5
@@ -17,8 +17,8 @@ module Circuitdata
17
17
  require_relative "./circuitdata/exposed_area"
18
18
  require_relative "./circuitdata/summary"
19
19
 
20
- SCHEMA_BASE_PATH = File.join(__dir__, "circuitdata/schema_files/v1")
21
- SCHEMA_FULL_PATH = File.join(SCHEMA_BASE_PATH, "..", "schema_v1_dereferenced.json")
20
+ SCHEMA_BASE_PATH = File.join(__dir__, "circuitdata/schema_files/current")
21
+ SCHEMA_FULL_PATH = File.join(SCHEMA_BASE_PATH, "..", "schema_current_dereferenced.json")
22
22
  DEFINITIONS_FULL_PATH = File.join(
23
23
  SCHEMA_BASE_PATH, "ottp_circuitdata_schema_definitions.json"
24
24
  )
@@ -574,11 +574,7 @@
574
574
  "properties": {
575
575
  "size_x": { "type": "number", "uom": "mm" },
576
576
  "size_y": { "type": "number", "uom": "mm" },
577
- "area": { "type": "number", "uom": "mm" },
578
- "breakaway_method": {
579
- "type": "string",
580
- "enum": ["routing", "punching"]
581
- },
577
+ "area": { "type": "number", "uom": "mm2" },
582
578
  "thickness": { "type": "number", "uom": "mm" }
583
579
  }
584
580
  },
@@ -607,7 +603,7 @@
607
603
  "type": "array",
608
604
  "items": {
609
605
  "type": "string",
610
- "enum": ["routing", "scoring", "punching", "v_cut", "v_grove", "jump_scoring"]
606
+ "enum": ["routing", "scoring", "punching", "jump_scoring"]
611
607
  }
612
608
  },
613
609
  "mouse_bites": { "type": "boolean" },
@@ -688,7 +684,7 @@
688
684
  "type": "array",
689
685
  "items": {
690
686
  "type": "string",
691
- "enum": ["ul", "c_ul", "rohs", "ul94", "iec_61249-2-21", "esa", "itar", "dfars", "mil_prf_55110", "mil_prf_50884", "mil_prf_31032", "as9100", "nadcap", "rw_en45545_2_2013", "rw_nf_f_16_101", "rw_uni_cei_11170_3", "rw_nfpa_130"]
687
+ "enum": ["ul94", "c_ul", "rohs", "iec_61249-2-21", "esa", "itar", "dfars", "mil_prf_55110", "mil_prf_50884", "mil_prf_31032", "as9100", "nadcap", "rw_en45545_2_2013", "rw_nf_f_16_101", "rw_uni_cei_11170_3", "rw_nfpa_130"]
692
688
  }
693
689
  },
694
690
  "ipc_6010_class": {
@@ -728,7 +724,11 @@
728
724
  "type": "string",
729
725
  "enum": ["1", "2", "3"]
730
726
  },
731
- "ipc_6018": { "type": "boolean" }
727
+ "ipc_6018": { "type": "boolean" },
728
+ "ipc_a600_class": {
729
+ "type": "string",
730
+ "enum": ["1", "2", "3"]
731
+ }
732
732
  }
733
733
  },
734
734
  "testing": {
@@ -1290,14 +1290,7 @@
1290
1290
  },
1291
1291
  "area": {
1292
1292
  "type": "number",
1293
- "uom": "mm"
1294
- },
1295
- "breakaway_method": {
1296
- "type": "string",
1297
- "enum": [
1298
- "routing",
1299
- "punching"
1300
- ]
1293
+ "uom": "mm2"
1301
1294
  },
1302
1295
  "thickness": {
1303
1296
  "type": "number",
@@ -1374,8 +1367,6 @@
1374
1367
  "routing",
1375
1368
  "scoring",
1376
1369
  "punching",
1377
- "v_cut",
1378
- "v_grove",
1379
1370
  "jump_scoring"
1380
1371
  ]
1381
1372
  }
@@ -1512,10 +1503,9 @@
1512
1503
  "items": {
1513
1504
  "type": "string",
1514
1505
  "enum": [
1515
- "ul",
1506
+ "ul94",
1516
1507
  "c_ul",
1517
1508
  "rohs",
1518
- "ul94",
1519
1509
  "iec_61249-2-21",
1520
1510
  "esa",
1521
1511
  "itar",
@@ -1586,6 +1576,14 @@
1586
1576
  },
1587
1577
  "ipc_6018": {
1588
1578
  "type": "boolean"
1579
+ },
1580
+ "ipc_a600_class": {
1581
+ "type": "string",
1582
+ "enum": [
1583
+ "1",
1584
+ "2",
1585
+ "3"
1586
+ ]
1589
1587
  }
1590
1588
  }
1591
1589
  },
@@ -1,78 +1,52 @@
1
- require 'bigdecimal'
1
+ require "bigdecimal"
2
+
2
3
  module Circuitdata
3
4
  class Summary
4
-
5
- SUMMARY_FIELDS = [
6
- :base_materials,
7
- :number_of_conductive_layers,
8
- :board_outline,
9
- :final_thickness,
10
- :minimum_track,
11
- :minimum_spacing,
12
- :min_through_hole_size,
13
- :max_aspect_ratio
14
- ]
15
-
16
5
  def initialize(product)
17
6
  @product = product
18
7
  end
19
8
 
20
- def data
21
- d = {}
22
- SUMMARY_FIELDS.each do |key|
23
- d[key] = send(key)
24
- end
25
- d
26
- end
27
-
28
- private
29
-
30
- # helper functions
31
9
  def conductive_layers
32
10
  layers_with_function("conductive")
33
11
  end
34
12
 
35
13
  def board_area
36
- # try adding up all sections
37
- sizes = @product.sections.map{|section| section[:mm2]}
38
- sizes.compact.inject(0, :+)
14
+ sizes = @product.sections.map { |section| section[:mm2] }
15
+ sizes.compact.sum
39
16
  end
40
17
 
41
18
  def layers_with_function(func)
42
- @product.layers.select{ |layer| layer[:function] == func}
19
+ @product.layers.select { |layer| layer[:function] == func }
43
20
  end
44
21
 
45
- # mapping
46
22
  def base_materials
47
23
  dielectrics = layers_with_function("dielectric")
48
24
  return nil if dielectrics.length == 0
49
- flexes = dielectrics.map{|d| d.dig(:flexible)}.compact.uniq
50
- return "Flexible" if flexes === [true]
51
- return "Rigid" if flexes === [false]
25
+
26
+ flexes = dielectrics.map { |d| d.dig(:flexible) }.compact.uniq
27
+ return "Flexible" if flexes == [true]
28
+ return "Rigid" if flexes == [false]
52
29
  return "Rigid Flex" if flexes.length == 2
53
30
  return "Unknown" # dielectric is present, but does not have flex info.
54
31
  end
55
32
 
56
- # Return number of conductive layers
57
33
  def number_of_conductive_layers
58
- if conductive_layers.length > 0
59
- return conductive_layers.length
60
- end
34
+ conductive_layers.length
61
35
  end
62
36
 
63
37
  def minimum_track
64
- conductive_layers.map { |layer| layer.dig(:layer_attributes, :minimum_track_width)}.compact.min
38
+ conductive_layers.map { |layer| layer.dig(:layer_attributes, :minimum_track_width) }.compact.min
65
39
  end
66
40
 
67
41
  def minimum_spacing
68
- conductive_layers.map { |layer| layer.dig(:layer_attributes, :minimum_spacing_width)}.compact.min
42
+ conductive_layers.map { |layer| layer.dig(:layer_attributes, :minimum_spacing_width) }.compact.min
69
43
  end
70
44
 
71
45
  def board_outline
72
46
  array = @product.metrics.fetch(:board, {})
73
47
  size_x = array[:size_x]
74
48
  size_y = array[:size_y]
75
- return size_x.to_s+" x "+size_y.to_s+" mm" if size_x && size_y
49
+ return size_x.to_s + " x " + size_y.to_s + " mm" if size_x && size_y
76
50
  end
77
51
 
78
52
  def final_thickness
@@ -80,16 +54,15 @@ module Circuitdata
80
54
  end
81
55
 
82
56
  def min_through_hole_size
83
- @product.processes.map{ |process| process.dig(:function_attributes,:finished_size)}.compact.min
57
+ @product.processes.select { |process| process.dig(:function_attributes, :hole_type) == "through" }
58
+ .map { |process| process.dig(:function_attributes, :finished_size) }.compact.min
84
59
  end
85
60
 
86
61
  def max_aspect_ratio
87
- if final_thickness
88
- if min_through_hole_size
89
- th = BigDecimal(min_through_hole_size.to_s)/1000.0
90
- ft = BigDecimal(final_thickness.to_s)
91
- return (ft/th).truncate(2).to_s.to_f
92
- end
62
+ if final_thickness && min_through_hole_size
63
+ th = BigDecimal(min_through_hole_size.to_s) / 1000.0
64
+ ft = BigDecimal(final_thickness.to_s)
65
+ return (ft / th).truncate(2).to_s.to_f
93
66
  end
94
67
  end
95
68
  end
@@ -1,4 +1,4 @@
1
1
  module Circuitdata
2
- VERSION = "0.8.0"
2
+ VERSION = "0.9.0"
3
3
  SCHEMA_VERSION = 1.0
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: circuitdata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Lydersen
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-02-05 00:00:00.000000000 Z
13
+ date: 2019-03-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json-schema
@@ -176,12 +176,12 @@ files:
176
176
  - lib/circuitdata/product_id_validator.rb
177
177
  - lib/circuitdata/profile.rb
178
178
  - lib/circuitdata/schema.rb
179
- - lib/circuitdata/schema_files/schema_v1_dereferenced.json
180
- - lib/circuitdata/schema_files/v1/ottp_circuitdata_schema.json
181
- - lib/circuitdata/schema_files/v1/ottp_circuitdata_schema_generics.json
182
- - lib/circuitdata/schema_files/v1/ottp_circuitdata_schema_materials.json
183
- - lib/circuitdata/schema_files/v1/ottp_circuitdata_schema_products.json
184
- - lib/circuitdata/schema_files/v1/ottp_circuitdata_schema_profiles_and_capabilities.json
179
+ - lib/circuitdata/schema_files/current/ottp_circuitdata_schema.json
180
+ - lib/circuitdata/schema_files/current/ottp_circuitdata_schema_generics.json
181
+ - lib/circuitdata/schema_files/current/ottp_circuitdata_schema_materials.json
182
+ - lib/circuitdata/schema_files/current/ottp_circuitdata_schema_products.json
183
+ - lib/circuitdata/schema_files/current/ottp_circuitdata_schema_profiles_and_capabilities.json
184
+ - lib/circuitdata/schema_files/schema_current_dereferenced.json
185
185
  - lib/circuitdata/summary.rb
186
186
  - lib/circuitdata/validator.rb
187
187
  - lib/circuitdata/version.rb
@@ -204,8 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
204
204
  - !ruby/object:Gem::Version
205
205
  version: '0'
206
206
  requirements: []
207
- rubyforge_project:
208
- rubygems_version: 2.7.6
207
+ rubygems_version: 3.0.1
209
208
  signing_key:
210
209
  specification_version: 4
211
210
  summary: Basic test and comparison of JSON files agains the CircuitData JSON schema