示例#1
0
void PickCreateRevolution()
{
	if(wxGetApp().m_marked_list->size() == 0)
	{
		wxGetApp().PickObjects(_("pick sketches, faces or circles"), MARKING_FILTER_CIRCLE | MARKING_FILTER_SKETCH | MARKING_FILTER_FACE);
	}

	double angle;
	{
		HeeksConfig config;
		config.Read(_T("RevolutionAngle"), &angle, 360.0);
	}

	if(InputRevolutionAngle(angle, &wxGetApp().m_extrude_to_solid))
	{
		{
			HeeksConfig config;
			config.Write(_T("RevolutionAngle"), angle);
		}
		if(wxGetApp().m_marked_list->size() > 0)
		{
			CreateExtrusionOrRevolution(wxGetApp().m_marked_list->list(), angle, wxGetApp().m_extrude_to_solid, true, 0.0, true);
		}
	}
}
示例#2
0
文件: Tag.cpp 项目: play113/swer
void CTag::ReadDefaultValues()
{
	HeeksConfig config;
	config.Read(_T("Width"), &m_width);
	config.Read(_T("Angle"), &m_angle);
	config.Read(_T("Height"), &m_height);
}
示例#3
0
文件: Sketch.cpp 项目: play113/swer
	void Run()
	{
	    wxString message(_("Use negative for smaller and Positive for larger)"));
	    wxString prompt(_("Enter the distance"));
	    wxString caption(_("Distance"));

		double distance;
		HeeksConfig config;
		config.Read(_T("CopyParallelDistance"), &distance, 1.0);
		if(wxGetApp().InputDouble(wxString(_("Use negative for smaller and Positive for larger)") ), _("Enter the distance"), distance))
		{
			config.Write(_T("CopyParallelDistance"), distance);
			HeeksObj *parallel_sketch = sketch_for_tools->Parallel( double(distance) );
			if (parallel_sketch != NULL)
			{
				wxGetApp().StartHistory();
				wxGetApp().AddUndoably(parallel_sketch, NULL, NULL);
				wxGetApp().EndHistory();
			}
			else
			{
				wxMessageBox(wxString(_("Error making offset")));
			}
		}
	}
示例#4
0
	// Tool's virtual functions
	void Run(){
		double offset_value = 2.0;
		HeeksConfig config;
		config.Read(_T("OffsetShapeValue"), &offset_value);
		if(wxGetApp().InputLength(_("Enter Offset Value, + for making bigger, - for making smaller"), _("Offset value"), offset_value))
		{
			try
			{
				TopoDS_Shape new_shape = BRepOffsetAPI_MakeOffsetShape(shape_for_tools->Shape(), offset_value, wxGetApp().m_geom_tol);

#ifdef TESTNEWSHAPE
				//This will end up throwing 90% of the exceptions caused by a bad offset
				BRepTools::Clean(new_shape);
				BRepMesh::Mesh(new_shape, 1.0);
#endif

				HeeksObj* new_object = CShape::MakeObject(new_shape, _("Result of 'Offset Shape'"), SOLID_TYPE_UNKNOWN, shape_for_tools->m_color, shape_for_tools->GetOpacity());
				shape_for_tools->HEEKSOBJ_OWNER->Add(new_object, NULL);
				shape_for_tools->HEEKSOBJ_OWNER->Remove(shape_for_tools);
				config.Write(_T("OffsetShapeValue"), offset_value);
			}
			catch (Standard_Failure) {
				Handle_Standard_Failure e = Standard_Failure::Caught();
				wxMessageBox(wxString(_("Error making offset")) + _T(": ") + Ctt(e->GetMessageString()));
			}
		}
	}
