Grasshopper

algorithmic modeling for Rhino

Hello,

ich have a new Problem.

Is it possible to reduce small Diameters, for example ø0.3 or what else in this datatree.

Thank you for help.

Views: 1140

Attachments:

Replies to This Discussion

There are many ways to handle this, such as defining a domain with a minimum radius or providing a list of radii that each value is rounded to.  Or you could do this - any value smaller than the slider value is converted to zero by an expression (red due to null data, but it works):

Good morning Joseph,

Thank you, it sounds great and it works despite the error.

The error is due, indirectly, to the 'Cull' operation that skips X & Y values <= 4.  You can fix it by applying 'Clean Tree' with 'Remove Empty = True' to the input of the image sampler.

By the way, you have some needlessly complex code after 'Circle CNR'...

First, you are sorting circles, but not explicitly by radius or diameter.  Then you divide the results by Pi, so you assume GH used diameter (and maybe it does?), but you could have sorted radius (or radius * 2) directly.

Second, instead of this:

You can do this - "-1" returns the last item in the list:

very greatly and thank you that you gave me these tips.

i'm quite a beginner and so i'm grateful for these good explanations and the best of all, it works.

Joseph, i have one last question.

is it possible to add a switch or a button that i can change the black and white color. i mean, now the white color becomes a circle. i want add a switch that the black color becomes a circle without to change the picture.

do you understand me?

Since the output of the image sampler is between zero and one, all you need to do is subtract that value from one to reverse the effects.  A 'Stream Filter' allows you to switch between the two values:

By the way, an even simpler way to get smallest and largest values, without 'Sort List', is as follows - 'Bounds (Bnd)' followed by 'Deconstruct Domain (DeDomain)':

At the risk of beating a dead horse, setting the radius to zero for circles below the minimum size struck me as less than ideal.  Better would be not to have any circle at all in those cases instead of so many with zero radii.  This will speed up any subsequent processing you might want to do, such as making boundary surfaces for the circles.

So I re-did your code and will post it this time - with a caveat: a very long-standing, well-known bug in Grasshopper fails to save the Image Sampler component when I save a copy of your file.

Quite annoying, but there is a work-around.  Copy/paste and connect the Image Sampler from the code you posted above into the place I reserved for it.

Attachments:

sorry for my late reply.

Your knowledge is very impressive and great thanks for your help und all the fantastic Solutions.

And the Speed up is noticeable.

I have another problem, i will explain it in a few hours, perhaps you can help me again.

There are MANY examples of Image Sampler code on this forum.  You might want to look around a bit and read more code first.  There is rarely a single best way.

Like this one from two days ago:

Image Sampler with rgba images
http://www.grasshopper3d.com/forum/topics/image-sampler-with-rgba-i...

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service