A hackable C# based scripting environment for 3D modeling running in the web browser.

Overview

Hackuble gif Hackuble icon
A hackable C# based scripting environment for 3D modeling running in the web browser.

Background

Script based 3D modeling software running in the web browser typically requires expertise in JavaScript (JS). This isn't a surprising fact, since web browsers are built specifically for interpreting and executing JavaScript code. However, while JavaScript is a great language, many professionals in the AEC industry (architecture, engineering and construction), are far more comfortable with programming languages such as C#. This is mainly because lots of CAD, BIM and analysis software have C# SDKs which have been widely adopted. That means that aspiring AEC professionals either have to pick up a new language and eco system (JS), or go back to desktop based 3D modeling software to achieve this. Hackuble aims to bridge this gap.

Hackuble is a generative 3D modeling environment built to write and execute C# code in the browser. Scripts can either be authored in the application, or brought in by loading compiled .NET dlls. The scripts can manipulate the 3D scene, such as adding objects. Each script becomes a button, which can be executed later on.

Context

This project was initially developed in the context of the CORE studio Thornton Tomasetti AEC Summer Hackathon 2021. The team consisted of the following people:

Among other things, a major motivation for this project was the democratization of tools for design. The power to develop your own tools implies freedom and empowerment of creativity.

Features

Write, compile and execute C# scripts in the browser.

Hackuble comes with an in-browser scripting editor, where you can write and compile C# code to interact with the 3D viewport. Add your code to the RunCommand method and hit compile. You'll see a new button showing up in the toolbar which can be pressed to execute your code.

Hackuble gif Writing, compiling and running scripts in Hackuble.

Register command arguments to provide user input

Commands can have input arguments, which will be presented as a modal to the user when running the script. Override the RegisterInputArguments method and add your command arguments with type, name, description and default value. Then use the DataAccess object inside of the RunCommand method to read the input values of the parameters.

Hackuble gif Adding a command with custom inputs.

Use the Hackuble SDK to build your own script libraries (dll) in Visual Studio

Hackuble offers an alternative way to add command buttons to the user interface. By importing the Hackuble.Core dll into your own dotnet standard library, you can write and compile your own Hackuble plugin and upload it to the web application at runtime. The dll is then parsed and all types inheriting from AbstractCommand will be registered and added to the user interface.

Hackuble gif Compiling and uploading custom Hackuble plugin dlls from Visual Studio.

Getting started

Prerequisites

  • Latest version of VisualStudio 2019 link

Installation

  1. clone the repo
git clone https://github.com/EmilPoulsen/Hackuble.git
  1. Open Hackuble.sln
  2. Compile the Hackuble.Examples project.
  3. Set the Hackbule.Web project to start up and hit the debug button.
  4. Once the application is started, click on the "Load Library" button in the side bar. Locate the Hackuble.Examples.dll in the output from step 3 and select it.
  5. You should see buttons showing up in the sidebar.
  6. Clicking on one of those to test a command.

Create a script

Hackuble's system for adding scripts should look familiar to someone with experience with Revit/Rhino/Grasshopper tool development:

  1. Create a script by adding a new class and inherit from AbstractCommand.
  2. Write your script in the RunCommand override method.
  3. A Context object is injected into the RunCommand method, which you can use to interact with the scene, for instance adding objects to the scene.
  4. Each script can have a series of input parameters. These will be presented to a user through a modal in which they can specify values for the input parameters. Use the RegisterInputArguments override to add inputs.

See example below:

public class AddCubeWithColorCommand : AbstractCommand
{
    //Override there properties to configure the command.
    public override string Name => "Add Cube With Color";
    public override string Author => "Emil Poulsen";
    public override string Description => "Add a cuboid to the scene";
    public override string CommandLineName => "cube-colors";
    public override string Accent => "#FF96AD";

    //Here's where inputs are registered
    public override void RegisterInputArguments(DataAccess dataAccess)
    {
        dataAccess.RegisterTextArgument("Color", "The color of the cube in Hex Format", "#FF96AD");
    }

    //Here's the method that is called when the button is clicked.
    public override CommandStatus RunCommand(Context context, DataAccess dataAccess)
    {
        //Use the DataAccess object to read the user provided inputs registered above.
        string c = "#ffffff";
        if (!dataAccess.GetData<string>(0, ref c))
        {
            return CommandStatus.Failure;
        }

        //Use the context object to add a cube with specified color to the view port.
        context.AddCube(20.0, 20.0, 20.0, 0, 0, 0, c);
        return CommandStatus.Success;
    }
}

Tech stack

The following key technologies have been adopted in Hackuble:

Note that Hackuble is a front-end only application, meaning there is no need for a back-end. This is possible through Blazor and WebAssembly!

Road map

  • Extend the functionality of the Context object to better reflect the state of the three.js scene.
  • Implement view port interaction to allow adding objects manually.
  • Web-based Visual Scripting Interface for Chaining Commands and Faster Parametric Design.
  • Integration + Interop with p5.js, ml5.js, and more.
  • Integration + Interop with ShapeDiver, Rhino.Compute and more.
  • One-click Deployment packages for local on-premise installation as well as cloud instances.
  • Multi-platform ‘sister’ environments for interop with the likes of Unity, UE4 and more.

License

MIT

You might also like...

WebVM is a server-less virtual Linux environment running fully client-side in HTML5/WebAssembly.

WebVM This repository hosts the source code of the https://webvm.io live demo page. WebVM is a server-less virtual Linux environment running fully cli

Jan 8, 2023

Jugglr is a tool for managing test data and running tests with a dedicated database running in a Docker container.

Jugglr Jugglr is a tool for managing test data and running tests with a lightweight, dedicated database. Jugglr enables developers, testers, and CI/CD

Aug 20, 2022

UAParser.js - Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data. Supports browser & node.js environment.

UAParser.js - Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data. Supports browser & node.js environment.

