file renders differently in 2.71 vs. 2.5.1
file renders differently in 2.71 vs. 2.5.1
hello, we are in the process of updating from release 2.5.1 to release 2.7.1. i have changed nothing in our application other than updating to 2.7.1. our application renders bitmap files from input dwg files. using the attached dwg file as input, we get differences in the output bitmap in 2.5.1 vs. 2.7.1. the two output files are also attached. specifically, in 2.5.1, much of the text has gray highlighting, but this highlighting is not present when rendered in 2.7.1. this can be seen in the text around the perimeter of the drawing.
however, i have noted that with odamfcapp 2.7.1, the highlighting is rendered. evidently, we are not doing something in our application that we need to do, even though this worked fine using release 2.5.1.
do you have any idea what we might need to do to properly get the highlighting rendered?
attached files
hello
it seems you need to load exfieldevaluatormodule (exfieldevaluator.drx) in your application. see odamfcapp.cpp source code.
best regards,
sergey z.
thanks for the response. i tried loading the exfieldevaluatormodule, but that did not make a difference. specifically, i updated the project settings to link with exfieldevaluator.lib, then added the code to declare, define, and load the exfieldevaluatormodule. portions of the code are below. do you have any other ideas?
code:
odrx_declare_static_module_entry_point(wingdimodule);
odrx_declare_static_module_entry_point(modelermodule);
odrx_declare_static_module_entry_point(dwf7importmodule);
odrx_declare_static_module_entry_point(exfieldevaluatormodule);
// the architectural desktop (adt) elements are conditionally included.
// they greatly increase the executable code size.
#ifdef include_adt
odrx_declare_static_module_entry_point(aecarchbase);
odrx_declare_static_module_entry_point(aecarchbase40);
odrx_declare_static_module_entry_point(aecarchbase50);
odrx_declare_static_module_entry_point(aecarchdachbase);
odrx_declare_static_module_entry_point(aecarchdachbase40);
odrx_declare_static_module_entry_point(aecarchdachbase50);
odrx_declare_static_module_entry_point(aecareacalculationbase);
odrx_declare_static_module_entry_point(aecareacalculationbase40);
odrx_declare_static_module_entry_point(aecareacalculationbase50);
odrx_declare_static_module_entry_point(aecbase);
odrx_declare_static_module_entry_point(aecbase40);
odrx_declare_static_module_entry_point(aecbase50);
odrx_declare_static_module_entry_point(aecschedule);
odrx_declare_static_module_entry_point(aecschedule40);
odrx_declare_static_module_entry_point(aecschedule50);
odrx_declare_static_module_entry_point(aecscheduledata);
odrx_declare_static_module_entry_point(aecscheduledata40);
odrx_declare_static_module_entry_point(aecscheduledata50);
odrx_declare_static_module_entry_point(aecstructurebase);
odrx_declare_static_module_entry_point(aecstructurebase40);
odrx_declare_static_module_entry_point(aecstructurebase50);
#endif
odrx_begin_static_module_map()
odrx_define_static_application(l"wingdi", wingdimodule)
odrx_define_static_application(l"modelergeometry", modelermodule)
odrx_define_static_appmodule(l"dd_dwf7import.drx", dwf7importmodule)
odrx_define_static_appmodule(l"exfieldevaluator.drx", exfieldevaluatormodule)
#ifdef include_adt
odrx_define_static_application(l"aecarchbase", aecarchbase)
odrx_define_static_application(l"aecarchbase40", aecarchbase40)
odrx_define_static_application(l"aecarchbase50", aecarchbase50)
odrx_define_static_application(l"aecarchdachbase", aecarchdachbase)
odrx_define_static_application(l"aecarchdachbase40", aecarchdachbase40)
odrx_define_static_application(l"aecarchdachbase50", aecarchdachbase50)
odrx_define_static_application(l"aecareacalculationbase", aecareacalculationbase)
odrx_define_static_application(l"aecareacalculationbase40", aecareacalculationbase40)
odrx_define_static_application(l"aecareacalculationbase50", aecareacalculationbase50)
odrx_define_static_application(l"aecbase", aecbase)
odrx_define_static_application(l"aecbase40", aecbase40)
odrx_define_static_application(l"aecbase50", aecbase50)
odrx_define_static_application(l"aecschedule", aecschedule)
odrx_define_static_application(l"aecschedule40", aecschedule40)
odrx_define_static_application(l"aecschedule50", aecschedule50)
odrx_define_static_application(l"aecscheduledata", aecscheduledata)
odrx_define_static_application(l"aecscheduledata40", aecscheduledata40)
odrx_define_static_application(l"aecscheduledata50", aecscheduledata50)
odrx_define_static_application(l"aecstructurebase", aecstructurebase)
odrx_define_static_application(l"aecstructurebase40", aecstructurebase40)
odrx_define_static_application(l"aecstructurebase50", aecstructurebase50)
#endif
odrx_end_static_module_map()
// these errors are caused by exceptions raised by the cad library. the specific errors
// are not meaningful to the end user, but they may be interesting for debugging,
// so they are returned in the range of err_unexpected_error errors.
enum caderrors
{
cad_error_memstream_create = -900,
cad_error_database_create = -901,
cad_error_load_module = -902,
cad_error_create_device = -903,
cad_error_create_context = -904,
cad_error_create_layout = -905
};
const char *modellayoutname = "model"; //the model space layout is always named "model"
const dword modelnamelength = 5;
/**************************************************************************************************
* name: initcadlibrary
*
* description:
* this function initializes the cad library.
*
***************************************************************************************************/
void initcadlibrary ()
{
// initialize the static module map
odrx_init_static_module_map();
// create the portion of the 's' structure that will hold c++ objects.
// note that 'sx' is just a #define for 's.pop' (see swapvars.h).
s.pop = (void *)new struct sop;
sx->pdb = 0;
sx->pgs = 0;
sx->pdevice = 0;
sx->pcontext = 0;
sx->playouthelper = 0;
#ifdef singleclient
// see swapvars.h for a description of singleclient mode.
// create the portion of the 's' structure that will hold the services c++ object.
// this must be in a separate structure because, due to dwgdirect library constraints,
// it must be destroyed separately from the objects in the 's.pop' structure.
// then, initialize dwgdirect.
s.pop2 = (void *)new struct sop2;
odinitialize(&(sx2->svcs));
#else
// only initialize dwgdirect once per process.
if (numlibclients == 0)
{
odinitialize(&svcs);
}
numlibclients++;
#endif
}
/**************************************************************************************************
* name: cadparseinput
*
* description:
* this function loads the input drawing into a cad library database,
* extracts data from the database to return to the client, and prepares for rendering a bitmap.
*
***************************************************************************************************/
void cadparseinput ()
{
try
{
// the adtdirect modules must be loaded.
#ifdef include_adt
:

drxdynamiclinker()->loadapp( "aecbase" );
:

drxdynamiclinker()->loadapp( "aecarchbase" );
:

drxdynamiclinker()->loadapp( "aecarchdachbase" );
:

drxdynamiclinker()->loadapp( "aecscheduledata" );
:

drxdynamiclinker()->loadapp( "aecschedule" );
:

drxdynamiclinker()->loadapp( "aecstructurebase" );
:

drxdynamiclinker()->loadapp( "aecareacalculationbase" );
#endif
:

drxdynamiclinker()->loadmodule(l"exfieldevaluator.drx");
// load the cad drawing into a memory stream
odmemorystreamptr pmemstream = loadinputtomemorystream (s.pbindrawing, s.drawingsize);
// dwf files require special processing by the cad library. they must be imported into
// the database before they can be processed.
if (isdwfdrawing())
{
#ifdef singleclient
sx->pdb = sx2->svcs.createdatabase();
#else
sx->pdb = svcs.createdatabase();
#endif
oddwfimportptr importer = createimporter();
importer->properties()->putat( "database", sx->pdb );
importer->properties()->putat( "stream", pmemstream );
// set this property to true to ensure that 3d dwf drawings can be rendered.
importer->properties()->putat( "importw3d", odrxvariantvalue((bool)1) );
//set the memory stream back to the beginning of the buffer.
pmemstream->rewind();
importer->import();
}
else
{
// create a cad database and load the drawing into it.
#ifdef singleclient
sx->pdb = sx2->svcs.readfile(pmemstream, false, false);
#else
sx->pdb = svcs.readfile(pmemstream, false, false);
#endif
opverify(!sx->pdb.isnull(), s.pp, err_unexpected_error + cad_error_database_create);
}
// retrieve information from the cad drawing
getgeneralinfo(sx->pdb);
getlayerinfo(sx->pdb);
getlayoutinfo(sx->pdb);
// load the windows gdi module
sx->pgs = :

drxdynamiclinker()->loadmodule("wingdi", false);
opverify(!sx->pgs.isnull(), s.pp, err_unexpected_error + cad_error_load_module);
// create a rendering context for the database
sx->pcontext = odgicontextfordbdatabase::createobject();
opverify(!sx->pcontext.isnull(), s.pp, err_unexpected_error + cad_error_create_context);
// associate the database with the context
sx->pcontext->setdatabase (sx->pdb);
// the memory stream can be released. the contents have been read into the database
// so we no longer need the memory stream.
pmemstream.release ();
}
catch (oderror& e)
{
#ifdef _debug
// capture the error description text to assist in debugging.
odstring s = e.description();
#endif
// force opverify to report an error and report the error code raised by the library
opverify(0, s.pp, err_unexpected_error - e.code());
}
catch (...)
{
// force opverify to report an error.
opverify(0, s.pp, err_unexpected_error);
}
return;
try to call oddbevaluatefields() after opening the drawing.
vladimir
hello
fields have not background box in case draw context is "isplotgeneration()" ( odgicommondraw* pwd, pwd->context()->isplotgeneration() ). testing this condition was added after release 2.5.1
best regards,
sergey z.
thank you for the explanation. in our application we were always setting plotgeneration to true. we were doing this because of email we received from neil several years ago:
quote:
from: [mailto:neilp@opendesign.com]
sent: friday, october 27, 2006 3:50 pm
to: 'stephen bucholtz'
subject: re: bitmap color issue
that flag controls some settings that improve bitmap output, so you should set it.
regards,
(neilp@opendesign.com)
-----original message-----
from: stephen bucholtz [mailto:sbucholtz@jpg.com]
sent: friday, october 27, 2006 3:35 pm
to:
subject: re: bitmap color issue
just one more thing, late on a friday afternoon:
i just added this line to my project:
pctx->setplotgeneration(1);
and so far, i'm getting correct colors. seems a little strange and doesn't seem like i should have to do this.
i have removed the call to setplotgeneration and we now get the drawing rendered with the background box. i guess we no longer should call setplotgeneration?
should you set plot generation to true or not depends on your purpose.
autocad displays and prints things differently. besides the background of fields some entities can visible or not. layers have property "plottable". entities on such layers are visible on screen but are not printed on paper.
plot generation = false - you get picture as displayed by autocad.
plot generation = true - you get picture as printed by autocad.
sergey slezkin