Shared Parameter of Type FamilyType
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Denunciar
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?
