Stress attribute in vellum solver and how to use?

   6473   27   1
User Avatar
Member
767 posts
Joined: April 2014
Offline
I would like to know how I can use the stress attribute within the vellum sop solver. I thought it was a matter of diving into the vellum sop solver adding a wrangler then placing in some code for an example a condition that checks if the @stress attribute is greater then a float parameter then add those points to a group. I tried this and it didn't work ?
【T】【C】【S】
User Avatar
Member
9379 posts
Joined: July 2007
Offline
f@stress is a prim attribute on the constraints
each point can have multiple constaints attached, so you may want to compute f@stress attribute on the geo yourself based on your metrics, like find all stretch constraints attached to the point and get max stress, or get bend constraints, etc.
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
767 posts
Joined: April 2014
Offline
tamte
f@stress is a prim attribute on the constraints
each point can have multiple constaints attached, so you may want to compute f@stress attribute on the geo yourself based on your metrics, like find all stretch constraints attached to the point and get max stress, or get bend constraints, etc.

Do you have any examples of code ?
【T】【C】【S】
User Avatar
Member
9379 posts
Joined: July 2007
Offline
technically only thing you need to do is to include Vellum Post Process in your SOP Solver, since that already can compute them quite efficiently so no need to reinvent the wheel
Just make sure to turn Apply Welds Off, to just make it compute the attributes
You can also uncheck any attributes you don't need as computing some of them may have some small impact on the speed, but if you keep just stretch_stress and bend_stress those are almost free as the stress is already on constraints
Edited by tamte - Jan. 7, 2023 19:46:52

Attachments:
ts_vellum_stress_to_points.hipnc (567.0 KB)

Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
767 posts
Joined: April 2014
Offline
For the DOP Import where are you retrieving the name for the constraints name ?
【T】【C】【S】
User Avatar
Member
9379 posts
Joined: July 2007
Offline
It's just copied default dopimport that lives in SOP Solver
So it already references the current DOP object etc and the only thing needed is to point it to ConstraintGeometry data instead of the data specified at SOP Solver which the default does
And this is done in Geometry Data Path parameter if you compare those 2
Edited by tamte - Jan. 7, 2023 22:23:18
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
767 posts
Joined: April 2014
Offline
For the DOP Import Records, I see there is a parameter for the Data Path. Although, even if I simply type "Geometry Constraints" in this parameter field; I still do not get where you are getting the name from ?

Instead of copying, as you did; what would be the path for the DOP Network parameter field and the Objects parameter field; no difference whether manually entered or copied ?
Edited by _Christopher_ - Jan. 7, 2023 22:48:14
【T】【C】【S】
User Avatar
Member
9379 posts
Joined: July 2007
Offline
_Christopher_
I still do not get where you are getting the name from ?
ah, the name is just the name of the Data I want from vellum object

in DOPs DOP Object contain data which can be geometry, volume field or other types
each data has a name and they can be hierarchically nested

if you open Geometry Spreadsheet at DOP level you will see the hierarchy

Vellum holds and modifies first input geometry in data named Geometry
and the second input geometry which are constraints in data named ConstraintGeometry
that's why I'm using that name

Attachments:
vellumobject_data.png (18.8 KB)

Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
9379 posts
Joined: July 2007
Offline
_Christopher_
Instead of copying, as you did; what would be the path for the DOP Network parameter field and the Objects parameter field; no difference whether manually entered or copied ?
you can MMB on the label and you will see
but its not convenient to hardcode those hence the expressions
especially because one SOP Solver can run over multiple objects so that expression makes sure it will return correct objectid of the object it is currently processing, which hardcoded value couldn't do
but as mentioned you can just copy the default as the only thing you need to get is different data, same dopnet, same object
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
767 posts
Joined: April 2014
Offline
If I wanted to type it in manually I just use an expression which I assumed but decided to just ask. 😉
【T】【C】【S】
User Avatar
Member
9379 posts
Joined: July 2007
Offline
no problem typing it manually if you have it acting on just 1 DOP object, but may be annoying to have them hardcoded especially once you decide to copy that setup and use in another DOPnet

DOPnet would be just path to the dopnet, absolute or relative
so in that file it would be /obj/geo1/vellumsolver2/dopnet1 or ../..

as far as Objects it is either internal objectid or object name
so in this case 1 or vellumobject1

however sometimes yes, you would type it in manually or use different expressions that get object id based on DOP node or something
for example if you want to dopimport from other objects than currently processed one
Edited by tamte - Jan. 7, 2023 23:13:11
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
767 posts
Joined: April 2014
Offline
This was helpful. Atleast now I can write out constraints as attributes and work with them at the sop wrangler level. Although I was wondering is there another way to do this ? 😉
【T】【C】【S】
User Avatar
Member
9379 posts
Joined: July 2007
Offline
_Christopher_
Although I was wondering is there another way to do this ? 😉
There is plenty of ways, it really depends on what is the goal
This is just getting some reduced values from constraints based in the geo point they are attached to (with some extra redirection for welds)

To get the stress values that already live on constraints tou can do the same in POP Wrangle or Geometry Wrangle DOP
However then you'd have to write some code
Using Vellum Post Process in the solver has the advantage that it works and no extra code is necessary even though feel free to look inside if you are interested in the code
Edited by tamte - Jan. 7, 2023 23:26:42
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
767 posts
Joined: April 2014
Offline
Geometry wrangler DOP as in a wrangler inside a DOP network ?

Do you have any code or resources to which the same could be done as you mentioned using the POP or Geometry Wrangler in DOPS ?

