ImageVerifierCode 换一换
格式:DOCX , 页数:84 ,大小:36.08KB ,
资源ID:19702749      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/19702749.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(用ObjectARX开发AutoCAD 应用程序 配套源码 老虎工作室Word格式.docx)为本站会员(b****6)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

用ObjectARX开发AutoCAD 应用程序 配套源码 老虎工作室Word格式.docx

1、exam09 23exam10a 25exam10b 26exam13 29exam14 32exam03 #include rxdlinkr.haced.hdbents.hgeassign.hdbsymtb.hdbapserv.hAcad:ErrorStatus newLine();void addLineCommand()/BEGIN_LEVEL_ADVANCED if (newLine()=Acad:eOk) acutPrintf(Successn); elseFailedn/END_LEVEL_ADVANCEDErrorStatus postToDatabase(/*in*/AcDbE

2、ntity* pEnt,/*out*/AcDbObjectId& idObj) Acad:ErrorStatus es; AcDbBlockTable* pBlockTable; AcDbBlockTableRecord* pSpaceRecord; /确定当前有正在工作的数据库 if (acdbHostApplicationServices()-workingDatabase()=NULL) return Acad:eNoDatabase; /获得当前图形的指针 /获得图形的块表,打开准备读取数据 if (es = acdbHostApplicationServices()-workingD

3、atabase()-getBlockTable(pBlockTable, AcDb:kForRead)=Acad:eOk) /获得建模空间的记录,打开准备写数据 if (es = pBlockTable-getAt(ACDB_MODEL_SPACE, pSpaceRecord, AcDb:kForWrite)=Acad: /添加实体指针到建模空间后关闭指针和建模空间记录 if (es = pSpaceRecord-appendAcDbEntity(idObj, pEnt)=Acad: pEnt-close(); pSpaceRecord- /关闭块表 pBlockTable- /返回状态信息

4、return es;ErrorStatus newLine() ads_point pt1, pt2;/定义两个ads_point的点 int retval; try /从用户处获得第一点 if (retval = acedGetPoint(NULL, nSelect lower left: , pt1) != RTNORM) throw retval; /以第一点为基点, 从用户处获得第二点. if (retval = acedGetPoint(pt1, nSelect upper right:, pt2) != RTNORM) catch (int e) if (e = RTCAN) /判

5、断输入错误程序中断 return Acad:eUserBreak; if (e = RTERROR) /判断无效输入eInvalidInput;/ 将ads_point类型的点转换为AcGePoint3d类型之后创建直线 AcDbLine* pLine = new AcDbLine(asPnt3d(pt1), asPnt3d(pt2);/如果创建直线出错,返回错误信息 if (!pLine) acedAlert(Not enough memory to create a Line! return Acad:eOutOfMemory; AcDbObjectId id; /定义对象ID retur

6、n postToDatabase(pLine, id);extern C AcRx:AppRetCode acrxEntryPoint(AcRx:AppMsgCode msg, void* pkt) switch (msg) case AcRx:kInitAppMsg: acrxDynamicLinker-unlockApplication(pkt); acrxDynamicLinker-registerAppMDIAware(pkt); /注册命令 acedRegCmds-addCommand(EXAM03,addline,ACRX_CMD_MODAL,addLineCommand); br

7、eak;kUnloadAppMsg: /当应用程序卸载后,为防止AUOTCAD调用此命令,产生不必要的 /错误,移走命令组removeGroup( return AcRx:kRetOK;exam04a#include dbidmap.hlngtrans.hdbltrans.hdbmain.hvoidrefEdit() AcDbObjectId transId; AcDbDatabase* pDb; char *fname; struct resbuf *rb; rb = acutNewRb(RTSTR); int stat = acedGetFileD(Pick a drawing, NULL

8、, dwg, 0, rb); if (stat != RTNORM) | (rb = NULL) nYou must pick a drawing file. return; fname = (char*)acad_malloc(strlen(rb-resval.rstring) + 1); strcpy(fname, rb-resval.rstring); acutRelRb(rb); pDb = new AcDbDatabase(Adesk:kFalse); if (pDb-readDwgFile(fname) != Acad:eOk) nSorry, that draing is pro

9、bably already open. AcDbBlockTable *pBlockTable; pDb-getSymbolTable(pBlockTable, AcDb:kForRead); AcDbBlockTableRecord *pOtherMsBtr;getAt(ACDB_MODEL_SPACE, pOtherMsBtr, AcDb: AcDbBlockTableRecordIterator *pIter; pOtherMsBtr-newIterator(pIter); AcDbObjectIdArray objIdArray; for (pIter-start(); !pIter-

10、done(); pIter-step() AcDbEntity *pEntity;getEntity(pEntity, AcDb: if (pEntity-isKindOf(AcDbCircle:desc() objIdArray.append(pEntity-objectId(); pEntity- delete pIter; if (objIdArray.isEmpty() acad_free(fname);nYou must pick a drawing file that contains circles. AcDbBlockTable *pThisBlockTable; acdbHo

11、stApplicationServices()-workingDatabase() -getSymbolTable(pThisBlockTable, AcDb: AcDbBlockTableRecord *pThisMsBtr; pThisBlockTable-getAt(ACDB_MODEL_SPACE, pThisMsBtr, AcDb:kForWrite); AcDbObjectId id = pThisMsBtr-objectId(); pThisMsBtr- AcDbIdMapping errorMap; acapLongTransactionManagerPtr()-checkOu

12、t(transId, objIdArray, id, errorMap); int colorIndex; double radius; acedGetInt(nEnter color number to circles center line:, &colorIndex); acedGetReal(nEnter circle radius:,&radius); if (radiusnewWorkSetIterator(pWorkSetIter); for (pWorkSetIter-pWorkSetIter- pWorkSetIter-step() acdbOpenAcDbEntity(pE

13、ntity, pWorkSetIter-objectId(), AcDb: pEntity-setColorIndex(colorIndex); (AcDbCircle*)pEntity)-setRadius(radius); delete pWorkSetIter; pObj- char str132; acedGetString(0, nSee the new colors and radius. Press return to back, str);checkIn(transId, errorMap);saveAs(fname); delete pDb; pDb = NULL;initA

14、pp()EXAM04A, LONGTRANS ACRX_CMD_MODAL, refEdit);void unloadApp()AppMsgCode msg, void* appId)unlockApplication(appId);registerAppMDIAware(appId); initApp(); unloadApp();kLoadDwgMsg:kUnloadDwgMsg:kInvkSubrMsg: default: ;exam04bstdlib.hstring.hrxobject.h#include acestext.hvoid printXdata();void addXdat

15、a();void printList(struct resbuf* pRb);AcDbObject* selectObject(AcDb:OpenMode openMode);void initApp();void unloadApp();AcRx:AppRetCode acrxEntryPoint(AcRx:AppMsgCode, void*);printXdata() AcDbObject *pObj; if (pObj = selectObject(AcDb:kForRead) = NULL) char appname133; if (acedGetString(NULL,nEnter

16、the desired Xdata application name:, appname) ! struct resbuf *pRb; pRb = pObj-xData(appname); if (pRb != NULL) printList(pRb); acutRelRb(pRb); else nNo xdata for this appnamevoid addXdata() AcDbObject* pObj = selectObject(AcDb:pObj) Error selecting objectn char appName132, resString200; appName0 =

17、resString0 = 0; acedGetString(NULL, Enter application name: appName);Enter string to be added: resString); struct resbuf *pRb, *pTemp;xData(appName); for (pTemp = pRb; pTemp-rbnext != NULL; pTemp = pTemp-rbnext) ; acdbRegApp(appName); pRb = acutNewRb(AcDb:kDxfRegAppName); pTemp = pRb;resval.rstring

18、= (char*) malloc(strlen(appName) + 1); strcpy(pTemp-resval.rstring, appName);rbnext = acutNewRb(AcDb:kDxfXdAsciiString);rbnext; = (char*) malloc(strlen(resString) + 1);resval.rstring, resString);upgradeOpen();setXData(pRb);printList(struct resbuf* pRb) int rt, i; char buf133; for (i = 0;pRb !i+, pRb

19、 = pRb-rbnext) if (pRb-restype 1040) rt = RT3DPOINT; 1060) rt = RTREAL; 1071) rt = RTSHORT;restype = 1071) rt = RTLONG; rt = pRb-restype; switch (rt) case RTSHORT:restype = RTSHORT) acutPrintf(RTSHORT : %dn, pRb-resval.rint);(%d . %d)nrestype, pRb- ; case RTREAL:restype = RTREAL) RTREAL : %0.3fnresval.rreal);(%d . %0.3f)n case RTSTR:restype = RTSTR) RTSTR : %sn(%d . %s)n case RT3DPOINT:restype = RT3DPOINT) RT3DPOINT : %0.3f, %0.3f, %0.3fnresval.rpointX,resval.rpointY,resval.rpointZ);(%d %0.3f %0.3f %0.3f)nresval.rpointX

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

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