Duplicating Revit families based on Excel sheet data

I am trying to create a script to duplicate an item multiple times, where it could get each time its Width, Depth and Height from an excel sheet. Based on my current script, I achieved the result I want to see in Revit. However, when I run the script it is still showing me an error. Something about dereferencing a pointer. Any suggestion is truly appreciated!

Show the list that’s being inputted into the “Convert Between Units” node. Need to find out what is causing that error and fix that first.

Hi Staylor,
The previous post wasn’t showing clearly. Here is the first portion of the script :

What is the warning on the concert units node?

Here is what it says

Put a watch node on the data coming into it. My gut says you have a null or other data point that doesn’t belong.

You’re right. Anything after 455 has a null value. Any idea how to fix it?

Clean out the excel data, or use a List.Clean node.

Careful with the later as it can cause issues if you remove something g midway through the list.

It gave me a different error now…

Use the list clean from Genius Loci. But as @jacob.small eludes to, be careful, as you could possibly affect your list indexing.

FYI…Even when I remove the “Convert Between Units” node, the error at the “Set Parameter By Name” node remains

The error at the Set Parameter nodes may be a completely different error now. If you bypass the unit conversion, then show us your graph and tell us what the errors are that you are getting. It’s difficult for us to determine without seeing the results of the nodes prior to the ones giving the errors.

Hi again Samuel.
Here is the error that shows at the SetParameterByName Node

Was that with or without the unit conversion node? If with, has that error been corrected?

If without, then it’s still probably a null value in the list that you are feeding into the “value” input of the set parameter nodes. You will still need to use the List Clean or fix the null values in the spreadsheet as @jacob.small stated.

To clarify my previous comment above, we need to see the lists that are being fed into the set parameter inputs. Use watch nodes to show that.

EDIT…EDIT
Most common errors are caused by incorrect information being inputted into them. So in this case, we need to see the element list coming from the Duplicate node and the list of values in order to see what is causing the error that you are getting.

Noted. Here is some progress! I added a List.Clean Node and there is no errors anymore at the SetParameterByName node. However, the error still shows at the Convert Units node.

I then tried to add another Clean List node. I’ll show what I got in the following post :

Here is what I got after adding the other Clean List node before the Convert Unit node :

I think we’re very close!

I’m guessing that your parameters are all set to take doubles as you’re attempting to convert data types. I’m also guessing that you have a string (word) in that data set; perhaps one representing a number (ie "1" instead of 1).

The Object.Type node should confirm. Numbers should be either integers or doubles. If you have a string you’ll either have to clean the excel, or convert them into numbers with a String.ToNumber node (if possible - not all strings can be made numbers).

The first error is being caused by you inputting strings into the unit conversion that only accepts doubles or integers. So you will need to rework your input list to remove those strings. Due to strings, the unit conversion is returning nulls for those items because it can’t convert them and in conjunction throwing the error. When when you inserted the list clean after the unit conversion node, you basically cleaned out all those nulls which in turn removed the error being reported by the set parameter node.

image

Thank you both!! @staylor @jacob.small You were totally right. It was reading strings into units and showing them as null. What I was doing wrong is that I was kind of bulk converting all of the lists together. I had to add multiple ConvertUnit nodes AFTER each list (that are all doubles and have no null values) rather than one node before . Hence the result. Thanks again. You are the best!

2 Likes