Building a printer: Day 4

It moves!

After much much failure, I have it able to move. The Y belt seems really loose, near impossible to fix, the gantry is a bit stiff, but it's moving. I'm not going easy on this printer, and going for Voron speed right out of the gate the first print. It's by no means done. Enclosure is still not on, y belt is skipping, parts are missing here and there, but it can at least print the rest of it's upgrades if I tame it in. There will be at least a few more follow up posts as I'm looking into some upgrades that can solve some issues. So far I'm printing the Y belt mod found here. That should help me get better acceleration, but I'll need to wait to see until belts come in. The parts are printed. I also printed a temporary solution to not wanting to solder the bed connectors, which I think looks nice enough for now.

Some pictures/videos

Starting a benchy. It didn't finish thanks to the Y belt skipping.

Tamed the printer down and started printing the fix.

belt_mod_1

This printer is totally not tuned, and ringing can be seen, especially near the voron logo. I'll address this later hopefully, but that's high speed printing problems at least. The rest looks bad on camera, but looks fine in person.

belt_mod_2

Here's the connector I printed to be lazy.

connector_cover

Building a printer: Day 3

It's getting closer!

This has truly been a learning experience in things that should be obvious, but aren't when you are in the middle of things. Crimping the connectors has been nothing but a pain, so for now, I soldered most of them on the toolhead, which I'm sure I'll regret later, and by later, I mean almost instantly. I've torn the entire toolhead down at least 10 times due to small issues here and there. The probe was installed too high, the extruder had a few issues once I looked at it, the list goes on, but with each teardown, I learn a bit about the toolhead, and it gets easier. Firmware is flashed, wired up to test, but I'm out of time, and I didn't bother to cable manage too much because I'm sure I'll have to rewire it all eventually.

Some pictures

Turns out that the probe, while it looks like it should be flush mount, should, in fact, not be. probe_in_wrong_spot

Not only is my cable management horrible, but it also was a horrible photo!

printer_wiring

It's starting to look like a printer.

printer_day_3

Building a printer: Day 2

Slowly but surely

I don't have a lot of time today to work on the printer, but I managed to install the toolhead. It's not really wired, but it's on the X carriage, which is also installed. I also got the drag chains on, display attached, and a few other things. Planning on hammering out wiring tomorrow to see if it will live or die. Time will tell. I'm bound to destroy something.

Some pictures

I've never been a fan of the V6 groove mount, and neither has anyone else. I'm hoping to replace this with a Revo or a Dragon hotend at some point. groove_mount_is_bad

Final shots for the day.

printer_day_2_1 printer_day_2_2

Building a printer: Day 1

It's finally revealed

It's been a while since I've posted, and I'm sure you wonder what I've been up to. The Prusa Mini has been working overtime, printing every waking hour, failing a lot because ASA is hard to print on a Mini (for me at least), and it's time to reveal what it's all been about. Without further ado...

I'm building a Voron

voron_switchwire_parts printer_frame printer_parts_1

Day 1 summary

With some images to spoil a bit, I've been hard at work for a while on this. Printing and starting to build my Voron Switchwire. I've started with a Formbot kit, but I'm sure I'll replace a lot of things. Been going through the generally good manual, building, screwing things up many times, and ordering parts that weren't included. Was missing the Keyback, PTFE tube, and a few other small things, but it's getting built. So far, I have the frame, and Y axis mostly built somewhat connectly I think, skipping some things I'll have to go back to due to missing parts. I've never built a printer before, and the only electronics knowledge I really have is keyboards. Luckily, I at least ran Klipper on my prusa mini most of the time, so hopefully tuning that won't be as hard as it could have been. This post is a short one, but hopefully it helps explain why I've been so busy. This is what it looks like at the end of day 1.

printer_day_1

ZSH: The better shell

Your shell is bad, but doesn't have to be

I get a lot of questions on why I use a shell as opposed to a GUI for things. A shell is often annoying to do some basic things even if it's much more powerful and generally a tradeoff. Deleting all files ending in .txt is hard in a gui, but in a shell is just rm *.txt. Meanwhile, going up a directory in a gui is easy. Just hid the back button on the mouse. In a shell it's cd .. which is a lot to type for something so simple. Another common issue that I had was different operating systems or even Linux distros having different commands to do basically the same thing. On Debian it's sudo apt install <package> and Mac it's brew install <package>. This gets quite annoying to have to remember what system you are on, and understand the differences in them.

Aliases, functions, and bliss

All of the above complaints can go away. Changing directories can be shortened.

# Changing dirs with just dots.
alias .='cd ../'
alias ..='cd ../../'
alias ...='cd ../../../'
alias ....='cd ../../../../'

This is just one example. Maybe you want to have commands that work on both Mac and Linux. What if it even matters if you are running Wayland or X11? Still can be easily solved.

if command -v pbcopy > /dev/null 2>&1; then
  alias xclip='pbcopy'
elif command -v wl-copy > /dev/null 2>&1; then
  alias xclip='tee >(wl-copy) | wl-copy -p'
fi

The above makes xclip be the actual xclip if there are no better options, or sets it to the Mac or Wayland version if those exist instead. No need to remember what system you are on, or what software stack. It automatically adapts.

Package management.

I'll mostly let the code speak for itself as it's easy to understand, but this makes traveling between machines nearly seamless as there is nothing new to learn or remember.

if command -v xbps-install > /dev/null 2>&1; then
  export IS_VOID=1
elif command -v emerge > /dev/null 2>&1; then
  export IS_GENTO=1
elif command -v pacman > /dev/null 2>&1; then
  export IS_ARCH=1
elif command -v apt-get > /dev/null 2>&1; then
  export IS_DEBIAN=1
elif command -v apk > /dev/null 2>&1; then
  export IS_ALPINE=1
elif [[ "$OSTYPE" == "darwin"* ]]; then
  export IS_MAC=1
else;
  export IS_BSD=1
fi

if [ "${IS_ARCH}" = "1" ]; then
  ## Package Manager - pacman/yay
  if command -v yay > /dev/null 2>&1; then
    alias pi='yay -S'
    alias pr='yay -R'
    alias psearch='yay -Slq | fzf --multi --preview 'yay -Si {1}' | xargs -ro yay -S'
    alias pu='yay -Syu --devel --timeupdate'
    alias oneshot='yay -S --asdeps'
    alias orphans="yay -Qtdq | yay -Rns -"
  else;
    alias pi='sudo pacman -S'
    alias pr='sudo pacman -R'
    alias psearch='pacman -Slq | fzf --multi --preview 'sudo pacman -Si {1}' | xargs -ro sudo pacman -S'
    alias pu='sudo pacman -Syu'
    alias oneshot='sudo pacman -S --asdeps'
    alias orphans="pacman -Qtdq | sudo pacman -Rns -"
  fi
  alias mirrorupdate="sudo pacman-mirrors --geoip && sudo pacman -Syyu"
  alias etc-update="sudo pacdiff"
  alias asdep="sudo pacman -D --asdeps"
  alias explicit="sudo pacman -D --asexplicit"

elif [ "${IS_DEBIAN}" = "1" ]; then
  ## Package Manager - apt
  alias pi='sudo apt install'
  alias pr='sudo apt remove'
  alias psearch='apt search'
  alias pu='sudo apt update && sudo apt upgrade'
  alias orphans='apt autoremove'

elif [ "${IS_GENTOO}" = "1" ]; then
  ## Package Manager - portage/emerge
  alias gsync='sudo eix-sync'
  alias pi='sudo emerge -av --autounmask'
  alias oneshot='sudo emerge -av --oneshot'
  alias pu='sudo emerge --update --deep --with-bdeps=y --newuse --keep-going @world --ask'
  alias pub='sudo emerge --update --deep --with-bdeps=y --newuse --keep-going @world --ask --binpkg-changed-deps'
  alias pr='sudo emerge --depclean -av'
  alias psearch='eix -r'
  alias pclean='sudo qpkg -c'
  alias howlong='sudo watch --color genlop -uic'
  alias etcupdate='sudo -E etc-update --automode -3'

elif [ "${IS_ALPINE}" = "1" ]; then
  ## Package Manager - apk
  alias pi='sudo apk add'
  alias pr='sudo apk del'
  alias psearch='sudo apk search'
  alias pu='sudo apk update && sudo apk upgrade'

elif [ "${IS_VOID}" = "1" ]; then
  ## Package Manager - void/xpbs
  alias pi='sudo xbps-install -S'
  alias prr='sudo xbps-remove -R'
  alias pr='sudo xbps-remove'
  alias psearch='sudo xbps-query -Rs'
  alias pu='sudo xbps-install -Su'
  alias orphans='sudo xpbs-remove -o'

elif [ "${IS_MAC}" = "1" ]; then
  ## Package Manager - brew
  function pi {
      brew install "${@:1}"
      brew bundle dump --force --file=$HOMEBREW_BREWFILE
  }
  function pic {
      brew install cask "${@:1}"
      brew bundle dump --force --file=$HOMEBREW_BREWFILE
  }
  function pr {
      brew uninstall cask "${@:1}"
      brew bundle dump --force --file=$HOMEBREW_BREWFILE
  }
  alias psearch='brew search'
  alias pu='brew update && brew upgrade'
  alias orphans='brew autoremove'

elif [ "${IS_BSD}" = 1 ]; then
  ## Package Manager - freebsd
  alias pi='sudo pkg install'
  alias pr='sudo pkg remove'
  alias psearch='sudo pkg search'
  alias pu='sudo pkg update && sudo pkg upgrade'

fi

There is a combination of aliases and functions used in there. Aliases are simple commands, functions can have more advanced actions attached, but both act as a "normal" command as far as a user sees.

Adding sane defaults

A lot of the time you want to do the same thing. When you want to rm files, most of the time you probably want to remove a directory recursively, as opposed to deleting everything inside, and using rmdir. You can alias over commands and add default arguements.

# Default flags
alias cp='cp -R -i -v'
alias mv='mv -i -v'
alias mkdir='mkdir -p -v'
alias df='df -h'
alias du='du -h -s'
alias dd='dd status=progress bs=4M conv=fdatasync '
alias wgetpaste='wgetpaste -Xx'
alias sudo='sudo '  # Makes sudo work with aliases
alias ssh='TERM=xterm ssh'  # Fixes some issues with ssh on some terminals

More use of functions

I mentioned that functions can do a bit more than a basic alias. Here's a few more examples of that in action.

# Easy extract
extract () {
  if [ -f $1 ] ; then
      case $1 in
            *.tar.bz2)      tar xvjf $1   ;;
            *.tar.gz)       tar xvzf $1   ;;
        *.tar.xz)       tar xvJf $1   ;;
            *.bz2)          bunzip2 $1    ;;
            *.rar)          unrar x $1    ;;
            *.gz)           gunzip $1     ;;
            *.tar)          tar xvf $1    ;;
            *.tbz2)         tar xvjf $1   ;;
            *.tgz)          tar xvzf $1   ;;
        *.txz)          tar xvJf $1   ;;
            *.rar)          unrar $1      ;;
            *.zip)          unzip $1      ;;
            *.Z)            uncompress $1 ;;
            *.7z)           7z x $1       ;;
          *)           echo "don't know how to extract '$1'..." ;;
      esac
  else
      echo "'$1' is not a valid file!"
  fi
}

# Makes directory then moves into it
function mkcdr {
    mkdir -p -v $1
    cd $1
}

# Creates an archive from given directory
mktar()  { tar cvf  "${1%%/}.tar"     "${1%%/}/"; }
mktgz()  { tar cvzf "${1%%/}.tar.gz"  "${1%%/}/"; }
mktbz()  { tar cvjf "${1%%/}.tar.bz2" "${1%%/}/"; }
mkzip()  { 7z a -r  "${1%%/}.zip"     "${1%%/}/"; }
mk7zip() { 7z a -r  "${1%%/}.7z"      "${1%%/}/"; }

Conclusion

I know this was a short post that was heavy in raw text from files, but it's meant to highlight some of my dotfiles that make my life much easier, and I think would be useful to many others. Even if you don't use the exact lines, you can see how things are used, get new ideas, and maybe make something even better for your workflow than you could just grab from using my files blindly. I didn't go deeply into things that bash can't do that ZSH can, but I may do a more in depth dive of my .zshrc to pull out some of those things at a later date. These are only snippits of my dotfiles. They can all be found, in full here for further reading and extraction. ZSH related files are .zshrc .zshenv .zsh_aliases as I have split my zsh for easier reading and editing.

Bonus

Here are the aliases I use to open my zsh files for editing.

alias zshrc="$EDITOR ~/.zshrc"
alias zshenv="$EDITOR ~/.zshenv"
alias zshaliases="$EDITOR ~/.zsh_aliases"