How to convert the python code to Julia

Thanks,
I tried using below code for rotating the object which is working fine.

using FileIO
using GeometryBasics

rotate_x(point::GeometryBasics.Point{3, Float32}, angle_deg::Float64) = GeometryBasics.Point3f(
    point[1],
    cos(deg2rad(angle_deg)) * point[2] - sin(deg2rad(angle_deg)) * point[3],
    sin(deg2rad(angle_deg)) * point[2] + cos(deg2rad(angle_deg)) * point[3]
)

function rotate_stl(input_file::String, output_file::String, rotation_angle_x::Float64)
    println("Processing STL file: $input_file")
    mesh = load(input_file)
    rotated_vertices = [rotate_x(v.position, rotation_angle_x) for v in GeometryBasics.coordinates(mesh)]
    save(output_file, GeometryBasics.Mesh(rotated_vertices, GeometryBasics.faces(mesh)))
    println("Rotated STL saved to: $output_file")
end

rotate_stl(
    "LowerJaw.stl",
    "rotated_lower_jaw.stl",
    90.0
)

Below is the output of rotated_lower_jaw.stl:

Please help with the slice / remove the bottom area of the 3d object Lower jaw teeth inside the stl file.

thanks and regards

1 Like