MeshKit
1.0
|
00001 00019 #include "meshkit/MKCore.hpp" 00020 #include "meshkit/MeshOp.hpp" 00021 #include "meshkit/CopyGeom.hpp" 00022 #include "meshkit/ModelEnt.hpp" 00023 00024 using namespace MeshKit; 00025 00026 #ifdef HAVE_ACIS 00027 #define DEFAULT_TEST_FILE "brick.sat" 00028 #elif defined(HAVE_OCC) 00029 #define DEFAULT_TEST_FILE "brick.stp" 00030 #endif 00031 00032 MKCore *mk; 00033 00034 int main(int argc, char **argv) 00035 { 00036 mk = new MKCore(); 00037 std::string filename = std::string (MESH_DIR) + "/" + DEFAULT_TEST_FILE; 00038 mk->load_geometry(filename.c_str()); 00039 00040 MEntVector vols; 00041 mk->get_entities_by_dimension(3, vols); 00042 00043 CopyGeom *cg = (CopyGeom*) mk->construct_meshop("CopyGeom", vols); 00044 cg->set_name("copy_move_geom"); 00045 00046 // set the location 00047 Vector<3> dx; dx[0] = 1; dx[1] = 0; dx[2] = 0; 00048 cg->set_location(dx); 00049 00050 // put them in the graph 00051 mk->get_graph().addArc(mk->root_node()->get_node(), cg->get_node()); 00052 mk->get_graph().addArc(cg->get_node(), mk->leaf_node()->get_node()); 00053 00054 // execute the CopyGeom graph 00055 mk->setup_and_execute(); 00056 00057 // merge and imprint the o/p geometry 00058 std::vector<iBase_EntityHandle> entities_out; 00059 mk->igeom_instance()->getEntities(0, iBase_REGION, entities_out); 00060 double dTol = 1.0e-2; 00061 mk->igeom_instance()->mergeEnts(&entities_out[0],entities_out.size(), dTol); 00062 mk->igeom_instance()->imprintEnts(&entities_out[0], entities_out.size()); 00063 00064 // delete the cg instance 00065 delete cg; 00066 return 0; 00067 } 00068 00069