Exemple #1
0
        /// <summary>
        /// Creates a new layer at the specified index in the CompoundStructure.
        /// </summary>
        /// <param name="compoundStructure">The CompoundStructure to modify.</param>
        /// <param name="layerIndex">Index of the layer to be inserted.</param>
        /// <param name="width">Width of the layer.</param>
        /// <param name="layerFunction">Autodesk.Revit.DB.MaterialFunctionAssignment enumeration of the layer.</param>
        /// <param name="material">Autodesk.Revit.DB.Materials of the layer.  Dynamo wrapped Revit.Material objects will not work.</param>
        /// <returns name="compoundStructure">The modified CompoundStructure.</returns>
        public static CompoundStructure InsertLayerAtIndex(CompoundStructure compoundStructure,
                                                           int layerIndex,
                                                           double width,
                                                           revitDB.MaterialFunctionAssignment layerFunction,
                                                           revitDB.Material material)
        {
            revitCSLayer layer = new revitCSLayer(width, layerFunction, material.Id);

            cg.IList <revitCSLayer> layers = compoundStructure.internalCompoundStructure.GetLayers();
            layers.Insert(layerIndex, layer);

            compoundStructure.internalCompoundStructure.SetLayers(layers);
            return(compoundStructure);
        }
Exemple #2
0
        /// <summary>
        /// Creates a Synthetic.Revit.CompoundStructure given lists of layer properties.  Please note that layers will only be made with the shortest number of complete layer properties.  For example if five widths and layer functions are provided but only four materials, only four layers will be created.
        /// </summary>
        /// <param name="width">List with the width of each layer.</param>
        /// <param name="layerFunction">List with the Autodesk.Revit.DB.MaterialFunctionAssignment enumerations for each layer.</param>
        /// <param name="material">List of Autodesk.Revit.DB.Materials for each layer.  Dynamo wrapped Revit.Material objects will not work.</param>
        /// <param name="document">An unwrapped document associated with the CompoundStructure.</param>
        /// <returns name="compoundStructure">A Compound Structure.</returns>
        public static CompoundStructure ByLayerProperties(cg.IList <double> width,
                                                          cg.IList <revitDB.MaterialFunctionAssignment> layerFunction,
                                                          cg.IList <revitDB.Material> material,
                                                          [DefaultArgument("Synthetic.Revit.Document.Current()")] revitDoc document)
        {
            cg.List <int> lenList = new cg.List <int>();
            lenList.Add(layerFunction.Count);
            lenList.Add(width.Count);
            lenList.Add(material.Count);

            int l = lenList.Min();

            cg.List <revitCSLayer> layerList = new cg.List <revitCSLayer>();

            for (int i = 0; i < l; i++)
            {
                revitCSLayer layer = new revitCSLayer(width[i], layerFunction[i], material[i].Id);
                layerList.Add(layer);
            }

            //return new CompoundStructure(revitCS.CreateSimpleCompoundStructure(layerList), document);
            return(new CompoundStructure(layerList, document));
        }
Exemple #3
0
 /// <summary>
 /// Sets the layers for the CompoundStructure with a list of Autodesk.Revit.DB.CompoundStructureLayer elements from the CompoundStructure.  For use with python or other methods for using the Revit API directly.
 /// </summary>
 /// <param name="compoundStructure">A CompoundStructure</param>
 /// <param name="compoundStructureLayers">A list of Autodesk.Revit.DB.CompoundStructureLayer elements</param>
 /// <returns name="compoundStructure">The modified CompoundStructure</returns>
 public static CompoundStructure SetCompoundStructureLayers(CompoundStructure compoundStructure, cg.IList <revitCSLayer> compoundStructureLayers)
 {
     compoundStructure.internalCompoundStructure.SetLayers(compoundStructureLayers);
     return(compoundStructure);
 }