ruby3mf 0.1.2 → 0.1.3
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.
- checksums.yaml +4 -4
- data/lib/ruby3mf.rb +1 -0
- data/lib/ruby3mf/document.rb +4 -4
- data/lib/ruby3mf/log3mf.rb +11 -4
- data/lib/ruby3mf/texture3mf.rb +11 -0
- data/lib/ruby3mf/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c3c875e13f40a3230c7146228502167eae4452b
|
4
|
+
data.tar.gz: e572579b6da6f51705ced9dded95eec810a2230f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3eda18a557d21f60cf8236786002085afa545236e206df90794f66341125f447e48ffa1189a898786cabb678cab74f650f45867a49938abfea82072129d20fb8
|
7
|
+
data.tar.gz: e4da8cb5bdab1a1fac1b36cfa351d542ebcef28738c13716d6dc928ebcb7dc7b8978d2b7bba7d20ce51107f989bb4ee3eaf2b7cc64351787bf1f1432417f8bcc
|
data/lib/ruby3mf.rb
CHANGED
data/lib/ruby3mf/document.rb
CHANGED
@@ -2,19 +2,19 @@ class Document
|
|
2
2
|
|
3
3
|
attr_accessor :models
|
4
4
|
attr_accessor :thumbnails
|
5
|
-
|
5
|
+
attr_accessor :textures
|
6
6
|
|
7
7
|
# Relationship Type => Class validating relationship type
|
8
8
|
RELATIONSHIP_TYPES = {
|
9
9
|
'http://schemas.microsoft.com/3dmanufacturing/2013/01/3dmodel' => {klass: 'Model3mf', collection: :models},
|
10
|
-
'http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail' => {klass: 'Thumbnail3mf', collection: :thumbnails}
|
11
|
-
|
10
|
+
'http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail' => {klass: 'Thumbnail3mf', collection: :thumbnails},
|
11
|
+
'http://schemas.microsoft.com/3dmanufacturing/2013/01/3dtexture' => {klass: 'Texture3mf', collection: :textures}
|
12
12
|
}
|
13
13
|
|
14
14
|
def initialize
|
15
15
|
self.models=[]
|
16
16
|
self.thumbnails=[]
|
17
|
-
|
17
|
+
self.textures=[]
|
18
18
|
end
|
19
19
|
|
20
20
|
def self.read(input_file)
|
data/lib/ruby3mf/log3mf.rb
CHANGED
@@ -89,14 +89,21 @@ class Log3mf
|
|
89
89
|
Log3mf.instance.entries(*l)
|
90
90
|
end
|
91
91
|
|
92
|
-
def spec_link(page)
|
93
|
-
|
92
|
+
def spec_link(spec, page)
|
93
|
+
spec = :core unless spec
|
94
|
+
doc_urls={
|
95
|
+
core: 'http://3mf.io/wp-content/uploads/2016/03/3MFcoreSpec_1.1.pdf',
|
96
|
+
material: 'http://3mf.io/wp-content/uploads/2015/04/3MFmaterialsSpec_1.0.1.pdf',
|
97
|
+
production: 'http://3mf.io/wp-content/uploads/2016/07/3MFproductionSpec.pdf',
|
98
|
+
slice: 'http://3mf.io/wp-content/uploads/2016/07/3MFsliceSpec.pdf'
|
99
|
+
}
|
100
|
+
"#{doc_urls[spec]}#page=#{page}"
|
94
101
|
end
|
95
102
|
|
96
103
|
def to_json
|
97
104
|
@log_list.collect { |ent|
|
98
105
|
h = { context: ent[0], severity: ent[1], message: ent[2] }
|
99
|
-
h[:spec_ref] = spec_link(ent[3][:page]) if (ent[3] && ent[3][:page])
|
106
|
+
h[:spec_ref] = spec_link(ent[3][:spec], ent[3][:page]) if (ent[3] && ent[3][:page])
|
100
107
|
h
|
101
108
|
}.to_json
|
102
109
|
end
|
@@ -115,7 +122,7 @@ class Log3mf
|
|
115
122
|
@log_list.each do |logline|
|
116
123
|
msg = logline[2]
|
117
124
|
if logline[3] && logline[3][:page]
|
118
|
-
msg = "<a href=\"#{spec_link(logline[3][:page])}\" target=\"_blank\">#{msg}</a>"
|
125
|
+
msg = "<a href=\"#{spec_link(logline[3][:spec], logline[3][:page])}\" target=\"_blank\">#{msg}</a>"
|
119
126
|
end
|
120
127
|
s << "[#{logline[0].ljust(longest_context)}] #{logline[1].to_s.upcase.ljust(longest_severity)} #{msg}"
|
121
128
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class Texture3mf
|
2
|
+
|
3
|
+
def self.parse(relationship_file, relationships)
|
4
|
+
img_type = MimeMagic.by_magic(relationship_file.get_input_stream)
|
5
|
+
Log3mf.context "Texture3mf" do |l|
|
6
|
+
l.debug "texture is of type: #{img_type}"
|
7
|
+
l.error "Expected a png or jpeg texture but the texture was of type #{img_type}", spec: :material, page: 16 unless ['image/png', 'image/jpeg'].include? img_type.type
|
8
|
+
end
|
9
|
+
|
10
|
+
end
|
11
|
+
end
|
data/lib/ruby3mf/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby3mf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Whitmarsh, Jeff Porter, and William Hertling
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -122,6 +122,7 @@ files:
|
|
122
122
|
- lib/ruby3mf/log3mf.rb
|
123
123
|
- lib/ruby3mf/model3mf.rb
|
124
124
|
- lib/ruby3mf/relationships.rb
|
125
|
+
- lib/ruby3mf/texture3mf.rb
|
125
126
|
- lib/ruby3mf/thumbnail3mf.rb
|
126
127
|
- lib/ruby3mf/version.rb
|
127
128
|
- ruby3mf.gemspec
|