China lathe goes Chinese on me.

Posted by on February 26, 2014

When steel turns into butter, again.

I’m starting to believe the best idea for a chinese lathe, as a first mod or project, would be to replace all threaded parts with proper ones. This is not the first stripped thread on the lathe… And rest assured, any time a thread strips, you lose at least half a lathe – functionality wise.

Actually scrap that, the best idea is, if you have the option, not to buy chinese. Buy old iron instead, problem is finding an old lathe that doesn’t have massive wear and isn’t missing most of the parts… So you might need some luck there.


Was it made out of rebar? or butter?


Dat oiler.

Discussing the problem

Since I don’t have any oiler inserts and I don’t plan on making any, the idea of making a new part from scratch seems sketchy as I wouldn’t have a way to seal the oil and prevent gunk from getting inside the port.

This part is the shaft for the double transmission gear on the banjo, it transmits power, through the two A and B gears, to the gearbox for power feeding, threading, etc. Without it, you only have half a lathe.

The oil port acts as a valve, allowing the oil to only escape through the hole on the shaft, which it does by centrifugal force, allowing a layer of oil to remain in between the bushing of the gears and the shaft itself, reducing friction and wear. Without the valve, very little oil would get onto the shaft and most would fall off the oiling port.

Thankfuly the T-nut didn’t strip, but the thread was slightly damaged and had to be dressed with a tap, it’s been since case-hardened and awaits installation.

Two Options

Either I turn down the stripped M6 portion, counterbore the shaft and press a new stud with an M6x1 thread or I make the whole part from scratch using mild steel (I would like to use brass, but I don’t currenly have any stock big enough). Of course we only have a square portion to chuck onto, that means moving onto the 4 jaw chuck and busting out the indicator. One problem though the square part wasn’t milled exactly 90°, it’s all over the place.

The second option, make the part from scratch out of mild steel and figure out a way to fashion an oiling port.

Contrary to what I thought, and as I’ve mentioned, the square portion was milled flat from round stock, this part did not start life as a square stock. Makes sense, since interrupted cuts are slower in production and you can trade in a bit more material loss over higher productivity time, which means more income in general… Of course, if you use crappy materials, it doesn’t matter how you make the part… it’s always going to be crappy.

Given the slot near the square portion is to engage another part, which acts as a washer and for lack of better words, a sort of thrust “bearing” or “clamp” which also helps lock the parts in place, the head of the part MUST be square, otherwise the other part would also have to be remade since it’s slotted to fit and slide through the square portion.


Critical Dimensions:

The shaft is 10mm and pennies, turned down for a perfect sliding fit on the gear train (Currently 10.05mm). The threaded portion is M6x1mm however originally it wasn’t long enough to engage all of the threads on the T nut (not shown on pictures). So while I will duplicate the original part, I might make a second part, with my own design. Of course if I could have it my way I would use at least M8 for this, M10 would be ideal.

Making due with what you’ve got.

For a temporary part, I’m thinking I could skip the oiling (maybe add oil “holes” on the shaft, not through holes, just small pockets throughout to contain oil) and use a slotted head on the end, to fasten the part. This would work perfectly on the short term while I come across better stock or a better design.

Thinking in advance…

Now I can’t help but wonder, should I make spares of every part that’s been damaged?, or should I trust my materials and skills?. For now, let’s make a working part, once I’ve got power feed and threading capabilities back, I might turn spares. This is not the first time a thread strips on this lathe.

Gettin’ busy!


Test fitting on the rough blank after careful turning it down to size, the gears turn freely with ever so slightly drag (excellent!)

Filed the flats, parted with the chop saw. Time to debur!

Filed the flats, parted with the chop saw. Time to deburr!


The almost finished part, compared to the original.

The almost finished part, next to the original. There’s no real need for all faces to be flat, two are the absolute minimum you need, two is what I did. I faced it on the lathe and deburred the remaining edges with a file.


The finished part, Bored the inside, drilled the oil port. Case hardened and black oxide finish. Ready to install!



All setup and working! Let’s hope it lasts. A new T nut is in order though.

Final notes

All in all a simple project, but shows how even the simplest parts can fail -one way or another- and cause you a lot of trouble.

Once I figure out a simple way to make oiler inserts I’ll most likely be adding one to the new shaft. Next time I will probably use a better material, cold rolled steel isn’t ideal, but it’s what I had. I will probably make spares anyway, including new T-nuts.

I have an idea for a different style oiler (gravity fed, bottle style) but out of cheap aluminum, I would ideally use glass with aluminum caps but at the moment I don’t have a source for small diameter glass tubing (8mm or so) and cutting it might end up being problematic.

Of course there isn’t a lot of space available and it has to be sturdy and reliable. Ideally the originals could be ordered (I really can’t do that anymore) or made to look alike, but they are rather complicated due to the fact they use a tapered spring and require flat milling on the bore of the part, the right sized steel ball bearings, etc..

Either way, rest assured something cheap and simple will be devised!

That’s all for now, cheers.

PureBasic – strip_tags() just like in PHP!

Posted by on February 11, 2014

