139{
141 root["sources"] = source_paths;
142 root["frame"] = "mesh_local";
143 root["note"] = "Coordinates are mesh-local (each volume's own frame). "
144 "Paint gizmos operate in this frame.";
145
146 json objects = json::array();
147 size_t total_objects = 0, total_volumes = 0, total_painted = 0, total_facets = 0;
148
149 for (
size_t oi = 0; oi < model.
objects.size(); ++oi) {
151 if (!mo) continue;
152 ++total_objects;
153
155 obj["index"] = oi;
156 obj[
"name"] = mo->
name;
157
158 json volumes = json::array();
159 for (
size_t vi = 0; vi < mo->
volumes.size(); ++vi) {
161 if (!mv) continue;
162 ++total_volumes;
163
164 const indexed_triangle_set &its = mv->
mesh().
its;
166 vol["index"] = vi;
167 vol[
"name"] = mv->
name;
168 vol["n_facets"] = its.indices.size();
170 vol[
"bbox_mesh_local"] = bbox_to_json(
bounding_box(its));
171
172 size_t vol_painted = 0;
175 supports_states(), vol_painted);
176 paints[
"seam"] = inspect_layer(*mv, mv->
seam_facets,
177 supports_states(), vol_painted);
179 mmu_states(), vol_painted);
181 fuzzy_states(), vol_painted);
182 vol["paints"] = std::move(paints);
183 vol["painted_facets_total"] = vol_painted;
184
185 if (vol_painted > 0) ++total_painted;
186 total_facets += vol_painted;
187
188 volumes.push_back(std::move(vol));
189 }
190 obj["volumes"] = std::move(volumes);
191 objects.push_back(std::move(obj));
192 }
193 root["objects"] = std::move(objects);
194 root["summary"] = {
195 { "objects", total_objects },
196 { "volumes", total_volumes },
197 { "volumes_with_paint", total_painted },
198 { "painted_facets_total", total_facets },
199 };
200
201
202
203
204 out << root.dump(2, ' ', false, json::error_handler_t::replace) << std::endl;
205}
std::string name
Definition Model.hpp:384
ModelVolumePtrs volumes
Definition Model.hpp:393
const TriangleMesh & mesh() const
Definition Model.hpp:892
bool is_model_part() const
Definition Model.hpp:1025
FacetsAnnotation mmu_segmentation_facets
Definition Model.hpp:913
FacetsAnnotation fuzzy_skin_facets
Definition Model.hpp:916
FacetsAnnotation supported_facets
Definition Model.hpp:907
FacetsAnnotation seam_facets
Definition Model.hpp:910
std::string name
Definition Model.hpp:834
ModelObjectPtrs objects
Definition Model.hpp:1702
indexed_triangle_set its
Definition TriangleMesh.hpp:164
BoundingBoxf3 bounding_box(const TriangleMesh &m)
Definition TriangleMesh.hpp:391
nlohmann::json json
Definition AssembleList.cpp:42