DXFlib来读取DXF文件


使用DXFlib来读取DXF文件,软件实现了读取出来数据的处理,图形的显示,一个简单的数控加工软件,VS2005编译
资源截图
代码片段和文件信息
/****************************************************************************
** Copyright (C) 2001-2013 RibbonSoft GmbH. All rights reserved.
**
** This file is part of the dxflib project.
**
** This file is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License or
** (at your option) any later version.
**
** Licensees holding valid dxflib Professional Edition licenses may use 
** this file in accordance with the dxflib Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND INCLUDING THE
** WARRANTY OF DESIGN MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.ribbonsoft.com for further details.
**
** Contact info@ribbonsoft.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/

#include “dl_dxf.h“

#include 
#include 
#include 
#include 
#include 

#include “dl_attributes.h“
#include “dl_codes.h“
#include “dl_creationadapter.h“
#include “dl_writer_ascii.h“

#include “iostream“

/**
 * Default constructor.
 */
DL_Dxf::DL_Dxf() {
    version = DL_VERSION_2000;

    vertices = NULL;
    maxVertices = 0;
    vertexIndex = 0;

    knots = NULL;
    maxKnots = 0;
    knotIndex = 0;

    weights = NULL;
    weightIndex = 0;

    controlPoints = NULL;
    maxControlPoints = 0;
    controlPointIndex = 0;

    fitPoints = NULL;
    maxFitPoints = 0;
    fitPointIndex = 0;

    leaderVertices = NULL;
    maxLeaderVertices = 0;
    leaderVertexIndex = 0;
}



/**
 * Destructor.
 */
DL_Dxf::~DL_Dxf() {
    if (vertices!=NULL) {
        delete[] vertices;
    }
    if (knots!=NULL) {
        delete[] knots;
    }
    if (controlPoints!=NULL) {
        delete[] controlPoints;
    }
    if (fitPoints!=NULL) {
        delete[] fitPoints;
    }
    if (weights!=NULL) {
        delete[] weights;
    }
    if (leaderVertices!=NULL) {
        delete[] leaderVertices;
    }
}



/**
 * @brief Reads the given file and calls the appropriate functions in
 * the given creation interface for every entity found in the file.
 *
 * @param file Input
 *      Path and name of file to read
 * @param creationInterface
 *      Pointer to the class which takes care of the entities in the file.
 *
 * @retval true If p file could be opened.
 * @retval false If p file could not be opened.
 */
bool DL_Dxf::in(const std::string& file DL_CreationInterface* creationInterface) {
    FILE *fp;
    firstCall = true;
    currentobjectType = DL_UNKNOWN;

    fp = fopen(file.c_str() “rt“);
    if (fp) {
        std::locale oldLocale = std::locale::global(std::locale(“C“)); // use dot in numbers
        while (readDxfGroups(fp creationInterface)) {}
        std::locale::global(oldLocale);
        fclose(fp);
        return true;
    }


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-03-05 14:10  dxflib
     目录           0  2018-03-05 14:10  dxflibDebug
     文件        4392  2017-12-29 17:09  dxflibDebugBuildLog.htm
     文件     1629592  2017-12-29 17:09  dxflibDebugdl_dxf.obj
     文件       49223  2017-12-29 11:50  dxflibDebugdl_writer_ascii.obj
     文件      338944  2017-12-29 11:27  dxflibDebugvc80.idb
     文件      348160  2017-12-29 11:27  dxflibDebugvc80.pdb
     文件      388096  2017-12-29 17:09  dxflibDebugvc90.idb
     文件      430080  2017-12-29 17:09  dxflibDebugvc90.pdb
     文件        5755  2017-05-18 16:17  dxflibdl_attributes.h
     文件       21926  2017-05-18 16:17  dxflibdl_codes.h
     文件        5747  2017-05-18 16:17  dxflibdl_creationadapter.h
     文件       11348  2017-05-18 16:17  dxflibdl_creationinterface.h
     文件      144288  2017-12-29 17:08  dxflibdl_dxf.cpp
     文件       18666  2017-05-18 16:17  dxflibdl_dxf.h
     文件       42247  2017-05-18 16:17  dxflibdl_entities.h
     文件        1541  2017-05-18 16:17  dxflibdl_exception.h
     文件        3102  2017-05-18 16:17  dxflibdl_extrusion.h
     文件         299  2017-05-18 16:17  dxflibdl_global.h
     文件       13998  2017-05-18 16:17  dxflibdl_writer.h
     文件        3530  2017-05-18 16:17  dxflibdl_writer_ascii.cpp
     文件        2258  2017-05-18 16:17  dxflibdl_writer_ascii.h
     文件        4337  2017-12-29 11:49  dxflibdxflib.vcproj
     文件        2595  2018-01-26 17:28  dxflibdxflib.vcproj.2014-0731-0942.celiy.user
     文件        1401  2017-12-29 11:35  dxflibdxflib.vcproj.NML-D9C3CCFBAA9.NML.user
     文件         655  2017-12-29 09:27  dxflibReadMe.txt
     目录           0  2018-03-05 14:10  EasyLaser
     目录           0  2018-03-05 14:10  EasyLaser\_UpgradeReport_Files
     文件        3348  2017-12-29 11:45  EasyLaser\_UpgradeReport_FilesUpgradeReport.css
     文件       12505  2008-01-11 01:25  EasyLaser\_UpgradeReport_FilesUpgradeReport.xslt
     文件          69  2017-12-29 11:45  EasyLaser\_UpgradeReport_FilesUpgradeReport_Minus.gif
............此处省略3915个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)