Grasshopper

algorithmic modeling for Rhino

Hi All,

I am trying to create a persistent list (that is what I think it is called but I'm not a programmer by any means) of points which I can then fine-tune individually until I've got the proper location for each. I've setup a demonstration in the attached files to make it more obvious. Here are the steps:

  1. Choose the curve (in this case a circle) -> (D)
  2. Choose the number of points you would like on this curve -> (N)
  3. The algorithm chooses (N) random points on the curve
  4. Use the slider to choose a point from the list of randomly chosen points (from 0 to N -1)
  5. For each of these points use the slider to move the point behind or forward (between -5 to 5 points) along the curve

Now I want to be able to do this but keep the results of my adjustments. Is this actually possible?

Thanks,

Ali

Views: 4681

Attachments:

Replies to This Discussion

When you say:

Now I want to be able to do this but keep the results of my adjustments. Is this actually possible?

Do you mean you want to store the values that created this specific case for recollection in the future?

If so then yes there are ways to achieve this, one of which is built in to the user interface of Grasshopper called Save States in the solution menu.

Alternatively you can create a string of variables for all your user settings and Internalise them in a String Param when you are satisfied with the results.

Don't forget to include any seed values used in your Random Components as this will have an effect on your ability to repeat randomness.

Hi Danny,

Thanks for the reply. Well actually repeatability is not what I'm after. In fact the random picking of points is for this demonstration. In my project I will use another algorithm to pick some points on the curve. However, my algorithm isn't producing the exact result I want so I was thinking that I could have a manual override mechanism by which I could tweek each of the points left or right and then use the set of tweaked points to carry out my other calculations.

Now in this example this would mean I would use the third slider to choose a point (say 3 which is displayed in the panel on the side) and then use the fourth slider to manipulate its location. This works fine. However, when I move on to the next point (by using the third slider) everything gets reset to the original positions. Looking at the code it is obvious why this happens. What I want to find out is how to keep my changes as I go along changing each of the points.

I don't think states would work because then each state would only represent the position of a single point and I would have to manually record and apply everything.

Any other ideas? Is my explanation any clearer?

Regards,

Ali

use list item and assign different movement values and vectors to each assigned point.

I thought you had a slider per point. So no it would not work the way you describe.

What is the criteria that you are satisfying when a point is good? Can this be worked into the definition so that there is no user interaction?

Hi Danny,

Sorry for the delay in replying. I was trying to clean up my file so that I can post it and let you see what I'm working on. I think your point about removing user interaction is a good one. This is the actual reason I'm going through all this. I want to develop an algorithm that can be applied consistently and produce good results.

Here is a a little background. I'm working on my master's thesis in structural analysis. My thesis is on seismic behaviour of a roman temple in Portugal. I will be using a method of analysis suitable for block structures called the discrete element method. I am using a commercial code called 3DEC for this.

Now in order to the analysis I need to construct a 3D block model of my structure. I received a 3D scan of the entire structure (in *.wrl) format and spent a week trying to clean it up and slice it into the blocks that make up the structure. Now I want to use the scanned geometry of the blocks and describe a simplified prism around each that will represent the block in my analysis. I've attached a file with one of the columns in the temple. I think (at least with my tests so far) that it is representative of the all the blocks I'm dealing with.

Now my criteria for creation of the blocks:

  1. I would like the contact area between the blocks to be as close as possible to the actual drum contact area,
  2. I would like to get the volume of the blocks to be as close as possible (secondary to the contact area) to the volume of the actual drums in order to insure that the weight distribution in the structure is as close to reality as possible,
  3. I would like the shape of the contact area to be as close to reality as possible

I order to satisfy all these requirements, I've done the following in my grasshopper file:

  1. I take a section at the top and bottom of each of the drum meshes. I use this to extract the contact outline at the top and bottom of the drum. This is sometimes problematic and requires me to clean up the model and remove features that interfere.
  2. Next I take each surface and try to fit a minimum circle around it. I try to do this because in my mind this is the best possible way to find the actual centre of the drum when there is cut outs and deterioration. This works well as long as more than half of the contact surface is still in its circular shape (third block from bottom in the example file doesn't satisfy this requirement and thus causes problems).
  3. Knowing the centre, I use an algorithm I created in VB to search for one of the flutes on the contact profile. My ideas is that if I can find one of the flutes, I can then find the others by just going around at 30 degrees (there are 12 flutes) and find the location of all the flutes. In the VB code I've tried to explain my algorithm so I won't explain it here. I also think this algorithm is needlessly complicated and stupid as I'll explain later.
  4. Once I've got one of the flutes, I just find the intersection of a line with at every 30 degrees with the outline curve.
  5. Having all (12) points around the perimeter, I use an loop to scale the shape around the centre of the circle I found in step 1 to get the area within a tolerance value of the actual contact area (satisfying requirement 1). I was using HoopSnake before, but it required resetting every time so I decided to write my own thing.
  6. I then connect the points on both top and bottom to get a solid block.

Now the problems are as follows:

  1. Sometimes the algorithm doesn't find the best location as the starting point. As I said an important thing is that the circle is tangent to the flutes and that is true only if the column profile is larger than a half-circle.
  2. The software I use requires convex blocks. I've tried to remedy this by using convex hull component before step 5 to insure the surfaces are convex.
  3. I'm having issues sometimes with the alignment of top and bottom points. I think I just need to implement a component that sorts the points around a single basis so that there is no twisting.
  4. I've been experimenting with convex hull as a general approach for defining the corner points, but I'm having problem take the convex hull curve and breaking it into a 12 sided polygon, preserving as much as possible the location of the flutes and the general shape of the contact surface.

I'm really sorry about the long post and complicated question. I hope someone can give some pointers on what I could try. I understand that this is not an easy question and that it is more a question of doing something rather than asking about grasshopper itself. My goal is to have an algorithm that I can explain as a general method for others to use in the future when dealing with these structures. This is only a small minor part of my thesis (the analysis is what is important) but it is taking a lot of time to figure out.

If you have any other questions, I would be more than happy to provide a better explanation. In the file I have created a region with all my input parameters. You can choose a different mesh from that point and change various settings. I hope that is self-explanatory.

Thanks for all your help,

Ali

BTW: I'm really sorry for the poor way I've done this stuff so far. I'm not a programmer and apart from some small macros in Excel I don't know much about this stuff. To add to that, I've just started with Rhino and Grasshopper about five days ago after almost pulling out all my hair trying to do this with AutoCAD!

Attachments:

Hi all,

I have been thinking about this and I think using a curve created using the convex hull algorithm might be the "ticket" here. I have been trying to see how I can identify the location of the corners on the convex hull surface.

My current idea is to evaluate the derivative of the points along the curve, shift the list of derivatives by 1 and subtract it from the original list of derivatives. This step is proving very difficult. I tried to use the List Shift component with wrapping enabled to shift the list. But upon subtracting, I get zero results.

If I can get this part fixed, then the next challenge is how to go through this list of differences and identify and separate out maximum points. I can't use sort because some of the points on the curve will have sharper corners than others. I have to parse the list one by one. I don't know how to do this with GH components. I may have to do it in VB.

Any ideas?

Ali

When you say block what do you mean?

is it a closed nurbs surface ?

I know it is a bit confusing. So I have the actual closed meshes which represent the column drums.

Through the GH algorithm I want to derive two surfaces on top and bottom having the same number of nodes. I supply these points to the program and it generates a prism. That constitutes the block inside the program. I mimic this behaviour in the algorithm by creating the top and bottom polyline and then creating lines between points on the top and bottom and lofting over top. It is basically the right most part of my algorithm.

The main point of the algorithm is to come up with a "good" definition of the top and bottom surfaces. I'm not interested in stuff in between. If I want to take into account holes in the middle of a drum, I can break it into two blocks for analysis purposes.

Are you restricted to any number of points to define the surfaces?

can they be trimmed surfaces?

I'm not restricted on the number of points. However, in order to save computational effort in my analysis, the goal is to minimize the number of vertices. So my idea was to stick with 12 points on each surface, equal to the number of flutes (ribs) on the columns. The thing is that the number of points on top and bottom must be the same and defined in the same order.

I'm not sure what you mean by trimmed surfaces. The top and bottom will have to be flat. The surfaces must be convex and the resulting prism must also be convex (it has to do with computational effort in evaluating contacts). Does that help?

Here's what I've got so far, to see if any of this is along the right lines.

It doesn't work so well at the top though

Attachments:

This is amazing! It is so much neater and simpler. I'm trying to understand what is happening at the moment. But I think this is exactly what I had in mind. I'm not sure if you are doing a comparison of contact areas in this, but that is something I can try and figure out how to build into this (without messing it up too much).

I'm trying to output the coordinates into the analysis software to see if everything works. I'll let you know as soon as possible.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service