Ga naar inhoud

Draw with a script

Deze inhoud is nog niet vertaald.

A script draws members from a rule instead of by hand: a vault on the golden ratio, a row of portal frames, a spiral stair. You do not have to write it yourself. The Script tool writes a prompt for ChatGPT or any other assistant, and you paste the code it sends back. The script declares its own sliders, so you can change the design afterwards without touching the code.

This works with any assistant, also a free account. No connector or developer mode is needed.

  1. Open the fitting view and choose Insert > Construct > Script. You do not need to select anything first.
  2. Under What do you want to make?, describe the design, for example “a roof on the golden ratio spanning 6 metres, ribs every 1.5 metres”.
  3. Click Copy for AI and paste the prompt into ChatGPT. The prompt tells the assistant which functions exist, the timber rules and what is in your model.
  4. Copy the assistant’s reply and paste it into Code. You can paste the whole reply: the text around the code is left out.
  5. Click Run, or press Ctrl+Enter (Cmd+Enter on a Mac). The model shows the result in blue.
  6. Move the sliders under Parameters. The script runs again after each change.
  7. Click Apply. The members become ordinary parts with part numbers, and Undo removes them in one step.

To try the tool without an assistant, pick a script under Load an example.

If the script fails, the panel shows the message and the line. Click Copy problem for AI, paste it into the same chat, and paste the corrected script back.

If the script runs but joints are not right, the preview lists the warnings. Copy issues for AI sends them to the assistant with the member and the line of code each one comes from.

To change a script, write the change under What do you want to make? and click Copy for AI again. The prompt then carries the current script and its slider values, so the assistant changes it instead of starting over.

A script can say how its members join, not only where they are. Ask for it in your request, for example “let the posts 20 mm into the beam” or “notch the joists 15 mm over the beams”. The assistant knows the functions for it:

  • joint() with ends sets one member end: what it is cut against, how far it is let into that member, or a trim.
  • lap() says how a crossing is cut: how deep each member is cut, or a joint of your own.
  • jointDefinition() describes that joint, the way the joint editor does, sized from the timber so it fits any section.

A member can also carry a role, such as kolom or spoor, which later versions use to choose joints by role.

  • Select members before you open the tool. The script sees them as selection, with their ends, length and section.
  • Click Pick points and click points in the model. The script sees them as picked.
  • A point slider has Pick in model to take its value from a point you click.

Both are optional. The prompt lists what you selected and picked, so the assistant can build on it.

Insert > Construct > Patterns lists the script as a pattern. Opening it shows the stored result without running the code. Change a slider or the code and run it again: members that keep their key keep their part number. A name you gave a part in the list stays too.

  • One script makes at most 1,000 members and 20 profiles, and must finish in 5 seconds.
  • Scripts make new members. They do not move members you drew yourself.
  • A script only draws timber. Boards, roofing, glass, fixings and foundations are not modelled.
  • The drawings and the warnings are not a structural check.