Hi Guys,
I am reading data in from a JSON file and attempting to store it in a detail attribute and then read back a lookup value in a wrangle. The JSON data looks like this.
{
"DOM_IDS":[
{
"DOM_ID": "00",
"PATTERN": ""
},
{
"DOM_ID": "01",
"PATTERN": "13"
},
{
"DOM_ID": "02",
"PATTERN": "11,15"
}
]
}
The code to push that to a detail attribute looks like this for me ...
node = hou.pwd()
geo = node.geometry()
import csv, json
file = node.evalParm("data_dir")+node.evalParm("json")
dom_dict = {}
with open(file, 'r') as json_file:
dom_dict = json.load(json_file)
geo.addAttrib(hou.attribType.Global, "dom_dict", {}, 0, 0)
geo.setGlobalAttribValue("dom_dict", dom_dict)
This works .. but I have no idea if this is formatted correctly
The detail attribute has this value ...
{"DOM_IDS": [{"DOM_ID": "00", "PATTERN": ""}, {"DOM_ID": "01", "PATTERN": "13"}, {"DOM_ID": "02", "PATTERN": "11,15"}]}
Can anyone tell me how to access a given PATTERN using the DOM_ID as a key (using an attribute wrangle) ??
Thanks a lot !!!
Mike