algorithmic modeling for Rhino
Hi all,
I am a python user(beginner) trying to understand meshes and meshing algorithms like Marching cubes, Ball Pivot and Marching tetrahedra. I saw basic example provided with rhinoscriptsyntax, It was hard to imagine how hard it was to make mesh faces assigned from points. One way i could think of not Reinventing the wheel was to call mesh from points commands in python . I needs some direction to head towards creating meshes in rhino
I was suggested Libraries but i not smart enough to figure out how to or where to use them exactly.
Tags:
So this AddFace command/function is so obscurely documented, that how you really use it, what damn buttons to push on your keyboard as a hopeful primate, is *hidden* in the old 32 bit version of the command in the help file Rhinocommon.chk, there being no examples in real language let alone the English language in the modern entries of the "help" document, no indication for a normal student of Rhino to find out that you need to use mesh.Faces before AddFace which is NOT described anywhere in any manual that exists:
I also realize that my periodic study of Javascript has confused me in relation to the specific object oriented command "dot structure sequences" of Python in Grasshopper in Rhino in Windows in Intel.
LESSON LEARNED: "slow down to speed up" by actively scanning *every* entry in the help file Rhinocommon.chk for an old seemingly obsolete entry that really contains code examples that indicate how you actually use the godforsaken command.
Oh God no, I thought the faces were created as independent, separate "meshes" but here you are implying that you are somehow keeping a list of vertices too, and in removing duplicates, somehow you retain the topological (vertex number) face definitions?
I thought you were just making floating faces as proudly independent "meshes" and then joining them.
Remember we are dealing with a marching tetrahedra script that spits out many redundant vertices.
I get it: this is a formality. Just a way to "weld" the faces into one real mesh. This is a footnote.
There is a way to teach this stuff. I don't know it yet. But I have an inkling. It involves shouting out strong distinctions. One distinction is to stick to real programming, since Grasshopper is a bait and switch bitch.
Didn't mean to confuse you...yes, you build the faces independently and then let the OutputMesh.Vertices.CombineIdentical() function sort out all of the redundant vertices.
There are no redundant vertices.
It's just mesh join or something. Really it's just 1011110 becoming 1011101, right, as the whole human universe is made of gray atoms?
I'm a street fighter, trying to steel your thunder, to bullshit my way into a $120K job.
Why are you doing Grasshopper?
I'm asking a personal question and I want a story, as does almost everyone who reads this forum.
What do you want?
it's probably just easier...http://www.bespokegeometry.com/about/
Thanks! Nice! Looking forward to keeping the conversation going...
Thanks to David Stasiuk's street smart guidance, I have now finally achieved a simple mesh output of marching tetrahedra in Python in Grasshopper in Rhino in Windows in Intel:
Computation time for the Python script is two seconds. I'm still not sure how to ramp up the resolution of the tetrahedra, or what sort of smoothing is best in Grasshopper. Nor yet how to join the individual mesh faces into one mesh within Python to avoid the MJoin Grasshopper component.
Now, gloriously, I only import Rhino, leaving out rhinoscriptsyntax.
I'm still not sure what marching cubes/tetrahedra is though. Does the internal trigonometric function define an actual volume or just a surface? Marching cubes was supposed to make a surface around voxels when the early computer kids started grabbing 3D scanner data from frozen biological sample slices and then nuclear magnetic resonance data, volumetric pixels, but here is just a surface function?! What do I input to this beast now, instead? Can I make art out of this?
Surface Formula:
# return a 3d list of values
def readdata(f=lambda x,y,z:x*x+y*y+z*z,size=5.0,steps=11):
m=int(steps/2)
ki = []
for i in range(steps):
kj = []
for j in range(steps):
kd=[]
for k in range(steps):
kd.append(f(size*(i-m)/m,size*(j-m)/m,size*(k-m)/m))
kj.append(kd)
ki.append(kj)
return ki
from math import cos,exp,atan2
def lobes(x,y,z):
try:
theta = atan2(x,y) # sin t = o
except:
theta = 0
try:
phi = atan2(z,y)
except:
phi = 0
r = x*x+y*y+z*z
ct=cos(PARAMETER_A * theta)
cp=cos(PARAMETER_B * phi)
return ct*ct*cp*cp*exp(-r/10)
def main():
data = readdata(lobes,10,40)
...
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