2024年5月11日发(作者:ppt素材)
64 }
65
66 bool ok = extractText(fileName);
67 if (ok)
68 return 0;
69 else
70 return 1;
71 }
2、dwg2dxf:将dwg转换为dxf(read/write)
1 bool convertFile(std::string inName, std::string outName, DRW::Version ver, bool binary, bool overwrite){
2 bool badState = false;
3 //verify if input file exist
4 std::ifstream ifs;
5 (inName.c_str(), std::ifstream::in);
6 badState = ();
7 ();
8 if (badState) {
9 std::cout << "Error can't open " << inName << std::endl;
10 return false;
11 }
12 //verify if output file exist
13 std::ifstream ofs;
14 (outName.c_str(), std::ifstream::in);
15 badState = ();
16 ();
17 if (!badState) {
18 if (!overwrite){
19 std::cout << "File " << outName << " already exist, overwrite Y/N ?" << std::endl;
20 int c = getchar();
21 if (c == 'Y' || c=='y')
22 ;
23 else {
24 std::cout << "Cancelled.";
25 return false;
26 }
27 }
28 }
29 //All ok proceed whit conversion
30 //class to store file read:
31 dx_data fData;
32 //First read a dwg or dxf file
33 dx_iface *input = new dx_iface();
34 badState = input->fileImport( inName, &fData );
35 if (!badState) {
36 std::cout << "Error reading file " << inName << std::endl;
37 return false;
38 }
39
40 //And write a dxf file
41 dx_iface *output = new dx_iface();
42 badState = output->fileExport(outName, ver, binary, &fData);
43 delete input;
44 delete output;
45
46 return badState;
47 }
发布者:admin,转转请注明出处:http://www.yc00.com/xitong/1715438254a2618280.html
评论列表(0条)