没有合适的资源?快使用搜索试试~ 我知道了~
ObjectARX&Dummies教程.doc
5星 · 超过95%的资源 需积分: 9 54 下载量 77 浏览量
2007-11-01
21:17:36
上传
评论
收藏 927KB DOC 举报
温馨提示
试读
64页
ObjectARX的一个英文教程,这个资料来源于http://www.objectarx.net/bbs/index.php论坛,我做了简单的收集,谢谢大家观看!也希望大家都能掌握ObjectARX这门技术
资源推荐
资源详情
资源评论
ObjectARX&Dummies 教程(一)——Overview
一个巴西人写的 ObjectARX 教程,其后面所讲到的自定义实体
的教程,应该是这方面最好的教程了。
呵呵,没时间翻译,大家就将就着看英文吧。
Class 1 - Overview
Introduction
ObjectARX is an AutoCAD Runtime Extension.
With ObjectARX SDK you can build applications that will alow you to
extend AutoCAD features like commands, dialog boxes, entities, objects
and much more.
The ObjectARX application is actually a DLL that is loaded into
AutoCAD environment and allows you to access new features as
mentioned above. To be able to build these DLLs you need to follow
some basic rules to setup Microsoft Visual Studio.NET environment and
assert your application will respect AutoCAD requirements.
The performance of this application will be the same of native
features. By the way, Autodesk uses ObjectARX to build vertical
products you may already know like Autodesk MAP and Architectural
Desktop, among many others.
User Requirements
Because ObjectARX is not a simple customization tool, some
requirements must be observed to allow you to be able to proceed. If you
don't match these requirements I would recommend you to first increase
your skills and then go back to try this course.
The minimum requirements to learn at least basic ObjectARX are:
(1) Basic Visual Studio.NET concepts;
(2) Average C++ knowledge;
(3) Advanced AutoCAD knowledge;
(4) MFC (Microsoft Foundation Classes) concepts;
(5) Object Oriented Techniques;
As mentioned before, this course is not intended to be a complex
guide or even cover advanced features. I believe you can go further by
yourself after learn the basic features and mainly the basic concepts
which are the secret of ObjectARX.
I will not cover .NET Framework capabilities to make the course as
much simple as I can. Once you learn and figure out how AutoCAD
works from inside you will open your mind to ObjectARX capabilities
and will be able to build great application!
How to use ObjectARX SDK
Once you have downloaded your copy of ObjectARX SDK and
extracted it to your hard drive, you will find the following folders inside
it:
\arxlabs : This directory consists of a set of labs that shows some aspects
of the ObjectARX.
\classmap : This directory contains an AutoCAD drawing with the ObjectARX
class hierarchy tree.
\docs : This directory contains the ObjectARX online help files.
\inc : The inc directory contains the ObjectARX header files.
\lib : The lib directory contains the ObjectARX library files.
\redistrib : This directory contains DLLs that may be required for an
ObjectARX application to run.
\samples : This directory contains examples of ObjectARX applications.
\utils : This directory contains other libraries like brep for boundary
representation and ObjARXWiz for the ObjectARX wizards.
ObjectARX Classes Naming
ObjectARX classes names follow the following prefix standards:
AcRx : Classes for binding an application and for runtime class
registration and identification.
AcEd : Classes for registering native AutoCAD commands and for
AutoCAD event notification.
AcDb : AutoCAD database classes.
AcGi : Graphics classes for rendering AutoCAD entities.
AcGe : Utility classes for common linear algebra and geometric
objects.
Depending on which set of features you use in your applications you
will need to use the corresponding library as follows:
AcRx : acad.lib, rxapi.lib, acdb16.lib
AcEd : acad.lib, rxapi.lib, acedapi.lib, acdb16.lib
AcDb : acad.lib, rxapi.lib, acdb16.lib
AcGi : acad.lib, rxapi.lib, acdb16.lib
AcGe : acad.lib, rxapi.lib, acge16.lib, acdb16.lib
ObjectARX Wizard
I will bypass the Visual Studio environment configuration to build
ObjectARX applications. You could refer to this information inside SDK
documentation. We will use on this course the Wizard provided by ADN
(Autodesk Developer Network) team. It is located inside ObjectARX
directory called \utils\ObjARXWiz. Inside it you will find the installation
package named ArxWizards.msi.
To install this Wizard, close your Visual Studio.NET and double click
the above mentioned file. Follow the steps. When finished, open Visual
Studio.NET again and you will see a new toolbar.
See you on Class 2!
ObjectARX&Dummies 教程(二)——AutoCAD's Database
Class 2 - AutoCAD's Database
Introduction
Each AutoCAD drawing represents a structured Database which
stores several types of objects. When you just open a new drawing,
AutoCAD creates behind the scenes a organized and efficient Database.
This Database has a minimun data that allows you to make basic
drawings.
This minimun data is represented basically by objects like layers,
linetypes, text styles, etc. Due that you have layer 0, stadard text style,
continuous linetype and others.
Since AutoCAD Release 2000 you can work with multiple drawings
at the same time which is called MDI environment. This functionality
brings great flexbility but also bring some extra complexity when dealing
with more than one drawing. We won't discuss MDI aspects on this
course but this will be probably a requirement for your future ObjectARX
applications.
How data is stored
This Database mantains all sort of objects a drawing needs to exist.
These objects are stored into appropriate containers which are special
objects made to manage objects of the same type. This way we have
appropriate methods and procedures to store entities, layers, text styles,
etc. Each object stored into Database receives an identifier that is called
ObjectId. This identifier is unique inside the same AutoCAD session and
it is valid during the lifecycle of each object. The ObjectId is generated
by its Database and you don't need to worry about how to create it.
Inside ObjectARX we have basically 3 kind of objects:
Entities: Objects with graphical representation (lines, arcs,
texts, ...);
Containers: Special objects to store and manage collections (layer
table, linetype table, ...);
Objects: Objects without any graphical representation (groups,
layouts, ...)
AutoCAD's Database structure
Creating objects
To create an object through ObjectARX we have some kind of recipe
depending on what type of object it is and where we would like to store it
(most of time we need to store an objects inside its specific container).
Basically, you will follow this sequence:
Declare a pointer to the object type you would like to create and call
its new operator;
With this pointer, call appropriate methods of this object to change its
features;
Get a pointer to the Database where you would like to create the
object (most of time the current Database);
Open the appropriate container where it should be stored;
Call the specific container method to store your object passing its
pointer;
Receive its ObjectId automatically generated by its container;
Finish the operation closing all opened objects including containers
and the object you have just created.
Obviously you will create some handy classes to allow the
automation of this processes because they are very similar and can be
easily reused. The main idea is to create a sort of database utility funcions
like: AddLayer, AddLine, AddCircle, AddTextStyle, etc.
* It is very important to not forget to close opened objects because this will cause
AutoCAD to terminate.
Sample code to create a line (AcDbLine)
This code demonstrates how to create a simple line between two
points. The process is simple and no error check is made. This code needs
to be embedded inside an ObjectARX application structure to work. The
main idea is to show you the concepts. Further we will create a working
code. Pay attention to the order of opening and closing operations.
// We first need to declare a couple of points
AcGePoint3d startPt(1.0, 1.0, 0.0);
AcGePoint3d endPt(10.0, 10.0, 0.0);
// Now we need to instantiate an AcDbLine pointer
// In this case, its constructor allows me to pass the 2 points
AcDbLine *pLine = new AcDbLine(startPt, endPt);
// Now we need to open the appropriate container which is inside
BlockTable
AcDbBlockTable *pBlockTable = NULL;
// First, get the current database and then get the BlockTable
AcDbDatabase* pDB = acdbHostApplicationServices()-
>workingDatabase();
pDB->getSymbolTable(pBlockTable, AcDb::kForRead);
// Inside BlockTable, open the ModelSpace
AcDbBlockTableRecord* pBlockTableRecord = NULL;
pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord,
AcDb::kForWrite);
// After get ModelSpace we can close the BlockTable
pBlockTable->close();
// Using ModelSpace pointer we can add our brand new line
AcDbObjectId lineId = AcDbObjectId::kNull;
pBlockTableRecord->appendAcDbEntity(lineId, pLine);
// To finish the process we need to close ModelSpace and the entity
pBlockTableRecord->close();
pLine->close();
On the next class we will present the ObjectARX application structure
and will build and compile a simple application using the above code. See
you there!
剩余63页未读,继续阅读
资源评论
- wufang_20042012-03-13ObjectARX的一个英文教程,巴西人写的,很好
- jeck5152013-09-24好东西,就是英文的,有点累。 谢谢
- ftyuhg2013-01-26看了几天,感觉还行吧,很详细的。就是英文的看的费劲了点!!
汉宫飞溅
- 粉丝: 5
- 资源: 8
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 毕业设计-仿生六足机器人的制作全教程源码+电子元器件+程序代码+线路组件图+安装教程+搭建视频教程
- 基于ROS和webots的xrobot机械臂仿真初探C++源码
- 基于ROS的点焊机器人仿真与控制python源码+文档说明+使用说明+详细注释
- 基于vue实现的细粒度交通时空大数据分析系统+源代码+文档说明
- 安卓大作业-基于Electron的交通时空大数据分析挖掘系统客户端(Android)+源代码+文档说明+界面截图
- 基于Java的朱氏集团客户关系管理系统设计源码
- 基于C++的作业提交与批改系统设计源码
- 基于Vue2的移动端电影资讯网站设计源码
- 高分课程设计作业-基于QT的模仿宝石迷阵游戏C++源码+文档说明+界面截图
- 基于Apache Spark的Spark DistCP重实现设计源码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功