Plot xyz into color image

Hi all,

I’m working on a stadium design tool and I have calculated the c-value (a value that says something about sight quality) for a number of XYZ points in the stadium. Now, I want to create a 2D color plot using the X and Y coordinates for the location of these points, and the C-value that determines the color. To do so, i have found a time consuming workaround. I place simple disc-shaped 1-point adaptive components in a Revit project, and I write the c-value corresponding to that point to a parameter instance parameter called c-value. Then I use some color filters in the view to create the image I want (see attachments).

My question: is there a simple way to use some python script for creating such an output?

I came across this library (http://matplotlib.org/ ), but I don’t know exactly how to use it within a python script node, and where to locate the library on my computer, as I’m a beginner level programmer.

This example seems easy and promising for my purpose.

http://matplotlib.org/examples/mplot3d/2dcollections3d_demo.html

Hope you guys can help me out here!

Best,

Jesse Mom

output image

 

Theres a few ways to do this:

You can use Revit’s analysis visualization framework to plot colored points. Theres some nodes for this, not sure how they are working in .7.

You can use matplotlib, but I’m not sure it’s supported through iron python…

We don’t have color overrides in the current visualization engine of Dynamo but it’s in development in the BloodStone branch on github.

What is your intended output, image files? If so and you want to use python you can find some python library for drawing that is supported in iron python.

Using your existing adaptive component placement workflow, you can then use the visibly/graphics color override node (can’t remember the exact name) to recolor the families. You can see a sample of this kind of workflow in the Revit_color sample in the help menu.

Thanks for your responses Michael and Zach. To Michael, yes my intended output is an image file. As said, I don’t know exactly how to use a library in the iron python environment at all, as I’m not very experienced (but very eager to learn!) in programming. So if you can hook me up with a brief workflow of importing a library and making use of it’s methods within the dynamo environment, that would be great.

To Zach, the problem with my existing adaptive component placement workflow is that the placement of these simple components is time consuming. it increases my runtime from 1 minute without placing components to 20 minutes with placement of components. That’s the reason that I would like to generate an image or plot directly from dynamo.

So again, can anyone think of a way to do this?

Thanks in advance!

Jesse Mom

If you already have the components placed, you don’t need to recreate them every time. As long as your AC has an adaptive point, you could use something like the Lunchbox’s AC collector to get that point’s location.

Following Zach’s suggestion, I’d try the following workflow:

2014-09-16_135558

 

 

 

 

 

color by distance

 

Thanks Dimitar,

I think this partially improves performance, since I want to enable the user to try different stadium configurations, which can drastically change the number of adaptive components in each run. But thanks for the effort you’ve put in to it.

Can I conclude that it is a pain to use external libraries, since you guys keep recommending to use the Revit workaround?

Best,

Jesse

In general it is a pain to find third party libraries that have full support in iron python if they were originally written for the “real” python implementation. I don’t have one to recommend, but using it wont be so bad. You’ll need to place it somewhere that the iron python engine will be looking for .py files, or add that path to the sys.path variable, and then import from it just like normal.

check this one out.

this may also help, if you just want to manually draw into a windows.forms popup window without other plotting libraries, then you should be able to save the window as an image somehow. (unsure)

Michael, thanks for your reply. I will definitely check it out. In the meantime, I wrote my own Matlab plotter and compiled into an .exe file. This works great and is much faster. the downside is that it requires a manual action (starting the .exe) I tried to start this from within a python script node, but that failed.

It works as follows: Dynamo writes XY and C values to an excel file. the matlab script reads this data and plots it into a figure. The matlab output looks as follows (quite similar to the revit output):

Image

Very nice! You should be able to use subproccess.call or system() from iron python but I think you need to point iron python to the iron python install directory so you can import those built in libraries.

something like sys.path.append(“c:\ironpython\lib”)