Jump to content

using python to control color node, bounding box problem

Recommended Posts

Hello, I got two specific questions in simulation right now, as they were described in title.

First, I want to use python node to program a few lines of statement that could add color points on the ramp of my color nodes, since I need to add 200 points in order to give my geometry layers of different colors.
(I only know the syntax of how to set node's attribute values with Python, but I did not find out the syntax that can tell the node automatically add points)
Also, as my first screenshot shows, I want to know how to set values to color vector, since color parameter's name is “rampcr#rampgr#rampbr#”, I don't know how to syntax that with values and expressions.

The second question is about generating a bounding box in order to delete exactly half of my volume, but I want the effect operated in the end of my network, because I want the color be set well(i.e. color changes from shell to shell of my spherical volume), and then cut it half, make the cross section of my spherical volume be seen, so that the rings of different colors could be seen more obviously~
I used a delete node as the second screenshot shows, but it did not work, it seems all my volume was disappeared, the whole volume was ghosted in the scene so that you can see what I constructed. I don't know if I set something wrong or I should use another node to achieve my final effect?

It is ok if you can only solve one of my questions, I would be grateful. Thanks a lot in advance!

Screenshot (72).png

Screenshot (74).png

Share this post

Link to post
Share on other sites

for slicing the volume, there is a node "Volume Slice" it should work fine. 

it just give you a plane :/ idk if that works for you, maybe if you convert that volume into vdb then use "vdb combine" to substract.

and for the python code that you are looking for, i found this 


hope it helps.
Good luck :)

Edited by esnaacho
  • Like 1

Share this post

Link to post
Share on other sites

I found the answer to my first question somewhere else, I will share here~

The color attribute in color node can be set with specific expression by using a statement like:  parms[i+3].setExpression('point("../attribwrangle", $F, "waterCd{}", 0)'.format(j))

The whole script worked on my color node is attached as the screenshot~

Hope someone can take it as a reference in the future!

Screenshot (80).png

  • Like 1

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now