Ejemplo n.º 1
1
 /// <summary>
 /// Given an array of edges, weeds out any edges
 /// not present on the desired plane
 /// </summary>
 /// <param name="xyzArray">the array of edges </param>
 /// <param name="normal">normal to the desired plane</param>
 /// <returns>edges on the desired plane</returns>
 public static EdgeArray GetEdgesOnPlane(EdgeArray edgeArray, XYZ normal)
 {
     EdgeArray edgesOnPlane = new EdgeArray();
     for (int i = 0; i < edgeArray.Size; i++) {
         IList<XYZ> xyzArray = edgeArray.get_Item(i).Tessellate();
         if (normal.Equals(GeomUtils.kXAxis)) {
             if (xyzArray[0].X == xyzArray[1].X) {
                 edgesOnPlane.Append(edgeArray.get_Item(i));
             }
         }
         if (normal.Equals(GeomUtils.kYAxis)) {
             if (xyzArray[0].Y == xyzArray[1].Y) {
                 edgesOnPlane.Append(edgeArray.get_Item(i));
             }
         }
         if (normal.Equals(GeomUtils.kZAxis)) {
             if (xyzArray[0].Z == xyzArray[1].Z) {
                 edgesOnPlane.Append(edgeArray.get_Item(i));
             }
         }
     }
     return edgesOnPlane;
 }
Ejemplo n.º 2
0
        GetEdgesOnPlane(EdgeArray edgeArray, XYZ normal)
        {
            EdgeArray edgesOnPlane = new EdgeArray();

            for (int i = 0; i < edgeArray.Size; i++)
            {
                IList <XYZ> xyzArray = edgeArray.get_Item(i).Tessellate();
                if (normal.Equals(GeomUtils.kXAxis))
                {
                    if (xyzArray[0].X == xyzArray[1].X)
                    {
                        edgesOnPlane.Append(edgeArray.get_Item(i));
                    }
                }
                if (normal.Equals(GeomUtils.kYAxis))
                {
                    if (xyzArray[0].Y == xyzArray[1].Y)
                    {
                        edgesOnPlane.Append(edgeArray.get_Item(i));
                    }
                }
                if (normal.Equals(GeomUtils.kZAxis))
                {
                    if (xyzArray[0].Z == xyzArray[1].Z)
                    {
                        edgesOnPlane.Append(edgeArray.get_Item(i));
                    }
                }
            }
            return(edgesOnPlane);
        }
Ejemplo n.º 3
0
        GetEdgesOnPlaneAtOffset(EdgeArray edgeArray, XYZ normal, double offset)
        {
            EdgeArray edgesAtOffset = new EdgeArray();

            edgeArray = GetEdgesOnPlane(edgeArray, normal);
            for (int i = 0; i < edgeArray.Size; i++)
            {
                IList <XYZ> xyzArray = edgeArray.get_Item(i).Tessellate();
                if (normal.Equals(GeomUtils.kXAxis))
                {
                    if ((xyzArray[0].X == offset))
                    {
                        edgesAtOffset.Append(edgeArray.get_Item(i));
                    }
                }
                if (normal.Equals(GeomUtils.kYAxis))
                {
                    if (xyzArray[0].Y == offset)
                    {
                        edgesAtOffset.Append(edgeArray.get_Item(i));
                    }
                }
                if (normal.Equals(GeomUtils.kZAxis))
                {
                    if (xyzArray[0].Z == offset)
                    {
                        edgesAtOffset.Append(edgeArray.get_Item(i));
                    }
                }
            }
            return(edgesAtOffset);
        }
