Soap Dispenser – Extended 3D Printer Model

Author: @
License: CC BY-NC-SA
File formats: stl,py
Download type: zip
Size:824.1KB

The file 'Soap Dispenser – Extended 3D Printer Model' is (stl,py) file type, size is 824.1KB.

Summary

This is a remake of the Soap dispenser by advancedvb. The pump assembly I have is too long for this model, so I extended its height by 9.5mm.

The extension is done by a script that just increases the Z height of vertexes higher than 70mm (arbitrary). Prior to execute the script on a .STL, you must save it as an ASCII STL instead of a binary STL (example: open with FreeCAD > Export > as .ast, then rename the .ast file to .stl).

The script is provided to tune either the increase (I'm limited to 125mm by my printer) or the height at which the increase occurs (if you want a longer neck or a shallower sponge holder for example).

Script is copy-pasted below (excuse my "dirty-but-works" coding ;) ):

-- coding: utf-8 --

STL_input_path = r"ZeepPomp_01.stl"
STL_out_path = r"ZeepPomp_01_extended.stl"

towrite = []

threshold = 70.0 # [mm]
Z_increase = 9.5 # [mm]

STL_input_file = open(STL_input_path)
for line in STL_input_file:
if line.find("vertex") < 0: # non-vertex line
towrite.append(line)
else: # vertex line
Z_value = float(line.split(" ")[-1][:-1])
if Z_value < threshold: # vertex not affected
towrite.append(line)
else: # vertex to be extended
Z_value += Z_increase
newline = line.split(" ")[:-1]
newline.append("{:0.6f}".format(Z_value)+"n")
towrite.append(" ".join(newline))
STL_input_file.close()

towrite = "".join(towrite)
STL_output_file = open(STL_out_path, "w+")
STL_output_file.write(towrite)
STL_output_file.close()

ZeepPomp_01.stl 3.3MB
ZeepPomp_01_extended.stl 3.3MB
ZeepPomp_extender.py 899.0B