示例#5
0
文件: Tag.cpp 项目: play113/swer
void CTag::WriteDefaultValues()
{
	HeeksConfig config;
	config.Write(_T("Width"), m_width);
	config.Write(_T("Angle"), m_angle);
	config.Write(_T("Height"), m_height);
}
void COrientationModifierParams::set_initial_values()
{
	HeeksConfig config;

	config.Read(_T("OrientationModifier_m_spacing"), (int *) &m_spacing, int(eNormalSpacing));
	config.Read(_T("OrientationModifier_number_of_rotations"), (int *) &m_number_of_rotations, 0);
	config.Read(_T("OrientationModifier_sketch_rotates_text"), &m_sketch_rotates_text, false);
	config.Read(_T("OrientationModifier_justification"), (int *) &m_justification, int(eLeftJustified));
}
示例#7
0
文件: Edge.cpp 项目: Heeks/heekscad
	void Run(){
		double rad = 2.0;
		HeeksConfig config;
		config.Read(_T("EdgeBlendRadius"), &rad);
		if(wxGetApp().InputLength(_("Enter Blend Radius"), _("Radius"), rad))
		{
			edge_for_tools->Blend(rad,false);
			config.Write(_T("EdgeBlendRadius"), rad);
		}
	}
示例#8
0
文件: Edge.cpp 项目: Heeks/heekscad
	void Run(){
		double rad = 2.0;
		HeeksConfig config;
		config.Read(_T("EdgeChamferDist"), &rad);
		if(wxGetApp().InputLength(_("Enter Chamfer Distance"), _("Distance"), rad))
		{
			edge_for_tools->Blend(rad,true);
			config.Write(_T("EdgeChamferDist"), rad);
		}
	}
