I am a newbie and therefore still relatively inexperienced in terms of scripting and the possibilities.
I would like to pull up walls in 3D and connect them to a box, then copy it several times in all directions. So to say a big box from several small ones. Then I would have to be able to delete certain walls automatically, so that a kind of structure is created.
Kinda like this
Is this possible? Can anyone help me?
The Wasp add-on for Grasshopper might be the right way to accomplish this. You can find plenty of tutorials on YouTube on how to use it.
Unfortunately I have to script it with Python.
The example was written by Grasshopper and I was hoping there would be a way to script such things in Python too.
OK, you sure can. Do you have the example file? If so, can you upload it (or post a link)?
Luckily I have.
The file contains more than I actually need. For me the structure would be enough with just the walls.
SuperPart 02.gh (314.0 KB)
And here SuperPart 02.zip (2.0 MB)
Haha, so the reference project was done in Wasp. Fun fact: Wasp is actually written in Python.
What box? Do walls and floor slabs “grow” until they reach a pre-placed box, or how should this work?
Can you maybe upload a diagram or sketch of a simplified scenario?
So everything should be contained in a larger box, a bounding box so to speak?
Unfortunately, there is no such thing as “automatically” in scripting! You can either delete walls randomly - which would mean that you’d have very little control -, or you have to come up with a rule set, which might be the better approach.
Haha really? As I said, I am a complete Newbie
I must have expressed myself a little unhappily. I would like to transfer this file into a Python script, only consisting of the walls, without columns and stairs.
Rules? I already thought of something like that, but I don’t know how to implement it, which code would be necessary and so on.
You’ve answered literally none of my questions from my post above!
I don’t know how best to describe it
The word box doesn’t quite fit it in this case. I want to transfer the uploaded script exactly like this into a Python script, but without pillars and stairs.
So actually you can forget the description at the beginning.
The walls should develop in all directions until they have reached a certain size. Actually the walls should form rooms, from which certain walls are erased by rules.
I have tried to represent the idea
So what you could do is write a function or class that returns/represents a two-dimensional grid.
For each level/floor of your building you then generate a grid, where each grid cell represents a possibility to materialize/grow the floor slab of that level, and the overall size of the grid represents the outer growth limits.
For the ground floor the slab growth could be random until a certain number of cells have solidified, and for the floors above it could be made dependant on their corresponding levels below. One rule could possibly be that a column or wall should be underneath the grid cell in question for it to be allowed to become possible.
With the rules you already came up with this should yield an interesting result and there’s no need to go back and delete stuff manually. The result emerges so to speak.
How you distribute walls and columns is up to you, but I’d start with programming the base grid first.
The way you explained it, sounds like easy work, so it seems logical and the approach will surely lead to success, but now I have the question, how to script it, many commands are still unknown to me and that’s why I don’t know which code is the best to start with
Have you programmed before, or is this your first rodeo?
A little but always with help and rather the basics of the basics.
There is a free online course offered by Coursera named ‘Design Computing: 3D Modeling in Rhinoceros with Python / Rhinoscript’. I started it but got into a time-squeeze so had to temporarily stop, but I found it very worthwhile when I was taking it. I did have one problem getting started, which you may not have, which was being able to import Rhinoscript into the Python program. But when I used the Atom editor to open Python (I think this is right, it was a little while ago) I was able to import Rhinoscript with no problem. Oh, what Python imports is ‘Rhinoscriptsyntax’. It’s all very clear in the course. Good luck, and I have to say that you certainly seem ambitious!
You may have already found most of this, but a good place to start is with the documentation for rhinoscriptsyntax:
You can write python scripts directly in rhino by typing in “EditPythonScript”. This brings up the rhino python editor, which provides a list of commands, autocomplete, etc. It’s not the most fully featured editor, but it’s a good place to get started and lets you run your script in rhino with a single click.