예제 #1
0
/**
	Find out how high up all the objects are for this operation.   From this we
	will determine how far to retract the  tool so as not to hit
	them during rapid movements.
 */
double CAdaptive::GetMaxHeight( const int object_type, const std::list<int> & object_ids )
{
	// Look through the objects that make up the model and find a safe height.
	bool l_bValueUnset = true;
	double max_z = -999999;
	for (std::list<int>::const_iterator l_itObjectID = object_ids.begin(); l_itObjectID != object_ids.end(); l_itObjectID++)
	{
		HeeksObj *ob = heeksCAD->GetIDObject( object_type, *l_itObjectID );
		if (ob != NULL)
		{
			CBox bbox;
			ob->GetBox( bbox );
			{
				if ((l_bValueUnset) || (bbox.MaxZ() > max_z))
				{
					max_z = bbox.MaxZ();
					l_bValueUnset = false;
				} // End if - then
			} // End if - then
		} // End if - then
	} // End for

	return(max_z);
} // End GetMaxHeight() method
예제 #2
0
파일: Simulate.cpp 프로젝트: play113/swer
static void	WriteCoords(std::wofstream &ofs)
{
	CBox box;
	GetWorldBox(box);

	if(!box.m_valid)
	{
		box = CBox(-100, -100, -50, 100, 100, 50);
	}
	else
	{
		while(box.Width() < 100){box.m_x[0] -= 5.0; box.m_x[3] += 5.0;}
		while(box.Height() < 100){box.m_x[1] -= 5.0; box.m_x[4] += 5.0;}
		box.m_x[2] -= 10.0;
	}

	ofs<<"toolpath.coords = Coords("<<box.MinX()<<", "<<box.MinY()<<", "<<box.MinZ()<<", "<<box.MaxX()<<", "<<box.MaxY()<<", "<<box.MaxZ()<<")\n";
}