2 Likes
Here’s a beautiful house made with ChatGPT:
Code:
# Load the SketchUp Ruby API module
require 'sketchup.rb'
# Create a new model
model = Sketchup.active_model
entities = model.entities
# Define some points to create a rectangle
pt1 = Geom::Point3d.new(0, 0, 0)
pt2 = Geom::Point3d.new(10, 0, 0)
pt3 = Geom::Point3d.new(10, 10, 0)
pt4 = Geom::Point3d.new(0, 10, 0)
# Create the rectangle face
face = entities.add_face(pt1, pt2, pt3, pt4)
# Extrude the face into a 3D object
height = 5
vector = Geom::Vector3d.new(0, 0, height)
face.pushpull(vector.length)
# Define some points to create a triangle
pt5 = Geom::Point3d.new(0, 10, height)
pt6 = Geom::Point3d.new(5, 15, height)
pt7 = Geom::Point3d.new(10, 10, height)
# Create the triangle face
roof_face = entities.add_face(pt5, pt6, pt7)
# Extrude the face into a 3D object
roof_height = 2
roof_vector = Geom::Vector3d.new(0, 0, roof_height)
roof_face.pushpull(roof_vector.length)
# Save the model
model.save('new_model_with_roof.skp')
It doesn’t look as good from the side:
5 Likes