⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 face.h

📁 曲面加工程序源码,用C++编写的加工曲线曲面的程序
💻 H
字号:
#if !defined(__face_h)	//斣暫

#define __face_h

//Difinition of face class

//#include <vcl\vcl.h>
#include <fstream.h>                       
#include <stdio.h>
#include <string.h>
//#include <classes.hpp>

#include "vector.h"

using namespace std;


class face {
public:
	//Face data
	double **x;					//x[imaxmax][jmaxmax];
	double **y;       	// (x[i][j],y[i][j])
	int	**ToolOk;
	int     *jmax;    	// j = 0..jmax[i]-1
	int	imax;    	// i = 0..imax-1
	int	IsDirty;	// Flag about change of parameters

        //980519
        int imaxmax;
        int jmaxmax;
        //~980519

	double *xApproach;  // Approach point;
	double *yApproach;  //

	double *xEscape;    // Escape point
	double *yEscape;

private:
	//Paramaters
	//// Parameters of Work
	double	WorkDiameter;	//[mm];Diameter =WorkSizeX
	double	WorkSizeY;	//[mm];Diameter

	double	WorkPosition;	//[mm];Distance between center of work and (0,0,0) of face
	//// Position of work is ( 0,WorkPosition,0).
	//////and (info of z-coordinate and xy-machine-coordinate)

	//// Parameters of Ball endmill
	//double 	EndmillRadius;	//[mm];Radius
	double 	MinAngle,MaxAngle;	//[deg];Angle limit of endmill;(>0,<90)

	//// Parameters of Machining
	double 	Speed;			//[mm/min];Machining Speed
	double	JogSpeed;		//[mm/min];Sending Speed
	double  RevSpeed; 		//[rpm];Speed of Endmill revolution
	//double	DwellTime;		//[sec];Dwell time
	double	Escape;			//[mm];Escape length

	//// Parameters of Mesh
	double	RoughnessBetweenLines;	//[mm];Ideal Surface roughness between 2 lines
	double	RoughnessAlongLine;	//[mm];Ideal Surface roughness along the line

        double X_Pitch;                 //[mm];980520
        double Y_Pitch;                 //[mm];980520


	//double	MaxRoughness,
	//		MinRoughness;	//[mm];Max and Min of surface roughness

	//double	XXPitch,		 //[mm];X-direction pitch of mesh
	//		YYPitch;         //[mm];Y-direction pitch of mesh
							 ////at the center point

   // Parameter for flycutting -----------97.11.25
   double ToolRadiusFlycut; //[mm]; Radius of flycutting tool
   double WheelRadiusFlycut; //[mm]; Raduis of flycutting wheel
   									// (= Radius of tool rotation)
   double LargeRadius;//[mm];Larger radius of tolus(donuts) face of tool
   double SmallRadius;//[mm];Smaller radius of tolus(donuts) face of tool

   int ToolType;//0:torus,1:ball

   //981008
   int WorkShape;//0:square,1:circle, 2: ellipse, 4:convex_polygon

   //020404
   double XRadiusEllipse;
   double YRadiusEllipse;

   //991008
   int NumWorkAreaPoints;
   vector* WorkAreaPoints;

   //981027
   int FeedDirection;//0:y,1:x

   // LargeRadius = WRF - TRF;
   // SmallRadius = TRF;

   //981028
   bool ErrorComp; 
   AnsiString  ErrorCompFileName;

	//// Other Parameters
	char	Comment[256],date[256];
	int 	ProgramNumber;

    //010320
    double wolter_thickness;

    //020405
    bool recipro;      //OUFUKU-UNDOU
    bool recipro_count; //OURO=false; FUKURO=true;

    double workpiece_center_height;

public:
	//Constructor and destructor
	face();
	~face();

	//virtual functions
	virtual double GetZ(double x, double y)=0;
	virtual vector GetPosition(double x, double y)=0;
	virtual double gradX(double x, double y)=0;
	virtual double gradY(double x, double y)=0;
	virtual double gradXX(double x, double y)=0;           //never used
	virtual double gradYY(double x, double y)=0;           //only used in y_roughness(,y_pitch)
	virtual vector NormalVector ( double x, double y)=0;
	virtual vector NormalVector ( vector position)=0;
	virtual vector GradientVector(double x, double y)=0;
	virtual vector GradientVector( vector position)=0;
	virtual vector NoGradientVector(double x,double y)=0;
	virtual vector NoGradientVector(vector position)=0;

	virtual int WriteFaceName(ofstream&)=0;
	virtual int WriteParameters(ofstream&)=0;


	//accessor

	int MakeFace();  				//Making Face data

	vector FacePosition( int, int);	//Convert (i,j) to (x,y,z)
	vector MachinePosition(vector point);	//tool correction at the point
	double MachineSpeed(const vector& prev,const vector& now);	//Machining speed correction

	////About Mesh

	int InWorkArea(double xx,double yy);// Value of TRUE means point(xx,yy) is within the area of work
	double	XPitch(double xx, double yy);		 	//[mm];X-direction pitch of mesh
	double  YPitch(double xx,double yy);//[mm];Y-direction pitch of mesh

        double x_roughness(double xx,double yy);
        double y_roughness(double xx,double yy);


	////Check Tool
	int CheckTool(double xx,double yy);
	double ToolAngle(double xx,double yy);

	////Output
	//////Argument: filename
	//////Return:	success=1, fail=0
	int NCDataOut( const char* filename );
	int WriteAPoint(ofstream &, vector, const double);
	int FaceDataOut( const char* filename );


	////Input( <- DialogBox )

	//double InputParameter(const char* name,double init,double lower,double upper);
	//void SetFaceParameters();

        inline double GetWorkPosition(){return WorkPosition;};
        inline double GetWorkDiameter(){return WorkDiameter;};
        inline double GetWorkSizeY(){return WorkSizeY;};
        inline double GetToolLargeRadius(){return LargeRadius;};
        inline double GetToolSmallRadius(){return SmallRadius;};


        //980519
        void SetFaceParameter(TStringList *);
        void GetFaceParameter(TStringList *);

        virtual void SetParameter(TStringList *)=0;
        virtual void GetParameter(TStringList *)=0;

        //981008
        int LatticeDataOut (AnsiString filename);

        //981028
        void FlagErrorComp(bool);

        inline void SetErrorCompFileName(AnsiString filename){ErrorCompFileName=filename;};
        inline AnsiString GetErrorCompFileName(){return ErrorCompFileName; }

        //000406
        void CenterLine(AnsiString filename);

        //0103
        bool isConflict(double x, double y);
};
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -