|
CString hatchName;
AcGePoint3d pt;
AcDbObjectId hatchId;
ads_name ent;
if (acedEntSel(_T("\nSelect hatch: "),ent,asDblArray(pt))!=RTNORM) return;
acdbGetObjectId(hatchId, ent);
if (acedGetPoint(NULL,_T("\nNew origin point: "),asDblArray(pt)) != RTNORM) return;
AcDbObjectPointer<AcDbHatch> pHatchPtr(hatchId,AcDb::kForWrite);
if (pHatchPtr.openStatus () == Acad::eOk)
{
acdbUcs2Wcs(asDblArray(pt),asDblArray(pt),false);
hatchName = pHatchPtr->patternName();
AcGeMatrix3d ecsMat;
pHatchPtr->getEcs(ecsMat);
AcGePoint3d org;
AcGeVector3d uAxis,vAxis, normal;
ecsMat.getCoordSystem(org,uAxis,vAxis,normal);
AcGePlane hatchPlane = AcGePlane(org,uAxis,vAxis);
AcGePoint2d originPoint2d = pt.convert2d(hatchPlane);
Acad::ErrorStatus es;
es = pHatchPtr->setOriginPoint(originPoint2d);
es = pHatchPtr->setPattern(AcDbHatch::kPreDefined, hatchName.GetString());
es = pHatchPtr->evaluateHatch();
es = pHatchPtr->draw();
AcGePoint2dArray arSt,arEnd;
es = pHatchPtr->getHatchLinesData(arSt,arEnd);
pHatchPtr->close();
if (es == Acad::eOk && arSt.isEmpty() && arEnd.isEmpty())
acutPrintf(_T("\nFailure in hatch modification."));
} |
|