IsParallel() 공개 정적인 메소드

judge whether a face and a line are parallel
public static IsParallel ( Face face, Line line ) : bool
face Face
line Line
리턴 bool
예제 #1
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);
        }
예제 #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 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);
        }