Grasshopper -Irregular Flat Surface Division by Dimension (spacing)

hii, I am currently working on a project which calculates the tiling waste in the floorplan, I have created a simple C# script for dividing the irregular surface into grids, But what I want to do is to divide the surface with fixed dimension instead of count

this is what I had now,
and also I would like to keep the division vertical or horizontal rather than this

Really appreciate someone can help me with it!! (c#, ghpython, gh) all should be good!!,


what I understand is you have a tile of (w, l) or (width length) and you want to put that on any shape.
If shape bounding box is W L (Width Length) the max number is

  • nw = Ceiling(W/w)
  • nl = Ceiling(L/l)

You can get W and H doing that, W is X of deconstruct component, L is Y.

In a way … (114.8 KB)

PS: Modify things (i.e. the output, the input etc etc) accordingly

Please help. How can I do parametric series of extrusion. Thanks.

Please help. How can I do parametric series of extrusion.
Simple rectangle will do. I want to create this series of extrusion or sweep. My reference line is already parametric for some reason my solid model didn’t follow. I use sweep in this case

Shape of extrusion be something like this. image

That - entry level - C# divides a “rectangle” derived from the box (pts 0, 1, 2, 3) and then uses a BrepFace containment filter by testing the center of a given divided “module” (a rectangle in this case) for inclusion. Meaning that you should:

  1. Control the output: Meshes (faster) or Breps (general case - see PS2)?
  2. Elaborate other filters as well (for instance testing all points for inclusion etc etc).
  3. Elaborate a safety net (i.e. respect max N of divisions in X.Y: just imagine attempting to divide a 100 m long direction using a step like 0.001).
  4. Include an option: get things inside or outside the BrepFace.
  5. Use the BrepFace plane for the Box and thus use any BrepFace “rotated” in 3d space.

PS1: Other than that are you after some recursive loop for the remaining “spaces” ? I.e. If NOT an inclusion is found AND if at least one point is included … then use half x/y for the first pass (loop) and then half of the half … blah, blah. This means that the modules wouldn’t be equal (obviously) AND you may end with a BIG N of “mini” modules (up to some min size [ doc tolerance for instance]).

PS2: Obviously another way is to get the Curve intersection between the Rectangle (as Curve) and the prox BrepFace Loop. This means that the modules wouldn’t be rectangles AND you can’t use Meshes (for the general case: any planar BrepFace with curvy BrepLoops etc etc).

For the other thing (Linear alu/steel profiles extrusions) use the

Brep.CreatePlanarBreps (i.e. get the Face) and Brep.CreateFromOffsetFace (i.e. use the Face) Methods

Note: Rhino is a surface modeller … meaning that MAY become very slow when “solids” (closed Breps) are required. In general and if you are after solids (and most notably post operations like fillets etc) avoid using Rhino at any cost.

sorry for being silly here, emm but if I want the same square like this
How can I get the points and create the same rectangle based on your previous script? Thank you!!

The “area” sketched (Nothing to do with some Inside/Outside filter) is not a rectange: is the Intersection of the candidate Rectangle as Curve (if is valid according to some criterium) VS the BrepLoops as Curves. This means NO MESHES as output (general case).

For getting the Loops:

List< Curve > loops = new List< Curve >();
foreach(BrepLoop loop in face.Loops) loops.Add(loop.To3dCurve());

That said: 1 to 10 what is your rate about your C# level? (question related with various things that this case requires in order to be the complete thingy)

maybe only 3 or 4 hahaha, I used to use python a lot, just begin to use last two months

2 months means minus 1 (min), he he. You can hope for 1 after 6 months (min). Then … you’ll need ~ 5 years to get the gist of C# (and several more in order to do anything imaginable). Then … is kinda martial arts: the zone state of things and the likes, blah, blah.

1 Like

hahaha that’s true, but what you mean before is about getting the intersections of those two lines and get the curve? maybe I need to find an alternative way in gh to do that (sad tho hhhhh)
like this

Jesus C ! You are lost in space I guess (life sucks).

  1. For a given quad of a candidate module (Rectangle) points .
  2. If no point is inside the face > adios amigos > add null (that’s handy for other type of “post” things).
  3. Get the Rectange and then a Curve out of it (rect.ToNurbsCurve()).
  4. Test for ccx events (Curve.Intersection(s)) between that Curve and each of the Curve loops (as above).
  • If some Curves (general case) are found add the resulting Breps (Brep.CreatePlanarBreps(crvs)) to the result Tree.

  • If no ccx events occured add the Rectange Curve as Brep.

Note: a given Rectangle MAY have all the 4 corner points inside a face while there’s still potential ccx events (but you may use a test by finding the min prox distance between the center and the loops > if this is greater than the half diagonal > NO ccx test is required [ just add the Rectangle]).

That said C# is a thingy for the brave. Thus I added some stuff BUT not the code for the “pieces as above”.

Moral: be brave, never give-up. (118.9 KB)

Offset your curves with the max dimension of your tile. You will have enough tiles. Use Clipper Offset it will union shapes.

And a more Sioux Method using Peter Definition (15.2 KB)


Er … you know what this means (general case : weird/freaky/odd PolyCurves etc etc) in real life.

Thank youuu, i have a long way to go hahaha , but don’t give up !!

Screen Shot 054

Hi @reny.w, are you lost? You can make your own question without polluting this one.

@Blair_Huang I updated my answer and put a definition.

Thank you! Its pretty straightforward

Offset from Clipper is not weird, freaky or whatever. There are drawbacks because it is polyline. But is the Nature really continuous ? At the end everything is atoms, quark … light … So in real life good polyline is better than bad Nurbs/Bezier curve.
Whatever it is good to see you Peter @PeterFotiadis , you are always a bit “cryptic” but you always bring nice solutions.

I mean situations like these: