Example #1
0
bool CSketch::IsCircle()const
{
	if (m_objects.size() == 1)
	{
		return m_objects.front()->GetType() == CircleType;
	}

	if (m_objects.size() > 1)
	{
		if (m_objects.front()->GetType() != ArcType)
			return false;
		HArc* reference_arc = (HArc*)(m_objects.front());
		gp_Circ reference_circle = reference_arc->GetCircle();

		for (std::list<HeeksObj*>::const_iterator It = m_objects.begin(); It != m_objects.end(); It++)
		{
			HeeksObj* span = *It;
			if (span->GetType() != ArcType)
				return false;

			HArc* arc = (HArc*)span;
			gp_Circ circle = arc->GetCircle();

			if (fabs(circle.Radius() - reference_circle.Radius()) > wxGetApp().m_geom_tol)
				return false;

			if (!circle.Axis().Direction().IsEqual(reference_circle.Axis().Direction(), 0.01))
				return false;
		}
		return true;
	}

	return false;
}
Example #2
0
HeeksObj* CreateRuledFromSketches(std::list<HeeksObj*> list, bool make_solid)
{
	std::list<TopoDS_Wire> wire_list;
	for(std::list<HeeksObj *>::iterator It = list.begin(); It != list.end(); It++)
	{
		HeeksObj* object = *It;
		if(object->GetType() == SketchType)
		{
			std::list<HeeksObj*> s;
			s.push_back(object);
			TopoDS_Wire wire;
			if(ConvertLineArcsToWire2(s, wire))
			{
				wire_list.push_back(wire);
			}
		}
	}

	TopoDS_Shape shape;
	if(CreateRuledSurface(wire_list, shape, make_solid))
	{
		return CShape::MakeObject(shape, _("Ruled Surface"), SOLID_TYPE_UNKNOWN, HeeksColor(51, 45, 51), 1.0f);
	}
	return NULL;
}
Example #3
0
void GetSketchMenuTools(std::list<Tool*>* t_list){
	int count=0;
	bool gotsketch=false;
	bool gotpart=false;
	// check to see what types have been marked
	std::list<HeeksObj*>::const_iterator It;
	for(It = wxGetApp().m_marked_list->list().begin(); It != wxGetApp().m_marked_list->list().end(); It++){
		HeeksObj* object = *It;
		if(object->GetType() == SketchType)
			gotsketch=true;
		if(object->GetType() == PartType)
			gotpart=true;
		count++;
	}

    if (gotsketch)
    {
        t_list->push_back(&simplify_sketch_tool);
        t_list->push_back(&simplify_sketch_to_bsplines_tool);

        // t_list->push_back(&fix_wire);    /* This is not ready yet */
    }

	if(count == 2 && gotsketch && gotpart)
		t_list->push_back(&add_to_part);

	if(count!=1 || !gotsketch)
		return;

	t_list->push_back(&pad_sketch);
	t_list->push_back(&pocket_sketch);
	t_list->push_back(&make_to_part);
}
Example #4
0
HeeksObj* CShape::CommonShapes(std::list<HeeksObj*> &list_in)
{
	// find common solid ( intersect ) with the first one in the list all the others
	HeeksObj* s1 = NULL;
	bool s1_set = false;
	std::list<HeeksObj*> list = list_in;

	for(std::list<HeeksObj*>::const_iterator It = list.begin(); It != list.end(); It++){
		HeeksObj* object = *It;
		if(object->GetType() == SolidType || object->GetType() == FaceType)
		{
			if(!s1_set)
			{
				s1 = object;
				s1_set = true;
			}
			else{
				s1 = Common(s1, object);
			}
		}
	}

	wxGetApp().Repaint();

	return s1;
}
Example #5
0
/**
    Augment my list of child CFixture objects with any found in the CFixtures (children)
    passed in.
 */
