internal static StepBSplineCurveWithKnots CreateFromSyntaxList(StepBinder binder, StepSyntaxList syntaxList) { syntaxList.AssertListCount(9); var controlPointsList = syntaxList.Values[2].GetValueList(); var spline = new StepBSplineCurveWithKnots(string.Empty, new StepCartesianPoint[controlPointsList.Values.Count]); spline.Name = syntaxList.Values[0].GetStringValue(); spline.Degree = syntaxList.Values[1].GetIntegerValue(); for (int i = 0; i < controlPointsList.Values.Count; i++) { var j = i; // capture to avoid rebinding binder.BindValue(controlPointsList.Values[j], v => spline.ControlPointsList[j] = v.AsType <StepCartesianPoint>()); } spline.CurveForm = ParseCurveForm(syntaxList.Values[3].GetEnumerationValue()); spline.ClosedCurve = syntaxList.Values[4].GetBooleanValue(); spline.SelfIntersect = syntaxList.Values[5].GetBooleanValue(); var knotMultiplicitiesList = syntaxList.Values[6].GetValueList(); spline.KnotMultiplicities.Clear(); for (int i = 0; i < knotMultiplicitiesList.Values.Count; i++) { spline.KnotMultiplicities.Add(knotMultiplicitiesList.Values[i].GetIntegerValue()); } var knotslist = syntaxList.Values[7].GetValueList(); spline.Knots.Clear(); for (int i = 0; i < knotslist.Values.Count; i++) { spline.Knots.Add(knotslist.Values[i].GetRealVavlue()); } spline.KnotSpec = ParseKnotSpec(syntaxList.Values[8].GetEnumerationValue()); return(spline); }
internal static StepRepresentationItem FromTypedParameter(StepBinder binder, StepItemSyntax itemSyntax) { StepRepresentationItem item = null; if (itemSyntax is StepSimpleItemSyntax) { var simpleItem = (StepSimpleItemSyntax)itemSyntax; switch (simpleItem.Keyword) { case StepItemTypeExtensions.AdvancedFaceText: item = StepAdvancedFace.CreateFromSyntaxList(binder, simpleItem.Parameters); break; case StepItemTypeExtensions.Axis2Placement2DText: item = StepAxis2Placement2D.CreateFromSyntaxList(binder, simpleItem.Parameters); break; case StepItemTypeExtensions.Axis2Placement3DText: item = StepAxis2Placement3D.CreateFromSyntaxList(binder, simpleItem.Parameters); break; case StepItemTypeExtensions.BSplineCurveWithKnotsText: item = StepBSplineCurveWithKnots.CreateFromSyntaxList(binder, simpleItem.Parameters); break; case StepItemTypeExtensions.CartesianPointText: item = StepCartesianPoint.CreateFromSyntaxList(simpleItem.Parameters); break; case StepItemTypeExtensions.CircleText: item = StepCircle.CreateFromSyntaxList(binder, simpleItem.Parameters); break; case StepItemTypeExtensions.CylindricalSurfaceText: item = StepCylindricalSurface.CreateFromSyntaxList(binder, simpleItem.Parameters); break; case StepItemTypeExtensions.DirectionText: item = StepDirection.CreateFromSyntaxList(simpleItem.Parameters); break; case StepItemTypeExtensions.EdgeCurveText: item = StepEdgeCurve.CreateFromSyntaxList(binder, simpleItem.Parameters); break; case StepItemTypeExtensions.EdgeLoopText: item = StepEdgeLoop.CreateFromSyntaxList(binder, simpleItem.Parameters); break; case StepItemTypeExtensions.EllipseText: item = StepEllipse.CreateFromSyntaxList(binder, simpleItem.Parameters); break; case StepItemTypeExtensions.FaceBoundText: item = StepFaceBound.CreateFromSyntaxList(binder, simpleItem.Parameters); break; case StepItemTypeExtensions.FaceOuterBoundText: item = StepFaceOuterBound.CreateFromSyntaxList(binder, simpleItem.Parameters); break; case StepItemTypeExtensions.LineText: item = StepLine.CreateFromSyntaxList(binder, simpleItem.Parameters); break; case StepItemTypeExtensions.OrientedEdgeText: item = StepOrientedEdge.CreateFromSyntaxList(binder, simpleItem.Parameters); break; case StepItemTypeExtensions.PlaneText: item = StepPlane.CreateFromSyntaxList(binder, simpleItem.Parameters); break; case StepItemTypeExtensions.VectorText: item = StepVector.CreateFromSyntaxList(binder, simpleItem.Parameters); break; case StepItemTypeExtensions.VertexPointText: item = StepVertexPoint.CreateFromSyntaxList(binder, simpleItem.Parameters); break; default: if (UnsupportedItemTypes.Add(simpleItem.Keyword)) { Debug.WriteLine($"Unsupported item {simpleItem.Keyword} at {simpleItem.Line}, {simpleItem.Column}"); } break; } } else { // TODO: } return(item); }