Exemplo n.º 1
0
        protected static Reference[] GetSideReferences(FamilyInstance projectZone, View view)
        {
            Reference[]    array = (Reference[])new Reference[4];
            BoundingBoxXYZ val   = projectZone.get_BoundingBox(null);
            double         c     = val.get_Max().get_X() - val.get_Min().get_X();
            double         c2    = val.get_Max().get_Y() - val.get_Min().get_Y();
            double         z     = val.get_Min().get_Z();
            Options        val2  = new Options();

            val2.set_ComputeReferences(true);
            val2.set_View(view);
            GeometryElement  source = projectZone.get_Geometry(val2);
            GeometryInstance val3   = ((IEnumerable <GeometryObject>)source).First((GeometryObject g) => g is GeometryInstance) as GeometryInstance;
            GeometryElement  val4   = val3.get_SymbolGeometry();
            int num = 0;

            foreach (GeometryObject item in val4)
            {
                if (item is Line)
                {
                    Line val5 = item as Line;
                    if (!(val5.GetEndPoint(0).get_Z() >= z + 0.01) && !(val5.GetEndPoint(1).get_Z() >= z + 0.01))
                    {
                        Directions?nullable = null;
                        if (val5.get_Direction().get_X() >= 0.99 || val5.get_Direction().get_X() <= -0.99)
                        {
                            double y = val5.GetEndPoint(0).get_Y();
                            if (NearlyIntersects(y, c2))
                            {
                                nullable = Directions.North;
                            }
                            else if (NearlyIntersects(y, 0.0))
                            {
                                nullable = Directions.South;
                            }
                        }
                        else if (val5.get_Direction().get_Y() >= 0.99 || val5.get_Direction().get_Y() <= -0.99)
                        {
                            double x = val5.GetEndPoint(0).get_X();
                            if (NearlyIntersects(x, c))
                            {
                                nullable = Directions.East;
                            }
                            else if (NearlyIntersects(x, 0.0))
                            {
                                nullable = Directions.West;
                            }
                        }
                        if (nullable.HasValue && array[(int)nullable.Value] == null)
                        {
                            array[(int)nullable.Value] = val5.get_Reference();
                            num++;
                            if (num == 4)
                            {
                                return(array);
                            }
                        }
                    }
                }
            }
            return(null);
        }