Ejemplo n.º 4
0
        public EdgeArray FlEdgeArray(FamilyInstance familyInstance)
        {
            EdgeArray edge   = new EdgeArray();
            Options   option = new Options();

            option.ComputeReferences        = true;
            option.IncludeNonVisibleObjects = true;
            option.DetailLevel = ViewDetailLevel.Undefined;
            if (familyInstance != null)
            {
                GeometryElement geoElement = familyInstance.get_Geometry(option);
                foreach (GeometryObject geoObject in geoElement)
                {
                    GeometryInstance instance = geoObject as GeometryInstance;
                    if (instance != null)
                    {
                        FamilySymbol    familySymbol          = instance.Symbol as FamilySymbol;
                        GeometryElement instancegeotryElement = familySymbol.get_Geometry(option);
                        foreach (GeometryObject insto in instancegeotryElement)
                        {
                            Solid solid = insto as Solid;
                            if (solid != null)
                            {
                                foreach (var geoFace in solid.Edges)
                                {
                                    edge.Append(geoFace as Edge);
                                }
                            }
                        }
                    }
                }
            }
            return(edge);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Get all points of the Slab
        /// </summary>
        /// <returns>points array stores all the points on slab</returns>
        public EdgeArray GetFloorEdges()
        {
            EdgeArray edges   = new EdgeArray();
            Options   options = m_commandData.Application.Application.Create.NewGeometryOptions();

            options.DetailLevel = DetailLevels.Medium;
            //make sure references to geometric objects are computed.
            options.ComputeReferences = true;
            Autodesk.Revit.DB.GeometryElement geoElem = m_floor.get_Geometry(options);
            GeometryObjectArray gObjects = geoElem.Objects;

            //get all the edges in the Geometry object
            foreach (GeometryObject geo in gObjects)
            {
                Solid solid = geo as Solid;
                if (solid != null)
                {
                    FaceArray faces = solid.Faces;
                    foreach (Face face in faces)
                    {
                        EdgeArrayArray edgeArrarr = face.EdgeLoops;
                        foreach (EdgeArray edgeArr in edgeArrarr)
                        {
                            foreach (Edge edge in edgeArr)
                            {
                                edges.Append(edge);
                            }
                        }
                    }
                }
            }
            return(edges);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Get all points of the Slab
 /// </summary>
 /// <returns>points array stores all the points on slab</returns>
 public EdgeArray GetFloorEdges()
 {
     EdgeArray edges = new EdgeArray();
     Options options = m_commandData.Application.Application.Create.NewGeometryOptions();
     options.DetailLevel = DetailLevels.Medium;
     //make sure references to geometric objects are computed.
     options.ComputeReferences = true;
     Autodesk.Revit.DB.GeometryElement geoElem = m_floor.get_Geometry(options);
     GeometryObjectArray gObjects = geoElem.Objects;
     //get all the edges in the Geometry object
     foreach (GeometryObject geo in gObjects)
     {
         Solid solid = geo as Solid;
         if (solid != null)
         {
             FaceArray faces = solid.Faces;
             foreach (Face face in faces)
             {
                 EdgeArrayArray edgeArrarr = face.EdgeLoops;
                 foreach (EdgeArray edgeArr in edgeArrarr)
                 {
                     foreach (Edge edge in edgeArr)
                     {
                         edges.Append(edge);
                     }
                 }
             }
         }
     }
     return edges;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Given an array of edges, weeds out any edges
 /// not present at the given offset
 /// </summary>
 /// <param name="edgeArray">the array of edges </param>
 /// <param name="normal">normal to the desired plane</param>
 /// <param name="offset">offset from the plane</param>
 /// <returns>edges on a plane at given offset</returns>
 public static EdgeArray GetEdgesOnPlaneAtOffset(EdgeArray edgeArray, XYZ normal, double offset)
 {
     EdgeArray edgesAtOffset = new EdgeArray();
     edgeArray = GetEdgesOnPlane(edgeArray, normal);
     for (int i = 0; i < edgeArray.Size; i++) {
         IList<XYZ> xyzArray = edgeArray.get_Item(i).Tessellate();
         if (normal.Equals(GeomUtils.kXAxis)) {
             if ((xyzArray[0].X == offset)) {
                 edgesAtOffset.Append(edgeArray.get_Item(i));
             }
         }
         if (normal.Equals(GeomUtils.kYAxis)) {
             if (xyzArray[0].Y == offset) {
                 edgesAtOffset.Append(edgeArray.get_Item(i));
             }
         }
         if (normal.Equals(GeomUtils.kZAxis)) {
             if (xyzArray[0].Z == offset) {
                 edgesAtOffset.Append(edgeArray.get_Item(i));
             }
         }
     }
     return edgesAtOffset;
 }