Blender generated STL files not showing up in snapmaker luban 4.7

I created an object in blender using Python. The file shows up on viewers and other software but not on snapmaker luban
disk_with_hole_rim_and_boxes.stl (57.3 KB)
. The code looks like it’s all in binary so I don’t even know what to make of it. Any help would be appreciated.

Thank you

It’s pretty small. Did you try scaling it up 10 000%?

that’s the problem. I’m a newb at this. I used chatGpt to come up with the python code. thanks for that, need to poke thru code and see where my original size settings went awry.

Code might be fine as it is. Just change your unit scale in blender and then save a new startup file.

or maybe you need to tell chat GPT that you want another unit scale…

1 Like

It’s set to meters in my scene properties. Which is in line with the code that I have. What’s outputted and shows up on snapmaker luban is something which is basically one by two millimeters in size


Yes but your unit scale is 1.0 right? You need to change it to 0.001 for the scales to match…

That looks like it could be it. We’ll give it a try

dint work.
here my python script
import bpy
import math

Function to create a cylinder

def create_cylinder(name, radius, depth, location, vertices=32):
bpy.ops.mesh.primitive_cylinder_add(
radius=radius,
depth=depth,
location=location,
vertices=vertices)
obj = bpy.context.active_object
obj.name = name
return obj

Function to create a ring

def create_ring(name, outer_radius, inner_radius, depth, location, vertices=32):
outer_cylinder = create_cylinder(name + “_outer”, outer_radius, depth, location, vertices)
inner_cylinder = create_cylinder(name + “_inner”, inner_radius, depth, location, vertices)

bpy.context.view_layer.objects.active = outer_cylinder
bpy.ops.object.modifier_add(type='BOOLEAN')
outer_cylinder.modifiers['Boolean'].object = inner_cylinder
outer_cylinder.modifiers['Boolean'].operation = 'DIFFERENCE'
bpy.ops.object.modifier_apply(modifier='Boolean')

bpy.ops.object.select_all(action='DESELECT')
inner_cylinder.select_set(True)
bpy.ops.object.delete()

return outer_cylinder

Delete all mesh objects

bpy.ops.object.select_all(action=‘DESELECT’)
bpy.ops.object.select_by_type(type=‘MESH’)
bpy.ops.object.delete()

Blender uses meters, but 1 inch = 0.0254 meters

main_disk_radius = 11 * 0.0254 / 2
main_disk_height = 1 * 0.0254

rim_outer_radius = main_disk_radius
rim_inner_radius = rim_outer_radius - 0.25 * 0.0254
rim_height = 4 * 0.0254

hole_radius = 0.75 * 0.0254 / 2
hole_height = main_disk_height + rim_height

Create the main disk

main_disk = create_cylinder(“main_disk”, main_disk_radius, main_disk_height, (0, 0, main_disk_height / 2))

Create the rim ring with 24 faces

rim_ring = create_ring(“rim_ring”, rim_outer_radius, rim_inner_radius, rim_height, (0, 0, main_disk_height + rim_height / 2), vertices=24)

Create the hole cylinder

hole_cylinder = create_cylinder(“hole_cylinder”, hole_radius, hole_height, (0, 0, (main_disk_height + hole_height) / 2))

Add the rim to the main disk

bpy.context.view_layer.objects.active = main_disk
bpy.ops.object.modifier_add(type=‘BOOLEAN’)
main_disk.modifiers[‘Boolean’].object = rim_ring
main_disk.modifiers[‘Boolean’].operation = ‘UNION’
bpy.ops.object.modifier_apply(modifier=‘Boolean’)

Cut hole in the resulting disk

bpy.context.view_layer.objects.active = main_disk
bpy.ops.object.modifier_add(type=‘BOOLEAN’)
main_disk.modifiers[‘Boolean’].object = hole_cylinder
main_disk.modifiers[‘Boolean’].operation = ‘DIFFERENCE’
bpy.ops.object.modifier_apply(modifier=‘Boolean’)

Delete the hole_cylinder and rim_ring

bpy.ops.object.select_all(action=‘DESELECT’)
hole_cylinder.select_set(True)
rim_ring.select_set(True)
bpy.ops.object.delete()

Now we need to export the object as STL

bpy.ops.object.select_all(action=‘DESELECT’)
main_disk.select_set(True)
bpy.ops.export_mesh.stl(filepath=“C:/Users/Baron/Documents/disk_with_hole_and_rim.stl”)

I’m having GBT change the code to scale it up by 1000

After 0.001 unit scale is applied. Blender will use millimeters not meters as standard unit.

I think maybe you need to think in millimeters in your code. So it should be 25.4 in your example :slightly_smiling_face:

ok will try, thx, you’ve been very helpful

No problem!

Maybe you should be using OPENScad instead of phyton+blender?

I had similar issue w/ .stl file generated by my granddaughter from some software she used at a Girl Scout camp. In the end, I discovered this (and seems this is relevant to your situation):

Luban is constrained to import .stl files with units set to mm. I.e., it will interpret all dims as mm no mater how or what the .stl export software intended. When I found this info (on some forum) and had my granddaughter re-export her .stl with units set to mm, and it subsequently imported to Luban as expected. Turns out that initially, she had exported it with units set to inches - and Luban was importing as mm so there was a 25.4x reduction in apparent “size” of the model!

Hope that is useful.

Gonna try that right now.