コード例 #1
0
        private List<SectionElement> GetSectionElementsVisibleInSketch(Section section, Plane minPlane, Plane maxPlane, List<SteelThicknessGaugingPoint> steelThicknessGaugingPoints, Vector3D normal)
        {
            try
            {
                SortedList<int, Plate> targetPlates = new SortedList<int, Plate>();
                foreach (SteelThicknessGaugingPoint steelThicknessGaugingPoint in steelThicknessGaugingPoints)
                {
                    Plate targetPlate = steelThicknessGaugingPoint.TargetElement as Plate;
                    if (targetPlate == null || targetPlates.ContainsKey(targetPlate.ID))
                    {
                        continue;
                    }

                    targetPlates.Add(targetPlate.ID, targetPlate);
                }

                List<SectionElement> sectionElements = new List<SectionElement>();

                SectionElementsSet sectionElementsSet = section.GetPermanentSectionElementsSet("Plate");
                foreach (Plate plate in sectionElementsSet.Elements.Values)
                {
                    Point3D point = plate.Design.Geometry.Primitive(0).Centroid;

                    Vector3D plateNormal = plate.Design.Geometry.Primitive(0).Normal;
                    plateNormal.Normalize();

                    double angle = Vector3D.Angle(plateNormal, normal);

                    if ((minPlane.Signal(point) == 1 && maxPlane.Signal(point) == -1 && angle < 1.0) || targetPlates.ContainsKey(plate.ID))
                    {
                        sectionElements.Add(plate);
                    }
                }

                return sectionElements;
            }
            catch (Exception ex)
            {
                throw new ApplicationException("Section elements visible in skectch cannot be get!", ex);
            }
        }
コード例 #2
0
        private List<SectionElement> GetSectionElementsVisibleInSketch(Section section, Plane minPlane, Plane maxPlane)
        {
            try
            {
                List<SectionElement> sectionElements = new List<SectionElement>();

                SectionElementsSet sectionElementsSet = section.GetPermanentSectionElementsSet("Plate");
                foreach (Plate plate in sectionElementsSet.Elements.Values)
                {
                    Point3D point = plate.Design.Geometry.Primitive(0).Centroid;
                    if (minPlane.Signal(point) == 1 && maxPlane.Signal(point) == -1)
                    {
                        sectionElements.Add(plate);
                    }
                }

                return sectionElements;
            }
            catch (Exception ex)
            {
                throw new ApplicationException("Section elements visible in skectch cannot be get!", ex);
            }
        }
