Create Views, Update View Parameters, Set View Template, and Scope Box from Excel

Hi, i have created the following script to assist with model view creation. I am currently stuck on view templates and scope boxes.

The view template node, changes the value to the first view template in my manage view templates dialog.

The Scope Box Set Parameter is giving me the parameter storage type not a string. even though i have seen a few posts do it this way.

CKR-CreateViewsFromExcel.dyn (55.8 KB)

Any assistance will be greatly appreciated. Thanks.

difficult to say without knowing what data is coming from the spreadsheet

A ‘string from object’ node before feeding into SetParameter or adding a ‘true’ on the ‘ReadAsStrings’ input on the Data.ImportExcel node might help

Andrew

Thanks for the reply @Andrew_Hannell.

So i set ReadAsString to true and it broke the entire script from DataImportExcel.

The data coming in looks like this in Dynamo and will add the excel.

WS-MASTER VIEW LIST - WIP.xlsx (11.3 KB)

on further thought- I think the problem is that you need to feed in a scope box element, not the name

I’ll have a look at it

like this

I will give it a go… the logic in my head goes like this.

  1. Extract all scope boxes from project and List.Create.
  2. List.Map the scope box list with the excel spreadsheet.
  3. Assign scope box to view based on excel list.

I would assume i can follow the same process for ViewTemplates.

You could just tack the dictionary bit from the link onto the end of your graph

the important part is that you are feeding in elements (of scope boxes) to the parameter value not strings

Andrew, you are a super star!! thanks a million.
CKR-CreateViewsFromExcel.dyn (87.2 KB)
ME-MASTER VIEW LIST - WIP.xlsx (11.8 KB)

Scope Boxes - Sorted!

Now i am stuck on the View.SetViewTemplate. I am calling it from a View but the argument is looking for View, View. I dont get this one.

Thanks again for your assistance thus far.

Hi Gary

It is a similar issue- you need to feed the right element type into the node inputs
You are feeding view elements into both the inputs of View.SetViewTemplate- it needs to be views and viewtemplates respectively

@Andrew_Hannell, not sure why but yesterday i tried to apply the same dictionary method to the view templates and it didnt work.

Today i did it again and had great success.

Final script… the error at the end was a ViewTemplate Name i forgot to add to the project.
CKR-CreateViewsFromExcel.dyn (67.2 KB)
WS-MASTER VIEW LIST - WIP.xlsx (11.4 KB)

THANKS AGAIN FOR ALL THE ASSISTANCE. I LEARNED QUITE A BIT HERE! :slight_smile:

no problem, just paying forward the help others have given me on this forum