Jump to content

using python to control color node, bounding box problem


CatherineKan

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

Link to comment
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
Link to comment
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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...