示例#1
0
void Model::ReadStl(Glib::RefPtr<Gio::File> file)
{
  STL stl;
  if (stl.loadFile (file->get_path()) == 0)
    AddStl(NULL, stl, file->get_path());
  ModelChanged();
}
void ModelViewController::ReadStl(string filename)
{
	STL stl;
	bool ok = ProcessControl.ReadStl(filename, stl);
	if(ok)
		AddStl(stl, filename);
}
void ModelViewController::Duplicate()
{
	Flu_Tree_Browser::Node *node = gui->RFP_Browser->get_selected( 1 );
	// first check files
	for(uint o=0;o<ProcessControl.rfo.Objects.size();o++)
	{
		for(uint f=0;f<ProcessControl.rfo.Objects[o].files.size();f++)
		{
			if(ProcessControl.rfo.Objects[o].files[f].node == node)
			{
				// Move it, so there's room for it.
				RFO_File* obj = AddStl(ProcessControl.rfo.Objects[o].files[f].stl, ProcessControl.rfo.Objects[o].files[f].location);
				Vector3f p = ProcessControl.rfo.Objects[o].files[f].transform3D.transform.getTranslation();
				Vector3f size = ProcessControl.rfo.Objects[o].files[f].stl.Max - ProcessControl.rfo.Objects[o].files[f].stl.Min;
				p.x += size.x+5.0f;	// 5mm space
				obj->transform3D.transform.setTranslation(p);
				gui->RFP_Browser->set_hilighted(obj->node);
				ProcessControl.CalcBoundingBoxAndZoom();
				redraw();
				return;
			}
		}
	}
}