algorithmic modeling for Rhino
Replies are closed for this discussion.
Dear buggers, advice is greatly appreciated! Thanks!
Hi Grasshope,
While I didn't write that component myself. You need the RhinoCommon Mesh.CreateFromBrep method
search for it in the RhinoCommon - http://4.rhino3d.com/5/rhinocommon/
Hi Grasshoppe,
Anton is right. You just need to set a number of meshing parameters based on the gridSize.
Here is the sample code that you can find in Honeybee_Generate Test Points:
https://github.com/mostaphaRoudsari/Honeybee/blob/master/src/Honeyb...
Mostapha
Thank you Anton and Mostapha!
I did a brute force "copy and paste" test of the following code, and it didn't work with the warning of unable to determine the length of the brep objects.
I'm sure I get it wrong in this way, and I hope you can point out how to correct the errors.
import Rhino as rc
import Grasshopper.Kernel as gh
from itertools import chain
import System.Threading.Tasks as tasks
import rhinoscriptsyntax as rs
mesh = []
def createMesh(brep, gridSize):
## mesh breps
def makeMeshFromSrf(i, inputBrep):
try:
mesh[i] = rc.Geometry.Mesh.CreateFromBrep(inputBrep, meshParam)[0]
inputBrep.Dispose()
except:
print 'Error in converting Brep to Mesh...'
pass
# prepare bulk list for each surface
mesh = [None] * len(brep)
# set-up mesh parameters for each surface based on surface size
meshParam = rc.Geometry.MeshingParameters.Default
meshParam.MaximumEdgeLength = gridSize
meshParam.MinimumEdgeLength = gridSize
meshParam.GridAspectRatio = 1
for i in range(len(mesh)): makeMeshFromSrf(i, brep[i])
return mesh
createMesh(brep, 0.1)
File attached.
The easiest solution is to use the [Deconstruct Brep] component and plug in the output faces into Python. You would have to do this for the [Honeybee_Generate Test Points] component as well.
Concerning your second question below, that has to do with the way we call the function. In the Honeybee component, you will notice that Mostapha creates a new list from 'createMesh' and passes that through another function as an argument. So the organization is a bit different from what you're doing.
Hope this helps.
/SPM
Hi Grasshope
Is this what you are looking for? Check out the component Brep to Mesh
Cheers,
Anton
Hi Stephen,
I also wonder why in your GH file the brep node must be set as "List Access" to take a group of Breps, whereas in Mostapha's Honeybee_Generate Test Points component, the _testSurface node set as "Item Access" can take a group of Brep as input using the same Python code...
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by