Access Sheet properties and modify

Access Sheet properties and modify

strsuraj
Enthusiast Enthusiast
1,385 Views
2 Replies
Message 1 of 3

Access Sheet properties and modify

strsuraj
Enthusiast
Enthusiast

Hi,

 

I want to access the properties of selected sheet and modify them. I am able to do for properties which are listed under Identity Data

 

using

foreach (Element e in new FilteredElementCollector(doc).OfClass(typeof(FamilyInstance)).OwnedByView(viewsheet.Id))
{
   Parameter param1 = e.LookupParameter(ParameterName);
   if (param1 != null) { param1.Set(finalValue);  }

properties.png

 

 

but unable to do it for those under "Other"

properties1.png

 

This is just an example, I have few properties which are Associate Global Parameter and are placed inside Other in Properties window.

 

Thanks 

 

 

0 Likes
Accepted solutions (1)
1,386 Views
2 Replies
Replies (2)
Message 2 of 3

naveen.kumar.t
Autodesk Support
Autodesk Support
Accepted solution

Hi @strsuraj ,

Filter the view sheet and try to access the parameters.

FilteredElementCollector collector = new FilteredElementCollector(doc).OfClass(typeof(ViewSheet)).WhereElementIsNotElementType();
                foreach(Element e in collector)
                {
                    foreach (Parameter p in e.Parameters)
                    {
                       if(p.Definition.Name=="Guide Grid")
                       {
                            p.Set("Guide Grid Name");
                       }
                    }
                }

You can use the above code to set the value for the parameters.

From my understanding, It is not possible to change the file path parameter via API.

If you want to set the value for the guide grid then you should first create guide grid elements in the active sheet and by using guide grid element name you can assign value for the guide grid parameter.

 

I hope this helps.


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 3 of 3

strsuraj
Enthusiast
Enthusiast

Hi @naveen.kumar.t  that's all I was looking for. Thanks.

0 Likes