Archive for the ‘Uncategorized’ Category.

Create Watchface with Zepp Editor for Amazfit

How to prepare and test a Zepp watchface

Done with Amazfit GTR 2E

Before you start, you need a lot of files prepared:

  • A background image to be used as watchface
  • A hour, minute and second dial, if you create an analog watchface
  • Digits and symbols to be used, for example the digits 0-9, a period, a percent, a ‘°C’, a distance unit (km) and others as you like to place on your watch face.

The background watchface for the GTR2E is 454×454 pixels. You need to know, how to do precise pixel images. The hands have to be symmetric, so they can easily rotate.

The digits can be created one by one using your favorite painting tool (i.e. Paint.Net, Inkscape or Painter or even GIMP). Another option is to use fontforge or the fontimage tool (Linux only) or a fontforge python script. Imagemagick is also useful if you need to invert or make the images transparent.

Fontimage example

Create a small text in white with transparent (black) background from Comic Sans Bold Truetype font:

fontimage --pixelsize 22 --text "km" -o km_comicsans1.png ComicSansMSBold.ttf
-or-
fontimage --pixelsize 22 --text "°C" -o gradCelsius_comicsans1.png ComicSansMSBold.ttf

Then invert the image (using imagemagick convert):

convert km_comicsans1.png -negate km_comicsans_n.png
-or-
convert gradCelsius_comicsans1.png -negate gradCelsius_comicsans_n.png

Finally make the black background transparent:

convert km_comicsans_n.png -transparent black km_comicsans.png
-or-
convert gradCelsius_comicsans_n.png -transparent black gradCelsius_comicsans.png

Another example for a bash script to generate digits:

#!/bin/sh
for n in 0 1 2 3 4 5 6 7 8 9 '.' ':' '%' '°C' 'km'
do
  fontimage --pixelsize 22 --text $n -o $n_1.png "ComicSansMSBold.ttf"
  convert $n_1.png -negate $n_n.png
  convert $n_n.png -transparent black $n.png
done

In the above script 22 is the pixel size of the images and ComicSansMSBold.ttf is the font to be used.

If you need to create more, single bitmaps at once, you may use a fontforge python script. I used to first load the font to be used into Fontforge and change the Encoding to Latin-1, mark the first 127 chars, invert the selection and delete the rest. Then save this as a Fontforge font file for later use.

Now you can use a small python script and export the remaining glyphs to single bitmap files:

import os
from fontforge import *

font = open(os.sys.argv[1])
font.reencode("iso8859-1")
for glyph in font:
  if font[glyph].isWorthOutputting():
    if glyph.isupper():
      name = glyph + "_capital"
    else:
      name = font[glyph].glyphname
      # or name it with ' + "_" + str(font[glyph].unicode)' added
      print ("glyph: " + glyph + ", unicode: " + str(font[glyph].unicode) + ", name: " + name + "\n")
      font[glyph].export("c:/temp/" + name + ".png", 22)

If you do not want to start this from command line, you may replace ‘os.sys.argv[1]’ by the path and name of your saved Fontforge font file or a TrueType font file. Be warned that you get many bitmap files now. Possibly do that within an empty new directory.

Now that you have your images ready, go on and start a watchface.

Assemble the Watchface

Continue reading ‘Create Watchface with Zepp Editor for Amazfit’ »

Get Profile Setting from AnyCubic gcode 3D print file

I wanted to see the settings and profile used to print the sample Owl_pair.gcode. The file has the settings included at the end starting with

;CURA_PROFILE_STRING:

After that there is the base64 encoded zlib inflated profile data. You can extract it by removing everything before the following start code similar to ‘eNrtWk’ (6 bytes or chars) and after the == at the end of this line.

Here is a single line to do this within a Linux system with zlib-flate fro qpdf installed:

awk -F ';CURA_PROFILE_STRING:' '{print $2}' <Owl_pair.gcode |base64 -d -i | zlib-flate -uncompress | tr '\010' '\012' >Owl_pair.gcode.settings

Or here the bash script I used:

