AutoCAD ObjectARX和RealDWG的基本数据操作

摘要:
拥有RealDWG或ObjectARX是不必说的。安装RealDWG后,请检查RealDWG目录中的“示例”。新项目配置了Inc、Lib和其他依赖项。AcDbHostApplicationServices需要实现一次。样本随附,或者你可以根据自己的想法来写。

.dwg文件的读取。拥有RealDWG或者ObjectARX不必多说。

安装RealDWG后RealDWG目录下的Samples看看。

新建工程配置好Inc,Lib,附加依赖等。

AutoCAD ObjectARX和RealDWG的基本数据操作第1张

AutoCAD ObjectARX和RealDWG的基本数据操作第2张

AutoCAD ObjectARX和RealDWG的基本数据操作第3张

不必多说。

需要将AcDbHostApplicationServices实现一遍。

sample自带的即可,也可自己按照自己的来写。

  1 int Verbose = 0;
  2 int Copy = 0;
  3 int Header = 0;
  4 int Tables = 0;
  5 int doExtents = 0;
  6 int showErased = 0;
  7 int resolveXrefs = 0;
  8 
  9 class DumpDwgHostApp : public AcDbHostApplicationServices
 10 {
 11 public:
 12     ~DumpDwgHostApp();
 13     Acad::ErrorStatus findFile(TCHAR* pcFullPathOut, int nBufferLength,
 14                          const TCHAR* pcFilename, AcDbDatabase* pDb = NULL,
 15                          AcDbHostApplicationServices::FindFileHint = kDefault);
 16     // These two functions return the full path to the root folder where roamable/local 
 17     // customizable files were installed. Note that the user may have reconfigured 
 18     // the location of some the customizable files using the Options Dialog 
 19     // therefore these functions should not be used to locate customizable files. 
 20     // To locate customizable files either use the findFile function or the 
 21     // appropriate system variable for the given file type. 
 22     //
 23     Acad::ErrorStatus getRoamableRootFolder(const TCHAR*& folder);
 24     Acad::ErrorStatus getLocalRootFolder(const TCHAR*& folder);
 25 
 26     //URL related services
 27     Adesk::Boolean isURL(const TCHAR* pszURL) const;
 28     Adesk::Boolean isRemoteFile(const TCHAR* pszLocalFile, TCHAR* pszURL, size_t nUrlSize) const;
 29     Acad::ErrorStatus  getRemoteFile(const TCHAR* pszURL, TCHAR* pszLocalFile, size_t nFilePath, Adesk::Boolean bIgnoreCache) const;
 30 
 31     // make sure you implement getAlternateFontName. In case your findFile implementation
 32     // fails to find a font you should return a font name here that is guaranteed to exist.
 33     virtual TCHAR * getAlternateFontName() const
 34     {
 35         return _T("txt.shx"); //findFile will be called again with this name
 36     }
 37 private:
 38     mutable CMapStringToString m_localToUrl;
 39 };
 40 DumpDwgHostApp::~DumpDwgHostApp()
 41 {
 42     CString local,url;
 43     for (POSITION pos = m_localToUrl.GetStartPosition();pos!=NULL;)
 44     {
 45         m_localToUrl.GetNextAssoc(pos,local,url);
 46         DeleteUrlCacheEntry(url);
 47     }
 48 }
 49 // Return the Install directory for customizable files
 50 Acad::ErrorStatus 
 51 DumpDwgHostApp::getRoamableRootFolder(const TCHAR*& folder)
 52 {
 53     Acad::ErrorStatus ret = Acad::eOk;
 54     static TCHAR buf[MAX_PATH] = _T("

免责声明:内容来源于网络,仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇Element drawer添加 滚动条 无法上下滚动fastapi之根据model生成schema和router下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

C# 实现预览dwg文件完整源代码(无需autocad环境)

using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.IO; namespace WindowsApplica...

OJ开发笔记(1)

  最近想挖坑搞个跑在linux上的OJ,查了很多资料,也读了很多大神的代码,自己有些感悟。于是把评测内核的部分功能写了出来,这里做个笔记备忘啦。   学校用的OJ是几年前的hustoj,只支持C/C++,Java和Pascal跑起来老是出现莫名奇妙的错误,感觉某学长没有搭好(╬ ̄皿 ̄)。自己想搞的OJ以后应该能支持C/C++/Java/Pascal/C#...

Grid++Report应用(引入项目中)

1、将Grid++Report安装文件中(WebSamplesasp.net(csharp)App_Code)的ReportData.cs,MssqlReportData.cs两个文件复制到自己项目中的App_Code文件中。并配置数据库连接 public const string SqlConnStr = "Data Source=.;Initial C...

FUSE简介

什么是FUSE 传统的文件系统是操作系统的一部分,放在操作系统内核里面实现。Fuse(Filesystem in Userspace), 一个用户空间文件系统框架,提供给我们一组用于实现一个文件系统的API,使我们可以在用户态实现自已的文件系统。 FUSE的优缺点 1)传统文件系统都是定义在操作系统内核层面上的,要操作系统识别一种新的文件系统,必需重写内核...

不知道怎么提高代码可扩展性?来看看优秀框架源码中的这几种设计模式吧!

为什么要提高代码扩展性 我们写的代码都是为了一定的需求服务的,但是这些需求并不是一成不变的,当需求变更了,如果我们代码的扩展性很好,我们可能只需要简单的添加或者删除模块就行了,如果扩展性不好,可能所有代码都需要重写,那就是一场灾难了,所以提高代码的扩展性是势在必行的。怎样才算有好的扩展性呢?好的扩展性应该具备以下特征: 需求变更时,代码不需要重写。 局部...

ES6-10笔记(let&const -- Array)

大纲 scope-作用域 作用域是指程序源代码中定义变量的区域,规定了如何查找变量,也就是确定当前执行代码对变量的访问权限。 JavaScript作用域共有两种主要的工作模型——词法作用域(静态作用域)和动态作用域。 JavaScript默认采用词法作用域(lexical scoping),也就是静态作用域。 词法作用域是由开发者在写代码时将变量和...