几何尺寸与公差论坛------致力于产品几何量公差标准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=7096)

yang686526 2009-04-16 07:25 PM

【转帖】为什么???为什么???
 
为什么???为什么???
为什么???为什么???
我加载的线行在打开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还没都久。。。。我资料也不多。。。望大家都都回答我这个菜鸟的问题。。。。哈哈。。。感谢了。。。
用好的心态学好来


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