#!/bin/sh
# awk -F ';CURA_PROFILE_STRING:' '{print $2}' <Owl_pair.gcode |base64 -d -i | zlib-flate -uncompress | tr '\010' '\012' >Owl_pair.gcode.settings
infile=$1
[ $# -eq 0 ] && { echo "Usage: $0 gcode-file"; exit 999; }
echo "$0\ntool to extract cura settings from gcode file\n"
if [ -f ${infile} ];
then
awk -F ';CURA_PROFILE_STRING:' '{print $2}' < ${infile} |base64 -d -i | zlib-flate -uncompress | tr '\010' '\012' > ${infile}.settings
# less ${infile}.settings
else
echo "\n${infile} not found!\n"
fi
if [ -s ${infile}.settings ];
then
echo "\nSettings written to ${infile}.settings"
else
echo "\nNO Settings found. Either missing ';CURA_PROFILE_STRING:' in gcode file or base64 decode or zlib deflate failed\n"
if [ -f ${infile}.settings ];
then
#delete empty file
rm ${infile}.settings
fi
fi

The output looks similar to this:

layer_height=0.2
wall_thickness=1.2
retraction_enable=True
solid_layer_thickness=1.2
fill_density=25
print_speed=50
print_temperature=200
print_temperature2=0
print_temperature3=0
print_temperature4=0
print_temperature5=0
print_bed_temperature=60
support=None
platform_adhesion=None
support_dual_extrusion=Both
wipe_tower=False
wipe_tower_volume=15
ooze_shield=False
filament_diameter=1.75
filament_diameter2=0
filament_diameter3=0
filament_diameter4=0
filament_diameter5=0
filament_flow=100.0
nozzle_size=0.4
retraction_speed=60.0
retraction_amount=5
retraction_dual_amount=16.5
retraction_min_travel=1.5
retraction_combing=All
retraction_minimal_extrusion=0.02
retraction_hop=0.0
bottom_thickness=0
layer0_width_factor=140
object_sink=0
overlap_dual=0.15
travel_speed=60
bottom_layer_speed=20
infill_speed=0.0
solidarea_speed=30
inset0_speed=30
insetx_speed=40.0
cool_min_layer_time=5
...

 

Settings location for Ultimaker Cura Linux AppImage

Where does Ultimaker Cura AppImage store plugins and settings?

There are two locations. One is the $HOME/.config/cura/ directory and the other is %HOME/.local/share/cura/ folder.
For example: The material folder of Ultimaker Cura 4.9 with your custom changes is at $HOME/4.9/materials/.

Biete Programmierung von Kunden-Anwendungen, Automatisierung, Plugins für Honeywell Handheld

Sie benötigen ein kleines Programm für die Inventur oder ein spezielles Plugin für Honeywell Handheld Geräte. Da kann ich Ihnen vielleicht helfen.

Problemlösungen:

  • Ihr Telnet Client macht nicht, was er soll. Anpassungen von Client und/oder Server.
  • Sie möchten Tasten am Handheld umbelegen
  • Die Daten des Barcode Scanners entsprechen nicht der Erwartung?
  • Die Darstellung von SAP Web-Inhalten auf Mobil-Geräten gefällt Ihnen nicht?
  • Sie möchten vom Mobil-Gerät auf einem mobilen Label- oder Quittungsdrucker ausgeben.

Biete auch Windows- und Web-Programmierung, Linux Scripting und andere Software Leistungen. Bei Bedarf einfach Kommentar posten. Arduino, ESP und andere Microcontroller Erfahrung ist auch vorhanden.

Ich bin seit über 35 Jahren in der Computer Software- und Hardware Branche unterwegs. Habe sowohl PCs konfiguriert und repariert als auch professionells Desktop Publishing inklusive Bildbearbeitung, Text Layout und Satz. Zuletzt war ich als Senior Software Specialist tätig und habe Kunden, Partner und Kollegen bei kleinen und großen Projekten mit Lösungen geholfen. Dabei kamen die unterschiedlichsten Umgebungen und Programiersprachen zum Einsatz. Die notwendigen Grundlagen habe ich mir selbst erarbeitet und erfolgreich eingesetzt, oft mit verblüffenden Lösungen, weil ich über ein sehr breites Wissen verfüge. Manchmal wurde zur Lösung ein kleines Programm oder ein Dienst programmiert.

Mein größtes, privates Projekt war die Programmierung einer Faktura für eine Nutzfahrzeug-Werkstatt inkl. Merc*des Teile Übernahme aus der Fahrzeug Datenbank.

Ein anderes, großes, privates Projekt war die Erstellung eines technischen Katalogs vom Satz und Layout bis zum Belichten und Druck.

Einige Jahre habe ich das Novell Netware / Windows 2000 / MS SQL Server Netzwerk eines Seniorenheims betreut, inklusive automatischem Backup und Netware Server-Spiegelung.

Einen Teil meiner Programme können Sie unter github.com/hjgode begutachten.