IsRectangular() public static method

judge whether given 4 lines can form a rectangular
public static IsRectangular ( CurveArray curves ) : bool
curves CurveArray
return bool
Beispiel #1
0
        /// <summary>
        /// get necessary data when create AreaReinforcement on a horizontal floor
        /// </summary>
        /// <param name="floor">floor on which to create AreaReinforcemen</param>
        /// <param name="refer">reference of the horizontal face on the floor</param>
        /// <param name="curves">curves compose the horizontal face of the floor</param>
        /// <returns>is successful</returns>
        public bool GetFloorGeom(Floor floor, ref Reference refer, ref IList <Curve> curves)
        {
            //get horizontal face reference
            FaceArray faces = GeomUtil.GetFaces(floor);

            foreach (Face face in faces)
            {
                if (GeomUtil.IsHorizontalFace(face))
                {
                    refer = face.Reference;
                    break;
                }
            }
            //no proper reference
            if (null == refer)
            {
                return(false);
            }

            //check the analytical model profile is rectangular
            AnalyticalModel model = floor.GetAnalyticalModel();

            if (null == model)
            {
                return(false);
            }
            curves = model.GetCurves(AnalyticalCurveType.ActiveCurves);
            if (!GeomUtil.IsRectangular(curves))
            {
                return(false);
            }

            return(true);
        }
Beispiel #2
0
        /// <summary>
        /// get necessary data when create AreaReinforcement on a straight wall
        /// </summary>
        /// <param name="wall">wall on which to create AreaReinforcemen</param>
        /// <param name="refer">reference of the vertical straight face on the wall</param>
        /// <param name="curves">curves compose the vertical face of the wall</param>
        /// <returns>is successful</returns>
        public bool GetWallGeom(Wall wall, ref Reference refer, ref CurveArray curves)
        {
            FaceArray     faces    = GeomUtil.GetFaces(wall);
            LocationCurve locCurve = wall.Location as LocationCurve;

            //unless API has bug, locCurve can't be null
            if (null == locCurve)
            {
                return(false);
            }
            //check the location is line
            Line locLine = locCurve.Curve as Line;

            if (null == locLine)
            {
                return(false);
            }

            //get the face reference
            foreach (Face face in faces)
            {
                if (GeomUtil.IsParallel(face, locLine))
                {
                    refer = face.Reference;
                    break;
                }
            }
            //can't find proper reference
            if (null == refer)
            {
                return(false);
            }

            //check the analytical model profile is rectangular
            AnalyticalModel model = wall.GetAnalyticalModel();

            if (null == model)
            {
                return(false);
            }

            IList <Curve> curveList = model.GetCurves(AnalyticalCurveType.ActiveCurves);

            curves = m_currentDoc.Application.Create.NewCurveArray();
            foreach (Curve curve in curveList)
            {
                curves.Append(curve);
            }
            if (!GeomUtil.IsRectangular(curves))
            {
                return(false);
            }

            return(true);
        }
Beispiel #3
0
        /// <summary>
        /// get necessary data when create AreaReinforcement on a horizontal floor
        /// </summary>
        /// <param name="floor">floor on which to create AreaReinforcemen</param>
        /// <param name="refer">reference of the horizontal face on the floor</param>
        /// <param name="curves">curves compose the horizontal face of the floor</param>
        /// <returns>is successful</returns>
        public bool GetFloorGeom(Floor floor, ref Reference refer, ref IList <Curve> curves)
        {
            //get horizontal face reference
            FaceArray faces = GeomUtil.GetFaces(floor);

            foreach (Face face in faces)
            {
                if (GeomUtil.IsHorizontalFace(face))
                {
                    refer = face.Reference;
                    break;
                }
            }
            //no proper reference
            if (null == refer)
            {
                return(false);
            }

            //check the analytical model profile is rectangular
            //check the analytical model profile is rectangular
            Document document = floor.Document;
            AnalyticalToPhysicalAssociationManager assocManager = AnalyticalToPhysicalAssociationManager.GetAnalyticalToPhysicalAssociationManager(document);
            AnalyticalPanel model = null;

            if (assocManager != null)
            {
                ElementId associatedElementId = assocManager.GetAssociatedElementId(floor.Id);
                if (associatedElementId != ElementId.InvalidElementId)
                {
                    Element associatedElement = document.GetElement(associatedElementId);
                    if (associatedElement != null && associatedElement is AnalyticalPanel)
                    {
                        model = associatedElement as AnalyticalPanel;
                    }
                }
            }
            if (null == model)
            {
                return(false);
            }
            curves = model.GetOuterContour().ToList();

            if (!GeomUtil.IsRectangular(curves))
            {
                return(false);
            }

            return(true);
        }
Beispiel #4
0
        /// <summary>
        /// get necessary data when create AreaReinforcement on a straight wall
        /// </summary>
        /// <param name="wall">wall on which to create AreaReinforcemen</param>
        /// <param name="refer">reference of the vertical straight face on the wall</param>
        /// <param name="curves">curves compose the vertical face of the wall</param>
        /// <returns>is successful</returns>
        public bool GetWallGeom(Wall wall, ref Reference refer, ref IList <Curve> curves)
        {
            FaceArray     faces    = GeomUtil.GetFaces(wall);
            LocationCurve locCurve = wall.Location as LocationCurve;

            //unless API has bug, locCurve can't be null
            if (null == locCurve)
            {
                return(false);
            }
            //check the location is line
            Line locLine = locCurve.Curve as Line;

            if (null == locLine)
            {
                return(false);
            }

            //get the face reference
            foreach (Face face in faces)
            {
                if (GeomUtil.IsParallel(face, locLine))
                {
                    refer = face.Reference;
                    break;
                }
            }
            //can't find proper reference
            if (null == refer)
            {
                return(false);
            }
            //check the analytical model profile is rectangular
            Document document = wall.Document;
            AnalyticalToPhysicalAssociationManager assocManager = AnalyticalToPhysicalAssociationManager.GetAnalyticalToPhysicalAssociationManager(document);
            AnalyticalPanel model = null;

            if (assocManager != null)
            {
                ElementId associatedElementId = assocManager.GetAssociatedElementId(wall.Id);
                if (associatedElementId != ElementId.InvalidElementId)
                {
                    Element associatedElement = document.GetElement(associatedElementId);
                    if (associatedElement != null && associatedElement is AnalyticalPanel)
                    {
                        model = associatedElement as AnalyticalPanel;
                    }
                }
            }
            if (null == model)
            {
                return(false);
            }

            curves = model.GetOuterContour().ToList();

            if (!GeomUtil.IsRectangular(curves))
            {
                return(false);
            }

            return(true);
        }