First thank you in advance for any help that is provided.
First a little background I am using Revit 2016 and programming in C#.
My issue is that:
I am creating new shared parameter definition information and storing this in a class list utilising as follows,(this is all before an external definition file is created).
public class SharedParam
{
public string GUID { get; set; }
public string Name { get; set; }
public ParameterType DataType { get; set; }
public int DataCategory { get; set; }
public string Group { get; set; }
public bool Visible { get; set; }
public string Tooltip { get; set; }
public bool Modifiable { get; set; }
}
I then save this to an External definition file using the api.
Groups are saved using:
//Check if Group name exists and if not create
DefinitionGroup myGroup = myGroups.get_Item(saveGroup);
if (myGroup == null)
{
myGroup = UtilityFiles.masterParafile.Groups.Create(saveGroup);
}
The shared parameter definition is then saved using:
//Check if Parameter Name exists
ExternalDefinition myExDef = myGroup.Definitions.get_Item(saveName) as ExternalDefinition;
if (myExDef == null)
{
ExternalDefinitionCreationOptions option = new ExternalDefinitionCreationOptions(saveName, saveParamType);
option.UserModifiable = saveModifiable;
option.Description = saveTooltip;
Definition myDefinition = myGroup.Definitions.Create(option);
This all works no problem except when it comes to FamilyType parameters.
For clarity what I mean by FamilyType parameters is when creating a shared parameter, in the Parameter Properties dialog there is a drop down box titled Type of Parameter. The last item of the selection is <Family Type…>.
This selection creates an integer that represents a Built in Category. In this caste -2000080 which represents the BuiltinCategory.OST_Furniture.
My code stores this in “Int saveCategory” within the list. If you interrogate the list all the data is stored correctly but when it comes to creating the External shared parameter definition file using the code above I am unable to find a method to add this DATACATEGORY optional data to the definition file.
The shared parameter definition file should read:
*PARAM GUID NAME DATATYPE DATACATEGORY GROUP VISIBLE DESCRIPTION USERMODIFIABLE
PARAM 0db89500-3a9b-44ca-a7b2-1f93412f8ba7 COBie_Size TEXT 1 1 1
PARAM 3f0a0ed6-b451-4904-b323-ef553b0fa9af Furniture FAMILYTYPE -2000080 1 1 1
But the file reads:
*PARAM GUID NAME DATATYPE DATACATEGORY GROUP VISIBLE DESCRIPTION USERMODIFIABLE
PARAM 0db89500-3a9b-44ca-a7b2-1f93412f8ba7 COBie_Size TEXT 1 1 1
PARAM 3f0a0ed6-b451-4904-b323-ef553b0fa9af Furniture FAMILYTYPE -1 1 1 1
My question is how do you use the api to save a shared parameter to the external definition file of type FamilyType?
Dear Stephen,
As i try to create Family Type Parameter. i got following option please see below image this may help you.
Thank you for your reply.
This is very much in line with the code I have been trying but instead of using ParameterType.FamilyType I have been utilising a variable of ParameterType.FamilyType.
Regrettably either way the result in a shared parameter definition with a DATACATEGORY of -1 as my example above rather than -2000080.
Again thank you for your reply, it is increasingly looking like I need to find a workaround.
hi - I checked the status of the mentioned CF, it has no update yet. I will communicate with engineering team again, will keep you updated on any progress.
Hello Jim Jia,
I am Marcelo from hsbcad company. Also, our Revit application needs to create FamilyType shared parameters using the API. I tried it using Revit 2018 API, and the issue persists. We would like to know the status the CF-4658. It would be a huge help for us if the issue is solved soon.
Thank you so much in advance!
Marcelo
Dear Marcelo,
Thank you for your request.
Sorry that this is taking so long.
I see no activity yet on this item, CF-4658 [API: Shared Parameter of Type FamilyType - allow specify category associated to the parameter].
I added your request to it, raised its status to 'Critical' for you, and prompted the development team for a status update.
I hope this helps.
Please also ensure that this request is listed in the Revit Idea Station and receives many votes to underline its importance.
Thank you!
Best regards,
Jeremy
Dear Jeremy, special thanks for that! We also need this.
Manual editing shared parameters file is a very dumb workaround
Dear Alexander,
Thank you for your request.
I added your request to to CF-4658 [API: Shared Parameter of Type FamilyType - allow specify category associated to the parameter] as well.
The same applies to you, of course:
Please also ensure that this request is listed in the Revit Idea Station and receives many votes to underline its importance.
Thank you!
Best regards,
Jeremy
Hi all!
I've created an idea: https://forums.autodesk.com/t5/revit-ideas/shared-parameter-of-type-familytype/idi-p/7643901
Please vote for it, if you need this Revit API enhancement
Is ther any API progress on allowing to specify a category of the Shared Parameter of Type FamilyType?