|
新建布局:
AcApLayoutManager *pLmg=(AcApLayoutManager*)acdbHostApplicationServices()->layoutManager();
AcDbObjectId lyId,blkRecId;
sLyName=pLmg->getNextNewLayoutName();
pLmg->createLayout(sLyName,lyId,blkRecId);
//pLmg->setDefaultPlotConfig(blkRecId);
es = acdbOpenObject(blkRec,blkRecId,AcDb::kForWrite);
if (es != Acad::eOk)
return ;
blkRec->appendAcDbEntity(ClipId,pLine);
pLine->setClosed(TRUE);
pLine->close();
新建视口:
AcDbViewport *vp=new AcDbViewport();
blkRec->appendAcDbEntity(pId,vp);
blkRec->close();
vp->setNonRectClipEntityId(ClipId);
vp->setNonRectClipOn();
int vpNum = vp->number();
vp->setTwistAngle(ang);
vp->setViewCenter(ptC2);
vp->setCustomScale(ppScale);
vp->setLocked();
vp->setOn();
vp->close();
pLmg->setCurrentLayoutId(lyId);
pLmg->updateCurrentPaper(Adesk::kTrue);
es = acedSetCurrentVPort(vpNum);
acedCommand(RTSTR, _T("_MSPACE"), 0);
acedCommand(RTSTR,_T("REGEN"),0);
打印设置:
1、获取系统的打印设置验证器
AcDbPlotSettingsValidator* pPSV=acdbHostApplicationServices()->plotSettingsValidator()
2、通过系统布局管理器获取当前活动布局,并基于当前布局信息创建一个打印设置
AcDbLayoutManager *pLayoutManager = acdbHostApplicationServices()->layoutManager();
AcDbObjectId btrId=pLayoutManager->getActiveLayoutBTRId();
AcDbBlockTableRecord *pBTR;
Acad::ErrorStatus es=acdbOpenObject(pBTR,btrId,AcDb::kForRead);
AcDbObjectId layoutId=pBTR->getLayoutId();
AcDbLayout *pLayout=NULL;
acdbOpenObject(pLayout,layoutId,AcDb::kForRead);
AcDbPlotSettings *pPS=new AcDbPlotSettings(pLayout->modelType()==Adesk::kTrue ? true:false);
pPS->copyFrom(pLayout);
pLayout->close();
pBTR->close();
3、通过打印设置验证器pPSV的设置函数设置各种布局参数
4、通过AutoCAD的IAcadPlot接口进行当前布局的打印控制(ARX2005以前版本)。
注意:从ARX2005开始,打印方面的ARX接口已经出现了(打印引擎API),就不需要使用IAcadDocument的IAcadPlot接口了;2000/2000i/2002只能采用上面的这种方式;AutoCAD R14只能采用完全的OLE接口了。 |
|