The ROP Composite Output TOP has by default the text “Overlay $F”, but what I want to put in there is the currently evaluated Wedge Attribute name, parameter, and value. I don't seem to find that anywhere. Checking “Export to Environment” doesn't seem to help.
Is that possible? It should be possible. That information is in there somewhere, right? Is it a $ or a `@attribute` style expression? Is it some python code?
My final goal is to put these up on the left had side of the frame to demonstrate the use of variables in sims when teaching and when prototyping and experimenting.
Overlay current wedge attributes
6647 6 1- kleer001
- Member
- 55 posts
- Joined: Jan. 2006
- Offline
- tpetrick
- Staff
- 600 posts
- Joined: May 2014
- Offline
Work item attributes are always accessed with @attribute.index or pdgattribute(“attribute”, index) when using HScript. For each work item, the wedge node will create:
Those are accessible on the job side as well, e.g. a ROP Geometry can cook a SOP net that contained expressions with PDG attributes in them. If you have a wedge attribute called “scale”, you could put the following in the overlay text for example:
Note that backticks are needed becasue the text field is a string parameter.
If you want a more automated solution that dumps out all wedge attributes, the easiest way is probably to set a Python expression on the overlay text field:
This will query the active work item and then create a multi-line string from the wedge attribute/value pairs.
- The wedgeattribs attribute, which is a list of the attributes created by the wedge
- For each wedged attribute, an attribute with the name specified on the wedge node and the value of the variation for that work item
- If a target parameter was specified, an attribute named <attrib>channel which contains the the target parameter.
Those are accessible on the job side as well, e.g. a ROP Geometry can cook a SOP net that contained expressions with PDG attributes in them. If you have a wedge attribute called “scale”, you could put the following in the overlay text for example:
scale = `@scale`, parameter = `@scalechannel`
Note that backticks are needed becasue the text field is a string parameter.
If you want a more automated solution that dumps out all wedge attributes, the easiest way is probably to set a Python expression on the overlay text field:
import pdg active_item = pdg.EvaluationContext.workItemDep() data = active_item.data attribs = "" for wedge_attrib in data.stringDataArray("wedgeattribs"): val = data.stringDataArray(wedge_attrib) if not val: val = data.intDataArray(wedge_attrib) if not val: val = data.floatDataArray(wedge_attrib) if not val: continue attribs += "{} = {}\n".format(wedge_attrib, str(val)) return attribs
This will query the active work item and then create a multi-line string from the wedge attribute/value pairs.
Edited by tpetrick - Aug. 2, 2019 11:17:12
- kleer001
- Member
- 55 posts
- Joined: Jan. 2006
- Offline
AWESOME! That's exactly what I was looking for.
Weird though, last night I swear I was trying ‘@attrib’ ,but it wasn't working (see my original question). Oh well.
I'll also add that if you want to control the floating point representation printed on the overlay you can use:
Weird though, last night I swear I was trying ‘@attrib’ ,but it wasn't working (see my original question). Oh well.
I'll also add that if you want to control the floating point representation printed on the overlay you can use:
val = round(float(str(val)[1:-1]),3) attribs += "{} = {}\n".format(wedge_attrib, str(val))
Edited by kleer001 - Aug. 2, 2019 13:30:11
“If you can eat it raw you can't under cook it”
- SuekieZA
- Member
- 12 posts
- Joined: Feb. 2018
- Offline
- tpetrick
- Staff
- 600 posts
- Joined: May 2014
- Offline
- SuekieZA
- Member
- 12 posts
- Joined: Feb. 2018
- Offline
- tpetrick
- Staff
- 600 posts
- Joined: May 2014
- Offline
The script on the overlay text is being set a string value, not as an expression. You need to right click on the parm and go to “Edit Expression” and set the expression contents. Then, set the expression language to Python instead of HScript.
I've attached an updated version of the .hip file. I also fixed the output path on the overlay text so that it doesn't use the same file name for different wedges.
I've attached an updated version of the .hip file. I also fixed the output path on the overlay text so that it doesn't use the same file name for different wedges.
-
- Quick Links