and 7 floors) depending on the size of their areas of surfaces. I managed to do it. Then I tried to divide buildings into frames/staircases (more or less). Then, I wanted to assign appropriate numbers to the proper frame/staircase. Like I did it before with whole buildings. Here is a problem. I'm lost in the lists. Could somebody help me with it? Disscution about lines and boolean regions
Columns in Excel: A - year B - population number C - % of kids in 0-2 age D - % of kids in 3-6 age
…
o it would cause troubles with unfolding and fabricating... that's why I used Extrude point component- it will give you similar result, but all surfaces are planar.. you can control extrusion direction with a tip point in rhino...
2)I changed tagging so every tube has 8 points form list A and 8 points from list B... first number of tag is a number of point within one tube... last number of the tag is order of tubes (I draw a little picture in GH, hope you'll understand)...I think original way of tagging wasn't really usefull.. but you can change tagging by yourself...
3) the definition is really messy, sorry about that, but it's just quite complicated task...
4)if you find some incorrect order of tagging, use the slider that controls Shift List component ... it will shift tagging..
5) if you won't be using this definition or find some better way, pleeeease don't tell me - I'll jump out the window :D ... it took me whole day to make it work :D
6)I can't guarantee you anything- I hope it works, but if not - at least I tried... so check everything (especially order of tags and points) twice before you fabricate it.. or print few tubes and make them paper first..
7)there is a part of original definition, that is not useful anymore.. I left it there, but you can delete it (I called it "UNUSED PARTS OF ORIGINAL FILE")
..good luck
Dimitri…
or create a form through code.
2) Add a public function to your component that displays this form, I recommend you use form.ShowDialog() for now to avoid weird conditions with non-modal forms.
3) Override the method Menu_AppendCustomComponentItems() on your Component and add an extra menu item that will show the form (i.e. when clicked, it will call the function defined in step [2].
4) Create a new class and derive it from Grasshopper.Kernel.Attributes.GH_ComponentAttributes. (if you don't want to offer double-click functionality, you can skip steps 4 to 6)
5) Override the RespondToMouseDoubleClick() method on the new attributes and also call the function defined in step [2]
6) Override the CreateAttributes() method on your Component class and construct an instance of the custom attributes defined in step [4] instead.
7) Once you've shown the form and the user has clicked OK, you need to assign values and invalidate the Component, then start a new Solution.
Here's some code:
Public Class MySpecialComponentAttributes
Inherits GH_ComponentAttributes
Public Sub New(ByVal comp As MySpecialComponent)
MyBase.New(comp)
End Sub
Public Overrides Function RespondToMouseDoubleClick( _
ByVal sender As GH_Canvas, _
ByVal e As GH_CanvasMouseEvent) As GH_ObjectResponse
DirectCast(Me.Owner, MySpecialComponent).DisplayForm()
Return Canvas.GH_ObjectResponse.Handled
End Function
End Class
Public Class MySpecialComponent
Inherits GH_Component
.....
.....
Protected Overrides Sub Menu_AppendCustomComponentItems( _
ByVal iMenu As ToolStripDropDown)
Menu_AppendGenericMenuItem(iMenu, "Set Values", AddressOf Menu_SetValues)
End Sub
Private Sub Menu_SetValues(ByVal sender As Object, ByVal e As EventArgs)
DisplayForm()
End Sub
Public Sub DisplayForm()
Dim frm As New MySpecialForm()
Grasshopper.GUI.GH_WindowsFormUtil.CenterFormOnCursor(frm, True)
If (frm.ShowDialog() = DialogResult.OK) Then
'Harvest values from form and assign them to local variables
Me.ExpireSolution(True)
End If
End Sub
End Class
--
David Rutten
david@mcneel.com
Turku, Finland…
hopper and the GH file.
2. There is a drop down menu at the top of Pure Data that reads "Media". Click on "Midi". If your device connection is working, you should see it show up as an option. Set the device to MIDI in. You don't really need to set a MIDI out unless you are planning to send messages back to the device (not sure why you would want to).
3. The boxes labeled "ctlin" with a number are the Control Change in's. In Pure Data go to the "Edit" menu and click on "Edit Mode". Click on one of the "ctlin #" boxes and change the number to match the Control Change number of your physical controller. Mine starts with 5 in the upper right and goes to 65. Each control change number shows up on the display window of my device when I use it which made it easy.
4. Continue this process for all your controls. Delete the unneccesary "ctlin #" boxes by selecting them with a fence and clicking "delete". When you hover over one of the wires you should see and "x". Press the "backspace" key to delete it.
5. Now go down to the "pack f f f ..." box. There should be as many "f" or "floats" in that box as there are you number of controllers. Delete the remaining "f".
6. Next look at the box below that reads "send /0...". Make sure to keep the "/0". If you delete the "/" it will crash Grasshopper. Change the number "5" to match your first control change number. Leave the $numbers alone. You'll want to keep them sequential. Continue change the control change numbers to match all of yours. The $numbers should match the order in which you wired each controller to the "pack f f f..." box.
7. For testing purposes hover over the input on the upper let of the "print" box and connect it to the out of the "send" box. If everything is mapped correctly, working properly, and you go back to the "main" PD window you should see a list of all controllers will a value (0 to 127) next to it. As you turn a knob, the value next to the control change number will increase from 0 to 127. This will give you a good indication of whether or not everything is working and if you mapped it correctly.
8. Click on the "connect OSC" box. You might need to exit out of "edit mode" and back to "performance" mode in the PD canvas.
9. Go To Grasshopper. If everything is working you should see the Panel read "new message" when you turn a knob. At this point it should be pretty obvious how to modify the Grasshopper components. I've tried to keep everything as consistent as possible. Since I filtered out the "/0", the "explode data treat" component starts at 0, the numbers are shifted down by 1.
I just left the IP address, etc. alone on the gHowl UDP component. Just make sure the "port number" matches the OSC port number on the send in Pure Data. If you crash, you may need to choose a new number.
Hope that helps. Let me know if you have any questions. If your computer is not recognizing your midi controller, you may need to install "Midiyoke". I did at first, but it turns out I didn't need it after all.
Best of luck.
…
is set up to manipulate strings into an STL file that is quite different from how Grasshopper defines meshes, in that an STL seems to define each face by XYZ points, Grasshopper wants a single list of all vertex points and then has an allied lists of topological connectivity according to vertex number, so for now I just hacked it to spit out points minus so many duplicates it generates for STL:
Right now it has an internal 3D trigonometric function I added input sliders to control, that creates surfaces that look a lot like molecular orbitals.
So how do I make a mesh? I failed to make a single mesh face from each STL face since AddMesh seems to want a list, so I tried making a single list and matching it with a simple ((1,2,3),(4,5,6),(7,8,9)...) array of connectivity but it hasn't worked yet since the STL list of vertices has duplicates that won't work for Grasshopper and removing the duplicates scrambles the connectivity relation.
After some work on this and seeing the output, I figure I could just randomly populate the mathematical function with points instead, unless it really gives a better mesh result than other routines. I'm not sure what to do with it yet, even if I get the mesh figured out.
import rhinoscriptsyntaximport RhinoPOINTS_CONTAINER =[]POINTS = []class Vector: # struct XYZ def __init__(self,x,y,z): self.x=x self.y=y self.z=z def __str__(self): return str(self.x)+" "+str(self.y)+" "+str(self.z) class Gridcell: # struct GRIDCELL def __init__(self,p,n,val): self.p = p # p=[8] self.n = n # n=[8] self.val = val # val=[8] class Triangle: # struct TRIANGLE def __init__(self,p1,p2,p3): self.p = [p1, p2, p3] # vertices # HACK TO GRAB VERTICES FOR PYTHON OUTPUT POINTS_CONTAINER.append( (p1.x,p1.y,p1.z) ) POINTS_CONTAINER.append( (p2.x,p2.y,p2.z) ) POINTS_CONTAINER.append( (p3.x,p3.y,p3.z) )# 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 sin,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) isolevel = 0.1 #print(data) triangles=[] for i in range(len(data)-1): for j in range(len(data[i])-1): for k in range(len(data[i][j])-1): p=[None]*8 val=[None]*8 #print(i,j,k) p[0]=Vector(i,j,k) val[0] = data[i][j][k] p[1]=Vector(i+1,j,k) val[1] = data[i+1][j][k] p[2]=Vector(i+1,j+1,k) val[2] = data[i+1][j+1][k] p[3]=Vector(i,j+1,k) val[3] = data[i][j+1][k] p[4]=Vector(i,j,k+1) val[4] = data[i][j][k+1] p[5]=Vector(i+1,j,k+1) val[5] = data[i+1][j][k+1] p[6]=Vector(i+1,j+1,k+1) val[6] = data[i+1][j+1][k+1] p[7]=Vector(i,j+1,k+1) val[7] = data[i][j+1][k+1] grid=Gridcell(p,[],val) triangles.extend(PolygoniseTri(grid,isolevel,0,2,3,7)) triangles.extend(PolygoniseTri(grid,isolevel,0,2,6,7)) triangles.extend(PolygoniseTri(grid,isolevel,0,4,6,7)) triangles.extend(PolygoniseTri(grid,isolevel,0,6,1,2)) triangles.extend(PolygoniseTri(grid,isolevel,0,6,1,4)) triangles.extend(PolygoniseTri(grid,isolevel,5,6,1,4)) def t000F(g, iso, v0, v1, v2, v3): return [] def t0E01(g, iso, v0, v1, v2, v3): return [Triangle( VertexInterp(iso,g.p[v0],g.p[v1],g.val[v0],g.val[v1]), VertexInterp(iso,g.p[v0],g.p[v2],g.val[v0],g.val[v2]), VertexInterp(iso,g.p[v0],g.p[v3],g.val[v0],g.val[v3])) ] def t0D02(g, iso, v0, v1, v2, v3): return [Triangle( VertexInterp(iso,g.p[v1],g.p[v0],g.val[v1],g.val[v0]), VertexInterp(iso,g.p[v1],g.p[v3],g.val[v1],g.val[v3]), VertexInterp(iso,g.p[v1],g.p[v2],g.val[v1],g.val[v2])) ] def t0C03(g, iso, v0, v1, v2, v3): tri=Triangle( VertexInterp(iso,g.p[v0],g.p[v3],g.val[v0],g.val[v3]), VertexInterp(iso,g.p[v0],g.p[v2],g.val[v0],g.val[v2]), VertexInterp(iso,g.p[v1],g.p[v3],g.val[v1],g.val[v3])) return [tri,Triangle( tri.p[2], VertexInterp(iso,g.p[v1],g.p[v2],g.val[v1],g.val[v2]), tri.p[1]) ] def t0B04(g, iso, v0, v1, v2, v3): return [Triangle( VertexInterp(iso,g.p[v2],g.p[v0],g.val[v2],g.val[v0]), VertexInterp(iso,g.p[v2],g.p[v1],g.val[v2],g.val[v1]), VertexInterp(iso,g.p[v2],g.p[v3],g.val[v2],g.val[v3])) ] def t0A05(g, iso, v0, v1, v2, v3): tri = Triangle( VertexInterp(iso,g.p[v0],g.p[v1],g.val[v0],g.val[v1]), VertexInterp(iso,g.p[v2],g.p[v3],g.val[v2],g.val[v3]), VertexInterp(iso,g.p[v0],g.p[v3],g.val[v0],g.val[v3])) return [tri,Triangle( tri.p[0], VertexInterp(iso,g.p[v1],g.p[v2],g.val[v1],g.val[v2]), tri.p[1]) ] def t0906(g, iso, v0, v1, v2, v3): tri=Triangle( VertexInterp(iso,g.p[v0],g.p[v1],g.val[v0],g.val[v1]), VertexInterp(iso,g.p[v1],g.p[v3],g.val[v1],g.val[v3]), VertexInterp(iso,g.p[v2],g.p[v3],g.val[v2],g.val[v3])) return [tri, Triangle( tri.p[0], VertexInterp(iso,g.p[v0],g.p[v2],g.val[v0],g.val[v2]), tri.p[2]) ] def t0708(g, iso, v0, v1, v2, v3): return [Triangle( VertexInterp(iso,g.p[v3],g.p[v0],g.val[v3],g.val[v0]), VertexInterp(iso,g.p[v3],g.p[v2],g.val[v3],g.val[v2]), VertexInterp(iso,g.p[v3],g.p[v1],g.val[v3],g.val[v1])) ] trianglefs = {7:t0708,8:t0708,9:t0906,6:t0906,10:t0A05,5:t0A05,11:t0B04,4:t0B04,12:t0C03,3:t0C03,13:t0D02,2:t0D02,14:t0E01,1:t0E01,0:t000F,15:t000F} def PolygoniseTri(g, iso, v0, v1, v2, v3): triangles = [] # Determine which of the 16 cases we have given which vertices # are above or below the isosurface triindex = 0; if g.val[v0] < iso: triindex |= 1 if g.val[v1] < iso: triindex |= 2 if g.val[v2] < iso: triindex |= 4 if g.val[v3] < iso: triindex |= 8 return trianglefs[triindex](g, iso, v0, v1, v2, v3) def VertexInterp(isolevel,p1,p2,valp1,valp2): if abs(isolevel-valp1) < 0.00001 : return(p1); if abs(isolevel-valp2) < 0.00001 : return(p2); if abs(valp1-valp2) < 0.00001 : return(p1); mu = (isolevel - valp1) / (valp2 - valp1) return Vector(p1.x + mu * (p2.x - p1.x), p1.y + mu * (p2.y - p1.y), p1.z + mu * (p2.z - p1.z)) if __name__ == "__main__": main() # GRASSHOPPER PYTHON OUTPUTPOINTS = rhinoscriptsyntax.AddPoints(POINTS_CONTAINER)POINTS = rhinoscriptsyntax.CullDuplicatePoints(POINTS)…