Import Folder of Images, Each To A New Drafting View

First time posting here. I have found so much help already on this idea of mine but I am falling sort on finishing it off. Full disclosure. I am modifying the work of KONRAD K SOBON that he did at this post http://dynamobim.org/forums/topic/is-it-possible/

I am trying to do a little different thing though. I want to import all the image files from a specific directory into individual drafting views and name the drafting views with the same name of the image file. This works with the attached script for a single file at a time. I am asking the community what I am missing when it comes to making it batch run. Currently the only issue I am experiencing is the API command wont import from a list. The creation of the views works perfectly but the importing of the file doesn’t happen. I get this error

File “<string>”, line 45, in <module>

TypeError: expected View, got List[object]

Import Folder of Images, Each To A New Drafting View

I really appreciate any help that you might be.

-Alex

1 Like

Hi Alex,

You’ll need to create a loop through each element in the lists. The simplest way to loop through both the views and the image file paths at the same time is with the zip() function in python:

 

1 Like

How the crap do you know all this stuff!!! That works fabulously!!! I’ve attached the final dynamo file for others use.

Import Folder of Images, Each To A New Drafting View

Thank you so much!

2 Likes

great job everyone!