t I need is P3, which is the point at which a circle or arc (through P1 and P2) is tangent to line L.
I know that Rhino's "Circle tangent to 3 curves" command features the switch between tangent and point as input parameters, so that I can easily construct the circle in Rhino. However - Grasshopper, Rhinoscript and RhinoCommon all don't feature that switch of parameters. I need to integrate this into a GH python component.
Maybe someone has an idea?
Thank you very much,
Dominik
…
e to output a List(Of Point3d) which represents a collection of different lists. If you want to output multiple lists, you'll need to create a DataTree(Of Point3d).
I wrote a small script based on yours that outputs a list of curves instead (attached).
Private Sub RunScript(ByVal N As Integer, _
ByVal dx As Interval, _
ByVal dy As Interval, _
ByRef A As Object) Dim curves As New List(Of Curve)Dim rnd As New Random(2)
For i As int32 = 0 To N Dim P1 As New Point3d(0.0 + dx.ParameterAt(rnd.NextDouble()), _
dy.ParameterAt(rnd.NextDouble()), i) Dim P2 As New Point3d(P1.X + dx.ParameterAt(rnd.NextDouble()), _
dy.ParameterAt(rnd.NextDouble()), i) Dim P3 As New Point3d(P2.X + dx.ParameterAt(rnd.NextDouble()), _
dy.ParameterAt(rnd.NextDouble()), i) Dim P4 As New Point3d(P3.X + dx.ParameterAt(rnd.NextDouble()), _
dy.ParameterAt(rnd.NextDouble()), i)
Dim curve As Curve = Curve.CreateInterpolatedCurve( _
New Point3d(){P1,P2,P3,P4}, 3) curves.Add(curve)Next
A = curves End Sub
--
David Rutten
david@mcneel.com
Poprad, Slovakia…
ing basic concepts for personalization in footwear design and fabrication in order to send afterwards to CNCs, laser cutting equipment, 3D printers, etc.
Note: Previous knowledge in Rhinoceros and footwear design is not necessary.Content:1. Personalization in footwear upper(Working with a digital shape from a 3D scan)2. Shoe sole creation3. Using Grasshopper to create women's heels4. Nesting and using the work area5. Basic programming for a mold and/or a mock-up for CNC - RhinoCAM
Requirements: 1 PC or LaptopSoftware: Punto3D, provided by a CD which includes necessary demo programs, as well as the files that will be used for the session. Rhinoceros 5.0 for WindowsGrasshopperRhinoCAM 2014RhinoNEST 2014NOTE: You have to bring your own computer with Rhino 5 installed.
Register:
http://www.mcneelmiami.com/inc/sdetail/1727
//
Diseño y fabricación digital de Calzado
Lugar: Sala Ejecutiva 4
Precio: $95.00 USD
Idioma de curso: Español
Profesor: José de Jesús López Martínez. Punto3D, ART (Authorized Rhino Trainer)
Descripción: Compartir conceptos básicos para la personalización de cortes de calzado y el diseño de accesorios. Para su posterior envío a dispositivos como CNC's, equipos de corte láser, impresoras 3D, entre otros. Nota: No es necesario tener conocimientos previos de Rhinoceros, ni de diseño de calzado.
Contenido:
1. Personalización de corte de calzado (Trabajo sobre horma digital, la cual proviene de un escaneado 3D)
2. Creación de una suela
3. Grasshopper para la creación de un tacón para calzado de dama
4. Nesting y el aprovechamiento de áreas de trabajo
5. Programación básica de un molde y/o maqueta para CNC – RhinoCAM
Requisitos: 1 PC o Laptop
Software: Punto3D, proveerá un CD que incluirá los programas Demos necesarios, así como los archivos para trabajar en la sesión
Rhinoceros 5.0 para Windows
Grasshopper
RhinoCAM 2014
RhinoNEST 2014
NOTA: Tienes que llevar tu computador con Rhino 5 ya instalado
Regístrate:
http://www.mcneelmiami.com/inc/sdetail/1727…
ld work.
For example there's a grid shell and I've got a number of control points (for example 3) that can move up and down.
Depending on the control points I get forms that are structurally good and some that are bad.
In my office we've got a GH-Component, which leads the geometry in structural members and solves the structural forces and so on through an external Software called Sofistik and afterwards gives back to GH some Values, for example maximum bending moments. (Like Karamba)
Now I want to create this optimization component or something like that to minimize e.g. the bending moments in the given geometry.
Let's start with the work of the component.
So when I've three control points that can only move in z-direction.
P1(0,0,Z1), P2(10,0,Z2), P3(5,5,Z3)
They only depend on Z, so everything depends on Z1 to Z3 which have a range between 0 and 10 f.e.
First I want to get some (between 9 and 15) random Particles, one particle consists of this 3 different Z's.
So for example the first particle Part1 is [Z1=10, Z2=5, Z3=7]
and the second particle Part2 is [Z1=7, Z2=1, Z3=9]
and so on.
I created these Start Particles in a Cluster. See attached file.
I also tried this in C#, but thought it is easier in GH.
After I've got the Start Particles I want to give out the first particle and evaluate with its including Z's the target value in GH. Therefore I had to take the first branch and graft this branch (Discussion before)
Afterwards I want to save this Target Value that depends on the first starting Particle. Then I want to give out the second starting Particle to evaluate its target Value and store it. And so on till the last target Value of the last Starting Particle got assigned.
Then I want to assign the particles with its target values. E.g. part1: t=0.9, part2: t=1.8...
Then I want to define neighborhoods or the count of the expected local minima.
These neighborhoods can look like: Each neighborhood has to include not less than 3 particles. And the particles have to be next to each other.
E.g. if there are 12 particles and I want to have a look for 3 local minima, I need 3 or 4 neighborhoods. Then I would take 3 neighborhoods, because the more particles in one neighborhood, the better.
So the Count of the neighborhoods would be N=min{(Count of Part/3)& N_min}
How to define these neighborhoods I don't know at the moment. I think it has to be searched for the distance between the particles. E.g. part1 with (9,9,9) and part2 with (9,9,8) are next to each other but part 3 with(1,1,2) is far away.
Then each StartParticle is set to Partx_localbest.
And in each Neighbourhood the best of these localbeststs is Part_NyBest. (The best ist the one with the smallest target Value)
Loop:
Now I want to create new Particles. These Particles don't change their Z-values randomly. They change their Z-Values depending on Part_NxBest and Part_localBest. Therefore it has to be evaluated a new velocityfactor with v_Partx_new=0,792*v_PartxOld+1,5*random(0,1)*(partx_localbest-partx)+1,5*random(0,1)*(part_NyBest-partx)
The new particles will then be partx_new=partx+v_Partx_new.
The new Particle partx_new will be set to partx and then set in the output.
then there has to be caught the targetValue of part1 afterwards part2 can be put out and its target value caught and so on.
Then it has to be looked for the Partx_localbest through comparing the partx_localbest and its target value with the new part_x and its target value. If the target value of the new partx is smaller than partx_localbest,
then partx_localbest is the new partx.
This has to be done for each partx. Afterwards the same for neighborhoods best (best of all partx_localbest in one neighborhood)
Endloop if velocity gets small.
Output all part_NxBest
Output all targetvalues of the part_NxBests.
So in the Input there have to be:
StartParticles if they are given through the cluster attached.
Device on the target Value like in the attached gh.file from David Rutten I found in the discussions
Count of neighborhoods
And in the output
Output particle for evaluation
Output all part_NxBest
Output all targetvalues of the part_NxBests
Hope didn’t forget anything. And hope it isn’t crushed to badly. Sorry for my bad English by the way ;-)
For more explanation, how the PSO works in other programs. There’s attached a workflow script (is it called like that?) I think for GH it should be a little bit changed like I tried in my explanations.
So if you can help me a in some parts or you have any advices would be great, otherwise thank you nevertheless!!!!
Thankfully there’s no limit for the words in the discussions :-D
Best, Heiko
…
rring to the above image)
Area
effective
effective
Second
Elastic
Elastic
Plastic
Radius
Second
Elastic
Plastic
Radius
of
Vy shear
Vz shear
Moment
Modulus
Modulus
Modulus
of
Moment
Modulus
Modulus
of
Section
Area
Area
of Area
upper
lower
Gyration
of Area
Gyration
(strong axis)
(strong axis)
(strong axis)
(strong axis)
(strong axis)
(weak axis)
(weak axis)
(weak axis)
(weak axis)
A
Ay
Az
Iy
Wy
Wy
Wply
i_y
Iz
Wz
Wplz
i_z
cm2
cm2
cm2
cm4
cm3
cm3
cm3
cm
cm4
cm3
cm3
cm
I have a very similar table which I could import to the Karamba table. But I have i_v or i_u values as well as radius of inertia for instance.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
dimensjon
Masse
Areal
akse
Ix
Wpx
ix
akse
Iy
Wpy
iy
akse
Iv
Wpv
iv
Width
Thickness
Radius R
[kg/m]
[mm2]
[mm4]
[mm3]
[mm]
[mm4]
[mm3]
[mm]
[mm4]
[mm3]
[mm]
[mm]
[mm]
[mm]
L 20x3
0.89
113
x-x
4,000
290
5.9
y-y
4,000
290
5.9
v-v
1,700
200
3.9
20
3
4
L 20x4
1.15
146
x-x
5,000
360
5.8
y-y
5,000
360
5.8
v-v
2,200
240
3.8
20
4
4
L 25x3
1.12
143
x-x
8,200
460
7.6
y-y
8,200
460
7.6
v-v
3,400
330
4.9
25
3
4
L 25x4
1.46
186
x-x
10,300
590
7.4
y-y
10,300
590
7.4
v-v
4,300
400
4.8
25
4
4
L 30x3
1.37
175
x-x
14,600
680
9.1
y-y
14,600
680
9.1
v-v
6,100
510
5.9
30
3
5
L 30x4
1.79
228
x-x
18,400
870
9.0
y-y
18,400
870
9.0
v-v
7,700
620
5.8
30
4
5
L 36x3
1.66
211
x-x
25,800
990
11.1
y-y
25,800
990
11.1
v-v
10,700
760
7.1
36
3
5
L 36x4
2.16
276
x-x
32,900
1,280
10.9
y-y
32,900
1,280
10.9
v-v
13,700
930
7.0
36
4
5
L 36x5
2.65
338
x-x
39,500
1,560
10.8
y-y
39,500
1,560
10.8
v-v
16,500
1,090
7.0
36
5
5
I have diagonals (bracings) which can buckle in these "non-regular" directions too, and they do. If I could add those values then in the Karamba model I could assign specific buckling scenarios..... I can see another challenge which will be at the ModifyElement component, I will not be able to choose these buckling lengths, in these directions.
Do you think this functionality can be added within short, or should I try to find another way to model these members?
Br, Balazs
…
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)…