- bool GetDashedBox( AcDbLayout* pLayout,AcGePoint2d &MinPt,AcGePoint2d &MaxPt )
- {
- if (pLayout==nullptr)
- {
- return false;
- }
- ads_name EntName;
- Acad::ErrorStatus es=acdbGetAdsName (EntName,pLayout->objectId());
- if (es!=Acad::eOk)
- {
- return false;
- }
- struct resbuf *rbENT_root,*rbtmp;
- rbENT_root=acdbEntGet(EntName);//获取对象链表
- if (rbENT_root==nullptr)
- {
- return false;
- }
- rbtmp=rbENT_root;
- while (rbtmp!=nullptr)
- {
- if (rbtmp->restype==148)
- {
- MinPt.x=-rbtmp->resval.rreal;
- }
- if (rbtmp->restype==149)
- {
- MinPt.y=-rbtmp->resval.rreal;
- }
- rbtmp=rbtmp->rbnext;
- }
- acutRelRb(rbENT_root);
- double Width=0,Heigth=0;//虚线框框的大小
- pLayout->getPlotPaperSize(Width,Heigth); //纸张定义的大小,包含不可打印区域
- //去除不可打印区域。
- double printableXmin,printableYmin,printableXmax,printableYmax;
- pLayout->getPlotPaperMargins(printableXmin,printableYmin,printableXmax,printableYmax);
- Width =Width-printableXmin-printableXmax;
- Heigth=Heigth-printableYmin-printableYmax;
- //现在才是那个虚线框框的大小
- AcDbPlotSettings::PlotRotation RoAngtype=pLayout->plotRotation();//这个是相对与纸张定义来说的,纸张定义的如果是长乘以短,那么0度就是和定义的一样,90度就是逆时针旋转90
- if (RoAngtype==AcDbPlotSettings::k90degrees||RoAngtype==AcDbPlotSettings::k270degrees)
- {
- double temp=Width;
- Width=Heigth;
- Heigth=temp;
- }
- MaxPt.x=MinPt.x+Width;
- MaxPt.y=MinPt.y+Heigth;
- return true;
- }
|