UAParser.js JavaScript library to detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data with relatively small footprint (~17KB m

Jan 4, 2023

Javascript implementation of flasher tool for Espressif chips, running in web browser using WebSerial.

Javascript implementation of esptool This repository contains a Javascript implementation of esptool, a serial flasher utility for Espressif chips. Un

Dec 22, 2022

A collection of retro emulators running in the web browser.

A collection of retro emulators running in the web browser.

RETROCADE is (going to be) a collection of browser-based emulators capable of playing games from retro consoles and arcade machines, optimized for use both on desktop computers as well as mobile devices. The right tool for all your retro gaming needs!

Feb 18, 2022

Tools for Dump NUXT JS Environment Config Through Browser Window Object

Tools for Dump NUXT JS Environment Config Through Browser Window Object

Introduction Nuxt JS is an open source javascript framework making web development simple and powerful. This tool is used to get environment configura

Sep 5, 2022

💄 An app to create, edit, and preview HDR environment maps in the browser

💄 An app to create, edit, and preview HDR environment maps in the browser

Environment Map Light Editor Create, edit, and preview HDR environment maps in the browser. Preview your models in realtime and export lightmaps to us

Dec 30, 2022

Browser-compatible JS library for running language models

Huggingface Transformers Running in the Browser This library enables you to run huggingface transformer models directly in the browser. It accomplishe

Jan 8, 2023

Javascript library for generating identicons. Running in the browser and on Node.js.

Javascript library for generating identicons. Running in the browser and on Node.js.

Jdenticon JavaScript library for generating highly recognizable identicons using HTML5 canvas or SVG. Live demo https://jdenticon.com Getting started

Jan 3, 2023
Comments
  • Coordinates and dimensions of addCube are switched

    Coordinates and dimensions of addCube are switched

    I started playing with hackuble this morning. I read through the Geometry code to understand the inputs of Cube and addCube functions in C#. I would expect that the first three inputs (named x,y,z) would be the position coordinates of the cube (perhaps the center although this is not specified in the code). And the inputs named width, depth, height to be the dimensions of the cube. Yet the reverse is happening. Having a look at the JS code that adds the sphere to the context it is clear that x,y,z are being used to create the geometry and width, depth, height as the position coordinates.

    bug good first issue 
    opened by filipejsbrandao 4
  • Shift in rendered objects on the scene

    Shift in rendered objects on the scene

    The objects that are rendered on the scene are shifted to the right relative to the center of the canvas. This causes the THREE.raycaster to appear to fail detecting intersections with the objects on the scene. Couldn't find yet why this is happening, tough.

    opened by filipejsbrandao 0
  • * RangeArgument.cs: A new range argument

    * RangeArgument.cs: A new range argument

    Testing the waters with the a new range argument.

    • AddCubeSliders.cs: A new example file with a range argument

    • DataAccess.cs: Changed to include the new range argument

    • NavMenu.razor: Added the range argument

    opened by filipejsbrandao 1
Releases(0.2.0)
  • 0.2.0(Feb 6, 2022)

    What's Changed

    • readme fix by @EmilPoulsen in https://github.com/EmilPoulsen/Hackuble/pull/6
    • Added a boolean input by @filipejsbrandao in https://github.com/EmilPoulsen/Hackuble/pull/8
    • minor updates for boolean input PR by @EmilPoulsen in https://github.com/EmilPoulsen/Hackuble/pull/9

    New Contributors

    • @filipejsbrandao made their first contribution in https://github.com/EmilPoulsen/Hackuble/pull/8

    Full Changelog: https://github.com/EmilPoulsen/Hackuble/compare/0.1.0...0.2.0

    Source code(tar.gz)
    Source code(zip)
  • 0.1.0(Jul 13, 2021)

Owner
Emil Poulsen
Computational design, AEC tech, digital architecture and structural engineering.
Emil Poulsen
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
This web application retrieves real live data from the Financial modeling prep API

This web application retrieves real live data from the Financial modeling prep API. It provides financial information about companies listed on Nasdaq 100 and Dow Jones Market indexes. All these companies are listed on the Home page. Users can filter these companies by searching for a specific company or by choosing one from the dropdown.

Sahar Abdel Samad 7 May 31, 2022
🎨 Flat, simple, multi-themed, responsive and hackable Color-Picker library.

?? Flat, simple, multi-themed, responsive and hackable Color-Picker library. No dependencies, no jQuery. Compatible with all CSS Frameworks e.g. Bootstrap, Materialize. Supports alpha channel, rgba, hsla, hsva and more!

Simon 3.9k Dec 27, 2022
Visualize, modify, and build your database with dbSpy! An open-source data modeling tool to facilitate relational database development.

Visualize, modify, and build your database with dbSpy! dbSpy is an open-source data modeling tool to facilitate relational database development. Key F

OSLabs 115 Dec 22, 2022
mirrord lets you easily mirror traffic from your production environment to your development environment.

mirrord lets you easily mirror traffic from your Kubernetes cluster to your development environment. It comes as both Visual Studio Code extension and a CLI tool.

MetalBear 2.1k Dec 24, 2022
Safe and controlled language for scripting.

Retagged Custom simplified language created for Aun. Keep in mind this is mainly made for Aun and under heavy development. Installation Coming soon...

Hue 3 Jan 13, 2022
A cross-platform AutoHotKey-like thing with TypeScript as its scripting language

suchibot A cross-platform AutoHotKey-like thing with JavaScript/TypeScript as its scripting language. Built on top of uiohook-napi and nut.js. Install

Lily Scott 79 Sep 21, 2022
A program that makes scripting videos easier.

QuickScript A program that makes scripting videos easier. Scripts can be written using only the keyboard. Installation Clone/fork the repository Insta

Samuel Albert 18 Jun 22, 2022