overwrite Shared Parameter of a Nested Family

overwrite Shared Parameter of a Nested Family

studio-a-int
Advocate Advocate
1,207 Views
3 Replies
Message 1 of 4

overwrite Shared Parameter of a Nested Family

studio-a-int
Advocate
Advocate

I'm trying to overwrite in a project a Shared Parameter that is binded to a nested (shared) family.

 

I'm able to select the nested family in the Revit project, get the value of the Shared Parameter, but I cannot overwrite that parameter in the project.

Shared Parameter is a String StorageType.

 

I select all families using a filtered elem. collector

NESTED_FAMILIES = FilteredElementCollector(doc).... etc

then, when I try to write that parameter:


t1 = Transaction(doc, 'Set New Values')
t1.Start()
WRITE_TEST = [i.get_Parameter(Guid(MY_SHARED_PARAMETER)).Set('TEST') for i in NESTED_FAMILIES]
doc.Regenerate()
t1.Commit()

 

 

I get:
Exception: The parameter is read-only

 

Thanks for your help.

 

 

 

0 Likes
1,208 Views
3 Replies
Replies (3)
Message 2 of 4

jeremytammik
Autodesk
Autodesk

Dear Adrian,

 

Thank you for your query.

 

What you are saying makes no sense to me.

 

A shared parameter is associated with a BIM category and stores a value on specific elements belonging to that category.

 

You seem to be iterating over your nested families and trying to set a shared parameter value on the family itself.

 

As said, this makes no sense to me whatsoever.

 

As always, I would suggest implementing the functionality you need manually through the user interface first, so that you are sure that it works and makes sense.

 

Then, making a note of the steps you took to achieve this, you can implement the same functionality programmatically through the API.

 

Here is some advice on researching how to solve a Revit programming task:

 

http://thebuildingcoder.typepad.com/blog/2017/01/virtues-of-reproduction-research-mep-settings-ontol...

http://thebuildingcoder.typepad.com/blog/2013/11/intimate-revit-database-exploration-with-the-python...

 

I hope this helps.

 

Best regards,

 

Jeremy

 



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

0 Likes
Message 3 of 4

studio-a-int
Advocate
Advocate

Jeremy -

thanks for you reply.

I had couple busy days and could not reply back.

Couple notes:

1. the Shared Parameter of a nested family can be overwritten by parent family (with an associated parameter) in a Revit project. So it is "doable".

Of course, the issue is that if multiple instances of the nested Family are in the same Revit Family, the parameter will have same value. Solution which is not ok for my application. I need to figure out something.

2. I've seen an independent application, developed by other programmers that obtained the same solution as the one I'm aiming at. So this is a hint for me that this is doable.

3. I have the backup solution, as I can create lists of tuples or list of lists in Python, that can store externally the information I need for that Shared Parameter. I might use this one, until I dive more in the Revit API and find a solution directly in Revit. Thank you for your comments/help.

0 Likes
Message 4 of 4

stever66
Advisor
Advisor

Are you sure the shared parameter is user modifiable?

 

https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2016/ENU/Revit-API/files/GUID-...

 

are you working from within the family manager?  If so, you can set the current type in the family manager, and then setting the shared parameter sets it for that type..  not sure what that means for nested families.  

 

I think there here is an example in the help under developers.  It shows how to open the family manager, edit the family, and load the family back into the project.  It might be possible to do something similar where your code opens the nested family, edits the nested family, and loads it back in.

 

it would be interesting to know if that is possible in the api.  

 

0 Likes