MSBsplineCurve SectionCurve1 = GetMSBsplineCurveFromElement(ElementAgenda.GetEntry(0)); // start profile section curve MSBsplineCurve SectionCurve2 = GetMSBsplineCurveFromElement(ElementAgenda.GetEntry(1)); // end profile section curve MSBsplineCurve PathCurve1 = GetMSBsplineCurveFromElement(ElementAgenda.GetEntry(2)); // path 1 MSBsplineCurve PathCurve2 = GetMSBsplineCurveFromElement(ElementAgenda.GetEntry(3)); // path 2 BCIMNETGMesh.SurfaceTraceSweepParam param; param.scale = 0; param.scaleHeight = 0; param.firstConstraint = 0; param.lastConstraint = 0; param.alignment = 1; //0 normal 1 parallel param.selfRepair = 1; param.unused = 0; List<MSBsplineCurve> sectionCurves = new List<MSBsplineCurve>(); List<MSBsplineCurve> pathCurves = new List<MSBsplineCurve>(); sectionCurves.Add(SectionCurve1); sectionCurves.Add(SectionCurve2); pathCurves.Add(PathCurve1); pathCurves.Add(PathCurve2); int mode = 2; // Sweep mode 0: 2Profile+1Path 1: 1Profile+2Path 2: 2Profile+2Path MSBsplineSurface bsurface = null; if (!BCIMNETGMesh.MeshSDKNET.CreateSurfaceBySweepAlongPath(ref bsurface, sectionCurves, pathCurves, mode, param, model) ) { return StatusInt.Error; } AddSurfaceToModel(bsurface); return StatusInt.Success;
问题在于这个
MSBsplineCurve SectionCurve1 = GetMSBsplineCurveFromElement(ElementAgenda.GetEntry(0)); // start profile section curve
因为例子里面是获取BSpline的曲线的,但您给我发的截面是一个shape,所以获取的是空值,我将您模型的shape转成BSPline后就可以了:
您可以稍微修改一下代码,可以支持shape的选取,然后再测试一下。