Jump to content

How to get all fields


Macha

Recommended Posts

Still none the wiser but I found the following python code in the sopsolver of the Gas Resize Fluid DOP:

" ".join("../../..:" + y for y in ch("../../refobject").split())

Could that be of any help? Not sure what's going there.

Link to comment
Share on other sites

" ".join("../../..:" + y for y in ch("../../refobject").split())

Apparently you can plug in multiple dynamic objects when using the gas resize, based on this code. It's simply expanding each object entered to ../../..:{object} (without curly brackets). For example, if you enter "a b" into the Dynamic object parameter, this expression will expand it to "../../..:a ../../..:b" in the object_merge.

Perhaps you can do something like this in a similar setup

pyro = pwd().parent().parent().simulation().findObject("pyro")
if not pyro:
    return " "
strexp = " ".join("../../..:" + y for y in [field for field in pyro.subData().keys() if "Field" in pyro.subData()[field].dataType()]
return strexp

This would merge in all data which contains "Field" in it's data type, ie: SIM_ScalarField, SIM_IndexField, SIM_VectorField

Edited by static
Link to comment
Share on other sites

that's very useful. thanks Static :)

Apparently you can plug in multiple dynamic objects when using the gas resize, based on this code. It's simply expanding each object entered to ../../..:{object} (without curly brackets). For example, if you enter "a b" into the Dynamic object parameter, this expression will expand it to "../../..:a ../../..:b" in the object_merge.

Perhaps you can do something like this in a similar setup

pyro = pwd().parent().parent().simulation().findObject("pyro")
if not pyro:
    return " "
strexp = " ".join("../../..:" + y for y in [field for field in pyro.subData().keys() if "Field" in pyro.subData()[field].dataType()]
return strexp

This would merge in all data which contains "Field" in it's data type, ie: SIM_ScalarField, SIM_IndexField, SIM_VectorField

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...