Hi all,

I am looking for help to convert text number to number in grasshopper calculation, please see the screenshot below.

Thanks in advance!

Peiming

Hi all,

I am looking for help to convert text number to number in grasshopper calculation, please see the screenshot below.

Thanks in advance!

Peiming

Just connect the `Start`

output to wherever you need it - it is already a number. In general you should **not** pass your data through panels, since that converts the data to text, after which it needs to be converted back. So just directly use the outputs in your calculations

Right. I tried that but it didnt work out for me… or maybe something else went wrong… I attached the files. Would you be willing to take a look at them? Thanks.1.3dm (10.7 MB)

1.gh (7.1 KB)

You have four faces that generate very large negative numbers. Because of that the majority of your mesh will be colored with the red, as you see currently in your setup.

Instead of multiplying your tangent results with `100`

, then figuring out some domains and so on you should just directly pipe your tangents into the gradient, and set the lower and upper limits to `0`

and `1`

respectively.

You’ll still have the four faces generating very large negative numbers, but those will just evaluate to the lower limit of your gradient.

yields

Okay. No wonder it doesn’t show thing even connecting the right way. But what I’m trying to do is to calculate different slope percentage such as 5%, 10%, 30% and so on and be able to color them to see the changes. Is there a way to do this with this model though? Cause this is my site and I’m trying to analyze it. Or should I try to use surface rather then mesh, but can I still get the same amount of detail in mesh?

Thank you!

Assuming you can get your data computed correctly before you put it into the gradient you then just have to set up your gradient such that the colors make sense for your usage. Personally I’d stay with mesh as long as possible, but in the end use whatever gets you want you need

Haha! Okay. Can I ask you one more favor for checking my formula and see if that is correct? I use the minimum component to cap the slope range, such as 5%,10%,etc (or if you have better way to do it would be appreciated as well!)

I find that this setup seems to work well on a variety of meshes.

Hi, Chanley,

Thanks for attaching this useful file for me to explore. However I am still trying to figure out this script. Could you explain to me the difference between slope ranges( the gene pool) and the convert to percent component group underneath it? what’s the connection between them?

Thanks a lot!

Peiming

The gene pool component is being used to set up the creation of the desired “ranges”. The creation is actually happening in the Consecutive Domains component. Those domains then get fed into the find domain, along with the calculated face angles.

That face angles are initially calculated in radians and, for most slope analysis, need to be converted to either degrees or “percent”. (I think the math is pretty clearly shown in the file). It’s often the part that I see folks having some trouble with.

Once they are converted to your desired format, those values are ready to be fed into the Find Domain component.

The only other bit is that I prefer to average the normals, (optimize group), that come out of the measure between 2 angles component. (which is described in more detail in that post).