Test for family parameter & run a portion of the script

I want this script to run from Dynamo Player multiple times with the user changing the input values for each run. This script creates a means of toggling the visibility of keyplan areas based on the value of KeyplanAreaToggle in family instances. A second script give the user control over which sheets have their keyplan area visible.

My problem occurs when running the script more than one time. The parameter that drives keypla area visibility is created in Step 1 and formulas that control which keyplan area is made visible in titleblock family instances are created in Step 2. After the first run, a second run may or may not complete (I have not nailed down why this is). The script does not fully execute when it recognizes that the KeyplanAreaToggle parameter already exists.

I have been searching and testing but have not found a way to test if the family document parameter “KeyplanAreaToggle” exists. If it does not exist, do Steps 1 & 2. If it does exist, do Step 2 only.

Thanks in advance.

You could try something like this, the If node will pass the string of the parameter you want to make if it doesn’t exist, if it does exist it passes that integer and makes the FamilyDocument.AddParamter node have an error and not create the parameter.

1 Like

Thank you, @tom123.

It didn’t like the number node going into the “true” input of the If node. I replaced it with a string node with a “0” value. It is working nicely.

1 Like