logical HSolidModel::HA_Read_Asat_File(const char* fname, asm_model_list& model_list) { FILE * fp = NULL; ENTITY* entity = 0; outcome oc; logical res = TRUE; fp = fopen(fname, "r"); res = (fp != NULL); if (res) { entity_mgr_factory* pEntity_Mgr_Factory; outcome o = asmi_get_entity_mgr_factory(pEntity_Mgr_Factory); check_outcome(o); // Retrieve a list of all models from file asm_restore_options ropts; ropts.set_entity_mgr_factory( pEntity_Mgr_Factory ); oc = asmi_restore_model_list(fp, TRUE, model_list, &ropts); res = oc.ok(); } if (fp) fclose(fp); return res; }
CGenViewerCtrl::~CGenViewerCtrl() { // TODO: Cleanup your control's instance data here. if( m_pHDB != NULL ) { delete m_pHDB; m_pHDB = NULL; } #ifdef ACIS outcome o = api_terminate_hoops_acis_bridge(); check_outcome(o); o = api_stop_modeller(); check_outcome(o); terminate_base(); #endif // ACIS }
int CGenViewerApp::ExitInstance() { #ifdef HOOPS if( m_pHDB != NULL ) { delete m_pHDB; m_pHDB = NULL; } #endif #ifdef ACIS outcome o = api_terminate_hoops_acis_bridge(); check_outcome(o); o = api_stop_modeller(); check_outcome(o); terminate_base(); #endif // ACIS #ifdef VL vl::VisualizationLibrary::shutdown(); #endif // VL return CWinApp::ExitInstance(); }
void PmeStdSolidChamferFeature::Update(void) { PmeThrowExceptionIf<PmeIlligalOperationException>(GetChamferType() != PmeChamferType_Length); PmeThrowExceptionIf<PmeIlligalOperationException>(m_pSelectedEdge == 0); PmeThrowExceptionIf<PmeIlligalOperationException>(m_length != m_value); PmeThrowExceptionIf<PmeIlligalOperationException>(m_length <= 0); PmeThrowExceptionIf<PmeIlligalOperationException>(m_value <= 0); PmeThrowExceptionIf<PmeIlligalOperationException>(GetSelectedEdge()->GetReferenceType() != PmeReferenceType_Brep); PmePart * pPart = GetPart(); ENTITY * pEdge = pPart->GetSelectionManager()->GetBrepFromReference(GetSelectedEdge()); PmeThrowExceptionIf<PmeIlligalOperationException>(strcmp(pEdge->type_name(), "edge") != 0); ENTITY_LIST selectedEdges; selectedEdges.add(pEdge); double leftRange = m_length; API_BEGIN // api_set_int_option("annotations", TRUE); result = api_chamfer_edges(selectedEdges, leftRange); check_outcome(result); if(result.ok()) { PmeSolid * pSolid = pPart->GetExplicitModel()->GetSolid(); SetSolid(pSolid); } // api_clear_annotations(); API_END }
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))); //改为你的视图类 }
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; }