cgma
point_project.cpp File Reference
#include <cassert>
#include "GeometryModifyEngine.hpp"
#include "GeometryModifyTool.hpp"
#include "GeometryQueryTool.hpp"
#include "CubitMessage.hpp"
#include "Body.hpp"
#include "RefVolume.hpp"
#include "RefFace.hpp"
#include "RefEdge.hpp"
#include "RefVertex.hpp"
#include "InitCGMA.hpp"
#include "OCCBody.hpp"
#include "OCCSurface.hpp"
#include "OCCCurve.hpp"
#include "OCCDrawTool.hpp"
#include "CubitCompat.hpp"

Go to the source code of this file.

Defines

#define SRCDIR   .
#define STRINGIFY_(X)   #X
#define STRINGIFY(X)   STRINGIFY_(X)
#define SRCPATH   STRINGIFY(SRCDIR) "/"
#define PRINT_SEPARATOR   PRINT_INFO("=======================================\n");

Functions

CubitStatus read_geometry (int, const char **, bool local=false)
CubitStatus point_project ()
int main (int argc, char **argv)

Define Documentation

#define PRINT_SEPARATOR   PRINT_INFO("=======================================\n");

Definition at line 41 of file point_project.cpp.

#define SRCDIR   .

Definition at line 30 of file point_project.cpp.

#define SRCPATH   STRINGIFY(SRCDIR) "/"

Definition at line 35 of file point_project.cpp.

#define STRINGIFY (   X)    STRINGIFY_(X)

Definition at line 34 of file point_project.cpp.

#define STRINGIFY_ (   X)    #X

Definition at line 33 of file point_project.cpp.


Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 44 of file point_project.cpp.

{
  CubitStatus status = InitCGMA::initialize_cgma("OCC");
  if (CUBIT_SUCCESS != status) return 1;

  //Do make point.
  status = point_project();
  if (status == CUBIT_FAILURE)
     PRINT_INFO("Operation Failed");

  int ret_val = ( CubitMessage::instance()->error_count() );
  if ( ret_val > 0 )
  {
    PRINT_ERROR("Errors found during Mergechk session.\n");
  }
  return ret_val;

}

Definition at line 89 of file point_project.cpp.

{
  GeometryQueryTool *gti = GeometryQueryTool::instance();

  const char *argv = "box-w-hole.brep";
  CubitStatus status = read_geometry(1, &argv);
  if (status == CUBIT_FAILURE) exit(1);
  
  DLIList<Body*> test_bodies;
  gti->bodies(test_bodies);
  DLIList<Surface*> surfaces;
  BodySM* body = test_bodies.get()->get_body_sm_ptr();
  body->surfaces(surfaces);
  Surface* surf = NULL;
  for (int i = 0 ; i <  surfaces.size(); i++)
  {
    surf = surfaces.get_and_step();
    double d = surf->measure();
    if (d < 82.1 && d > 81.9)
      break;
  } 
  CubitVector point(1,1,-5); 
  CubitVector on_surf;
  surf->closest_point_trimmed(point, on_surf); 
  std::cout << "Point on surface closest to (1, 1, -5) is (" << on_surf.x()
      << ", " << on_surf.y() << ", " << on_surf.z() << ")" << std::endl;
  assert (fabs(on_surf.z() + 5) < 0.0001);
  if (on_surf.y() < on_surf.x())
  {
    assert (on_surf.y() < 1.001 && on_surf.y() > 0.999);
    assert (on_surf.x() < 2.122 && on_surf.x() > 2.121 );
  }
  else
  {
    assert (on_surf.y() < 2.122 && on_surf.y() > 2.121 );
    assert (on_surf.x() < 1.001 && on_surf.x() > 0.999);
  }

  CubitVector p1(0, 1.5, -6 );
  surf->closest_point_trimmed(p1, on_surf);
  std::cout << "Point on surface closest to (0, 1.5, -6) is (" << on_surf.x()
      << ", " << on_surf.y() << ", " << on_surf.z() << ")" << std::endl;
  assert (fabs(on_surf.z() + 5) < 0.0001);
  assert (on_surf.y() < 2.122 && on_surf.y() > 2.121);
  assert (on_surf.x() < 0.0001 && on_surf.x() > -0.0001 );
  return CUBIT_SUCCESS;
}
CubitStatus read_geometry ( int  num_files,
const char **  argv,
bool  local 
)

attribs module: list, modify attributes in a give model or models

Arguments: file name(s) of geometry files in which to look

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines