- UID
- 610333
- 积分
- 6
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2008-3-30
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
我创建wipeout的代码如下:
static AcDbObjectId PostToModelSpace(AcDbEntity *pEnt)
{
AcDbBlockTable *pBlockTable;
acdbHostApplicationServices()->workingDatabase()->getBlockTable(pBlockTable,AcDb::kForRead);
AcDbBlockTableRecord *pBlockTableRecord;
pBlockTable->getAt(ACDB_MODEL_SPACE,pBlockTableRecord,AcDb::kForWrite);
AcDbObjectId entId;
Acad::ErrorStatus es=pBlockTableRecord->appendAcDbEntity(entId,pEnt);
pBlockTable->close();
pBlockTableRecord->close();
pEnt->close();
return entId;
}
static void trans3DTo2D(AcGePoint3dArray& arr3d, AcGePoint2dArray& arr2d)
{
for(int i = 0; i < arr3d.length(); i++)
{
AcGePoint3d pt3d = arr3d.at(i);
AcGePoint2d pt2d(pt3d.x, pt3d.y);
arr2d.append(pt2d);
}
}
static void wptest()
{
AcGePoint3d pt1;
AcGePoint3dArray cbPtAry;
pt1[0] = 300; pt1[1] = 300; pt1[2] = 0;
cbPtAry.append(pt1);
pt1[0] = 700; pt1[1] = 300; pt1[2] = 0;
cbPtAry.append(pt1);
pt1[0] = 700; pt1[1] = 100; pt1[2] = 0;
cbPtAry.append(pt1);
pt1[0] = 300; pt1[1] = 100; pt1[2] = 0;
cbPtAry.append(pt1);
pt1[0] = 300;pt1[1] = 300;pt1[2] = 0;
cbPtAry.append(pt1);
// TODO: Implement the command
AcRxClass* pClass = AcRxClass::cast(acrxClassDictionary->at(L"AcDbWipeout"));
AcDbEntity *pWipeOut=(AcDbEntity *)pClass->create();
AcDbRasterImage *pImage = AcDbRasterImage::cast(pWipeOut);
// Set clip boundary
AcGePoint3d origin;
//AcGeVector3d u;
//AcGeVector3d v;
AcGeVector3d u(400,0,0);
AcGeVector3d v(0,400,0);
pImage->getOrientation(origin, u, v);
pImage->setOrientation(origin, u, v);
pImage->setClipBoundaryToWholeImage();
AcGeMatrix3d PixelToModel,ModelToPixel;
pImage->getPixelToModelTransform(PixelToModel);
ModelToPixel=PixelToModel.invert();
for(int i=0;i< cbPtAry.length();i++)
{
cbPtAry.transformBy(ModelToPixel);
}
AcGePoint2dArray poly2d;
//XdGeUtils::trans3DTo2D(&cbPtAry,poly2d);
trans3DTo2D(cbPtAry,poly2d);
pImage->setClipBoundary(AcDbRasterImage::kPoly,poly2d);
pImage->setDisplayOpt(AcDbRasterImage::kTransparent,Adesk::kTrue);
pImage->setDisplayOpt(AcDbRasterImage::kShow,Adesk::kFalse );
pWipeOut=(AcDbEntity *)pImage;
//if(PostToModelSpace(pImage)==Acad::eOk)
//if(appendToModelSpace(pWipeOut)==Acad::eOk)
PostToModelSpace(pImage);
pImage->close();
//pWipeOut->close();
acutPrintf(L"\nYes,append");
}
// - GJwipeout._WO command (do not rename)
static void GJwipeout_WO(void)
{
// Add your code for command GJwipeout._WO here
wptest();
}
我知道用cad的wipeout+F命令可以关闭边框,但我想通过程序实现,请各位大虾不吝赐教! |
|