几何尺寸与公差论坛------致力于产品几何量公差标准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)
-   DirectDWG (http://www.dimcax.com/hust/forumdisplay.php?f=89)
-   -   【转帖】hard-coding style sheet names (http://www.dimcax.com/hust/showthread.php?t=16458)

yang686526 2009-05-05 11:46 AM

【转帖】hard-coding style sheet names
 
hard-coding style sheet names
hard-coding style sheet names
dear oda gurus, i am presently studying how to load a style sheet in a dwg using dwgdirect 2.4.2.
i have found difficulties with storing a hard-coded style sheet name. i need no interaction with the user, nor i need checking whether any ctb file does exist; i just need storing a file name, so that if the file exists in the proper path specified in the autocad profile, autocad will load it; otherwise, autocad should report "file missing".
when using version 1.14.02, this task was straightforward using oddbplotsettingvalidator::setcurrentstylesheet i.e.
code:
struct myservices : public exsystemservices, public exhostappservices {...}
//myservices m_svcs is declared and properly initialized in my class
//following code in the routine creating the plot setting
oddbplotsettingsptr ps = oddbplotsettings::createobject();
oddbplotsettingsvalidatorptr v = m_svcs.plotsettingsvalidator();
ps->setplotsettingsname(psname);
...
v->setcurrentstylesheet(ps, dd_t("cce.ctb"));
...i have not been succeeding reproducing this behaviour.
i wonder if that routine works differently than before. i retrieved information about ddplotstylepaths as well as plot setting features in odamfcapp, but they do not seem suiting my needs. i am using static linking for my application.
thank you very much for your suggestions in advance.
mirko pontrelli.
last edited by m.pontrelli@coastalexploration.com; 11th december 2008 at 07:47 amfff">. reason: mistakes
still searching for a solution
back on the topic after some months and switching to dd 2.7.1. i can't grasp what i am missing yet.
basically, after this code
code:
odresult res = v->setcurrentstylesheet(pplotsettings, odstring("test.ctb"));
odstring test = ps->getcurrentstylesheet();the value of res is einvalidinput and, subsequently, test is empty.
odamfcapp also put it that way:
code:
void cpagesetupdlg::onselchangeplotstylefiles()
{
int idx = m_comboplotstylefiles.getcursel();
getdlgitem(idc_pagesetup_button_plotstylefiles)->enablewindow( idx );
if (idx)
{
cstring tmp;
m_comboplotstylefiles.getlbtext(idx, tmp);
m_pvalidator->setcurrentstylesheet(&m_params, odstring(tmp));
}
else
{
m_pvalidator->setcurrentstylesheet(&m_params, odstring::kempty);
}
}using oddbplotsettingsvalidator::refreshlists() does not work, even if the ddplotstylepaths is properly set. does setcurrentstylesheet() check for the actual existence of the ctb file in the plot style list? that would be most annoying for my target.
the problem seems similar to this one:
quote:
originally posted by sjaiswal@hachisoft.com
hi,
my drawing has one *.ctb plot style associated with model layout. i want to remove this association and set it to empty.
currently oddbplotsettingsvalidator::setcurrentstylesheet() returns einvalidinput result when passing odstring::kempty as stylesheet name.
is there any other way to remove currently associated plotstyle from a layout?
thanks.
mr. slezkin suggested using oddbentget and oddbentmod methods as a workaround to one of dd bugs, but more than one year has passed since then. it requires module loading, which in turn requires touching the main application file. i would prefer not to apply that solution, in order to keep my code clean: i just use dd to serialize dwg files, and i would keep everything involving it in a separate application "branch".
by the way, i didn't manage to succefully use that suggestion. i took information about odplotsettingsvalidatormodule, odbagfiler and tasks involved by such modules. i guess that's because i have no familiarity with dd modules - i did't need them before.
other solutions seem making the task more complex, rather than easier.
so, before spending some more time with modules and other "exotic" ways: do i really need them? adding the dotted pair (7 . "test.ctb") to the plot setting list ?la-lisp is all i need, regardless whether that file is present or not; nor i need to vectorize anything with my application. with dd 1.14.02, it was really a one-line task. i currently use class oddbplotsettingsvalidator to set every other plot setting parameter, and it works flawlessly.
regards,
mirko pontrelli.
last edited by m.pontrelli@coastalexploration.com; 3rd april 2009 at 03:41 amfff">.


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