几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量  


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » AutoCAD二次开发 » ObjectARX(C++)
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


回复
 
主题工具 搜索本主题 显示模式
旧 2009-04-16, 08:29 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】关于文本标注 和 圆圈标注 的问题

关于文本标注 和 圆圈标注 的问题
关于文本标注 和 圆圈标注 的问题
[arx函数]:关于文本标注 和 圆圈标注 的问题? 9pt 10pt 11pt 12pt 13pt 15pt
/////////////////////////////////////////////////////
在指定坐标点进行文本标注:
acdbblocktable *pblocktablew;
acdbhostapplicationservices()->workingdatabase()
->getsymboltable(pblocktablew, acdb::kforread);
acdbblocktablerecord *pblocktablerecorde;
pblocktablew->getat(acdb_model_space,
pblocktablerecorde, acdb::kforwrite);
pblocktablew->close();//关闭块表
ads_point point;
int ret;
acutprintf("\n请选中权属单位:“%s",cscaption);
ret = acedgetpoint(null,"”标注的中心点:",point);
ret= acedcommand(rtstr, "boundary",rtpoint ,point, rtstr, "",0) ;
acutprintf("\n你选的点坐标为 x = %.3f y = %.3f",point[0],point[1]);
acgepoint3d textposition(point[0], point[1], 0.0);
acgepoint3d atextposition(point[0], point[1], 0.0);
double textheight = 10;
double textwidthfactor = 0.8000;
double textrotation = 0.0;
acdbtext *ptext=new acdbtext(textposition, cscaption, acdbobjectid::knull ,
textheight, textrotation);
ptext->sethorizontalmode(acdb::ktextmid);
ptext->setalignmentpoint(atextposition);
ptext->setcolorindex (1);
acdbobjectid textid;
pblocktablerecorde->appendacdbentity(textid, ptext); //*
pblocktablerecorde->close();
ptext->close();
/////////////////////////////////////////////////////////////////////////////////////////
在指定坐标点进行画圆标注坐标点:
cstring xpt[100];
cstring ypt[100];
float xco[100];
float yco[100];
acedgetint("\n请输入多边形顶点数:",&nodenumcount);
if(acedgetpoint(null,"\n请选择起始点:",pt)==rtnorm)
{
xpt[0].format("%g",pt[x]);
ypt[0].format("%g",pt[y]);
acutprintf("\n起始点坐标为:%s,%s",xpt[0],ypt[0]);
}
xco[0]=atof(xpt[0]);
yco[0]=atof(ypt[0]);
for(int i=0;i {
if(acedgetpoint(null,"\n拾取下一点:",pt)==rtnorm)
{
xpt[i+1].format("%g",pt[x]);
ypt[i+1].format("%g",pt[y]);
acutprintf("\n该点坐标为:%s,%s",xpt[i+1],ypt[i+1]);
}
xco[i+1]=atof(xpt[i+1]);
yco[i+1]=atof(ypt[i+1]);
acdbblocktable *pblocktablew;
acdbhostapplicationservices()->workingdatabase()
->getsymboltable(pblocktablew, acdb::kforread);
acdbblocktablerecord *pblocktablerecorde;
pblocktablew->getat(acdb_model_space,
pblocktablerecorde,acdb::kforwrite);
pblocktablew->close();
acgevector3d normal(0.0, 0.0, 1.0);
acgepoint3d startpt(xco[n],yco[n],0.0);//定义圈标注的中点
acdbcircle *pcirc1 = new acdbcircle(startpt, normal, num);
acdbobjectid circleid;
pblocktablerecorde->appendacdbentity(circleid, pcirc1);
pblocktablerecorde->close();
pcirc1->close();
///////////////////////////////////////////////////////////////
以上两个功能函数均正确!! 以下是两个功能整合过()后的程序,编译无错,
但在cad中会导致-致命错误!估计是定义坐标不一致而导致的,即:
进行圈标注的点---acgepoint3d startpt(xco[n],yco[n],0.0); //float型的
不能做为数字标注的点---acgepoint3d textposition(point[0], point[1], 0.0);
希望哪位高手给予指点,我在这里先谢过了!
cstring xpt[100];
cstring ypt[100];
float xco[100];
float yco[100];
acedgetint("\n请输入多边形顶点数:",&nodenumcount);
if(acedgetpoint(null,"\n请选择起始点:",pt)==rtnorm)
{
xpt[0].format("%g",pt[x]);
ypt[0].format("%g",pt[y]);
acutprintf("\n起始点坐标为:%s,%s",xpt[0],ypt[0]);
}
xco[0]=atof(xpt[0]);
yco[0]=atof(ypt[0]);
for(int i=0;i {
if(acedgetpoint(null,"\n拾取下一点:",pt)==rtnorm)
{
xpt[i+1].format("%g",pt[x]);
ypt[i+1].format("%g",pt[y]);
acutprintf("\n该点坐标为:%s,%s",xpt[i+1],ypt[i+1]);
}
xco[i+1]=atof(xpt[i+1]);
yco[i+1]=atof(ypt[i+1]);
for(int n=0;n {
acgevector3d normal(0.0, 0.0, 1.0);
acgepoint3d startpt(xco[n],yco[n],0.0);//定义直线点
acdbcircle *pcirc1 = new acdbcircle(startpt, normal, num);
acdbblocktable *pblocktablee;
acdbhostapplicationservices()->workingdatabase()
->getsymboltable(pblocktablee, acdb::kforread);
acdbblocktablerecord *pblocktablerecorde;
pblocktablee->getat(acdb_model_space, pblocktablerecorde,acdb::kforwrite);
pblocktablee->close();
//acgepoint3d textposition(xco[n], yco[n], 0.0);//*
//acgepoint3d atextposition(xco[n], yco[n], 0.0);//开始数字标注
char s1[64];
sprintf(s1, "%d", n);//强制转换类型
double textheight = 10;
double textwidthfactor = 0.8000;
double textrotation = 0.0;
//acdb::ktextleft
acdbtext *ptext=new acdbtext(startpt,s1, acdbobjectid::knull , textheight, textrotation);
ptext->sethorizontalmode(acdb::ktextmid);
ptext->setalignmentpoint(startpt);
ptext->setcolorindex(1);
acdbobjectid textid;
pblocktablerecorde->appendacdbentity(textid, ptext);
//////////////////////////////////////////////////////////////////////////
acdbobjectid circleid;
pblocktablerecorde->appendacdbentity(circleid, pcirc1);
pblocktablerecorde->close();
pcirc1->close();
ptext->close();
}
进行圈标注的点---acgepoint3d startpt(xco[n],yco[n],0.0); 是float型的
不能做为数字标注的点---acgepoint3d textposition(point[0], point[1], 0.0);是ads_point型的
这两者怎么能达到统一,希望高手指点一下啊!
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭



所有的时间均为北京时间。 现在的时间是 11:02 PM.


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多