各位老师好,请问当各个横断面的点数不一样且每一处的横断面数目也不一样时,如何将它们创建成Mesh?
今天抽空仔细研究了一下,这个问题和您的另外一个等高线创建Mesh的问题都属于同一个问题,可以用如下代码实现。
void meshFromLoft(WCharCP) { IFacetOptionsPtr pOptions = IFacetOptions::Create(); pOptions->SetEdgeHiding(false); pOptions->SetMaxPerFace(3); //Only apply to type 18/19 elements pOptions->SetCurvedSurfaceMaxPerFace(3); //Important for smartsolid pOptions->SetAngleTolerance(0.1); IPolyfaceConstructionPtr pPolyCon = IPolyfaceConstruction::Create(*pOptions); const int num = 8; ElementId ids[num] = { 1222101L, 1222102L, 1222103L, 1222104L, 1222105L, 1222106L, 1222107L, 1222108L }; bvector<CurveVectorPtr> contours; for (int i = 0; i < num; i++) { ElementHandle eh(ids[i], ACTIVEMODEL); CurveVectorPtr pCV = ICurvePathQuery::ElementToCurveVector(eh); contours.push_back(pCV); } pPolyCon->AddRuledBetweenCorrespondingCurves(contours, true); PolyfaceHeaderPtr pPolyHeader = pPolyCon->GetClientMeshPtr(); EditElementHandle eeh; if (SUCCESS == DraftingElementSchema::ToElement(eeh, *pPolyHeader, nullptr, *ACTIVEMODEL)) { eeh.AddToModel(); } }
测试结果如下: