Author Topic: unable to plot in cms  (Read 2281 times)

0 Members and 1 Guest are viewing this topic.

web.pawan

  • Guest
unable to plot in cms
« on: June 15, 2010, 10:32:57 PM »
Hi,

I have a problem with plotting. i want to print the drawing in cms(centimeters), i have two choices
1. i can use standard scale, with unit set in AcDbPlotSettings::kMillimeters and use scale type as AcDbPlotSettings::k10_1, 10mm=1cm
2. i can use custom scale, with unit set in AcDbPlotSettings::kMillimeters or inches and putting proper conversion 1 unit = 10 (for mm) or 1 unit = 2.54(for inches)

I am unable to print a 10 cm line. I feel i am missing to set some more configuration.
I have attached compilable win32 project. Just copy samples\testline_10cms.dwg to c:\temp. The project takes filename as input and converts to filename.pdf

Can somebody help?

Code: [Select]
void CPlotApi2::setPlotConfiguration()
{
Acad::ErrorStatus es;
double xOrigin,yOrigin;
PlotPaperUnits units;

xOrigin = 0.0;
yOrigin = 0.0;

if(requestedPlotType == FIT_TO_PAPER_STANDARD_SCALE)//without scale
{
m_iPlotType = AcDbPlotSettings::kExtents;
m_Landscape=true;
}
else //ACTUAL_SIZE_CUSTOM_SCALE_IN_CMS
{
//part print, full extent, proper scale
m_iPlotType = AcDbPlotSettings::kExtents;
// m_Landscape=true;
}

es = pPSV->setPlotType(pPlotSettings, (PlotType) m_iPlotType);


if(m_Landscape)
es=pPSV->setPlotRotation(pPlotSettings,AcDbPlotSettings::k90degrees);
else
es=pPSV->setPlotRotation(pPlotSettings,AcDbPlotSettings::k0degrees);

es = pPSV->setPlotCentered(pPlotSettings, Adesk::kTrue);

switch(requestedPlotType)
{
case ACTUAL_SIZE_CUSTOM_SCALE_IN_CMS:
//in case don't wanted centered
// es = pPSV->setPlotCentered(pPlotSettings, Adesk::kFalse);
// es = pPSV->setPlotOrigin(pPlotSettings, xOrigin, yOrigin);

//set units
// units = AcDbPlotSettings::kInches;
units = AcDbPlotSettings::kMillimeters;
es = pPSV->setPlotPaperUnits(pPlotSettings,(PlotPaperUnits) units);

//set custome scaled 1unit=10mm(mms), or 1unit=2.54cms(inches)
m_Scale = 10; //2.54;
// es = pPSV->setUseStandardScale(pPlotSettings,Adesk::kFalse);
//use custom scale
// es = pPSV->setCustomPrintScale(pPlotSettings,m_Scale, 1);

//in case use standard scale with k10_1
es = pPSV->setUseStandardScale(pPlotSettings,Adesk::kTrue);
//set scale type
es = pPSV->setStdScaleType(pPlotSettings,AcDbPlotSettings::k10_1);
break;

case FIT_TO_PAPER_STANDARD_SCALE: // Choose to use this custom scale...
default:
es = pPSV->setUseStandardScale(pPlotSettings,Adesk::kTrue);
es = pPSV->setStdScaleType(pPlotSettings,AcDbPlotSettings::kScaleToFit);
break;
}
}