public override void SolveInstance(IGH_DataAccess DA, out string msg, out GH_RuntimeMessageLevel level) { msg = ""; level = GH_RuntimeMessageLevel.Blank; //var line = new LineCurve(); Brep inSrfc = null; var noIndex = 0; var comment = ""; var rfSrfc = new RFSurface(); var inRFEM = new GH_RFEM(); var rfEdges = new List <RFLine>(); var mod = false; var del = false; var boundList = ""; var geomType = 0; var stiffType = 0; var thickType = 0; var thick = 0.0; var mat = 0; //int intPoints = 4; //int newNo = 0; if (DA.GetData(9, ref inRFEM)) { rfSrfc = new RFSurface((RFSurface)inRFEM.Value); if (DA.GetData(0, ref inSrfc)) { Component_RFSurface.SetGeometry(inSrfc, ref rfSrfc); } if (DA.GetData(6, ref geomType)) { rfSrfc.GeometryType = (SurfaceGeometryType)geomType; if (rfSrfc.GeometryType == SurfaceGeometryType.UnknownGeometryType) { msg = "Surface Geometry Type not supported. "; level = GH_RuntimeMessageLevel.Warning; return; } } if (DA.GetData(2, ref mat)) { rfSrfc.MaterialNo = mat; } if (DA.GetData(3, ref thick)) { rfSrfc.Thickness = thick; } } else if (DA.GetData(0, ref inSrfc)) { if (!(DA.GetData(2, ref mat) && DA.GetData(3, ref thick))) { msg = "Insufficient input parameters. Provide Material Number and Surface thickness. "; level = GH_RuntimeMessageLevel.Warning; return; } if (inSrfc.Edges.Select(x => x.GetLength()).Min() <= 0.001) { level = GH_RuntimeMessageLevel.Warning; msg = "Boundary lines are too short. It may cause import errors."; } else { rfSrfc.MaterialNo = mat; rfSrfc.Thickness = thick; } //DA.GetData(7, ref intPoints); Component_RFSurface.SetGeometry(inSrfc, ref rfSrfc); if (DA.GetData(6, ref geomType)) { rfSrfc.GeometryType = (SurfaceGeometryType)geomType; if (rfSrfc.GeometryType == SurfaceGeometryType.NurbsSurfaceType) { if (inSrfc.Edges.Count != 4) { msg = "Provide a valide NURBS Surface with 4 edge curves. "; level = GH_RuntimeMessageLevel.Warning; return; } Component_RFSurface.SetGeometryNURBS(inSrfc, ref rfSrfc); } if (rfSrfc.GeometryType == SurfaceGeometryType.UnknownGeometryType) { msg = "Surface Geometry Type not supported. "; level = GH_RuntimeMessageLevel.Warning; return; } } } else if (DA.GetData(5, ref boundList)) { rfSrfc.BoundaryLineList = boundList; if (!(DA.GetData(2, ref mat) && DA.GetData(3, ref thick))) { msg = "Insufficient input parameters. Provide Material Number and Surface thickness. "; level = GH_RuntimeMessageLevel.Warning; return; } else { rfSrfc.MaterialNo = mat; rfSrfc.Thickness = thick; } if (DA.GetData(6, ref geomType)) { rfSrfc.GeometryType = (SurfaceGeometryType)geomType; if (rfSrfc.GeometryType == SurfaceGeometryType.UnknownGeometryType || (rfSrfc.GeometryType != SurfaceGeometryType.PlaneSurfaceType && rfSrfc.GeometryType != SurfaceGeometryType.QuadrangleSurfaceType)) { msg = "Surface Geometry Type not supported. "; level = GH_RuntimeMessageLevel.Warning; return; } } //}else //{ // rfSrfc.GeometryType = SurfaceGeometryType.PlaneSurfaceType; //} } else { msg = "Insufficient input parameters. Provide either Input Surface shape, Boundary Lines List or existing RFSurface Object. "; level = GH_RuntimeMessageLevel.Warning; return; } if (DA.GetData(10, ref mod)) { rfSrfc.ToModify = mod; } if (DA.GetData(11, ref del)) { rfSrfc.ToDelete = del; } if (DA.GetData(1, ref noIndex)) { rfSrfc.No = noIndex; } if (DA.GetData(4, ref comment)) { rfSrfc.Comment = comment; } if (DA.GetData(5, ref boundList)) { rfSrfc.BoundaryLineList = boundList; } if (DA.GetData(7, ref thickType)) { rfSrfc.ThicknessType = (SurfaceThicknessType)thickType; if (rfSrfc.ThicknessType == SurfaceThicknessType.UnknownThicknessType) { msg = "Surface Thickness Type not supported. "; level = GH_RuntimeMessageLevel.Warning; return; } } if (DA.GetData(8, ref stiffType)) { rfSrfc.StiffnessType = (SurfaceStiffnessType)stiffType; if (rfSrfc.StiffnessType == SurfaceStiffnessType.UnknownStiffnessType) { msg = "Taper Shape Type not supported. "; level = GH_RuntimeMessageLevel.Warning; return; } } DA.SetData(0, rfSrfc); }
public override void SolveInstance(IGH_DataAccess DA, out string msg, out GH_RuntimeMessageLevel level) { msg = ""; level = GH_RuntimeMessageLevel.Blank; //var line = new LineCurve(); Brep inSrfc = null; var noIndex = 0; var comment = ""; var rfSrfc = new RFSurface(); var inRFEM = new GH_RFEM(); var rfEdges = new List <RFLine>(); var mod = false; var del = false; var boundList = ""; var geomType = 0; var stiffType = 0; var thickType = 0; var thick = 0.0; var mat = 0; var ecc = 0.0; //int intPoints = 4; //int newNo = 0; RFEM.SurfaceAxes axes = new RFEM.SurfaceAxes(); var axesDirType = 0; var axesLines = 0; Point3d pt1 = new Point3d(); Point3d pt2 = new Point3d(); int csNo = 0; var rot = 0.0; if (DA.GetData(13, ref inRFEM)) { rfSrfc = new RFSurface((RFSurface)inRFEM.Value); if (DA.GetData(0, ref inSrfc)) { Component_RFSurface.SetGeometry(inSrfc, ref rfSrfc); } if (DA.GetData(6, ref geomType)) { rfSrfc.GeometryType = (SurfaceGeometryType)geomType; if (rfSrfc.GeometryType == SurfaceGeometryType.UnknownGeometryType) { msg = "Surface Geometry Type not supported. "; level = GH_RuntimeMessageLevel.Warning; return; } } if (DA.GetData(2, ref mat)) { rfSrfc.MaterialNo = mat; } if (DA.GetData(3, ref thick)) { rfSrfc.Thickness = thick; } } else if (DA.GetData(0, ref inSrfc)) { if (!(DA.GetData(2, ref mat) && DA.GetData(3, ref thick))) { msg = "Insufficient input parameters. Provide Material Number and Surface thickness. "; level = GH_RuntimeMessageLevel.Warning; return; } if (inSrfc.Edges.Select(x => x.GetLength()).Min() <= 0.001) { level = GH_RuntimeMessageLevel.Warning; msg = "Boundary lines are too short. It may cause import errors."; } else { rfSrfc.MaterialNo = mat; rfSrfc.Thickness = thick; } Component_RFSurface.SetGeometry(inSrfc, ref rfSrfc); if (DA.GetData(6, ref geomType)) { rfSrfc.GeometryType = (SurfaceGeometryType)geomType; if (rfSrfc.GeometryType == SurfaceGeometryType.NurbsSurfaceType) { if (inSrfc.Edges.Count != 4) { msg = "Provide a valide NURBS Surface with 4 edge curves. "; level = GH_RuntimeMessageLevel.Warning; return; } Component_RFSurface.SetGeometryNURBS(inSrfc, ref rfSrfc); } if (rfSrfc.GeometryType == SurfaceGeometryType.UnknownGeometryType) { msg = "Surface Geometry Type not supported. "; level = GH_RuntimeMessageLevel.Warning; return; } } } else if (DA.GetData(5, ref boundList)) { rfSrfc.BoundaryLineList = boundList; if (!(DA.GetData(2, ref mat) && DA.GetData(3, ref thick))) { msg = "Insufficient input parameters. Provide Material Number and Surface thickness. "; level = GH_RuntimeMessageLevel.Warning; return; } else { rfSrfc.MaterialNo = mat; rfSrfc.Thickness = thick; } if (DA.GetData(6, ref geomType)) { rfSrfc.GeometryType = (SurfaceGeometryType)geomType; if (rfSrfc.GeometryType == SurfaceGeometryType.UnknownGeometryType || (rfSrfc.GeometryType != SurfaceGeometryType.PlaneSurfaceType && rfSrfc.GeometryType != SurfaceGeometryType.QuadrangleSurfaceType)) { msg = "Surface Geometry Type not supported. "; level = GH_RuntimeMessageLevel.Warning; return; } } } else { msg = "Insufficient input parameters. Provide either Input Surface shape, Boundary Lines List or existing RFSurface Object. "; level = GH_RuntimeMessageLevel.Warning; return; } if (DA.GetData(14, ref mod)) { rfSrfc.ToModify = mod; } if (DA.GetData(15, ref del)) { rfSrfc.ToDelete = del; } if (DA.GetData(1, ref noIndex)) { rfSrfc.No = noIndex; } if (DA.GetData(4, ref comment)) { rfSrfc.Comment = comment; } if (DA.GetData(5, ref boundList)) { rfSrfc.BoundaryLineList = boundList; } if (DA.GetData(7, ref thickType)) { rfSrfc.ThicknessType = (SurfaceThicknessType)thickType; if (rfSrfc.ThicknessType == SurfaceThicknessType.UnknownThicknessType) { msg = "Surface Thickness Type not supported. "; level = GH_RuntimeMessageLevel.Warning; return; } } if (DA.GetData(8, ref stiffType)) { rfSrfc.StiffnessType = (SurfaceStiffnessType)stiffType; if (rfSrfc.StiffnessType == SurfaceStiffnessType.UnknownStiffnessType) { msg = "Taper Shape Type not supported. "; level = GH_RuntimeMessageLevel.Warning; return; } } if (DA.GetData(9, ref ecc)) { rfSrfc.Eccentricity = ecc; } if (DA.GetData(10, ref axesDirType)) { axes.SurfaceAxesDirection = (SurfaceAxesDirection)axesDirType; switch (axes.SurfaceAxesDirection) { case SurfaceAxesDirection.UnknownSurfaceAxesDirection: msg = "Axes direction not supported."; level = GH_RuntimeMessageLevel.Warning; return; case SurfaceAxesDirection.StandardSurfaceAxesDirection: break; case SurfaceAxesDirection.IdenticalToAxesForInput: msg = "Axes are always paralell to axes for input."; level = GH_RuntimeMessageLevel.Warning; break; case SurfaceAxesDirection.SurfaceAxesParallelToGlobalCS: msg = "Axes direction not supported."; level = GH_RuntimeMessageLevel.Warning; return; case SurfaceAxesDirection.SurfaceAxesParallelToUserCS: msg = "Axes direction not supported."; level = GH_RuntimeMessageLevel.Warning; return; case SurfaceAxesDirection.SurfaceAngularRotation: if (!(DA.GetData(12, ref rot))) { msg = "Insufficient input parameters. Provide Angular rotation."; level = GH_RuntimeMessageLevel.Warning; return; } axes.Rotation = rot; break; case SurfaceAxesDirection.SurfaceAxisXDirectToPoint: msg = "Axes direction not supported."; level = GH_RuntimeMessageLevel.Warning; return; case SurfaceAxesDirection.SurfaceAxisYDirectToPoint: msg = "Axes direction not supported."; level = GH_RuntimeMessageLevel.Warning; return; case SurfaceAxesDirection.SurfaceAxisXParallelToLine: if (!DA.GetData(11, ref axesLines)) { msg = "Insufficient input parameters. Provide Line."; level = GH_RuntimeMessageLevel.Warning; return; } axes.AxesLineList = axesLines.ToString(); break; case SurfaceAxesDirection.SurfaceAxisYParallelToLine: if (!DA.GetData(11, ref axesLines)) { msg = "Insufficient input parameters. Provide Line."; level = GH_RuntimeMessageLevel.Warning; return; } axes.AxesLineList = axesLines.ToString(); break; } rfSrfc.SurfaceAxes = axes; } else if (DA.GetData(12, ref rot) || DA.GetData(11, ref axesLines)) { msg = "Insufficient input parameters. Provide Axes Direction."; level = GH_RuntimeMessageLevel.Warning; return; } DA.SetData(0, rfSrfc); }