//删除,Id public static int DeleteStdHullShellByName(int Id) { using (HullShellContainer hs = new HullShellContainer()) { StdHullShell shs = hs.StdHullShellSet.Where(s => s.PlateModel == _name).FirstOrDefault(); //删除包围盒 BoundingBox boundbox = shs.BoundingBox; hs.DeleteObject(boundbox); //删除理论点 TheoryPoints tps = shs.TheoryPoints; List <Point> tpsList = tps.Point.ToList(); for (int i = 0; i < tpsList.Count; i++) { hs.DeleteObject(tpsList[i]); } hs.DeleteObject(tps); //删除肋位线点 RiblinePoints rps = shs.RiblinePoints; List <Point> rpList = rps.Point.ToList(); for (int i = 0; i < rpList.Count; i++) { hs.DeleteObject(rpList[i]); } hs.DeleteObject(rps); //删除余量点 ExcessPoints eeps = shs.ExcessPoints; List <Point> eepList = eeps.Point.ToList(); for (int i = 0; i < eepList.Count; i++) { hs.DeleteObject(eepList[i]); } hs.DeleteObject(eeps); //删除边角点 EdgeEdgePoints exps = shs.EdgeEdgePoints; List <Point> expList = exps.Point.ToList(); for (int i = 0; i < expList.Count; i++) { hs.DeleteObject(expList[i]); } hs.DeleteObject(exps); hs.DeleteObject(shs); return(hs.SaveChanges()); } }
//增加 public static int AddStdHullShell(StdHullShellCls StdShell) { using (HullShellContainer hs = new HullShellContainer()) { //包围盒 BoundingBox boundbox = new BoundingBox { x_Dir = StdShell.Dir.x, y_Dir = StdShell.Dir.y, z_Dir = StdShell.Dir.z, x_Min = StdShell.Pt_Min.x, y_Min = StdShell.Pt_Min.y, z_Min = StdShell.Pt_Min.z, x_Max = StdShell.Pt_Max.x, y_Max = StdShell.Pt_Max.y, z_Max = StdShell.Pt_Max.z, }; //理论点 TheoryPoints tps = new TheoryPoints { RowNumber = StdShell.tpc.RowNumberow, ColumnNumber = StdShell.tpc.ColnumNumber }; for (int i = 0; i < StdShell.tpc.PointsCloudList.Count; i++) { Point pt = new Point { X = StdShell.tpc.PointsCloudList[i].x, Y = StdShell.tpc.PointsCloudList[i].y, Z = StdShell.tpc.PointsCloudList[i].z, }; tps.Point.Add(pt); } //增加肋位线点 RiblinePoints rps = new RiblinePoints(); for (int i = 0; i < StdShell.tpc.RiblinePointsList.Count; i++) { Point pt = new Point { X = StdShell.tpc.RiblinePointsList[i].x, Y = StdShell.tpc.RiblinePointsList[i].y, Z = StdShell.tpc.RiblinePointsList[i].z, }; rps.Point.Add(pt); } //增加边缘点 EdgeEdgePoints eeps = new EdgeEdgePoints(); for (int i = 0; i < StdShell.tpc.EdgeEdgePointsList.Count; i++) { Point pt = new Point { X = StdShell.tpc.EdgeEdgePointsList[i].x, Y = StdShell.tpc.EdgeEdgePointsList[i].y, Z = StdShell.tpc.EdgeEdgePointsList[i].z, }; eeps.Point.Add(pt); } //增加余量点 ExcessPoints expts = new ExcessPoints(); for (int i = 0; i < StdShell.tpc.ExcessPointsList.Count; i++) { Point pt = new Point { X = StdShell.tpc.ExcessPointsList[i].x, Y = StdShell.tpc.ExcessPointsList[i].y, Z = StdShell.tpc.ExcessPointsList[i].z, }; expts.Point.Add(pt); } //添加 StdHullShell shs = new StdHullShell { PlateModel = StdShell.PlateModel, Thickness = StdShell.Thickness, Width1 = StdShell.Width1, Length1 = StdShell.Length1, TransverseCurvate = StdShell.TransverseCurvate, RiblineAmount = StdShell.RiblineCount, LongitudinalCurvature = StdShell.LongitudinalCurvature, CurvePlateKind = StdShell.CurvePlateKind, Width2 = StdShell.Width2, Length2 = StdShell.Length2, ShipName = StdShell.ShipName, TheoryPoints = tps, RiblinePoints = rps, EdgeEdgePoints = eeps, ExcessPoints = expts, BoundingBox = boundbox }; hs.AddToStdHullShellSet(shs); return(hs.SaveChanges()); } }