Modify properties in Columns

Modify properties in Columns

Anonymous
Not applicable
807 Views
4 Replies
Message 1 of 5

Modify properties in Columns

Anonymous
Not applicable

I am trying getting the "Columns" of model with a method that receive a Category how parameter. Then, with a "for" modify the value in two properties of all Columns.

 

See code:

 

public void GenerateFormworkToElements(string category)
        {
            SubTransaction createFormwork = new SubTransaction(m_revit.ActiveUIDocument.Document);
            try
            {
                createFormwork.Start();          
//Parameter is a Category if (category == "Structural Columns") { //Here to find the columns y modify the properties } createFormwork.Commit(); } catch (Exception ex) { TaskDialog.Show("GenerateFormworkToElements", "Error = " + ex.Message); createFormwork.RollBack(); } }

 The following are properties to change:

 

modify_parameters.jpg

 

Thanks for your help.

 

David

0 Likes
808 Views
4 Replies
Replies (4)
Message 2 of 5

jeremytammik
Autodesk
Autodesk

Dear David,

 

If you are new to the Revit API, the first thing to do is to work through the getting started material, especially the 'My First Revit Plug-in' and DevTV tutorials:

 

http://thebuildingcoder.typepad.com/blog/about-the-author.html#2

 

Getting started includes installing the SDK and RevitLookup, a very important Revit project database exploration tool.

 

Here are some recent other notes on getting started:

 

http://thebuildingcoder.typepad.com/blog/2015/01/cloud-accelerator-and-more-revit-stuff.html#3

 

I promise you that working through that material will make the answer to your question completely obvious.

 

Have fun!

 

Best regards,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 5

Anonymous
Not applicable

Hi Jeremy:

 

I am relatively new, but I won experience doing my first Add-in.


My question is specifically el code that get the all columns of a model according to parameter "Category" (see code up). If you may help me It would be great.

 

I will revise the information that you've shared.

 

Thanks very much.

 

Regards

 

David

0 Likes
Message 4 of 5

Anonymous
Not applicable

Hi,

 

Here goes the code:

 

FilteredElementCollector collector
= new FilteredElementCollector(doc)
.OfClass(typeof(FamilyInstance));

foreach (FamilyInstance fi in collector)
{

 

       if (fi.StructuralType == StructuralType.Column)
        {

           do you work here

        }

}

0 Likes
Message 5 of 5

Anonymous
Not applicable

Hi,

 

Thanks very much for responding. The code works good.

 

How can getting of a Element the value the properties and shared parameters?. See image.

 

parameter_shared.png

 

I am using the code following, but not woks:

 foreach (FamilyInstance fi in collector)
                    {

                        if (fi.StructuralType == StructuralType.Column)
                        {

//Get parameter "GyM Categoría"
                            Parameter gymCategoria = fi.get_Parameter(BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS);
                            gymCategoria = fi.LookupParameter("Categoria GyM");

}
}

 

 

 

Thanks for you help.

0 Likes