几何尺寸与公差论坛------致力于产品几何量公差标准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-06, 10:06 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】plotstyle 9ctb0 not being applied

plotstyle (ctb) not being applied
plotstyle (ctb) not being applied
hi,
i have taken the odamfcapp example and stripped it down to create a simple viewer. i have created an exe for the app and a dll containing the view for display (aka cdwgviewer). i am able to open and view a drawing and even plot.
some differences include the structure of the cdocument of the view which is external to the dll containing the view.
i used the view switching technique.
mainfrm()
typedef uint ( * lpdllfunc)(cruntimeclass**);
lpdllfunc lpfndllfunc = null;
lpfndllfunc = (lpdllfunc)::getprocaddress(theapp.m_hplotcontrold ll,"initdwg");
cruntimeclass* pnewviewclass;
lpfndllfunc(&pnewviewclass);
.....
pdoc->switchtoview(pnewviewclass, null);
cdocument()
switchtoview(cruntimeclass* pnewviewclass, cview* pnewview)
....
however, the ".ctb" that is used in the drawing and actually found and loaded does not seem to be applied - but does in the original sample. is there something that needs to initialized in the doc that i may not be doing? a sample showing only the initialization of plotstyle using a ctb for a known m_pdb would be appreciated.
the following is some of the code used which is not much different from the sample.
void oninitialupdate()
odinitialize(&m_svcs);
m_pdb = m_svcs.readfile( filename, /*false*/true, false, oda::ksharedenyno );
odgicontextfordbdatabase::setdatabase(m_pdb);
m_hwindowdc = ::getdc(m_hwnd);
const odcolorref* palette = curpalette();
odgspalette ppalcpy;
ppalcpy.insert(ppalcpy.begin(), palette, palette+256);
ppalcpy[0] = activebackground();
createdevice();
if(m_pdevice.isnull())
{
getparent()->postmessage(wm_close);
return;
}
m_pdevice->update();
m_hthreadreadyevent = ::createevent(0, true, false, 0);
m_hdrawerthread = ::createthread(null, 0, _drawerthread, this, create_suspended, &m_drawerthreadid);
::setthreadpriority(m_hdrawerthread, thread_priority_below_normal);
::resumethread(m_hdrawerthread);
::waitforsingleobject(m_hthreadreadyevent, infinite);
void createdevice()
odgsmoduleptr pgs = :drxdynamiclinker()->loadmodule("wingdi");
// odgsmoduleptr pgs = :drxdynamiclinker()->loadapp("genericopenglmodule");
odgsdeviceptr pdevice = pgs->createdevice();
odrxdictionaryptr pproperties = pdevice->properties();
if(pproperties.get())
{
pproperties->putat("windowhdc", odrxvariantvalue((long)m_hwindowdc));
pproperties->putat("windowhwnd", odrxvariantvalue((long)m_hwnd)); // hwnd necessary for directx device
if(pproperties->has("doublebufferenabled")) // check if property is supported
{
pproperties->putat("doublebufferenabled", odrxvariantvalue(doublebufferenabled()));
}
// this is for temporary illustration of using gl lists:
if(pproperties->has("enablecaching")) // check if property is supported
{
pproperties->putat("enablecaching", odrxvariantvalue(usegsmodel()));
}
}
enablegsmodel(usegsmodel());
m_pdevice = oddbgsmanager::setupactivelayoutviews(pdevice, this);
m_layoutid = m_pdevice->layoutid();
const odcolorref* palette = curpalette();
odgspalette ppalcpy;
ppalcpy.insert(ppalcpy.begin(), palette, palette+256);
ppalcpy[0] = activebackground();
m_pdevice->setlogicalpalette(ppalcpy.asarrayptr(), 256);
if(m_pdevice->iskindof(odgsmodellayouthelper::desc()))
{
m_bpsoverall = false;
m_pdevice->setbackgroundcolor(activebackground());
}
else
{
m_bpsoverall = true;
m_pdevice->setbackgroundcolor(odrgb(173,174,173)); // acad's color for paper bg
}
setpalettebackground(activebackground());
if (rc.left == 0 && rc.right == 0 && rc.bottom == 0 && rc.top == 0)
rc.right = rc.bottom = 100;
odgsdcrect gsrect(rc.left, rc.right, rc.bottom, rc.top);
m_pdevice->onsize(gsrect);
// adding plotstyletable info
prepareplotstyles();
i have narrowed it down to:
loadplotstyletable(pfilebuf);
resulting in
m_pplotstyletable == 0 of class odgicontextfordbdatabase
any clues?
look at your oddbhostappservices... it may not be finding the .ctb or mishandling it... or not even called.
tyler
dwg export dll
i am writing a dwg export dll for our cad program. but i cannot use plotstyle services because when i add codes above, my dll will not be loaded. i guess that afxloadlibrary function dont load because of g_odrx_static_module_map.
the macros above are required only for static build but they should not damage configuration using dwgdirect dlls because _toolkit_in_dll_ must be defined if and only if dll configuration of dwgdirect is used.
in dll configuatation modules (.drx) are loaded dynamically. the only requirement is their presence in application folder.
in static configuration the macros above must be used and application must be linked with modules mentioned in macros.
btw, client dll may fail to load if it is linked with some .dll or .drx which is absent in application folder.
sergey slezkin
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】profile of surface applied to irregularly shaped features wi yang686526 American standards 0 2009-04-29 09:29 PM
【转帖】pos tol applied to pattern 9how to0 yang686526 American standards 0 2009-04-29 09:18 PM
【转帖】block tolerances applied to comercial hardware yang686526 American standards 0 2009-04-29 06:41 PM


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


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