C# - points from subdivided surface

Hi! I was wondering how to get points on surface by c# script.
The surface is subdivided by given counts, and points got extracted by PointAt(0,0) method.
I could use if condition to get the points at the end of subdivided surface but it doesn’t look so clean.
Is there any simple way how to get all crossing points on subdivided surface?

Attached .gh file!

PointsOnSubdividedSrf.gh (10.8 KB)

Screenshot 2021-04-15 at 10.58.44


That way:

SurfaceOrBrepFace_Divide_Simple_V1.3dm (225.5 KB) SurfaceOrBrepFace_Divide_Simple_V1A.gh (120.5 KB)

1 Like

So great! Thanks! I have an instant question (still investigating methods that you used :sweat_smile:) is it a special class <Point3d?> ? It’s the first time that I’ve seen Point3d with question mark, and couldn’t find this class in Rhinocommon document. I’m just curious!

Screenshot 2021-04-16 at 08.26.55

? means a nullable collection: used in various cases where you need info related with a valid “hit”/item (like a BrepFace that may - or may not - yield a point). For instance imagine doing some pattern (or a surf piece), say, from a quad of points: if any of them is null > adios amigos > next quad etc etc. This means that for reading a similar Tree you’ll need unboxing (but no pain == no gain).

See what I mean ( C# shown does 74 different patters):

NOTE: the attached is an entry level (a bit primitive) thingy: for instance (case: Lists) doesn’t compute proportional (to U/V sizes) divisions etc etc. That’s rather a must … so try to do it as a challenge.

1 Like

Thanks a lot for the explanation! it’s the first time I got to know the nullable collection. It seems very useful to avoid null exception(hopefully I understood correctly).
I’m not sure if I can figure out how to extract points without (case:List) :sweat_smile: but I will keep that in my mind!

Really minor question, why U/V cannot be integer 1? it wouldn’t be an error to operate w( width) divided by 1 and h (height)divided by 1. Is there geometrical reason that U/V value should be larger than 1?

I didn’t know DataTree path can contain 3 dimensions, so many useful information from your code. I appreciate for it! thanks agian!

Well … If you insist (but what’s the purpose? [ you can get the 4 corners wthout all that]):

I have no idea if David imposed some max dim rule on Trees … but you can have as many dimensions as rational thinking dictates.

NOTE: If your universe is the GH/R combo … then DataTrees are a good thing. Otherwise try to avoid using them (portability to/from other apps [say for real-life AEC BIM things and the likes]).

1 Like

And now the task for the brave:

Added an inside/outside option plus a surf sub division one. But the pieces related part of the code is - on purpose - a bit naive … so … by what means can you provide more/better options (case : Bep Faces with trims) about what piece to include in the collection? (and why the surf pieces Tree is not nullable? ). Answers: The Lord, District 666, North Pole.

SurfaceOrBrepFace_Divide_Simple_V1B.gh (128.4 KB)
SurfaceOrBrepFace_Divide_Simple_V1B.3dm (408.3 KB)

1 Like