Johann Felipe Gonzalez – johannavila@cmail.carleton.ca

About this project

We present our Bidirectional Programming version of OpenSCAD. We have integrated navigation and editing through interactions with the view.

Getting started

This project is currently supported only for MacOS. You can download the latest binaries of our version on this link. Also, it works well in ONE file models. We will release updates shortly to support multiple files.

Start the application

This version of OpenSCAD is under development and it does not have a Developer ID certificate. Thus, when you try to run it, a warning message indicates that the system can not open the application because it cannot confirm the developer’s identity (Fig. 1).

Fig1. Error message when starting the app

You can do a secondary click (typically a two fingers tap or a right click). The system will display an options list. Select the option “Open” (Fig. 2). A pop-up will appear asking for confirmation of this action. Confirm by pressing the “Open” button.

Fig 2. Secondary click on the app to open it
Fig 3. Click on open button

You will see the normal OpenSCAD interface.

Bidirectional Programming Features

We have implemented two sets of features: Navigation and Editing. Please activate both features before start

Activating

Typically, the settings for editing from the view are set by default. You should see at the bottom of the View Area three new buttons: Translate, Rotate, and Scale. If not, go to settings -> editor. Scroll down and find the options “Enable direct manipulation” and “Highlight Edges when you select an object”. Check them. If they are already checked, uncheck them, and recheck them. The system should have placed the buttons previously mentioned in the view area.

Fig 4. Enabling direct manipulation on settings window, editor tab.

Navigation

We developed a series of features to assist users in understanding how the code is related to the elements in the view.

Reverse search

The original version of OpenSCAD allows right-clicking on the view elements to display a list of the code statements contributing to creating that part. In our OpenSCAD version, when you hover over the different items on the list, the system will mark that element as the target. The program colors green the edges of the target. It also highlights the code statement, including its scope, that creates the target in the same color. The system highlights in green the code statements of the call stack involved in the target. It adds a number on the editor’s margins to follow the target’s stack order.

Fig 5. Selecting an object after right-clicking on it. Users can hover over the items in the list while the system shows visual feedback connecting the code with the view.

Suppose the code statement of the target creates other elements in the view (for instance, a code statement inside a loop or in a module instantiated several times). In that case, these elements are marked as impacted. The system colors pink the edges of impacted elements in the view. Consequently, the code statements in the editor are colored pink. If the target part is created by a difference or an intersect statement, the system adds colored ghosts of the removed part in the target and impacted elements. The user can now right-click on the ghost to explore their code, just like the other parts.

Forward search

The user can also search elements from the code editor. By selecting at least two text characters and pressing the key F1, the system will locate the parts in the view created by the code statement. If only one, the system will mark the part as the target. Otherwise, all elements will be marked as impacted. If the user selects the text of variable definitions, the system will find all the elements impacted by the variable and will mark the impacted. The system will color the edges, create ghosts, and highlight the code, as it is described in the reverse search.

Editing

The system allows users to perform some edits directly from the view.

Performing edits

To edit the view, you must first select the element you want to edit. You can do it by marking an element as a target using the Reverse search feature explained previously. Then, you can select between the three available buttons to perform the spatial edits of Translate, Rotate, and Scale.

Fig 6. After selecting an element, press the operation button at the right bottom of the view area. In this case Rotate button

After clicking, the system places a widget representing the three axes (X,Y, and Z) in the center of the target object. You must select the axis you want to edit by clicking on it. The widget will turn opaque purple, indicating you are in editing mode.

Fig 7. Click the widget of the axis you want to modify. Purple color indicates you are in editing mode

You can click anywhere on the view and drag and drop to perform the edit. The system will automatically add or modify a pre-existing statement in the code while updating the 3D view.

Fig 8. By dragging and dropping you can perform the edit directly in the view while the system updates the code coherently

Limitations

This is a project in development and as such it has some limitations.

Only one-file models

Currently, interactive features ONLY work with models scripted in one file

Constraints editing not supported… yet

Currently, the system does not support making edits on statements with variable-based constraints. When trying to edit one, the system will not perform any action.

Previous versions

For checking previous versions visit this link.

Contact us

The system is under development and it is not stable. Please contact us to johannavila@cmail.carleton.ca if you need assistance.