Grasshopper

algorithmic modeling for Rhino

Hello,

I have a question about creating surfaces from either points that are placed in lists, or from line-like curves (created from the points). Is this possible, the number of points in the list can vary.

After that I want to colour the surface either red or blue, depending on the position of the horizontal line (surface created under horizontal line -> colour red; surface above horizontal line -> colour blue). 

Hope somebody has a solution

Thanks in advance

Surface.jpg

Surfaces.jpg

Surfaces%20colours.jpg

Views: 1262

Replies to This Discussion

If they are not planar then patch.

Also Mesh.FromClosedPolyline() works quite well.

Yess the patch component I was looking for. But it doesn't work for datatrees, can I modify it in a python script for instance so that it also works for datatrees?

Or is there another solution

Attachments:

For sure yes.

Do you know how to use datatrees in python?

If not send me the file I will make an example.

No not exactly

This is an example how I want to implement it

Thanks

Attachments:

import Rhino as r
import Grasshopper as g

patches = []
datatree = g.DataTree[r.Geometry.Brep]()

for i in range(x.BranchCount):
   
    geoBase = []
    for j in x.Branch(i):
        geoBase.append(r.Geometry.Point(j)) #yeah right geomtrybase casting
   
    """
    geoBaseLines = []
    for j in range( len(x.Branch(i))-1 ):
        geoBaseLines.append(r.Geometry.LineCurve(x.Branch(i)[j],x.Branch(i)[j+1]))
    """
    datatree.Add(r.Geometry.Brep.CreatePatch(geoBase,10,10,r.RhinoDoc.ActiveDoc.ModelAbsoluteTolerance),g.Kernel.Data.GH_Path(i))
    patches.append(r.Geometry.Brep.CreatePatch(geoBase,10,10,r.RhinoDoc.ActiveDoc.ModelAbsoluteTolerance));
   
a = patches
b = datatree

Attachments:

This doesn't seem to work. The patches are namely not drawn in between the 5 points. 

This also happens for the patch component, that the patch is not exactly drawn in between the points.

Dont know how this can happen since I use the points where the patch has to be drawn in between

Attachments:

Because it is approximation, both python and component use the same function, as decompiler says.

A workaround would be to create patch not from points from closed contour.

RSS

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service