Giter VIP home page Giter VIP logo

3d-hanzi-generator's Introduction

3d Hanzi Generator

Introduction

This program generates a 3d model of a Hanzi/Kanji character using stroke data from Make me a Hanzi. It extrudes the character with the stroke order as the Z dimension.

It does this by splitting up each stroke into parts following the stroke order, and then skewing each part to form a slope.

In this blog post I go into detail about about the inner workings of this program. It uses SolidPython, OpenSCAD, Voronoi diagrams, PCA, and quite a lot of linear algebra.

Examples

Watch this YouTube video to see some examples.

Example image ็ˆฑ

Usage

The input of the program is a .yml file containing the settings to generate the model.

python src/main.py --out-scad main.scad --stl true --out-stl main.stl --settings examples/ai.yml --parts strokes

See src/base_settings.yml for all configuration options.

Installation

# Create a venv or similar, then:
pip3 install -r requirements.txt

Installation on ARM macOS

Due to the unavailability of ARM-compatible wheels for Scipy (and other libraries), you can use Miniforge instead: Note: this doesn't always work properly, so your mileage may vary.

cat requirements.txt | xargs -n 1 pip install # this will fail for some packages
conda create -n 3d-hanzi-venv
conda activate 3d-hanzi-venv
while read requirement; do conda install --yes $requirement || pip install $requirement; done < requirements.txt

Scipy issue: scipy/scipy#13409

Printing workflow

  1. Generate strokes STLs and plate,pillars STLs
  2. Verify design
  3. Import to PrusaSlicer
  4. Split to objects (top menu)
  5. Export from PrusaSlicer as STL
  6. Import in Cura
  7. Use tree supports and raft to slice and print (preset available at res/cura-preset.curaprofile)

Contributing

Please use black (pip install black) for formatting.

3d-hanzi-generator's People

Contributors

hansottowirtz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

zhishouxin

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.