AutoCADObjectARX环境配置.docx

上传人:b****1 文档编号:23259867 上传时间:2023-05-15 格式:DOCX 页数:19 大小:623.97KB
下载 相关 举报
AutoCADObjectARX环境配置.docx_第1页
第1页 / 共19页
AutoCADObjectARX环境配置.docx_第2页
第2页 / 共19页
AutoCADObjectARX环境配置.docx_第3页
第3页 / 共19页
AutoCADObjectARX环境配置.docx_第4页
第4页 / 共19页
AutoCADObjectARX环境配置.docx_第5页
第5页 / 共19页
点击查看更多>>
下载资源
资源描述

AutoCADObjectARX环境配置.docx

《AutoCADObjectARX环境配置.docx》由会员分享,可在线阅读,更多相关《AutoCADObjectARX环境配置.docx(19页珍藏版)》请在冰豆网上搜索。

AutoCADObjectARX环境配置.docx

AutoCADObjectARX环境配置

资料位置

主要资料包括3个

1.ObjectARXSDK中的doc文档

2.ObjectARXSDK中的sample中的readme.html

3.ObjectARXSDK中的arxlabs帮助文档

1.安装AutoCAD2007.exe

从共享盘上复制:

\\whk\应用 (F)\应用软件\图像多媒体处理

到本地安装目录D:

\下载\AutoCAD2007中文版。

按照说明安装:

2.安装vs2005

●考虑到是在win8上安装vs2005,必然存在兼容性的问题

●直接忽略兼容性问题,使用管理员身份安装vs2005

●安装完成以后,下载VS80sp1-KB926604-X86-CHS.exe,和VS80sp1-KB932230-X86-CHS.exe,使用管理员身份安装

●安装成功以后,可以使用后,创建项目进行测试

3.objectARXwizard安装

4.在vs2005上进行环境配置

1)创建项目

Inthisstep,youwilllearnhowtosetupanewObjectARXprojectinVisualC++.NET2005andyouwillbuildyourfirstObjectARXapplication.

1.Fromthe"File"pulldownmenuofVisualC++.NET,select"New"->"Project...".

Step1Figure1-CreatinganewVC++project

2.Clickonthe"VisualC++"nodeinthe"ProjectTypes:

"treeonthe"NewProject"dialogthatappears.

3.Select"Win32Project"inthelistoftemplates.

4.Enterthedesiredprojectname,forexample"Step01"intheProjectnameeditbox.

5.Setthelocationtothefolderwhereyouwantyourprojecttobestored,thenclick"OK".Thiswillinvoke"Win32ApplicationWizard"dialog.

Step1Figure2-SelectingWin32projecttemplate

1.Select"ApplicationSettings"tabonthewizard.Select"DLL"forthe"Applicationtype:

"option.

Step1Figure3-ApplicationWizard,specifyingtheapplicationtypeasDLL

1.Clickon"Finish"tocreatetheproject.

2)配置包含目录

1.InvoketheSolutionExplorerintheVC++.NETusingthemenu"View"->"SolutionExplorer".AlternativelyyoucanusethekeyboardshortcutCtrl+Alt+L.

2.Selecttheproject"Step01"intheSolutionExplorer.RightclickontheprojectnodeintheSolutionexplorerandselectthe"Properties"intheright-clickmenu.Thisbringsupthepropertypagesdialogfortheproject.

3.Inthe"Configuration:

"drop-downlist,select"AllConfigurations".Thiswillensurethatthechangeswemakeareappliedtoalltheconfigurations.

4.Selectthenode"C/C++"->"General".Inthe"AdditionalIncludeDirectories"item,addpathtotheincludefoldersoftheObjectARXSDK.AlsosetthewarningleveltoLevel1and"Detect64-BitPortabilityIssues"toNo.Wedothistosuppressthewarningswhichwearenotgoingtoaffectusanywayinthisproject.Click"OK"buttontoapplyandclosethedialog.Similarly,afteryouhadchangedanypropertyinthePropertyPagesdialog,youcanuse "OK"buttontoapplyandclose.

YoucanspecifythelocationfortheObjectARXheaderfilesandthelibraryfilesusingtheVC++.NETOptionsdialog(availableintheTools->Optionsmenu).ThiswillensurethatVC++.NETwillsearchfortheObjectARXheaderfilesandlibraryfilesinthesepathsfirstandhenceyoudon'thavetosetthepathsforeveryObjectARXproject.Tosetthepathsselect"VC++Directories"iteminthe"Projects"nodeintheOptionsdialog.Fromthedrop-downlist"SelectDirectoriesfor:

"selecttheitem"Includefiles".AddnewitemandsetthepathtotheObjectARXheaderfiles.Similarlysetthepathforthelibraryfiles.

选择“工具选项卡”》选择“选项”

5.Clickonthenode"C/C++"inthe"ConfigurationProperties"node.Selecttheitem"CodeGeneration".Selecttheitem"RuntimeLibrary"inthelist.Assigntheproperty"Multi-threadedDLL(/MD),byselectingthepropertyfromthedrop-downlist. (黑色改)

3)连接器配置

1.Selectthenode"Linker"->"Input".Inthe"AdditionalDependencies"item,addthefollowinglibraries:

"rxapi.libacdb17.libacge17.libacad.libacedapi.lib"

