int main(int argc, char *argv[]) { struct rt_wdb *wdbp = NULL; const char *name = "brep"; ON_Brep *brep = NULL; int ret; if ( BU_STR_EQUAL(argv[1],"-h") || BU_STR_EQUAL(argv[1],"-?")) { printusage(); return 0; } if (argc >= 1) { printusage(); fprintf(stderr," Program continues running (will create file breplicator.g):\n"); } bu_log("Breplicating...please wait...\n"); ON_3dPoint points[8] = { /* left */ ON_3dPoint(0.0, 0.0, 0.0), // 0 ON_3dPoint(1.0, 0.0, 0.0), // 1 ON_3dPoint(1.0, 0.0, 2.5), // 2 ON_3dPoint(0.0, 0.0, 2.5), // 3 /* right */ ON_3dPoint(0.0, 1.0, 0.0), // 4 ON_3dPoint(1.0, 1.0, 0.0), // 5 ON_3dPoint(1.0, 1.0, 2.5), // 6 ON_3dPoint(0.0, 1.0, 2.5), // 7 }; brep = generate_brep(8, points); if (!brep) bu_exit(1, "ERROR: We don't have a BREP\n"); ON_TextLog log(stdout); brep->Dump(log); if (!brep->IsValid(&log)) { delete brep; bu_exit(1, "ERROR: We don't have a valid BREP\n"); } brep->Dump(log); wdbp = wdb_fopen("breplicator.g"); if (!wdbp) { delete brep; bu_exit(2, "ERROR: Unable to open breplicator.g\n"); } mk_id(wdbp, "Breplicator test geometry"); bu_log("Creating the BREP as BRL-CAD geometry\n"); ret = mk_brep(wdbp, name, brep); if (ret) { delete brep; wdb_close(wdbp); bu_exit(3, "ERROR: Unable to export %s\n", name); } bu_log("Done.\n"); delete brep; wdb_close(wdbp); return 0; }