00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef DXFWRTIER_H
00019 #define DXFWRTIER_H
00020 #include "File.h"
00021 #define _USE_MATH_DEFINES
00022 #include "math.h"
00023
00024 #ifdef WIN32
00025 #define EXPORT __declspec(dllexport)
00026 #else
00027 #define EXPORT
00028 #endif
00029
00030 typedef struct
00031 {
00032 double x;
00033 double y;
00034 double z;
00035 } Point3d_t;
00036
00037 typedef std::vector<Point3d_t> Polygon_t;
00038 typedef std::vector<std::pair<Polygon_t, Polygon_t> > Mesh_t;
00039
00040 class dxfwriter :
00041 public linfile::File
00042 {
00043 public:
00044 static bool WriteMesh(Mesh_t mesh, std::string FileName);
00045 EXPORT dxfwriter(std::string FileName);
00046 EXPORT ~dxfwriter(void);
00047 EXPORT void Write3dLINE(double startx, double starty, double startz, double endx, double endy, double endz);
00048 EXPORT void WriteBox(double offsetx, double offsety, double offsetz, double sizex, double sizey, double sizez);
00049 EXPORT void WriteSolid(double dx0, double dy0, double dz0,
00050 double dx1, double dy1, double dz1,
00051 double dx2, double dy2, double dz2,
00052 double dx3, double dy3, double dz3);
00053 EXPORT void WriteSolid(double dx0, double dy0, double dz0,
00054 double dx1, double dy1, double dz1,
00055 double dx2, double dy2, double dz2);
00056 void WriteCylinder(double centerx0, double centery0, double centerz0,
00057 double radius, double height, double angleX);
00058 EXPORT void WriteBoxFromPoints(double dx0, double dy0, double dz0,
00059 double dx1, double dy1, double dz1,
00060 double dx2, double dy2, double dz2,
00061 double dx3, double dy3, double dz3,
00062 double dx4, double dy4, double dz4,
00063 double dx5, double dy5, double dz5,
00064 double dx6, double dy6, double dz6,
00065 double dx7, double dy7, double dz7);
00066 private:
00067 void WriteConstHeader();
00068 void WriteConstTail();
00069 void WriteGroup(std::string st, int value);
00070 void WriteGroup(std::string st, double value);
00071 void WriteGroup(int st, int value);
00072 void WriteGroup(int st, double value);
00073 void WriteGroupHex(int st, double value);
00074 private:
00075 int m_handle;
00076 };
00077 #endif