void CFixtures::CopyFrom(const HeeksObj* object)
{
    if (object->GetType() == GetType())
    {
        for (HeeksObj *child = ((HeeksObj *) object)->GetFirstChild(); child != NULL; child = ((HeeksObj *) object)->GetNextChild())
        {
            if (child->GetType() == FixtureType)
            {
                bool found = false;
                for (HeeksObj *mine = GetFirstChild(); ((mine != NULL) && (! found)); mine = GetNextChild())
                {
                    if (mine->GetType() == FixtureType)
                    {
                        if (((*(CFixture *) mine)) == (*((CFixture *) child)))
                        {
                            found = true;
                            break;
                        } // End if - then
                    } // End if - then
                } // End for
                if (! found)
                {
                    Add( child, NULL );
                } // End if - then
            } // End if - then
        } // End for
    } // End if - then
}
Example #6
0
void CSketch::ReverseSketch()
{
	if(m_objects.size() == 0)return;

	std::list<HeeksObj*> new_list;
	std::list<HeeksObj*> old_list = m_objects;

	for(std::list<HeeksObj*>::iterator It=m_objects.begin(); It!=m_objects.end() ;It++)
	{
		HeeksObj* object = *It;
		HeeksObj* copy = object->MakeACopy();
		ReverseObject(copy);
		new_list.push_front(copy);
	}

	Clear();
	for(std::list<HeeksObj*>::iterator It = new_list.begin(); It != new_list.end(); It++)
	{
		HeeksObj* object = *It;
		Add(object, NULL);
	}
	//TODO: this is a hack. Must call remove before add, or else add has no effect. Why are we calling this here?
	wxGetApp().ObserversOnChange(NULL,&old_list,NULL);
	wxGetApp().ObserversOnChange(&new_list,NULL,NULL);
}
Example #7
0
	void Run()
	{
	    CBox bounding_box;

	    for (HeeksObj *object = m_pThis->GetFirstChild(); object != NULL; object = m_pThis->GetNextChild())
	    {
                object->GetBox(bounding_box);
		}

        // add tool radius all around the box
        if(bounding_box.m_valid)
        {
            CTool *pTool = CTool::Find(m_pThis->m_tool_number);
            if(pTool)
            {
                double extra = pTool->m_params.m_diameter/2 + 0.01;
                bounding_box.m_x[0] -= extra;
                bounding_box.m_x[1] -= extra;
                bounding_box.m_x[3] += extra;
                bounding_box.m_x[4] += extra;
            }
        }

	    m_pThis->m_params.m_box = bounding_box;
		m_pThis->SetDepthOpParamsFromBox();
	}
Example #8
0
void ConvertToFaceOrWire(std::list<HeeksObj*> list, std::list<TopoDS_Shape> &faces_or_wires, bool face_not_wire)
{
	std::list<HeeksObj*> sketches_or_faces_to_delete;

	for(std::list<HeeksObj *>::const_iterator It = list.begin(); It != list.end(); It++)
	{
		HeeksObj* object = *It;
		switch(object->GetType())
		{
		case SketchType:
		case CircleType:
			{
				if(ConvertSketchToFaceOrWire(object, faces_or_wires, face_not_wire))
				{
					if(wxGetApp().m_extrude_removes_sketches)sketches_or_faces_to_delete.push_back(object);
				}
			}
			break;

		case FaceType:
			faces_or_wires.push_back(((CFace*)object)->Face());
			if(wxGetApp().m_extrude_removes_sketches)sketches_or_faces_to_delete.push_back(object);
			break;

		default:
			break;
		}
	}

	wxGetApp().DeleteUndoably(sketches_or_faces_to_delete);
}
Example #9
0
void TransformObjectsTool::Run(bool redo){
	std::list<HeeksObj*>::iterator It;
	for(It = m_list.begin(); It != m_list.end(); It++){
		HeeksObj* object = *It;
		object->ModifyByMatrix(modify_matrix);
	}
	wxGetApp().WereModified(m_list);
}
Example #10
0
void TransformObjectsTool::RollBack(){
	std::list<HeeksObj*>::const_iterator It;
	for(It = m_list.begin(); It != m_list.end(); It++){
		HeeksObj* object = *It;
		object->ModifyByMatrix(revert_matrix);
	}
	wxGetApp().WereModified(m_list);
}
Example #11
0
void CSketch::SetColor(const HeeksColor &col)
{
	std::list<HeeksObj*>::iterator It;
	for(It=m_objects.begin(); It!=m_objects.end() ;It++)
	{
		HeeksObj* object = *It;
		object->SetColor(col);
	}
}
Example #12
0
//static
void TransformTools::RemoveUncopyable()
{
	std::list<HeeksObj*> uncopyable_objects;
	for(std::list<HeeksObj*>::const_iterator It = wxGetApp().m_marked_list->list().begin(); It != wxGetApp().m_marked_list->list().end(); It++)
	{
		HeeksObj* object = *It;
		if(!object->CanBeCopied())uncopyable_objects.push_back(object);
	}
	if(uncopyable_objects.size() > 0)wxGetApp().m_marked_list->Remove(uncopyable_objects, true);
}
void GripperSelTransform::OnGripperMoved( double* from, const double* to ){
	if ( m_data.m_type == GripperTypeStretch)
	{
		bool stretch_done = false;

		double shift[3];
		if(m_data.m_move_relative){
			shift[0] = to[0] - from[0];
			shift[1] = to[1] - from[1];
			shift[2] = to[2] - from[2];
		}
		else{
			shift[0] = to[0] - m_initial_grip_pos[0];
			shift[1] = to[1] - m_initial_grip_pos[1];
			shift[2] = to[2] - m_initial_grip_pos[2];
		}

		{
			std::list<HeeksObj *>::iterator It;
			for ( It = m_items_marked_at_grab.begin(); It != m_items_marked_at_grab.end(); It++ )
			{
				HeeksObj* object = *It;
				if(object)
				{
					double p[3] = {m_data.m_x, m_data.m_y, m_data.m_z};
					stretch_done = object->StretchTemporary(p, shift,m_data.m_data);
				}
			}
		}
		
		if(stretch_done)
		{
			m_data.m_x += shift[0];
			m_data.m_y += shift[1];
			m_data.m_z += shift[2];
			from[0] += shift[0];
			from[1] += shift[1];
			from[2] += shift[2];
			m_initial_grip_pos[0] += shift[0];
			m_initial_grip_pos[1] += shift[1];
			m_initial_grip_pos[2] += shift[2];
		}

		wxGetApp().Repaint(true);
		return;
	}

	double object_m[16] = {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1};

	if(m_items_marked_at_grab.size() > 0)m_items_marked_at_grab.front()->GetScaleAboutMatrix(object_m);

	MakeMatrix ( from, to, object_m, wxGetApp().m_drag_matrix );

	wxGetApp().Repaint();
}
Example #14
0
void CSketchOp::glCommands(bool select, bool marked, bool no_color)
{
	CDepthOp::glCommands(select, marked, no_color);

	if (select || marked)
	{
		// allow sketch operations to be selected
		HeeksObj* sketch = heeksCAD->GetIDObject(SketchType, m_sketch);
		if (sketch)sketch->glCommands(select, marked, no_color);
	}
}
Example #15
0
 void Run()
 {
     for(HeeksObj* object = object_for_tools->GetFirstChild(); object; object = object_for_tools->GetNextChild())
     {
         if(COperations::IsAnOperation(object->GetType()))
         {
             ((COp*)object)->m_active = true;
         }
     }
     heeksCAD->Changed();
 }
