高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】关于文本标注 和 圆圈标注 的问题
关于文本标注 和 圆圈标注 的问题
关于文本标注 和 圆圈标注 的问题
[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型的
这两者怎么能达到统一,希望高手指点一下啊!
|