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


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


 
 
主题工具 搜索本主题 显示模式
旧 2009-05-05, 12:05 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】help me. complex linetype problem

help me. complex linetype problem.
please help me. complex linetype problem.
hi.
i got a problem in autocad dwg save program.
this program uses a complex linetype in directdwg 1.11(dd)
after i had created a several of complex linetypes using dd, and created a autocad dwg file(version 2004) using dd.
however, wasn't displayed in autocad 2004 properly.
this dwg file has two lines with complex linetypes.
the struct of complex linetype is
*cdv000,vtype(conc) ----> v ----> v ---->
a,.9,[kc24,khcline.shx,s=.006],-.2,["v",standard,s=.2,x=.15,y=-.1],-.25,-.2
in .lin file.
before create this linetype, i had created a 'khcline.shx' textstyle(shape font). the 'khcline.shx' is shape file to be made from third party company.(currently, this shape file is widely using in autocad third party industry in korea. this file contains arrow style shapes.)
< below code is source code of the program. >
1) add styles.
void dbfiller::addstyles()
{
addstyle(pdb, "standard", textsize, xscale, priorsize, opblquing, "txt.shx", "", false, "", false, false, 0, 0);
...
addstyle(pdb, "khcline", textsize, xscale, priorsize, opblquing, "khcline.shx", "khcline", true, "", false, false, 0, 0);
}
2) add style.(shape file & font file)
void dbfiller::addstyle(oddbdatabaseptr pdb, odstring stylename, double textsize, double xscale, double priorsize, double obliquing, odstring filename, odstring bigfontname, bool isshapefile, const odstring& ttfacename, bool bold, bool italic, int charset, int pitchandfamily)
{
oddbtextstyletableptr pstyles;
pstyles = pdb->gettextstyletableid().safeopenobject(oddb::kforwr ite);
oddbtextstyletablerecordptr pstyle;
oddbobjectid existstyleid = pstyles->getat(stylename);
if(existstyleid.isnull())
pstyle = oddbtextstyletablerecord::createobject();
else
pstyle = existstyleid.safeopenobject(oddb::kforwrite);
if(pstyle.isnull())
return;
// name must be set before a table object is added to a table. the
// isshapefile flag must also be set (if true) before adding the object
// to the database.
pstyle->setname(stylename);
pstyle->setisshapefile(isshapefile);
// add the object to the table.
if(existstyleid.isnull())
pstyles->add(pstyle);
// set the remaining properties.
pstyle->settextsize(textsize);
pstyle->setxscale(xscale);
pstyle->setpriorsize(priorsize);
pstyle->setobliquingangle(obliquing);
pstyle->setfilename(filename);
pstyle->setbigfontfilename(bigfontname);
if (isshapefile)
{
pstyle->setpriorsize(22.45);
}
if (!ttfacename.isempty())
{
pstyle->setfont(ttfacename, bold, italic, charset, pitchandfamily);
}
}
3) add linetypes(mylinetypetable, mylinetype... are the linetype library symbol of my company.)
void dbfiller::addlinetypes(oddbdatabaseptr pdb)
{
oddblinetypetableptr ptable = pdb->getlinetypetableid().safeopenobject(oddb::kforwri te);
oddbtextstyletableptr ptexttable = pdb->gettextstyletableid().safeopenobject(oddb::kforwr ite);
mylinetypetable* pmytable = m_pmydb->getlinetypetable();
for(int i = 0; i < pmytable->getcount(); i++)
{
mylinetype* plinetype = pmytable->getat(i);
char szname[max_defstr];
strcpy(szname, plinetype->getname());
oddbobjectid existid = ptable->getat(szname);
oddblinetypetablerecordptr pentry = oddblinetypetablerecord::createobject();
odstring sdesc = plinetype->getdescript();
odstring sname = szname;
pentry->setname(sname);
// add the object to the table.
oddbobjectid id = ptable->add(pentry);
oddblinetypetablerecordptr plt = id.safeopenobject(oddb::kforwrite);
plt->setcomments(sdesc);
int ndash = plinetype->getpatterncount();
plt->setnumdashes(ndash);
double dlength = 0.;
for(int j = 0; j < ndash; j++)
{
mylinetypepattern* ppat = plinetype->getpatternobjat(j);
double ddash = ppat->getvalue();
dlength += fabs(ddash);
}
plt->setpatternlength(dlength);
// set patterns.
for(j = 0; j < ndash; j++)
{
mylinetypepattern* ppat = plinetype->getpatternobjat(j);
double ddash = ppat->getvalue();
plt->setdashlengthat(j, ddash);
odstring stextstyle = ppat->getsymbolstyle();
oddbobjectid id = ptexttable->getat(stextstyle);
plt->setshapestyleat(j, id); // not sure code!? (shape file or font file)
mypoint2d pt = ppat->getsymboloffset();
odgevector2d offset;
offset.x = pt.x, offset.y = pt.y;
plt->setshapeoffsetat(j, offset);
double dscale = ppat->getsymbolscale();
plt->setshapescaleat(j, dscale);
double dangle = ppat->getsymbolangle();
plt->setshaperotationat(j, dangle);
int inumber = ppat->getsymbolcode();
if(inumber >= 0) // if inumber is symbol code, inumber has a positive sign.
{
oduint16 shapenumber = inumber;
plt->setshapenumberat(j, shapenumber);
}
else
{
odstring text = ppat->getsymboltext();
plt->settextat(j, text);
}
}
}
}
4) save dwg file.
void _savedwgfile(...)
{
pod->writefile(&fb, oddb::kdwg, oddb::vac15, true /* save preview */);
}
how can i solve this complex linetype problem? please help me.
last edited by namosoft; 9th september 2004 at 07:15 pmfff">.
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】dwg file with complex linetype crashes the toolki yang686526 DirectDWG 0 2009-05-05 08:03 AM
【转帖】color conversion problem dd 1.14.01 yang686526 DirectDWG 0 2009-05-04 05:53 PM
【转帖】cannot open a dwg file in autocad - random problem yang686526 DirectDWG 0 2009-05-04 05:28 PM
【转帖】can i draw object in viewport as the linetype 9selected enti yang686526 DirectDWG 0 2009-05-04 05:19 PM
【转帖】vista and addin dll problem yang686526 SolidWorks二次开发 0 2009-04-13 03:19 PM


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


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