Example #16
0
static void GetWorldBox(CBox &box)
{
	// gets the extents of the volume of all the solids
	for(HeeksObj* object = wxGetApp().GetFirstChild(); object != NULL; object = wxGetApp().GetNextChild())
	{
		if(object->GetIDGroupType() == SolidType)
		{
			object->GetBox(box);
		}
	}
}
Example #17
0
	void Run()
	{
		for(HeeksObj* object = object_for_tools->GetFirstChild(); object; object = object_for_tools->GetNextChild())
		{
			if(COperations::IsAnOperation(object->GetType()))
			{
				((COp*)object)->m_active.SetValue ( false );
				heeksCAD->EndHistory();
			}
		}
	}
Example #18
0
void CSelectMode::GetObjectsInWindow(wxMouseEvent& event, std::list<HeeksObj*> &objects)
{
	if(window_box.width > 0){
		// only select objects which are completely within the window
		MarkedObjectManyOfSame marked_object;
		wxGetApp().m_marked_list->ObjectsInWindow(window_box, &marked_object, false);
		std::set<HeeksObj*> obj_set;
		for(HeeksObj* object = marked_object.GetFirstOfTopOnly(); object; object = marked_object.Increment())if(object->GetType() != GripperType)
			obj_set.insert(object);

		int bottom = window_box.y;
		int top = window_box.y + window_box.height;
		int height = abs(window_box.height);
		if(top < bottom)
		{
			int temp = bottom;
			bottom = top;
			top = temp;
		}

		wxRect strip_boxes[4];
		// top
		strip_boxes[0] = wxRect(window_box.x - 1, top, window_box.width + 2, 1);
		// bottom
		strip_boxes[1] = wxRect(window_box.x - 1, bottom - 1, window_box.width + 2, 1);
		// left
		strip_boxes[2] = wxRect(window_box.x - 1, bottom, 1, height);
		// right
		strip_boxes[3] = wxRect(window_box.x + window_box.width, bottom, 1, height);

		for(int i = 0; i<4; i++)
		{
			MarkedObjectManyOfSame marked_object2;
			wxGetApp().m_marked_list->ObjectsInWindow(strip_boxes[i], &marked_object2, false);
			for(HeeksObj* object = marked_object2.GetFirstOfTopOnly(); object; object = marked_object2.Increment())if(object->GetType() != GripperType)
				obj_set.erase(object);
		}

		for(std::set<HeeksObj*>::iterator It = obj_set.begin(); It != obj_set.end(); It++)
		{
			if(!event.ControlDown() || !wxGetApp().m_marked_list->ObjectMarked(*It))objects.push_back(*It);
		}
	}
	else{
		// select all the objects in the window, even if only partly in the window
		MarkedObjectManyOfSame marked_object;
		wxGetApp().m_marked_list->ObjectsInWindow(window_box, &marked_object, false);
		for(HeeksObj* object = marked_object.GetFirstOfTopOnly(); object; object = marked_object.Increment())
		{
			if(object->GetType() != GripperType && (!event.ControlDown() || !wxGetApp().m_marked_list->ObjectMarked(object)))
				objects.push_back(object);
		}
	}
}
Example #19
0
HeeksObj *VectorFont::Glyph::GlyphArc::Sketch( const gp_Pnt & location, const gp_Trsf & transformation_matrix, const float width, COrientationModifier *pOrientationModifier ) const
{
	double start[3];
	double end[3];
	double centre[3];
	double up[3];

	gp_Pnt centre_point( location.X() + m_xcentre, location.Y() + m_ycentre, location.Z() );
	gp_Pnt start_point( centre_point.X() + m_radius, centre_point.Y(), centre_point.Z() );
	gp_Pnt end_point( centre_point.X() + m_radius, centre_point.Y(), centre_point.Z() );

    gp_Dir z_direction( 0, 0, 1 );

    if (pOrientationModifier) centre_point = pOrientationModifier->Transform(transformation_matrix, location.Distance(gp_Pnt(0.0,0.0,0.0)), centre_point, width );

    if (pOrientationModifier) start_point = pOrientationModifier->Transform(transformation_matrix, location.Distance(gp_Pnt(0.0,0.0,0.0)), start_point, width );

	gp_Trsf start_rotation_matrix;
	start_rotation_matrix.SetRotation( gp_Ax1(centre_point, z_direction), m_start_angle );
	start_point.Transform(start_rotation_matrix);	// Rotate to start_angle

	start[0] = start_point.X();
	start[1] = start_point.Y();
	start[2] = start_point.Z();

	if (pOrientationModifier) end_point = pOrientationModifier->Transform(transformation_matrix, location.Distance(gp_Pnt(0.0,0.0,0.0)), end_point, width );

	gp_Trsf end_rotation_matrix;
	end_rotation_matrix.SetRotation( gp_Ax1(centre_point, z_direction), m_end_angle );
	end_point.Transform(end_rotation_matrix);	// Rotate to start_angle

	end[0] = end_point.X();
	end[1] = end_point.Y();
	end[2] = end_point.Z();



	centre[0] = centre_point.X();
	centre[1] = centre_point.Y();
	centre[2] = centre_point.Z();

	gp_Pnt up_point( 0.0, 0.0, 1.0 );

	// For counter-clockwise (always in this font format)
	up[0] = up_point.X();
	up[1] = up_point.Y();
	up[2] = up_point.Z();

	HeeksObj *arc = heekscad_interface.NewArc( start, end, centre, up );
	double m[16];
	extract(transformation_matrix,m);
	arc->ModifyByMatrix(m);
	return(arc);
} // End Sketch() method
Example #20
0
/**
	The location is relative both to (0,0,0) and, from there, to the point along the text string
	for this character.  The transformation matrix is both a translation (movement) and a
	rotation function that is maintained by the HText class based on where the operator has
	placed the text.  i.e. the location is in 'internal' coordinates and those are then
	transformed (moved and/or rotated) by the rotation matrix to determine the final
	coordinates.  This is handled differently to the glCommands() method because the OpenGL
	libraries will have had the transformation matrix pushed onto the stack so that all
	OpenGL coordinates will be implicitly transformed.
 */
