3

I am creating plugin for Revit 2019 and want to get all the parameters of Wall Category. I have filtered the walls and then I am accessing parameters of wall. But I am not getting the parameters like "Material: Name, Material: Area, Material: Volume" etc

I have tried the following code

ElementFilter wall = new ElementCategoryFilter(BuiltInCategory.OST_Walls);
    ICollection<Element> walls = new 
    FilteredElementCollector(doc).WherePasses(wall).ToElements();

string prompt = "Parameters";
foreach (Element e in walls)
{    
        ParameterSet pSet = e.Parameters;

        foreach (Parameter p in pSet)
        {
            prompt += (p.Definition as 
     InternalDefinition).BuiltInParameter.ToString();
            prompt += Environment.NewLine;
        }

        break;
    }
 }

I have also tried the following method:

IList<Parameter> orderedParameters = e.GetOrderedParameters();

And also this:

ParameterMap parameterMap = e.ParametersMap;

I want to get all parameters including schedule and take off parameters.

I am not getting the highlighted parameters.

Field parameters

Mah Noor
  • 83
  • 1
  • 11
  • Don't post duplicate questions. Edit your original question to include all the details. –  Aug 06 '19 at 11:23

3 Answers3

1
WallType type = WallTypes.ElementAt(0) as WallType;
WallType newType = type.Duplicate(name) as WallType;
CompoundStructure cs = type.GetCompoundStructure();
CompoundStructure wallComPound = newType.GetCompoundStructure();
foreach (CompoundStructureLayer layer in wallComPound.GetLayers())
{
layer.Width = value ;
wallComPound.SetLayerWidth(layer.LayerId, layer.Width);
break;
}
newType.SetCompoundStructure(wallComPound);

this demo is change wall's width,If I understand you correctly, you want to get material parameter,in wall,you should get the walltype and then you should get the compoundStructural ,in this ,youcan get the martral information.Beacuse wall is Consists of several layers of information。Hopefully it helped you!

Imkc
  • 15
  • 3
1

You can get this from the wall without, there is no need to access the parameters.

foreach (Element e in walls)
{    
    double area = e.GetMaterialArea();
    double volume = e.GetMaterialVolume();
    //Get the category material
    Material mat = e.Category.Material;
}

If you want to get all the information of the material you can use GetMaterialIds()

foreach(ElementId id in e.GetMaterialIds())
{
    Material mat = doc.GetElement(id) as Material;
    //Get data from material...
}

For more information check the api.

DomCR
  • 533
  • 4
  • 19
0

I don't know about some of the element specific parameters like Area, As Paint and Volume, but at least some of them are accessible by getting the material of the wall and also accessing the parameters of the material instead of just your wall.

Jan Buijs
  • 98
  • 1
  • 6
  • Can you provide some more information? How can I get the material of the wall and material parameters? – Mah Noor Jul 30 '19 at 16:14