what happened to setmediasize?
what happened to setmediasize?
where has oddbplotsettingvalidator::setmediasize gone? have i lost this functionality?
replacement for setmediasize
i do no know how to replace setmediasize with setcanonicalmedianame.
i suppose that first i must use canonical*media*name*list to get a list of the supported media sizes, and then choose one of them with setcanonicalmedianame as shown in the odamfcapp example. my problem is that i have non-standard media-sizes, example : 30x40 cm. how do i set non-standard media-sizes ?
you can generate your own device with new paper sizes in
odplotsettingsvalidatorpeimpl::getdevicelist() & getmedialist().
plotsettingsvalidator.drx is win32 platform module. it return list of window system available devices and some parameter of such devices (like media sizes and margins).
btw : why did you need non-standard media-sizes ?
last edited by sslezkin; 30th october 2006 at 06:16 amfff">.
non-standard mediasizes
nn-standard media-sizes are used when printing to a roll of paper.
if you work on scale 1/10 and the building is for example 20 meter.
the paper will be 2 m long in this case.
for me the name of the printer is not important, because a drawing can be made on computer 1, converted on computer 2, send to computer 3. printernames will surely differ, so will the capabilities of the printer. it is possible to convert a drawing, when there is only a a4 printer on your computer.
i would very much like to write the papersizes to the dwg-file, so the scale of the viewport will be correct. plotter margins are of no importance to me.
i used the following code with a previous version of open design.
oddbdatabaseptr pdb;
oddblayoutptr pentry;
oddbobjectid newlayoutid;
newlayoutid = pdb->createlayout("ddt layout");
pentry = newlayoutid.safeopenobject(oddb::kforwrite);
pentry->setlayoutname("abc");
pentry->setplotsettingsname("");
pplotvalidator = pdb->appservices()->plotsettingsvalidator();
pplotvalidator->setplotcfgname (pentry, "printer");
pplotvalidator->setplotviewname (pentry, "");
pplotvalidator->setmediasize (pentry, "custom", 1500/*widh*/, 900 /* height */, (oddbplotsettings:

lotpaperunits) 1, 0, 0,0, 0);
i looked in the code of odplotsettingsvalidatorpeimpl.
i do not know how to integrate odplotsettingsvalidatorpeimpl in my code.
i would be very thankfull if i could get a piece of code, that i can use to replace setmediasize.
could you tell me your printer name (hp laserjet 4000 series pcl)?
btw :
printername
the printername that i prefer is "none" because for me there is no way of knowing what printer was used by the person who made the drawing. the person who will recieve the drawing will surely have other printers.
on my pc, i have several printers available, 2 of them are
a4 printer : hp color laserjet 4550 pcl
44 inch printer : epson stylus pro 9800
the reciever of the drawing might have an oce-printer.
thank you for your fast responce.
hi
i got epson 9800 printer driver and test it with autocad. epson 9800 has user defined paper - see jpg. i have changed paper sizes to biggest values. it is system driver functionality - not autocad. i selected epson 9800 and user defined paper in the page setup and saved drawing. after loading on pc without epson 9800 autocad changes device to none and adds 'previous paper size **** ' to media list for none device. so user knows prev paper sizes and can select another printer with reasonable paper.
mfcapp is not supported 'prev paper size' in page setup dialog yet, i am planning to add this functionality later, but you can send your file with epson 9800 name inside to pc without epson 9800.
attached images (63.5 kb, 19 views)
(15.0 kb, 17 views)
i still got problem with setting paper layout to free size.
i really need function "setmediasize" back. anyone please help me...
setclosestmedianame
hi, i use setmediasize too with dd1_x , now i use setclosestmedianame
( it was a hint from oda )
#ifdef dd_2_x
pvalidator->setclosestmedianame ( playout, ys, xs, oddbplotsettings::kmillimeters, false );
pvalidator->setplotorigin ( playout, xo, yo );
pvalidator->setplotviewname ( playout, plotviewname );
pvalidator->setplotcfgname ( playout, "none_device" );
pvalidator->setstdscale ( playout, m_doccover.m_systemunit );
#else
pvalidator->setmediasize ( playout, papersize, ys, xs, oddbplotsettings::kmillimeters, 7.5, 7.5, 7.5, 7.5);
pvalidator->setplotorigin ( playout, xo, yo );
pvalidator->setplotviewname ( playout, plotviewname );
pvalidator->setplotcfgname ( playout, "none_device" );
pvalidator->setstdscale ( playout, m_doccover.m_systemunit );
#endif
hi,
this is sample code for changing of anything in oddbplotsettings. it uses oddbentget and oddbentmod methods.
code:
oddbblocktablerecordptr playoutblock = m_pdb->getactivelayoutbtrid().safeopenobject();
oddblayoutptr playout = playoutblock->getlayoutid().safeopenobject(oddb::kforwrite);
odresbufptr presb = oddbentget(playout);
odresbufptr pstart = presb;
while(presb.get() && !(presb->restype() == 100 && presb->getstring() == dd_t("acdbplotsettings")))
presb = presb->next();
// skip 100 "acdbplotsettings"
if (presb.get())
presb = presb->next();
while(presb.get())
{
int restype = presb->restype();
switch(restype)
{
case 100:
// stop all
presb = 0;
continue;
case 1: // page setup name
presb->setstring(dd_t(""));
break;
case 2: // name of system printer or plot configuration file
presb->setstring(dd_t("none_device"));
break;
case 4: // paper size
presb->setstring(dd_t("none_user_media"));
break;
case 6: // plot view name
presb->setstring(dd_t(""));
break;
case 40: // size, in millimeters, of
// unprintable margin on the left side of the paper
presb->setdouble(0.);
break;
case 41: // size, in millimeters, of unprintable
// margin on the bottom of the paper
presb->setdouble(0.);
break;
case 42: // size, in millimeters, of unprintable
// margin on the right side of the paper
presb->setdouble(0.);
break;
case 43: // size, in millimeters, of unprintable
// margin on the top of the paper
presb->setdouble(0.);
break;
case 44: // plot paper size: physical paper width in millimeters
presb->setdouble(1000.);
break;
case 45: // plot paper size: physical paper height in millimeters
presb->setdouble(2000.);
break;
case 46: // plot origin: x value of origin offset in millimeters
presb->setdouble(0.);
break;
case 47: // plot origin: y value of origin offset in millimeters
presb->setdouble(0.);
break;
case 48: // plot window area: x value of lower left window corner
presb->setdouble(0.);
break;
case 49: // plot window area: y value of lower left window corner
presb->setdouble(0.);
break;
case 140: // plot window area: x value of upper right window corner
presb->setdouble(0.);
break;
case 141: // plot window area: y value of upper right window corner
presb->setdouble(0.);
break;
case 142: // numerator of custom print scale: real world (paper) units
presb->setdouble(1.);
break;
case 143: // denominator of custom print scale: drawing units
presb->setdouble(1.);
break;
case 70: // plot layout flag:
/* 1 = plotviewportborders
2 = showplotstyles
4 = plotcentered
8 = plothidden
16 = usestandardscale
32 = plotplotstyles
64 = scalelineweights
128 = printlineweights
512 = drawviewportsfirst
1024 = modeltype
2048 = updatepaper
4096 = zoomtopaperonupdate
8192 = initializing
16384 = prevplotinit */
presb->setint16(16);
break;
case 72:
/* plot paper units:
0 = plot in inches
1 = plot in millimeters
2 = plot in pixels */
presb->setint16(1);
break;
case 73:
/* plot rotation:
0 = no rotation
1 = 90 degrees counterclockwise
2 = upside down
3 = 90 degrees clockwise */
presb->setint16(0);
break;
case 74:
/* plot type (portion of paperspace to output to the media):
0 = last screen display
1 = drawing extents
2 = drawing limits
3 = view specified by code 6
4 = window specified by codes 48, 49, 140, and 141
5 = layout information */
presb->setint16(1);
break;
case 7: // current style sheet
presb->setstring(dd_t(""));
break;
case 75:
/* standard scale type:
0 = scaled to fit
1 = 1/128"=1'; 2 = 1/64"=1'; 3 = 1/32"=1'
4 = 1/16"=1'; 5 = 3/32"=1'; 6 = 1/8"=1'
7 = 3/16"=1'; 8 = 1/4"=1'; 9 = 3/8"=1'
10 = 1/2"=1'; 11 = 3/4"=1'; 12 = 1"=1'
13 = 3"=1'; 14 = 6"=1'; 15 = 1'=1'
16= 1:1 ; 17= 1:2; 18 = 1:4; 19 = 1:8; 20 = 1:10; 21= 1:16
22 = 1:20; 23 = 1:30; 24 = 1:40; 25 = 1:50; 26 = 1:100
27 = 2:1; 28 = 4:1; 29 = 8:1; 30 = 10:1; 31 = 100:1 */
presb->setint16(16);
break;
case 76:
/* shadeplot mode: - new to acad2004
0 = as displayed
1 = wireframe
2 = hidden
3 = rendered */
presb->setint16(0);
break;
case 77:
/* shadeplot resolution level: - new to acad2004
0 = draft
1 = preview
2 = normal
3 = presentation
4 = maximum
5 = custom */
presb->setint16(0);
break;
case 78:
/* shadeplot custom dpi: - new to acad2004
valid range: 100 to 32767
only applied when the shadeplot resolution level is set to 5 (custom) */
presb->setint16(100);
break;
case 147: // a floating point scale factor that represents the standard
// scale value specified in code 75
presb->setdouble(1);
break;
case 148: // paper image origin
presb->setdouble(0.);
break;
case 149: // paper image origin
presb->setdouble(0.);
break;
case 333: // shadeplotid
presb->setobjectid(0);
break;
};
presb = presb->next();
}
oddbentmod(playout, pstart);
we've been using this api since dd1.12, are you going to bring it back?
the dd1.12 sdk header file says that setmediasize is
// not very good function
virtual void setmediasize(
so, that should answer the question.
i took the first 3 lines of code from the suggested workaround and pasted it in odvectorizeex sample and it crashes on the 3rd line:
odvectorizeex.cpp: dd2.1, vs2005, using simple drawing test sample or wilhome.dwg
if (!pdb.isnull())
{
oddbblocktablerecordptr playoutblock = pdb->getactivelayoutbtrid().safeopenobject();
oddblayoutptr playout = playoutblock->getlayoutid().safeopenobject(oddb::kforwrite);
odresbufptr presb = oddbentget(playout); // <- crash!
any idea?
thanks,
codey
crash - odbagfiler module should be available.
code:
toolkit_export odresbufptr oddbentget( const oddbobject* pobj )
{
odsmartptr<odbagfilermodule> pmodule = odrxdynamiclinker()->loadapp(dd_t("odbagfiler"));
if(pmodule.isnull())
throw oderror(enointerface);
return pmodule->entget(pobj);
}