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

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   ObjectARX(C++) (http://www.dimcax.com/hust/forumdisplay.php?f=34)
-   -   【转帖】请教大侠:如何将变量的值以字符串的形式显示 (http://www.dimcax.com/hust/showthread.php?t=8125)

yang686526 2009-04-18 08:25 PM

【转帖】请教大侠:如何将变量的值以字符串的形式显示
 
请教大侠:如何将变量的值以字符串的形式显示
请教大侠:如何将变量的值以字符串的形式显示
请教大侠,如何将变量的值在cad绘图界面中以字符串的形式显示出来?
这个问题涉及到变量的转换,各种类型变量转换成字符串方法不一样,转换成字符串后再添加数据库中,下面是添加文字的函数,如果你看不懂的话,多看多做arx中sample下面的例子,多试几次..
acdbobjectid createtext(acgepoint3d pt,cstring strtext,
char *pstylename,double height,double dwidth,
double rotation,char *playername,acdb::textvertmode vmode,
acdb::texthorzmode hmode)
{
acdbtextstyletable *ptextstyletable;
acdbobjectid objid,styleid;
char text[255];
acdbhostapplicationservices()->workingdatabase()
->getsymboltable(ptextstyletable, acdb::kforread);
if (!ptextstyletable->has(pstylename)){
ptextstyletable->close();
createtextstyle(pstylename,"romanc.shx","hzdx.shx",height,1.0,0.0,1.0);
acdbhostapplicationservices()->workingdatabase()
->getsymboltable(ptextstyletable, acdb::kforread);
}
if (ptextstyletable->has(pstylename)){
ptextstyletable->getat(pstylename,styleid,adesk::kfalse);
//′′?¨??×?
acdbblocktable *pblocktable;
acdbhostapplicationservices()->workingdatabase()
->getsymboltable(pblocktable,acdb::kforread);
acdbblocktablerecord *pspace;
pblocktable->getat(acdb_model_space,pspace,acdb::kforwrite);
pblocktable->close();
strcpy(text,strtext);
acdbtext *ptext = new
acdbtext(pt,text,styleid,height,rotation);
if(dwidth != 1.0)ptext->setwidthfactor(dwidth);
ptext->setlayer(playername);
ptext->setverticalmode(vmode);
ptext->sethorizontalmode(hmode);
ptext->setalignmentpoint(pt);
pspace->appendacdbentity(objid,ptext);
ptext->close();
pspace->close();
pblocktable->close();
ptext = null;
}
ptextstyletable->close();
return objid;
}
下面贴一个别人写的数据转换的例子:
作者:程佩君
刚接触vc编程的朋友往往对许多数据类型的转换感到迷惑不解,本文将介绍一些常用数据类型的使用。
我们先定义一些常见类型变量借以说明
int i = 100;
long l =
这个问题涉及到变量的转换,各种类型变量转换成字符串方法不一样,转换成字符串后再添加数据库中,下面是添加文字的函数,如果你看不懂的话,多看多做arx中sample下面的例子,多试几次..
acdbobjectid createtext(acgepoint3d pt,cstring strtext,
char *pstylename,double height,double dwidth,
double rotation,char *playername,acdb::textvertmode vmode,
acdb::texthorzmode hmode)
{
acdbtextstyletable *ptextstyletable;
acdbobjectid objid,styleid;
char text[255];
acdbhostapplicationservices()->workingdatabase()
->getsymboltable(ptextstyletable, acdb::kforread);
if (!ptextstyletable->has(pstylename)){
ptextstyletable->close();
createtextstyle(pstylename,"romanc.shx","hzdx.shx",height,1.0,0.0,1.0);
acdbhostapplicationservices()->workingdatabase()
->getsymboltable(ptextstyletable, acdb::kforread);
}
if (ptextstyletable->has(pstylename)){
ptextstyletable->getat(pstylename,styleid,adesk::kfalse);
//′′?¨??×?
acdbblocktable *pblocktable;
acdbhostapplicationservices()->workingdatabase()
->getsymboltable(pblocktable,acdb::kforread);
acdbblocktablerecord *pspace;
pblocktable->getat(acdb_model_space,pspace,acdb::kforwrite);
pblocktable->close();
strcpy(text,strtext);
acdbtext *ptext = new
acdbtext(pt,text,styleid,height,rotation);
if(dwidth != 1.0)ptext->setwidthfactor(dwidth);
ptext->setlayer(playername);
ptext->setverticalmode(vmode);
ptext->sethorizontalmode(hmode);
ptext->setalignmentpoint(pt);
pspace->appendacdbentity(objid,ptext);
ptext->close();
pspace->close();
pblocktable->close();
ptext = null;
}
ptextstyletable->close();
return objid;
}
下面贴一个别人写的数据转换的例子:
作者:程佩君
刚接触vc编程的朋友往往对许多数据类型的转换感到迷惑不解,本文将介绍一些常用数据类型的使用。
我们先定义一些常见类型变量借以说明
int i = 100;
long l =
这个问题涉及到变量的转换,各种类型变量转换成字符串方法不一样,转换成字符串后再添加数据库中,下面是添加文字的函数,如果你看不懂的话,多看多做arx中sample下面的例子,多试几次..
acdbobjectid createtext(acgepoint3d pt,cstring strtext,
char *pstylename,double height,double dwidth,
double rotation,char *playername,acdb::textvertmode vmode,
acdb::texthorzmode hmode)
{
acdbtextstyletable *ptextstyletable;
acdbobjectid objid,styleid;
char text[255];
acdbhostapplicationservices()->workingdatabase()
->getsymboltable(ptextstyletable, acdb::kforread);
if (!ptextstyletable->has(pstylename)){
ptextstyletable->close();
createtextstyle(pstylename,"romanc.shx","hzdx.shx",height,1.0,0.0,1.0);
acdbhostapplicationservices()->workingdatabase()
->getsymboltable(ptextstyletable, acdb::kforread);
}
if (ptextstyletable->has(pstylename)){
ptextstyletable->getat(pstylename,styleid,adesk::kfalse);
//′′?¨??×?
acdbblocktable *pblocktable;
acdbhostapplicationservices()->workingdatabase()
->getsymboltable(pblocktable,acdb::kforread);
acdbblocktablerecord *pspace;
pblocktable->getat(acdb_model_space,pspace,acdb::kforwrite);
pblocktable->close();
strcpy(text,strtext);
acdbtext *ptext = new
acdbtext(pt,text,styleid,height,rotation);
if(dwidth != 1.0)ptext->setwidthfactor(dwidth);
ptext->setlayer(playername);
ptext->setverticalmode(vmode);
ptext->sethorizontalmode(hmode);
ptext->setalignmentpoint(pt);
pspace->appendacdbentity(objid,ptext);
ptext->close();
pspace->close();
pblocktable->close();
ptext = null;
}
ptextstyletable->close();
return objid;
}
下面贴一个别人写的数据转换的例子:
作者:程佩君
刚接触vc编程的朋友往往对许多数据类型的转换感到迷惑不解,本文将介绍一些常用数据类型的使用。
我们先定义一些常见类型变量借以说明
int i = 100;
long l =


所有的时间均为北京时间。 现在的时间是 06:24 AM.