ruby3mf 0.2.5 → 0.2.6

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