I want to group all the points which are effected by a stress attribute. Therefore since it's dynamic, I place a wrangler inside of the SOP Solver after the Vellum Post Process node with the following vex code; but I don't see none of the points which are effected based on the float parameter being added to the stress group ?

if(@bend_stress > chf("BendStressAngle")){
@group_bendyStress;
};
Edited by _Christopher_ - Jan. 8, 2023 09:30:45
【T】【C】【S】
User Avatar
Member
173 posts
Joined: Aug. 2017
Offline
with Constraint..no Clue where i found.

Attachments:
Stress.hipnc (1.1 MB)

Conservation of Momentum
User Avatar
Member
9379 posts
Joined: July 2007
Offline
_Christopher_
I want to group all the points which are effected by a stress attribute. Therefore since it's dynamic, I place a wrangler inside of the SOP Solver after the Vellum Post Process node with the following vex code; but I don't see none of the points which are effected based on the float parameter being added to the stress group ?

if(@bend_stress > chf("BendStressAngle")){
@group_bendyStress;
};
that code doesn't do anything since you are not assigning 1 or 0 to that group binding, hence you are not setting the group membership but merely reading the current one

also bend_stress is not measuring the angle directly but you can use the bend_angle attribute also

i@group_bendStress = f@bend_stress > chf("BendStress");
i@group_bendAngle = f@bend_angle > chf("BendAngle");
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
9379 posts
Joined: July 2007
Offline
_Christopher_
Geometry wrangler DOP as in a wrangler inside a DOP network ?
Do you have any code or resources to which the same could be done as you mentioned using the POP or Geometry Wrangler in DOPS ?

so instead of that SOP Solver create POP Wrangle or Geometry Wrangle DOP
- set Inputs/Input 2 to DOP Data
- set DOP Data to: ConstraintGeometry
- check Use This Object's Data
this way whichever function in the wrangle refers to 2nd input, like prim(1, ...) it will refer to ConstraintGeometry of the same vellum object
and this would be the code to get maximum stretch and bend stress from the corresponding constraints attached to the point
#include <pbd_constraints.h>
int pt = weldTarget(0, @ptnum);

f@stretch_stress = 0;
f@bend_stress = 0;
int constraints[] = pointprims(1, pt);

foreach(int cns; constraints){
    float stress = prim(1, "stress", cns);
    if (inprimgroup(1, "@type=distance" ,cns)) f@stretch_stress = max(f@stretch_stress, stress);
    if (inprimgroup(1, "@type=bend" ,cns)) f@bend_stress = max(f@bend_stress, stress);    
}

but again, just use the SOP Solver with Vellum Post-Process as that's future proof since the code for computing the stresses and other values is managed by SideFX
Edited by tamte - Jan. 8, 2023 16:46:57
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
767 posts
Joined: April 2014
Offline
tamte
_Christopher_
I want to group all the points which are effected by a stress attribute. Therefore since it's dynamic, I place a wrangler inside of the SOP Solver after the Vellum Post Process node with the following vex code; but I don't see none of the points which are effected based on the float parameter being added to the stress group ?

if(@bend_stress > chf("BendStressAngle")){
@group_bendyStress;
};
that code doesn't do anything since you are not assigning 1 or 0 to that group binding, hence you are not setting the group membership but merely reading the current one

also bend_stress is not measuring the angle directly but you can use the bend_angle attribute also

i@group_bendStress = f@bend_stress > chf("BendStress");
i@group_bendAngle = f@bend_angle > chf("BendAngle");

Thanks, although the group; bend_stress is not having any points assigned to them, is it because the values in the attribute bend_stress are extremely low to the decimal place so to speak ?
【T】【C】【S】
User Avatar
Member
9379 posts
Joined: July 2007
Offline
_Christopher_
Thanks, although the group; bend_stress is not having any points assigned to them, is it because the values in the attribute bend_stress are extremely low to the decimal place so to speak ?
yes, check Geometry Spreadsheet to see what values you are getting, they may be tiny so you need to work within those ranges
that's why stretch_distance, stretch_ratio and bend_angle may be more intuitive attributes to work with
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
767 posts
Joined: April 2014
Offline
tamte
_Christopher_
Geometry wrangler DOP as in a wrangler inside a DOP network ?
Do you have any code or resources to which the same could be done as you mentioned using the POP or Geometry Wrangler in DOPS ?

so instead of that SOP Solver create POP Wrangle or Geometry Wrangle DOP
- set Inputs/Input 2 to DOP Data
- set DOP Data to: ConstraintGeometry
- check Use This Object's Data
this way whichever function in the wrangle refers to 2nd input, like prim(1, ...) it will refer to ConstraintGeometry of the same vellum object
and this would be the code to get maximum stretch and bend stress from the corresponding constraints attached to the point
#include <pbd_constraints.h>
int pt = weldTarget(0, @ptnum);

f@stretch_stress = 0;
f@bend_stress = 0;
int constraints[] = pointprims(1, pt);

foreach(int cns; constraints){
    float stress = prim(1, "stress", cns);
    if (inprimgroup(1, "@type=distance" ,cns)) f@stretch_stress = max(f@stretch_stress, stress);
    if (inprimgroup(1, "@type=bend" ,cns)) f@bend_stress = max(f@bend_stress, stress);    
}

but again, just use the SOP Solver with Vellum Post-Process as that's future proof since the code for computing the stresses and other values is managed by SideFX

The geometry wrangler is just that; not a dop network with a geometry wrangler ? The geometry wrangler seems almost identical to an attribute wrangler, although I know is isn't the same.
【T】【C】【S】
  • Quick Links