Shared Parameter of Type FamilyType

Shared Parameter of Type FamilyType

stephen_harrison
Advocate Advocate
3,581 Views
12 Replies
Message 1 of 13

Shared Parameter of Type FamilyType

stephen_harrison
Advocate
Advocate

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…>.

FamilyType Shared Parameter.png

 

 

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?

0 Likes
3,582 Views
12 Replies
Replies (12)
Message 2 of 13

Anonymous
Not applicable

Dear Stephen,

 

As i try to create Family Typetest.png Parameter. i got following option please see below image this may help you.

0 Likes
Message 3 of 13

stephen_harrison
Advocate
Advocate

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.

 

0 Likes
Message 4 of 13

JimJia
Alumni
Alumni
Dear Stephen Harrison,

Revit doesn't expose API to allow specifying category for shared parameter of "Family Type", we already created Revit request issue CF-4658 to track this.

This issue needs to be assessed by our engineering team, and prioritized against all of the other change requests that are outstanding. As a result any information that you can provide to influence this assessment will help. Please provide the following where possible:
• Impact on your application and/or your development.
• The number of users affected.
• The potential revenue impact to you.
• The potential revenue impact to Autodesk.
• Realistic timescale over which a fix would help you.
• In the case of a request for a new feature or a feature enhancement, please also provide detailed Use Cases for the workflows that this change would address.
This information is extremely important. Our engineering team have limited resources, and so must focus their efforts on the highest impact Change Requests. We do understand that this will cause you delays and affect your development planning, and we appreciate your cooperation and patience.

Jim Jia
Autodesk Forge Evangelist
https://forge.autodesk.com
Developer Technical Services
Autodesk Developer Network
Email: [email protected]
0 Likes
Message 5 of 13

Anonymous
Not applicable

Hi Jim Jia,

 

Has the request issue CF-4658 been solved?

0 Likes
Message 6 of 13

JimJia
Alumni
Alumni

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.


Jim Jia
Autodesk Forge Evangelist
https://forge.autodesk.com
Developer Technical Services
Autodesk Developer Network
Email: [email protected]
0 Likes
Message 7 of 13

marcelo_quevedo
Contributor
Contributor

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

0 Likes
Message 8 of 13

jeremytammik
Autodesk
Autodesk

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



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

Message 9 of 13

aignatovich
Advisor
Advisor

Dear Jeremy, special thanks for that! We also need this.

Manual editing shared parameters file is a very dumb workaround Robot Frustrated

0 Likes
Message 10 of 13

jeremytammik
Autodesk
Autodesk

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



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

0 Likes
Message 11 of 13

aignatovich
Advisor
Advisor

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

Message 12 of 13

ebrownVWFR7
Explorer
Explorer

Is ther any API progress on allowing to specify  a category of the Shared Parameter of Type FamilyType?

Message 13 of 13

islam.alqalyubi
Participant
Participant

@jeremytammik 

Please, let us know if there is any progress regarding this issue, Thanks.

0 Likes