add family parameter (forgetypeid is still a puzzle to me)

add family parameter (forgetypeid is still a puzzle to me)

Joris.vd.Meulen
Collaborator Collaborator
257 Views
1 Reply
Message 1 of 2

add family parameter (forgetypeid is still a puzzle to me)

Joris.vd.Meulen
Collaborator
Collaborator

I've read a few posts here regarding conversion etc. but no clear answer to me was found.

 

So: how do I add a simple parameter to a family?

 

Using python, but you get the picture if you're using C#.

 

settempparam = doc3.FamilyManager.AddParameter("parametername_as_string", ForgeTypeId, ForgeTypeId, False)

 

 
So for example I want to add a text parameter in IdentityData:

 

settempparam = doc3.FamilyManager.AddParameter("parametername_as_string", DB.GroupTypeId.IdentityData, DB.ForgeTypeId(DB.SpecTypeId.Number), False)

 

(above doesn't work)
 
So to my understanding:
- DB.GroupTypeId is the replacement for BuiltinParameterGroup
- Now so magic is happening ... where or how do I know what ForgeTypeId does / how I construct one etc? Don't tell me read at revitapidocs, did that, don't understand it (yet).
 
 
Since my example isn't working, what am I doing wrong?
Ok, this one does work. But how am I supposed to know this is the way to go?
https://www.revitapidocs.com/2023/87de2c69-a5e8-40e3-3d7a-9b18f1fda03a.htm doesn't show "String" as property ... I'm confused how to get full documentation on this one.

 

settempparam = doc3.FamilyManager.AddParameter("parametername_as_string", DB.GroupTypeId.IdentityData, DB.SpecTypeId.String.Text, False)

 

 
 
 
love python coding
0 Likes
258 Views
1 Reply
Reply (1)
Message 2 of 2

RPTHOMAS108
Mentor
Mentor

This:

 DB.ForgeTypeId(DB.SpecTypeId.Number)

looks wrong since SpecTypeId.Number is itself a ForgeTypeId.

 

The only constructor argument to a ForgeTypeId is string not another ForgeTypeId.

 

You found SpecTypeId.String.Text ok it seems?

 

I don't immediately see the reason for all the nesting, but you can flatten that out by extraction with reflection or SpecUtils.GetAllSpecs.

0 Likes