Changing slope txt output from xx% to fraction (1/xx)

Hello!
I am new-ish to GH and still getting my head around the different types of data output and how to modify them. I was wondering if someone could help me with what I think might be a simple task.

I am using the Bison plugin and the “Slope to Point” function to derive spot levels across a mesh surface. The function outputs txt in percentages but I would like the txt to ready as fractions.

For example function output is: 5%
I am trying to manipulate the output so it reads as: 1/20

Is this possible?

Thanks!



Slope to Fraction.3dm (102.1 KB)
Slope to fraction.gh (11.9 KB)

missing

pct_to_frac_2024Apr11a
pct_to_frac_2024Apr11a.gh (9.4 KB)

P.S. Found this useful diagram. 100% = 12/12 = 45 degrees.


pct_to_frac_2024Apr11b.gh (18.3 KB)

Hi Joseph,

Thanks so much for your help. Impressive! Super useful.

The unknown object is from a plugin called Bison. Is there a way to “internalise” components from external plugins?

I am still not sure how to best connect the output values from the Slope Point component to your definition. Simply connecting the two doesn’t work perhaps because the output I am working with appears to be a “Collection of Geometry” while the input to your definition is a “Collection of integers”. Is there a way to convert between or link the two?

Sorry, I am very new a this.

Hi Dylan -

Yes.
image

Right-click on the Geo parameter.
-wim

No, I replicated your plugin output as a list of random numbers. Now that I can see your data, try this version instead. Replace the white group I am using by connecting your Slope Point output to the square cyan group input,.


pct_to_frac_2024Apr12a.gh (27.8 KB)

By the way, this would have been solved on the first try if you had internalized the Slope Point output or posted an image of your data.

3. Attach minimal versions of all the relevant files
[…] It’s also a good idea to remove everything non-essential from a gh file. You can use the Internalise Data menu option to cut everything to the left of a parameter:

Hi Joseph,

Works great. Thanks so much!
Next time I will be sure to “Internalise Data” correctly to speed things up.

Much appreciated!