2
5
3
初来乍到
// 1) Enable support for the BRep API in StdAfx.h#define _BREP_SUPPORT_ //- Support for the BRep API// 2) Code to retrieve the IsoLines from a surfaceAcad::ErrorStatus es;ads_point pt;ads_name ename;if (RTNORM != acedEntSel(L"Select a Surface", ename, pt)) return;AcDbEntity *pEnt = NULL;AcDbObjectId id;es = acdbGetObjectId(id, ename);es = acdbOpenAcDbEntity(pEnt, id, AcDb::kForWrite);AcDbSurface *pSurface = AcDbSurface::cast(pEnt);if(NULL == pSurface){ acutPrintf(ACRX_T("\nPlease select a surface.")); return;}AcDbNurbSurfaceArray nsArray;es = pSurface->convertToNurbSurface(nsArray);if(es == Acad::eOk){ if(nsArray.length() == 1) { AcDbDatabase *pDb = acdbHostApplicationServices()->workingDatabase(); AcDbBlockTable *pBlockTable = NULL; es = pDb->getBlockTable(pBlockTable, AcDb::kForRead); AcDbBlockTableRecord *pMS = NULL; es = pBlockTable->getAt( ACDB_MODEL_SPACE, pMS, AcDb::kForWrite); AcDbNurbSurface *pNS = NULL; pNS = AcDbNurbSurface::cast(nsArray.at(0)); Adesk::UInt16 uIsoDensity = pSurface->uIsolineDensity(); Adesk::UInt16 vIsoDensity = pSurface->vIsolineDensity(); AcDbBody* pBody = new AcDbBody(); es = pBody->setASMBody(pSurface->getLockedASMBody()); AcBr::ErrorStatus ebs; AcBrBrep* pBrep = new AcBrBrep(); ebs = pBrep->set(*pBody); if(AcBr::eOk == ebs) { AcBrBrepFaceTraverser* pFaceTrav = new AcBrBrepFaceTraverser; ebs = pFaceTrav->setBrep(*pBrep); if(AcBr::eOk == ebs) {