コード例 #3
0
        private List<SectionElement> GetSectionElementsVisibleInSketch(Section section, List<SteelThicknessGaugingPoint> steelThicknessGaugingPoints)
        {
            try
            {
                Vector3D planeNormal = section.Normal * section.Up;
                List<SectionElement> sectionElements = new List<SectionElement>();

                if (section.SectionType.Name.Equals("WebFrames") ||
                    section.SectionType.Name.Equals("TransverseBulkheads") ||
                    section.SectionType.Name.Equals("TransverseCentralBulkheads") ||
                    section.SectionType.Name.Equals("SwashBulkheads"))
                {
                    BoundingBox boundingBox = section.GetBoundingBoxOfElementType("Plate");
                    Plane plane = new Plane(planeNormal, boundingBox.Center);

                    int pointsSignal = plane.Signal(steelThicknessGaugingPoints[0].PointGeometry.Position);
                    pointsSignal = (pointsSignal == 1) ? pointsSignal : -1; // Avoid zero signal

                    SectionElementsSet sectionElementsSet = section.GetPermanentSectionElementsSet("Plate");
                    foreach (Plate plate in sectionElementsSet.Elements.Values)
                    {
                        int plateSignal = plane.Signal(plate.Design.Geometry.Primitive(0).Centroid);

                        if (plateSignal == pointsSignal)
                        {
                            sectionElements.Add(plate);
                        }
                    }
                }
                //else if (section.SectionType.Name.Equals("MainDeck") ||
                //             section.SectionType.Name.Equals("OtherDecks") ||
                //             section.SectionType.Name.Equals("InnerBottom") ||
                //             section.SectionType.Name.Equals("Bottom")
                //            )
                //{
                //}
                //else if (section.SectionType.Name.Equals("Shell") ||
                //             section.SectionType.Name.Equals("Longitudinal") ||
                //             section.SectionType.Name.Equals("LongitudinalBulkheads") ||
                //             section.SectionType.Name.Equals("LongitudinalCentralBulkheads")
                //            )
                //{
                //}
                //else if (section.SectionType.Name.Equals("AnyOtherSection"))
                else
                {
                    float xMin = float.MaxValue, xMax = float.MinValue;
                    float yMin = float.MaxValue, yMax = float.MinValue;
                    float zMin = float.MaxValue, zMax = float.MinValue;

                    float increase = 0;
                    BoundingBox sectionBoundingBox = section.GetBoundingBoxOfElementType("Plate");

                    char[] sortAxisLabels = sectionBoundingBox.GetSizeOrderedAxisLabels();
                    if (sortAxisLabels[0] == 'X')
                    {
                        increase = sectionBoundingBox.Width / 10;
                    }
                    else if (sortAxisLabels[0] == 'Y')
                    {
                        increase = sectionBoundingBox.Height / 10;
                    }
                    else if (sortAxisLabels[0] == 'Z')
                    {
                        increase = sectionBoundingBox.Depth / 10;
                    }

                    foreach (SteelThicknessGaugingPoint steelThicknessGaugingPoint in steelThicknessGaugingPoints)
                    {
                        Point3D point = steelThicknessGaugingPoint.PointGeometry.Position;

                        xMin = ((point.X - increase) < xMin) ? (point.X - increase) : xMin;
                        xMax = ((point.X + increase) > xMax) ? (point.X + increase) : xMax;

                        yMin = ((point.Y - increase) < yMin) ? (point.Y - increase) : yMin;
                        yMax = ((point.Y + increase) > yMax) ? (point.Y + increase) : yMax;

                        zMin = ((point.Z - increase) < zMin) ? (point.Z - increase) : zMin;
                        zMax = ((point.Z + increase) > zMax) ? (point.Z + increase) : zMax;
                    }

                    Point3D minPoint = new Point3D(xMin, yMin, zMin);
                    Point3D maxPoint = new Point3D(xMax, yMax, zMax);

                    Plane minPlane = new Plane(planeNormal, minPoint);
                    Plane maxPlane = new Plane(planeNormal, maxPoint);

                    return this.GetSectionElementsVisibleInSketch(section, minPlane, maxPlane);

                    //SectionElementsSet sectionElementsSet = section.GetSectionElementsSet("Plate");
                    //foreach (Plate plate in sectionElementsSet.Elements.Values)
                    //{
                    //    Point3D point = plate.Design.Geometry.Primitive(0).Centroid;
                    //    if (minPlane.Signal(point) == 1 && maxPlane.Signal(point) == -1)
                    //    {
                    //        sectionElements.Add(plate);
                    //    }
                    //}
                }

                return sectionElements;
            }
            catch (Exception ex)
            {
                throw new ApplicationException("Section elements visible in skectch cannot be get!", ex);
            }
        }
コード例 #4
0
        private List<SectionElement> GetSectionElementsVisibleInSketch(Section section, Compartment compartment)
        {
            try
            {
                List<SectionElement> sectionElements = new List<SectionElement>();

                Vector3D xAxis = new Vector3D(1, 0, 0);
                Plane minPlane = new Plane(xAxis, compartment.BoundingBox.MinPoint);
                Plane maxPlane = new Plane(xAxis, compartment.BoundingBox.MaxPoint);

                SectionElementsSet sectionElementsSet = section.GetPermanentSectionElementsSet("Plate");
                foreach (Plate plate in sectionElementsSet.Elements.Values)
                {
                    Point3D point = plate.Design.Geometry.Primitive(0).Centroid;
                    if (minPlane.Signal(point) == 1 && maxPlane.Signal(point) == -1)
                    {
                        sectionElements.Add(plate);
                    }
                }

                return sectionElements;
            }
            catch (Exception ex)
            {
                throw new ApplicationException("Section elements visible in skectch cannot be get!", ex);
            }
        }
コード例 #5
0
        private List<SteelThicknessGaugingPoint> GetPointsBetweenPlanes(List<SteelThicknessGaugingPoint> steelThicknessGaugingPoints, Plane minPlane, Plane maxPlane)
        {
            try
            {
                List<SteelThicknessGaugingPoint> pointsBetweenPlanes = new List<SteelThicknessGaugingPoint>();
                foreach (SteelThicknessGaugingPoint steelThicknessGaugingPoint in steelThicknessGaugingPoints)
                {
                    Point3D point = steelThicknessGaugingPoint.PointGeometry.Position;
                    if (minPlane.Signal(point) == 1 && maxPlane.Signal(point) == -1)
                    {
                        pointsBetweenPlanes.Add(steelThicknessGaugingPoint);
                    }
                }

                return pointsBetweenPlanes;
            }
            catch (Exception ex)
            {
                throw new ApplicationException("Points between planes cannot be get!", ex);
            }
        }