⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 htest6model.cpp

📁 hoops_acis_mfc框架
💻 CPP
字号:
// Htest6Model.cpp : implementation of the Htest6Model class
//

#include "StdAfx.h"
#include <afxtempl.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

#include "hc.h"
#include "HStream.h"
#include "HOpcodeShell.h"
#include "HUtility.h"

#include "Htest6Model.h"
#include "HTools.h"
#include "test6.h"


Htest6Model::Htest6Model()
{
	m_bSolidModel = false;
	SetBRepGeometry(false);


}

Htest6Model::~Htest6Model()
{
	// Model cleanup : delete all the entities from the 
	// partition associated with this model
	DeleteAllEntities();
}

// Delete all the entities in the current model from the 
// modeller and associated HOOPS geometry
void Htest6Model::DeleteAllEntities()
{
	HA_Delete_Entity_Geometry(m_entityList);
	api_del_entity_list(m_entityList);
	m_entityList.clear();
}

void Htest6Model::DeleteAcisEntity( ENTITY* entity)
{
	ENTITY_LIST elist;
	elist.add(entity);

	// delete from HOOPS
	HA_Delete_Entity_Geometry(elist);

	// delete from ACIS 
	api_del_entity(entity);
	m_entityList.remove(entity);
}


// our application-specific read function
HFileInputResult Htest6Model::Read(const char * FileName) 
{   
	CWaitCursor show_hourglass_cursor_through_this_function;

	unsigned int i;
	HFileInputResult success = InputOK;

	// get the file extension
	char extension[120]; 
	HUtility::FindFileNameExtension(FileName, extension);



	// read the file into the model object's model segment
    HC_Open_Segment_By_Key(m_ModelKey);	

		HC_Open_Segment("main");
			if  (streq(extension,"sat"))
			{  
				m_bSolidModel = true;
				SetBRepGeometry(true);

				HA_Read_Sat_File(FileName, m_entityList);	// read a SAT file
			} 
			else
			{
				// No special read - let the base class handle
				m_bSolidModel = false;
				success = HBaseModel::Read(FileName);
			}

 		HC_Close_Segment();
    HC_Close_Segment();

    return success;
}

// our application-specific write function
bool Htest6Model::Write(const char * FileName, HBaseView * view, 
									int version, int width, int height) 
{   
	CWaitCursor show_hourglass_cursor_through_this_function;

	unsigned int i;
	bool success = true;
 
	// get the file extension
	char extension[120]; 
	HUtility::FindFileNameExtension(FileName, extension);

	if (streq(extension,"sat"))
	{
		if (m_entityList.count() > 0)
			HA_Write_Sat_File(FileName, m_entityList);
	}
	else
	{
		if(!HBaseModel::Write(FileName, view, width, height))
			success = false;
	}
 
    return success;
}




⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -