/four-bar-rs

FouršŸ€bar is a simulator, a synthesizing tool for four-bar linkage mechanism.

Primary LanguageRustGNU Affero General Public License v3.0AGPL-3.0

FouršŸ€bar

dependency status documentation

Web demo: https://kmolyuan.github.io/four-bar-rs/

FouršŸ€bar is a simulator and a synthesis tool for four-bar linkage mechanism.

GUI powered by https://github.com/emilk/egui.

Release

Download: https://github.com/KmolYuan/four-bar-rs/releases/latest

Native GUI is the default startup behavior, use --help option to see more commands.

# Equivalent to double-clicking the executable
four-bar
# Equivalent to opening by the app or file dragging
four-bar FILE_PATH1 FILE_PATH2

Some platforms require additional dependencies as listed below. If your platform have no pre-compiled binary, you need to build from source.

Windows

The executable requires support for Visual C++. You can refer to the Visual C++ support documentation for installation instructions.

Linux

libxcb and libgtk-3 are required to run the application on Linux, and most desktop environments come with these packages pre-installed.

NetBSD

On NetBSD a pre-compiled binary is available from the official repositories, to install it simply run:

pkgin install four-bar-rs

Build from Source

In Linux, you need to install some library for GUI.

This is an example for apt, please see https://github.com/emilk/egui#demo.

sudo apt install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libgtk-3-dev

Then run with cargo directly:

cargo build --release
cargo run --release -- --help

WebAssembly

Powered by trunk, a Rust CLI tool for creating bin-type WASM projects.

Run those scripts from the repository:

rustup target add wasm32-unknown-unknown
cargo install trunk
cd four-bar-ui
# Serve in localhost
trunk serve
# Compile WASM
trunk build --release

The application package will be deployed in the dist directory.

File Format

FouršŸ€bar uses a custom file format to store the linkage data. The file is a plain text file of RON syntax.

Synthesis Target Format

The target coupler curve can be input from:

  • CSV .csv file
  • RON .ron file as a linkage to generate a coupler curve

The file name should be name.mode.ext pattern, where

  • name is the name of the case, can be any string
  • mode is the mode of the target curve, can be closed, open, and partial
  • ext is the file extension, can be csv or ron

For example, example.closed.csv is a target closed curve in CSV format.

Figure Configuration

The figure configuration is a RON file with the extension .fig.ron. FouršŸ€bar GUI can import figure configurations to generate linkage plots, and the syn command will redraw the linkage result without cleaning if the figure configuration exists.

Citations

  • Chang, Y., Chang, JL., Lee, JJ. (2024). Atlas-Based Path Synthesis of Planar Four-Bar Linkages Using Elliptical Fourier Descriptors. In: Okada, M. (eds) Advances in Mechanism and Machine Science. IFToMM WC 2023. Mechanisms and Machine Science, vol 149. Springer, Cham. https://doi.org/10.1007/978-3-031-45709-8_20