ruby3mf 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +13 -13
- data/.rspec +2 -2
- data/bin/cli.rb +12 -12
- data/bin/console +14 -14
- data/bin/folder_test.sh +13 -13
- data/bin/suite_test.sh +41 -41
- data/lib/ruby3mf/3MFcoreSpec_1.1.xsd.template +188 -188
- data/lib/ruby3mf/content_types.rb +79 -77
- data/lib/ruby3mf/document.rb +242 -242
- data/lib/ruby3mf/edge_list.rb +60 -60
- data/lib/ruby3mf/errors.yml +191 -188
- data/lib/ruby3mf/log3mf.rb +135 -135
- data/lib/ruby3mf/mesh_analyzer.rb +80 -80
- data/lib/ruby3mf/mesh_normal_analyzer.rb +218 -218
- data/lib/ruby3mf/model3mf.rb +120 -117
- data/lib/ruby3mf/relationships.rb +50 -50
- data/lib/ruby3mf/schema_files.rb +26 -26
- data/lib/ruby3mf/texture3mf.rb +29 -29
- data/lib/ruby3mf/thumbnail3mf.rb +21 -21
- data/lib/ruby3mf/version.rb +3 -3
- data/lib/ruby3mf/xml.xsd +286 -286
- data/lib/ruby3mf/xml_val.rb +68 -68
- data/lib/ruby3mf.rb +26 -26
- data/ruby3mf.gemspec +32 -32
- metadata +3 -4
- data/suite.011917.out +0 -237
data/lib/ruby3mf/edge_list.rb
CHANGED
@@ -1,60 +1,60 @@
|
|
1
|
-
class EdgeList
|
2
|
-
|
3
|
-
def initialize
|
4
|
-
@edges = { }
|
5
|
-
end
|
6
|
-
|
7
|
-
def add_edge(first_vertex, second_vertex)
|
8
|
-
if first_vertex < second_vertex
|
9
|
-
edge = "#{first_vertex}:#{second_vertex}"
|
10
|
-
else
|
11
|
-
edge = "#{second_vertex}:#{first_vertex}"
|
12
|
-
end
|
13
|
-
|
14
|
-
(pos_count, neg_count) = @edges[edge]
|
15
|
-
|
16
|
-
if pos_count == nil or neg_count == nil
|
17
|
-
pos_count = 0
|
18
|
-
neg_count = 0
|
19
|
-
end
|
20
|
-
|
21
|
-
pos_count += 1 if first_vertex < second_vertex
|
22
|
-
neg_count += 1 if second_vertex < first_vertex
|
23
|
-
|
24
|
-
@edges[edge] = [pos_count, neg_count]
|
25
|
-
end
|
26
|
-
|
27
|
-
def edge_count(first_vertex, second_vertex)
|
28
|
-
if first_vertex < second_vertex
|
29
|
-
edge = "#{first_vertex}:#{second_vertex}"
|
30
|
-
else
|
31
|
-
edge = "#{second_vertex}:#{first_vertex}"
|
32
|
-
end
|
33
|
-
|
34
|
-
@edges[edge]
|
35
|
-
end
|
36
|
-
|
37
|
-
def print_list
|
38
|
-
@edges.each do |key, value|
|
39
|
-
(pos, neg) = value
|
40
|
-
puts "#{pos} : #{neg}"
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def verify_edges
|
45
|
-
@edges.each do |key, value|
|
46
|
-
(pos, neg) = value
|
47
|
-
|
48
|
-
if (pos > 1 and neg == 0) or (pos == 0 and neg > 1)
|
49
|
-
return :bad_orientation
|
50
|
-
elsif pos + neg == 1
|
51
|
-
return :hole
|
52
|
-
elsif pos != 1 or neg != 1
|
53
|
-
return :nonmanifold
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
:ok
|
58
|
-
end
|
59
|
-
|
60
|
-
end
|
1
|
+
class EdgeList
|
2
|
+
|
3
|
+
def initialize
|
4
|
+
@edges = { }
|
5
|
+
end
|
6
|
+
|
7
|
+
def add_edge(first_vertex, second_vertex)
|
8
|
+
if first_vertex < second_vertex
|
9
|
+
edge = "#{first_vertex}:#{second_vertex}"
|
10
|
+
else
|
11
|
+
edge = "#{second_vertex}:#{first_vertex}"
|
12
|
+
end
|
13
|
+
|
14
|
+
(pos_count, neg_count) = @edges[edge]
|
15
|
+
|
16
|
+
if pos_count == nil or neg_count == nil
|
17
|
+
pos_count = 0
|
18
|
+
neg_count = 0
|
19
|
+
end
|
20
|
+
|
21
|
+
pos_count += 1 if first_vertex < second_vertex
|
22
|
+
neg_count += 1 if second_vertex < first_vertex
|
23
|
+
|
24
|
+
@edges[edge] = [pos_count, neg_count]
|
25
|
+
end
|
26
|
+
|
27
|
+
def edge_count(first_vertex, second_vertex)
|
28
|
+
if first_vertex < second_vertex
|
29
|
+
edge = "#{first_vertex}:#{second_vertex}"
|
30
|
+
else
|
31
|
+
edge = "#{second_vertex}:#{first_vertex}"
|
32
|
+
end
|
33
|
+
|
34
|
+
@edges[edge]
|
35
|
+
end
|
36
|
+
|
37
|
+
def print_list
|
38
|
+
@edges.each do |key, value|
|
39
|
+
(pos, neg) = value
|
40
|
+
puts "#{pos} : #{neg}"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def verify_edges
|
45
|
+
@edges.each do |key, value|
|
46
|
+
(pos, neg) = value
|
47
|
+
|
48
|
+
if (pos > 1 and neg == 0) or (pos == 0 and neg > 1)
|
49
|
+
return :bad_orientation
|
50
|
+
elsif pos + neg == 1
|
51
|
+
return :hole
|
52
|
+
elsif pos != 1 or neg != 1
|
53
|
+
return :nonmanifold
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
:ok
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
data/lib/ruby3mf/errors.yml
CHANGED
@@ -1,188 +1,191 @@
|
|
1
|
-
build_with_other_item:
|
2
|
-
msg: "build item with object of type other"
|
3
|
-
page: 27
|
4
|
-
content_types_invalid_xml:
|
5
|
-
msg: "[Content_Types].xml file is not valid XML. %{e}"
|
6
|
-
page: 15
|
7
|
-
dot_rels_file_has_invalid_xml:
|
8
|
-
msg: "Relationships (.rel) file is not a valid XML file: %{e}"
|
9
|
-
page: 4
|
10
|
-
dot_rels_file_missing_relationships_element:
|
11
|
-
msg: ".rels XML must have <Relationships> root element"
|
12
|
-
page: 4
|
13
|
-
dot_rels_file_no_relationship_element:
|
14
|
-
msg: "No relationship elements found"
|
15
|
-
page: 4
|
16
|
-
duplicate_content_extension_types:
|
17
|
-
msg: "Only one ContentType definition is allowed per extension"
|
18
|
-
page: 8
|
19
|
-
duplicate_content_override_types:
|
20
|
-
msg: "Only one override is allowed per part"
|
21
|
-
page: 8
|
22
|
-
|
23
|
-
msg: "
|
24
|
-
page: 8
|
25
|
-
|
26
|
-
msg: '
|
27
|
-
page:
|
28
|
-
|
29
|
-
msg: '
|
30
|
-
page: 13
|
31
|
-
|
32
|
-
msg:
|
33
|
-
page: 13
|
34
|
-
|
35
|
-
msg:
|
36
|
-
page: 13
|
37
|
-
|
38
|
-
msg:
|
39
|
-
page:
|
40
|
-
|
41
|
-
msg: "
|
42
|
-
page:
|
43
|
-
|
44
|
-
msg: "
|
45
|
-
page:
|
46
|
-
|
47
|
-
msg: "
|
48
|
-
page:
|
49
|
-
|
50
|
-
msg: "
|
51
|
-
page:
|
52
|
-
|
53
|
-
msg: "
|
54
|
-
page:
|
55
|
-
|
56
|
-
msg: "
|
57
|
-
page:
|
58
|
-
|
59
|
-
msg: "Metadata
|
60
|
-
page: 21
|
61
|
-
|
62
|
-
msg: "
|
63
|
-
page:
|
64
|
-
|
65
|
-
msg: "Invalid
|
66
|
-
page:
|
67
|
-
|
68
|
-
msg: "
|
69
|
-
page: 10
|
70
|
-
|
71
|
-
msg: "
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
page:
|
77
|
-
|
78
|
-
msg: "
|
79
|
-
page:
|
80
|
-
|
81
|
-
msg: "
|
82
|
-
page:
|
83
|
-
|
84
|
-
msg: "
|
85
|
-
page:
|
86
|
-
|
87
|
-
msg: "
|
88
|
-
page:
|
89
|
-
|
90
|
-
msg: "
|
91
|
-
page:
|
92
|
-
|
93
|
-
msg: "
|
94
|
-
page:
|
95
|
-
|
96
|
-
msg: "
|
97
|
-
page:
|
98
|
-
|
99
|
-
msg: "
|
100
|
-
page:
|
101
|
-
|
102
|
-
msg: "Missing required file
|
103
|
-
page: 4
|
104
|
-
|
105
|
-
msg: "
|
106
|
-
page:
|
107
|
-
|
108
|
-
msg: "
|
109
|
-
page:
|
110
|
-
|
111
|
-
msg: "
|
112
|
-
page:
|
113
|
-
|
114
|
-
msg: "
|
115
|
-
page:
|
116
|
-
|
117
|
-
msg: "
|
118
|
-
page:
|
119
|
-
|
120
|
-
msg: "
|
121
|
-
page:
|
122
|
-
|
123
|
-
msg: "
|
124
|
-
page:
|
125
|
-
|
126
|
-
msg: "
|
127
|
-
page:
|
128
|
-
|
129
|
-
msg: "
|
130
|
-
page:
|
131
|
-
|
132
|
-
msg: "
|
133
|
-
page:
|
134
|
-
|
135
|
-
msg: "The
|
136
|
-
page:
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
msg: "
|
143
|
-
page:
|
144
|
-
|
145
|
-
msg: "
|
146
|
-
page:
|
147
|
-
|
148
|
-
msg: "
|
149
|
-
page:
|
150
|
-
|
151
|
-
msg: "
|
152
|
-
page:
|
153
|
-
|
154
|
-
msg: "
|
155
|
-
page: 27
|
156
|
-
|
157
|
-
msg: "
|
158
|
-
page: 27
|
159
|
-
|
160
|
-
msg: "
|
161
|
-
page:
|
162
|
-
|
163
|
-
msg: "
|
164
|
-
page:
|
165
|
-
|
166
|
-
msg: "
|
167
|
-
page:
|
168
|
-
|
169
|
-
msg: "
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
msg: "
|
175
|
-
page:
|
176
|
-
unsupported_relationship_type:
|
177
|
-
msg: "Validation of relationship type '%{type}' is not supported by this tool. The targeted part '%{target}' will not be validated."
|
178
|
-
page: 10
|
179
|
-
|
180
|
-
msg: "
|
181
|
-
page:
|
182
|
-
|
183
|
-
msg: "
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
page:
|
1
|
+
build_with_other_item:
|
2
|
+
msg: "build item with object of type other"
|
3
|
+
page: 27
|
4
|
+
content_types_invalid_xml:
|
5
|
+
msg: "[Content_Types].xml file is not valid XML. %{e}"
|
6
|
+
page: 15
|
7
|
+
dot_rels_file_has_invalid_xml:
|
8
|
+
msg: "Relationships (.rel) file is not a valid XML file: %{e}"
|
9
|
+
page: 4
|
10
|
+
dot_rels_file_missing_relationships_element:
|
11
|
+
msg: ".rels XML must have <Relationships> root element"
|
12
|
+
page: 4
|
13
|
+
dot_rels_file_no_relationship_element:
|
14
|
+
msg: "No relationship elements found"
|
15
|
+
page: 4
|
16
|
+
duplicate_content_extension_types:
|
17
|
+
msg: "Only one ContentType definition is allowed per extension"
|
18
|
+
page: 8
|
19
|
+
duplicate_content_override_types:
|
20
|
+
msg: "Only one override is allowed per part"
|
21
|
+
page: 8
|
22
|
+
empty_default_extension:
|
23
|
+
msg: "Default extensions can't be empty"
|
24
|
+
page: 8
|
25
|
+
empty_override_part_name:
|
26
|
+
msg: "Overrides can't have empty partname"
|
27
|
+
page: 8
|
28
|
+
err_uri_bad:
|
29
|
+
msg: 'Path names must be valid Open Package Convention URIs or IRIs'
|
30
|
+
page: 13
|
31
|
+
err_uri_empty_segment:
|
32
|
+
msg: 'No segment of a 3MF part name path may be empty'
|
33
|
+
page: 13
|
34
|
+
err_uri_hidden_file:
|
35
|
+
msg: "Other than /_rels/.rels, no segment of a 3MF part name may start with the '.' character"
|
36
|
+
page: 13
|
37
|
+
err_uri_relative_path:
|
38
|
+
msg: 'Part names must not include relative paths'
|
39
|
+
page: 13
|
40
|
+
has_base_materials_gradient:
|
41
|
+
msg: "Base materials form a gradient on one or more triangles. Interpolation of materials is not supported in the core spec."
|
42
|
+
page: 31
|
43
|
+
has_commas_for_floats:
|
44
|
+
msg: "numbers not formatted for the en-US locale %{e}"
|
45
|
+
page: 15
|
46
|
+
has_improper_base_color:
|
47
|
+
msg: "An sRGB color MUST be specified with a value of a 6 or 8 digit hexadecimal number"
|
48
|
+
page: 35
|
49
|
+
has_xml_space_attribute:
|
50
|
+
msg: "xml:space attribute is not allowed"
|
51
|
+
page: 16
|
52
|
+
invalid_content_type:
|
53
|
+
msg: "[Content_Types].xml is missing required ContentType \"%{mt}\""
|
54
|
+
page: 10
|
55
|
+
invalid_image_content_type:
|
56
|
+
msg: "Invalid content type for %{extension}"
|
57
|
+
page: 22
|
58
|
+
invalid_metadata_name:
|
59
|
+
msg: "Metadata names must be prefixed with a valid namespace"
|
60
|
+
page: 21
|
61
|
+
invalid_metadata_under_defaultns:
|
62
|
+
msg: "Metadata without a namespace name must only contain allowed name values"
|
63
|
+
page: 21
|
64
|
+
invalid_model_unit:
|
65
|
+
msg: "Invalid unit value of '%{unit}' specified in model file."
|
66
|
+
page: 17
|
67
|
+
invalid_startpart_target:
|
68
|
+
msg: "Invalid StartPart target '%{target}'. The 3MF Document StartPart relationship MUST point to the 3D Model part that identifies the root of the 3D payload."
|
69
|
+
page: 10
|
70
|
+
invalid_startpart_type:
|
71
|
+
msg: "rels/.rels Relationship file is missing a required StartPart relationship to the primary 3D payload"
|
72
|
+
page: 10
|
73
|
+
invalid_texture_file_type:
|
74
|
+
msg: "Expected a png or jpeg texture but the texture was of type %{type}"
|
75
|
+
spec: :material
|
76
|
+
page: 16
|
77
|
+
invalid_thumbnail_colorspace:
|
78
|
+
msg: "CMYK JPEG images must not be used for the thumbnail"
|
79
|
+
page: 36
|
80
|
+
invalid_thumbnail_file:
|
81
|
+
msg: "thumbnail file must be valid image file"
|
82
|
+
page: 10
|
83
|
+
invalid_thumbnail_file_type:
|
84
|
+
msg: "Expected a png or jpeg thumbnail but the thumbnail was of type %{type}"
|
85
|
+
page: 36
|
86
|
+
invalid_vertex_index:
|
87
|
+
msg: "Triangle with a invalid vertex index"
|
88
|
+
page: 26
|
89
|
+
invalid_xml_core:
|
90
|
+
msg: "XML file doesn't pass validation with the XSD file"
|
91
|
+
page: 15
|
92
|
+
inward_facing_normal:
|
93
|
+
msg: "All trianges must be oriented with normals pointing away from interior"
|
94
|
+
page: 31
|
95
|
+
metadata_elements_with_same_name:
|
96
|
+
msg: "metadata elements must not share the same name"
|
97
|
+
page: 22
|
98
|
+
missing_content_type:
|
99
|
+
msg: "Unable to find an associated content type for part '%{part}' in [Content_Types].xml"
|
100
|
+
page: 10
|
101
|
+
missing_content_types:
|
102
|
+
msg: "Missing required file: [Content_Types].xml"
|
103
|
+
page: 4
|
104
|
+
missing_dot_rels_file:
|
105
|
+
msg: "Missing required file _rels/.rels"
|
106
|
+
page: 4
|
107
|
+
missing_extension_namespace_uri:
|
108
|
+
msg: "Required extension '%{ns}' MUST refer to namespace with URI"
|
109
|
+
page: 14
|
110
|
+
missing_model_children:
|
111
|
+
msg: "Model element must include resources and build as child elements"
|
112
|
+
page: 20
|
113
|
+
missing_object_pid:
|
114
|
+
msg: "Object with triangle color override missing object level pid"
|
115
|
+
page: 26
|
116
|
+
missing_object_reference:
|
117
|
+
msg: "3D objects not referenced by an item element"
|
118
|
+
page: 23
|
119
|
+
missing_rels_folder:
|
120
|
+
msg: "Missing required file _rels/.rels"
|
121
|
+
page: 4
|
122
|
+
model_invalid_xml:
|
123
|
+
msg: "Model file invalid XML. Exception %{e}"
|
124
|
+
page:
|
125
|
+
model_resource_not_in_rels:
|
126
|
+
msg: "Missing required resource: %{mr}. Resource referenced in model, but not in .rels relationship file"
|
127
|
+
page: 10
|
128
|
+
multiple_print_tickets:
|
129
|
+
msg: "Only one print ticket allowed for any given model"
|
130
|
+
page: 13
|
131
|
+
multiple_relationships:
|
132
|
+
msg: "There MUST NOT be more than one relationship of a given relationship type from one part to a second part"
|
133
|
+
page: 10
|
134
|
+
non_distinct_indices:
|
135
|
+
msg: "The indices v1, v2 and v3 MUST be distinct."
|
136
|
+
page: 31
|
137
|
+
non_unique_rel_id:
|
138
|
+
msg: "The ID value '%{id}' appears more than once in '%{file}'. Within a rels file, all ID's must be unique"
|
139
|
+
page: 8 #TODO:change this to page 23 of the OPC spec once logging supports linking to that spec
|
140
|
+
spec: opc
|
141
|
+
not_a_zip:
|
142
|
+
msg: "File provided is not a valid ZIP archive"
|
143
|
+
page: 9
|
144
|
+
not_enough_triangles:
|
145
|
+
msg: "Mesh has fewer than four triangles"
|
146
|
+
page: 30
|
147
|
+
object_with_components_and_pid:
|
148
|
+
msg: "object with components and pid or pindex"
|
149
|
+
page: 26
|
150
|
+
rel_file_not_found:
|
151
|
+
msg: "Relationship Target file %{mf} not found"
|
152
|
+
page: 11
|
153
|
+
resource_3dmodel_hole:
|
154
|
+
msg: "Hole in model"
|
155
|
+
page: 27
|
156
|
+
resource_3dmodel_nonmanifold:
|
157
|
+
msg: "Non-manifold edge in 3dmodel"
|
158
|
+
page: 27
|
159
|
+
resource_3dmodel_orientation:
|
160
|
+
msg: "Bad triangle orientation"
|
161
|
+
page: 27
|
162
|
+
resource_contentype_invalid:
|
163
|
+
msg: "Relationship target %{rt} resource has invalid contenttype %{bt}"
|
164
|
+
page: 10
|
165
|
+
resource_id_collision:
|
166
|
+
msg: "resources must be unique within the model"
|
167
|
+
page: 22
|
168
|
+
resource_pid_missing:
|
169
|
+
msg: "A model resource referenced a property group id (pid) that is not present. Missing pid is: %{pid}"
|
170
|
+
page: 20
|
171
|
+
schema_error:
|
172
|
+
msg: "Schema error found: %{e}"
|
173
|
+
thumbnail_image_type_mismatch:
|
174
|
+
msg: "Image not of declared type"
|
175
|
+
page: 36
|
176
|
+
unsupported_relationship_type:
|
177
|
+
msg: "Validation of relationship type '%{type}' is not supported by this tool. The targeted part '%{target}' will not be validated."
|
178
|
+
page: 10
|
179
|
+
unsupported_extension:
|
180
|
+
msg: "Validation of extension type '%{ext}' is not fully supported"
|
181
|
+
page: 17
|
182
|
+
wrong_encoding:
|
183
|
+
msg: "XML content must be UTF8 encoded"
|
184
|
+
page: 15
|
185
|
+
zero_size_texture:
|
186
|
+
msg: "Texture file must be valid image file"
|
187
|
+
spec: :material
|
188
|
+
page: 16
|
189
|
+
contains_xsi_namespace:
|
190
|
+
msg: "XML content must not use the xsi namespace as it is not defined in the XSD schema"
|
191
|
+
page: 15
|