Skip to content

Commit 95f5f22

Browse files
author
jtomori
committed
added DOPs examples for accessing fields and volumes
1 parent c5cdf1a commit 95f5f22

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ It is the best to check all the nodes with open *Geometry Spreadsheet* and *Cons
3434
* [VOPs / Using Inline Code](#vops--using-inline-code)
3535
* [DOPs / Volumes workflow](#dops--volumes-workflow)
3636
* [DOPs / Gas Field Wrangle](#dops--gas-field-wrangle)
37+
* [DOPs / Gas Field Wrangle - accessing DOPs and SOPs data](#dops--gas-field-wrangle--accessing-dops-and-sops-data)
3738
* [DOPs / Geometry workflow](#dops--geometry-workflow)
3839
* [DOPs / Geometry Wrangle](#dops--geometry-wrangle)
40+
* [DOPs / Geometry Wrangle - accessing fields](#dops--geometry-wrangle--accessing-fields)
3941
* [Conditions](#conditions)
4042
* [Loops](#loops)
4143
* [Stopping For-Each SOP from VEX](#stopping-for-each-sop-from-vex)
@@ -514,6 +516,31 @@ f@pig_in *= .9;
514516
```
515517
<br>
516518

519+
#### DOPs / Gas Field Wrangle - accessing DOPs and SOPs data
520+
521+
```C
522+
// it is also possible to access DOP fields using this syntax
523+
// we can sample "pig_mask" without setting the field "Inputs"
524+
525+
float pig_mask = 0;
526+
// the following lines bellow are identical, the second and third ones are more flexible as they refer to relative path,
527+
// it will work even if we renamed this DOP network, the first line would not work after that
528+
// the second argument is either an int representing primitive number, or string representing primitive name
529+
// the syntax for accessing DOP data is: op:/DOP_path:dop_object/field_name
530+
531+
pig_mask = volumesample("op:/obj/examples/dopnet_vex_vops_volume:volume/pig_mask", 0, v@P);
532+
//pig_mask = volumesample("op:" + opfullpath("../") + ":volume/pig_mask", "pig_mask", v@P);
533+
//pig_mask = volumesample("op:../" + ":volume/pig_mask", 0, v@P); // op: syntax also accepts relative paths
534+
535+
// we can also directly access SOP volumes using this syntax
536+
//pig_mask = volumesample("op:../../IN_VOLUMES", 1, v@P);
537+
538+
f@pig_in *= 1-pig_mask;
539+
```
540+
![Gas Field Wrangle - DOPs and SOPs data](./img/gas_field_wrangle_dop_sop_data.jpg)
541+
542+
<br>
543+
517544
#### DOPs / Geometry workflow
518545
Here I will show basic steps of creating a simple custom DOP solver operating on volumes.
519546

@@ -541,6 +568,24 @@ v@P *= 1.1;
541568
```
542569
<br>
543570

571+
#### DOPs / Geometry Wrangle - accessing fields
572+
[link to explanation](#dops--gas-field-wrangle--accessing-dops-and-sops-data)
573+
```C
574+
// we can also access DOP fields from Geometry Wrangle, it is explained in:
575+
// /obj/examples/dopnet_vex_vops_volume/gasfieldwrangle_accessing_DOPs_and_SOPs_data
576+
577+
// all following lines will produce the same result
578+
float mask = 0;
579+
mask = volumesample("op:../" + ":box/pig_mask", 0, v@P);
580+
//mask = volumesample("op:" + opfullpath("../") + ":box/pig_mask", "pig_mask", v@P);
581+
//mask = volumesample("op:../../IN_VOLUMES", 1, v@P);
582+
583+
// visualize what points sampled non-zero density in the volume
584+
if (mask != 0) v@Cd = {1,0,0};
585+
```
586+
587+
<br>
588+
544589
#### Conditions
545590
```C
546591
// it there is only one operation after if condition, this operation

examples.hipnc

22.6 KB
Binary file not shown.
244 KB
Loading

0 commit comments

Comments
 (0)