2.Next,selectthenode"Linker"->"General".Inthe"AdditionalLibraryDirectories"item,addpathtothelibraryfoldersoftheObjectARXSDK.

3.Inthe"OutputFile"item,changetheextensionoftheoutput".dll"to".arx".

4)添加代码

1.Fromthe"Project"pulldownmenu,select"AddNewItem"(shortcutCtrl+Shift+A).

2.Inthe"AddNewItem"dialog,selectitem"C++File(.cpp)".

3.Enter"HelloWorld"inthe"Name:

"editboandclick"Add"toaddthecppfile.

#include"stdafx.h"

#include

#include

#include

//initApp()-whichwillbecalledbyAutoCADwhenourapplicationisloadedand

//unloadApp()-whichiscalledwhenourapplicationisunloaded.

voidinitApp();

voidunloadApp();

//print"Helloworld!

"ontheAutoCADcommandline

voidhelloWorld();

voidinitApp()

{

//registeracommandwiththeAutoCADcommandmechanism

acedRegCmds->addCommand(_T("HELLOWORLD_COMMANDS"),

_T("Hello"),

_T("Bonjour"),

//wedefineatransparentcommandbelow,

//whichmeansthatthecommandcanbeinvoked

//whileanothercommandisactive

ACRX_CMD_TRANSPARENT,

helloWorld);

}

//Thisfunctionwillremoveourcommandgroup,whichwillalsoremoveourcommand.

voidunloadApp()

{

//SincecommandsregisteredwithAutoCADbecomeadditionalentrypointsintoourapplication,

//itisabsolutelynecessarytoremovethemwhentheapplicationisunloaded.

acedRegCmds->removeGroup(_T("HELLOWORLD_COMMANDS"));

}

voidhelloWorld()

{

acutPrintf(_T("\nHelloWorld!

"));

}

//AllObjectARXapplicationshaveonemainentrypoint

//thatisusedformessaging:

theacrxEntryPoint()function.

//Nomainentrypointbecauseofitisadllproject

//ThefirstparameterofacrxEntryPoint()isadatamember

//oftheAcRxclasscalledmsgwhichrepresentsthemessage

//sentfromtheObjectARXkerneltotheapplication.

//Bydefault,applicationsarelocked,

//whichmeansthatonceloadedtheycannotbeunloaded.

extern"C"AcRx:

:

AppRetCode

acrxEntryPoint(AcRx:

:

AppMsgCodemsg,void*pkt)

{

switch(msg)

{

caseAcRx:

:

kInitAppMsg:

acrxDynamicLinker->unlockApplication(pkt);

//Applicationsneedtoregisterthemselvesexplicitly

//asbeingMDIawareusingtheacrxRegisterAppMDIAware()globalfunction.

acrxRegisterAppMDIAware(pkt);

initApp();

break;

caseAcRx:

:

kUnloadAppMsg:

unloadApp();

break;

default:

break;

 

}

returnAcRx:

:

kRetOK;

}

5)创建DEF文件

1.Fromthe"Project"pulldownmenu,select"AddNewItem"(shortcutCtrl+Shift+A).

2.Inthe"AddNewItem"dialog,selectitem"DefFile(.def)".

3.Enter"ArxProject"inthe"Name:

"editbox.Click"Open"

Addthefollowinginformationtothenewfile.AllObjectARXapplicationshavetoexportatleasttwofunctions:

 

∙acrxEntryPoint 

∙acrxGetApiVersion.

EXPORTSacrxEntryPointPRIVATEacrxGetApiVersionPRIVATE

6)测试

1)右键“Step01”生成解决方案。

2)确定无错以后,在project中找到.arx文件。

3)将其拖拽到AutoCAD中

4)在命令行中输入hello,或者bonjour,则在命令行中出现helloworld!

安装协同工具

1.安装协同校审工具.exe。

FromE:

\TDDOWNLOAD

2.安装vcredist_x84.exe(vcredist_x64.exe).FromE:

\TDDOWNLOAD

3.加载工具R17在1所在目录

4.使用上图的启动组功能

●点击“内容”,找到文件位置R17目录,选择加载

●在“工具”,“选项”中添加浏览文件的位置:

R17目录

●单机AutoCAD时,默认加载以上项目

安装AutoCAD调试工具

(一)

●位置:

C:

\ObjectArx2007\samples\database\ARXDBG

●有专门调试文档,讲解调试过程

●使用VS2005打开ArxDbg.vcproj文件,生成解决方案。

●找到release或者Debuge中的ARX文件,将其插入到AutoCAD的启动程序中

●过程如下:

1.在工具选项卡中,找到“加载应用程序”,点击打开。

2.在启动组的“内容”中选择ARX的位置添加

3.在工具选项卡中,找到“选项”,点击打开。

4.在“添加浏览文件”的项目中添加浏览位置目录为ARX文件所在位置

安装AutoCAD调试工具

(二)

●将编译好的.arx文件添加到AutoCAD的启动项目中,并且在AutoCAD中设置好文件浏览路径,以免其找不到运行项目

●启动Project工程【Ctrl+F5】,不调试,启动起来之后设置project【ctrl+alt+p】附加到进程窗口。

将acad.exe附加到进程

●依次修改:

⏹链接器->调试->生成调试信息,选“是”

⏹c/c++->常规->调试信息格式,选“C7”

⏹c/c++->优化->优化,选“禁用”

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 总结汇报 > 学习总结

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1