cgma
scale.cpp
Go to the documentation of this file.
00001 
00010 #include "GeometryModifyTool.hpp"
00011 #include "GeometryQueryTool.hpp"
00012 #include "OCCQueryEngine.hpp"
00013 #include "Body.hpp"
00014 #include "InitCGMA.hpp"
00015 
00016 #include "OCCModifyEngine.hpp"
00017 #include "CubitCompat.hpp"
00018 #include "TestUtilities.hpp"
00019 // main program - initialize, then send to proper function
00020 bool debug = false;
00021 
00022 int main (int argc, char **argv)
00023 {
00024   CubitStatus status = InitCGMA::initialize_cgma("OCC");
00025   if (CUBIT_SUCCESS != status) return 1;
00026 
00027   GeometryQueryTool *gti = GeometryQueryTool::instance();
00028   GeometryModifyTool *gmti = GeometryModifyTool::instance();
00029 
00030   int prob_type =1; // problem type 1 only works, the bounding box computation for sphere, circle surface and cylinder is off - more investigation is needed. The bug is in OCC or OCE not CGM. Tested direct OCE calls and the error persist.
00031   Body* body2 = NULL;
00032   CubitVector plane(1, 0, 0);
00033   if (prob_type == 1)
00034     body2 = gmti->brick(10, 10, 10);
00035   else if (prob_type == 2)
00036     body2 = gmti->sphere(5.0, 0 , 0, 0, 0, false);
00037   else if (prob_type == 3)
00038     body2 = gmti->cylinder(5.0, 5.0, 5.0, 5.0);
00039   else if (prob_type == 4)
00040     body2 = gmti->create_circle_surface(5.0, plane);
00041 
00042   // compute bounding box
00043   CubitBox curr_box_before = gti->bounding_box_of_bodies();
00044 
00045   CubitVector scale(2, 2, 2);
00046   CubitVector p1(0, 0, 0);
00047   gmti->scale(body2, p1, scale);
00048 
00049   // compute bounding box
00050   CubitBox curr_box_after = gti->bounding_box_of_bodies();
00051 
00052   // check if bounding boxes are identical
00053   double tol = 1.0/100;
00054   int return_val = cubit_box_identical(curr_box_after, 2*curr_box_before, tol, true);
00055 
00056   // save file if debug true
00057 
00058   if (debug){
00059       DLIList<RefEntity*> ref_entity_list;
00060       ref_entity_list.push( (RefEntity*) body2);
00061       const CubitString cubit_version="12.2";
00062       int num_ents_exported=0;
00063       const char *filename = "scale.brep";
00064       const char *filetype = "OCC";
00065       CubitCompat_export_solid_model(ref_entity_list, filename, filetype,
00066                                      num_ents_exported, cubit_version);
00067     }
00068   return (return_val-1);
00069 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines