addparameter without forgetypeid

addparameter without forgetypeid

ivo.lafeber
Enthusiast Enthusiast
1,377 Views
7 Replies
Message 1 of 8

addparameter without forgetypeid

ivo.lafeber
Enthusiast
Enthusiast

Dear all,

 

I get a message about the ParameterType which is deprecated in Revit 2022 and may be removed in later versions.

ivolafeber_1-1629886984939.png

in the addparameter function there is still the option which accepts ParameterType, but there is no option which accepts a ForgeTypeId, does anybody know why that is ?

ivolafeber_0-1629886929549.png

 

0 Likes
Accepted solutions (1)
1,378 Views
7 Replies
Replies (7)
Message 2 of 8

Omar_Amen
Advocate
Advocate
Accepted solution

Dear @ivo.lafeber,
you can use   addparameter function with ForgeTypeId arg only if you are using RevitAPI.dll of Revit 2022,
but I can notice that u have the 6 overloads of the function which means you can use ForgeTypeId !

overloads.png

 ------

addParameter.png



Message 3 of 8

ivo.lafeber
Enthusiast
Enthusiast

Not only the ParameterType has to be changed to ForgeTypeId, but also the BuiltInParameterGroup 🙂

Message 4 of 8

ivo.lafeber
Enthusiast
Enthusiast

In a family a parameter can be added to a group called "other", in the api it is the BuiltInParameterGroup. Invalid.

Group Invalid cannot be found in GroupTypeId, also Other cannot be found, which ForgeTypeId is the "Other" group?

 

ivolafeber_0-1629897268133.png

the error which occurs

ivolafeber_1-1629898049075.png

 

 

0 Likes
Message 5 of 8

Omar_Amen
Advocate
Advocate

Are you getting the same error with different BuiltInParameterGroups or it's be only with the .INVALID one ?

0 Likes
Message 6 of 8

ivo.lafeber
Enthusiast
Enthusiast

for now only with the INVALID one, I've not (jet) tested all the groups.

0 Likes
Message 7 of 8

imustafa_adel
Explorer
Explorer

Hi Ivo,

 

You can use the following code

C#:
doc.FamilyManager.AddParameter("paraName",new ForgeTypeId(),SpecTypeId.Number,true)

python

doc.FamilyManager.AddParameter("paraName",ForgeTypeId(),SpecTypeId.Number,True)

 

Regards,

0 Likes
Message 8 of 8

a.bejenaru
Enthusiast
Enthusiast

Did you try to use in C#

 

new ForgeTypeId(string.Empty)

 

 This stands for the Other group

0 Likes