Quick Post #5: A Utility for Converting .obj Files Created by Microsoft 3D Builder

There are several different file formats for specifying 3d objects (as Tannenbaum wrote, “The good thing about standards is that there are so many to choose from.” One such standard is the obj or .obj open format. By itself, the .obj file definition does not support coding surface shading properties in the .obj file, but these can be provided in a separate Material Template Library (.mtl) file.

While not part of the official file format, many program support vertex coloring by adding the RGB values for color to the end of the relevant vertex line. The de facto “standard” for this non-standard usage is to code the RGB values as decimals between 0 and 1. However for some reason, Microsoft’s 3D Builder codes them as integers between 0 and 255. As a result, other programs, e.g., Bambu Studio, while capable of using vertex coloring using values between 0.0 and 1.0, won’t read the color information when you import such a file. This simple script converts the RGB values from a range of 0-255 to a range of 0.0 – 1.0 and writes out the modified file. Here’s the code, which is also published as a Gist:

import sys

def convert_obj_vertex_colors(input_file, output_file):
    with open(input_file, 'r') as infile, open(output_file, 'w') as 
    outfile:
        for line in infile:
            parts = line.strip().split()
            if parts and parts[0] == 'v' and len(parts) == 7:
                # Convert RGB from [0, 255] to [0, 1]
                r, g, b = map(float, parts[4:7])
                r, g, b = r / 255.0, g / 255.0, b / 255.0
                outfile.write(f"{parts[0]} {parts[1]} {parts[2]} {
                parts[3]} {r:.6f} {g:.6f} {b:.6f}\n")
            else:
                outfile.write(line)

if __name__ == "__main__":
    if len(sys.argv) != 3:
        print("Usage: python convert_obj_rgb.py input.obj output.obj")
    else:
        convert_obj_vertex_colors(sys.argv[1], sys.argv[2])

Quick Post #4: 3d Printed Monitor Stand

Two combined images showing the original plastic stand, including the broken piece. The top image shows the assembled stand, while the bottom one shows the individual pieces.

Original stand, including broken piece

I have a 7″ touch screen monitor for Raspberry Pi’s. I wasn’t happy with the stand that it originally came with, which was rather flimsy, and the stand broke twice. But I got a 3d printer from my wife for Christmas, and I decided I could build a better stand for it. To design the stand, I used TinkerCad, which while less sophisticated than many other tools, has one of the easiest learning curves.

I started with just a large block in TinkerCad, sized to the dimensions I needed, than cut out sections one by one to form the sloping back, the slot that the monitor slides into to hold it, and a section cut out of the stand so that it would use less plastic.

 

 

Side view of the printed monitor stand, clearly showing the slot to hold the monitor. The stand is white.

Side view of the printed stand, showing the slot the monitor slides into.

After I started printing, I realized I could make it even more efficient by making the main section of the stand hollow. To do that, I made a copy of the stand in TinkerCad, cut off the front, then shrank the copy. Then I changed the copy from a solid object to a hole, positioned it inside the original, and joined the hole to the stand.

I’m really happy about how it came out, and as you can see in the pictures, the monitor fits perfectly!

I’ve published the model files on Thingiverse.

Picture of the stand with the monitor in place.

The finished stand, with the monitor in place.

National Maker Faire 2016

I attended the National Maker Faire held over Father’s Day weekend at the University of the District of Columbia, and thought I’d share some observations and pictures. They’ve added the National Maker Faire to the list of flagship faires around the US, along with the original Bay Area and World Maker Faires. I’ve been to the World Maker Faire once, and from that and what I’ve heard of the Bay Area Faire, the National Faire is much smaller than either. You could certainly see it all in less than half a day. It’s also a bit random in its layout, as it makes use of several areas of campus buildings and grounds. Unlike the other two major faires, I would not travel from out of town to see this one. But for anyone on the greater DC area, I found it well worth my time.

It’s not new, but I hadn’t seen the Intel Arduino 101 board before. I’d have loved if it had WiFi but the built in real-time clock, bluetooth, accelerometer, and gyro make it quite interesting. Apparently the Curie system on a chip module it’s build around also has a 128-node neural network for machine-learning, but there is, at least as of now, no software released to access it.

Ability3D had a table promoting their planned 3d metal printer, with a kickstarter campaign planned for January 2017. They were showing a development prototype model (the final consumer product to be smaller). It prints with powdered metal. I believe they said they were targeting the several thousand dollar range for price, so not inexpensive for a home printer, but an order of magnitude cheaper than current metal powder printers.
Nova Labs, one of the local area makerspaces, was also there with some interesting demos and projects.

There was also a lock picking village put on by TOOOL, which was quite full when I went by. It was also nice to see a short waiting line for the “Learn to Solder” hands on booth. How often do you see people lining up to learn to solder? Unfortunately for some reason the drones only were being flown on Saturday, and there were no drone demos when I went on Sunday.

Below are a number of photos from the event:

Learn to Solder hands on exhibit

Learn to Solder hands on exhibit

Ability3D's booth. Developing a home metal powder 3D printer

Ability3D’s booth. Developing a home metal powder 3D printer

Cardboard pinball kits, with options to add arduino, electronics, servo, etc. There's going to be an upcoming kickstarter campaign.

Cardboard pinball kits, with options to add arduino, electronics, servo, etc. There’s going to be an upcoming kickstarter campaign.