- UID
- 675095
- 积分
- 59
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2013-4-16
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2014-4-1 18:50:19
|
显示全部楼层
R18以下没有AcWipeoutObj17.lib AcWipeoutObj16.lib库文件,现已解决,以下代码在2004~2013编译测试成功! - //创建WipeOut对象
- #if (ADS > 17)
- Acad::ErrorStatus CCreateEnt::CreateWipeout (AcDbObjectId &wipeoutId,AcGePoint2dArray point2ds)
- {
- Acad::ErrorStatus es;
- #if (ADS>18)
- if (RTNORM != acedArxLoad(_T("acismui.arx"))) return Acad::eNotImplementedYet;
- #else
- if (RTNORM != acedArxLoad(_T("acwipeout.arx"))) return Acad::eNotImplementedYet;
- #endif
-
- es = AcDbWipeout::createImageDefinition();
- if (es != Acad::eOk)
- {
- return es;
- }
- if (!point2ds.at(0).isEqualTo(point2ds.last()))
- {
- point2ds.append(point2ds.at(0));
- }
- AcDbWipeout *pWipeout = new AcDbWipeout;
- if(pWipeout == NULL) return Acad::eNotImplementedYet;
- pWipeout->setDatabaseDefaults();
- AcGePoint3d originPnt(AcGePoint3d::kOrigin);
- AcGeVector3d Udirection(1,0,0);
- AcGeVector3d Vdirection(0,-1,0);
- pWipeout->setOrientation(originPnt,Udirection, Vdirection);
- pWipeout->setDisplayOpt(AcDbRasterImage::kTransparent,Adesk::kTrue);
- pWipeout->setDisplayOpt( AcDbRasterImage::kShow, true);
- es = pWipeout->setClipBoundaryToWholeImage();
- AcGePoint2d pt2d;
- double scale;
- es = pWipeout->fitPointsToImage(point2ds,pt2d,scale,0);
- AcDbObjectId id;
- pWipeout->append(id);
- wipeoutId = pWipeout->objectId();
- pWipeout->close();
- return Acad::eOk;
- }
- Acad::ErrorStatus CCreateEnt::CreateWipeout (AcDbObjectId &wipeoutId,AcGePoint3dArray point3ds)
- {
-
- AcGePoint2dArray point2ds = CCalculation::Pt3dTo2d(point3ds);
- return CreateWipeout(wipeoutId,point2ds);
- }
- #else
- Acad::ErrorStatus CCreateEnt::CreateWipeout (AcDbObjectId &wipeoutId,AcGePoint3dArray point3ds)
- {
- if (!point3ds.at(0).isEqualTo(point3ds.last()))
- {
- point3ds.append(point3ds.at(0));
- }
- if (RTNORM != acedArxLoad(_T("acwipeout.arx"))) return Acad::eNotImplementedYet;
- AcRxClass* pClass = AcRxClass::cast(acrxClassDictionary->at(_T("AcDbWipeout")));
- AcDbEntity *pWipeOut=(AcDbEntity *)pClass->create();
- AcDbRasterImage *pImage=AcDbRasterImage::cast(pWipeOut);
- // AcDbRasterImage::ClipBoundaryType cbType;
- AcGePoint3dArray exts = CCalculation::getExtentsBox(point3ds);
- //AcGePoint3d originPnt(AcGePoint3d::kOrigin);
- // AcGePoint3d originPnt(CCalculation::MiddlePoint(exts[0],exts[1]) );
- AcGePoint3d originPnt(exts[0]);
- double w = max(exts[1].x-exts[0].x,exts[1].y-exts[0].y);
- AcGeVector3d Udirection(w,0,0);
- AcGeVector3d Vdirection(0,w,0);
- pImage->setOrientation(originPnt,Udirection, Vdirection);
- AcGeMatrix3d PixelToModel,ModelToPixel;
- pImage->getPixelToModelTransform(PixelToModel);
- ModelToPixel=PixelToModel.invert();
- for(int i=0;i< point3ds.length();i++)
- {
- point3ds.transformBy(ModelToPixel);
- }
- AcGePoint2dArray point2ds = CCalculation::Pt3dTo2d(point3ds);
- // ...设置参数
- pImage->setDisplayOpt(AcDbRasterImage::kTransparent,Adesk::kTrue);
- pImage->setDisplayOpt( AcDbRasterImage::kShow, true);
- pImage->setClipBoundaryToWholeImage();
- pImage->setClipBoundary(AcDbRasterImage::kPoly,point2ds);
- pWipeOut=(AcDbEntity *)pImage;
- return CCreateEnt::PostToSpace(wipeoutId,pWipeOut);
- }
- Acad::ErrorStatus CCreateEnt::CreateWipeout (AcDbObjectId &wipeoutId,AcGePoint2dArray point2ds)
- {
- return CreateWipeout (wipeoutId,CCalculation::Pt2dTo3d(point2ds));
- }
- #endif
|
|