Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Rename Shared Parameter

28 REPLIES 28
SOLVED
Reply
Message 1 of 29
Anonymous
26372 Views, 28 Replies

Rename Shared Parameter

Is there a way to rename shared parameter already assigned to the project and/or family files? I would like to keep the GUID as it is but change the alias.

28 REPLIES 28
Message 21 of 29
Ning_Zhou
in reply to: aricke59

thanks aricke, my question is that after renamed SP in RFA, then reload to RVT, is it going to work?

Message 22 of 29
aricke59
in reply to: Ning_Zhou

Short answer is no. You need to use the API to delete the associated SharedParameterElement. I have added some content I wrote a while ago that may better explain what is going on. Hope you find it useful.

 

Shared Parameters – What are they?

 

Like all parameters, shared parameters enable you to store a value associated to some item. They could store against items that are instances or a types. They can store various sorts of information such as text, number, material, yes no, etc.

 

Shared Parameters – Names and GUIDs

 

The thing that differentiates shared parameters from non-shared parameters is that shared parameters use a GUID to differentiate one from the other; the name is pretty much irrelevant. You could have 50 shared parameters all named “Company” assigned to a single Family provided they all have different GUIDs. Obviously this is not a good thing and will very quickly lead to great confusion!

 

Multiple GUIDs with the same name

 

The sorts of issues that occur when you have multiple GUIDs all with the same name is that your schedules are likely to present a blank entry when you know you set Company to ACME. Tags will display a blank entry. One family shows correctly, another shows something else.

 

The point to make is it can take hours to find the issue!

 

Shared Parameter Definition files

 

You can define your shared parameters in a “Shared Parameter Definitions” file. I will assume that you know about these. In the file you can define the Names, Data Types,  Group, Description, and if it is Visible and also user modifiable.

 

How does a shared parameter get into my file?

 

The obvious way is to add a “Shared Project Parameter” and associate it to various categories. Another way is to load a family that contains a shared parameter. I assume the same applies if you bring in a tag family that has a label using a shared parameter.

 

Changing your mind about the name / visibility / etc. of a Shared Parameter

Easy you think, edit the definition file to change the name, add the shared parameter again – and, the name is still the same? What!

 

Ok, I must need to delete the parameter first. Still there as the old name!

 

Purge, delete families and purge? None of them work.

 

Getting rid of a shared parameter from your project

 

Basically you can’t! Once a shared parameter is in your project, you can delete the project parameter, delete the family containing the parameter, purge the project, scream, and the parameter definition remains in your project exactly as it was brought in the first time.

 

The only way to have a new definition is by adding a parameter with a different GUID.

 

So what’s going on?

 

Revit stores Shared Parameter definitions in a “SharedParameterElement” table. This provides a single source that defines the parameter properties based on the GUID; a different GUID means a different parameter. There is a logic here that makes certain that you can bring families in from anywhere and have them work even if they all contain similarly named shared parameters.

 

Since 2016 the table of “SharedParameterElements” has been accessible and to totally remove a shared parameter from Revit you need to delete the element as defined in that table. If you know the ID you can actually use the “Select by ID” and then just hit delete. There is just one issue with this. If you delete a parameter that is being used in a family, a tag, or as a project parameter, those fields will no longer display, or schedule, or tag. Not a good outcome.

 

ARUtils Parameter Manager

 

Apart from other functionality, two Shared Parameter issues that the Parameter Manager addresses are:

  • Shared parameters with the SAME NAME but DIFFERENT GUIDs
  • Identifying shared parameters that be deleted

 

This is achieved by comparing Shared Project Parameters and Family Shared Parameters against the list of “SharedParameterElements”. If a parameter only occurs in the “SharedParameterElements” then it most likely can be safely deleted.

Message 23 of 29
Ning_Zhou
in reply to: aricke59

thanks aricke for in-depth info! well, now i understand that SharedParameterElement is the key even though i don't understand why its uid is not same as uid in SP file?

so basically if i want to rename SP in RVT, i have to

1) create temporary SP in order to store old SP value, etc

2) delete old SP's SharedParameterElement, this will REALLY delete that old SP in RVT

3) create new SP, get info i.e. value, etc from temporary SP

4) delete temporary SP via SharedParameterElement

correct me if i'm wrong, will give it a try later

Message 24 of 29
aricke59
in reply to: Ning_Zhou

Unfortunately you cannot do the "temporary" SP in a RVT file. It only works in a family or RFA file where you can create a temporary SP and then use the familymanager.replaceparameter(familyparamter,...) command, delete the SPE, and bring in the revised SP from the SP File, and then replace the temporary parameter with the new definition.

 

Deleting the sharedparameterelement in the RVT without due consideration will pretty much wipe out / corrupt any family / other items that rely on the SP/E. 

 

At best, delete any families using the SP, delete the SPE, bring "Fixed" families back in, and hope that the SPE now shows the correct name for your SP. Any values that were specifically in the RVT will need to be re-established/re-entered. You may be able to use some sort of Excel export function to export and later import the values. 

 

This is about a level 9 degree of difficulty as far as Revit manipulation goes. There is a reason the UI does not allow you to simply delete the SP/E. 

 

Any file that is important to you will need to be backed up, tested, and tested again, to make sure you have not TOTALLY CORRUPTED your RVT.

Message 25 of 29
Ning_Zhou
in reply to: aricke59

OK, so no way to rename SPs in RVT via API at all, too bad! seems lots of manual works cannot be avoided after all.

i guess i still have to use API just to REALLY delete SPs in RVT, isn't it?

Message 26 of 29
Ning_Zhou
in reply to: aricke59

i guess it's also impossible to change group and/or visibility in RVT via API, in fact, how to get visibility, etc stuff via API, i mean VISIBLE DESCRIPTION, USERMODIFIABLE in SP file

Message 27 of 29
aricke59
in reply to: Ning_Zhou

You can get most of what you want via the "InternalDefinition" , e.g. parameter.definition.

 

you then have access to parametergroup, visible, isType, etc. If it has a GUID then it is shared. 

Message 28 of 29
oboennecUKLON
in reply to: Ning_Zhou

IT IS POSSIBLE TO RENAME PARAMETERS IN REVIT...

1) With .RFA files, it can be done simply by editing the parameter file used

2) With .RVT files it is more complicated. RVT files remember parameter names and GUID even after these have been removed and deleted. If you change the parameter, it remembers the old one. Do rename the parameter, you need to PURGE the dark memory of Revit. I have never done this but I know there are scripts and plugin that can help you do that with more or less manual intervention.

3) Please note that if you have RENAMED the parameter in a .RFD family file, the parameter will have ONE name when you view the FAMILY via the RVT files in the property data, but a DIFFERENT name when you OPEN the family in a separate TAB/WINDOW, i.e. it will have the RENAMED parameter value. I have experienced this.

 

Good luck

Olivier

Message 29 of 29
aricke59
in reply to: rosalesduquej

Hi All,

just thought I would let you know I have now implemented a Sync Shared Parameters routine to allow you to sync a project to the shared parameter names in your shared parameters file. The routine fixes your families, stores off values in your project for instances and types, and also fixes schedules that use shared parameters for values, sorting / grouping, and filtering. The one thing that cannot be rectified are tag families that use a shared parameter - the routine does however open the tags where this is an issue. 

Check out ARUtils at arsoftwaresolutions.com.au if you want a commercial solution.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Rail Community