Export schedule columns to Python array

Hi there, it is me again.

I am currently working on the automation of Revit schedules export by using Dynamo and Python.
The aim of this is to generate a list of quantities based on the famillies used in Revit.

I would like to transfer each column of the schedule to a specific Pyhon arrays.
Those arrays will be processed later in Python to count different quantities.

I hope my explanation is clear enough.
And thanks for your help.

Regars,
Clement

It’s certainly possible; the big question is: on what basis do you want to split the data?

Just to make sure, I assume you mean using Python within Dynamo with that.

My schedules would be formatted with a standard procedure it will result in a certain number of columns.
Those columns should be transformed in a python array.

You are right, it would be a Python script inside Dynamo.

Maybe the best way is the cut this process in two parts.
The first one would “parse” the schedule and have the arrays as output variables.
The second would search those arrays for matching results, calculate the quantities based famillies and finally export to a existing Excel file (on a second sheet).

Yes. But do you have a list of names or something on which basis you’d want to split it?

I don’t really understand what you mean :confused:

You’re importing lists of data right?
Is one of those which contains strings like “length”/“width”/“pressure” or parameter names or something alike.

Maybe if you show a sample of what you currently have it will be easier to assist you? :slight_smile:

Well, currently I don’t have much to show yet.

I am still trying to simply read the current schedule and export in Excel based Read data in Pre-created schedule in Revit. Unfortunately, this alread fails…

I think what you’re giving as input is more interesting.

1 Like

Added some more Watch nodes.
The python script is from the topics linked in my post above.

Well… the Code Block node is mandatory.
That part is fixed.

But fails when trying to use the active view of the document

If I look at the link you provided I’d say you should attempt to pass “Document.Activeview” into the codeblock and see what happens.

@Jonathan.Olesen thanks for the hint but unfortunately this does not work neither.

The output of ScheduleField.Name is correct “Nomenclature des canalisations” but the input of the code block is completly wrong. It seems that it only kept the first char of the complete string “N”…

Little-bit different approach:

I believe your issue is that you, while you are getting your schedule name, your not getting the “object” itself. Thus you cannot use python to “export” attributes from the object, which your code does.

Well, the node schedules on sheets only list the schedule which are used in a sheet.
What I want to do is, user opens a schedule then click the script button which will work on the active schedule.

How about this:

What makes you think that the code block is mandatory? When I look in your link the code block is used to choose the first of the schedules from the “Get All Views” node.

1 Like

Document.ActiveViewFromCurrentDocument returns null :confused:

Try a restart of your system :slight_smile:

A restart was indeed needed.

I reviewed the way I will process the data.
I will export all I need in a Excel document.
Do you know how to write the data on the same sheet using Write To Excel?

Thanks.

Considering your original question was answered, please mark the comment that solved it as solution so others with similar problems might be able (and maybe leave a like here and there).
If you want to know how to send calculated data towards excel I think it’s better to create a new topic for that to keep the forum tidy.

1 Like