RFO_File* ModelViewController::AddStl(STL stl, string filename)
{
	RFO_Object *parent = SelectedParent();
	if(parent == 0)
	{
		ProcessControl.rfo.Objects.push_back(RFO_Object());
		ProcessControl.rfo.BuildBrowser(ProcessControl);
		parent = SelectedParent();
	}
	assert(parent != 0);

	RFO_File r;
	r.stl = stl;

	size_t found;
	found=filename.find_last_of("/\\");
	r.location = filename.substr(found+1);
	//r.filetype = "";
	//string material;
	r.node = 0;	//???

	if (parent->files.size())
	{
		RFO_File *selectedFile=0;
		selectedFile = &parent->files[parent->files.size()-1];
		Vector3f p = selectedFile->transform3D.transform.getTranslation();
		Vector3f size = selectedFile->stl.Max - selectedFile->stl.Min;
		p.x += size.x + 5.0f; // 5mm space
		r.transform3D.transform.setTranslation(p);
	}

	parent->files.push_back(r);
	ProcessControl.rfo.BuildBrowser(ProcessControl);
	parent->files[parent->files.size()-1].node->select(true); // select the new stl file.
	ProcessControl.CalcBoundingBoxAndZoom();
	redraw();
	return &parent->files.back();
}
Exemple #2
0
void RFO::newObject()
{
  Objects.push_back(RFO_Object());
  update_model();
}
void ModelViewController::newObject()
{
	ProcessControl.rfo.Objects.push_back(RFO_Object());
	ProcessControl.rfo.BuildBrowser(ProcessControl);
}