C++CADArx二次开发用户交互

C++CADArx⼆次开发⽤户交互
⼀、本节课程2012河北中考作文
Arx⼆次开发⽤户交互
⼆、本节要讲解的知识点
1、⽤户交互的⼀些函数:acedGetXXX(acedGetString、acedGetPoint、acedGetInt acedGetKword、acedGetReal)。
2、动态创建多段线的实现。
3、acedGetPoint函数中使⽤关键字。
三、具体内容
1、acedGetString:获取户输⼊的字符串
acedGetPoint:获取⽤户输⼊的点
acedGetInt:获取⽤户输⼊的整型
acedGetKword:获取⽤户输⼊的关键字
acedGetReal:获取⽤户输⼊的实数。
2、动态创建多段线:最基本的要求就是⽤户在图形窗⼝中按顺序拾取各个点,每次拾取⼀点都会将其加⼊到多段线的末端,最终按ENTER键或者ESC键就完成多段线的创建。
(1)拾取第⼀点;
(2)拾取第⼆点,创建多段线。
(3)如果没有按ENTER或ESC键,则拾取下⼀点,并将拾取的点添加到多段线的末尾。
(4)如果⽤户按ENTER或ESC键,退出程序的执⾏,多段线创建完毕,否则执⾏步骤3。
3、动态创建多段线(简单版、升级版)
static void YunyouMyGroupAddPolyBaic(void)
{
int index=2;
AcGePoint3d ptStart;
if (!CGetInputUtil::GetPoint(TEXT("\n please input first point:"),ptStart))
{
return;
}
AcGePoint3d ptPrevious,ptCurrent;
ptPrevious=ptStart;
AcDbObjectId polyId;
while (CGetInputUtil::GetPoint(ptPrevious,TEXT("\n please input NEXT point:"),ptCurrent))
{
if (index==2)
{
polyId=CPolylineUtil::Add(CConvertUtil::ToPoint2d(ptPrevious),CConvertUtil::ToPoint2d(ptCurrent));
}
else if(index>2)
{
AcDbPolyline *pPoly=NULL;
AcDbPolyline *pPoly=NULL;
if (acdbOpenObject(pPoly,polyId,AcDb::kForWrite)==Acad::eOk)中山大学bbs
{
pPoly->addVertexAt(index-1,CConvertUtil::ToPoint2d(ptCurrent)); pPoly->close();
}
}
ptPrevious=ptCurrent;
index++;
}
}
static void YunyouMyGroupAddPoly(void)
{
int colorIndex=0;
ads_real width=0;
int index=2;
AcGePoint3d ptStart;
if (!CGetInputUtil::GetPoint(TEXT("\n please input first point:"),ptStart)) {
return;
}
AcGePoint3d ptPrevious,ptCurrent;
ptPrevious=ptStart;
AcDbObjectId polyId;
acedInitGet(NULL,TEXT("W C O"));
int rc=CGetInputUtil::GetPointReturnCode(ptPrevious,
TEXT("\n输⼊下⼀点[宽度(W)/颜⾊(C)<;完成(O)>:"),
ptCurrent);
while (rc==RTNORM || rc==RTKWORD)
{
if (rc==RTKWORD)
{
ACHAR kword[20];
摇摇变
if (acedGetInput(kword)!=RTNORM)
{
return;
}2005年诺贝尔医学奖
if (_tcscmp(kword,TEXT("W"))==0)
{
width=GetWidth();
}
调墨油
else if (_tcscmp(kword,TEXT("C"))==0)
{
colorIndex=GetColorIndex();
}
else if (_tcscmp(kword,TEXT("O"))==0)
{
return;
}
else
{
acutPrintf(TEXT("\n输⼊了⽆效的关键字"));
}
}
else if(rc==RTNORM)
{
{
if (index==2)
{
polyId=CPolylineUtil::Add(CConvertUtil::ToPoint2d(ptPrevious),CConvertUtil::ToPoint2d(ptCurrent)); AcDbPolyline *pPoly=NULL;
if (acdbOpenObject(pPoly,polyId,AcDb::kForWrite)==Acad::eOk)
{
pPoly->setConstantWidth(width);
pPoly->setColorIndex(colorIndex);
pPoly->close();
}
}
else if(index>2)
{
AcDbPolyline *pPoly=NULL;
if (acdbOpenObject(pPoly,polyId,AcDb::kForWrite)==Acad::eOk)
{
pPoly->addVertexAt(index-1,CConvertUtil::ToPoint2d(ptCurrent));
pPoly->setConstantWidth(width);
pPoly->setColorIndex(colorIndex);
pPoly->close();
}
}
ptPrevious=ptCurrent;
index++;
}
//
acedInitGet(NULL,TEXT("W C O"));
rc=CGetInputUtil::GetPointReturnCode(ptPrevious,TEXT("\n输⼊下⼀点[宽度(W)/颜⾊(C)<;完成(O)>:"),ptCurrent);// }
}
static void YunyouMyGroupGetPointKeyword(void)
{
int rc;
ACHAR kword[20];
AcGePoint3d pt;
acedInitGet(RSG_NONULL,TEXT("K W"));
rc=CGetInputUtil::GetPointReturnCode(TEXT("\n输⼊⼀个点或[Keyword1/KeyWord2]:"),pt);
switch (rc)
{
case RTKWORD:
if (acedGetInput(kword)!=RTNORM)
{
return;
}
if (_tcscmp(kword,TEXT("K"))==0)
{
acutPrintf(TEXT("\n 选择的关键字是Keyword1"));
}
else
{
acutPrintf(TEXT("\n 选择的关键字是Keyword2"));
acutPrintf(TEXT("\n 选择的关键字是Keyword2"));
}
break;
case RTNORM:
acutPrintf(TEXT("\n输⼊点的坐标是(%.2f,%.2f,%.2f)"),pt.x,pt.y,pt.z); break;
default:
break;
}
}
四、总结
acedGetString:获取⽤户输⼊的字符串
越南京族
acedGetPoint:获取⽤户输⼊的点
acedGetInt:获取⽤户输⼊的整型
acedGetKword:获取⽤户输⼊的关键字
acedGetReal:获取⽤户输⼊的实数
acedGetDist:获取⽤户输⼊的距离值
acedGetCorner:获取⽤户输⼊的⾓点
acedGetAngle:获取⽤户输⼊的⾓度
acedGetFileD:打开⽂件选择对话框获取⽤户输⼊的⽂件名
视频课程由提供

本文发布于:2024-09-21 22:46:42,感谢您对本站的认可!

本文链接:https://www.17tex.com/xueshu/118739.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:户输   获取   拾取   创建   选择   关键字   交互
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议