protected override void Process(IFCAnyHandle ifcCurve) { base.Process(ifcCurve); KnotMultiplicities = IFCAnyHandleUtil.GetAggregateIntAttribute <List <int> >(ifcCurve, "KnotMultiplicities"); Knots = IFCAnyHandleUtil.GetAggregateDoubleAttribute <List <double> >(ifcCurve, "Knots"); if (KnotMultiplicities == null || Knots == null) { Importer.TheLog.LogError(ifcCurve.StepId, "Cannot find the KnotMultiplicities or Knots attribute of this IfcBSplineCurveWithKnots", true); } if (KnotMultiplicities.Count != Knots.Count) { Importer.TheLog.LogError(ifcCurve.StepId, "The number of knots and knot multiplicities are not the same", true); } IList <double> revitKnots = IFCGeometryUtil.ConvertIFCKnotsToRevitKnots(KnotMultiplicities, Knots); Curve nurbsSpline = NurbSpline.CreateCurve(Degree, revitKnots, ControlPointsList); SetCurve(nurbsSpline); if (nurbsSpline == null) { Importer.TheLog.LogWarning(ifcCurve.StepId, "Cannot get the curve representation of this IfcCurve", false); } }
private BRepBuilderSurfaceGeometry StartCollectingNURBSFace(IFCBSplineSurfaceWithKnots bSplineSurfaceWithKnots, Transform localTransform) { if (bSplineSurfaceWithKnots == null) { return(null); } IFCRationalBSplineSurfaceWithKnots rationalBSplineSurfaceWithKnots = (bSplineSurfaceWithKnots as IFCRationalBSplineSurfaceWithKnots); IList <double> knotsU = IFCGeometryUtil.ConvertIFCKnotsToRevitKnots(bSplineSurfaceWithKnots.UMultiplicities, bSplineSurfaceWithKnots.UKnots); if (knotsU == null || knotsU.Count == 0) { throw new InvalidOperationException("No knots in u-direction"); } IList <double> knotsV = IFCGeometryUtil.ConvertIFCKnotsToRevitKnots(bSplineSurfaceWithKnots.VMultiplicities, bSplineSurfaceWithKnots.VKnots); if (knotsV == null || knotsV.Count == 0) { throw new InvalidOperationException("No knots in v-direction"); } IList <double> weights = (rationalBSplineSurfaceWithKnots != null) ? rationalBSplineSurfaceWithKnots.WeightsList : null; IList <XYZ> controlPoints = new List <XYZ>(); foreach (XYZ point in bSplineSurfaceWithKnots.ControlPointsList) { controlPoints.Add(localTransform.OfPoint(point)); } int uDegree = bSplineSurfaceWithKnots.UDegree; int vDegree = bSplineSurfaceWithKnots.VDegree; BRepBuilderSurfaceGeometry surfaceGeometry = null; if (weights == null) { surfaceGeometry = BRepBuilderSurfaceGeometry.CreateNURBSSurface(uDegree, vDegree, knotsU, knotsV, controlPoints, false, null); } else { surfaceGeometry = BRepBuilderSurfaceGeometry.CreateNURBSSurface(uDegree, vDegree, knotsU, knotsV, controlPoints, weights, false, null); } return(surfaceGeometry); }