




已阅读5页,还剩3页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
/ ObjectARX defined commands, created by 2010-9-30, , #include StdAfx.h#include StdArx.h#include dbents.h#include geassign.h#include dbpl.h#define PI 3.141592653589793238462643383279502884197169399375105820974944592308BOOL AddEntityToDBS(AcDbEntity *pEntity, AcDbObjectId &Id)/获取块表AcDbBlockTable *pBlockTable = NULL;if (acdbHostApplicationServices()-workingDatabase()-getBlockTable(pBlockTable, AcDb:kForRead) != Acad:eOk)return FALSE;/获取模型空间的快表记录AcDbBlockTableRecord *pBlkTabRec = NULL;if (pBlockTable-getAt(ACDB_MODEL_SPACE, pBlkTabRec, AcDb:kForWrite) != Acad:eOk)pBlockTable-close();return FALSE;pBlkTabRec-appendAcDbEntity(Id, pEntity);pEntity-close();pBlockTable-close();pBlkTabRec-close();return TRUE;/-绘制直线-/ This is command CLINE, by 2010-9-30, , void EICADDrawCLine()#ifdef OARXWIZDEBUGacutPrintf (nOARXWIZDEBUG - EICADDrawCLine() called.);#endif / OARXWIZDEBUG/ TODO: Implement the commandads_point pt0;ads_point pt;AcDbObjectId EntId;if (ads_getpoint(NULL, _T(n请指定起始点:), pt0) !=RTNORM) return;if (ads_getpoint(pt0, _T(n请指定终点:), pt) != RTNORM) return;AcDbLine *pLine = new AcDbLine(asPnt3d(pt0), asPnt3d(pt);AddEntityToDBS(pLine, EntId);pLine-close();/-编辑直线起点-/ This is command EDITLSTARTPOINT, by 2010-9-30, , void EICADDRAWEditlstartpoint()#ifdef OARXWIZDEBUGacutPrintf (nOARXWIZDEBUG - EICADDRAWEditlstartpoint() called.);#endif / OARXWIZDEBUG/ TODO: Implement the commandads_point pt0;ads_point pt;ads_name Ent;AcDbObjectId EntId;AcDbLine *pLine = NULL;if (ads_entsel(_T(n请选择对象:), Ent, pt0) != RTNORM) return;if (ads_getpoint(NULL, _T(n请选择起点:), pt) != RTNORM) return;if (acdbGetObjectId(EntId, Ent) != Acad:eOk) return;if (acdbOpenObject(pLine, EntId, AcDb:kForWrite) != Acad:eOk) return;pLine-setStartPoint(asPnt3d(pt);pLine-close();/-编辑直线终点-/ This is command EDITLENDPOINT, by 2010-9-30, , void EICADDRAWeditlendpoint()#ifdef OARXWIZDEBUGacutPrintf (nOARXWIZDEBUG - EICADDRAWeditlendpoint() called.);#endif / OARXWIZDEBUG/ TODO: Implement the commandads_point pt0;ads_point pt;ads_name Ent;AcDbObjectId EntId;AcDbLine *pLine = NULL;if (ads_entsel(_T(n请选择对象:), Ent, pt0) != RTNORM) return;if (ads_getpoint(NULL, _T(n请选择终点:), pt) != RTNORM) return;if (acdbGetObjectId(EntId, Ent) != Acad:eOk) return;if (acdbOpenObject(pLine, EntId, AcDb:kForWrite) != Acad:eOk) return;pLine-setEndPoint(asPnt3d(pt);pLine-close();/-绘制多段线-/ This is command CPLINE, by 2010-9-30, , void EICADDRAWCPLine()#ifdef OARXWIZDEBUGacutPrintf (nOARXWIZDEBUG - EICADDRAWCPLine() called.);#endif / OARXWIZDEBUG/ TODO: Implement the commandads_point pt0 = 0.0;ads_point pt = 0.0;AcDbObjectId EntId;AcGePoint2d Gpt2d;AcDbPolyline *pPLine = new AcDbPolyline();if (ads_getpoint(NULL, _T(n请指定起始点:), pt0) != RTNORM) return;Gpt2d.set(pt0X, pt0Y);if (pPLine-addVertexAt(0, Gpt2d) != Acad:eOk)delete pPLine;return;AddEntityToDBS(pPLine, EntId);pPLine = NULL;while (ads_getpoint(pt0, _T(n请指定下一个点:), pt) = RTNORM)Gpt2d.set(ptX, ptY);pt0X = ptX;pt0Y = ptY;if (acdbOpenObject(pPLine, EntId, AcDb:kForWrite) != Acad:eOk) return;if (pPLine-addVertexAt(pPLine-numVerts(), Gpt2d) != Acad:eOk)return;pPLine-close();AddEntityToDBS(pPLine, EntId);pPLine-close();/-绘制圆(用户输入圆心和半径画圆)-/ This is command CCIRCLE, by 2010-9-30, , void EICADDrawCCircle()#ifdef OARXWIZDEBUGacutPrintf (nOARXWIZDEBUG - EICADDrawCCircle() called.);#endif / OARXWIZDEBUG/ TODO: Implement the commandads_point pt;ads_real pr;AcDbObjectId EntId;if (ads_getpoint(NULL, _T(n请指定圆心:), pt) != RTNORM) return;if (ads_getreal(_T(n请输入半径:), &pr) != RTNORM) return;AcDbCircle *pCircle = new AcDbCircle(asPnt3d(pt), AcGeVector3d(0.0, 0.0, 1.0), pr);pCircle-setColorIndex(4);AddEntityToDBS(pCircle, EntId);pCircle-close();/-编辑圆心-/ This is command EDITCCENTER, by 2010-9-30, , void EICADDRAWEditCCenter()#ifdef OARXWIZDEBUGacutPrintf (nOARXWIZDEBUG - EICADDRAWEditCCenter() called.);#endif / OARXWIZDEBUG/ TODO: Implement the commandads_point pt;ads_point pt0;ads_name Ent;AcDbObjectId EntId;if (ads_entsel(_T(n请选择对象:), Ent, pt0) != RTNORM) return;if (ads_getpoint(NULL, _T(n请选择圆心位置:), pt) != RTNORM) return;AcDbCircle *pCircle = NULL;if (acdbGetObjectId(EntId, Ent) != Acad:eOk) return;if (acdbOpenObject(pCircle, EntId, AcDb:kForWrite) != Acad:eOk) return;pCircle-setCenter(asPnt3d(pt);pCircle-close();/-编辑圆半径-/ This is command EDITCRADIUS, by 2010-9-30, , void EICADDRAWEditCRadius()#ifdef OARXWIZDEBUGacutPrintf (nOARXWIZDEBUG - EICADDRAWEditCRadius() called.);#endif / OARXWIZDEBUG/ TODO: Implement the commandads_point pt;ads_name Ent;ads_real pr;AcDbObjectId EntId;AcDbCircle *pCircle = NULL;if (ads_entsel(_T(n请选择对象:), Ent, pt) != RTNORM) return;if (ads_getreal(_T(n请指定半径:), &pr) != RTNORM) return;if (acdbGetObjectId(EntId, Ent) != Acad:eOk) return;if (acdbOpenObject(pCircle, EntId, AcDb:kForWrite) != Acad:eOk) return;pCircle-setRadius(pr);pCircle-close();/-编辑单行文本内容-/ This is command EDITTEXT, by 2010-9-30, , void EICADDRAWEditText()#ifdef OARXWIZDEBUGacutPrintf (nOARXWIZDEBUG - EICADDRAWEditText() called.);#endif / OARXWIZDEBUG/ TODO: Implement the commandads_point pt0;ads_name Ent;char pt200;AcDbObjectId EntId;AcDbText *PText = NULL;if (ads_entsel(_T(n请选择对象:), Ent, pt0) != RTNORM) return; if (ads_getstring(1, _T(n请输入内容:), pt) != RTNORM) return;if (acdbGetObjectId(EntId, Ent) != Acad:eOk) return;if (acdbOpenObject(PText, EntId, AcDb:kForWrite) != Acad:eOk) return;PText-setTextString(pt);PText-setColorIndex(2);PText-close();/-插入块参照-/ This is command CBLKREF, by 2010-9-30, , void EICADDrawCBlkRef()#ifdef OARXWIZDEBUGacutPrintf (nOARXWIZDEBUG - EICADDrawCBlkRef() called.);#endif / OARXWIZDEBUG/ TODO: Implement the commandAcDbBlockTable *pBlockTable = NULL;if (acdbHostApplicationServices()-workingDatabase()-getBlockTable(pBlockTable, AcDb:kForRead) != Acad:eOk)return;AcDbBlockTableRecord *pBlkTblRec = NULL;if (pBlockTable-getAt(_T(zfm), pBlkTblRec, AcDb:kForRead) != Acad:eOk)pBlockTable-close();return;AcDbObjectId BlkRefId = pBlkTblRec-objectId();AcDbObjectId EntId;AcDbBloc
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 南通市中石化2025秋招笔试模拟题含答案行测综合英语
- 天津市中储粮2025秋招面试典型题目及答案
- 国家能源武汉市2025秋招化学工程类面试追问及参考回答
- 国家能源铜陵市2025秋招机械工程类面试追问及参考回答
- 安阳市中石化2025秋招笔试提升练习题含答案
- 丽江市中石化2025秋招笔试模拟题含答案新材料与新能源岗
- 株洲市中石化2025秋招面试半结构化模拟题及答案电气仪控技术岗
- 许昌市中储粮2025秋招购销统计岗高频笔试题库含答案
- 大唐电力鸡西市2025秋招半结构化面试模拟30问及答案
- 武威市中石油2025秋招心理测评常考题型与答题技巧
- 隧道施工应急预案方案
- 植物鉴赏课件
- 安徽省华师联盟2026届高三上学期9月开学质量检测物理试卷(含答案)
- 肿瘤热疗中国专家共识
- 2025年甘肃省药品检查员资格考试(药械化流通)历年参考题库含答案详解(5套)
- 2025年泸州职业技术学院招聘考试笔试试卷【附答案】
- 自来水企业内部管理规范
- 2025新热处理工程师考试试卷及答案
- 硬笔书法全册教案共20课时
- 工会兼职补助管理办法
- 纸箱不合格品管理制度
评论
0/150
提交评论