DisplayPlotPreview problems, ARX

DisplayPlotPreview problems, ARX

Anonymous
Not applicable
330 Views
1 Reply
Message 1 of 2

DisplayPlotPreview problems, ARX

Anonymous
Not applicable
Hi, I've successfully written a function using COM in an ARX to print the current .dwg file to the printer, but I also want to implement a Print Preview.

The problem is that I can not get DisplayPlotPreview to work because by default there is no plotter defined for my drawings. I need to know how to set the default or current plotter so that DisplayPlotPreview will run successfully.

Any help would be greatly appreciated!
0 Likes
331 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
This is a routine I am using. It does not display a plot preview, but it will get you to setting your plotter: #include "dbplotsetval.h" Acad::ErrorStatus errStat = Acad::eOk; AcDbPlotSettingsValidator* pltVal = acdbHostApplicationServices()->plotSettingsValidator(); AcDbObjectId actSpaceId = acdbHostApplicationServices()-> layoutManager()->getActiveLayoutBTRId(); ///////////////////////////////////////////////////////////////////// AcDbBlockTableRecord* pRecord; errStat = acdbOpenObject(pRecord, actSpaceId, AcDb::kForRead); if(errStat != Acad::eOk) { acutPrintf("\nError -- > Could not open table record!"); } AcDbObjectId layoutId = pRecord->getLayoutId(); pRecord->close(); ///////////////////////////////////////////////////////////////////// AcDbLayout* pLayout; errStat = acdbOpenObject(pLayout, layoutId, AcDb::kForWrite); if(errStat != Acad::eOk) { acutPrintf("\nError -- > Could not open layout!"); } pltVal->refreshLists(pLayout); const char* printerName= "PLOT_CONFIG_NAME_HERE"; errStat = pltVal->setPlotCfgName(pLayout, printerName); if(errStat != Acad::eOk) { acutPrintf("\nError -- > Could not 'setPlotCfgName': %s", printerName); pLayout->close(); return; } pLayout->close(); I haven't tested this but you could try: IAcadApplication IApp; IAcadDocument IDoc; IAcadPlot IPlot; IAcadLayout ILayout; IDispatch *pDisp = acedGetAcadWinApp()->GetIDispatch(TRUE); IApp.AttachDispatch(pDisp); pDisp = IApp.GetActiveDocument(); IDoc.AttachDispatch(pDisp); pDisp = IDoc.GetPlot(); IPlot.AttachDispatch(pDisp); pDisp = IDoc.GetActiveLayout(); ILayout.AttachDispatch(pDisp); ILayout.SetConfigName(printerName); "kebray" wrote in message news:[email protected]... > Hi, I've successfully written a function using COM in an ARX to print the current .dwg file to the printer, but I also want to implement a Print Preview. > > The problem is that I can not get DisplayPlotPreview to work because by default there is no plotter defined for my drawings. I need to know how to set the default or current plotter so that DisplayPlotPreview will run successfully. > > Any help would be greatly appreciated!
0 Likes