示例#9
0
文件: HDxf.cpp 项目: play113/swer
HeeksDxfRead::HeeksDxfRead(const wxChar* filepath, bool undoable) : CDxfRead(Ttc(filepath)), m_undoable(undoable)
{
	HeeksConfig config;

	config.Read(_T("ImportDxfAsSketches"), &m_make_as_sketch);
	config.Read(_T("IgnoreDxfReadErrors"), &m_ignore_errors);
	config.Read(_T("DxfReadPoints"), &m_read_points);
	config.Read(_T("LayerNameSuffixesToDiscard"), m_layer_name_suffixes_to_discard);

	m_current_block = NULL;
	extract(gp_Trsf(), m_ucs_matrix);
}
void COrientationModifierParams::write_values_to_config()
{
	// We always want to store the parameters in mm and convert them back later on.

	HeeksConfig config;

	// These values are in mm.
	config.Write(_T("OrientationModifier_m_spacing"), m_spacing);
	config.Write(_T("OrientationModifier_number_of_rotations"), m_number_of_rotations);
	config.Write(_T("OrientationModifier_sketch_rotates_text"), m_sketch_rotates_text);
	config.Write(_T("OrientationModifier_justification"), m_justification);
}
示例#11
0
文件: Pocket.cpp 项目: play113/swer
void CPocket::WriteDefaultValues()
{
	CSketchOp::WriteDefaultValues();

	HeeksConfig config;
	config.Write(_T("StepOver"), m_step_over);
	config.Write(_T("CutMode"), (int)(m_cut_mode));
	config.Write(_T("MaterialAllowance"), m_material_allowance);
	config.Write(_T("FromCenter"), m_starting_place);
	config.Write(_T("KeepToolDown"), m_keep_tool_down_if_poss);
	config.Write(_T("UseZigZag"), m_use_zig_zag);
	config.Write(_T("ZigAngle"), m_zig_angle);
	config.Write(_T("ZigUnidirectional"), m_zig_unidirectional);
	config.Write(_T("DecentStrategy"), (int)(m_entry_move));
}
示例#12
0
void PickCreateExtrusion()
{
	if(wxGetApp().m_marked_list->size() == 0)
	{
		wxGetApp().PickObjects(_("pick sketches, faces or circles"), MARKING_FILTER_CIRCLE | MARKING_FILTER_SKETCH | MARKING_FILTER_FACE);
	}

	double height;
	double taper_angle;
	{
		HeeksConfig config;
		config.Read(_T("ExtrusionHeight"), &height, 10.0);
		config.Read(_T("ExtrusionTaperAngle"), &taper_angle, 0.0);
	}

	if(InputExtrusionHeight(height, &(wxGetApp().m_extrude_to_solid), &taper_angle))
	{
		{
			HeeksConfig config;
			config.Write(_T("ExtrusionHeight"), height);
			config.Write(_T("ExtrusionTaperAngle"), taper_angle);
			config.Write(_T("ExtrudeToSolid"), wxGetApp().m_extrude_to_solid);
		}

		if(wxGetApp().m_marked_list->size() > 0)
		{
			wxGetApp().StartHistory();
			CreateExtrusionOrRevolution(wxGetApp().m_marked_list->list(),height, wxGetApp().m_extrude_to_solid, false, taper_angle);
			wxGetApp().EndHistory();
		}
	}
}
示例#13
0
文件: Pocket.cpp 项目: play113/swer
void CPocket::ReadDefaultValues()
{
	CSketchOp::ReadDefaultValues();

	HeeksConfig config;
	config.Read(_T("StepOver"), &m_step_over, 1.0);
	int int_mode = m_cut_mode;
	config.Read(_T("CutMode"), &int_mode, CPocket::eConventional);
	m_cut_mode = (CPocket::eCutMode)int_mode;
	config.Read(_T("MaterialAllowance"), &m_material_allowance, 0.2);
	config.Read(_T("FromCenter"), &m_starting_place, 1);
	config.Read(_T("KeepToolDown"), &m_keep_tool_down_if_poss, true);
	config.Read(_T("UseZigZag"), &m_use_zig_zag, false);
	config.Read(_T("ZigAngle"), &m_zig_angle);
	config.Read(_T("ZigUnidirectional"), &m_zig_unidirectional, false);
	int int_for_entry_move = CPocket::ePlunge;
	config.Read(_T("DecentStrategy"), &int_for_entry_move);
	m_entry_move = (CPocket::eEntryStyle) int_for_entry_move;
}
示例#14
0
void HRuler::WriteToConfig(HeeksConfig& config)
{
	config.Write(_T("RulerTrsf11"), m_trsf.Value(1, 1));
	config.Write(_T("RulerTrsf12"), m_trsf.Value(1, 2));
	config.Write(_T("RulerTrsf13"), m_trsf.Value(1, 3));
	config.Write(_T("RulerTrsf14"), m_trsf.Value(1, 4));
	config.Write(_T("RulerTrsf21"), m_trsf.Value(2, 1));
	config.Write(_T("RulerTrsf22"), m_trsf.Value(2, 2));
	config.Write(_T("RulerTrsf23"), m_trsf.Value(2, 3));
	config.Write(_T("RulerTrsf24"), m_trsf.Value(2, 4));
	config.Write(_T("RulerTrsf31"), m_trsf.Value(3, 1));
	config.Write(_T("RulerTrsf32"), m_trsf.Value(3, 2));
	config.Write(_T("RulerTrsf33"), m_trsf.Value(3, 3));
	config.Write(_T("RulerTrsf34"), m_trsf.Value(3, 4));

	config.Write(_T("RulerUseViewUnits"), m_use_view_units);
	config.Write(_T("RulerUnits"), m_units);
	config.Write(_T("RulerWidth"), m_width);
	config.Write(_T("RulerLength"), m_length);
	config.Write(_T("RulerEmptyLength"), m_empty_length);
}
示例#15
0
void HRuler::ReadFromConfig(HeeksConfig& config)
{
	double m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34;
	config.Read(_T("RulerTrsf11"), &m11, 1.0);
	config.Read(_T("RulerTrsf12"), &m12, 0.0);
	config.Read(_T("RulerTrsf13"), &m13, 0.0);
	config.Read(_T("RulerTrsf14"), &m14, 0.0);
	config.Read(_T("RulerTrsf21"), &m21, 0.0);
	config.Read(_T("RulerTrsf22"), &m22, 1.0);
	config.Read(_T("RulerTrsf23"), &m23, 0.0);
	config.Read(_T("RulerTrsf24"), &m24, 0.0);
	config.Read(_T("RulerTrsf31"), &m31, 0.0);
	config.Read(_T("RulerTrsf32"), &m32, 0.0);
	config.Read(_T("RulerTrsf33"), &m33, 1.0);
	config.Read(_T("RulerTrsf34"), &m34, 0.0);
	m_trsf.SetValues(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, 0.0001, 0.00000001);

	config.Read(_T("RulerUseViewUnits"), &m_use_view_units);
	config.Read(_T("RulerUnits"), &m_units);
	config.Read(_T("RulerWidth"), &m_width);
	config.Read(_T("RulerLength"), &m_length);
	config.Read(_T("RulerEmptyLength"), &m_empty_length);
}
示例#16
0
文件: Pocket.cpp 项目: play113/swer
// static
void CPocket::ReadFromConfig()
{
	HeeksConfig config;
	config.Read(_T("PocketSplineDeviation"), &max_deviation_for_spline_to_arc, 0.1);
}
示例#17
0
	void LoadSetttings()
    {
        HeeksConfig config;
        config.Read(_T("SketchToolOptions_reorder"), &m_reorder, true);
        config.Read(_T("SketchToolOptions_max_gap"), &m_max_gap, 0.001);
        config.Read(_T("SketchToolOptions_fix_small"), &m_fix_small, true);
        config.Read(_T("SketchToolOptions_fix_small_precision"), &m_fix_small_precision, 0.0254);
        config.Read(_T("SketchToolOptions_fix_self_intersection"), &m_fix_self_intersection, true);
        config.Read(_T("SketchToolOptions_fix_lacking"), &m_fix_lacking, true);
        config.Read(_T("SketchToolOptions_fix_degenerated"), &m_fix_degenerated, true);

        config.Read(_T("SketchToolOptions_modify_topology"), &m_modify_topology, true);
        config.Read(_T("SketchToolOptions_modify_geometry"), &m_modify_geometry, true);
        config.Read(_T("SketchToolOptions_closed_wire"), &m_closed_wire, true);
        config.Read(_T("SketchToolOptions_preference_pcurve"), &m_preference_pcurve, true);
        config.Read(_T("SketchToolOptions_fix_gaps_by_ranges"), &m_fix_gaps_by_ranges, true);
        config.Read(_T("SketchToolOptions_max_deviation"), &m_max_deviation, 0.001);
        config.Read(_T("SketchToolOptions_cleanup_tolerance"), &m_cleanup_tolerance, 0.000001);
        config.Read(_T("SketchToolOptions_degree_min"), &m_degree_min, 3);
        config.Read(_T("SketchToolOptions_degree_max"), &m_degree_max, 8);
        config.Read(_T("SketchToolOptions_continuity"), &m_continuity, 4);
		config.Read(_T("SketchToolOptions_sort_points"), &m_sort_points, false);
		config.Read(_T("SketchToolOptions_force_closed_shape"), &m_force_closed_shape, false);
    }