HeeksObj *VectorFont::Glyph::Sketch( const gp_Pnt & location, const gp_Trsf & transformation_matrix, const float width, COrientationModifier *pOrientationModifier ) const
{
	HeeksObj *sketch = heekscad_interface.NewSketch();

	for (GraphicsList_t::const_iterator l_itGraphic = m_graphics_list.begin(); l_itGraphic != m_graphics_list.end(); l_itGraphic++)
	{
		sketch->Add((*l_itGraphic)->Sketch( location, transformation_matrix, width, pOrientationModifier ), NULL);
	} // End for

	return(sketch);
} // End Sketch() method
Example #21
0
/**
	This is ALMOST the same as the assignment operator.  The difference is that
	this method augments its local list of operations with those passed in rather
	than replacing them.
 */
void COperations::CopyFrom(const HeeksObj *object)
{
    if (object->GetType() == GetType())
    {
        COperations *rhs = (COperations*)object;
        for (HeeksObj *child = rhs->GetFirstChild(); child != NULL; child = rhs->GetNextChild())
        {
            child->SetID( heeksCAD->GetNextID(child->GetType()) );
            Add(child, NULL);
        } // End for
    }
}
Example #22
0
void CSelectMode::OnRender()
{
	for(std::list<HeeksObj*>::iterator It = m_highlighted_objects.begin(); It != m_highlighted_objects.end(); It++)
	{
		HeeksObj* object = *It;
		wxGetApp().m_highlight_color.glColor();
		glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
		glEnable(GL_COLOR_MATERIAL);
		object->glCommands(false, true, true);
		glDisable(GL_COLOR_MATERIAL);
	}
}
Example #23
0
void ObjList::Draw(wxDC& dc){
	HeeksObj::Draw(dc);
	std::list<HeeksObj*>::iterator It;
	for(It=m_objects.begin(); It!=m_objects.end() ;It++)
	{
		HeeksObj* object = *It;
		if(object->OnVisibleLayer() && object->m_visible)
		{
			object->Draw(dc);
		}
	}
}
Example #24
0
void HeeksObj::GetGripperPositionsTransformed(std::list<GripData> *list, bool just_for_endof)
{
#ifdef HEEKSCAD

	//TODO: We want to transform these coords by whatever has happened to the draw matrix on the way down to our level
	//For right now we are just grabbing the sketches coord system, but this isn't right and won't work when parts or
	//assemblies come around.
	//For that matter it has gotten out of control with the addition of faces and edges to pads
	std::list<GripData> newlist;
	GetGripperPositions(&newlist,just_for_endof);

	gp_Trsf mat;

#ifdef MULTIPLE_OWNERS
	HeeksObj* owner = Owner();
	CSketch *sketch = dynamic_cast<CSketch*>(owner);
#else
	CSketch *sketch = dynamic_cast<CSketch*>(m_owner);
#endif

	if(sketch && sketch->m_coordinate_system)
		mat = sketch->m_coordinate_system->GetMatrix();

#ifdef MULTIPLE_OWNERS
	CPad *pad = dynamic_cast<CPad*>(owner);
	if(!pad && owner)
		pad = dynamic_cast<CPad*>(owner->Owner());
#else
	CPad *pad = dynamic_cast<CPad*>(m_owner);
	if(!pad && m_owner)
		pad = dynamic_cast<CPad*>(m_owner->m_owner);
#endif
	if(pad && pad->m_sketch->m_coordinate_system)
		mat = pad->m_sketch->m_coordinate_system->GetMatrix();

	std::list<GripData>::iterator it;
	for(it = newlist.begin(); it != newlist.end(); ++it)
	{
		GripData gd = *it;

		gp_Pnt pnt(gd.m_x,gd.m_y,gd.m_z);
		pnt.Transform(mat);
		gd.m_x = pnt.X();
		gd.m_y = pnt.Y();
		gd.m_z = pnt.Z();
		list->push_back(gd);
	}
#else
	GetGripperPositions(list,just_for_endof);
#endif
}
Example #25
0
static void	WriteTools(std::wofstream &ofs)
{
	ofs<<"GRAY = 0x505050\n";
	ofs<<"RED = 0x600000\n";
	ofs<<"BLUE = 0x000050\n";
	for(HeeksObj* object = wxGetApp().m_program->Tools()->GetFirstChild(); object != NULL; object = wxGetApp().m_program->Tools()->GetNextChild())
	{
		if(object->GetType() == ToolType)
		{
			CTool* tool = (CTool*)object;
			ofs<<"toolpath.tools["<<tool->m_tool_number<<"] = "<<tool->VoxelcutDefinition().c_str()<<"\n";
		}
	}
}
Example #26
0
bool CSketchRelinker::AddNext()
{
	// returns true, if another object was added to m_new_lists

	if(m_new_back)
	{
		bool added = false;

		// look through all of the old list, starting at m_old_front
		std::list<HeeksObj*>::const_iterator It = m_old_front;
		do{
			It++;
			if(It == m_old_list.end())It = m_old_list.begin();
			HeeksObj* object = *It;

			added = TryAdd(object);

		}while(It != m_old_front && !added);

		if(added)return true;

		// nothing fits the current new list

		m_new_back = NULL;
		m_new_front = NULL;

		if(m_old_list.size() > m_added_from_old_set.size())
		{
			// there are still some to add, find a unused object
			for(std::list<HeeksObj*>::const_iterator It = m_old_list.begin(); It != m_old_list.end(); It++)
			{
				HeeksObj* object = *It;
				if(m_added_from_old_set.find(object) == m_added_from_old_set.end())
				{
					HeeksObj* new_object = object->MakeACopy();
					std::list<HeeksObj*> empty_list;
					m_new_lists.push_back(empty_list);
					m_new_lists.back().push_back(new_object);
					m_added_from_old_set.insert(object);
					m_old_front = It;
					m_new_back = new_object;
					m_new_front = new_object;
					return true;
				}
			}
		}
	}

	return false;
}
Example #27
0
static bool GetSymbols(std::list< std::pair<int,unsigned int> >& symbols )
{
	// check for at least one sketch selected
	const std::list<HeeksObj*>& list = heeksCAD->GetMarkedList();
	for(std::list<HeeksObj*>::const_iterator It = list.begin(); It != list.end(); It++)
	{
		HeeksObj* object = *It;
		if(object->GetIDGroupType() == SketchType)
		{
                  symbols.push_back(std::make_pair(object->GetType(), object->m_id));
		}
	}

	if(symbols.size() == 0)return false;

	return true;
}
Example #28
0
void MarkedList::create_move_grips(){
	delete_move_grips(true);
	int number_of_grips_made = 0;
	std::list<HeeksObj*>::iterator Iter ;
	for(Iter = m_list.begin(); Iter != m_list.end() && number_of_grips_made<100; Iter++){
		HeeksObj* object = *Iter;
		if(object->GetType() == GripperType)continue;
		std::list<GripData> vl;
		std::list<GripData>::iterator It;
		object->GetGripperPositionsTransformed(&vl, false);
		for(It = vl.begin(); It != vl.end() && number_of_grips_made<100; It++)
		{
			move_grips.push_back(new GripperSelTransform(*It, object));
			number_of_grips_made++;
		}
	}
}
Example #29
0
CWaterline::CWaterline(const std::list<int> &solids, const int tool_number)
    :CDepthOp(GetTypeString(), NULL, tool_number, WaterlineType), m_solids(solids)
{
	ReadDefaultValues();

	// set m_box from the extents of the solids
	for(std::list<int>::const_iterator It = solids.begin(); It != solids.end(); It++)
	{
		int solid = *It;
		HeeksObj* object = heeksCAD->GetIDObject(SolidType, solid);
		if(object)
		{
			if(object->GetType() == StlSolidType)
			{
				object->GetBox(m_params.m_box);
			}
			else
			{
				double extents[6];
				if(heeksCAD->BodyGetExtents(object, extents))
				{
					m_params.m_box.Insert(CBox(extents));
				}
			}

			Add(object, NULL);
		}
	}
	m_solids.clear();

	SetDepthOpParamsFromBox();

	// add tool radius all around the box
	if(m_params.m_box.m_valid)
	{
		CTool *pTool = CTool::Find(m_tool_number);
		if(pTool)
		{
			double extra = pTool->m_params.m_diameter/2 + 0.01;
			m_params.m_box.m_x[0] -= extra;
			m_params.m_box.m_x[1] -= extra;
			m_params.m_box.m_x[3] += extra;
			m_params.m_box.m_x[4] += extra;
		}
	}
}
Example #30
0
void ManyRemoveOrAddTool::Remove()
{
	std::list<HeeksObj*>::iterator It;
	for(It = m_objects.begin(); It != m_objects.end(); It++){
		HeeksObj* object = *It;
		m_owner->Remove(object);
		wxGetApp().m_marked_list->Remove(object, false);
	}

	wxGetApp().WereRemoved(m_objects);
	wxGetApp().WasModified(m_owner);
	for(It = m_objects.begin(); It != m_objects.end(); It++){
		HeeksObj* object = *It;
		object->SetOwner(NULL);
	}

	m_belongs_to_owner = false;
}