Trying to make a script, that can generate stairs on the terrain, using shortest walk. What I have for now:
6.3dm (501.8 KB)
6.gh (34.6 KB)
the main problem is heights. If I just use series for every step, the ladder will just
disperse with a terrain level. What do you think, is there a solution, or I need to start over again with a completely another logic?
I suggest that you edit the thread title to include āon terrainā, as in āGenerative staircases on terrainā.
The phrase āany adviceā isnāt helpful.
I canāt open your R7 .3dm file using R6.
I donāt see any reference to Contour in your GH file, which I think would be useful for steps or terracing on terrain?
I internalized the surface and the mesh output from TriRemesh for you so TriRemesh isnāt required
6.gh (270.2 KB)
Thanks for trying, still no go for me, but thatās OK. There are plenty of threads about terracing.
Thank you Joseph. These threads are helpfull, but my definition isnt exactly about terracingā¦
Iāve replaced components, so you can watch this gh once again, and maybe give me some idea:
6 replaced.gh (256.3 KB)
thank you!
I have used Contour(ex) component.
itās a nice topic and a nice script!
I have moved the end point around and ,despite some improvements might be needed, the definition looks like working pretty nicely
it is not completely clear to me what kind of step/flats combination you are trying to achieve for each mesh-edge⦠I see you are tri-remeshing the initial mesh in such a way you get triangle edges with length approx 15 units, then you are culling out edges whith angles higher than 25 degrees with their projection (which means you end up with edges which have a slope of 25 degrees or less) and at that point you use shortest walk to generate the final path
the amount / distribution of steps / flats you will have for each edge, depends on angle and length of each edge that compose the final path: a steeper edge will require more steps while a flat edge will require more flats and less steps
at that point, how you distribute your steps along each edge is something you can customize: for instance you can decide each edge always starts and ends with a flat part, or maybe you want flat/steps/flat/steps/flat, or you want steps/flat/steps⦠any solution is possible
I see a lot of gaps between flats and stairs, and several steps that were generated despite not having the required height to allow them to exist
would something like this maybe work? itās just a fast sketchā¦
this generates flat/steps/flats⦠but again, any distribution is possible
stair_from_2Pts.gh (25.3 KB)
Thanks. Your code looks more sophisticated than this first draft of mine, though I must admit I didnāt try very hard to understand it. I discarded everything after ShortWalk and started from scratch, knowing that this approach is too simplistic as is. No effort to resolve short treads or long ones, as expected on a real trail. There are some games that could be played with this but I suspect an iterative approach (Anemone) might ultimately work best, as real trail builders would likely do.
The vertical Move tacked on at the end raises all steps just enough to be visible.
terrain_steps_2021_Jul14a.gh (253.9 KB)
P.S. Yellow group adds Fillet to smooth the corners of the trail.
terrain_steps_2021_Jul14b2.gh (243.4 KB)
Short treads (red), medium treads and long treads (blue)ā¦
The reason for having steps of one size height and āgoingā only could be to do with how they are made (from a concrete mould or using pre-cast steps) but what you have done here by colour coding the steps could be a clue to then turning them into groups of fixed steps and varying length flats? I presume its the same grouping as the mesh edges?
So for each mesh edgeā¦
calculate difference in height Z and horizontal distance L,
divide Z by step height = no of steps,
multiply no of steps x step āgoingā (length of tread)
L - length of steps = length of flat.
I donāt quite understand what you are saying? All of the steps in my model are identical in height, itās only tread length (ārunā?) that differs. Thatās what the color gradient is showing. The colors could suggest spots where the trail path could be changed to keep the slope (and therefore step colors and tread lengths) more consistent. Inserting ālandingsā here and there seems difficult for this path since there are few places with little slope. Landings would have to be either elevated or cut into the hill?
I didnāt use the mesh at all, just projected the path onto the hilly surface and intersected it with evenly spaced planes. The step locations are basically contour points on the single projected path curve.
Thank you for putting so much effort Joseph! I really appreciate it. But Iāve already tried this, the problem is, that using this method i cannot achieve different step lenghts, for flats. So I have to choose between two wrong staircases:) I think my code is wrong in the roots, and you are probably right, I have to use anemone. Thank you again!
Thank you for joining conversation! I think what you said is make sense. I need to make flat at least every 18 steps, and, probably, on every point where my shortwalk curve turns. But if I just divide a list of steps from Joseph definition, and insert flats at certain points, i need to somehow move other steps, in the way that they wolud not be floating over terrain, etc. I think I have to start over, and use Anemone at this point.
Thank you for responce! Im glad you are interested!
Actually, Iām trying to achieve pattern: flat on every staircase turn, and flat after max every 18 steps, (could be less).
That is some really cool looking thing, thank you inno, it could be really helpful!
We have two types of stepped paths to the beach in this town (southern Oregon):
- Gentle path with occasional short flights of steps and one longer set at the bottom beach end:
- Steep, elevated endless steps with landings, no path on the ground anywhere:
Is Shortest Walk the best way to choose a route for steps? It looks like you are considering angles when choosing points for the walk but I wonder if it could be done better?
This whole thread is relevant but this post by @DanielPiker has a fascinating video showing pathfinding with Kangaroo:
The approach I used is this - dividing a straight line between the points into many segments, then fixing the ends of these segments in Z, and controlling their length.
If they all have the same length they have the same slope, because the difference in heights of their ends is equal.
Also note that in the elevated beach steps supported on poles, each flight of steps between landings appears to have the same slope. It works because it doesnāt try to follow the ground exactly but relies on the poles instead of a cut-and-fill approach more typical of roadways.
Iām saying to keep the tread lengths (called āgoingā in stair terminology I think) equal as well as the step height you need to split the staircase into sections and add a flat section at the beginning or end.
I think you canāt avoid either steps floating over or being cut into the terrain if you keep the step height and length fixed unless you have so many flat sections that they just become long steps like @Joseph_Oster 's solution.
Check out the link @Joseph_Oster has posted to the definition by Daniel Piker. Thatās really cool!
I didnāt know that! Iāve always used the terms āriseā and ārunā but you are correct about going, so Iāll use that from now on. Apparently ārunā refers to an entire flight of stairs, the sum of āgoingā values.
This (below) is only another sketch of an idea, not a solution. I hesitate to share it but it confirms for me the necessity of an iterative solution, since landing locations and the start of subsequent stair sets (āflightsā?) depend on the previous one. The code is a hot mess so Iāll describe the general idea.
terrain_steps_2021_Jul15b.gh (259.8 KB)
The sliders in the blue group define a single flight of steps in a straight line that is copied (oriented) to various positions along the path, separated by landings. All flights have the same number of steps and all landings are the same length. There are obvious flaws but itās interesting?
An iterative approach (Anemone) could vary the number of steps and length of landings for each flight (between designated min and max values), depending on the changing slope of the path, as well as aligning each flight with the one below it.
The path route still matters and I donāt know yet what the magic algorithm will be but the pictures I posted of beach steps elevated on poles suggest a more realistic approach to this, since it guarantees that all steps will have identical āgoingā values (treads).
This one is not too shabby!
The path is projected onto the terrain surface and contoured, then projected to the āWorld XYā plane along with the contour points. The Anemone loop proceeds through the points and starts a new flight of steps when the horizontal distance from start point to current point is greater than the sum of (numSteps * āgoingā (tread ālengthā)) + āLanding (minimum)ā.
I donāt bother counting steps to force breaking a flight. There is one flight of 23 steps at the steepest part of the path, one flight of 17 steps, one of 16 steps and all the rest have 12 or less. No vertical gaps between flights.
terrain_steps_2021_Jul18a.gh (263.5 KB)
P.S. Laterā¦
-
Added āthickenā (white group) to steps and landings.
-
Centered steps and landings by re-using extrude vector on Move with ā-x/2ā expression.
-
Reduced āLandingā (minimum) to ~73 inches (1.85 meters), reducing longest flight to 20 steps.
-
Added āextend Landingsā slider to close some gaps by making them longer without affecting step positions. Not currently used, still needs work.
-
Fixed mismatched list lengths that caused red error messages (harmless).
-
Separated bulky, unchanging geometry (surface, mesh) and ShortWalk code to another GH file, connected by Data Output and Data Input. Sorry R5 users but this reduces the size of GH code files for steps, the parts that are still changing. Wish we had done this earlier.
terrain_steps_2021_Jul18b.gh (49.4 KB)
terrain_geo_2021_Jul18a.gh (233.9 KB) (REQUIRED only once)
Joseph, thank you so much! Beautiful script, and thats exactly what I was looking for at this stage. I feel guilty that you did all the work!
I was in a trip for a few days, now im at home, and that is my account. I dont have an opportunity to select this as a solution anymore, I would if I could.
Thank you again, best regards
This is a fun challenge. You did the path finding and Iād be interested to see how these steps behave on different paths up the same hill?
Yesterday I played with this and fairly quickly managed to trim off the extended landings at the beginning of the next flight of steps. But then I noticed some subtle misalignments and got curious. One of the problems was caused by inconsistent Offset in the white āThickenā group, which was fixed by providing an appropriate plane to Offset.
Other issues were off-by-one stuff here and there, which I have now fixed (perhaps more complicated than necessary). Finally, I adjusted the cutting planes to allow for thickness, which is only noticeable if you zoom in to the bottom of steps that touch a landing. Quite precise!
terrain_steps_2021_Jul19a.gh (54.7 KB)
(NOTE: Requires terrain_geo_2021_Jul18a.gh from earlier post.)
The steps are raised 0.45 meters (purple group) to avoid cutting into the terrain. The step/landing profiles are shown only for illustration at the original path locations and may be hidden by deleting the red āDelete this!ā group.
All of this thickening and trimming has been done after the Anemone loop, which I havenāt touched at all. One could get carried away with this by adding stringers and supporting poles but the shape of landings will get complicated when there are sharp turns or switchbacks in the path.
Thanks @wim for marking my previous post as solved but this one is really better. Iām done!