1 #define DWG_TYPE DWG_TYPE_MESH
2 #include "common.c"
3
4 void
5 api_process (dwg_object *obj)
6 {
7 int error;
8 BITCODE_BS dlevel;
9 BITCODE_B is_watertight;
10 BITCODE_BL i, num_subdiv_vertex;
11 BITCODE_3BD *subdiv_vertex;
12 BITCODE_BL num_vertex;
13 BITCODE_3BD *vertex;
14 BITCODE_BL num_faces;
15 BITCODE_BL *faces;
16 BITCODE_BL num_edges;
17 Dwg_MESH_edge *edges;
18 BITCODE_BL num_crease;
19 BITCODE_BD *crease;
20
21 // Dwg_Version_Type dwg_version = obj->parent->header.version;
22 dwg_ent_mesh *_obj = dwg_object_to_MESH (obj);
23
24 CHK_ENTITY_TYPE (_obj, MESH, dlevel, BS);
25 CHK_ENTITY_TYPE (_obj, MESH, is_watertight, B);
26 CHK_ENTITY_TYPE (_obj, MESH, num_subdiv_vertex, BL);
27 if (!dwg_dynapi_entity_value (_obj, "MESH", "subdiv_vertex", &subdiv_vertex,
28 NULL))
29 fail ("MESH.subdiv_vertex");
30 for (i = 0; i < num_subdiv_vertex; i++)
31 {
32 ok ("MESH.subdiv_vertex[%u]: (%f, %f, %f)", i, subdiv_vertex[i].x,
33 subdiv_vertex[i].y, subdiv_vertex[i].z);
34 }
35 CHK_ENTITY_TYPE (_obj, MESH, num_vertex, BL);
36 if (!dwg_dynapi_entity_value (_obj, "MESH", "vertex", &vertex, NULL))
37 fail ("MESH.vertex");
38 for (i = 0; i < num_vertex; i++)
39 {
40 ok ("MESH.vertex[%u]: (%f, %f, %f)", i, vertex[i].x, vertex[i].y,
41 vertex[i].z);
42 }
43 CHK_ENTITY_TYPE (_obj, MESH, num_faces, BL);
44 if (!dwg_dynapi_entity_value (_obj, "MESH", "faces", &faces, NULL))
45 fail ("MESH.faces");
46 for (i = 0; i < num_faces; i++)
47 {
48 ok ("MESH.faces[%u]: " FORMAT_BL, i, faces[i]);
49 }
50 CHK_ENTITY_TYPE (_obj, MESH, num_edges, BL);
51 if (!dwg_dynapi_entity_value (_obj, "MESH", "edges", &edges, NULL))
52 fail ("MESH.edges");
53 for (i = 0; i < num_edges; i++)
54 {
55 CHK_SUBCLASS_TYPE (edges[i], MESH_edge, idxfrom, BL);
56 CHK_SUBCLASS_TYPE (edges[i], MESH_edge, idxto, BL);
57 }
58 CHK_ENTITY_TYPE (_obj, MESH, num_crease, BL);
59 if (!dwg_dynapi_entity_value (_obj, "MESH", "crease", &crease, NULL))
60 fail ("MESH.crease");
61 for (i = 0; i < num_crease; i++)
62 {
63 ok ("MESH.crease[%u]: %f", i, crease[i]);
64 }
65 }