Let the strippin’ begin!

This is a basic implementation of PHP’s strip_tags() for PureBasic, it’s not fully optimized but it’s fast enough for most applications. It doesn’t use native string manipulation functions, instead it parses through each character of the string.

Naturally it’s going to be faster than using REGEXP, but not as flexible. Lots of room for improvement, but for now it is what it is!

Procedure.s strip_tags( *szInput.character)
	Define.s szOutput
	If (*szInput)
			If (*szInput\c = '< ')
				;Strip markup tags (completely)
					;-ToDo: add support for selective tag stripping!
					*szInput + SizeOf(CHARACTER)
				Until *szInput\c = '>'
				;Not a tag?, process for entities or send to output directly
				Define.c ThisCharacter = *szInput\c
				Select ThisCharacter
					Case '&' ;Entity
						*szInput + SizeOf(CHARACTER)
						If *szInput\c = '#'
							*szInput + SizeOf(CHARACTER)
							Define.s szEntity
								szEntity + Chr(*szInput\c)
								*szInput + SizeOf(CHARACTER)
							Until *szInput\c = ';'
							szOutput + Chr(Val(szEntity))
						szOutput + Chr( ThisCharacter )
			*szInput + SizeOf(CHARACTER)
		Until *szInput\c = #Null
		ProcedureReturn (szOutput)

Simple use example:

Define.s test = "<p>Test paragraph.</p><!-- Comment --> <a href="+Chr(34)+"#fragment"+Chr(34)+">Other text</a>"
Debug test
Debug strip_tags(@test)

Got any ideas on how to improve this?, let me know!


Android – Debugging through WIFI

Posted by on February 9, 2014

Ever wondered if you could use ADB through WiFi to avoid using the USB connector while debugging on Android all the time?, turns out you can and it’s simpler than you thought!

Of course, the first step is to root your Android device, But don’t worry, it’s also very easy now adays. I recommend you try Framaroot — Yes, in theory there could be some risk involved, but given the current state of Framaroot I’ve never had a problem and it takes about 3 seconds to root your device, you don’t really need to reboot it either although it’s recommended.

Once you’ve got SU (SuperUser), you can proceed to install WiFi ADB — Avoid any other application, specially if it requires a host on your desktop / dev box since really, you’ve rooted your device, no need to go around obstacles that aren’t there anymore.

Now, simply start WiFI ADB and enable it, the final step is to get your ADB to listen to your device through TCP/ip, we simply open ADB via the console and perform the connect command followed by the ip and the port of your device.

For example in my case:

adb connect

ADB should then report “connected”, otherwise make sure your device is listed to begin with using the “devices” command, it should pop the id of your device. Otherwise, make sure WiFI ADB is enabled.

That’s all!

Free Game Resources – Cloud pack with full alpha channel.

Posted by on February 1, 2014

Sample set of volumetric clouds

It’s been a while since I shared some of my game development related artwork, but here’s a nifty set of volumetric cloud samples I’ve made for one of my projects, the various shapes contained allow to create a vast amount of variations rather easily.




These images contain full alpha channel and are all 512×512.

Download here: gushh_dot_net_cloudpack

Some of the clouds have a dark background (night) — Others are daylight based, however they can be mixed using various rendering and blending methods to obtain rich pseudo dynamic clouds at a low processing cost.

Rendering Tips

An ideal blending method would be to utilize the luminosity of the samples to blend against an existing background, then through the use of layering and clever movement quite interesting cloud representations can be achieved for games and simulators, and why not a screensaver?.

Closing up

These samples are free of use for non commercial projects, however credit must be given.
If you need a complete set, higher resolution renders or other custom work — Feel free to contact me for extra details!.

Also, feel free to send in your suggestions for future freebies, I’m open to a challenge.


Monkey-X / Android – App name, version, orientation and package name.

Posted by on January 30, 2014

Certain games and applications require different screen orientation constraints as well as the obvious name, version and package differences between each other. There are also GPU flags and “MIMEs” we have to setup based on each project’s requirements, Monkey-X simplifies this by reducing the amount of resource / XML editing by allowing us to define constants in code.

The following is pretty much what I use on my main source before I begin to include libraries and the main routine:

#ANDROID_APP_LABEL			= "Your Program Name"
#ANDROID_SCREEN_ORIENTATION 		= "portrait" ' could be landscape or user which may or may not use 'sensor'.
#ANDROID_APP_PACKAGE			= "com.yourbrand.yoursubcat.yourprogramname" ' for instance:
#TEXT_FILES				= "*.txt|*.xml|*.json"
#IMAGE_FILES				= "*.png|*.jpg|*.gif|*.bmp"
#SOUND_FILES				= "*.wav|*.ogg|*.mp3|*.m4a"
#MUSIC_FILES				= "*.wav|*.ogg|*.mp3|*.m4a"
#BINARY_FILES				= "*.bin|*.dat"

By defining these constants we avoid having to edit resource files by hand or utilize extra tools / external code to perform the same action.

If you want to fully customize your Android target I suggest you create a new target to avoid modifying the defaults.

That’s all for now, Cheers!