Renaming a family type

Hi all,

I have a question: how can I rename a family type or add a family type to a family?
I’m trying to create footings by using input from excel. And it’s working but I’m not able to rename te family type.
And come to think of it…I need to create a new one from the current one I selected.
So basicly I need to duplicate and rename the selected family type.
How is this done?

I’ve tryed using Element.SetName but though it gives a name at the output “Success” it is not the name that it should have been given by the input of the node.

1 Like

You need to get a Type object from the instance and then you can set its name like so:

import clr
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

TransactionManager.Instance.EnsureInTransaction(doc)
output = UnwrapElement(IN[0]).Name = IN[1]
TransactionManager.Instance.TransactionTaskDone()

#Assign your output to the OUT variable.
OUT = output

For creating a new FamilyType I think the best option would be to actually get the FamilyManager and use the NewType and RenameCurrentType methods. That’s a little more complicated than just renaming a family type.

1 Like

@Konrad_K_Sobon I think @Mike_Wellink is looking to change parameter values and set the type name based on the modified values.

2 Likes

That looks pretty good. Also, yeah, FamilyType.Duplicate is another possibility as it takes a name input. I like that approach.

Both @Konrad_K_Sobon and @Kulkul thanks for your help.

I’m going with Kulkul’s method… but I can’t get it to work. I get the error: “The parameter’s storage type is noet a string”.
And How do you set the lacing to “Auto”??? Or didn’t I pay enough attention in class and is that the standard “shortest” notation?

@Mike_Wellink Show me expanded values of all the nodes.

Sure! Here you go.

@Mike_Wellink Do this changes then your good to go. You where assigning string values. Parameter storage types is double.

Is it possible to use a input list? So I can rename more than 1 item.

1 Like

Hi,

I used the Python Script you provided but I can only rename one type at a time… Is there a way to enable it to rename multiple types?

So sorry, I’m totally new to Python…

Btw, this is the warning I get when I select multiple items:

Thank you!

Jahzeel

@snnybsch, if you are also renaming multiple family types like me, the Element.SetName node from Clockwork package works.

Sorry all for continuing this topic. :confused:

6 Likes

The solution is 404’d… Can the image be uploaded to the forum?

2 Likes