/* This is the unite.cxx example program from page 80 of: J. Corney and T. Lim, "3D Modeling with ACIS", Saxe-Coburg Publications, Dun Eaglais, UK, 2001 This program creates two cylinders, rotates one and then unites them before the resulting BODY (solid) is saved to a file. Before running this program, make sure you set the shared library path: setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:/usr/arch/apps/acis/lib/solaris_so:/usr/arch/apps/acis/lib/solaris_so_debug */ #include #include #include #include #include #include #include #include #include void save_ent(const char *filename, ENTITY *ent); int main() { api_start_modeller(0); api_initialize_booleans(); BODY *cyl1, *cyl2; api_make_frustum(100, 20, 20, 20, cyl1); api_make_frustum(100, 20, 20, 20, cyl2); // Rotate one cylinder 90 degrees about X axis transf rotX = rotate_transf(3.14159265358/2, vector(1,0,0)); api_apply_transf(cyl1, rotX); // Unite the two cylinders api_unite(cyl1, cyl2); // cyl2 is the result // Save the result save_ent("unite.sat", cyl2); api_terminate_booleans(); api_stop_modeller(); return 0; } void save_ent(const char *filename, ENTITY *ent) { FileInfo info; // Create FileInfo Object info.set_product_id("Michigan Tech University"); // set info's data info.set_units(1.0); // Millimeters // Sets header info to be written to sat file api_set_file_info(FileId|FileUnits, info); FILE *fp = fopen(filename,"w"); if (fp != NULL) { ENTITY_LIST *savelist = new ENTITY_LIST; savelist->add(ent); api_save_entity_list(fp, TRUE, *savelist); delete savelist; } else printf("Unable to save file!\n"); fclose(fp); }