Skip to content

sivefunc/ambigram

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

50 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

:shipit: Ambigram

Ambigram Word in the X Perspective
Ambigram Word in the Y Perspective

πŸ”– Table of contents

  1. About
  2. Installation
  3. Example
  4. Notes

❓ About

Ambigram is a small but powerful 3D library that automates the process of creating 3D Ambigrams from two different length strings and with the allowance of whitespaces, the Ambigram generation is customizable in the sense that it supports: font_size, letter_spacing, font_path, bases and letter_support.

πŸ“ Installation

🐧 Binary dependencies (Unix)

sudo apt-get install python3 python3-pip python3-setuptools

🐍 Option 1: Pypi

python3 -m pip install ambigram

βœ‹ Option 2: Git repository (Still connects to Pypi)

pip install git+https://github.com/sivefunc/ambigram.git

πŸ’» Example

Simple Text

from ambigram import Ambigram

ambigram = Ambigram("HELLO", "WORLD", font_size=16)
ambigram.assembly.export('HelloWorld.stl')

#from cadquery.vis import show
#show(ambigram.assembly)
X Perspective Y Perspective
1 2

Two different length string with a Rectangular Base

from ambigram import Ambigram

ambigram = Ambigram("ANDROID", "IOS", font_size=16)
ambigram = ambigram.add_base_rectangle(
    height=ambigram.font_size / 10.0,
    padding=ambigram.font_size / 10.0,
)

ambigram.assembly.export('AndroidIos.stl')
#from cadquery.vis import show
#show(ambigram.assembly)
X Perspective Y Perspective
1 2

Letter Support + Rectangular Base

from ambigram import Ambigram

ambigram = Ambigram("RECURSIVE", "FUNCTION", font_size=16)

ambigram = ambigram.add_letter_support_to_all(
    cylinder_height=ambigram.font_size / 4.0,
    cylinder_radius=ambigram.font_size / 4.0,
    rect_height=ambigram.font_size / 16.0,
)

ambigram = ambigram.add_base_rectangle(
    height=ambigram.font_size / 10.0,
    padding=ambigram.font_size / 10.0,
)

ambigram.assembly.export('RecursiveFunction.stl')

#from cadquery.vis import show
#show(ambigram.assembly)
X Perspective Y Perspective
1 2

Rectangle Minimize + Custom Font

Use this base method when the Strings are from Equal Length or when one string length is multiple from other (e.g 5 and 15 because 15 is 5x3)

from ambigram import Ambigram

ambigram = Ambigram(
    "MATHEMATICS",
    "PROGRAMMING",
    font_size=16,

    # Path to your Font
    font_path="/usr/share/fonts/truetype/ibm-plex/IBMPlexMono-Bold.ttf",
)

ambigram = ambigram.add_base_rectangle_minimize(
    height=ambigram.font_size / 10.0,
    padding=0 # Padding is not supported for this function (YET)
)

ambigram.assembly.export('RectangleMinimize.stl')

#from cadquery.vis import show
#show(ambigram.assembly)
X Perspective Y Perspective
1 2

Base P2P + Custom Font

Use this method when a String Length is not a multiple from another (e,g 5 and 9) and you don't like the simple rectangle base, this makes the base by going point to point from one corner to another.

from ambigram import Ambigram

ambigram = Ambigram(
    "5X5=25", 
    "21+21=42",
    font_size=16,

    # Path to your Font
    font_path="/usr/share/fonts/truetype/ibm-plex/IBMPlexMono-Bold.ttf",
)

ambigram = ambigram.add_base_p2p(
    height=ambigram.font_size / 10.0,
    padding=ambigram.font_size / 10.0,
)

ambigram.assembly.export('P2P.stl')

#from cadquery.vis import show
#show(ambigram.assembly)
X Perspective Y Perspective
1 2

πŸ““ Notes

  • I recommend Monospaced fonts with Strong Serifs, because some letters like the letter 'I' in normal fonts is a thin thick and It doesn't looks appealing to the eye when compared to the other letters.
  • Different Length String are implemented by placing the extra chars behind the shortest one (see it for yourself)
  • Spaces are Allowed but needs further testing.
  • A new algorithm for bases is need the current ones are rectangle, P2P and rectangle_minimize, the rectangle minimize is quite good when string lengths are equal but more improvement is needed.
  • Needs further documentation
  • Needs further testing

Thanks to

  • 2CatTeam That allowed me to see that whitespaces and different string length are allowed.
  • Lucandia That allowd me to see that It was possible in Python.

Made by πŸ”— Sivefunc

Licensed under πŸ”— GPLv3

About

3D Ambigram Generationg using CadQuery

Topics

Resources

License

Unknown, GPL-3.0 licenses found

Licenses found

Unknown
LICENSE
GPL-3.0
COPYING

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages