查看单个帖子
旧 2009-04-16, 07:25 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】为什么???为什么???

为什么???为什么???
为什么???为什么???
我加载的线行在打开cad的第一个文档视里起作用。。。如果新建一个一个文档(文档)就不起作用了
源码附上。。。大家帮帮
//con1line 是我自己做的线形。。。
acdbhostapplicationservices()->workingdatabase()->loadlinetypefile("con1line","acadiso.lin");

acdblayertable *playertbl;
acdbhostapplicationservices()->workingdatabase()
->getsymboltable(playertbl, acdb::kforwrite);
if (!playertbl->has("asdk_testlayer")) {
acdblayertablerecord *playertblrcd
= new acdblayertablerecord;
playertblrcd->setname("asdk_testlayer");
playertblrcd->setisfrozen(0);// layer to thawed
playertblrcd->setisoff(0); // layer to on
playertblrcd->setvpdflt(0); // viewport default
playertblrcd->setislocked(0);// un-locked

accmcolor color;
color.setcolorindex(1); // set color to red
playertblrcd->setcolor(color);

// for linetype, we need to provide the object id of
// the linetype record for the linetype we want to
// use. first, we need to get the object id.
//
acdblinetypetable *plinetypetbl;
acdbobjectid ltid;
acdbhostapplicationservices()->workingdatabase()
->getsymboltable(plinetypetbl, acdb::kforread);
if ((plinetypetbl->getat("con1line", ltid))
!= acad::eok)
{
acutprintf("\nunable to find dashed"
" linetype. using continuous");

// continuous is in every drawing, so use it.
//
plinetypetbl->getat("continuous", ltid);
}
plinetypetbl->close();

playertblrcd->setlinetypeobjectid(ltid);
playertbl->add(playertblrcd);
playertblrcd->close();
playertbl->close();
} else {
playertbl->close();
acutprintf("\nlayer already exists");
用好的心态学好来
起码基本功不扎实,除了“continuous”,其他线型是不会自动加载到每一个新建的文档中的。
将你上面的程序写到一个过程中,再在on_kloaddwgmsg中调用。。。
acdbhostapplicationservices()->workingdatabase()当前工作的文档数据库
acdbhostapplicationservices()->workingdatabase()指当前工作的文档数据库
这几天有点忙。。。感谢明经的兄弟了。。。我试试先。。。我原来是自学vc的。。。学arx还没都久。。。。我资料也不多。。。望大家都都回答我这个菜鸟的问题。。。。哈哈。。。感谢了。。。
用好的心态学好来
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)