示例#18
0
void SaveSolids::Run(){
	std::list<HeeksObj*> 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;
		switch(object->GetType())
		{
		case SolidType:
		case StlSolidType:
		case FaceType:
		{
				objects.push_back(object);
			}
			break;
		}
	}

	if(objects.size() > 0)
	{
		wxString filepath(_T(""));
		{
			// get last used filepath
			HeeksConfig config;
			config.Read(_T("SolidExportFilepath"), &filepath, _T(""));
		}

		wxFileDialog fd(wxGetApp().m_frame, _("Save solid file"), wxEmptyString, filepath, wxString(_("Solid Files")) + _T(" |*.igs;*.iges;*.stp;*.step;*.stl;*.cpp;*.py;*.obj|") + _("IGES files") + _T(" (*.igs *.iges)|*.igs;*.iges|") + _("STEP files") + _T(" (*.stp *.step)|*.stp;*.step|") + _("STL files") + _T(" (*.stl)|*.stl|") + _("CPP files") + _T(" (*.cpp)|*.cpp|") + _("OpenCAMLib python files") + _T(" (*.py)|*.py|") + _("Wavefront .obj files") + _T(" (*.obj)|*.obj"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
		fd.SetFilterIndex(0);

		if (fd.ShowModal() == wxID_CANCEL)return;
		filepath = fd.GetPath();

		wxString wf(filepath);
		wf.LowerCase();

		if(wf.EndsWith(_T(".stl")))
		{
			wxGetApp().SaveSTLFile(objects, filepath, -1.0, NULL, wxGetApp().m_stl_save_as_binary);
		}
		else if(wf.EndsWith(_T(".cpp")))
		{
			wxGetApp().SaveCPPFile(objects, filepath);
		}
		else if (wf.EndsWith(_T(".py")))
		{
			wxGetApp().SavePyFile(objects, filepath);
		}
		else if (wf.EndsWith(_T(".obj")))
		{
			wxGetApp().SaveOBJFileAscii(objects, filepath);
		}
		else if (CShape::ExportSolidsFile(objects, filepath))
		{
		}
		else
		{
			wxMessageBox(_("Invalid solid file type chosen"));
			return;
		}

		{
			// save last used filepath
			HeeksConfig config;
			config.Write(_T("SolidExportFilepath"), filepath);
		}
	}
}
示例#19
0
//static
void TransformTools::Rotate(bool copy)
{
	//rotation axis - Z axis by default
	gp_Dir axis_Dir = gp_Dir(0,0,1);
	gp_Pnt line_Pos = gp_Pnt(0,0,0);

	// pick items
	if(wxGetApp().m_marked_list->size() == 0){
		wxGetApp().PickObjects(_("Pick objects to rotate"));
	}
	if(wxGetApp().m_marked_list->size() == 0)return;

	// get number of copies
	HeeksConfig config;
	int ncopies;
	config.Read(_T("RotateNumCopies"), &ncopies, 1);
	if(copy)
	{
		// check for uncopyable objects
		RemoveUncopyable();
		if(wxGetApp().m_marked_list->size() == 0)return;
	}

	// clear the selection
	std::list<HeeksObj *> selected_items = wxGetApp().m_marked_list->list();
	wxGetApp().m_marked_list->Clear(true);

	double angle;
	config.Read(_T("RotateAngle"), &angle, 90.0);

	// enter angle, plane and position
	double axis[3];
	double pos[3];
	config.Read(_T("RotateAxisX"), &axis[0], 0.0);
	config.Read(_T("RotateAxisY"), &axis[1], 0.0);
	config.Read(_T("RotateAxisZ"), &axis[2], 1.0);
	config.Read(_T("RotatePosX"), &pos[0], 0.0);
	config.Read(_T("RotatePosY"), &pos[1], 0.0);
	config.Read(_T("RotatePosZ"), &pos[2], 0.0);

	double axial_shift;
	config.Read(_T("RotateAxialShift"), &axial_shift, 0.0);

	if(!wxGetApp().InputAngleWithPlane(angle, axis, pos, copy ? &ncopies : NULL, &axial_shift))return;
	if(copy)
	{
		if(ncopies < 1)return;
		config.Write(_T("RotateNumCopies"), ncopies);
	}
	config.Write(_T("RotateAngle"), angle);
	config.Write(_T("RotateAxialShift"), axial_shift);
	config.Write(_T("RotateAxisX"), axis[0]);
	config.Write(_T("RotateAxisY"), axis[1]);
	config.Write(_T("RotateAxisZ"), axis[2]);
	config.Write(_T("RotatePosX"), pos[0]);
	config.Write(_T("RotatePosY"), pos[1]);
	config.Write(_T("RotatePosZ"), pos[2]);
	axis_Dir = gp_Dir(axis[0], axis[1], axis[2]);
	line_Pos = gp_Pnt(pos[0], pos[1], pos[2]);

	// transform the objects
	wxGetApp().CreateUndoPoint();
	if(copy)
	{
		for(int i = 0; i<ncopies; i++)
		{
			gp_Trsf mat;
			mat.SetRotation(gp_Ax1(line_Pos, axis_Dir), angle * M_PI/180 * (i+1));
			gp_Trsf tmat;
			tmat.SetTranslation(gp_Vec(axis_Dir.XYZ() * (axial_shift * ((double)(i+1)) / ncopies)));
			mat = tmat * mat;
			double m[16];
			extract(mat, m);
			for(std::list<HeeksObj*>::iterator It = selected_items.begin(); It != selected_items.end(); It++)
			{
				HeeksObj* object = *It;
				HeeksObj* new_object = object->MakeACopy();
				new_object->ModifyByMatrix(m);              // Rotate the duplicate object.
#ifdef MULTIPLE_OWNERS
				object->HEEKSOBJ_OWNER->Add(new_object, NULL);     // And add it to this object's owner
#else
				object->m_owner->Add(new_object, NULL);     // And add it to this object's owner
#endif
			}
		}
		wxGetApp().m_marked_list->Clear(true);
	}
	else
	{
		gp_Trsf mat;
		mat.SetRotation(gp_Ax1(line_Pos, axis_Dir), angle * M_PI/180);
		gp_Trsf tmat;
		tmat.SetTranslation(gp_Vec(axis_Dir.XYZ() * axial_shift));
		mat = tmat * mat;
		double m[16];
		extract(mat, m);
		wxGetApp().Transform(selected_items, m);
	}
	wxGetApp().Changed();
}
示例#20
0
    void SaveSettings()
    {
        HeeksConfig config;
        config.Write(_T("SketchToolOptions_reorder"), m_reorder);
        config.Write(_T("SketchToolOptions_max_gap"), m_max_gap);
        config.Write(_T("SketchToolOptions_fix_small"), m_fix_small);
        config.Write(_T("SketchToolOptions_fix_small_precision"), m_fix_small_precision);
        config.Write(_T("SketchToolOptions_fix_self_intersection"), m_fix_self_intersection);
        config.Write(_T("SketchToolOptions_fix_lacking"), m_fix_lacking);
        config.Write(_T("SketchToolOptions_fix_degenerated"), m_fix_degenerated);
        config.Write(_T("SketchToolOptions_modify_topology"), m_modify_topology);
        config.Write(_T("SketchToolOptions_modify_geometry"), m_modify_geometry);
        config.Write(_T("SketchToolOptions_closed_wire"), m_closed_wire);
        config.Write(_T("SketchToolOptions_preference_pcurve"), m_preference_pcurve);
        config.Write(_T("SketchToolOptions_fix_gaps_by_ranges"), m_fix_gaps_by_ranges);
        config.Write(_T("SketchToolOptions_max_deviation"), m_max_deviation);
        config.Write(_T("SketchToolOptions_cleanup_tolerance"), m_cleanup_tolerance);
        config.Write(_T("SketchToolOptions_degree_min"), m_degree_min);
        config.Write(_T("SketchToolOptions_degree_max"), m_degree_max);
        config.Write(_T("SketchToolOptions_continuity"), m_continuity);
		config.Write(_T("SketchToolOptions_sort_points"), m_sort_points);
		config.Read(_T("SketchToolOptions_force_closed_shape"), m_force_closed_shape);
    }
示例#21
0
void TransformTools::Scale(bool copy)
{
	// pick items
	if(wxGetApp().m_marked_list->size() == 0){
		wxGetApp().PickObjects(_("Pick objects to scale"));
	}
	if(wxGetApp().m_marked_list->size() == 0)return;

	// get number of copies
	int ncopies;
	HeeksConfig config;
	config.Read(_T("ScaleNumCopies"), &ncopies, 1);
	if(copy)
	{
		// check for uncopyable objects
		RemoveUncopyable();
		if(wxGetApp().m_marked_list->size() == 0)return;

		// input "number of copies"
		if(!wxGetApp().InputInt(_("Enter number of copies"), _("number of copies"), ncopies))return;
		if(ncopies < 1)return;
		config.Write(_T("ScaleNumCopies"), ncopies);
	}

	// clear the selection
	std::list<HeeksObj *> selected_items = wxGetApp().m_marked_list->list();
	wxGetApp().m_marked_list->Clear(true);

	// pick "centre" position
	if(!wxGetApp().PickPosition(_("Click centre position to scale about"), centre))return;

	// enter scale factor
	double scale;
	config.Read(_T("ScaleFactor"), &scale, 2.0);
	if(!wxGetApp().InputDouble(_("Enter scale factor"), _("scale factor"), scale))return;
	config.Write(_T("ScaleFactor"), scale);

	// transform the objects
	wxGetApp().CreateUndoPoint();
	if(copy)
	{
		for(int i = 0; i<ncopies; i++)
		{
			gp_Trsf mat;
			mat.SetScale(make_point(centre), scale * (i+1));
			double m[16];
			extract(mat, m);
			for(std::list<HeeksObj*>::iterator It = selected_items.begin(); It != selected_items.end(); It++)
			{
				HeeksObj* object = *It;
				HeeksObj* new_object = object->MakeACopy();
#ifdef MULTIPLE_OWNERS
				object->HEEKSOBJ_OWNER->Add(new_object, NULL);
#else
				object->m_owner->Add(new_object, NULL);
#endif
				new_object->ModifyByMatrix(m);
			}
		}
		wxGetApp().m_marked_list->Clear(true);
	}
	else
	{
		gp_Trsf mat;
		mat.SetScale(make_point(centre), scale);
		double m[16];
		extract(mat, m);
		wxGetApp().Transform(selected_items, m);
	}
	wxGetApp().Changed();
}
示例#22
0
//static
void TransformTools::Translate(bool copy)
{
	// pick items
	if(wxGetApp().m_marked_list->size() == 0){
		wxGetApp().PickObjects(_("Pick objects to move"));
	}
	if(wxGetApp().m_marked_list->size() == 0)return;

	// get number of copies
	HeeksConfig config;
	int ncopies;
	config.Read(_T("TranslateNumCopies"), &ncopies, 1);
	if(copy)
	{
		// check for uncopyable objects
		RemoveUncopyable();
		if(wxGetApp().m_marked_list->size() == 0)return;

		// input "number of copies"
		if(!wxGetApp().InputInt(_("Enter number of copies"), _("number of copies"), ncopies))return;
		if(ncopies < 1)return;
		config.Write(_T("TranslateNumCopies"), ncopies);
	}

	// clear the selection
	std::list<HeeksObj *> selected_items = wxGetApp().m_marked_list->list();
	wxGetApp().m_marked_list->Clear(true);

	// pick "from" position
	if(!wxGetApp().PickPosition(_("Click position to move from"), from))return;

	// pick "to" position
	wxGetApp().CreateTransformGLList(selected_items, false);
	wxGetApp().m_drag_matrix = gp_Trsf();
	if(!copy)
	{
		for(std::list<HeeksObj*>::const_iterator It = selected_items.begin(); It != selected_items.end(); It++){
			HeeksObj* object = *It;
			if(object->m_visible)wxGetApp().m_hidden_for_drag.push_back(object);
			object->m_visible = false;
		}
	}
	double to[3];

	bool move_to_accepted = wxGetApp().PickPosition(_("Click position to move to"), to, on_move_translate);

	if(!copy)
	{
		for(std::list<HeeksObj*>::iterator It = wxGetApp().m_hidden_for_drag.begin(); It != wxGetApp().m_hidden_for_drag.end(); It++)
		{
			HeeksObj* object = *It;
			object->m_visible = true;
		}
		wxGetApp().m_hidden_for_drag.clear();
	}
	wxGetApp().DestroyTransformGLList();

	if(!move_to_accepted)return;

	wxGetApp().CreateUndoPoint();

	// transform the objects
	if(copy)
	{
		for(int i = 0; i<ncopies; i++)
		{
			gp_Trsf mat;
			mat.SetTranslationPart(make_vector(make_point(from), make_point(to)) * (i + 1));
			double m[16];
			extract(mat, m);
			for(std::list<HeeksObj*>::iterator It = selected_items.begin(); It != selected_items.end(); It++)
			{
				HeeksObj* object = *It;
				HeeksObj* new_object = object->MakeACopy();
#ifdef MULTIPLE_OWNERS
				object->HEEKSOBJ_OWNER->Add(new_object, NULL);
#else
				object->m_owner->Add(new_object, NULL);
#endif
				new_object->ModifyByMatrix(m);
			}
		}
		wxGetApp().m_marked_list->Clear(true);
	}
	else
	{
		gp_Trsf mat;
		mat.SetTranslationPart(make_vector(make_point(from), make_point(to)));
		double m[16];
		extract(mat, m);
		wxGetApp().Transform(selected_items, m);
	}

	wxGetApp().Changed();
}
示例#23
0
文件: Pocket.cpp 项目: play113/swer
// static
void CPocket::WriteToConfig()
{
	HeeksConfig config;
	config.Write(_T("PocketSplineDeviation"), max_deviation_for_spline_to_arc);
}
示例#24
0
// static
void HDimension::WriteToConfig(HeeksConfig& config)
{
	config.Write(_T("DimensionDrawFlat"), DrawFlat);
}
示例#25
0
// static
void HDimension::ReadFromConfig(HeeksConfig& config)
{
	config.Read(_T("DimensionDrawFlat"), &DrawFlat, false);
}