Example #1
0
void QVX_Object::ExportXYZ(void)
{
	QString OutFilePath = QFileDialog::getSaveFileName(NULL, "Export XYZ Coordinates", GetLastDir(), "TXT Files (*.txt)");

	QFile File(OutFilePath);
		
	if (!File.open(QIODevice::WriteOnly | QIODevice::Text)) {
		QMessageBox::warning(NULL, "File read error", "Could not open file. Aborting.");
		return;
	}
	QTextStream out(&File); 

	out << "MatIndex" << "\t" << "X (m)" << "\t" << "Y (m)" << "\t" << "Z (m)" << "\n";

	Vec3D<> Coord;
	int Mat;
	for (int i=0; i<GetStArraySize(); i++){
		Mat = GetMat(i);
		if (Mat != 0){
			Coord = GetXYZ(i);
			out << Mat << "\t" << Coord.x << "\t" << Coord.y << "\t" << Coord.z << "\n";
		}
	}

	File.close();
	SetLastDir(OutFilePath);

}
Example #2
0
void QVX_Environment::SaveBCs(void)
{
	QString TmpPath = QFileDialog::getSaveFileName(NULL, "Save Boundary Conditions", GetLastDir(), "DM Boundary Condition Files (*.bcx)");
	if(!TmpPath.isNull()){
		SaveBCXFile(TmpPath.toStdString()); //store only the palette
		SetLastDir(TmpPath);
	}
}
Example #3
0
void QVX_Sim::SaveVXA(QString* pFilenameOut)
{
	QString TmpPath = QFileDialog::getSaveFileName(NULL, "Save VoxCad Analysis", GetLastDir(), "VoxCad Analysis Files (*.vxa)");
	if (!TmpPath.isNull()){
		SaveVXAFile(TmpPath.toStdString()); //store only the palette
		if (pFilenameOut) *pFilenameOut = QFileInfo(TmpPath).baseName();
		SetLastDir(TmpPath);
	}
}
Example #4
0
void QVX_Object::ExportKV6(void)
{
	QString TmpPath = QFileDialog::getSaveFileName(NULL, "Export KV6", GetLastDir(), "kv6 files (*.kv6)");
	if(!TmpPath.isNull()){
		ExportKV6File(TmpPath.toStdString());
		SetLastDir(TmpPath);
	}

}
Example #5
0
void QVX_Object::ExportSTL(void)
{
	QString TmpPath = QFileDialog::getSaveFileName(NULL, "Export STL", GetLastDir(), "Stereolithography Files (*.stl)");
	if(!TmpPath.isNull()){
		CVX_MeshUtil Obj;
		Obj.ToStl(TmpPath.toStdString(), this);
		SetLastDir(TmpPath);
	}
}
Example #6
0
bool QVX_Object::SavePal(void) //save a palette
{
	QString TmpPath = QFileDialog::getSaveFileName(NULL, "Save Palette", GetLastDir(), "VoxCad Palette Files (*.vxp)");
	if(!TmpPath.isNull()){
		SaveVXPFile(TmpPath.toStdString()); //store only the palette
		SetLastDir(TmpPath);
		return true;
	}
	return false;
}
Example #7
0
bool QVX_Object::OpenPal(void) //Open a palette
{
	QString TmpPath = QFileDialog::getOpenFileName(NULL, "Open Palette", GetLastDir(), "VoxCad Palette Files (*.vxp *.pal)");;
	
	if(!TmpPath.isNull()){
		LoadVXPFile(TmpPath.toStdString());
		SetLastDir(TmpPath);
		return true;
	}
	return false;
}
Example #8
0
//Environment
bool QVX_Environment::OpenBCs(void)
{
	QString TmpPath = QFileDialog::getOpenFileName(NULL, "Open Boundary Conditions", GetLastDir(), "VoxCad Boundary Condition Files (*.bcx)");;
	
	if(!TmpPath.isNull()){
		LoadBCXFile(TmpPath.toStdString());
		emit BCsChanged();
		SetLastDir(TmpPath);
		return true;
	}
	return false;
}
Example #9
0
void Dlg_EditPrim::ClickedLoadMesh(void)
{
	QString TmpPath = QFileDialog::getOpenFileName(NULL, "Load STL", GetLastDir(), "Stereolithography Files (*.stl)");
	CMesh tmp;
	tmp.LoadSTL(TmpPath.toStdString());
	tmp.CalcFaceNormals();
	tmp.DrawSmooth = false;

	pVXRegion->CreateMeshRegion(&tmp, Vec3D<>(0,0,0), Vec3D<>(1.0, 1.0, 1.0));

	UpdateUI();
	emit RequestUpdateGL();
}
cMenuBrowseFiles::cMenuBrowseFiles(cXinelibDevice *Dev, eMainMenuMode mode, bool OnlyQueue) :
    cOsdMenu( ( mode==ShowImages ? tr("Images") :
                mode==ShowMusic ? (!OnlyQueue ? tr("Play music") : tr("Add to playlist")) :
                /*mode==ShowFiles ?*/ tr("Play file")),
              2, 4),
    m_Mode(mode)
{
  m_Dev = Dev;
  m_OnlyQueue  = OnlyQueue;

  m_ConfigLastDir = GetLastDir();
  Set();
}
Example #11
0
bool QVX_Object::Open(QString* pFilenameOut) //Brings up file dialog to open VXC file
{
#ifdef DMU_ENABLED
	QString tmpPath = QFileDialog::getOpenFileName(NULL, "Open VXC", GetLastDir(), "Voxel CAD Files (*.vxc *.dmf);;DMUnit Files (*.dmu)");
#else
	QString tmpPath = QFileDialog::getOpenFileName(NULL, "Open VXC", GetLastDir(), "Voxel CAD Files (*.vxc *.dmf)");
#endif
	
	if (!tmpPath.isNull()){
		Close();
		#ifdef DMU_ENABLED
		if (tmpPath.right(3).compare("dmu", Qt::CaseInsensitive) == 0) ImportDMU(tmpPath.toStdString(), this);
		else
		#endif
		LoadVXCFile(tmpPath.toStdString());

		if (pFilenameOut) *pFilenameOut = QFileInfo(tmpPath).baseName();
		SetLastDir(tmpPath);

		return true;
	}
	return false;
}
Example #12
0
bool QVX_Sim::OpenVXA(QString* pFileNameOut)
{
	QString tmpPath = QFileDialog::getOpenFileName(NULL, "Open VoxCad Analysis", GetLastDir(), "VoxCad Analysis Files (*.vxa *.dmfea)");
	if (!tmpPath.isNull()){
		std::string ReturnString = "";
		LoadVXAFile(tmpPath.toStdString(), &ReturnString);
		if (ReturnString != "") QMessageBox::warning(NULL, "VXA Load", QString::fromStdString(ReturnString));
		emit BCsChanged();
		if (pFileNameOut) *pFileNameOut = QFileInfo(tmpPath).baseName();
		SetLastDir(tmpPath);
		return true;
	}
	return false;
}
Example #13
0
void QVX_Sim::ExportDeformedSTL(void)
{
	bool WasRunning = false;
	if (Running && !Paused){
		WasRunning = true;
		SimPauseToggle();
	}

	QString TmpPath = QFileDialog::getSaveFileName(NULL, "Export STL", GetLastDir(), "Stereolithography Files (*.stl)");
	if (!TmpPath.isNull()){
		this->VoxMesh.ToStl(TmpPath.toStdString(), this->pEnv->pObj, true);
		SetLastDir(TmpPath);
	}

	if (WasRunning) SimPauseToggle();
}
Example #14
0
//QVX_Object:
void QVX_Object::Save(int Compression, bool NewLoc, QString* pNewFilenameOut) //saves the file, or prompts if not yet been saved
{
	QString tmpPath = QString(Path.c_str());
	if (tmpPath == "" || NewLoc){ //if file path is empty string (IE not been saved yet)
		tmpPath = QFileDialog::getSaveFileName(NULL, "Save VXC", GetLastDir(), "Voxel CAD Files (*.vxc)");
		if (tmpPath == "") return; //if we canceled the dialog...
		SetLastDir(tmpPath);
	}

	if (!tmpPath.isNull()){
		Path = tmpPath.toStdString();
		SaveVXCFile(Path, Compression);
		if (pNewFilenameOut) *pNewFilenameOut = QFileInfo(tmpPath).baseName();

	}
	else Path = "";
}
void QVX_TensileTest::BeginTensileTest(QVX_Sim* pSim, int NumStepIn, double ConvThreshIn, Vec3D<double> MixRadIn, MatBlendModel ModelIn, double PolyExpIn)
//void QVX_TensileTest::BeginTensileTest(QVX_Environment* pEnvIn, int NumStepIn, double ConvThreshIn, double MixRadiusIn, MatBlendModel ModelIn, double PolyExpIn)
{
	//set up local copy of the environment and object...
	//QVX_Environment* pEnvIn = (QVX_Environment*) pSim->pEnv;

		
	LocObj = *(pSim->pEnv->pObj); //otherwise just simulate the original object.
	LocEnv = *pSim->pEnv; //set local environment params to those of the input
	LocEnv.pObj = &LocObj; //make sure local environment points to local object

	//set up blending if desired
	bool EnableBlending = false;
	if (MixRadIn.x != 0 || MixRadIn.y != 0 || MixRadIn.z != 0){ //if some blending...
		//check for 2 or fewer materials!
		if (LocObj.GetNumLeafMatInUse() > 2){
			QMessageBox::warning(NULL, "Warning", "Currently blending only supported with 2 or fewer materials. Aborting.");
			return;
		}
		EnableBlending = true;
		MixRadius = MixRadIn;
		BlendModel = ModelIn;
		PolyExp = PolyExpIn;

		if (MixRadius.x==0)MixRadius.x = LocObj.GetLatticeDim()/10000; //set to tiny fraction to avoid blowup of exponential function
		if (MixRadius.y==0)MixRadius.y = LocObj.GetLatticeDim()/10000; //set to tiny fraction to avoid blowup of exponential function
		if (MixRadius.z==0)MixRadius.z = LocObj.GetLatticeDim()/10000; //set to tiny fraction to avoid blowup of exponential function

		RenderMixedObject(pSim->pEnv->pObj, &LocObj, MixRadius); //if there's any mixing, we need to make it...

	}
	EnableFeature(VXSFEAT_BLENDING, EnableBlending);
	
	NumStep = NumStepIn;
	ConvThresh = ConvThreshIn;
	CurTick = 0;
	TotalTick = NumStep;
	CancelFlag = false;

	std::string Message = "";

	LocEnv.EnableFloor(false);
	LocEnv.EnableGravity(false);
	LocEnv.EnableTemp(false);

	Import(&LocEnv, NULL, &Message);
	EnableFeature(VXSFEAT_COLLISIONS, false);
	EnableFeature(VXSFEAT_EQUILIBRIUM_MODE, true);
	EnableFeature(VXSFEAT_PLASTICITY, false);
	EnableFeature(VXSFEAT_FAILURE, false);
	EnableFeature(VXSFEAT_VOLUME_EFFECTS, pSim->IsFeatureEnabled(VXSFEAT_VOLUME_EFFECTS)); //enables volume effects according to last set physics sandbox value
	SetStopConditionType(SC_MIN_MAXMOVE);
	SetStopConditionValue(ConvThreshIn);

	if (!DoBCChecks()) return;

	OutFilePath = QFileDialog::getSaveFileName(NULL, "Save Tensile Test Results", GetLastDir(), "TXT Files (*.txt)");
	
	pTensileView->VoxMesh.LinkSimVoxels(this, pTensileView);
	pTensileView->VoxMesh.DefMesh.DrawSmooth=false;

	//match view to current selection of the physics sandbox
	pTensileView->SetCurViewCol(pSim->pSimView->GetCurViewCol());
	pTensileView->SetCurViewMode(pSim->pSimView->GetCurViewMode());
	pTensileView->SetCurViewVox(pSim->pSimView->GetCurViewVox());
	pTensileView->SetViewAngles(pSim->pSimView->GetViewAngles());
	pTensileView->SetViewForce(pSim->pSimView->GetViewForce());
	emit StartExternalGLUpdate(33);

	TestRunning = true;
	if (OutFilePath != "") TensileThread.Execute(false);
//	RunTensileTest(&DispMesg);
	if (ProgressMessage != "") QMessageBox::warning(NULL, "warning", QString::fromStdString(ProgressMessage));

}