go-bjk

module
v0.0.0-...-e153092 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2024 License: Apache-2.0

README

go-bjk

go-bjk is a Go package used to generate *.bjk input files for the node-based parametric modeling program called "Blackjack": https://github.com/setzer22/blackjack

It uses gopher-lua to parse and execute all the Luau Programming Language scripts from the Blackjack repo which enables it to understand the "standard library" of nodes provided by Blackjack for use in building a model. Once the node library is parsed, Go programs can be written that build up a network of nodes by intelligently connecting the named nodes, inputs, and outputs, and finally writing out a Blackjack-compatible *.bjk file, ready for parsing.

This package also includes an AST generator using Participle that parses arbitrary Blackjack *.bjk files into Go structs.

Examples

With the Go Programming Language already installed, follow these steps in a command-line shell terminal window:

git clone https://github.com/gmlewis/blackjack
pushd blackjack
BLACKJACK_REPO_DIR=$(pwd)
popd
git clone https://github.com/gmlewis/go-bjk
cd go-bjk
go run examples/bifilar-electromagnet/main.go -repo ${BLACKJACK_REPO_DIR} > bifilar-electromagnet.bjk

Then to build and run blackjack_ui, you need to have already installed the Rust Programming Language, then execute the following code:

cd ../blackjack
cargo build --release --bin blackjack_ui
./target/release/blackjack_ui ../go-bjk/bifilar-electromagnet.bjk

This program will generate a file called "bifilar-electromagnet.bjk" which, when opened with blackjack_ui, will look something like this:

blackjack_ui

Directories

Path Synopsis
Package ast defines the AST grammar for BJK files.
Package ast defines the AST grammar for BJK files.
cmd
bjk-to-obj
bjk-to-obj loads a Blackjack BJK file and writes a Wavefront Obj file.
bjk-to-obj loads a Blackjack BJK file and writes a Wavefront Obj file.
bjk-to-stl
bjk-to-stl loads a Blackjack BJK file and writes an STL file.
bjk-to-stl loads a Blackjack BJK file and writes an STL file.
extrude-helix
extrude-helix tests the STL output for MakeQuad + Helix + extrude
extrude-helix tests the STL output for MakeQuad + Helix + extrude
extrude-quad
extrude-quad tests the STL output for MakeQuad + extrude
extrude-quad tests the STL output for MakeQuad + extrude
make-bfem-cage
make-bfem-cage tests the STL output for BFEMCage.
make-bfem-cage tests the STL output for BFEMCage.
make-box
make-box tests the STL output for MakeBox.
make-box tests the STL output for MakeBox.
make-elbows
make-elbows tests the STL output for several elbow-like structures.
make-elbows tests the STL output for several elbow-like structures.
make-herringbone-gear
make-herringbone-gear tests the STL output for HerringboneGear.
make-herringbone-gear tests the STL output for HerringboneGear.
make-svgpath
make-svgpath tests the STL output for SVGPath.
make-svgpath tests the STL output for SVGPath.
examples
bifilar-electromagnet
bifilar-electromagnet generates a Blackjack .bjk file that represents a bifilar electromagnet similar to those found here: https://github.com/gmlewis/irmf-examples/tree/master/examples/012-bifilar-electromagnet#axial-radial-bifilar-electromagnet-1irmf
bifilar-electromagnet generates a Blackjack .bjk file that represents a bifilar electromagnet similar to those found here: https://github.com/gmlewis/irmf-examples/tree/master/examples/012-bifilar-electromagnet#axial-radial-bifilar-electromagnet-1irmf
Package nodes loads the Blackjack Luau scripts and makes them available for building up BJK AST trees with a simple connection API.
Package nodes loads the Blackjack Luau scripts and makes them available for building up BJK AST trees with a simple connection API.
Usage: go run gen-gears.go
Usage: go run gen-gears.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL