File: read_egads.c

package info (click to toggle)
libmeshb 7.80-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,848 kB
  • sloc: ansic: 12,810; f90: 1,146; fortran: 406; makefile: 218
file content (42 lines) | stat: -rw-r--r-- 880 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

// libMeshb7 basic example: read an EGADS CAD model stored as a byte flow

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <libmeshb7.h>

int main(int argc, char **argv)
{
   int i, NmbBytes, ver, dim;
   char *cad, *InpNam;
   int64_t InpMsh;

   // Print usage and exit
   if(argc == 1)
   {
      puts("\nUSAGE:");
      puts("  read_egads cad_file.meshb\n");
      exit(0);
   }

   // Get the file name
   InpNam = *++argv;

   // Open the mesh file for reading
   if(!(InpMsh = GmfOpenMesh(InpNam, GmfRead, &ver, &dim)))
      return(1);

   // Read the egads tree stored as a raw byte flow
   cad = GmfReadByteFlow(InpMsh, &NmbBytes);

   // Print the byte flow
   printf("NmbBytes = %d\n", NmbBytes);
   for(i=0;i<NmbBytes;i++)
      printf("%d : %d\n", i, cad[i]);

   // Do not forget to close the mesh file
   GmfCloseMesh(InpMsh);

   return(0);
}