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: 

Shared Parameter of Type FamilyType

11 REPLIES 11
Reply
Message 1 of 12
stephen_harrison
1597 Views, 11 Replies

Shared Parameter of Type FamilyType

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?

11 REPLIES 11
Message 2 of 12

Dear Stephen,

 

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

Manish Singh
Message 3 of 12

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.

 

Message 4 of 12
JimJia
in reply to: stephen_harrison

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: Jim.Jia@autodesk.com
Message 5 of 12
msalguero2LSUE
in reply to: JimJia

Hi Jim Jia,

 

Has the request issue CF-4658 been solved?

Message 6 of 12
JimJia
in reply to: msalguero2LSUE

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: Jim.Jia@autodesk.com
Message 7 of 12
marcelo.quevedo
in reply to: JimJia

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

Message 8 of 12

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 12
aignatovich
in reply to: jeremytammik

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

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

Message 10 of 12
jeremytammik
in reply to: aignatovich

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

Message 11 of 12
aignatovich
in reply to: jeremytammik

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 12

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

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community