Im trying to set parameters in a revit family named “Tank Parameter Test”
Hi @gavin.hazlett ,
Could you share what dating is going through the nodes and what the error message is? Most of the times if you read the error message well you can easily spot what the issue is
Here is the error message:
Warning: FamilyDocument.SetParameterValueByName operation failed.
Value cannot be null.
Parameter name: familyType
For the python script I created a script that creates a GUI that asks for input values for the parameters heres the code:
import clr # import windows form clr.AddReference("System.Windows.Forms") # import system drawing clr.AddReference("System.Drawing") # import system import System from System.Windows.Forms import * from System.Drawing import * # Create a Class Form def CreateMyForm(): form1 = Form() form1.Text = "Tank Values" # Update the title here label = Label() label.Text = "Tank Diameter (in.):" label.AutoSize = True label.Location = Point(10, 10) textbox = TextBox() textbox.Location = Point(label.Right + 5, label.Top) textbox.Size = Size(100, 20) applyButton = Button() applyButton.Text = "Apply" applyButton.Location = Point(10, form1.ClientSize.Height - 10 - applyButton.Height) applyButton.DialogResult = DialogResult.OK applyButton.Click += lambda sender, event: form1.Close() # Close the form when Apply button is clicked form1.AcceptButton = applyButton # Set the AcceptButton to be the Apply button form1.Controls.Add(label) form1.Controls.Add(textbox) form1.Controls.Add(applyButton) form1.Size = Size(300, 300) form1.ShowDialog() if form1.DialogResult == DialogResult.OK: enteredValue = textbox.Text return enteredValue # Return the value entered in the text box return None if IN: enteredValue = CreateMyForm() OUT = enteredValue
It seems like either the FamilyType you supplied doesn’t exist or the value you are supplying through the Python Script is null.
If that is not the case for both show what data is going through each node
The value seems to be null even though it is stored in the python script block for some reason also I am not sure what is meant by family type… i just supplied a string with the name of the revit family
Share the dyn file please
Hola Amigo @gavin.hazlett buenas. This is very Confusing, but nodes in revit are very “Veddetes” When it comes to names, values and data types of Parameters and Families, you have to be very careful when supplying the information! I hope this helps you!!
Thank you! it works
Amigo @gavin.hazlett Glad to hear that you manage broo; Welcome to the dark side!!