OpenAI Explorer (Experimental)

An experimental extension to use OpenAI’s services to create or manipulate geometry in SketchUp using natural language.

Description

This tool uses OpenAI’s API service to generate SketchUp Ruby code that – when executed – can draw geometry (e.g. with the prompt “Draw a 2 inch box”) or manipulate drawn objects (e.g. with “Color the objects in the selection randomly using five blue tones”).

Usage

You can find this tool under the Extensions menu. Your first step should be the settings dialog, which you can find under the OpenAI Explorer (Experimental) > OpenAI Settings menu item:

Settings dialog

Before you can use this tool, sign up for OpenAI API access and generate an API Key here. You then need to enter the key in this dialog and you should be good to go. All of the other settings can stay as they are for now.

There are several ways to customize the tool, however. For example, you can enter a different model than the default “text-davinci-003” here. You may also want to adjust the max. tokens. This number controls the length (and thereby potential cost) of the response. It is likely good to keep this number low unless you need it higher. Furthermore, the “temperature” controls “creativity” in the answer and therefore is more deterministic at zero and more variable (and possibly incorrect) at higher values.

The first and last options in this dialog control the request and the response. If you just want to see the response and not execute the code, then you have an option here to choose that. Basically, there are two ways this tool can be used:

  • With the Use SketchUp Ruby prompt prefix and execute code option at Yes: Use this to draw or manipulate something based on your prompt. This is the default method that lets you control SketchUp with natural language (e.g. “Draw a 2″ box”).
  • With the None prompt prefix and execute code option at No: Use this to ask the AI anything that does not necessarily generate code (e.g. “Tell me a joke”).

The actual AI Prompt can be found in a different dialog, which opens up when you click the OpenAI Explorer (Experimental) > OpenAI Explorer menu item:

Input dialog

This is located in a different dialog than the settings so that the user can pre-set a keyboard shortcut for this tool and quickly type questions for the AI engine. After selecting OK here, the Ruby Console will open so that the prompt and the answer become visible.

In the future – and if this proves useful – I will redesign the UI. At this point it is more of a proof of concept. Feel free to suggest improvements in the comments below.

Screenshots and Videos

Downloads

You can now find this extension in Trimble’s Extension Warehouse (TBD). For an easy install (and update notifications), browse to it from inside SketchUp (2013 or newer) and install it directly.

ALTERNATIVE DOWNLOADS

Linked below are the installation files (RBZ format) for the current and some previous versions of this extension.

To install these files, follow the SketchUp folks’ instructions. You can also find this extension on GitHub (TBD).

Revision History

  • Version 1.0.2 (3/28/2023):
    – Fixed error handling bug
    – Added a double-check for delete requests
  • Version 1.0.1 (3/24/2023):
    – Added cleanup for the returned code/text
    – Added error handling for API and a one-time warning for the extension
  • Version 1.0 (3/18/2023): – Initial release

References

Yes, you can use OpenAI’s GPT AI to Create Geometry in SketchUp