Exemplo n.º 1
0
ACIS_Internals::ACIS_Internals(GModel *gm)
{
  // put your acis unlock string here...
#include "ACISLICENSE.h"

  spa_unlock_result out = spa_unlock_products(unlock_str);
  outcome prout = api_start_modeller(0);
  if (!prout.ok()){
    Msg::Error("Unable to start ACIS");
  }

  option_header* seam_option = NULL;

  seam_option = find_option("periodic_no_seam");
  if (seam_option != NULL)
    seam_option->push(FALSE);

  api_initialize_booleans();
  api_initialize_euler_ops();
  api_initialize_constructors();
  api_initialize_intersectors();
  api_initialize_generic_attributes();
  api_initialize_kernel();
  api_initialize_spline();
  api_initialize_faceter();

  _mm = new GMSH_MESH_MANAGER(gm);
  api_set_mesh_manager(_mm);
  /*
  REFINEMENT *ref = new REFINEMENT;
  ref->set_surf_mode(AF_SURF_ALL);
  ref->set_normal_tol(60); // 30
  ref->set_surface_tol(0.1); // 0.05
  ref->set_grid_mode(AF_GRID_TO_EDGES);
  ref->set_triang_mode(AF_TRIANG_ALL );
  api_set_default_refinement(ref);
  */
}
Exemplo n.º 2
0
CGenViewerCtrl::CGenViewerCtrl()
{
	InitializeIIDs(&IID_DGenViewer, &IID_DGenViewerEvents);
	// TODO: Initialize your control's instance data here.

	SetInitialSize(200, 200);

#ifdef HOOPS
	m_pHDB=new HDB();
	m_pHDB->Init();
	m_pHDB->SetIsolatedDrivers(false);
#endif
	TCHAR cur_dir[MVO_BUFFER_SIZE];
	GetCurrentDirectory(MVO_BUFFER_SIZE, cur_dir);
	memset(m_AppDirectory,0,MVO_BUFFER_SIZE);	
	//UtC(cur_dir, m_AppDirectory);

#if defined(INTEROP) || defined(ACIS)
#ifdef ACIS
	//Base configuration must happen before unlocking ACIS.
	//   If not using initialize_base, then unlock must 
	//   happen after the initialize modeller 
	base_configuration base_config;
	logical ok = initialize_base( &base_config);
	unlock_spatial_products_4158();
#endif // ACIS


#ifdef INTEROP
	char *path;
	path = getenv("PATH");
	if (path == NULL) {
		wchar_t * error_msg = L"Unable to add CATIA V5 DLLs to the path.  CATIA V5 translation will not work.";
		AfxMessageBox(LPCTSTR(error_msg), MB_ICONSTOP);
	}
	else {
		_putenv(H_FORMAT_TEXT("PATH=%s\\lib3dx\\intel_a\\code\\bin;%s", m_AppDirectory, path));
	}
#endif // INTEROP
#endif // defined(INTEROP) || defined(ACIS)


#ifdef ACIS
	outcome o; 
	o = api_start_modeller(0);
	check_outcome(o);

	//Issue #10605: Default Entity Manager Factory no longer registered by default		
	if (get_major_version() >= 20) 
	{
		entity_mgr_factory* my_manager = new default_entity_mgr_factory();
		{
			outcome o = asmi_set_entity_mgr_factory(my_manager);
			check_outcome(o);
		}
	}

	o = api_initialize_hoops_acis_bridge();
	check_outcome(o);
	ha_rendering_options &roptions=HA_Get_Rendering_Options();
	{
		roptions.SetMergeFacesMode(TRUE);
		roptions.SetGeomPattern ("?Include Library/ACIS model geometry");
		roptions.SetPattern("entity");
	}	
#endif // ACIS

	AfxInitRichEdit();

	AddDocTemplate(new CActiveXDocTemplate(
		RUNTIME_CLASS(CGenViewerDoc),   //改为你的文档类
		RUNTIME_CLASS(CMainFrame),  //改为你的框架类
		RUNTIME_CLASS(CGenViewerView))); //改为你的视图类

}
Exemplo n.º 3
0
BOOL CGenViewerApp::InitInstance()
{
    AfxEnableControlContainer();

    // Standard initialization
    // If you are not using these features and wish to reduce the size
    //  of your final executable, you should remove from the following
    //  the specific initialization routines you do not need.

#ifdef _AFXDLL
//	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
    Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif

    // Change the registry key under which our settings are stored.
    // TODO: You should modify this string to be something appropriate
    // such as the name of your company or organization.
    SetRegistryKey(_T("Local AppWizard-Generated Applications"));

    LoadStdProfileSettings();  // Load standard INI file options (including MRU)

    // Register the application's document templates.  Document templates
    //  serve as the connection between documents, frame windows and views.
#ifdef HOOPS
    m_pHDB=new HDB();
    m_pHDB->Init();
    m_pHDB->SetIsolatedDrivers(false);

    TCHAR cur_dir[MVO_BUFFER_SIZE];
    GetCurrentDirectory(MVO_BUFFER_SIZE, cur_dir);
    memset(m_AppDirectory,0,MVO_BUFFER_SIZE);
    //UtC(cur_dir, m_AppDirectory);
#endif

#ifdef VL
//	vl::showWin32Console();

    /* init Visualization Library */
    vl::VisualizationLibrary::init();
    registerLoadWriter(new LoadWriter3DXML);
#endif

#if defined(INTEROP) || defined(ACIS)
#ifdef ACIS
    //Base configuration must happen before unlocking ACIS.
    //   If not using initialize_base, then unlock must
    //   happen after the initialize modeller
    base_configuration base_config;
    logical ok = initialize_base( &base_config);
    unlock_spatial_products_4158();
#endif // ACIS

#ifdef INTEROP
    char *path;
    path = getenv("PATH");
    if (path == NULL) {
        wchar_t * error_msg = L"Unable to add CATIA V5 DLLs to the path.  CATIA V5 translation will not work.";
        AfxMessageBox(LPCTSTR(error_msg), MB_ICONSTOP);
    }
    else {
        _putenv(H_FORMAT_TEXT("PATH=%s\\lib3dx\\intel_a\\code\\bin;%s", m_AppDirectory, path));
    }
#endif // INTEROP
#endif // defined(INTEROP) || defined(ACIS)


#ifdef ACIS
    outcome o;
    o = api_start_modeller(0);
    check_outcome(o);

    //Issue #10605: Default Entity Manager Factory no longer registered by default
    if (get_major_version() >= 20)
    {
        entity_mgr_factory* my_manager = new default_entity_mgr_factory();
        {
            outcome o = asmi_set_entity_mgr_factory(my_manager);
            check_outcome(o);
        }
    }

    o = api_initialize_hoops_acis_bridge();
    check_outcome(o);
    ha_rendering_options &roptions=HA_Get_Rendering_Options();
    {
        roptions.SetMergeFacesMode(TRUE);
        roptions.SetGeomPattern ("?Include Library/ACIS model geometry");
        roptions.SetPattern("entity");
    }
#endif // ACIS

    CSingleDocTemplate* pDocTemplate;
    pDocTemplate = new CSingleDocTemplate(
        IDR_MAINFRAME,
        RUNTIME_CLASS(CGenViewerDoc),
        RUNTIME_CLASS(CMainFrame),       // main SDI frame window
        RUNTIME_CLASS(CGenViewerView));
    AddDocTemplate(pDocTemplate);

    // Parse command line for standard shell commands, DDE, file open
    CCommandLineInfo cmdInfo;
    ParseCommandLine(cmdInfo);


    // Don't display a new MDI child window during startup
// 	if (cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew)
// 		cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;


    // Dispatch commands specified on the command line
    if (!ProcessShellCommand(cmdInfo))
        return FALSE;

    AfxInitRichEdit();

    // The one and only window has been initialized, so show and update it.
    m_pMainWnd->ShowWindow(SW_SHOW);
    m_pMainWnd->UpdateWindow();

    return TRUE;
}